:root {
  --blue: #1b2170; --blue-ink: #171c60; --blue-wash: #eef0fa;
  --ink: #1b2330; --muted: #596477; --line: #e2e5eb; --bg: #f7f7f5; --panel: #ffffff; --field: #ffffff;
  --fire: #b43e40; --warn: #8a5a20; --ok: #1b2170; --bad: #b43e40;
  --serif: Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --r: 14px; --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-6: 24px; --space-8: 32px;
  --elevation: 0 8px 28px rgba(26, 33, 65, .06);
  color-scheme: light dark;
  /* The phone's top bar, home indicator, and landscape side insets (home-screen app;
     the viewport uses viewport-fit=cover). Zero in a normal browser tab. */
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
  --phone-nav-height: calc(66px + var(--safe-b));
}
@media (prefers-color-scheme: dark) {
  :root {
    --blue: #aab3ff; --blue-ink: #d0d5ff; --blue-wash: #252b45;
    --ink: #f0f1f4; --muted: #aeb6c5; --line: #343b4a; --bg: #111318; --panel: #1c2029; --field: #252a34;
    --fire: #ff9396; --warn: #e6b878; --ok: #aab3ff; --bad: #ff9396;
    --elevation: 0 12px 36px rgba(0, 0, 0, .28);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 15px/1.45 var(--sans); -webkit-text-size-adjust: 100%; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; color: var(--ink); margin: 0; }
h1 { font-size: 30px; line-height: 1.1; }
h2 { font-size: 21px; }
h3 { font-size: 17px; margin: 20px 0 8px; }
a { color: var(--blue); }
.mono { font-family: var(--mono); }
.small { font-size: 12px; }
.meta { color: var(--muted); font-size: 13px; margin: 2px 0 0; }
[hidden] { display: none !important; }

.stub { background: #FFE8A3; color: #3D2B00; font: 600 12px var(--mono); text-align: center; padding: 6px 16px; }

/* shell */
.shell { display: grid; grid-template-columns: 208px 1fr; min-height: 100vh; }
.side { border-right: 1px solid var(--line); padding: 20px 12px; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 0; height: 100vh; }
.brand { font: 600 20px var(--serif); color: var(--blue); text-decoration: none; padding: 0 10px; }
#nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
#nav a { display: block; padding: 8px 10px; border-radius: var(--r); color: var(--ink); text-decoration: none; }
#nav a:hover { background: var(--blue-wash); }
#nav a[aria-current="true"] { background: var(--blue); color: #fff; }
@media (prefers-color-scheme: dark) { #nav a[aria-current="true"] { color: var(--bg); } }
.global { margin-top: auto; display: grid; gap: 6px; }
main { padding: 24px 32px 64px; min-width: 0; }
.signed-out .side { display: none; }
.signed-out .shell { grid-template-columns: 1fr; }

@media (max-width: 760px) { main { padding: 16px 16px 48px; } }

/* controls */
.btn { font: 500 14px var(--sans); border: 1px solid var(--line); background: var(--field); color: var(--ink);
  border-radius: var(--r); padding: 7px 12px; cursor: pointer; }
.btn:hover:not(:disabled) { border-color: var(--blue); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.primary { color: var(--bg); } }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea { font: 15px var(--sans); color: var(--ink); background: var(--field); border: 1px solid var(--line);
  border-radius: var(--r); padding: 8px 10px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .row-btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; margin-top: 16px; }

.badge { font: 500 11px var(--mono); border: 1px solid var(--line); border-radius: var(--r); padding: 1px 6px; color: var(--muted); white-space: nowrap; }
.badge.queued { color: var(--warn); border-color: currentColor; }
.badge.warn { color: var(--warn); border-color: currentColor; }
.badge.ok { color: var(--ok); border-color: currentColor; }
.badge.bad, .badge.band-block { color: var(--bad); border-color: currentColor; }
.badge.band-review, .badge.band-propose { color: var(--warn); border-color: currentColor; }
.badge.band-inbox, .badge.band-auto { color: var(--blue); border-color: currentColor; }

.flash { position: fixed; top: 8px; left: 248px; right: 24px; max-width: 900px; z-index: 35;
  margin: 0; padding: 8px 12px; border-radius: var(--r); box-shadow: var(--elevation);
  border: 1px solid var(--blue); background: var(--blue-wash); font-size: 14px; }
.flash.bad { border-color: var(--bad); color: var(--bad); background: var(--bg); }
.flash-copy { border: 0; background: transparent; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; margin-left: 8px; }
.today-health-alert { margin: 0 0 12px; padding: 8px 12px; border-left: 3px solid var(--bad); color: var(--bad); background: var(--bg); }
.today-health-alert a { color: inherit; font-weight: 600; }
.error { color: var(--bad); font-size: 13px; min-height: 1em; }
.empty { color: var(--muted); margin: 8px 0; }
.empty.bad { color: var(--bad); }
.note { color: var(--warn); font-size: 13px; }

/* screen scaffolding */
.screen-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filters label { font-size: 13px; color: var(--muted); }
.lede { color: var(--muted); margin: 6px 0 20px; }
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); margin: 16px 0; overflow-x: auto; }
.tab { font: 500 14px var(--sans); background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 14px;
  color: var(--muted); cursor: pointer; white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--blue); border-bottom-color: var(--blue); }

/* catch-up */
.tier { margin: 0 0 28px; }
.tier h2 { display: flex; align-items: baseline; gap: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.tier-fire h2 { color: var(--fire); }
.count { font: 500 13px var(--mono); color: var(--muted); }
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { border-bottom: 1px solid var(--line); }
.row-btn { display: grid; grid-template-columns: 170px 1fr auto; gap: 12px; align-items: start; width: 100%;
  padding: 12px 4px; background: none; border: 0; text-align: left; color: inherit; font: inherit; cursor: pointer; }
.row-btn:hover { background: var(--blue-wash); }
.row-btn .matter { font-size: 13px; color: var(--muted); padding-top: 2px; }
.row-btn .main { display: grid; min-width: 0; }
.row-btn .summary { overflow-wrap: anywhere; }
@media (max-width: 560px) { .row-btn { grid-template-columns: 1fr auto; } .row-btn .matter { grid-column: 1 / -1; padding: 0; } }

/* side panel */
.scrim { position: fixed; inset: 0; background: rgba(10, 10, 30, .28); z-index: 10; }
.panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: var(--panel); z-index: 11;
  border-left: 1px solid var(--line); display: flex; flex-direction: column; box-shadow: -8px 0 24px rgba(0,0,0,.12); }
.panel > header { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.panel-body { flex: 1; min-height: 0; padding: 16px 20px 32px; overflow-y: auto; }
.summary-lg { font-size: 17px; margin: 0 0 12px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.facts.small { font-size: 13px; margin-top: 6px; }
.evidence { list-style: none; margin: 0; padding: 0; }
.evidence li { border-top: 1px solid var(--line); padding: 10px 0; }
.ev-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.ev-subject { margin-top: 2px; }
.ref { color: var(--muted); overflow-wrap: anywhere; margin-top: 2px; }
.card { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.card-summary { margin: 0; }
.card-action { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; }
.panel-actions { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); display: grid; gap: 8px; justify-items: start; }

/* work-item cards (Inbox, Work, Matters, To-Do) */
.items { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.item { border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.item-head { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; flex-wrap: wrap; }
.item-title { font-weight: 600; }
.acts { display: grid; gap: 8px; margin-top: 10px; }
.act { border-top: 1px solid var(--line); padding-top: 10px; }
.controls { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: left; font: 500 12px var(--mono); color: var(--muted); border-bottom: 1px solid var(--line); padding: 6px 8px; }
table.list td { border-bottom: 1px solid var(--line); padding: 10px 8px; vertical-align: top; }
table.list tr:hover td { background: var(--blue-wash); }

/* dialog, sign-in */
dialog.ask { border: 1px solid var(--line); border-radius: var(--r); padding: 20px; width: min(440px, calc(100vw - 32px)); background: var(--panel); color: var(--ink); }
dialog.ask::backdrop { background: rgba(10, 10, 30, .35); }
dialog.ask form, .signin { display: grid; gap: 6px; }
dialog.ask label, .signin label { font-size: 13px; color: var(--muted); margin-top: 6px; }
dialog.ask h3 { margin: 0 0 6px; }
.signin { max-width: 360px; margin: 10vh auto 0; }
.signin .btn { margin-top: 12px; padding: 10px; }

/* undo toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 20; display: flex; gap: 12px; align-items: center;
  background: var(--ink); color: var(--bg); border-radius: var(--r); padding: 10px 12px 10px 16px; box-shadow: 0 6px 24px rgba(0,0,0,.2); max-width: calc(100vw - 32px); }
.toast .btn { background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 40%, transparent); padding: 4px 10px; }
.toast .kbd { color: color-mix(in srgb, var(--bg) 60%, transparent); }
.kbd { font-family: var(--mono); font-size: 11px; }

/* catch-up triage */
.cu-row { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; padding-left: 4px; }
.cu-row .sel { width: 16px; height: 16px; accent-color: var(--blue); }
.cu-row.cursor { box-shadow: inset 3px 0 0 var(--blue); background: var(--blue-wash); }
.cu-row { transition: opacity .18s ease, transform .18s ease, height .18s ease, background-color .12s ease; }
.cu-row.leaving { opacity: 0; transform: translateX(32px); overflow: hidden; pointer-events: none; border-bottom-color: transparent; }
.cu-row.entering { opacity: 0; transform: translateX(-16px); }
.cu-row.pending .summary { color: var(--muted); }
.btn.pressed, .btn.pressed:disabled { background: var(--blue); border-color: var(--blue); color: #fff; opacity: 1; cursor: progress; }
@media (prefers-color-scheme: dark) { .btn.pressed, .btn.pressed:disabled { color: var(--bg); } }
.row-note { grid-column: 2 / -1; margin: 0 0 8px; font-size: 13px; color: var(--bad); }
.panel-actions .row-note { grid-column: auto; }
.row-acts { display: flex; gap: 4px; }
.btn.small { font: 500 12px var(--mono); padding: 3px 8px; min-width: 28px; }
.bulk { position: sticky; top: 8px; z-index: 3; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0 0 16px;
  padding: 8px 12px; border: 1px solid var(--blue); border-radius: var(--r); background: var(--bg); }
.kbd-help { margin: -10px 0 16px; }
.check { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
.panel-actions.top { margin: 16px 0 4px; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
@media (max-width: 560px) {
  .cu-row { grid-template-columns: auto 1fr; }
  .row-acts { grid-column: 2; padding-bottom: 10px; }
  .kbd-help { display: none; }
}

/* overview */
.ov-top { display: grid; grid-template-columns: 1.4fr .6fr; gap: 20px; margin-top: 16px; align-items: start; }
@media (max-width: 1000px) { .ov-top { grid-template-columns: 1fr; } }
.panel-box { border: 1px solid var(--line); border-radius: var(--r); }
.snapshot { display: grid; grid-template-columns: repeat(4, 1fr); }
.snapshot a { display: block; padding: 18px 12px; text-align: center; text-decoration: none; color: var(--ink); border-left: 1px solid var(--line); }
.snapshot a:first-child { border-left: 0; }
.snapshot a:hover { background: var(--blue-wash); }
.snapshot .num { font: 500 26px var(--mono); }
.snapshot .num.emph { color: var(--fire); }
.snapshot .lbl { font-size: 12px; font-weight: 500; margin-top: 2px; }
.snapshot .sub { font-size: 11px; color: var(--muted); }
@media (max-width: 560px) { .snapshot { grid-template-columns: repeat(2, 1fr); } .snapshot a:nth-child(3) { border-left: 0; } .snapshot a:nth-child(n+3) { border-top: 1px solid var(--line); } }
.hero { border-top: 1px solid var(--line); padding: 14px 18px; margin: 0; }
.eff { padding: 16px 18px; }
.eff-grid { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; margin-top: 10px; }
.eff dl { margin: 0; }
.eff dt { font-size: 12px; color: var(--muted); }
.eff dd { margin: 2px 0 10px; font: 500 17px var(--mono); }
.ring { position: relative; width: 112px; height: 112px; display: grid; place-items: center; }
.ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring .v { font: 500 18px var(--mono); text-align: center; }
.ring .g { font-size: 10px; color: var(--muted); text-align: center; }
.health { display: flex; gap: 8px; align-items: center; font-size: 13px; align-self: center; }
.health .dot { flex: none; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); display: inline-block; }
.dot.band-attention, .dot.band-down { background: var(--fire); }
.ov-cols { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-top: 28px; }
@media (max-width: 900px) { .ov-cols { grid-template-columns: 1fr; } }
.ov-cols section h2, .attention h2 { font-size: 22px; margin-bottom: 8px; }
.plain { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.plain > li { border-bottom: 1px solid var(--line); padding: 10px 0; display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.attention { margin-top: 32px; }
.hard { color: var(--fire); }
.week { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid var(--line); border-radius: var(--r); margin-top: 8px; }
.week > div { padding: 8px; border-left: 1px solid var(--line); min-height: 70px; font-size: 12px; }
.week > div:first-child { border-left: 0; }
.week .d { font: 500 11px var(--mono); color: var(--muted); margin-bottom: 4px; }
@media (max-width: 700px) { .week { grid-template-columns: 1fr; } .week > div { border-left: 0; border-top: 1px solid var(--line); min-height: 0; } .week > div:first-child { border-top: 0; } }

/* time review */
.day-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.day-head h2 { border: 0; padding: 0; }
.warn { border: 1px solid var(--fire); color: var(--fire); border-radius: var(--r); padding: 8px 12px; margin: 10px 0; font-weight: 500; }
.tgroup h3 { font-size: 16px; margin: 14px 0 4px; }
.t-row { display: grid; grid-template-columns: minmax(180px, 1fr) 2fr; gap: 16px; padding: 12px 8px; border-bottom: 1px solid var(--line); outline: none; }
.t-row.cursor { box-shadow: inset 3px 0 0 var(--blue); background: var(--blue-wash); }
.t-row.handled .t-narr { color: var(--muted); }
.t-cap { border-right: 1px solid var(--line); padding-right: 12px; }
.t-cap .mono { font-size: 14px; overflow-wrap: anywhere; }
.t-hours { font-weight: 500; }
.t-narr { margin: 6px 0 0; }
@media (max-width: 700px) { .t-row { grid-template-columns: 1fr; } .t-cap { border-right: 0; padding: 0; } }

/* library */
.lib-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.lib-bar input[type=search] { flex: 1 1 260px; }
.lib-row { grid-template-columns: 1fr auto; }

/* formerly inline styles (a strict CSP forbids style attributes) */
.facts.spaced { margin-top: 12px; }
.ring-label { text-align: center; margin-bottom: 6px; }
.ink { color: var(--ink); }

/* hardening: skip link, connection and staleness lines, focus, touch targets */
.skip { position: absolute; left: 8px; top: -48px; z-index: 30; background: var(--blue); color: #fff; padding: 8px 12px; border-radius: var(--r); text-decoration: none; }
.skip:focus { top: 8px; }
@media (prefers-color-scheme: dark) { .skip { color: var(--bg); } }
.conn, .stale { position: sticky; top: 8px; z-index: 4; margin: 0 0 12px; padding: 8px 12px; border-radius: var(--r); font-size: 14px; background: var(--bg); }
.conn { border: 1px solid var(--bad); color: var(--bad); font-weight: 500; }
.conn .btn { margin-left: 8px; color: var(--bad); border-color: currentColor; }
.saved-capture { margin: 12px 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.saved-capture pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; }
.stale { border: 1px solid var(--warn); color: var(--warn); }
.empty.loading { font-family: var(--mono); font-size: 13px; }
.load-error { display: grid; gap: 8px; justify-items: start; margin-top: 12px; }
a:focus-visible, .tab:focus-visible, #nav a:focus-visible, input[type=checkbox]:focus-visible, h1:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
h1[tabindex="-1"]:focus:not(:focus-visible) { outline: none; }
.cu-row.handled .summary { color: var(--muted); }
dialog.relogin .signin { margin: 0; max-width: none; }
@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .btn.small { min-height: 44px; min-width: 44px; }
  .cu-row .sel { width: 22px; height: 22px; }
  #nav a { padding: 10px 12px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
@media (max-width: 560px) {
  .screen-head > .filters { width: 100%; }
  .filters > .filters { flex: 1 1 100%; display: grid; grid-template-columns: 5.5em 1fr; }
  .filters > .filters select { width: 100%; min-width: 0; }
}

/* catch-up friction fixes (2026-09-26): word labels on phones, Later presets, Undo tray, Inbox notices */
.row-acts .lbl-word { display: none; }
@media (max-width: 560px) {
  .row-acts { flex-wrap: wrap; }
  .row-acts .btn.small { font: 500 13px var(--sans); padding: 6px 10px; }
  .row-acts .lbl-key { display: none; }
  .row-acts .lbl-word { display: inline; }
}
.tier-reason { color: var(--warn); }
.presets { display: grid; gap: 6px; margin: 4px 0 8px; }
.presets .btn { text-align: left; }
.undo-tray { position: fixed; right: 16px; bottom: 16px; z-index: 19; background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 6px 24px rgba(0,0,0,.14); max-width: min(420px, calc(100vw - 32px)); }
.undo-tray.raised { bottom: 76px; }
.undo-tray > summary { cursor: pointer; padding: 8px 12px; font: 500 13px var(--sans); list-style: none; }
.undo-tray > summary::-webkit-details-marker { display: none; }
.undo-tray ul { list-style: none; margin: 0; padding: 0 12px 10px; display: grid; gap: 8px; }
.undo-tray li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; font-size: 13px; border-top: 1px solid var(--line); padding-top: 8px; }
.undo-tray li .meta { grid-row: 2; margin: 0; }
.undo-tray li .btn { grid-row: 1 / span 2; grid-column: 2; }
.cu-notices:empty { display: none; }
.cu-notice { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0 0 8px; padding: 8px 12px;
  border: 1px solid var(--blue); border-radius: var(--r); background: var(--blue-wash); font-size: 14px; }
.cu-notice .btn { margin-left: auto; }
.ev-link { font-size: 13px; }
@media (max-width: 560px) { .undo-tray { left: 16px; right: 16px; max-width: none; } }

/* home-screen app: keep content clear of the phone's top bar, home indicator, and side insets */
.shell { padding-left: var(--safe-l); padding-right: var(--safe-r); }
.stub { padding-top: calc(6px + var(--safe-t)); }
.side { height: 100dvh; padding-top: calc(20px + var(--safe-t)); padding-bottom: calc(20px + var(--safe-b)); }
main { padding-bottom: calc(64px + var(--safe-b)); }
.toast { bottom: calc(24px + var(--safe-b)); }
.undo-tray { bottom: calc(16px + var(--safe-b)); }
.undo-tray.raised { bottom: calc(76px + var(--safe-b)); }
.panel { padding-top: var(--safe-t); padding-right: var(--safe-r); }
.panel-body { padding-bottom: calc(32px + var(--safe-b)); }
dialog.ask { max-height: calc(100dvh - var(--safe-t) - var(--safe-b) - 32px); overflow-y: auto; }
.signin { margin-top: calc(10vh + var(--safe-t)); }
@media (max-width: 760px) { main { padding-bottom: calc(48px + var(--safe-b)); } }
@media (max-width: 560px) { .undo-tray { left: calc(16px + var(--safe-l)); right: calc(16px + var(--safe-r)); } }
/* the toast is centred from the middle of the screen, which leaves it half the width to
   wrap in: give it a real width, and on phones anchor it to both edges */
.toast { width: max-content; max-width: min(560px, calc(100vw - 32px - var(--safe-l) - var(--safe-r))); }
@media (max-width: 560px) {
  .toast { left: calc(16px + var(--safe-l)); right: calc(16px + var(--safe-r)); width: auto; max-width: none; transform: none; }
}
@media (pointer: coarse) { .toast .kbd { display: none; } }

/* ---------- menu (2026-09-26): a pop-out panel from the left below 1024 px; a fixed sidebar on wide screens ---------- */
.topbar { display: none; }
.brand { display: flex; align-items: center; gap: 8px; }
.brand-icon { width: 24px; height: 24px; border-radius: 5px; flex: none; }
.nav-scrim { display: none; }
@media (max-width: 1023px) {
  .shell { grid-template-columns: 1fr; }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 6; background: var(--bg);
    border-bottom: 1px solid var(--line); padding: calc(6px + var(--safe-t)) calc(12px + var(--safe-r)) 6px calc(8px + var(--safe-l)); min-height: 48px; }
  .signed-out .topbar { display: none; }
  .menu-btn { display: inline-flex; align-items: center; gap: 8px; font: 500 15px var(--sans); background: none; border: 1px solid transparent;
    border-radius: var(--r); padding: 6px 8px; color: var(--ink); cursor: pointer; min-height: 40px; }
  .menu-btn:hover { background: var(--blue-wash); }
  .menu-btn .bars { width: 18px; height: 12px; position: relative; border-top: 2px solid currentColor; border-bottom: 2px solid currentColor; }
  .menu-btn .bars::after { content: ""; position: absolute; left: 0; right: 0; top: 3px; border-top: 2px solid currentColor; }
  .topbar-title { font: 600 18px var(--serif); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .side { position: fixed; top: 0; left: 0; bottom: 0; z-index: 30; width: min(280px, 84vw); height: 100dvh; background: var(--panel);
    border-right: 1px solid var(--line); box-shadow: 8px 0 24px rgba(0,0,0,.14); overflow-y: auto;
    padding: calc(16px + var(--safe-t)) 12px calc(16px + var(--safe-b)) calc(12px + var(--safe-l));
    transform: translateX(-105%); visibility: hidden; transition: transform .18s ease, visibility 0s linear .18s; }
  .menu-open .side { transform: none; visibility: visible; transition: transform .18s ease; }
  .nav-scrim { display: block; position: fixed; inset: 0; z-index: 29; background: rgba(10,10,30,.32); opacity: 0; pointer-events: none; transition: opacity .18s ease; }
  .menu-open .nav-scrim { opacity: 1; pointer-events: auto; }
  .flash, .conn, .stale, .bulk { top: calc(56px + var(--safe-t)); }
  .flash { left: calc(16px + var(--safe-l)); right: calc(16px + var(--safe-r)); max-width: none; }
}
@media (prefers-reduced-motion: reduce) { .side, .nav-scrim { transition: none !important; } }

/* ---------- decision cards (2026-09-26): headline, proposed action, buttons; the rest behind Details ---------- */
.card .card-headline { margin: 0; font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .card-proposed { margin: 4px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .card-category { display: inline-block; margin-top: 6px; color: var(--blue); }
.draft-review pre { white-space: pre-wrap; font: 14px/1.45 var(--sans); overflow-wrap: anywhere; }
.card .card-actions { margin-top: 12px; }
.card .card-note { margin: 10px 0 0; padding: 8px 10px; border-left: 3px solid var(--warn); background: color-mix(in srgb, var(--warn) 8%, var(--bg)); color: var(--ink); font-size: 14px; }
.card .card-held { margin-top: 6px; }
.card-details { margin-top: 10px; font-size: 13px; }
.card-details > summary { cursor: pointer; color: var(--muted); width: max-content; padding: 4px 0; }
.card-details[open] > summary { margin-bottom: 6px; }
.card-details .variants { margin: 4px 0 0; padding-left: 20px; }
.shadow-banner { margin: 12px 0; padding: 10px 12px; border: 1px solid var(--warn); border-radius: var(--r); color: var(--ink);
  background: color-mix(in srgb, var(--warn) 10%, var(--bg)); font-size: 14px; font-weight: 500; }

/* ---------- Matters list ---------- */
.matter-list { list-style: none; margin: 16px 0 0; padding: 0; border-top: 1px solid var(--line); }
.matter-list > li { border-bottom: 1px solid var(--line); }
.matter-row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 4px; color: inherit; text-decoration: none; align-items: flex-start; }
.matter-row:hover { background: var(--blue-wash); }
.matter-main { display: grid; gap: 2px; min-width: 0; }
.matter-name { font: 600 17px var(--serif); color: var(--blue); }
.matter-desc { overflow-wrap: anywhere; }
.matter-side { display: grid; gap: 4px; justify-items: end; text-align: right; flex: none; max-width: 45%; }
.badge.open { color: var(--blue); border-color: currentColor; }
@media (max-width: 560px) { .matter-row { flex-direction: column; } .matter-side { justify-items: start; text-align: left; max-width: none; grid-auto-flow: column; gap: 10px; align-items: center; } }
.card .card-part { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.card .card-part:first-of-type { border-top: 0; padding-top: 0; }
.card .card-item-actions { padding-top: 10px; border-top: 1px dashed var(--line); }

/* ---------- To-Do for the phone (2026-09-26): filter chips, compact pickers, floating + ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 12px 0 14px; padding: 2px 2px 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; font: 500 13px var(--sans); color: var(--ink); background: var(--field);
  border: 1px solid var(--line); border-radius: var(--r); padding: 6px 12px; cursor: pointer; white-space: nowrap; min-height: 44px; }
.chip.on { background: var(--blue); border-color: var(--blue); color: #fff; }
@media (prefers-color-scheme: dark) { .chip.on { color: var(--bg); } }
.chip .chip-k { color: inherit; }
.chip .chip-v { font-weight: 600; }
.chip .chip-caret { font-size: 10px; opacity: .8; }
.chip.clear { border-style: dashed; }
dialog.picker { border: 1px solid var(--line); border-radius: 12px; padding: 16px; width: min(360px, calc(100vw - 32px)); max-height: 70dvh; background: var(--panel); color: var(--ink); }
dialog.picker::backdrop { background: rgba(10, 10, 30, .35); }
dialog.picker h3 { margin: 0 0 8px; }
.picker-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; max-height: 50dvh; }
.picker-opt { display: block; width: 100%; text-align: left; font: 15px var(--sans); color: var(--ink); background: none; border: 0; border-bottom: 1px solid var(--line); padding: 12px 6px; cursor: pointer; }
.picker-opt.on { color: var(--blue); font-weight: 600; }
.picker-cancel { margin-top: 10px; width: 100%; }
@media (max-width: 560px) {
  dialog.picker { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: 14px 14px 0 0; padding-bottom: calc(16px + var(--safe-b)); }
}
.items.tasks { gap: 8px; }
.task .controls { margin-top: 8px; }
.task-more { margin-top: 6px; font-size: 13px; }
.task-more > summary { cursor: pointer; color: var(--muted); width: max-content; padding: 4px 0; }
.btn.fab { position: fixed; right: calc(20px + var(--safe-r)); bottom: calc(24px + var(--safe-b)); z-index: 15; width: 56px; height: 56px; border-radius: 12px;
  font: 400 30px/1 var(--sans); padding: 0; display: grid; place-items: center; box-shadow: 0 6px 18px rgba(16, 6, 159, .35); }
main:has(.btn.fab) { padding-bottom: calc(96px + var(--safe-b)); }

/* ---------- card design (2026-09-28): attention badge, headline, Proposed:, buttons; Details = the original ---------- */
.card { position: relative; min-width: 0; }
.card-top { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.att { font: 600 12px var(--sans); border-radius: var(--r); padding: 2px 8px; border: 1px solid currentColor; white-space: nowrap; }
.att-today { color: #fff; background: var(--fire); border-color: var(--fire); }
.att-due { color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, var(--bg)); }
.att-fyi { color: var(--blue); background: var(--blue-wash); }
.att-later { color: var(--muted); background: var(--blue-wash); }
.att-none { color: var(--muted); }
@media (prefers-color-scheme: dark) { .att-today { color: var(--bg); } }
.card.att-today-card { border-left: 3px solid var(--fire); }
.card.att-due-card { border-left: 3px solid var(--warn); }
.card .card-headline { font-weight: 600; font-size: 16px; }
.card-proposed-k { font-weight: 600; color: var(--muted); }
.card-details > summary { font-size: 12px; }
.card-source { margin: 4px 0 0; font-size: 13px; }
.handled { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 10px; }
.handled-toggle { background: none; border: 0; color: var(--muted); font: 500 14px var(--sans); cursor: pointer; padding: 6px 0; text-align: left; }
.handled-toggle:hover { color: var(--ink); }
.handled .items { margin-top: 10px; }
.later-group { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 10px; }
.later-group > summary { cursor: pointer; font-weight: 600; padding: 8px 0; }
.later-group .items { margin-top: 10px; }
.followup-checklist { margin: 10px 0; padding-left: 24px; }
.followup-checklist li { margin: 8px 0; overflow-wrap: anywhere; }
.waiting-item p { margin: 4px 0 10px; }

/* ---------- what happened after a press (2026-09-28): Working…, Done + link, or the backend's error ---------- */
.card-result { margin: 10px 0 0; font-size: 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  border-left: 3px solid var(--line); padding: 6px 0 6px 10px; }
.card-result.result-working { border-left-color: var(--warn); }
.card-result.result-done { border-left-color: var(--ok); }
.card-result.result-failed, .card-result.result-refused, .card-result.result-not_sent { border-left-color: var(--bad); color: var(--ink); }
.card-result.result-unconfirmed { border-left-color: var(--warn); }

.disposition-card { padding: 12px 16px; }
.disposition-line { margin: 0; line-height: 1.4; }
.disposition-line strong { font-weight: 650; }
.disposition-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.disposition-control { display: inline-flex; flex-direction: column; gap: 3px; }
.disposition-control .held-why { max-width: 250px; font-size: 12px; }
.disposition-card > .btn { margin-left: 12px; }
.fyi-digest { margin: 0 0 20px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.digest-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.digest-head h2 { margin: 0 0 10px; font-size: 18px; }
.digest-list { list-style: none; margin: 0; padding: 0; max-height: 36vh; overflow: auto; }
.digest-row { display: grid; grid-template-columns: minmax(100px, 1fr) minmax(150px, 2fr) minmax(100px, 1fr) auto; align-items: center; gap: 5px 12px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 13px; }
.digest-subject { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.digest-rule, .digest-sender { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.digest-controls { display: flex; gap: 4px; }
.digest-controls .btn { min-height: 44px; padding: 4px 8px; font-size: 12px; }
.digest-result, .digest-row .held-why { grid-column: 1 / -1; }
.source-message .source-preview { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 55vh; overflow: auto; }
.source-attachments { padding-left: 20px; }
.source-attachment { margin: 8px 0; }
.source-attachment img, .source-attachment iframe { display: block; max-width: 100%; width: 100%; max-height: 55vh; margin-top: 8px; border: 0; }
@media (max-width: 700px) { .digest-row { grid-template-columns: 1fr auto; } .digest-subject, .digest-rule { grid-column: 1; } .digest-controls { grid-column: 2; grid-row: 1 / 4; flex-direction: column; } }
.result-text { overflow-wrap: anywhere; }
.btn.result-link { margin-left: 2px; }
/* A button that cannot run yet: shown, switched off, with the backend's reason. */
.card-held-btn { margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.card-item-held { margin-top: 4px; }
.held-why { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
/* Activity: this session's presses and their answers, kept after the card goes. */
.activity { margin: 16px 0; border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.activity h2 { font-size: 18px; margin-bottom: 6px; }
.activity-list { list-style: none; margin: 0; padding: 0; }
.activity-row { padding: 8px 0; border-top: 1px solid var(--line); }
.activity-row:first-child { border-top: 0; }
.activity-what { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.activity-said { margin: 2px 0 0; color: var(--ink); font-size: 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.activity-row.result-done .activity-said { color: var(--ok); }
.activity-row.result-failed .activity-said, .activity-row.result-refused .activity-said,
.activity-row.result-not_sent .activity-said { color: var(--bad); }
.confirmation-list { display: grid; gap: 6px; }
.confirmation-row { position: relative; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 52px 6px 10px; border: 1px solid var(--line) !important; border-radius: 9px; background: var(--panel); }
.confirmation-row .activity-said { margin: 0; min-width: 0; line-height: 1.35; }
.confirmation-close { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font: 19px var(--sans); cursor: pointer; }
.confirmation-close:hover, .confirmation-close:focus-visible { background: var(--blue-wash); }
.phone-more-link { display: none; }
@media (max-width: 699px), (max-height: 500px) and (pointer: coarse) { .phone-more-link { display: list-item; } }

/* ---------- Activity screen: system actions, and what the filter closed ---------- */
.closed-item .card-top, .sys-item .card-top { justify-content: space-between; }
.closed-item .card-headline, .sys-item .card-headline { font-weight: 600; font-size: 16px; }
.closed-from { margin: 2px 0 0; overflow-wrap: anywhere; }
.closed-rule { margin: 6px 0 0; font-size: 14px; overflow-wrap: anywhere; }
.att.closed-filtered { color: var(--blue); background: var(--blue-wash); }
.att.closed-done { color: var(--ok); }
.att.closed-stale { color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, var(--bg)); }
.att.closed-duplicate { color: var(--muted); }
.sys-item .activity-said { margin-top: 6px; }
.sys-item.result-failed .activity-said { color: var(--bad); }
.sys-item.result-done .activity-said { color: var(--ok); }

/* Product surface: five destinations, a daily brief, and focused decisions. */
html { scroll-behavior: smooth; }
body { font-size: 15px; line-height: 1.5; }
h1 { font-size: clamp(34px, 4vw, 46px); letter-spacing: -.035em; }
h2 { font-size: 22px; letter-spacing: -.025em; }
h3 { font-family: var(--sans); font-size: 15px; letter-spacing: 0; }
main { max-width: 1500px; width: 100%; margin-inline: auto; padding: 38px clamp(24px, 4vw, 64px) 96px; }
.side { width: 224px; padding: calc(28px + var(--safe-t)) 14px calc(20px + var(--safe-b)); background: var(--panel); }
.shell { grid-template-columns: 224px minmax(0, 1fr); }
.brand { font: 700 19px var(--sans); color: var(--blue-ink); padding: 2px 10px 26px; letter-spacing: -.04em; }
.brand-icon { width: 34px; height: 34px; border-radius: 9px; }
.brand-small { font-weight: 500; }
#nav { gap: 5px; }
#nav a { min-height: 48px; display: flex; align-items: center; padding: 10px 14px; border-radius: 10px; font-size: 14px; font-weight: 550; }
#nav a[aria-current="true"] { background: var(--blue-wash); color: var(--blue-ink); }
.global { border-top: 1px solid var(--line); padding-top: 16px; }
.btn { min-height: 44px; border-radius: 10px; padding: 9px 15px; transition: background .16s ease, transform .16s ease, box-shadow .16s ease; }
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--elevation); }
.btn.primary { background: #1b2170; border-color: #1b2170; color: #fff; }
.btn.primary:hover:not(:disabled) { background: #252d89; }
.btn.ghost { background: transparent; }
input, select, textarea { min-height: 44px; border-radius: 10px; }
.screen { max-width: 1120px; margin: auto; }
.screen-head { margin-bottom: 20px; }
.screen-head h1 { margin-bottom: 4px; }
.eyebrow { color: var(--muted); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; margin: 0 0 8px; }
.today-head { margin: 0 0 28px; }
/* Current Daily Brief: the approved three-page paper hierarchy, with phone controls. */
.daily-brief { max-width: 920px; margin: 0 auto; padding: 28px 34px; background: #fff; color: #1c1c1e; box-shadow: 0 2px 18px rgba(15,20,45,.08); }
.daily-brief a { color: #1b2170; }
.daily-brief .db-item-link { color: #1c1c1e; }
.db-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.db-logo { width: 190px; max-width: 40%; height: auto; object-fit: contain; }
.db-head-right { text-align: right; display: grid; gap: 2px; }
.db-head-right h1 { font: 600 23px var(--sans); color: #1b2170; }
.db-head-right strong { font-size: 23px; }
.db-head-right small { font: 11px var(--sans); letter-spacing: 1px; text-transform: uppercase; color: #666; }
.db-toolbar { display: flex; gap: 12px; align-items: center; margin: 14px 0; min-height: 36px; }
.daily-brief .db-toolbar .btn { color: #1b2170; background: #fff; border-color: #9da1b2; text-decoration: none; }
.db-print-status { font-size: 13px; color: #b3261e; }
.db-line { margin: 20px 0; padding: 0 0 0 13px; border-left: 3px solid #1b2170; font: italic 18px Georgia, serif; }
.db-section { margin: 22px 0; }
.db-section h2 { font: 700 12px var(--sans); color: #1b2170; text-transform: uppercase; letter-spacing: 1.5px; border-bottom: 1px solid #d9d9de; padding-bottom: 5px; }
.worklist-head { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: space-between; align-items: baseline; }
.worklist-head h2 { flex: 1 1 180px; }
.worklist-group { margin: 14px 0; }
.worklist-group h3 { font: 700 15px var(--sans); margin: 0 0 5px; }
.daily-brief .worklist-group h3 { color: #1c1c1e; }
.daily-brief .worklist .meta { color: #555; }
.daily-brief .today-inbox > .meta { color: #555; }
.worklist-items { list-style: none; padding: 0; margin: 0; }
.worklist-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 9px 0; border-bottom: 1px solid var(--line, #d9d9de); }
.worklist-action { font-weight: 650; min-width: 0; overflow-wrap: anywhere; }
.worklist-due { white-space: nowrap; font-variant-numeric: tabular-nums; }
.worklist-due.overdue { color: #ad1923; font-weight: 700; }
.worklist-item .meta { grid-column: 1 / -1; }
.worklist-item a:not(.worklist-action) { width: fit-content; }
.worklist-links { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 12px; }
@media (max-width: 600px) { .worklist-item { grid-template-columns: minmax(0, 1fr); } .worklist-due { white-space: normal; } }
@media (max-width: 640px) {
  .db-top .db-item-link, .worklist a, .worklist summary, .today-inbox > .meta a {
    display: inline-flex; align-items: center; min-height: 44px;
  }
  .worklist-links a { min-width: 44px; }
  .worklist-item a:not(.worklist-action) { width: auto; }
}
.db-list { list-style: none; padding: 0; margin: 0; }
.db-item { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-bottom: 1px solid #eee; }
.db-number { flex: 0 0 42px; font: 25px Georgia, serif; color: #1b2170; }
.db-when { flex: 0 0 94px; font-size: 13px; color: #666; }
.db-item-body { flex: 1; min-width: 0; display: grid; gap: 3px; }
.db-item-link { color: #1c1c1e; font-weight: 600; text-decoration: underline; text-decoration-color: #adb0c9; text-underline-offset: 3px; }
.db-item-link:hover { color: #1b2170; }
.db-detail { display: block; font-size: 13px; color: #666; }
.db-matter-detail { white-space: pre-line; line-height: 1.45; }
.db-client-group { margin-top: 20px; }
.db-client-group h3 { color: #1b2170; font: 700 13px var(--sans); letter-spacing: .08em;
  text-transform: uppercase; border-bottom: 1px solid #d9d9de; padding-bottom: 5px; }
.db-client-group .db-item { padding: 13px 0; }
.db-controls { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; min-width: 22px; }
.db-check { width: 19px; height: 19px; margin: 0; accent-color: #1b2170; cursor: pointer; }
.db-check:disabled { cursor: default; }
.db-result { font-size: 12px; color: #1b2170; }
.db-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.db-proposal, .db-adjustment { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 5px 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid #eee; }
.db-proposal-actions { display: flex; gap: 6px; }
.db-proposal .db-result, .db-adjustment .db-result, .db-proposal .db-detail, .db-adjustment .db-detail { grid-column: 1 / -1; }
.db-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; padding-top: 8px; border-top: 1px solid #d9d9de; font-size: 11px; color: #666; }
@media (max-width: 640px) { .daily-brief { padding: 20px 16px; margin: 0 -12px; } .db-head { align-items: flex-start; } .db-logo { width: 125px; } .db-head-right strong { font-size: 17px; } .db-head-right small { font-size: 9px; } .db-cols { grid-template-columns: 1fr; gap: 0; } .db-when { flex-basis: 62px; } .db-number { flex-basis: 34px; font-size: 19px; } .db-item { gap: 6px; } .db-proposal, .db-adjustment { grid-template-columns: 1fr; } .db-proposal-actions { grid-column: 1; } }
@media print { .shell { display: block; } .side, .topbar, .bottom-nav, .db-toolbar, .db-controls, .db-proposal-actions, .db-review, .db-adjustment { display: none !important; } main { padding: 0 !important; } .daily-brief { max-width: none; padding: 0; box-shadow: none; } .db-page-break { break-before: page; } .db-item { break-inside: avoid; } }
.today-head h1 { margin-bottom: 2px; }
.daily-line { color: var(--muted); margin: 3px 0 0; font-family: var(--serif); font-size: 17px; }
.brief-counts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 30px; }
.brief-counts a { min-height: 82px; display: flex; align-items: baseline; gap: 12px; padding: 16px 18px; color: var(--ink); text-decoration: none; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.brief-counts a:hover { border-color: var(--blue); box-shadow: var(--elevation); }
.brief-counts strong { font: 600 27px var(--sans); letter-spacing: -.05em; color: var(--blue-ink); }
.brief-counts span { font-size: 13px; color: var(--muted); }
.today-section { margin: 30px 0; }
.section-line { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; margin-bottom: 14px; }
.section-line h2 { margin: 0; }
.text-link { font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.text-link:hover { text-decoration: underline; }
.brief-list, .more-list { list-style: none; padding: 0; margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.brief-list li { min-height: 52px; padding: 12px 16px; display: flex; justify-content: space-between; gap: 16px; align-items: center; border-top: 1px solid var(--line); }
.brief-list li:first-child { border-top: 0; }
.brief-list a { color: var(--ink); text-decoration: none; font-weight: 550; }
.brief-list a:hover { color: var(--blue); }
.more-list a { min-height: 72px; display: grid; grid-template-columns: 1fr auto; gap: 2px 16px; align-items: center; padding: 14px 18px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.more-list li:first-child a { border-top: 0; }
.more-list strong { font-size: 16px; }
.more-list .meta { grid-row: 2; }
.more-list a > span:last-child { grid-column: 2; grid-row: 1 / span 2; font-size: 24px; color: var(--muted); }
.setting-section { padding: 24px 0; border-bottom: 1px solid var(--line); }
.setting-section h2 { font-size: 19px; }
.setting-section p { max-width: 55ch; }
.billing-page { max-width: 940px; }
.billing-pdf { display: inline-flex; margin-top: 12px; }
.billing-section { margin: 28px 0; }
.billing-section h2 { margin-bottom: 6px; }
.billing-list { list-style: none; padding: 0; margin: 14px 0; display: grid; gap: 10px; }
.billing-row, .billing-client { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.billing-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.billing-row > div { display: grid; gap: 4px; min-width: 0; }
.billing-row > strong { white-space: nowrap; }
.billing-client h3 { margin: 0 0 12px; }
.billing-aging { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.billing-aging > span { display: grid; gap: 3px; min-width: 0; padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
.billing-aging small { color: var(--muted); }
.billing-aging strong { font-size: 14px; overflow-wrap: anywhere; }
.billing-overdue { color: var(--bad); }
.billing-invoices { margin: 12px 0 0; padding-left: 20px; }
.item.card.billing-draft .card-proposed { display: block; -webkit-line-clamp: unset; }
.billing-draft-form { display: grid; gap: 12px; margin-top: 16px; }
.billing-draft-form input[type="email"] { width: 100%; min-width: 0; }
.billing-confirm { display: flex; align-items: flex-start; gap: 10px; line-height: 1.4; }
.billing-confirm input[type="checkbox"] { flex: none; width: 20px; height: 20px; margin: 2px 0 0; }
.billing-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.billing-actions .btn { flex: 1 1 130px; min-width: 0; }
.billing-draft-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.weekly-report { max-width: 940px; }
.weekly-section { margin: 24px 0; }
.weekly-section h2 { margin-bottom: 10px; }
.weekly-section .items { list-style: none; padding: 0; }
.weekly-section .item { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; overflow-wrap: anywhere; }
.db-mini-review { border: 1px solid var(--line); border-left: 3px solid var(--blue); border-radius: 10px; padding: 10px 14px; margin: 12px 0; }
.db-mini-review summary { cursor: pointer; font-weight: 700; color: var(--blue-ink); }
.db-mini-review p { margin: 10px 0 6px; }
.db-mini-review a { font-weight: 600; }
@media (max-width: 420px) { .billing-aging { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.items { gap: 10px; }
.item.card { background: var(--panel); padding: 20px 22px; border-radius: 16px; box-shadow: 0 1px 2px rgba(20,25,50,.025); transition: transform .17s ease, box-shadow .17s ease, border-color .17s ease; cursor: pointer; }
.item.card:hover, .item.card:focus-within { border-color: #b9c0d7; box-shadow: var(--elevation); }
.item.card:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.card.att-today-card, .card.att-due-card { border-left: 1px solid var(--line); }
.card .card-headline { font-size: 17px; line-height: 1.35; font-weight: 640; letter-spacing: -.012em; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card .card-proposed { margin: 7px 0 0; font-size: 14px; color: var(--muted); white-space: nowrap; }
.card .card-proposed { white-space: normal; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; color: var(--ink); }
.card .card-proposed strong { font-weight: 700; }
.card-face-label { display: block; margin-bottom: 3px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.card-draft-preview { display: block; white-space: pre-wrap; overflow-wrap: anywhere; }
.source-message .document-preview { display: block; width: 100%; min-height: 55dvh; border: 1px solid var(--line); }
.card-proposed-k { font-weight: 500; }
.card-top { margin-bottom: 11px; flex-wrap: wrap; }
.card-chip { font-size: 11px; color: var(--muted); background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 2px 7px; max-width: 170px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.matter-chip { cursor: pointer; min-height: 44px; text-align: left; font: 600 12px var(--sans); }
.matter-chip.no-matter { color: #9a5b00; border-color: #d89b37; background: color-mix(in srgb, #d89b37 13%, var(--panel)); }
.matter-picker { display: grid; gap: 12px; }
.matter-picker > input { width: 100%; min-height: 44px; }
.matter-picker-list { display: grid; gap: 4px; max-height: 50dvh; overflow: auto; }
.matter-picker-option { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; width: 100%; min-height: 48px; padding: 9px 12px; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 9px; text-align: left; cursor: pointer; }
.matter-picker-option[aria-checked="true"] { border-color: var(--blue); background: color-mix(in srgb, var(--blue) 9%, var(--panel)); }
.matter-picker-option small { color: var(--muted); }
.card-edit-form { display: grid; gap: 9px; }
.card-edit-form label { color: var(--muted); font-size: 13px; margin-top: 4px; }
.card-edit-form input, .card-edit-form textarea { width: 100%; padding: 10px; background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.snooze-sheet { display: grid; gap: 12px; }
.snooze-wheel { width: 100%; padding: 8px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--ink); font: inherit; }
.snooze-wheel option { padding: 12px; }
.card-removing { transform: translateX(-24px) scale(.98) !important; opacity: 0; pointer-events: none; transition: transform .22s ease, opacity .22s ease !important; }
.triage-card.card-confirmation { display: flex; align-self: start; align-items: center; gap: 10px; min-height: 58px; overflow: hidden; background: var(--panel); }
.card-confirm-text { flex: 1; font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.card-confirmation .result-link { font-size: 13px; white-space: nowrap; }
.card-confirm-undo { border: 0; padding: 8px; background: transparent; color: var(--blue-ink); font: 600 13px var(--sans); text-decoration: underline; cursor: pointer; }
.card-confirmation.result-error .card-confirm-text { color: var(--bad); }
.card-collapsing { max-height: 0 !important; min-height: 0 !important; margin: 0 !important; padding-top: 0 !important; padding-bottom: 0 !important; border-width: 0 !important; opacity: 0; overflow: hidden; transition: max-height .24s ease, min-height .24s ease, padding .24s ease, opacity .24s ease !important; }
.snoozed-section { margin-top: 24px; }
.snoozed-day { margin-top: 16px; }
.snoozed-day h3 { font-size: 14px; color: var(--muted); }
.card-action-status:empty { display: none; }
.card-category { display: none !important; }
.att { border-radius: 7px; font-size: 11px; padding: 3px 8px; }
.att-today { background: color-mix(in srgb, var(--blue) 11%, var(--panel)); color: var(--blue-ink); border-color: transparent; }
.att-due { background: color-mix(in srgb, var(--warn) 10%, var(--panel)); }
.card .card-actions { margin-top: 15px; }
.card-actions .btn { min-width: 104px; }
.card-actions .btn:not(.primary) { background: transparent; }
.card-actions .btn:has(+ .btn) { margin-right: 2px; }
.card-open { background: none; border: 0; color: var(--blue-ink); padding: 12px 0 0; cursor: pointer; font: 600 13px var(--sans); }
.card-open:hover { text-decoration: underline; }
.triage-card.item.card { padding: 9px 11px; border-radius: 12px; color: var(--ink); }
.triage-card .card-matter { margin-bottom: 4px; }
.triage-card .matter-chip { max-width: 100%; min-height: 44px; padding: 0; border: 0; background: transparent; color: var(--ink); font-size: 15px; font-weight: 750; }
.triage-card .matter-chip.no-matter { padding: 3px 8px; border: 1px solid var(--bad); border-radius: 6px; color: var(--bad); background: color-mix(in srgb, var(--bad) 8%, var(--panel)); }
.triage-card .card-blurb { margin: 0; font-size: 13px; line-height: 1.25; }
.triage-card .card-short-description, .triage-card .card-action-line { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.triage-card .card-action-line { color: var(--ink); font-weight: 600; }
.triage-card .card-actions { margin-top: 7px; display: grid; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: 5px; }
.triage-card .card-actions .btn { min-width: 0; min-height: 44px; padding: 6px 4px; font-size: 12px; font-weight: 650; }
.triage-card .card-actions .btn:not(.primary) { background: var(--field); border-color: #929bb1; color: var(--ink); }
.triage-card .card-actions button.card-action-approve { background: #1b2170; border-color: #1b2170; color: #fff; }
.triage-card .card-action-note { margin: 8px 0 0; color: var(--ink); font-size: 12px; line-height: 1.3; }
.triage-card .card-actions .card-action-revise { order: 4; }
.triage-card .card-actions .card-action-delete { order: 3; }
.triage-card .card-actions .card-action-snooze { order: 2; }
.triage-card .card-actions .card-action-approve { order: 1; }
.triage-card .card-open { display: none; }
.triage-card.grouped .card-open { display: inline-block; min-width: 44px; padding-top: 8px; }
.snooze-inline { margin-top: 8px; }
.snooze-days { display: grid; grid-template-columns: repeat(4, minmax(44px, 1fr)); gap: 4px; }
.snooze-days .btn { min-width: 0; min-height: 44px; padding: 5px 0; font-size: 11px; }
@media (min-width: 850px) { .items:has(> .triage-card) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.card-result { margin-top: 14px; padding: 10px 12px; border-radius: 10px; border-left-width: 0; background: var(--bg); }
.card-result.result-working { background: color-mix(in srgb, var(--blue) 8%, var(--panel)); }
.card-result.result-done { color: var(--blue-ink); }
.card-held-btn { background: var(--bg); border-radius: 10px; padding: 8px 10px; }
.card-held-btn .btn { min-height: 44px; }
.tabs { gap: 4px; border: 0; margin: 0 0 20px; }
.tab { border: 1px solid transparent; border-radius: 10px; min-height: 44px; padding: 9px 16px; }
.tab[aria-selected="true"] { color: var(--blue-ink); background: var(--blue-wash); border-color: transparent; }
.later-group { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 0 16px 12px; }
.later-group > summary { min-height: 48px; display: flex; align-items: center; }
.empty { background: var(--panel); border: 1px dashed var(--line); padding: 22px; border-radius: 14px; }
.skeleton-list { display: grid; gap: 12px; margin-top: 24px; }
.skeleton { height: 120px; border-radius: 14px; background: linear-gradient(100deg, var(--line) 5%, var(--panel) 35%, var(--line) 65%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position-x: -200%; } }
.panel { width: min(560px, 46vw); border-left: 1px solid var(--line); box-shadow: var(--elevation); }
.panel > header { min-height: 76px; padding: 18px 24px; gap: 12px; }
.panel > header h2 { flex: 1; font: 600 21px/1.25 var(--serif); }
.panel-body { padding: 24px 28px 40px; }
.sheet-grab { display: none; }
.sheet-content section, .matter-sheet section { margin-top: 26px; border-top: 1px solid var(--line); padding-top: 18px; }
.sheet-lede { font-size: 16px; line-height: 1.55; margin: 14px 0; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 20px; }
.source-preview, .draft-review pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 360px; overflow: auto; background: var(--bg); padding: 14px; border-radius: 10px; font: 14px/1.55 var(--sans); }
.time-log { width: min(500px, calc(100vw - 24px)) !important; }
.time-log label { display: grid; gap: 6px; }
.time-log select, .time-log input, .time-log textarea { width: 100%; }
.hour-chips { display: flex; gap: 6px; overflow-x: auto; }
.hour-chips .chip { border-radius: 9px; min-height: 44px; }
.time-summary { margin: 24px 0; }
.review-title { margin: 30px 0 12px; }
#matter-search { width: min(100%, 420px); margin-bottom: 8px; }
.matter-list { border: 0; display: grid; gap: 8px; }
.matter-list > li { border: 0; }
.matter-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, 38%); gap: 20px; min-height: 100px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px 20px; }
.matter-row:hover { border-color: var(--blue); background: var(--panel); box-shadow: var(--elevation); }
.matter-name { font: 620 17px var(--sans); color: var(--ink); }
.matter-side { max-width: none; gap: 1px; }
.matter-status { font-size: 12px; font-weight: 650; color: var(--blue-ink); }
.matter-next { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.matter-client-group { margin: 26px 0 34px; }
.matter-client-group h2 { margin: 0 0 10px; font: 600 19px/1.25 var(--serif); color: var(--ink); }
.matter-status { width: max-content; max-width: 100%; padding: 4px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--blue-wash); }
.matter-status.stalled { color: var(--danger, #a22336); background: color-mix(in srgb, currentColor 8%, var(--panel)); }
.matter-status.none { color: var(--muted); background: var(--bg); }
.matter-record-sheet { min-width: 0; }
.matter-record-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border-bottom: 1px solid var(--line); margin-top: 20px; }
.matter-record-tab { min-height: 48px; border: 0; border-bottom: 3px solid transparent; background: none; color: var(--muted); font: 650 12px var(--sans); letter-spacing: .08em; text-transform: uppercase; cursor: pointer; }
.matter-record-tab[aria-selected="true"] { color: var(--blue); border-color: var(--blue); }
.matter-record-actions { display: flex; justify-content: flex-end; margin: 18px 0; }
.matter-party-filters { display: flex; gap: 7px; overflow-x: auto; padding: 0 0 12px; margin-bottom: 8px; }
.matter-party-filters .chip { flex: none; min-height: 44px; }
.matter-party-filters .chip.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.matter-timeline { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 1px solid var(--line); }
.matter-timeline-entry { position: relative; padding: 0 0 22px 20px; }
.matter-timeline-entry::before { content: ""; position: absolute; top: 7px; left: -21px; width: 9px; height: 9px; border-radius: 50%; background: var(--blue); border: 2px solid var(--panel); }
.matter-timeline-entry.pinned::before { width: 12px; height: 12px; left: -23px; }
.matter-timeline-date { display: flex; gap: 8px; align-items: center; font: 600 12px var(--mono); color: var(--blue-ink); }
.matter-timeline-event { margin: 7px 0 4px; font-weight: 620; line-height: 1.45; }
.matter-timeline-body .meta { margin: 0 0 8px; }
.matter-you { margin-left: 8px; padding: 2px 5px; border: 1px solid var(--blue); border-radius: 4px; color: var(--blue); font: 600 10px var(--sans); vertical-align: middle; }
.matter-entry-actions { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 8px; }
.matter-entry-actions .btn { min-height: 44px; padding: 5px 8px; font-size: 12px; }
.matter-source { font-size: 11px; min-height: 44px; }
.matter-record-result { min-height: 18px; font-size: 12px; color: var(--muted); }
.matter-privileged { padding: 12px 14px; border-left: 3px solid var(--blue); background: var(--blue-wash); color: var(--blue-ink); font: 650 11px/1.45 var(--sans); letter-spacing: .04em; }
.matter-playbook-section { padding: 18px 0; border-top: 1px solid var(--line); }
.matter-playbook-section h3 { margin: 0 0 10px; font: 600 19px/1.3 var(--serif); }
.matter-playbook-section textarea { display: block; width: 100%; min-height: 128px; resize: vertical; line-height: 1.5; }
.note-head { align-items: baseline; }
.note-date-nav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 14px 0; }
.note-date-nav input { max-width: 170px; }
.daily-note-editor { display: block; width: 100%; min-height: min(55vh, 560px); padding: 20px; resize: vertical; border-radius: 12px; background: var(--panel); font: 16px/1.7 var(--sans); }
.note-footer { display: flex; justify-content: flex-end; min-height: 27px; padding-top: 6px; }
.note-time-lines { margin: 8px 0 20px; }
.note-time-line { margin: 4px 0; border-left: 2px solid var(--blue); padding: 3px 10px; color: var(--muted); font: 12px/1.5 var(--mono); overflow-wrap: anywhere; }
.note-conflict { border: 1px solid var(--warn); padding: 12px; margin: 12px 0; border-radius: 10px; }
.note-conflict .btn { margin-right: 8px; }
.daily-time-section { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); }
.daily-time-section h2 { margin-bottom: 10px; }
.note-card-entries { list-style: none; margin: 0; padding: 0; }
.note-card-entries li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.quick-capture { width: min(520px, calc(100vw - 24px)); max-height: 90dvh; border: 1px solid var(--line); border-radius: 16px; padding: 22px; background: var(--panel); color: var(--ink); box-shadow: var(--elevation); }
.quick-capture::backdrop { background: rgba(10, 15, 40, .4); }
.quick-capture form, .quick-capture label { display: grid; gap: 8px; }
.quick-capture form { gap: 14px; }
.quick-capture textarea { width: 100%; min-height: 140px; }
.quick-actions { display: flex; justify-content: flex-end; gap: 8px; }
#quick-capture { position: fixed; right: calc(20px + var(--safe-r)); bottom: calc(24px + var(--safe-b)); z-index: 15; width: 54px; height: 54px; padding: 0; border-radius: 13px; font-size: 30px; line-height: 1; box-shadow: var(--elevation); }
.signed-out #quick-capture { display: none; }
@media (min-width: 700px) and (min-height: 501px) {
  body:has(#view[data-screen="todo"]) #quick-capture { right: calc(86px + var(--safe-r)); }
  body:has(#view .triage-card) #quick-capture { position: absolute; top: calc(16px + var(--safe-t)); bottom: auto; width: 44px; height: 44px; font-size: 24px; }
}
body.sheet-open #quick-capture { display: none; }
.matter-save-status { margin: 7px 0 0; }
.panel:has(.matter-record-sheet) { width: min(700px, 52vw); }
.bottom-nav { display: none; }
/* Knowledge vault: one persistent tree and one reading pane. */
#view:has(.knowledge-layout) { max-width: none; }
#view:has(.knowledge-layout) > .screen { max-width: none; padding: 0; }
.knowledge-layout { display: grid; grid-template-columns: minmax(225px, 265px) minmax(0, 1fr); min-height: calc(100dvh - 48px); border: 1px solid var(--line); background: var(--panel); }
.knowledge-sidebar { position: sticky; top: 0; align-self: start; height: 100dvh; overflow-y: auto; border-right: 1px solid var(--line); padding: 18px 10px 30px; background: var(--panel); }
.knowledge-side-head { display: flex; align-items: center; justify-content: space-between; padding: 0 10px 12px; color: var(--blue-ink); }
.knowledge-close, .knowledge-drawer-button { display: none; }
.knowledge-shortcuts { margin-bottom: 20px; }
.knowledge-shortcuts h3 { display: flex; justify-content: space-between; align-items: center; margin: 0 10px 5px; font: 600 11px var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.knowledge-count { float: right; color: var(--muted); font: 500 11px var(--mono); margin-left: auto; }
.knowledge-folder summary { cursor: pointer; display: flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 7px; font-weight: 600; font-size: 13px; }
.knowledge-folder summary:hover, .knowledge-file:hover { background: var(--blue-wash); }
.knowledge-children { padding-left: 12px; }
.knowledge-file { display: flex; align-items: center; min-height: 44px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 6px 10px; border-radius: 7px; color: var(--ink); text-decoration: none; font-size: 13px; }
.knowledge-file.current { background: var(--blue-wash); color: var(--blue-ink); font-weight: 650; }
.knowledge-main { min-width: 0; }
.knowledge-top { position: sticky; top: 0; z-index: 2; display: flex; gap: 10px; padding: 12px 22px; background: var(--panel); border-bottom: 1px solid var(--line); }
.knowledge-top input { width: min(550px, 100%); border-radius: 8px; }
.knowledge-reader, .knowledge-editor { padding: 22px clamp(20px, 4vw, 56px) 60px; }
.knowledge-reader-head { display: flex; align-items: center; gap: 8px; }
.knowledge-reader-head .knowledge-back { margin-right: auto; }
.knowledge-back, .knowledge-history-nav button { border: 0; background: transparent; color: var(--blue-ink); cursor: pointer; padding: 7px; font: 600 13px var(--sans); }
.knowledge-history-nav { display: flex; gap: 3px; }
.knowledge-history-nav button { font-size: 18px; }
.knowledge-path { margin: 10px 0 24px; overflow-wrap: anywhere; }
.knowledge-generated { padding: 8px 10px; border-left: 2px solid var(--line); margin: -12px 0 24px; }
.knowledge-reading-grid { display: grid; grid-template-columns: minmax(0, 780px) minmax(145px, 210px); gap: clamp(22px, 4vw, 55px); align-items: start; }
.knowledge-article { min-width: 0; overflow-wrap: anywhere; font: 17px/1.65 var(--sans); }
.knowledge-article h1, .knowledge-article h2, .knowledge-article h3 { line-height: 1.2; margin: 1.2em 0 .5em; }
.knowledge-article h1 { font-size: clamp(29px, 3vw, 39px); margin-top: 0; }
.knowledge-article h2 { font-size: 27px; border-bottom: 1px solid var(--line); padding-bottom: 5px; }
.knowledge-article h3 { font-size: 21px; }
.knowledge-article p, .knowledge-article ul, .knowledge-article ol { margin: .8em 0 1.2em; }
.knowledge-article li { margin: .25em 0; }
.knowledge-article pre { overflow-x: auto; padding: 15px; background: var(--blue-wash); border-radius: 8px; font: 13px/1.5 var(--mono); }
.knowledge-article code { font: .85em var(--mono); }
.knowledge-article blockquote { margin: 1em 0; padding: 2px 18px; border-left: 3px solid var(--blue); color: var(--muted); }
.knowledge-article table { border-collapse: collapse; display: block; overflow-x: auto; }
.knowledge-article th, .knowledge-article td { border: 1px solid var(--line); padding: 6px 9px; }
.knowledge-article img { max-width: 100%; height: auto; }
.knowledge-outline { position: sticky; top: 84px; display: grid; gap: 8px; font-size: 12px; max-height: calc(100dvh - 100px); overflow-y: auto; }
.knowledge-outline strong { color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.knowledge-outline a { text-decoration: none; line-height: 1.3; }
.knowledge-outline a.h2 { padding-left: 10px; }
.knowledge-outline a.h3 { padding-left: 20px; }
.knowledge-backlinks { margin: 45px 0 0; padding-top: 22px; border-top: 1px solid var(--line); }
.knowledge-backlinks h2 { font-size: 20px; margin-bottom: 8px; }
.knowledge-backlinks .knowledge-file { max-width: 500px; }
.knowledge-results { position: absolute; z-index: 3; margin: 0 22px; width: min(550px, calc(100% - 44px)); max-height: 65dvh; overflow-y: auto; padding: 8px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--elevation); }
.knowledge-result { display: grid; gap: 2px; width: 100%; padding: 9px; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); cursor: pointer; }
.knowledge-result:hover { background: var(--blue-wash); }
.knowledge-result small { color: var(--muted); }
.knowledge-result mark { background: #ffe79c; color: #26210b; }
.knowledge-editor-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.knowledge-editor-bar h2 { margin-right: auto; }
.knowledge-edit-input { display: block; width: 100%; min-height: 65dvh; resize: vertical; border-radius: 7px; font: 14px/1.55 var(--mono); }
.knowledge-versions { margin-top: 12px; padding: 8px; border: 1px solid var(--line); }
.knowledge-version { display: block; width: 100%; text-align: left; padding: 8px; border: 0; background: transparent; color: var(--blue-ink); cursor: pointer; }
.knowledge-version-dialog { width: min(800px, 95vw); max-height: 90dvh; border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
.knowledge-version-dialog pre { white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.5 var(--mono); }
@media (max-width: 1100px) { .knowledge-reading-grid { grid-template-columns: minmax(0, 1fr); } .knowledge-outline { position: static; order: -1; display: flex; flex-wrap: wrap; max-height: 150px; } }
@media (max-width: 699px), (max-height: 500px) and (pointer: coarse) {
  .knowledge-layout { display: block; min-height: calc(100dvh - 140px); border: 0; }
  .knowledge-sidebar { position: fixed; z-index: 20; top: 0; left: 0; width: min(85vw, 340px); height: 100dvh; transform: translateX(-105%); transition: transform .2s ease; box-shadow: var(--elevation); }
  .knowledge-layout.drawer-open .knowledge-sidebar { transform: translateX(0); }
  .knowledge-layout.drawer-open::before { content: ""; position: fixed; inset: 0; z-index: 19; background: rgba(0,0,0,.35); }
  .knowledge-close, .knowledge-drawer-button { display: inline-block; }
  .knowledge-close { border: 0; background: transparent; color: var(--ink); font-size: 23px; min-width: 44px; }
  .knowledge-top { padding: 8px 0; }
  .knowledge-reader, .knowledge-editor { padding: 16px 0 36px; }
  .knowledge-results { margin: 0; width: calc(100% - 32px); }
  .knowledge-history-nav { display: none; }
}
@media (min-width: 700px) and (max-width: 1199px) {
  .shell { grid-template-columns: 78px minmax(0, 1fr); }
  .side { position: sticky; top: 0; left: auto; width: 78px; height: 100dvh; z-index: 8; visibility: visible; transform: none; overflow: visible; padding: calc(16px + var(--safe-t)) 8px calc(12px + var(--safe-b)); box-shadow: none; }
  .brand { justify-content: center; padding: 0 0 20px; }
  .brand > span { display: none; }
  #nav a { justify-content: center; text-align: center; font-size: 10px; padding: 8px 2px; min-height: 52px; }
  .global { display: none; }
  .topbar, .nav-scrim { display: none; }
  #menu-btn { display: none; }
  main { padding: 24px; }
  .sheet-open main { width: calc(100% - min(410px, 48vw)); margin: 0; }
  .panel { width: min(410px, 48vw); }
  .panel:has(.matter-record-sheet) { width: min(600px, 54vw); }
  body.sheet-open:has(.matter-record-sheet) main { width: calc(100% - min(600px, 54vw)); }
  body.sheet-open:has(.matter-record-sheet) .matter-row { grid-template-columns: 1fr; gap: 8px; }
  body.sheet-open:has(.matter-record-sheet) .matter-side { justify-items: start; text-align: left; }
  .scrim { display: none; }
}
@media (max-width: 699px), (max-height: 500px) and (pointer: coarse) {
  html, body { max-width: 100%; overflow-x: clip; }
  .shell { display: block; }
  .side, .topbar, .nav-scrim { display: none !important; }
  main { min-width: 0; padding: calc(76px + var(--safe-t)) calc(16px + var(--safe-r)) calc(var(--phone-nav-height) + 36px) calc(16px + var(--safe-l)); }
  #view, #view > .screen { min-width: 0; max-width: 100%; }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; z-index: 8; left: 0; right: 0; bottom: 0; width: 100%; min-width: 0; min-height: calc(66px + var(--safe-b)); padding: 4px var(--safe-r) var(--safe-b) var(--safe-l); background: color-mix(in srgb, var(--panel) 96%, transparent); border-top: 1px solid var(--line); backdrop-filter: blur(18px); }
  .bottom-nav a { display: grid; min-width: 0; justify-items: center; align-content: center; gap: 3px; min-height: 58px; font-size: clamp(10px, 2.8vw, 12px); line-height: 1.15; font-weight: 550; color: var(--muted); text-decoration: none; border-radius: 10px; touch-action: manipulation; }
  .bottom-nav a > span:last-child { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bottom-nav a:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
  .bottom-nav a[aria-current="true"] { color: var(--blue-ink); }
  .more-list a { grid-template-columns: minmax(0, 1fr) auto; }
  .more-list strong, .more-list .meta { min-width: 0; overflow-wrap: anywhere; }
  input:not([type="checkbox"]):not([type="radio"]), select, textarea { font-size: 16px; }
  #quick-capture { position: absolute; z-index: 7; top: calc(16px + var(--safe-t)); right: calc(16px + var(--safe-r)); bottom: auto; }
  body.signed-out .bottom-nav { display: none; }
  body.keyboard-open .bottom-nav, body.keyboard-open #quick-capture { display: none !important; }
  .tab-icon { width: 20px; height: 20px; border: 1.8px solid currentColor; border-radius: 6px; position: relative; }
  .icon-overview::after { content: ""; position: absolute; inset: 5px; border-radius: 2px; background: currentColor; }
  .icon-inbox { border-radius: 2px 2px 6px 6px; }
  .icon-inbox::after { content: ""; position: absolute; bottom: 5px; left: 5px; width: 7px; border-top: 2px solid currentColor; }
  .icon-todo::after { content: "✓"; position: absolute; top: -5px; left: 2px; font-size: 20px; font-weight: 700; }
  .icon-matters { border-radius: 3px; transform: rotate(-6deg); }
  .icon-waiting-on { border-radius: 50%; }
  .icon-waiting-on::after { content: ""; position: absolute; width: 5px; height: 6px; top: 3px; left: 8px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; }
  .icon-more { border: 0; }
  .icon-more::after { content: "•••"; position: absolute; font-size: 15px; top: -4px; left: 1px; }
  .today-head { margin-bottom: 22px; }
  .brief-counts { gap: 7px; margin-bottom: 26px; }
  .brief-counts a { min-height: 68px; display: grid; gap: 0; padding: 10px 8px; text-align: center; align-content: center; }
  .brief-counts strong { font-size: 23px; }
  .brief-counts span { font-size: 10px; }
  .today-section { margin: 26px 0; }
  .item.card { padding: 16px; }
  .card .card-proposed { white-space: normal; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
  .card-actions .btn { flex: 1 1 auto; }
  .card-actions .btn.primary { flex: 2 1 auto; }
  .matter-row { grid-template-columns: 1fr; gap: 8px; padding: 15px 16px; }
  .matter-side { justify-items: start; text-align: left; grid-auto-flow: row; }
  .panel { top: auto; left: 0; right: 0; bottom: 0; width: 100%; height: min(91dvh, 900px); border: 1px solid var(--line); border-bottom: 0; border-radius: 20px 20px 0 0; padding: 0; animation: sheet-in .18s cubic-bezier(.22,.85,.25,1); }
  .panel:has(.matter-record-sheet) { width: 100%; }
  .panel > header { min-height: 72px; position: relative; padding: 20px 18px 10px; }
  .panel > header h2 { font-size: 19px; margin-top: 6px; }
  .panel-body { padding: 14px 18px calc(44px + var(--safe-b)); }
  .sheet-grab { display: block; position: absolute; top: 8px; left: calc(50% - 18px); width: 36px; height: 5px; border-radius: 9px; background: var(--line); }
  .toast { bottom: calc(78px + var(--safe-b)); }
  .undo-tray { bottom: calc(78px + var(--safe-b)); }
  .btn.fab { bottom: calc(80px + var(--safe-b)); }
}
@keyframes sheet-in { from { transform: translateY(35px); opacity: .7; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .skeleton, .panel { animation: none !important; } .card-removing, .card-collapsing { transition: none !important; } }
@media (pointer: coarse) {
  button, summary, select, input[type="checkbox"], .matter-source { min-height: 44px; }
  .card-details a, .db-list a { display: inline-flex; align-items: center; min-height: 44px; }
  .knowledge-article a, .activity-row a, .history-link a, .billing-row a, .weekly-section a { display: inline-flex; align-items: center; min-width: 44px; min-height: 44px; }
}

/* Compact working cards: decisions on the face, supporting actions in Details. */
.triage-card .card-matter { display: flex; align-items: center; gap: 8px; }
.triage-card .card-matter .matter-chip { flex: 1; min-width: 0; }
.triage-card .card-open, .triage-card.grouped .card-open, .task-open {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 44px;
  min-width: 44px; min-height: 44px; padding: 0; border: 1px solid transparent;
  border-radius: 10px; background: transparent; color: var(--blue-ink); cursor: pointer;
  font: 700 24px var(--sans);
}
.triage-card.grouped .card-open { font-size: 13px; }
.card-open:focus-visible, .task-open:focus-visible, .task:focus-visible { outline: 3px solid var(--blue-ink); outline-offset: 2px; }
.triage-card > .card-actions { grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); }
.triage-card > .card-actions .btn { white-space: nowrap; margin: 0; }
.sheet-actions { margin-bottom: 16px; }
.items.tasks { gap: 12px; }
.item.task { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px; box-shadow: 0 2px 8px #18204b0a; cursor: pointer; }
.task-matter { color: var(--blue-ink); font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }
.task-title { margin: 8px 0; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.task > .task-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.task-detail-title { font-weight: 650; line-height: 1.5; overflow-wrap: anywhere; }
.task-detail .task-actions { margin-top: 16px; }
.task-detail .meta { white-space: pre-wrap; overflow-wrap: anywhere; }
