/* Workspace — deep graphite/navy surfaces, cyan signals, amber attention, muted red failure,
   soft green completion. 16px base; nothing renders under 13px. */
:root {
  --bg: #0b1020;
  --panel: #121a2e;
  --panel-2: #182238;
  --panel-3: #1f2b46;
  --border: #26314d;
  --border-strong: #35436a;
  --text: #e6ebf5;
  --text-2: #b7c1d9;
  --muted: #9aa7c2;
  --cyan: #4fd6e6;
  --cyan-dim: rgba(79, 214, 230, 0.16);
  --teal: #38c2ad;
  --amber: #f2b64a;
  --amber-dim: rgba(242, 182, 74, 0.16);
  --red: #e5636b;
  --red-dim: rgba(229, 99, 107, 0.16);
  --green: #6fcf97;
  --green-dim: rgba(111, 207, 151, 0.16);
  --focus: #8ccfff;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  --radius: 10px;
  --dur: 200ms;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-reduced-motion: reduce) { :root { --dur: 0ms; } *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 16px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.25; }
h2 { font-size: 1.05rem; }
h3 { font-size: 0.95rem; color: var(--text-2); }
p { margin: 0 0 0.5rem; }
a { color: var(--cyan); }
code, kbd, .handle { font-family: var(--mono); font-size: 0.875rem; }
.handle { color: var(--cyan); background: var(--cyan-dim); padding: 1px 6px; border-radius: 6px; white-space: nowrap; }
kbd { background: var(--panel-3); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; padding: 0 6px; }
.muted { color: var(--muted); }
.small-note { font-size: 0.875rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: 8px; top: -40px; background: var(--panel-3); color: var(--text); padding: 6px 10px; border-radius: 6px; z-index: 100; }
.skip:focus { top: 8px; }

/* ---------- app frame */
#app { min-height: 100%; display: grid; grid-template-rows: auto 1fr auto; }
#app[data-mode="viewer"], #app[data-mode="login"] { display: block; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 1px 0 rgba(255,255,255,0.03) inset; }
.loading { padding: 2rem; }

/* ---------- buttons & controls */
.btn { font: inherit; font-size: 0.9375rem; color: var(--text); background: var(--panel-3); border: 1px solid var(--border-strong); border-radius: 8px; padding: 6px 12px; cursor: pointer; line-height: 1.3; transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur) var(--ease); }
.btn:hover { background: #263454; border-color: #47588a; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--cyan); color: #06121c; border-color: transparent; font-weight: 600; }
.btn.primary:hover { background: #71e0ec; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--panel-3); color: var(--text); }
.btn.danger-soft { color: #ffb3b8; border-color: rgba(229,99,107,0.45); background: var(--red-dim); }
.btn.danger-soft:hover { background: rgba(229,99,107,0.28); }
.btn.small { font-size: 0.875rem; padding: 4px 10px; }
.btn.icon { padding: 2px 8px; line-height: 1; font-size: 1rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn.link, .link { background: none; border: 0; padding: 0; color: var(--cyan); cursor: pointer; font: inherit; text-decoration: underline; text-underline-offset: 3px; }
.btn.menu-item { display: block; width: 100%; text-align: left; background: transparent; border-color: transparent; border-radius: 6px; }
.btn.menu-item:hover { background: var(--panel-3); }
input, textarea, select { font: inherit; color: var(--text); background: #0d1428; border: 1px solid var(--border-strong); border-radius: 8px; padding: 8px 10px; }
input::placeholder, textarea::placeholder { color: #6f7c99; }
textarea { resize: vertical; }
.field { display: grid; gap: 4px; margin: 0.5rem 0; }
.field > span { font-size: 0.875rem; color: var(--muted); }
.controls { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.controls.secondary { justify-content: flex-start; }
.inline-date input { padding: 4px 8px; font-size: 0.875rem; }

/* ---------- chips & pills */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 0.8125rem; line-height: 1.2; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--panel-2); color: var(--text-2); white-space: nowrap; max-width: 100%; }
.chip.small { font-size: 0.8125rem; padding: 2px 7px; }
.chip .ref { color: var(--muted); }
.chip.editable { cursor: pointer; font: inherit; font-size: 0.8125rem; }
.chip.editable:hover { border-color: var(--cyan); color: var(--text); }
.chip.attention, .attention { border-color: rgba(242,182,74,0.6); color: var(--amber); background: var(--amber-dim); }
.chip.bucket { border-color: rgba(79,214,230,0.35); color: var(--cyan); background: var(--cyan-dim); }
.chip.shared { border-color: rgba(56,194,173,0.5); color: var(--teal); background: rgba(56,194,173,0.14); }
.chip.readiness-ready { border-color: rgba(111,207,151,0.5); color: var(--green); background: var(--green-dim); }
.chip.readiness-blocked, .chip.readiness-waiting-person { border-color: rgba(229,99,107,0.45); color: #ffb3b8; background: var(--red-dim); }
.chip.readiness-needs-decision, .chip.readiness-unknown { border-color: rgba(242,182,74,0.6); color: var(--amber); background: var(--amber-dim); }
.chip.source { color: var(--text-2); text-decoration: none; }
a.chip.source:hover { border-color: var(--cyan); }
.chip.kind-research { color: #b8c6ff; } .chip.kind-draft { color: #d9c7ff; } .chip.kind-apply { color: var(--teal); } .chip.kind-send, .chip.kind-decide { color: var(--amber); }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 0.875rem; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--panel-2); }
.pill time { color: inherit; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.live { background: var(--cyan); box-shadow: 0 0 0 3px var(--cyan-dim); }
.liveness-running, .liveness-starting, .liveness-queued { color: var(--cyan); border-color: rgba(79,214,230,0.4); background: var(--cyan-dim); }
.liveness-reconnecting, .liveness-awaiting_decision, .liveness-awaiting_approval { color: var(--amber); border-color: rgba(242,182,74,0.55); background: var(--amber-dim); }
.liveness-worker_offline, .liveness-failed { color: #ffb3b8; border-color: rgba(229,99,107,0.5); background: var(--red-dim); }
.liveness-paused, .liveness-checkpointed, .liveness-cancelled { color: var(--text-2); }
.liveness-completed { color: var(--green); border-color: rgba(111,207,151,0.5); background: var(--green-dim); }
.count { display: inline-block; min-width: 1.4em; text-align: center; font-size: 0.8125rem; padding: 1px 6px; border-radius: 999px; background: var(--panel-3); color: var(--text-2); }
.count.attention { background: var(--amber-dim); color: var(--amber); }

/* ---------- top bar */
.topbar { padding: 10px 16px 6px; background: linear-gradient(180deg, #0f1730 0%, var(--bg) 100%); border-bottom: 1px solid var(--border); }
.bar-row { display: flex; align-items: center; gap: 16px; }
.sources-row { margin-top: 6px; justify-content: space-between; gap: 12px; }
.app-name { font-size: 1.125rem; letter-spacing: 0.01em; white-space: nowrap; }
.role-tag { font-size: 0.8125rem; color: var(--muted); font-weight: 500; margin-left: 6px; }
.top-three { flex: 1 1 auto; min-width: 0; }
.top-list { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; }
.top-item { flex: 1 1 0; min-width: 0; }
.top-link { display: flex; gap: 8px; width: 100%; text-align: left; font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 10px; cursor: pointer; transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease); }
.top-link:hover, .top-item.selected .top-link { border-color: var(--cyan); background: var(--panel-2); }
.top-link .rank { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--cyan-dim); color: var(--cyan); font-size: 0.8125rem; font-weight: 700; display: grid; place-items: center; margin-top: 2px; }
.top-body { min-width: 0; display: grid; gap: 2px; }
.top-title { font-size: 0.9375rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.top-link { min-width: 0; }
.top-meta { font-size: 0.8125rem; color: var(--muted); display: flex; gap: 6px; align-items: center; min-width: 0; }
.top-meta .why { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-meta .chip { flex: none; }
.top-empty { font-size: 0.9375rem; padding: 6px 0; }
.budget { flex: none; width: 300px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 10px; display: grid; gap: 4px; }
.budget.exhausted { border-color: rgba(242,182,74,0.6); }
.budget-line { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.875rem; }
.budget-label { color: var(--muted); }
.budget-bar { height: 6px; border-radius: 3px; background: var(--panel-3); display: flex; overflow: hidden; }
.budget-bar .used { background: var(--cyan); }
.budget-bar .reserved { background: repeating-linear-gradient(135deg, var(--cyan-dim) 0 4px, rgba(79,214,230,0.4) 4px 8px); }
.budget-run { display: flex; align-items: center; gap: 6px; font-size: 0.875rem; min-width: 0; }
.budget-run .run-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; min-width: 0; }
.identity { flex: none; position: relative; }
.menu summary { list-style: none; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.menu summary::-webkit-details-marker { display: none; }
.menu .avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--panel-3); border: 1px solid var(--border-strong); display: grid; place-items: center; font-size: 0.8125rem; font-weight: 600; }
.menu .role { font-size: 0.8125rem; color: var(--muted); }
.menu-body { position: absolute; right: 0; top: calc(100% + 6px); background: var(--panel-2); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 6px; min-width: 200px; box-shadow: var(--shadow); z-index: 30; display: grid; gap: 2px; }
.sources { display: flex; flex-wrap: wrap; gap: 6px; }
.chip.source-state .dot { background: var(--muted); }
.src-ok .dot { background: var(--green); } .src-partial .dot { background: var(--amber); } .src-failed .dot, .src-denied .dot { background: var(--red); } .src-unavailable .dot, .src-not-configured .dot { background: #5d6a8a; }
.src-denied { border-color: rgba(229,99,107,0.45); } .src-partial { border-color: rgba(242,182,74,0.5); } .src-failed { border-color: rgba(229,99,107,0.45); }
.conn { font-size: 0.8125rem; color: var(--muted); white-space: nowrap; }
.conn-live::before, .conn-reconnecting::before, .conn-offline::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--green); }
.conn-reconnecting::before { background: var(--amber); } .conn-offline::before { background: var(--red); }

/* ---------- columns */
.columns { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(320px, 1.35fr) minmax(280px, 1.05fr) minmax(280px, 1.05fr); grid-template-rows: auto auto; gap: 12px; padding: 12px 16px; align-items: start; min-height: 0; }
#col-incoming, #col-inflight { grid-row: 1 / span 2; }
#col-review { grid-column: 4; grid-row: 1 / span 2; display: grid; gap: 12px; align-content: start; min-width: 0; }
#col-decision { grid-column: 3; grid-row: 1; }
#activity { grid-column: 3; grid-row: 2; }
.done-row { padding-top: 6px; padding-bottom: 6px; }
.col { padding: 12px 14px; display: grid; gap: 10px; align-content: start; min-width: 0; overflow-wrap: anywhere; }
.col > *, .stack > *, .bucket-group > *, .stale > * { min-width: 0; }
.col-head { display: flex; align-items: baseline; gap: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); min-width: 0; }
.col-head h2 { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-head .muted { font-size: 0.875rem; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stack, .bucket-group, .stale { display: grid; gap: 8px; }
.stack h3, .bucket-group h3, .stale h3 { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.rank-badge { font-size: 0.8125rem; color: var(--cyan); background: var(--cyan-dim); padding: 1px 7px; border-radius: 999px; }
.empty { padding: 8px 4px; font-size: 0.9375rem; }

/* ---------- task cards */
.task { position: relative; min-width: 0; max-width: 100%; background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; display: grid; gap: 6px; justify-items: start; transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.task > * { min-width: 0; max-width: 100%; }
.task > .task-line1, .task > .task-chips, .task > .task-meta, .task > .exec, .task > .milestone, .task > .why, .task > .reason, .task > .blocker-line, .task > .controls, .task > .triage-missing { justify-self: stretch; }
.task:hover { border-color: var(--border-strong); }
.task.selected { border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan) inset; }
.task.untriaged { border-left: 3px solid var(--amber); }
.task.executing { border-left: 3px solid var(--cyan); }
.task.grade { border-left: 3px solid var(--green); }
.task.enter { animation: enter var(--dur) var(--ease) both; }
.task.moved { animation: moved calc(var(--dur) + 50ms) var(--ease) both; }
@keyframes enter { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes moved { from { opacity: 0.2; transform: translateX(-24px); } to { opacity: 1; transform: none; } }
.task-line1 { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; min-width: 0; }
.task-title { font: inherit; font-weight: 500; color: var(--text); background: none; border: 0; padding: 0; text-align: left; cursor: pointer; line-height: 1.4; flex: 1 1 100%; min-width: 0; max-width: 100%; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
.task-title:focus-visible { outline-offset: 0; }
.task-title:hover { color: var(--cyan); }
.task-title.static { cursor: default; }
.task-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.task-meta { font-size: 0.875rem; }
.blocker { color: #ffb3b8; }
.blocker-line { font-size: 0.9375rem; display: flex; gap: 6px; align-items: baseline; }
.reason { font-size: 0.875rem; }
.why { font-size: 0.8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.milestone, .blocker-line, .task-meta, .reason { overflow-wrap: anywhere; }
.chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.triage-missing { font-size: 0.875rem; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.triage-missing .chip.link { text-decoration: none; border-color: rgba(242,182,74,0.6); color: var(--amber); background: var(--amber-dim); cursor: pointer; }
.exec { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; font-size: 0.875rem; }
.milestone { font-size: 0.9375rem; color: var(--text-2); padding-left: 10px; border-left: 2px solid var(--cyan-dim); }
.stale { padding-top: 8px; border-top: 1px dashed var(--border); }
.stale-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; font-size: 0.9375rem; min-width: 0; }
.stale-row .task-title { flex: 1 1 auto; }

/* ---------- decision card */
.card { background: var(--panel-2); border: 1px solid rgba(242,182,74,0.45); border-radius: var(--radius); padding: 14px; display: grid; gap: 10px; box-shadow: 0 0 0 1px var(--amber-dim) inset; }
.card-kind { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 0.875rem; }
.situation { font-size: 1.05rem; font-weight: 500; line-height: 1.4; color: var(--text); overflow-wrap: anywhere; }
.card-kind { justify-content: space-between; }
.card-kind-lead { display: flex; flex: 1 1 auto; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; }
.card-time { flex: 0 0 auto; }
/* The ask sits above the worker's question: initiative, the human sentence, the outcome, the links. */
.ask { display: grid; gap: 4px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.ask-label { font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; margin: 0; }
.situation .ask-label { display: block; font-weight: 400; margin-bottom: 2px; }
.ask-text { margin: 0; font-size: 0.9375rem; line-height: 1.45; color: var(--text); overflow-wrap: anywhere; }
.ask-outcome { margin: 0; font-size: 0.875rem; }
.ask-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
/* What the question names, defined above it. */
.situation-block { display: grid; gap: 10px; min-width: 0; }
.situation-block > * { min-width: 0; }
.situation-block .background { margin: 0; color: var(--text-2); font-size: 0.9375rem; line-height: 1.45; overflow-wrap: anywhere; }
.situation-block .background .ask-label { display: block; margin-bottom: 2px; }
.situation-block .background-gap { margin: 0; font-size: 0.875rem; }
/* A run's report, read in place; bounded so the options stay reachable. */
.report { display: grid; gap: 8px; justify-items: start; min-width: 0; }
.report-note { margin: 0; font-size: 0.875rem; overflow-wrap: anywhere; }
.report-body { justify-self: stretch; max-height: 60vh; overflow: auto; padding: 8px 12px; background: var(--panel-3); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 0.9375rem; line-height: 1.5; overflow-wrap: anywhere; }
.report-body h4 { margin: 12px 0 4px; font-size: 0.9375rem; }
.report-body p, .report-body ul { margin: 0 0 8px; }
.card { min-width: 0; }
.card > * { min-width: 0; }
.pr-summary { font-size: 0.9375rem; color: var(--text-2); }
.pr-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.agenda-item { margin: 0.5rem 0 0; padding-left: 1.2em; font-size: 0.9375rem; line-height: 1.5; }
.pr-files { margin: 0; padding-left: 1.2em; font-size: 0.9375rem; }
.pr-files code { overflow-wrap: anywhere; }
.ledger-group { border: 0; margin: 0.5rem 0 0; padding: 0; }
.ledger-group legend { font-weight: 600; font-size: 0.875rem; padding: 0; }
.ledger-group ul { list-style: none; margin: 0.25rem 0 0; padding: 0; }
.ledger-item { display: grid; gap: 0.125rem; padding: 0.375rem 0; font-size: 0.9375rem; line-height: 1.45; }
.ledger-item label { display: flex; gap: 0.5rem; align-items: baseline; cursor: pointer; }
.ledger-evidence, .ledger-into, .ledger-demoted, .ledger-unknown { padding-left: 1.5rem; font-size: 0.8125rem; overflow-wrap: anywhere; }
.ledger-more summary { cursor: pointer; font-size: 0.875rem; }
.pr-diff { font-size: 0.8125rem; margin: 0; padding: 8px 10px; background: #0a1020; border: 1px solid var(--border); border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-2); }
.pr-body { background: #0a1020; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; max-height: 260px; overflow: auto; font-size: 0.9375rem; line-height: 1.5; }
.pr-body h4 { margin: 8px 0 4px; font-size: 0.9375rem; color: var(--text); }
.pr-body h4:first-child { margin-top: 0; }
.pr-body p { margin: 0 0 6px; overflow-wrap: anywhere; }
.pr-body ul { margin: 0 0 6px; padding-left: 1.2em; }
.pr-body code { font-size: 0.8125rem; background: var(--panel-3); padding: 0 4px; border-radius: 4px; overflow-wrap: anywhere; }
.pr-closed { font-size: 0.875rem; }
.situation .action { color: var(--amber); }
.context { font-size: 0.9375rem; }
.options { display: grid; gap: 8px; }
.option { font: inherit; text-align: left; color: var(--text); background: var(--panel-3); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 10px 12px; cursor: pointer; display: grid; gap: 4px; transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease); }
.option:hover { border-color: var(--cyan); background: #24325a; }
.option.recommended { border-color: var(--cyan); background: linear-gradient(180deg, rgba(79,214,230,0.14), rgba(79,214,230,0.04)); }
.option.current { border-color: var(--teal); }
.option.armed { border-color: var(--amber, #e0a94a); box-shadow: 0 0 0 2px rgba(224, 169, 74, 0.35); }
.option.small { padding: 6px 10px; }
.option-label { font-weight: 600; }
.rec-tag { font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--cyan); margin-left: 8px; }
.option-consequence { font-size: 0.875rem; color: var(--text-2); }
.pause-reason { font-size: 0.9375rem; color: var(--text-2); }
.worker-did { font-size: 0.9375rem; background: var(--panel-3); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; }
.worker-did > summary { cursor: pointer; color: var(--muted); font-size: 0.875rem; }
.worker-did > p { margin: 8px 0 0; color: var(--text-2); overflow-wrap: anywhere; }
.rec-why { font-size: 0.875rem; color: var(--cyan); }
.standin { font-size: 0.875rem; }
.why-approval { font-size: 0.9375rem; }
.content { background: #0a1020; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; max-height: 260px; overflow: auto; white-space: pre-wrap; word-break: break-word; font-size: 0.875rem; line-height: 1.5; margin: 0; }
.hash { font-size: 0.8125rem; }
.quiet { padding: 18px 6px; display: grid; gap: 4px; }
.quiet-title { font-size: 1.05rem; color: var(--text-2); }
.more { font-size: 0.875rem; }

/* ---------- composer */
.composer-region { position: sticky; bottom: 0; z-index: 20; background: linear-gradient(180deg, rgba(11,16,32,0) 0%, var(--bg) 18%); padding: 8px 16px 12px; display: grid; grid-template-columns: minmax(420px, 1.4fr) minmax(320px, 1fr); gap: 12px; align-items: start; }
.composer { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; background: var(--panel); border: 1px solid var(--border-strong); border-radius: 12px; padding: 8px 10px; box-shadow: var(--shadow); }
.composer input { width: 100%; font-size: 1rem; padding: 10px 12px; background: #0a1020; }
.composer input:focus { border-color: var(--cyan); }
.composer .hint { grid-column: 1 / -1; font-size: 0.8125rem; }
.mode-chip { font-size: 0.8125rem; color: var(--cyan); background: var(--cyan-dim); border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.priorities { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: flex-start; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px; font-size: 0.875rem; }
.prio-block { display: grid; gap: 4px; min-width: 0; }
.prio-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.prio-title { font-weight: 600; color: var(--text-2); }
.ranking { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px 14px; counter-reset: rank; }
.ranking li { white-space: nowrap; counter-increment: rank; }
.ranking li::before { content: counter(rank); display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: 6px; border-radius: 50%; background: var(--cyan-dim); color: var(--cyan); font-size: 0.8125rem; font-weight: 700; }
.ranking.large { display: grid; gap: 6px; font-size: 1rem; }
.overrides { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }

/* ---------- drawer */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 92vw); background: var(--panel); border-left: 1px solid var(--border-strong); box-shadow: -16px 0 40px rgba(0,0,0,0.45); z-index: 40; transform: translateX(100%); transition: transform var(--dur) var(--ease); display: grid; grid-template-rows: auto auto 1fr; }
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: flex-start; gap: 10px; padding: 14px 16px 8px; border-bottom: 1px solid var(--border); }
.drawer-title { flex: 1 1 auto; min-width: 0; display: grid; gap: 6px; }
.drawer-title h2 { font-size: 1.05rem; line-height: 1.35; overflow-wrap: anywhere; }
.tabs { display: flex; gap: 4px; padding: 6px 12px 0; border-bottom: 1px solid var(--border); }
.tab { font: inherit; font-size: 0.9375rem; color: var(--muted); background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px; cursor: pointer; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--cyan); border-bottom-color: var(--cyan); }
.drawer-body { overflow: auto; padding: 12px 16px 24px; display: grid; gap: 14px; align-content: start; }
.detail-section { display: grid; gap: 6px; }
.detail-section h3 { display: flex; align-items: center; gap: 8px; }
.kv-list { margin: 0; display: grid; gap: 4px; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 10px; font-size: 0.9375rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
blockquote { margin: 4px 0 0; padding: 6px 10px; border-left: 2px solid var(--border-strong); color: var(--text-2); font-size: 0.9375rem; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.events .ev { display: grid; grid-template-columns: 90px 110px 1fr; gap: 8px; font-size: 0.875rem; padding: 4px 0; border-bottom: 1px dashed var(--border); }
.ev-type { color: var(--muted); font-family: var(--mono); font-size: 0.8125rem; }
.ev-tool .ev-type, .ev-milestone .ev-type { color: var(--cyan); }
.ev-heartbeat { color: var(--muted); }
.exec-block { display: grid; gap: 6px; padding: 10px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; }
.small-pre { font-size: 0.8125rem; margin: 4px 0 0; white-space: pre-wrap; color: var(--text-2); }
.error-line { color: #ffb3b8; }
.deliverables li { padding: 8px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; }
.result-evidence { font-size: 0.9375rem; }

/* ---------- graph */
.graph { width: 100%; height: auto; background: #0a1020; border: 1px solid var(--border); border-radius: 8px; }
.graph .edge line { stroke: var(--border-strong); stroke-width: 1.5; }
.graph .edge-label { fill: var(--muted); font-size: 11px; text-anchor: middle; }
.graph .legend { fill: var(--muted); font-size: 11px; }
.graph .legend-band { fill: #0d1428; }
.graph .node-label { fill: var(--text); font-size: 12px; text-anchor: middle; pointer-events: none; }
.graph .node-label.below { fill: var(--text-2); font-size: 11px; }
.graph .node-task { fill: #1c2a4a; stroke: var(--cyan); stroke-width: 1.5; }
.graph .node-task.focus { fill: #163a48; stroke-width: 2.5; }
.graph .node-initiative { fill: #1b2340; stroke: #8f9cff; stroke-width: 1.5; }
.graph .node-ticket { fill: #1a2a2b; stroke: var(--teal); stroke-width: 1.5; }
.graph .node-person { fill: #2a2438; stroke: #c9a6ff; stroke-width: 1.5; }
.graph .node-blocker { fill: #2f1c22; stroke: var(--red); stroke-width: 1.5; }
.graph .node-decision { fill: #2c2616; stroke: var(--amber); stroke-width: 1.5; }
.graph .node-decision-mark { fill: var(--amber); }
.graph .clickable { cursor: pointer; }
.graph .clickable:hover rect, .graph .clickable:focus rect { stroke-width: 3; }

/* ---------- activity */
.activity { padding: 8px 12px; display: grid; gap: 8px; align-content: start; }
.activity.open .activity-body { max-height: 46vh; overflow: auto; }
.activity .col-head { border-bottom: 0; padding-bottom: 0; }
.activity-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.activity-row { display: grid; grid-template-columns: 82px 1fr; gap: 8px; font-size: 0.875rem; padding-bottom: 6px; border-bottom: 1px dashed var(--border); }
.act-time { color: var(--muted); white-space: nowrap; }
.act-completed .act-body::before { content: "✓ "; color: var(--green); }
.act-denied .act-body::before, .act-failed .act-body::before { content: "! "; color: var(--red); }
.act-pending .act-body::before { content: "• "; color: var(--amber); }
.handle-link { text-decoration: none; }

/* ---------- history */
.history { margin: 12px 16px; padding: 12px 16px; display: grid; gap: 10px; }
.history-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.history-search { display: flex; gap: 8px; flex: 1 1 320px; }
.history-search input { flex: 1 1 auto; }
.history-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.history-row { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; display: grid; gap: 4px; }

/* ---------- popover, modal, toasts */
#popover { position: absolute; z-index: 60; }
.popover { width: 330px; background: var(--panel-2); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px; display: grid; gap: 8px; animation: enter var(--dur) var(--ease) both; }
.popover-head { display: flex; align-items: center; gap: 8px; }
.popover-head .btn { margin-left: auto; }
.popover-body { display: grid; gap: 6px; }
#modal .modal-backdrop { position: fixed; inset: 0; background: rgba(5, 8, 18, 0.6); z-index: 70; }
.modal { position: fixed; z-index: 71; top: 12vh; left: 50%; transform: translateX(-50%); width: min(520px, 92vw); background: var(--panel-2); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow); padding: 18px; display: grid; gap: 8px; animation: enter var(--dur) var(--ease) both; }
.modal h2 { font-size: 1.1rem; }
.shortcuts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
.shortcuts dd { margin: 0; }
#toasts { position: fixed; top: 12px; right: 16px; z-index: 90; display: grid; gap: 8px; width: min(380px, 90vw); }
.toast { display: flex; align-items: center; gap: 10px; background: var(--panel-3); border: 1px solid var(--border-strong); border-left: 3px solid var(--cyan); border-radius: 10px; padding: 10px 12px; box-shadow: var(--shadow); animation: enter var(--dur) var(--ease) both; font-size: 0.9375rem; }
.toast span { flex: 1 1 auto; }
.toast-ok { border-left-color: var(--green); } .toast-warn { border-left-color: var(--amber); } .toast-error { border-left-color: var(--red); }
.toast.leaving { opacity: 0; transition: opacity var(--dur) var(--ease); }

/* ---------- login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(420px, 92vw); background: var(--panel); border: 1px solid var(--border-strong); border-radius: 14px; padding: 24px; display: grid; gap: 10px; box-shadow: var(--shadow); }
.login-card label { color: var(--text-2); }

/* ---------- viewer */
.demo-banner { position: sticky; top: 0; z-index: 60; text-align: center; padding: 6px 16px; background: var(--amber); color: #1a1408; font-weight: 700; letter-spacing: 0.04em; font-size: 0.875rem; }
.preview-banner { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 12px; justify-content: center; padding: 8px 16px; background: var(--amber-dim); border-bottom: 1px solid rgba(242,182,74,0.6); color: var(--amber); font-size: 0.9375rem; }
.viewer-main { display: grid; grid-template-columns: repeat(2, minmax(320px, 1fr)); gap: 12px; padding: 12px 16px; align-items: start; }
.viewer-main .panel { padding: 12px 14px; display: grid; gap: 10px; align-content: start; }
.initiative { display: grid; gap: 4px; padding: 10px 12px; background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius); }
.initiative h3 { color: var(--text); font-size: 1rem; }
.eng-bar { height: 6px; border-radius: 3px; background: var(--panel-3); overflow: hidden; }
.eng-bar span { display: block; height: 100%; background: var(--green); }
.by-status { font-size: 0.875rem; }
.binding-linked { color: var(--green); } .binding-partial { color: var(--amber); } .binding-unlinked { color: var(--muted); }

/* ---------- responsive */
@media (max-width: 1200px) {
  .columns { grid-template-columns: 1fr 1fr; grid-template-rows: auto auto auto auto; }
  #col-decision { grid-column: 1 / -1; grid-row: 1; }
  #col-incoming { grid-column: 1; grid-row: 2; } #col-inflight { grid-column: 2; grid-row: 2; }
  #col-review { grid-column: 1 / -1; grid-row: 3; grid-template-columns: 1fr 1fr; align-items: start; }
  #activity { grid-column: 1 / -1; grid-row: 4; }
  .bar-row { flex-wrap: wrap; }
  .top-three { order: 3; flex-basis: 100%; }
  .budget { width: 280px; }
  .composer-region { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .columns { grid-template-columns: 1fr; grid-template-rows: auto; }
  #col-decision, #col-incoming, #col-inflight, #col-review, #activity { grid-column: 1; grid-row: auto; }
  #col-review { grid-template-columns: 1fr; }
  .top-list { flex-direction: column; }
  .viewer-main { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
}

/* Recap is a durable receipt view, kept separate from the action queue. */
.morning-recap { margin: 0 20px 16px; padding: 12px 16px; }
.morning-recap summary { cursor: pointer; }
.recap-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; padding-top: 12px; }
.recap-grid h3 { font-size: 14px; }
.recap-grid ul { padding-left: 18px; }
.recap-grid li { margin: 8px 0; overflow-wrap: anywhere; }
#budget-form { padding: 10px; max-width: 250px; }
#budget-form input { width: 80px; }
.morning-recap[open] { max-height: 44vh; overflow-y: auto; }
.morning-recap[open] > summary { position: sticky; top: -12px; background: var(--panel); padding: 8px 0; z-index: 1; }
.recap-grid .btn.ghost { text-align: left; padding-left: 0; }

/* ---------- sign-in with Clerk */
#clerk-sign-in { display: grid; place-items: center; min-height: 120px; }
#clerk-sign-in .cl-rootBox { width: 100%; }
#clerk-sign-in .cl-cardBox { width: 100%; box-shadow: none; }
.login-note { margin: 0; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border-strong); }
.login-note.refused { border-color: var(--amber); }
.login-bridge summary { cursor: pointer; }
.login-bridge-form { display: grid; gap: 8px; margin-top: 8px; }

/* Weekly editor (This week's order): 44px targets per DESIGN-DIRECTION § Non-negotiables. */
.chip.note { color: var(--muted); border-style: dashed; }
.wk-list { list-style: none; margin: 8px 0 12px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.wk-row { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 4px 0 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-2); }
.wk-row.drag-over { border-color: var(--cyan); }
.wk-grip { cursor: grab; color: var(--muted); user-select: none; }
.wk-n { min-width: 1.5em; color: var(--muted); font-variant-numeric: tabular-nums; }
.wk-label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.wk-moves { display: flex; gap: 2px; }
.wk-moves .btn.icon { min-width: 44px; min-height: 44px; }
.wk-add { display: flex; align-items: flex-end; gap: 8px; }
.wk-add .field { flex: 1; }
.wk-add .btn { min-height: 44px; }
.sources-line { margin: 4px 0 0; font-size: 0.8125rem; }
.why-order { margin-top: 6px; font-size: 0.875rem; }
.why-order summary { cursor: pointer; color: var(--muted); min-height: 44px; display: flex; align-items: center; }
.why-order ol { margin: 4px 0 0; padding-left: 1.25em; }
