/* CRI HQ: a bright, quiet work surface. Structure sits on hairlines; colour is
   kept for state (red overdue or off track, amber at risk, green on track) and
   for the teal steps of "how soon". Light only, by request. */
:root {
  color-scheme: light;
  --canvas: #f6f7f7;
  --card: #ffffff;
  --ink: #15191b;
  --ink-2: #4b5458;
  --ink-3: #687177;
  --rule: #e5e8e9;
  --rule-2: #d3d8da;
  --wash: #f1f3f4;
  --hover: #f5f7f7;
  --brand: #0f5e58;
  --brand-hover: #0c4e49;
  --brand-wash: #e6f0ee;
  --brand-ink: #0d544f;
  --good: #0ca30c;
  --good-ink: #0f7a2e;
  --good-wash: #e9f6ec;
  --warn: #fab219;
  --warn-ink: #8a5300;
  --warn-wash: #fff4dc;
  --bad: #d03b3b;
  --bad-ink: #b42318;
  --bad-wash: #fdecec;
  --soon: #0f5e58;
  --later: #5d9b94;
  --nodate: #c5cccb;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r-sm: 4px;
  --r: 6px;
  --r-lg: 8px;
  --shadow-pop: 0 10px 28px rgb(16 24 22 / 0.12), 0 1px 3px rgb(16 24 22 / 0.08);
  --shadow-drawer: -16px 0 40px rgb(16 24 22 / 0.10);
  --gutter: 24px;
  --max: 1320px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--canvas); color: var(--ink); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body.has-drawer { overflow: hidden; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: var(--r-sm); }
h1, h2, h3, p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--card); padding: 6px 10px; border-radius: var(--r); box-shadow: var(--shadow-pop); }
.skip:focus { left: 8px; }
.muted { color: var(--ink-3); }
.bad-text { color: var(--bad-ink); }
.icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* ── Top bar ── */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--card); border-bottom: 1px solid var(--rule); }
.topbar-inner { max-width: var(--max); margin: 0 auto; height: 52px; padding: 0 var(--gutter); display: flex; align-items: center; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; font-size: 15px; letter-spacing: -0.01em; white-space: nowrap; }
.mark { width: 14px; height: 14px; border-radius: 4px; background: var(--brand); box-shadow: inset 0 0 0 3px var(--brand), inset 0 0 0 5px #fff; flex: none; }
.nav { display: flex; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; flex: 1; }
.nav::-webkit-scrollbar { display: none; }
.nav-link { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: var(--r); color: var(--ink-2); font-weight: 500; white-space: nowrap; }
.nav-link:hover { background: var(--hover); color: var(--ink); }
.nav-link[aria-current="page"] { background: var(--wash); color: var(--ink); }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--bad-wash); color: var(--bad-ink); font-size: 11.5px; font-weight: 600; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.topbar-tools { display: flex; align-items: center; gap: 8px; }
.today { color: var(--ink-3); font-size: 13px; white-space: nowrap; margin-right: 4px; }
#refresh.is-busy .icon { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Page ── */
.page { max-width: var(--max); margin: 0 auto; padding: 20px var(--gutter) 64px; }
.page:focus { outline: none; }
.view { display: flex; flex-direction: column; gap: 16px; }
.loading { color: var(--ink-3); padding: 40px 0; text-align: center; }
.notice { margin: 0 0 16px; padding: 10px 14px; border-radius: var(--r); background: var(--warn-wash); color: var(--warn-ink); font-size: 13px; }
.notice[data-tone="bad"] { background: var(--bad-wash); color: var(--bad-ink); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.halves { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }

/* ── Cards ── */
.card { background: var(--card); border: 1px solid var(--rule); border-radius: var(--r-lg); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; min-height: 48px; }
.card-head { flex-wrap: wrap; }
.card-head h2 { font-size: 14px; font-weight: 600; white-space: nowrap; }
.card > .health, .card > .workload { padding: 0 16px 16px; }
.empty { padding: 28px 16px; text-align: center; color: var(--ink-3); display: flex; flex-direction: column; align-items: center; gap: 12px; }

/* ── Buttons and inputs ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--r); border: 1px solid var(--rule-2); background: var(--card); color: var(--ink); font-weight: 500; font-size: 13px; white-space: nowrap; transition: background 0.12s, border-color 0.12s; }
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--wash); color: var(--ink); }
.btn-icon { width: 32px; padding: 0; }
.btn-small { height: 30px; padding: 0 10px; }
.btn-xs { height: 26px; padding: 0 8px; font-size: 12.5px; gap: 4px; }
.btn-xs .icon { width: 14px; height: 14px; }
.input { height: 32px; padding: 0 10px; border: 1px solid var(--rule-2); border-radius: var(--r); background: var(--card); min-width: 0; }
.input:hover { border-color: #bfc6c9; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-wash); }
select.input { padding-right: 28px; appearance: none; background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 6.5L8 10l3.5-3.5' fill='none' stroke='%23687177' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 8px center / 14px; }
.input-area { width: 100%; height: auto; min-height: 34px; padding: 7px 10px; resize: none; line-height: 1.4; }
.input-date { width: 150px; }
.input-wide { width: 100%; max-width: 360px; }
.seg { display: inline-flex; border: 1px solid var(--rule-2); border-radius: var(--r); background: var(--card); padding: 2px; gap: 2px; }
.seg button { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--ink-2); font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.seg button:hover { background: var(--hover); color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--brand-wash); color: var(--brand-ink); font-weight: 600; }
.seg-wrap { flex-wrap: wrap; }
.seg-tight button { padding: 0 6px; gap: 5px; }

/* ── Pills, tags, dots, avatars ── */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px; background: var(--wash); color: var(--ink-2); font-size: 12px; font-weight: 500; white-space: nowrap; }
.pill .dot, .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--nodate); }
.pill-quiet { background: var(--wash); color: var(--ink-3); }
.pill-warn { background: var(--warn-wash); color: var(--warn-ink); }
.health-on-track .dot, .health-dot-on-track { background: var(--good); }
.health-at-risk .dot, .health-dot-at-risk { background: var(--warn); }
.health-off-track .dot, .health-dot-off-track { background: var(--bad); }
.health-off-track { background: var(--bad-wash); color: var(--bad-ink); }
.health-at-risk { background: var(--warn-wash); color: var(--warn-ink); }
.tag { display: inline-block; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 1px 8px; border-radius: var(--r-sm); background: var(--wash); color: var(--ink-2); font-size: 12px; line-height: 20px; }
a.tag:hover { background: var(--rule); }
.avatar { display: inline-grid; place-items: center; border-radius: 50%; font-weight: 600; letter-spacing: 0.01em; flex: none; border: 0; padding: 0; }
.avatar-xs { width: 18px; height: 18px; font-size: 8.5px; }
.avatar-sm { width: 22px; height: 22px; font-size: 9.5px; }
.avatar-md { width: 30px; height: 30px; font-size: 11.5px; }
.avatar-lg { width: 40px; height: 40px; font-size: 14px; }
.avatars { display: inline-flex; }
.avatars .avatar + .avatar { margin-left: -5px; box-shadow: 0 0 0 2px var(--card); }
.avatar-none, .avatar-more { background: var(--wash); color: var(--ink-3); }
.tint-0 { background: #e3f0ee; color: #0f5e58; }
.tint-1 { background: #e6edf8; color: #2a5aa8; }
.tint-2 { background: #efe9f8; color: #5b3fa6; }
.tint-3 { background: #fbeedd; color: #8a5300; }
.tint-4 { background: #f9e6ec; color: #a3325a; }
.tint-5 { background: #e9ecee; color: #3f4a50; }
.avatar-btn { cursor: pointer; }
.avatar-btn:hover { filter: brightness(0.97); }
.who { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }

/* Status marks: empty ring, half-filled, blocked bar, done tick, dropped slash */
.status-mark { width: 16px; height: 16px; flex: none; }
.status-mark .ring { fill: none; stroke: #9aa3a7; stroke-width: 1.6; }
.status-mark .fill { fill: var(--brand); }
.status-mark .mark { fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.s-in-progress .ring { stroke: var(--brand); }
.s-blocked .ring { stroke: var(--bad); fill: var(--bad-wash); }
.s-blocked .mark { stroke: var(--bad); }
.s-done .ring { stroke: var(--good-ink); fill: var(--good-ink); }
.s-done .mark { stroke: #fff; }
.s-dropped .ring { stroke: #b8c0c3; }
.s-dropped .mark { stroke: #9aa3a7; }

/* ── Action rows ── */
.rows > * + *, .group-body > * + * { border-top: 1px solid var(--rule); }
.arow { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: start; gap: 8px; padding: 8px 16px 8px 12px; cursor: pointer; transition: background 0.1s; }
.arow:hover { background: var(--hover); }
.arow.is-closed .arow-title { color: var(--ink-3); }
.status-btn { width: 24px; height: 24px; display: grid; place-items: center; border: 0; background: none; border-radius: var(--r-sm); margin-top: -1px; }
.status-btn:hover { background: var(--wash); }
.arow-main { min-width: 0; padding-top: 2px; }
.arow-title { display: block; font-weight: 500; overflow-wrap: anywhere; }
.arow-title:hover { text-decoration: underline; text-decoration-color: var(--rule-2); text-underline-offset: 3px; }
.arow-note { margin-top: 2px; color: var(--ink-3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arow-note.is-blocker { color: var(--bad-ink); }
.arow-side { display: flex; align-items: center; gap: 10px; padding-top: 1px; }
.prio { color: var(--bad); display: inline-flex; }
.due { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; min-width: 64px; text-align: right; font-variant-numeric: tabular-nums; }
.due-late { color: var(--bad-ink); font-weight: 600; }
.due-today { color: var(--brand-ink); font-weight: 600; }
.due-none { color: var(--ink-3); }
.rows-tight .arow { padding-left: 4px; padding-right: 4px; }

.groups { display: flex; flex-direction: column; }
.group + .group { border-top: 1px solid var(--rule); }
.group-head { display: flex; align-items: center; gap: 6px; width: 100%; padding: 10px 16px 6px 12px; border: 0; background: none; text-align: left; color: var(--ink-2); font-size: 12.5px; font-weight: 600; }
.group-head .chev { width: 14px; height: 14px; transition: transform 0.15s var(--ease); color: var(--ink-3); }
.group-head[aria-expanded="false"] .chev { transform: rotate(-90deg); }
.group-head.is-bad .group-title { color: var(--bad-ink); }
.count { color: var(--ink-3); font-weight: 500; font-variant-numeric: tabular-nums; }
.group-body .arow:first-child { border-top: 0; }

/* ── Headline figures ── */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; background: var(--card); border: 1px solid var(--rule); border-radius: var(--r-lg); transition: border-color 0.12s, background 0.12s; }
.kpi:hover { border-color: var(--rule-2); background: var(--hover); }
.kpi-label { font-size: 12.5px; color: var(--ink-2); }
.kpi-value { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.kpi.is-alert .kpi-value { color: var(--bad-ink); }
.kpi.is-alert .kpi-label::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--bad); margin-right: 6px; vertical-align: 1px; }

/* ── Next 14 days ── */
.card-flush { overflow: hidden; }
.agenda-wrap { overflow-x: auto; border-top: 1px solid var(--rule); }
.agenda { display: grid; grid-template-columns: 112px repeat(var(--lanes), minmax(170px, 1fr)); min-width: calc(112px + var(--lanes) * 170px); }
.agenda-row { display: contents; }
.agenda-row > * { border-bottom: 1px solid var(--rule); }
.agenda-row:last-child > * { border-bottom: 0; }
.agenda-day { padding: 8px 12px; display: flex; flex-direction: column; justify-content: flex-start; gap: 0; position: sticky; left: 0; background: var(--card); z-index: 1; border-right: 1px solid var(--rule); }
.agenda-label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.agenda-sub { font-size: 11.5px; color: var(--ink-3); }
.agenda-cell { padding: 6px 8px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.agenda-cell + .agenda-cell { border-left: 1px solid var(--rule); }
.agenda-head > * { padding: 8px 12px; font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--card); }
.agenda-head .agenda-cell { padding: 8px 12px; }
.agenda-row.is-empty > * { padding-top: 3px; padding-bottom: 3px; }
.agenda-row.is-empty .agenda-label { font-weight: 500; color: var(--ink-3); }
.agenda-row.is-weekend > * { background: #fafbfb; }
.agenda-row.is-weekend .agenda-day { background: #fafbfb; }
.agenda-row.is-week-start > * { border-top: 1px solid var(--rule-2); }
.agenda-row.is-today > * { background: #f3f8f7; }
.agenda-row.is-today .agenda-day { background: #f3f8f7; box-shadow: inset 3px 0 0 var(--brand); }
.agenda-row.is-today .agenda-label { color: var(--brand-ink); }
.agenda-row.is-overdue .agenda-label { color: var(--bad-ink); }
.agenda-row.is-overdue > * { background: #fffafa; }
.chip { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 4px 6px 4px 5px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--card); font-size: 12.5px; line-height: 1.25; transition: border-color 0.12s, box-shadow 0.12s; }
.chip:hover { border-color: var(--rule-2); box-shadow: 0 1px 3px rgb(16 24 22 / 0.08); }
.chip .status-mark { width: 14px; height: 14px; }
.chip-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.st-blocked { border-color: #f0c9c9; background: #fffafa; }
.is-overdue .chip { border-color: #f0c9c9; }

/* ── Workload, legends, health, meters ── */
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: 12px; color: var(--ink-2); }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend strong { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.legend .status-mark { width: 14px; height: 14px; }
.key { width: 10px; height: 10px; border-radius: 2px; flex: none; background: var(--nodate); }
.key-none { background: transparent; }
.seg-overdue { background: var(--bad); }
.seg-soon { background: var(--soon); }
.seg-later { background: var(--later); }
.seg-nodate, .seg-none { background: var(--nodate); }
.seg-good { background: var(--good); }
.seg-warn { background: var(--warn); }
.seg-bad { background: var(--bad); }
.workload { display: flex; flex-direction: column; gap: 10px; }
.bars { position: relative; display: flex; flex-direction: column; gap: 2px; }
.bar-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) 28px; align-items: center; gap: 10px; padding: 5px 6px; border: 0; background: none; border-radius: var(--r); text-align: left; }
.bar-row:hover { background: var(--hover); }
.bar-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { display: block; }
.bar { display: flex; gap: 2px; height: 14px; min-width: 6px; }
.bar .seg { display: block; height: 100%; min-width: 4px; }
.bar .seg:last-child { border-radius: 0 4px 4px 0; }
.bar-total { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tip { position: absolute; z-index: 5; min-width: 168px; padding: 8px 10px; background: var(--card); border: 1px solid var(--rule-2); border-radius: var(--r); box-shadow: var(--shadow-pop); font-size: 12px; pointer-events: none; }
.tip-head { color: var(--ink-3); margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 6px; line-height: 1.7; color: var(--ink-2); }
.tip-row strong { color: var(--ink); min-width: 14px; font-variant-numeric: tabular-nums; }
.tip .key { width: 12px; height: 3px; border-radius: 2px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 6px 8px; border-bottom: 1px solid var(--rule); text-align: left; }
.table th { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.health { display: flex; flex-direction: column; gap: 10px; }
.health-bar { display: flex; gap: 2px; height: 10px; }
.health-bar .seg { display: block; height: 100%; }
.health-bar .seg:first-child { border-radius: 4px 0 0 4px; }
.health-bar .seg:last-child { border-radius: 0 4px 4px 0; }
.health-bar .seg:only-child { border-radius: 4px; }
.meter { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.meter-track { width: 72px; height: 6px; border-radius: 999px; background: var(--brand-wash); overflow: hidden; }
.meter-fill { display: block; height: 100%; border-radius: 999px; background: var(--brand); }

/* ── My work ── */
.mini-streams { display: flex; flex-direction: column; }
.mini-stream { display: flex; flex-direction: column; gap: 4px; padding: 10px 16px; border-top: 1px solid var(--rule); }
.mini-stream:hover { background: var(--hover); }
.mini-stream-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mini-stream-name { font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-stream-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12.5px; color: var(--ink-3); }

/* ── Team: latest updates ── */
.feed { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.feed li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--rule); align-items: start; }
.feed li:nth-child(even) { border-left: 1px solid var(--rule); }
.feed-title { font-weight: 500; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-title:hover { text-decoration: underline; text-decoration-color: var(--rule-2); text-underline-offset: 3px; }
.feed-text { color: var(--ink-2); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; }
.feed-time { color: var(--ink-3); font-size: 12px; white-space: nowrap; }

/* ── Streams ── */
.area { display: flex; flex-direction: column; gap: 10px; }
.area-title { font-size: 12.5px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; padding: 4px 2px 0; }
.stream-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 400px), 1fr)); gap: 12px; align-items: start; }
.stream-card { background: var(--card); border: 1px solid var(--rule); border-radius: var(--r-lg); padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 10px; }
.stream-head { display: flex; align-items: center; gap: 8px; }
.stream-name { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; margin-right: auto; }
.stream-name:hover { text-decoration: underline; text-decoration-color: var(--rule-2); text-underline-offset: 3px; }
.stream-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--ink-2); }
.stream-update { font-size: 13px; color: var(--ink-2); padding-left: 10px; border-left: 2px solid var(--rule); }
.stream-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: 12.5px; color: var(--ink-2); }
.stream-stats strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.stream-stats .meter { margin-left: auto; }
.stream-next { display: flex; gap: 8px; font-size: 12.5px; padding: 8px 10px; border-radius: var(--r); background: var(--wash); min-width: 0; }
.stream-next > :last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.stream-next:hover { background: var(--rule); }
.substreams { display: flex; flex-direction: column; border-top: 1px solid var(--rule); margin: 2px -16px -12px; }
.sline { display: flex; align-items: center; gap: 10px; padding: 8px 16px; cursor: pointer; min-width: 0; }
.sline + .sline { border-top: 1px solid var(--rule); }
.sline:hover { background: var(--hover); }
.sline-name { font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sline-side { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.sline.is-closed .sline-name { color: var(--ink-3); }

/* ── Actions ── */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.toolbar .search { flex: 1 1 220px; max-width: 320px; }
.toolbar-count { font-size: 12.5px; margin-left: auto; white-space: nowrap; }

/* ── People ── */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 12px; align-items: start; }
.person { background: var(--card); border: 1px solid var(--rule); border-radius: var(--r-lg); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.person.is-closed { opacity: 0.6; }
.person-head { display: flex; align-items: center; gap: 12px; }
.person-name { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.person-role { font-size: 13px; color: var(--ink-2); }
.person-mail { font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
.person-mail:hover { color: var(--brand-ink); }
.person-text { font-size: 13px; color: var(--ink-2); }
.person-owns { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 12.5px; }
.person-load { display: flex; align-items: center; gap: 4px; margin-top: 2px; padding-top: 10px; border-top: 1px solid var(--rule); font-size: 13px; color: var(--ink-2); }
.person-load .icon { margin-left: auto; color: var(--ink-3); }
.person-load:hover { color: var(--ink); }

/* ── Tidy ── */
.gap { display: flex; align-items: center; gap: 12px; padding: 8px 16px 8px 34px; }
.gap-item { font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gap-item:hover { text-decoration: underline; text-decoration-color: var(--rule-2); text-underline-offset: 3px; }
.gap-detail { font-size: 12.5px; margin-left: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Side panel ── */
.scrim { position: fixed; inset: 0; z-index: 30; background: rgb(21 25 27 / 0.18); animation: fade 0.15s ease-out; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 31; width: min(600px, 100vw); background: var(--card); border-left: 1px solid var(--rule); box-shadow: var(--shadow-drawer); animation: drawer-in 0.18s var(--ease); }
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0; } }
.drawer:focus { outline: none; }
@keyframes fade { from { opacity: 0; } }
.drawer-inner { height: 100%; display: flex; flex-direction: column; }
.drawer-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 20px; border-bottom: 1px solid var(--rule); min-height: 52px; }
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; font-size: 12.5px; color: var(--ink-3); min-width: 0; }
.crumbs a { color: var(--ink-2); }
.crumbs a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.crumbs .sep { color: var(--rule-2); }
.drawer-tools { margin-left: auto; display: flex; gap: 2px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 20px 24px; display: flex; flex-direction: column; gap: 18px; }
.title-input { width: 100%; border: 1px solid transparent; border-radius: var(--r); padding: 4px 6px; margin: -4px -6px; font-size: 19px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; resize: none; background: transparent; overflow: hidden; }
.title-input:hover { border-color: var(--rule); }
.title-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-wash); }
.title-static { font-size: 19px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; }
.props { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 10px 14px; align-items: center; }
.prop-label { font-size: 12.5px; color: var(--ink-3); align-self: start; padding-top: 6px; }
.prop-value { min-width: 0; font-size: 13.5px; }
.picker { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pick { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 4px 0 6px; border: 1px solid var(--rule); border-radius: 999px; font-size: 13px; background: var(--card); }
.chip-x { display: grid; place-items: center; width: 20px; height: 20px; border: 0; border-radius: 50%; background: none; color: var(--ink-3); }
.chip-x .icon { width: 12px; height: 12px; }
.chip-x:hover:not(:disabled) { background: var(--wash); color: var(--ink); }
.chip-x:disabled { opacity: 0.35; cursor: default; }
.date-field { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 12.5px; }
.drawer-section { display: flex; flex-direction: column; gap: 10px; }
.drawer-section h3 { font-size: 12.5px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; }
.section-head { display: flex; align-items: center; justify-content: space-between; }
.closed-list summary { cursor: pointer; font-size: 12.5px; color: var(--ink-3); padding: 6px 0; }
.sub-list { list-style: none; margin: 0; padding: 0; }
.sub-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--rule); font-size: 13.5px; }
.sub-list li a { font-weight: 500; margin-right: auto; }
.sub-list li a:hover { text-decoration: underline; text-underline-offset: 3px; }
.thread { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.thread-item { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; }
.thread-item.is-pinned { grid-template-columns: minmax(0, 1fr); padding: 10px 12px; background: var(--wash); border-radius: var(--r); }
.thread-meta { display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; }
.thread-author { font-weight: 600; color: var(--ink); }
.thread-meta time, .thread-change time { color: var(--ink-3); font-size: 12px; }
.thread-text { margin-top: 2px; white-space: pre-wrap; overflow-wrap: anywhere; }
.thread-change { font-size: 12.5px; color: var(--ink-3); padding-left: 32px; position: relative; }
.thread-change::before { content: ""; position: absolute; left: 9px; top: 7px; width: 5px; height: 5px; border-radius: 50%; background: var(--rule-2); }
.thread-change .thread-author { font-weight: 600; color: var(--ink-2); }
.thread-status { font-size: 13px; }
.composer { border-top: 1px solid var(--rule); padding: 12px 20px 14px; display: flex; flex-direction: column; gap: 8px; background: var(--card); }
.composer-input { width: 100%; min-height: 60px; max-height: 220px; padding: 9px 11px; border: 1px solid var(--rule-2); border-radius: var(--r); resize: none; line-height: 1.45; overflow-y: auto; }
.composer-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-wash); }
.composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12px; }

/* ── Menu and toast ── */
.menu { position: fixed; z-index: 40; min-width: 200px; max-width: 320px; max-height: min(420px, 70vh); overflow-y: auto; padding: 4px; background: var(--card); border: 1px solid var(--rule); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); }
.menu-item { display: flex; align-items: center; gap: 8px; width: 100%; height: 32px; padding: 0 10px; border: 0; border-radius: var(--r-sm); background: none; text-align: left; font-size: 13px; }
.menu-item:hover, .menu-item:focus-visible { background: var(--wash); outline: none; }
.menu-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-hint { color: var(--ink-3); font-size: 12px; }
.menu-check { color: var(--brand); }
.toast { position: fixed; left: 50%; bottom: 20px; z-index: 50; transform: translate(-50%, 16px); opacity: 0; pointer-events: none; max-width: min(560px, calc(100vw - 32px)); padding: 10px 14px; border-radius: var(--r-lg); background: var(--ink); color: #fff; font-size: 13px; box-shadow: var(--shadow-pop); transition: opacity 0.18s, transform 0.18s var(--ease); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast[data-tone="bad"] { background: var(--bad-ink); }
.toast[data-tone="warn"] { background: var(--warn-ink); }

/* ── Sign-in ── */
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login { width: min(100%, 360px); display: flex; flex-direction: column; gap: 20px; padding: 28px; background: var(--card); border: 1px solid var(--rule); border-radius: 10px; }
.login-title { display: inline-flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 650; }
.login-form { display: flex; flex-direction: column; gap: 6px; }
.login-form label { font-size: 13px; color: var(--ink-2); margin-top: 8px; }
.login-form input { height: 40px; padding: 0 12px; border: 1px solid var(--rule-2); border-radius: var(--r); background: var(--card); }
.login-form input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-wash); }
.login-form button { margin-top: 16px; height: 40px; border: 0; border-radius: var(--r); background: var(--brand); color: #fff; font-weight: 600; }
.login-form button:hover { background: var(--brand-hover); }
.login-error { margin-top: 10px; padding: 8px 10px; border-radius: var(--r); background: var(--bad-wash); color: var(--bad-ink); font-size: 13px; }

/* ── Smaller screens ── */
@media (max-width: 1100px) {
  .split, .halves { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  :root { --gutter: 16px; }
  .topbar-inner { height: auto; flex-wrap: wrap; gap: 6px 12px; padding-top: 8px; padding-bottom: 6px; }
  .nav { order: 3; flex-basis: 100%; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter); }
  .topbar-tools { margin-left: auto; }
  .today, .label-wide { display: none; }
  #new { width: 32px; padding: 0; }
  .page { padding-top: 14px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-value { font-size: 24px; }
  .feed { grid-template-columns: minmax(0, 1fr); }
  .feed li:nth-child(even) { border-left: 0; }
  .arow { grid-template-columns: 24px minmax(0, 1fr); }
  .arow-side { grid-column: 2; flex-wrap: wrap; gap: 8px; }
  .due { text-align: left; min-width: 0; }
  .props { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .prop-label { padding-top: 8px; }
  .drawer { width: 100vw; border-left: 0; }
  .drawer-body { padding: 14px 16px 20px; }
  .composer { padding: 10px 16px 12px; }
  .toolbar .search { max-width: none; flex-basis: 100%; }
  .toolbar-count { margin-left: 0; }
  .gap { padding-left: 16px; flex-wrap: wrap; }
  .gap-detail { margin-left: 0; flex-basis: 100%; order: 3; }
  .bar-row { grid-template-columns: 72px minmax(0, 1fr) 24px; }
  /* The 14-day board becomes a day-by-day list, each group named by its stream. */
  .agenda-wrap { overflow: visible; }
  .agenda { display: block; min-width: 0; }
  .agenda-row { display: block; border-bottom: 1px solid var(--rule); }
  .agenda-row.agenda-head, .agenda-row.is-empty { display: none; }
  .agenda-row:last-child { border-bottom: 0; }
  .agenda-row > * { border: 0 !important; }
  .agenda-day { position: static; flex-direction: row; align-items: baseline; gap: 8px; padding: 10px 14px 2px; background: none !important; box-shadow: none !important; }
  .agenda-cell { padding: 4px 14px 8px; }
  .agenda-cell:empty { display: none; }
  .agenda-cell::before { content: attr(data-lane); font-size: 11.5px; font-weight: 600; color: var(--ink-3); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
