/* Today: the morning list. Zinc neutrals, square corners, one signal colour, no shadows.
   Dark mode is a token swap later (phase 4): every colour below is a variable. */
:root {
  --ink: #09090b;
  --secondary: #52525b;
  --muted: #71717a;
  --rule: #e4e4e7;
  --control: #d4d4d8;
  --surface: #ffffff;
  --band: #fafafa;
  --quote: #f4f4f5;
  --signal: #c2410c;
  --sans: 'Geist', 'Rubik', system-ui, sans-serif;
  --mono: 'Geist Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--surface); color: var(--ink); font-family: var(--sans); }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; color: inherit; }
h1, h2, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.mono { font-family: var(--mono); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* layout: one column on a phone, three from 1024 px */
.app { display: flex; min-height: 100vh; min-height: 100dvh; }
.col { min-width: 0; }
.list { flex: 1 1 100%; display: flex; flex-direction: column; }
.detail { display: none; flex: 1 1 100%; outline: none; }
.rail { display: none; }
body[data-view="detail"] .list { display: none; }
body[data-view="detail"] .detail { display: block; }
.d-only { display: none; }

/* header */
.head { padding: 24px 20px 20px; display: flex; flex-direction: column; gap: 8px; }
.head-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.date { font-size: 13px; line-height: 18px; color: var(--secondary); }
.built { font-family: var(--mono); font-size: 12px; line-height: 18px; color: var(--muted); white-space: nowrap; }
.title { font-size: 28px; line-height: 34px; font-weight: 600; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.lead { font-size: 14px; line-height: 20px; color: var(--secondary); }

/* banners */
#banner:empty { display: none; }
.banner { padding: 12px 20px; border-bottom: 1px solid var(--rule); background: var(--band); font-size: 13px; line-height: 18px; color: var(--secondary); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.banner strong { color: var(--ink); font-weight: 600; }
.banner button { min-height: 44px; padding: 0 14px; border: 1px solid var(--control); background: var(--surface); font-size: 14px; cursor: pointer; flex: none; }

/* calendar band */
.band { display: flex; flex-wrap: wrap; gap: 4px 20px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); background: var(--band); }
.band svg { flex: none; }
.band .tz { font-family: var(--mono); font-size: 12px; line-height: 20px; color: var(--muted); }
.ev { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.ev .t { font-family: var(--mono); font-size: 13px; line-height: 20px; white-space: nowrap; }
.ev .n { font-size: 13px; line-height: 20px; color: var(--secondary); overflow-wrap: anywhere; }
.band .none { font-size: 13px; line-height: 20px; color: var(--secondary); }

/* sections and rows */
.sec { padding: 20px 20px 8px; font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: 0.02em; }
.sec.later { color: var(--secondary); padding-top: 28px; }
.sec.rule { border-top: 1px solid var(--rule); }
.row { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; column-gap: 12px; align-items: start; padding: 14px 20px; border-top: 1px solid var(--rule); min-height: 44px; }
.row[aria-current="true"] { background: var(--quote); }
.rank { font-family: var(--mono); font-size: 13px; line-height: 20px; color: var(--muted); }
.rank.must { color: var(--signal); }
.row-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.row-title { font-size: 15px; line-height: 20px; font-weight: 600; overflow-wrap: anywhere; }
.row-reason { font-size: 13px; line-height: 18px; color: var(--secondary); }
.row-side { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.row-kind { font-size: 12px; line-height: 20px; color: var(--secondary); }
.row-min { font-family: var(--mono); font-size: 12px; line-height: 18px; color: var(--muted); white-space: nowrap; }
.row.done .row-title { color: var(--muted); font-weight: 500; }
.row.done .rank { color: var(--secondary); }
.tag { display: inline-block; align-self: flex-start; padding: 0 6px; border: 1px solid var(--control); font-size: 12px; line-height: 16px; color: var(--secondary); white-space: nowrap; }
.empty-list { padding: 16px 20px; font-size: 14px; line-height: 20px; color: var(--secondary); border-top: 1px solid var(--rule); }

/* count lines */
.count { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 0 20px; border: 0; border-top: 1px solid var(--rule); background: none; text-align: left; font-size: 14px; line-height: 20px; color: var(--secondary); cursor: pointer; }
.count .val { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 13px; line-height: 20px; }
.count svg { flex: none; transition: transform 160ms cubic-bezier(0.22, 1, 0.36, 1); }
.count[aria-expanded="true"] svg { transform: rotate(90deg); }
.count-items { border-top: 1px solid var(--rule); background: var(--band); }
.count-items li { padding: 10px 20px; border-top: 1px solid var(--rule); display: flex; flex-direction: column; gap: 2px; }
.count-items li:first-child { border-top: 0; }
.count-items .at { font-family: var(--mono); font-size: 12px; line-height: 16px; color: var(--muted); }
.count-items .who { font-size: 13px; line-height: 18px; font-weight: 600; overflow-wrap: anywhere; }
.count-items .line { font-size: 13px; line-height: 18px; color: var(--secondary); overflow-wrap: anywhere; }
.count-items .none { font-size: 13px; line-height: 18px; color: var(--secondary); }
.counts-end { border-bottom: 1px solid var(--rule); }
.foot { padding: 16px 20px 24px; font-size: 12px; line-height: 18px; color: var(--muted); }

/* all clear rows */
.stat { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 0 20px; min-height: 44px; border-top: 1px solid var(--rule); }
.stat .l { font-size: 14px; line-height: 20px; }
.stat .v { font-family: var(--mono); font-size: 13px; line-height: 20px; }
.stat.ev-row { justify-content: flex-start; }
.stat:last-of-type { border-bottom: 1px solid var(--rule); }

/* states: loading, error, empty */
.state { padding: 32px 20px; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.state h1 { font-size: 22px; line-height: 28px; font-weight: 600; letter-spacing: -0.01em; }
.state p { font-size: 14px; line-height: 20px; color: var(--secondary); max-width: 52ch; }
.skel { height: 14px; background: var(--quote); width: 60%; }
.skel.w1 { width: 40%; } .skel.w2 { width: 80%; }
.skel-row { padding: 14px 20px; border-top: 1px solid var(--rule); display: flex; flex-direction: column; gap: 8px; }

/* buttons */
.btn { height: 44px; padding: 0 16px; border: 1px solid var(--control); background: var(--surface); font-size: 14px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.btn:disabled { color: var(--muted); background: var(--band); cursor: not-allowed; }
.btn-primary { height: 52px; width: 100%; padding: 0 16px; border: 0; background: var(--ink); color: #ffffff; font-size: 16px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.btn-primary span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-primary:disabled { background: var(--muted); cursor: not-allowed; }
.btn-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.btn-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border: 1px solid var(--control); font-size: 14px; }
.btn-link.solid { border: 0; background: var(--ink); color: #ffffff; font-weight: 600; min-height: 52px; font-size: 16px; justify-content: center; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* open item */
.bar { display: flex; justify-content: space-between; align-items: center; height: 52px; padding: 0 20px 0 8px; border-bottom: 1px solid var(--rule); }
.back { display: flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 8px; border: 0; background: none; font-size: 14px; line-height: 20px; cursor: pointer; }
.pos { font-family: var(--mono); font-size: 12px; line-height: 18px; color: var(--muted); }
.d-body { padding: 20px; display: flex; flex-direction: column; gap: 20px; max-width: 100%; }
.d-head { display: flex; flex-direction: column; gap: 6px; }
.d-kind { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; line-height: 16px; color: var(--secondary); }
.d-title { font-size: 22px; line-height: 28px; font-weight: 600; letter-spacing: -0.01em; overflow-wrap: anywhere; outline: none; }
.d-reason { margin-top: 6px; font-size: 13px; line-height: 18px; color: var(--secondary); }
.d-reason.must { color: var(--signal); }
.check { display: flex; align-items: flex-start; gap: 6px; font-size: 13px; line-height: 18px; color: var(--secondary); }
.check svg { flex: none; margin-top: 2px; }
.check .tag { margin-right: 4px; }
.d-kind .pos { display: none; }
.d-kind > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.blk { display: flex; flex-direction: column; gap: 8px; }
.blk-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.blk-label { font-size: 12px; line-height: 16px; font-weight: 600; }
.blk-note { font-size: 12px; line-height: 16px; color: var(--secondary); text-align: right; overflow-wrap: anywhere; }
.draft { padding: 12px 16px; border: 1px solid var(--ink); font-size: 15px; line-height: 24px; white-space: pre-wrap; overflow-wrap: anywhere; }
.meta { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; font-size: 12px; line-height: 16px; color: var(--secondary); }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; overflow-wrap: anywhere; }
.actions { display: flex; flex-direction: column; gap: 10px; }
.editor { width: 100%; min-height: 160px; padding: 12px 16px; border: 1px solid var(--ink); background: var(--surface); color: var(--ink); font-family: inherit; font-size: 15px; line-height: 24px; resize: vertical; border-radius: 0; }
.msg { padding: 12px 16px; background: var(--quote); font-size: 14px; line-height: 20px; overflow-wrap: anywhere; }
.msg.err { background: var(--surface); border: 1px solid var(--signal); color: var(--signal); }
.q { font-size: 15px; line-height: 24px; overflow-wrap: anywhere; }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt { width: 100%; min-height: 68px; padding: 12px 16px; border: 1px solid var(--control); background: var(--surface); color: var(--ink); text-align: left; font-family: inherit; display: flex; flex-direction: column; gap: 4px; justify-content: center; cursor: pointer; border-radius: 0; overflow-wrap: anywhere; }
.opt.rec { border: 2px solid var(--ink); padding: 11px 15px; }
.opt:disabled { background: var(--band); color: var(--secondary); cursor: not-allowed; }
.opt:disabled .o-top { color: var(--secondary); }
.opt .o-top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; font-size: 15px; line-height: 20px; font-weight: 600; }
.opt .rec-tag { font-size: 12px; font-weight: 400; color: var(--secondary); white-space: nowrap; }
.help { font-size: 13px; line-height: 18px; color: var(--secondary); }

/* their message (phase 3): the client's words, quoted, clamped to 6 lines */
.in-subject { font-size: 13px; line-height: 18px; font-weight: 600; overflow-wrap: anywhere; }
.in-msg { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.quote { width: 100%; padding: 2px 0; border-inline-start: 3px solid var(--control); padding-inline-start: 12px; font-size: 15px; line-height: 22px; white-space: pre-wrap; overflow-wrap: anywhere; }
.quote.clamp { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 6; line-clamp: 6; overflow: hidden; }
.in-at { padding-inline-start: 15px; font-family: var(--mono); font-size: 12px; line-height: 16px; color: var(--muted); }
.in-more { min-height: 44px; padding: 0 12px; margin-inline-start: 3px; border: 0; background: none; font-size: 13px; line-height: 18px; color: var(--secondary); text-decoration: underline; cursor: pointer; }

/* actions added in phase 2b: own-words box, Done, Tomorrow, Drop, Already done */
.pick-label { font-size: 12px; line-height: 16px; font-weight: 600; }
.own { display: flex; flex-direction: column; gap: 8px; }
.own label { font-size: 13px; line-height: 18px; color: var(--secondary); }
.own-row { display: flex; gap: 8px; }
.field { flex: 1; min-width: 0; height: 48px; padding: 0 14px; border: 1px solid var(--control); background: var(--surface); color: var(--ink); font-family: inherit; font-size: 15px; border-radius: 0; }
.field::placeholder { color: var(--muted); }
.field:disabled { background: var(--band); color: var(--secondary); cursor: not-allowed; }
.sq { flex: none; width: 48px; height: 48px; border: 0; background: var(--ink); color: #ffffff; display: flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 0; }
.sq:disabled { background: var(--muted); cursor: not-allowed; }
.aux { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.link-quiet { display: inline-flex; align-items: center; min-height: 44px; font-size: 13px; line-height: 18px; color: var(--secondary); text-decoration: underline; }
.btn-done { height: 52px; width: 100%; padding: 0 16px; border: 0; background: var(--ink); color: #ffffff; font-size: 16px; font-weight: 600; cursor: pointer; border-radius: 0; display: flex; align-items: center; justify-content: center; }
.btn-done:disabled { background: var(--muted); cursor: not-allowed; }
.btn-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.btn-grid2 .btn { width: 100%; }
.hint { font-size: 12px; line-height: 18px; color: var(--secondary); }
.check-wrap { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }

/* toast with Undo */
.toast { position: fixed; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); max-width: 420px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 8px 4px 16px; min-height: 52px; background: var(--ink); color: #ffffff; font-size: 14px; line-height: 20px; z-index: 20; }
.toast button { min-height: 44px; min-width: 44px; padding: 0 14px; border: 1px solid #52525b; background: transparent; color: #ffffff; font-size: 14px; cursor: pointer; }
.toast button:focus-visible { outline-color: #ffffff; }

/* PIN gate */
.gate { position: fixed; inset: 0; background: var(--surface); z-index: 30; overflow-y: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 20px; gap: 16px; text-align: center; }
.gate h1 { font-size: 22px; line-height: 28px; font-weight: 600; letter-spacing: -0.01em; }
.gate p { font-size: 14px; line-height: 20px; color: var(--secondary); max-width: 40ch; }
.dots { display: flex; gap: 12px; height: 16px; }
.dots i { width: 12px; height: 12px; border: 1px solid var(--ink); }
.dots i.on { background: var(--ink); }
.keys { display: grid; grid-template-columns: repeat(3, 72px); gap: 10px; }
.keys button { height: 56px; border: 1px solid var(--control); background: var(--surface); font-family: var(--mono); font-size: 20px; cursor: pointer; }
.keys button.blank { visibility: hidden; }
.gate .err { color: var(--signal); font-size: 13px; min-height: 18px; }
.gate .signin { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 360px; }
.gate .signin input { height: 52px; width: 100%; padding: 0 14px; border: 1px solid var(--control); border-radius: 0; background: var(--surface); color: var(--ink); font-family: var(--mono); font-size: 16px; }
.gate .signin input::placeholder { color: var(--muted); font-family: var(--sans); }
button.btn-link { background: var(--surface); cursor: pointer; }
button.btn-link.solid { background: var(--ink); width: 100%; }

/* store line (phase 4): plain text when all is well, one word when it needs a look.
   Phone: under the calendar strip. Laptop: under Calendar in the rail. Old is grey, the other words use the signal colour. */
.store { display: flex; flex-direction: column; gap: 2px; padding: 10px 20px 12px; border-bottom: 1px solid var(--rule); background: var(--surface); overflow-wrap: anywhere; }
.store .ln { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 13px; line-height: 20px; color: var(--secondary); }
.store .v { font-family: var(--mono); color: var(--ink); }
.fl { font-size: 12px; line-height: 20px; font-weight: 600; color: var(--signal); white-space: nowrap; }
.fl.quiet { color: var(--secondary); }
.store .nt, .sline .nt { font-size: 12px; line-height: 18px; color: var(--secondary); }
.sline { display: flex; flex-direction: column; gap: 4px; overflow-wrap: anywhere; }
.sline-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.sline-top .sec { min-width: 0; overflow-wrap: anywhere; }
.store + .sec.rule { border-top: 0; }
.sline .v { font-family: var(--mono); font-size: 14px; line-height: 20px; }
.sline .nodata { font-size: 14px; line-height: 20px; color: var(--secondary); }

/* laptop */
@media (min-width: 1024px) {
  .app { flex-wrap: nowrap; align-items: stretch; }
  .list { flex: 1 1 380px; max-width: 460px; min-width: 340px; border-right: 1px solid var(--rule); }
  .detail, body[data-view="detail"] .detail { display: block; flex: 999 1 560px; padding: 40px 56px; }
  body[data-view="detail"] .list { display: flex; }
  .rail { display: flex; flex-direction: column; gap: 32px; flex: 1 1 260px; max-width: 320px; padding: 32px 24px; border-left: 1px solid var(--rule); }
  .m-only { display: none; }
  .d-only { display: block; }
  .head { padding: 28px 20px 20px; }
  .title { font-size: 24px; line-height: 30px; }
  .lead { font-size: 13px; line-height: 18px; }
  .bar { display: none; }
  .d-body { padding: 0; max-width: 640px; gap: 24px; }
  .d-title { font-size: 28px; line-height: 34px; letter-spacing: -0.02em; }
  .d-reason, .check { font-size: 14px; line-height: 20px; }
  .draft { font-size: 16px; line-height: 26px; padding: 14px 18px; }
  .actions { flex-direction: row; flex-wrap: wrap; }
  .btn-primary { width: auto; height: 48px; padding: 0 32px; font-size: 15px; }
  .btn-grid { display: flex; flex-wrap: wrap; gap: 12px; }
  .btn-done { width: auto; height: 48px; padding: 0 32px; font-size: 15px; }
  .btn-grid2 { display: flex; flex-wrap: wrap; gap: 12px; }
  .btn-grid2 .btn { width: auto; height: 48px; padding: 0 20px; }
  .btn-grid .btn { height: 48px; padding: 0 20px; }
  .rail .sec { padding: 0 0 10px; }
  .rail .ev { padding: 0 0 10px; gap: 12px; }
  .rail .ev .n { font-size: 14px; }
  .rail .count { min-height: 40px; border-top: 0; }
  .rail .count-items { border-top: 0; background: none; }
  .rail .count-items li { padding: 8px 0; }
  .d-kind .pos { display: inline; }
  .rail .count { flex-direction: column; align-items: stretch; justify-content: center; gap: 0; padding: 8px 0; }
  .rail .count .val { justify-content: space-between; white-space: nowrap; }
  .rail .rail-block { display: flex; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { .count svg { transition: none; } }
