/* 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(42px + env(safe-area-inset-bottom));
  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);
  color: var(--ink-soft); flex-shrink: 0; display: grid; place-items: center; font-size: 0.8rem;
  transition: all 0.25s var(--ease);
}
.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; }
