/* stream.css — capture, filters, paths, task rows, drag, history, settings */

/* ── capture (a calm bar fixed to the bottom — thumb-reachable) ── */
.capture {
  position: fixed; left: 0; right: 0;
  bottom: calc(44px + env(safe-area-inset-bottom));   /* sits just above the momentum footer */
  z-index: 30;
  padding: 8px 16px 10px;
  background: linear-gradient(to top, var(--paper) 74%, transparent);
}
.capture-inner {
  max-width: 760px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 4px 14px;
  box-shadow: var(--shadow);
  transition: border-color 0.3s var(--ease);
}
.capture-inner:focus-within { border-color: var(--sage-line); }
.capture-mark { color: var(--stone); font-size: 1.1rem; opacity: 0.7; flex-shrink: 0; }
.capture-input {
  flex: 1;
  background: transparent; border: none;
  padding: 10px 0;
  font-size: 1rem; font-weight: 300;
  resize: none; color: var(--ink); line-height: 1.5;
  overflow: hidden; max-height: 160px;
}
.capture-input:focus { outline: none; }
.capture-input::placeholder { color: var(--ink-faint); font-weight: 300; font-family: 'Noto Serif SC', serif; letter-spacing: 0.14em; }

/* ── controls ── */
.stream-controls { margin-bottom: 14px; }
.search-input {
  width: 100%; background: transparent; border: none;
  border-bottom: 1px solid var(--line); padding: 8px 4px; font-size: 0.95rem; font-weight: 300;
}
.search-input:focus { outline: none; border-bottom-color: var(--sage-line); }
.search-input::placeholder { color: var(--ink-faint); }

.filter-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.date-filter { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.date-filter .seg {
  padding: 5px 13px; font-size: 0.82rem; color: var(--ink-faint); transition: all 0.25s var(--ease);
}
.date-filter .seg.active { background: var(--sage); color: var(--ink); }
.date-filter .seg:hover:not(.active) { color: var(--ink-soft); }

.chip-toggle {
  padding: 5px 13px; border-radius: 999px; border: 1px solid var(--line);
  color: var(--ink-faint); font-size: 0.82rem; transition: all 0.25s var(--ease);
}
.chip-toggle.active { background: var(--stone); color: var(--paper); border-color: var(--stone); }
.chip-toggle:hover:not(.active) { color: var(--ink-soft); border-color: var(--sage-line); }

/* ── path chips (colored groups) ── */
.path-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.path-chip {
  padding: 5px 12px 5px 10px; border-radius: 999px; border: 1px solid var(--line);
  color: var(--ink-soft); font-size: 0.84rem; display: inline-flex; align-items: center; gap: 7px;
  transition: all 0.25s var(--ease);
}
.path-chip .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.path-chip.active { color: var(--ink); border-color: transparent; }
.path-chip:hover:not(.active) { border-color: var(--sage-line); color: var(--ink); }

/* ── draw button (quiet, minimal) ── */
.draw-bar { margin: 2px 0 18px; display: flex; justify-content: center; }
.draw-btn {
  padding: 9px 22px; border-radius: 999px;
  background: transparent; color: var(--ink-soft);
  border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-size: 0.92rem; letter-spacing: 0.08em; font-weight: 300;
  transition: all 0.3s var(--ease);
}
.draw-btn:hover { color: var(--ink); border-color: var(--sage-line); background: var(--card); }
.draw-btn:active { transform: scale(0.98); }
.draw-btn.solo { padding: 11px 26px; }
.draw-glyph { font-size: 1.05rem; opacity: 0.85; }
.draw-scope { font-size: 0.74rem; opacity: 0.5; font-weight: 300; letter-spacing: 0.03em; }

/* ── task list / sections ── */
.task-list { display: flex; flex-direction: column; gap: 16px; }
.task-group { display: flex; flex-direction: column; gap: 8px; }
.group-head {
  display: flex; align-items: center; gap: 8px;
  font-family: 'Noto Serif SC', serif; font-size: 0.82rem; color: var(--ink-faint);
  letter-spacing: 0.1em; text-transform: uppercase; padding: 2px 2px 0;
}
.group-head .count { opacity: 0.7; }
.group-head .line { flex: 1; height: 1px; background: var(--line); }

/* ── task row ── */
.task-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 14px 12px 12px;
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--row-accent, transparent);
  border-radius: var(--radius-sm);
  transition: background 0.25s var(--ease), border-color 0.25s var(--ease), box-shadow 0.2s var(--ease), transform 0.05s linear;
  position: relative; overflow: visible;        /* visible so popovers can float out */
  user-select: none; -webkit-user-select: none; /* so dragging from the body doesn't select text */
}
.task-row.just-added { animation: just-added 1.4s var(--ease); }
@keyframes just-added { 0% { background: var(--sage); } 100% { background: var(--card); } }
.task-row:hover { background: var(--card-2); box-shadow: var(--shadow); }
.task-row.is-done { opacity: 0.5; }
.task-row.is-done .task-text { text-decoration: line-through; }
.task-row.resting { opacity: 0.55; }
.task-row.dragging {
  box-shadow: 0 18px 44px rgba(0,0,0,0.55); background: var(--card-solid);
  border-color: var(--sage-line); z-index: 30; cursor: grabbing;
  transition: box-shadow 0.2s var(--ease); opacity: 0.98;
  touch-action: none;
}
.task-row.dragging .task-fill { opacity: 0.4; }
.task-row.expanded { background: var(--card-2); }

.task-row .task-fill {
  position: absolute; left: 0; top: 0; bottom: 0; background: var(--sage); z-index: 0;
  border-radius: var(--radius-sm);
  transition: width 0.6s var(--ease);
}
.task-row.over .task-fill { background: rgba(74,107,122,0.22); }
.task-row > * { position: relative; z-index: 1; }

.drag-handle {
  width: 20px; flex-shrink: 0; color: var(--ink-faint); font-size: 1rem;
  cursor: grab; touch-action: none; text-align: center; line-height: 1; user-select: none;
  opacity: 0.5; transition: opacity 0.2s;
}
.drag-handle:hover { opacity: 1; }

.task-check {
  width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid var(--ink-faint); flex-shrink: 0;
  transition: all 0.25s var(--ease); display: grid; place-items: center; font-size: 0.7rem; color: transparent;
}
.task-check:hover { border-color: var(--ink); }
.task-row.is-done .task-check { background: var(--stone); border-color: var(--stone); color: var(--paper); }

.task-body { flex: 1; min-width: 0; }
.task-text { font-weight: 300; font-size: 0.98rem; word-break: break-word; cursor: text; }
.task-text.editing {
  width: 100%; background: transparent; border: none;
  border-bottom: 1px solid var(--sage-line); color: var(--ink);
  font-weight: 300; font-size: 0.98rem; padding: 0 0 2px;
  user-select: text; -webkit-user-select: text;
}
.task-text.editing:focus { outline: none; }
.task-sub { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 3px; font-size: 0.73rem; color: var(--ink-faint); align-items: center; }
.task-paths { display: inline-flex; gap: 4px; align-items: center; cursor: pointer; padding: 2px 0; transition: opacity 0.2s; }
.task-paths:hover { opacity: 0.7; }
.task-paths .dot { width: 8px; height: 8px; border-radius: 50%; }
.task-paths .addpath { color: var(--ink-faint); border: 1px dashed var(--line); border-radius: 999px; padding: 1px 8px; font-size: 0.7rem; }
.task-est { font-variant-numeric: tabular-nums; }
.task-when { color: var(--ink-faint); }
.task-resting-badge { color: var(--stone); }

/* progress dots (one per completed span) */
.task-dots { display: inline-flex; gap: 3px; align-items: center; }
.task-dots .pd { width: 5px; height: 5px; border-radius: 50%; background: var(--stone); opacity: 0.8; }
.task-dots .pd.more { width: auto; height: auto; border-radius: 0; background: none; color: var(--ink-faint); font-size: 0.7rem; }

.task-pin, .task-play {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line-soft);
  color: var(--ink-soft); flex-shrink: 0; display: grid; place-items: center; font-size: 0.8rem;
  transition: all 0.25s var(--ease);
}
/* dim only when the task is NOT in Now; in-Now (and being-done) buttons stay bright */
.task-pin.dim, .task-play.dim { opacity: 0.4; }
.task-pin:hover, .task-play:hover { opacity: 1; }
.task-pin:hover { color: var(--ink); border-color: var(--sage-line); }
.task-pin.pinned { color: var(--yang-c); border-color: var(--yang-c); }
.task-play:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* small tappable bits inside the sub line (estimate, dots, ⋯) */
.sub-btn { color: var(--ink-faint); cursor: pointer; transition: color 0.2s; }
.sub-btn:hover { color: var(--ink); }
.info-trig { font-size: 0.95rem; line-height: 1; padding: 0 4px; }

/* ── floating popovers on the ticket (paths / info) ── */
.ticket-pop {
  position: absolute; left: 38px; top: calc(100% - 4px); z-index: 40;
  min-width: 210px; max-width: min(280px, 80vw);
  background: var(--card-solid); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 8px; display: flex; flex-direction: column; gap: 6px;
  animation: pop-in 0.18s var(--ease); user-select: none;
}
@keyframes pop-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.pop-input {
  background: transparent; border: none; border-bottom: 1px solid var(--line);
  padding: 6px 4px; font-size: 0.9rem; color: var(--ink); width: 100%;
}
.pop-input:focus { outline: none; border-bottom-color: var(--sage-line); }
.pop-list { display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow-y: auto; }
.pop-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: var(--radius-sm);
  color: var(--ink-soft); font-size: 0.86rem; text-align: left; transition: background 0.15s;
}
.pop-item:hover { background: var(--card-2); color: var(--ink); }
.pop-item .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.pop-item .nm { flex: 1; }
.pop-item .chk { color: var(--stone); }
.pop-item.on { color: var(--ink); }
.pop-item.create { color: var(--stone); font-style: italic; }
.pop-row {
  text-align: left; padding: 8px; border-radius: var(--radius-sm);
  color: var(--ink-soft); font-size: 0.86rem; transition: background 0.15s;
}
.pop-row:hover { background: var(--card-2); color: var(--ink); }
.pop-row.danger:hover { color: var(--danger); }
.pop-hh { color: var(--ink-faint); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; padding: 4px 8px 0; }
.pop-hist { display: flex; flex-direction: column; gap: 2px; max-height: 160px; overflow-y: auto; }
.pop-hist-row { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; padding: 3px 8px; border-bottom: 1px solid var(--line-soft); }

/* ── expanded detail / history ── */
.task-detail {
  flex-basis: 100%; order: 99; margin-top: 8px; padding-top: 10px;
  border-top: 1px dashed var(--line); font-size: 0.8rem; color: var(--ink-soft);
  display: flex; flex-direction: column; gap: 10px; animation: fade-in 0.3s var(--ease);
}
.detail-name {
  width: 100%; background: transparent; border: none; border-bottom: 1px solid var(--line);
  color: var(--ink); font-size: 0.98rem; font-weight: 300; padding: 4px 2px;
}
.detail-name:focus { outline: none; border-bottom-color: var(--sage-line); }
.detail-btn.on { color: var(--yang-c); border-color: var(--yang-c); }
.detail-meta { display: flex; flex-wrap: wrap; gap: 12px; color: var(--ink-faint); }

/* path editor (shared by the row and the detail) */
.path-editor {
  flex-basis: 100%; order: 98; margin-top: 8px; padding-top: 10px;
  border-top: 1px dashed var(--line);
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  animation: fade-in 0.25s var(--ease);
}
.detail-paths { display: flex; flex-wrap: wrap; gap: 6px; }
.detail-path-chip {
  font-size: 0.76rem; padding: 4px 11px; border-radius: 999px;
  display: inline-flex; gap: 6px; align-items: center;
  border: 1px solid var(--line); color: var(--ink-soft); cursor: pointer;
  transition: all 0.2s var(--ease);
}
.detail-path-chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.detail-path-chip.on { color: var(--ink); border-color: transparent; }
.detail-path-chip.off { opacity: 0.55; }
.detail-path-chip.off:hover { opacity: 1; border-color: var(--sage-line); }
.detail-add-path input {
  background: transparent; border: none; border-bottom: 1px solid var(--line);
  width: 96px; font-size: 0.78rem; padding: 3px 2px; color: var(--ink);
}
.detail-add-path input:focus { outline: none; border-bottom-color: var(--sage-line); }
.detail-history { display: flex; flex-direction: column; gap: 4px; }
.detail-history .hh { color: var(--ink-faint); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; }
.detail-span-row { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; padding: 2px 0; border-bottom: 1px solid var(--line-soft); }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.detail-btn { padding: 6px 13px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-soft); font-size: 0.82rem; transition: all 0.25s var(--ease); }
.detail-btn:hover { color: var(--ink); border-color: var(--sage-line); }
.detail-btn.danger:hover { color: var(--danger); border-color: var(--danger); }
.detail-add-path { display: inline-flex; gap: 6px; align-items: center; }
.detail-add-path input { background: transparent; border: none; border-bottom: 1px solid var(--line); width: 90px; font-size: 0.78rem; padding: 2px 0; }
.detail-add-path input:focus { outline: none; border-bottom-color: var(--sage-line); }

.empty-state {
  text-align: center; color: var(--ink-faint); font-weight: 300;
  padding: 56px 20px 30px; font-family: 'Noto Serif SC', serif;
}
.empty-state .big { font-size: 2.4rem; display: block; margin-bottom: 10px; color: var(--ink-soft); letter-spacing: 0.1em; }
.empty-state[hidden] { display: none; }

/* ── settings ── */
.settings-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); backdrop-filter: blur(2px);
  z-index: 80; display: flex; justify-content: flex-end; animation: fade-in 0.3s var(--ease);
}
.settings-overlay[hidden] { display: none; }
.settings-drawer {
  width: min(380px, 88vw); background: var(--card-solid); height: 100%; padding: 22px;
  overflow-y: auto; box-shadow: -8px 0 40px rgba(0,0,0,0.4); animation: slide-in 0.4s var(--ease);
}
@keyframes slide-in { from { transform: translateX(40px); opacity: 0.6; } to { transform: translateX(0); opacity: 1; } }
.settings-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.settings-head h2 { font-size: 1.2rem; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; font-size: 0.92rem; color: var(--ink-soft); }
.set-note { font-size: 0.74rem; color: var(--ink-faint); padding: 0 0 6px; line-height: 1.5; }
.set-divider { height: 1px; background: var(--line); margin: 12px 0; }
.set-paths-row { flex-direction: column; align-items: stretch; }
.settings-paths { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.settings-path { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); font-size: 0.88rem; }
.settings-path .dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; cursor: pointer; }
.settings-path .name { flex: 1; }
.settings-path .count { color: var(--ink-faint); font-size: 0.78rem; }
.settings-path .del { color: var(--ink-faint); padding: 2px 6px; }
.settings-path .del:hover { color: var(--danger); }
.set-add-path { display: flex; gap: 8px; margin-top: 8px; }
.set-add-path input { flex: 1; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 7px 10px; background: var(--paper); }
.set-add-path button, .set-data-btns button {
  padding: 7px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink-soft); transition: all 0.25s var(--ease);
}
.set-add-path button:hover, .set-data-btns button:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.set-data-btns { display: flex; gap: 8px; margin: 4px 0 8px; }
.set-data-btns button { flex: 1; }

/* ════════ v8 additions ════════ */

/* bidi: each task/name/note reads in its own direction (Hebrew/English mix) */
.task-text, .task-text.editing, .path-card-name, .pop-note-input, .capture-input { unicode-bidi: plaintext; }

/* ── priority hex (tap a line to set 1–6) ── */
.prio-hex {
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
  width: 18px; flex-shrink: 0; align-self: center; padding: 0 1px; cursor: pointer;
}
.hx-line { display: flex; gap: 3px; height: 5px; align-items: center; background: none; }
.hx-line .seg { height: 2.5px; border-radius: 1px; flex: 1; background: var(--ink-faint); opacity: 0.4; transition: all 0.2s var(--ease); }
.hx-line.yang .seg { background: var(--stone); opacity: 1; }
.hx-line:hover .seg { opacity: 0.9; }
.task-row.is-done .prio-hex { opacity: 0.4; }

/* ── note marker + notes textarea ── */
.task-note { font-size: 0.82rem; }
.pop-note-input {
  width: 100%; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 8px 10px; font-size: 0.85rem; color: var(--ink); resize: none; line-height: 1.5;
  min-height: 40px; max-height: 260px; overflow-y: auto;
}
.pop-note-input:focus { outline: none; border-color: var(--sage-line); }
.info-pop { min-width: 240px; }

/* ── tri-state path filter chips ── */
.path-chip.include { color: var(--ink); border-color: transparent; }
.path-chip.exclude { color: var(--ink-faint); border-color: var(--line); opacity: 0.7; }
.path-chip.exclude span:last-child { text-decoration: line-through; }
.path-chip.exclude .dot { opacity: 0.35; }

/* ── ink-dissolve when sealing from the Stream ── */
.task-row.dissolving { animation: ink-dissolve 0.6s var(--ease) forwards; pointer-events: none; z-index: 2; }
@keyframes ink-dissolve {
  0%   { opacity: 1; filter: blur(0) brightness(1); transform: scale(1); }
  45%  { opacity: 0.75; filter: blur(2px) brightness(0.8); }
  100% { opacity: 0; filter: blur(8px) brightness(0.5); transform: scale(0.99); }
}

/* ── popover flips above the row when the keyboard would clip it ── */
.ticket-pop.flip-up { top: auto; bottom: calc(100% - 4px); }

/* ── Paths page ── */
.path-card {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 13px 14px; background: var(--card);
  border: 1px solid var(--line-soft); border-left: 3px solid var(--row-accent, transparent);
  border-radius: var(--radius-sm); margin-bottom: 8px;
}
.path-card.submerged { opacity: 0.6; }
.path-card-dot { flex-shrink: 0; padding: 2px; }
.path-card-dot .dot.big { width: 16px; height: 16px; border-radius: 50%; }
.path-card-body { flex: 1; min-width: 55%; }
.path-card-name { font-size: 1rem; font-weight: 300; cursor: text; word-break: break-word; }
.path-card-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 0.74rem; color: var(--ink-faint); margin-top: 3px; }
.path-card-draw {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line);
  color: var(--ink-soft); font-size: 1rem; flex-shrink: 0; transition: all 0.25s var(--ease);
}
.path-card-draw:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.path-card-act { font-size: 0.78rem; color: var(--ink-faint); padding: 6px 9px; border-radius: var(--radius-sm); flex-shrink: 0; transition: all 0.2s var(--ease); white-space: nowrap; }
.path-card-act:hover { color: var(--ink); background: var(--card-2); }
.path-card-act.danger:hover { color: var(--danger); }

/* ════════ v9 additions ════════ */

/* path chips ON the task (named, clearly tappable) */
.tp-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px 1px 5px; border-radius: 999px; background: var(--card-2); }
.tp-chip .dot { width: 7px; height: 7px; border-radius: 50%; }
.tp-name { font-size: 0.72rem; color: var(--ink-soft); }
.task-paths { gap: 5px; }

/* big priority picker (opened from the small card hex) */
.prio-pop { min-width: 170px; align-items: stretch; }
.prio-pop .pop-hh { text-align: center; padding-bottom: 4px; }
.prio-hex.big { width: 100%; gap: 6px; padding: 4px 2px; }
.prio-hex.big .hx-line { height: 22px; gap: 7px; border-radius: 4px; cursor: pointer; }
.prio-hex.big .hx-line:hover { background: var(--card-2); }
.prio-hex.big .seg { height: 7px; border-radius: 2px; }

/* mini hex in the path-items list */
.prio-hex.mini { width: 14px; gap: 1.5px; flex-shrink: 0; }
.prio-hex.mini .hx-line { height: 3px; gap: 2px; }
.prio-hex.mini .seg { height: 1.5px; }

/* ── Paths page: expandable card detail ── */
.path-card.expanded { background: var(--card-2); }
.path-chev { color: var(--ink-faint); }
.path-detail {
  flex-basis: 100%; order: 99; margin-top: 10px; padding-top: 10px;
  border-top: 1px dashed var(--line); display: flex; flex-direction: column; gap: 10px;
  animation: fade-in 0.25s var(--ease);
}
.path-items { display: flex; flex-direction: column; gap: 4px; }
.path-item {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 7px 9px; border-radius: var(--radius-sm); font-size: 0.88rem; color: var(--ink); font-weight: 300;
  background: var(--card); border: 1px solid var(--line-soft); transition: background 0.15s;
}
button.path-item:hover { background: var(--card-solid); }
.path-item.sealed { opacity: 0.5; background: none; border: none; padding: 4px 9px; }
.pi-name { flex: 1; word-break: break-word; unicode-bidi: plaintext; }
.pi-go { color: var(--ink-faint); font-size: 0.8rem; }
.path-feed { display: flex; flex-direction: column; gap: 1px; }
.feed-row { display: flex; gap: 10px; font-size: 0.78rem; padding: 3px 4px; border-bottom: 1px solid var(--line-soft); }
.feed-when { color: var(--ink-faint); white-space: nowrap; min-width: 78px; }
.feed-what { color: var(--ink-soft); word-break: break-word; unicode-bidi: plaintext; }
.feed-what.sealed { color: var(--stone); }

/* install row button */
#installRow button { padding: 7px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink-soft); transition: all 0.25s var(--ease); }
#installRow button:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ── import/export modal ── */
.io-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.55); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 18px;
  animation: fade-in 0.25s var(--ease);
}
.io-box {
  width: min(560px, 96vw); max-height: 88vh; display: flex; flex-direction: column; gap: 12px;
  background: var(--card-solid); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px;
}
.io-title { font-family: 'Noto Serif SC', serif; font-size: 1.1rem; color: var(--ink); }
.io-textarea {
  width: 100%; min-height: 200px; flex: 1; resize: vertical;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 12px; color: var(--ink); font-size: 0.82rem; line-height: 1.4;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.io-textarea:focus { outline: none; border-color: var(--sage-line); }
.io-note { font-size: 0.78rem; color: var(--ink-faint); }
.io-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.io-btn {
  padding: 9px 18px; border-radius: 999px; border: 1px solid var(--line);
  color: var(--ink-soft); font-size: 0.9rem; transition: all 0.25s var(--ease);
  display: inline-flex; align-items: center; cursor: pointer;
}
.io-btn:hover { color: var(--ink); border-color: var(--sage-line); }
.io-btn.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.io-btn.primary:hover { filter: brightness(1.1); }
.io-btn.ghost { border-style: dashed; margin-left: auto; }

/* ════════ v16 / phase-1 additions ════════ */

/* priority bar 'on' color → warm amber (was a cool tone) */
.hx-line.yang .seg { background: var(--yang-c); }
.prio-hex.big .hx-line:hover .seg { background: var(--yang-c); opacity: 0.6; }

/* 為 'do' action button — filled so it clearly reads as the action */
.task-play {
  font-family: 'Noto Serif SC', serif; font-size: 0.92rem; line-height: 1;
  background: var(--ink); color: var(--paper); border-color: var(--ink);
}
.task-play:hover { filter: brightness(1.12); background: var(--ink); color: var(--paper); }

/* open-item count on a path filter chip */
.chip-count { font-size: 0.7rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.path-chip.include .chip-count { color: var(--ink-soft); }

/* draw button shows its scope count on the Stream */
#drawScope { font-variant-numeric: tabular-nums; }

/* today summary modal */
.today-box { gap: 14px; }
.today-stats { display: flex; gap: 10px; }
.today-stat { flex: 1; text-align: center; background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 12px 6px; }
.ts-big { font-family: 'Noto Serif SC', serif; font-size: 1.5rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.ts-label { font-size: 0.72rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.1em; margin-top: 2px; }
.today-list { display: flex; flex-direction: column; gap: 2px; max-height: 40vh; overflow-y: auto; }
.today-row { display: flex; gap: 10px; justify-content: space-between; font-size: 0.86rem; padding: 6px 4px; border-bottom: 1px solid var(--line-soft); }
.today-row .tr-name { color: var(--ink-soft); word-break: break-word; }
.today-row .tr-when { color: var(--ink-faint); white-space: nowrap; }

/* ════════ v17 / phase-2 additions ════════ */

/* path popover header (input + done button) */
.pop-head { display: flex; gap: 8px; align-items: center; }
.pop-head .pop-input { flex: 1; }
.pop-done {
  flex-shrink: 0; padding: 6px 13px; border-radius: 999px;
  background: var(--sage); border: 1px solid var(--sage-line); color: var(--ink); font-size: 0.8rem;
}
.pop-done:hover { background: var(--card-2); }

/* path picker as a bottom sheet on phones (rides above the keyboard) */
.ticket-pop.as-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; top: auto;
  width: 100%; max-width: none; border-radius: 16px 16px 0 0; z-index: 60;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  box-shadow: 0 -12px 40px rgba(0,0,0,0.5); animation: sheet-up 0.25s var(--ease);
}
.ticket-pop.as-sheet .pop-list { max-height: 40vh; }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* big priority panel: swipe up/down to set */
.prio-hex.big { touch-action: none; }
.prio-hint { font-size: 0.72rem; color: var(--ink-faint); text-align: center; margin-top: 6px; }

/* draggable path cards */
.path-card .drag-handle { align-self: center; }
.path-card.dragging { box-shadow: 0 18px 44px rgba(0,0,0,0.55); background: var(--card-solid); border-color: var(--sage-line); z-index: 30; opacity: 0.98; touch-action: none; }

/* today modal: task paths + row layout */
.today-row { align-items: center; }
.tr-left { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.tr-paths { display: inline-flex; gap: 3px; flex-shrink: 0; }
.tr-paths .dot { width: 8px; height: 8px; border-radius: 50%; }
.set-row small { color: var(--ink-faint); font-size: 0.7rem; }

/* footer range label + today-list path chips */
.mo-range { font-family: 'Noto Serif SC', serif; color: var(--ink-faint); font-size: 0.74rem; }
.tr-left { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; flex-wrap: wrap; }
.tr-path { display: inline-flex; align-items: center; gap: 4px; font-size: 0.72rem; color: var(--ink-soft); background: var(--card-2); padding: 1px 8px; border-radius: 999px; }
.tr-path .dot { width: 7px; height: 7px; border-radius: 50%; }

/* ════════ Tide (swipe-triage) + repeat ════════ */
.tide-overlay {
  position: fixed; inset: 0; z-index: 90; background: var(--paper);
  display: flex; flex-direction: column; align-items: center;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); animation: fade-in 0.3s var(--ease);
}
.tide-overlay[hidden] { display: none; }
.tide-head { width: 100%; max-width: 520px; display: flex; align-items: center; gap: 10px; }
.tide-title { display: inline-flex; align-items: baseline; gap: 8px; }
.tide-glyph { font-family: 'Noto Serif SC', serif; font-size: 1.35rem; color: var(--ink); }
.tide-word { font-size: 0.95rem; color: var(--ink-soft); letter-spacing: 0.06em; }
.tide-count { color: var(--ink-faint); font-variant-numeric: tabular-nums; font-size: 0.85rem; }
.tide-close { margin-left: auto; width: 38px; height: 38px; border-radius: 50%; color: var(--ink-faint); font-size: 1.15rem; }
.tide-close:hover { color: var(--ink); background: var(--sage); }

/* stage: the card, two edge-hues that bloom as you drag, and side symbols */
.tide-stage { position: relative; width: 100%; max-width: 520px; flex: 1 1 auto; display: flex; align-items: center; justify-content: center; overflow: hidden; }
/* screen-edge wash — white on the right (now / yang), black on the left (stream / yin) */
.tide-edge { position: absolute; top: 0; bottom: 0; width: 44%; opacity: 0; pointer-events: none; z-index: 0; transition: opacity 0.18s var(--ease); }
.edge-now { right: 0; background: linear-gradient(to left, rgba(248,247,242,0.55), transparent 80%); }
.edge-stream { left: 0; background: linear-gradient(to right, rgba(0,0,0,0.5), transparent 80%); }
/* the symbol above the card, on the side it will go: white 今 right, black 〜 left */
.tide-cue {
  position: absolute; top: 4px; z-index: 2; opacity: 0.16;
  display: flex; flex-direction: column; align-items: center; gap: 2px; pointer-events: none;
  transition: opacity 0.18s var(--ease);
}
/* now = warm white (yang), stream = cool light (yin) — both legible on the dark overlay */
.cue-stream { left: 12px; color: #c2c8d2; text-shadow: 0 0 9px rgba(0,0,0,0.6); }
.cue-now { right: 12px; color: #f7f6f1; text-shadow: 0 0 8px rgba(0,0,0,0.5); }
.cue-glyph { font-family: 'Noto Serif SC', serif; font-size: 1.7rem; line-height: 1; }
.cue-word { font-size: 0.68rem; letter-spacing: 0.08em; }

.tide-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 440px; flex: 0 0 auto;
  background: var(--card-solid); border: 1px solid var(--line); border-radius: 28px;
  box-shadow: 0 14px 50px rgba(0,0,0,0.4); padding: 30px 26px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease), border-color 0.3s var(--ease);
  touch-action: none; cursor: pointer; user-select: none;   /* capture vertical drags (swipe-up to fulfill) ourselves */
}
.tide-card .prio-hex { width: 26px; }
.tide-card .hx-line { height: 7px; }
.tide-card .hx-line .seg { height: 3px; }
.tide-name { font-family: 'Noto Serif SC', serif; font-size: 1.5rem; font-weight: 300; text-align: center; color: var(--ink); line-height: 1.4; unicode-bidi: plaintext; }
.tide-meta { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.tide-path { display: inline-flex; align-items: center; gap: 5px; font-size: 0.78rem; color: var(--ink-soft); background: var(--card-2); padding: 2px 10px; border-radius: 999px; }
.tide-path .dot { width: 8px; height: 8px; border-radius: 50%; }
.tide-est { font-size: 0.76rem; color: var(--ink-faint); }
.tide-card.to-now { border-color: var(--yang-c); }
.tide-card.to-stream { border-color: var(--stone); }

.tide-hints { width: 100%; max-width: 460px; display: flex; justify-content: space-between; font-size: 0.74rem; color: var(--ink-faint); margin: 10px 0; }
.tide-hints .c { opacity: 0.7; }
.tide-btns { width: 100%; max-width: 460px; display: flex; gap: 6px; align-items: stretch; }
.tide-btn { padding: 12px 6px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-soft); font-size: 0.86rem; transition: all 0.25s var(--ease); white-space: nowrap; }
.tide-btn:hover { color: var(--ink); border-color: var(--sage-line); }
/* glyph-only actions stay compact; the worded now/seal take the room */
.tide-btn.t-snooze, .tide-btn.t-stream, .tide-btn.t-letgo { flex: 0 0 auto; min-width: 44px; font-size: 1rem; }
.tide-btn.t-now, .tide-btn.t-seal { flex: 1; }
.tide-btn.t-snooze { color: var(--ink-faint); }
.tide-btn.t-snooze:hover { color: var(--ink-soft); border-color: var(--line); }
.tide-btn.t-stream:hover { color: var(--stone); border-color: var(--stone); }
.tide-btn.t-now { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.tide-btn.t-now:hover { filter: brightness(1.08); }
.tide-btn.t-seal:hover { color: var(--sage-deep, var(--stone)); border-color: var(--stone); }
.tide-btn.t-letgo { color: var(--ink-faint); }
.tide-btn.t-letgo:hover { color: var(--danger); border-color: var(--danger); }

/* full-task editor living inside the Tide */
.tide-edit { width: 100%; max-width: 460px; flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 12px; }
.tide-edit-name {
  width: 100%; resize: none; border: none; background: transparent; color: var(--ink);
  font-family: 'Noto Serif SC', serif; font-size: 1.4rem; font-weight: 300; line-height: 1.4;
  padding: 6px 0 12px; border-bottom: 1px solid var(--line); margin-bottom: 14px; unicode-bidi: plaintext;
}
.tide-edit-name:focus { outline: none; border-bottom-color: var(--sage-line); }
.tide-prio { display: flex; justify-content: center; margin: 4px 0 6px; }
.tide-prio .prio-hex { width: 56px; }
.tide-prio .hx-line { height: 12px; cursor: pointer; }
/* the embedded info popover loses its floating-card chrome inside the sheet */
.tide-edit .ticket-pop.as-tide-edit { position: static; max-width: none; min-width: 0; width: 100%; box-shadow: none; border: none; background: transparent; padding: 0; }
.tide-done { width: 40px; height: 40px; border-radius: 50%; color: var(--ink-soft); display: inline-flex; align-items: center; justify-content: center; }
.tide-done:hover { color: var(--ink); background: var(--sage); }

/* ensō — the brushed done circle */
.enso { width: 22px; height: 22px; transform: rotate(-12deg); }
.pop-done .enso { width: 20px; height: 20px; }
.tide-done .enso { width: 24px; height: 24px; }

/* repeat controls in the info popover */
.repeat-opts { display: flex; gap: 6px; }
.rep-opt { flex: 1; padding: 6px 8px; border-radius: var(--radius-sm); border: 1px solid var(--line); color: var(--ink-soft); font-size: 0.82rem; }
.rep-opt.on { background: var(--sage); color: var(--ink); border-color: var(--sage-line); }
.repeat-days { display: flex; gap: 4px; margin-top: 6px; }
.day-chip { flex: 1; height: 30px; border-radius: var(--radius-sm); border: 1px solid var(--line); color: var(--ink-faint); font-size: 0.78rem; }
.day-chip.on { background: var(--stone); color: var(--paper); border-color: var(--stone); }
.pop-note-hint { font-size: 0.74rem; color: var(--ink-faint); }
.task-repeat { font-size: 0.82rem; }

/* ════════ batch: links · note preview · path wrap · edit z · now toggle ════════ */
/* clickable links inside task text / notes */
.tlink { color: var(--stone); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.tlink:hover { color: var(--ink); }

/* note preview — a thin soft strip with the start of the note */
.task-note-preview {
  margin-top: 5px; font-size: 0.75rem; color: var(--ink-faint); line-height: 1.4;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border-left: 2px solid var(--line); padding-left: 8px; cursor: text; unicode-bidi: plaintext;
}
.task-note-preview .tlink { color: var(--ink-faint); }

/* paths wrap rather than sliding under the now/do buttons */
.task-paths { flex-wrap: wrap; }

/* editing a name must float above the fixed capture bar (z-index 30) */
.task-text.editing {
  position: relative; z-index: 32; box-sizing: border-box;
  background: var(--card-solid); border-radius: 7px; padding: 4px 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.28);
}

/* now toggle inside the path popover header */
.pop-now { flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); color: var(--ink-soft); font-size: 0.82rem; transition: all 0.2s var(--ease); }
.pop-now:hover { color: var(--ink); border-color: var(--sage-line); }
.pop-now.on { color: var(--yang-c); border-color: var(--yang-c); }

/* do button active = the task currently held in flow */
.task-play.active { background: var(--yang-c); color: var(--paper); border-color: var(--yang-c); box-shadow: 0 0 0 3px rgba(201,164,94,0.18); }

/* draw-one-from-Now button in the group header */
.group-draw {
  width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line);
  color: var(--ink-soft); font-size: 0.8rem; line-height: 1; display: grid; place-items: center;
  flex-shrink: 0; transition: all 0.25s var(--ease); margin-left: 2px;
}
.group-draw:hover { color: var(--ink); border-color: var(--sage-line); background: var(--card-2); }
.path-chip .chip-count { opacity: 0.6; font-variant-numeric: tabular-nums; font-size: 0.78rem; }

/* priority hex: drag without the page scrolling underneath */
.prio-pop .prio-hex { touch-action: none; }

/* ════════ Tide overhaul: fluid drift · up-to-fulfill · trimmed buttons ════════ */
.tide-pause { font-size: 0.7rem; letter-spacing: -1px; }
/* seal (up) — a warm gold glow blooming from the top, with a ✓ at top-centre */
.edge-seal { left: 0; right: 0; top: 0; width: auto; height: 42%; bottom: auto;
  background: linear-gradient(to bottom, rgba(201,164,94,0.5), transparent 85%); }
.cue-seal { left: 50%; transform: translateX(-50%); top: 4px; color: #f0d9a3; text-shadow: 0 0 9px rgba(0,0,0,0.55); }
.tide-card.to-seal { border-color: var(--yang-c); }
.tide-card.dissolving-up { filter: blur(1.5px); }
/* each new card rises from beneath, like the next leaf surfacing */
.tide-card.rising { animation: tide-rise 0.36s var(--ease); }
@keyframes tide-rise { from { transform: translateY(26px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
/* trimmed to two taps; let them breathe, centred */
.tide-btns { justify-content: center; }
.tide-btn.t-snooze, .tide-btn.t-letgo { flex: 1; max-width: 190px; font-size: 0.9rem; }
.tide-btn.t-letgo { color: var(--ink-faint); }
.tide-btn.t-letgo:hover { color: var(--danger); border-color: var(--danger); }

/* ════════ settings: auto-tag magic words ════════ */
.set-row.set-col { flex-direction: column; align-items: stretch; gap: 4px; }
.magic-list { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 10px; }
.magic-empty { font-size: 0.78rem; color: var(--ink-faint); padding: 2px 0; }
.magic-rule { display: flex; align-items: center; gap: 8px; font-size: 0.86rem; color: var(--ink-soft); padding: 6px 10px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); }
.mr-word { unicode-bidi: plaintext; }
.mr-arrow { color: var(--ink-faint); }
.mr-path { display: inline-flex; align-items: center; gap: 6px; }
.mr-path .dot, .magic-path-btn .dot, .magic-path-opt .dot { width: 9px; height: 9px; border-radius: 50%; }
.mr-missing { color: var(--ink-faint); font-style: italic; }
.mr-del { margin-left: auto; color: var(--ink-faint); width: 24px; height: 24px; border-radius: 50%; font-size: 0.8rem; }
.mr-del:hover { color: var(--danger); }
.magic-add { display: flex; gap: 8px; align-items: center; }
.magic-word-input { flex: 1; min-width: 0; background: transparent; border: none; border-bottom: 1px solid var(--line); padding: 7px 4px; color: var(--ink); unicode-bidi: plaintext; }
.magic-word-input:focus { outline: none; border-bottom-color: var(--sage-line); }
.magic-path-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px dashed var(--line); color: var(--ink-soft); font-size: 0.84rem; flex-shrink: 0; }
.magic-add-btn { padding: 6px 14px; border-radius: 999px; background: var(--sage); border: 1px solid var(--sage-line); color: var(--ink); font-size: 0.84rem; flex-shrink: 0; }
.magic-path-menu { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.magic-path-menu[hidden] { display: none; }
.magic-path-opt { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-soft); font-size: 0.84rem; }
.magic-path-opt:hover { border-color: var(--sage-line); color: var(--ink); }
