/* From the Open Items prototype (reference/open-items-page.html), plus desk additions at the end. */
/* Layout: one narrow column ordered by who acts next. Waiting on you first, then what Claude
   is doing, then Claude's backlog, parked and done. Streams are a filter, not the structure. */
:root {
  --bg: #f5f6f4;
  --surface: #ffffff;
  --line: #dde1dc;
  --ink: #17201b;
  --ink-2: #4f5a53;
  --ink-3: #7f8a83;
  --accent: #0b6e4f;
  --accent-soft: #e2f1ea;
  --wait: #8a5a0b;
  --wait-soft: #fbf1df;
  --work: #1f5fa8;
  --work-soft: #e3edf9;
  --alert: #b42318;
  --alert-soft: #fde8e6;
  --font-body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101512; --surface: #18201b; --line: #2a342e; --ink: #e8eee9; --ink-2: #aab5ad;
    --ink-3: #75817a; --accent: #4cc596; --accent-soft: #163327; --wait: #f0b35a; --wait-soft: #33270f;
    --work: #7fb2ef; --work-soft: #182a40; --alert: #ff8a7a; --alert-soft: #3a1b17;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101512; --surface: #18201b; --line: #2a342e; --ink: #e8eee9; --ink-2: #aab5ad;
  --ink-3: #75817a; --accent: #4cc596; --accent-soft: #163327; --wait: #f0b35a; --wait-soft: #33270f;
  --work: #7fb2ef; --work-soft: #182a40; --alert: #ff8a7a; --alert-soft: #3a1b17;
  color-scheme: dark;
}
body { background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.45; }
.wrap {
  max-width: 760px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 20px 56px;
  display: flex; flex-direction: column; gap: 18px;
}
header { display: flex; flex-direction: column; gap: 6px; }
.top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.live { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.live.on .dot { background: var(--accent); }
.summary { font-size: 15px; color: var(--ink); }
.summary b { font-weight: 700; }
.checker { font-size: 13px; color: var(--ink-2); }
.checker.stale { color: var(--alert); }
h2 { margin: 0; font-size: 18px; font-weight: 700; display: flex; gap: 8px; align-items: baseline; text-wrap: balance; }
h3 { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.n { font-family: var(--font-mono); font-size: 12px; font-weight: 400; letter-spacing: 0; color: var(--ink-3); }
.lead { margin: 0; font-size: 13px; color: var(--ink-2); }

.search { width: 100%; box-sizing: border-box; font: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--surface); color: var(--ink); }
.filter { display: flex; flex-direction: column; gap: 6px; }
.streams { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit; font-size: 13px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 999px; padding: 6px 12px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center;
}
.chip .c { font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.updates { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; font-size: 14px; border: 1px solid var(--work); background: var(--work-soft); color: var(--work); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.updates b { font-weight: 700; }
.jumps { display: flex; flex-wrap: wrap; gap: 6px; }
.jump { font: inherit; font-size: 13px; border: 1px solid var(--work); background: var(--surface); color: var(--work); border-radius: 999px; padding: 4px 10px; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jump.all { background: var(--work); color: var(--surface); }
.recent { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: var(--ink-2); }
.moved-label { font-size: 12px; font-weight: 700; color: var(--work); }
.card.moved { border-style: dashed; }
.summary-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }

.section { display: flex; flex-direction: column; gap: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.group { display: flex; flex-direction: column; gap: 8px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.card.flag { border-color: var(--alert); }
.card.changed { outline: 2px solid var(--work); outline-offset: 2px; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 12px; color: var(--ink-2); }
.stream-tag { font-weight: 600; color: var(--ink); }
.where { font-weight: 600; color: var(--accent); }
.find { font-size: 12px; color: var(--ink-2); }
.find b { font-weight: 600; color: var(--ink); }
.text { overflow-wrap: anywhere; font-weight: 500; }
.note { font-size: 13px; border-radius: 6px; padding: 6px 8px; overflow-wrap: anywhere; }
.note.wait { color: var(--wait); background: var(--wait-soft); }
.note.work { color: var(--work); background: var(--work-soft); }
.note.alert { color: var(--alert); background: var(--alert-soft); }
.note.calm { color: var(--ink-2); background: var(--bg); }
.note.ok { color: var(--accent); background: var(--accent-soft); }
.note b { font-weight: 700; }
.note .when { font-family: var(--font-mono); font-size: 11px; opacity: 0.8; margin-left: 6px; }
.suggest { font-size: 14px; color: var(--ink-2); }
.suggest b { color: var(--ink); font-weight: 600; }
.draft { border: 1px solid var(--line); border-radius: 8px; background: var(--bg); padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.draft .label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.draft .body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.draft .edited { font-size: 12px; color: var(--work); }
details.more summary { cursor: pointer; font-size: 13px; color: var(--accent); font-weight: 600; list-style: none; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::before { content: "▸ "; }
details.more[open] summary::before { content: "▾ "; }
.context { font-size: 14px; color: var(--ink-2); white-space: pre-line; overflow-wrap: anywhere; margin-top: 6px; }
.context a { color: var(--accent); }
.missing { font-size: 13px; color: var(--ink-3); font-style: italic; margin-top: 6px; }
.answered { font-size: 14px; overflow-wrap: anywhere; }
.answered b { font-weight: 600; }
.history { font-size: 13px; color: var(--ink-2); display: flex; flex-direction: column; gap: 2px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { font: inherit; font-size: 13px; font-weight: 600; border-radius: 6px; padding: 6px 12px; cursor: pointer; border: 1px solid var(--line); background: transparent; color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.btn.option { border-color: var(--accent); color: var(--accent); }
.btn.quiet { color: var(--ink-2); }
.btn:disabled { opacity: 0.5; cursor: default; }
textarea, select { font: inherit; width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 6px; padding: 8px; background: var(--bg); color: var(--ink); }
textarea { min-height: 80px; resize: vertical; }
.editor { display: flex; flex-direction: column; gap: 6px; }
.editor .hint { font-size: 12px; color: var(--ink-2); }

.rows { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.row { padding: 10px 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.row:first-child { border-top: 0; }
.row .text { font-size: 14px; font-weight: 400; }
.row.changed { outline: 2px solid var(--work); outline-offset: -2px; }
details.fold > summary { cursor: pointer; list-style: none; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary h2::before { content: "▸"; font-size: 12px; }
details.fold[open] > summary h2::before { content: "▾"; }
details.fold[open] > .rows { margin-top: 10px; }
.empty { color: var(--ink-3); font-size: 14px; }

.add { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.add summary { cursor: pointer; font-weight: 600; color: var(--accent); list-style: none; }
.add summary::-webkit-details-marker { display: none; }
.add form { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.add .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .add .two { grid-template-columns: 1fr; } }
.add label { font-size: 12px; color: var(--ink-2); display: flex; flex-direction: column; gap: 4px; }

.foot { font-size: 13px; color: var(--ink-2); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--bg); border-radius: 8px; padding: 10px 14px; font-size: 14px; display: flex; gap: 14px; align-items: center; max-width: calc(100% - 32px); }
.toast button { font: inherit; font-weight: 700; color: var(--bg); background: none; border: 0; text-decoration: underline; cursor: pointer; }

/* ---- desk additions ---- */
.health { font-size: 13px; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.health.bad { color: var(--alert); font-weight: 600; }
.newbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; font: inherit; font-size: 14px; font-weight: 600; border: 1px solid var(--work); background: var(--work-soft); color: var(--work); border-radius: 8px; padding: 10px 12px; cursor: pointer; text-align: left; }
.events { font-size: 12px; color: var(--ink-2); display: flex; flex-direction: column; gap: 3px; margin-top: 8px; font-family: var(--font-mono); }
.closedSearch { align-self: flex-start; }
.foot a, .foot button.link { color: var(--accent); background: none; border: 0; font: inherit; padding: 0; cursor: pointer; text-decoration: underline; }
/* Login page */
.login { max-width: 420px; margin: 12vh auto 0; padding: 0 16px; display: flex; flex-direction: column; gap: 14px; }
.login input { font: inherit; width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--surface); color: var(--ink); letter-spacing: 0.08em; }
.login .err { color: var(--alert); font-size: 14px; }
.login .btn { padding: 10px 14px; font-size: 15px; }
body { margin: 0; }
.draft .edited.warn { color: var(--alert); font-weight: 600; }
