/* OS Operations — visual system. docs/UI.md is the law; every class here maps to a component in src/views/ui.tsx. */
:root {
  --bg: #ebeae7;
  --surface: #ffffff;
  --ink: #1b1b1a;
  --ink-2: #3a3a38;
  --muted: #8b8b87;
  --faint: #b9b9b5;
  --line: #ebebe8;
  --line-2: #e2e2de;
  --soft: #f5f5f3;
  --pill: #f0f0ee;
  --accent: #ff6a2b;
  --ok: #17803f;
  --ok-bg: #e3f6ea;
  --risk: #a37415;
  --risk-bg: #fbf1dc;
  --late: #c0352b;
  --late-bg: #fdebe8;
  --sans: "Avenir Next", "Inter", "Segoe UI", system-ui, sans-serif;
  --serif: "Iowan Old Style", "Charter", Palatino, "Palatino Linotype", Georgia, serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace;
  --radius: 18px;
  --lift: 0 1px 2px rgba(20, 20, 18, 0.04), 0 10px 34px rgba(20, 20, 18, 0.06);
  --text: 17px;
  --control: 44px;
  --control-r: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: var(--text)/1.5 var(--sans); -webkit-font-smoothing: antialiased; overflow-wrap: break-word; }
/* Long words, URLs and names break instead of pushing their box wider. */
h1, h2, h3, .head-sub, .rowitem-main > *, .taskrow-text > *, .person-text > *, .product-card header > *,
.step-text > *, .rail-item p, .rail-quote, .task-top a, .stat-v, .chart-value, pre.brief, td, th, .prose, .toast,
.drawer-scroll p, .card p, ul.plain li { overflow-wrap: anywhere; }
.one-line { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a { color: inherit; text-decoration: none; }
code { font-family: var(--mono); font-size: 0.86em; color: var(--ink-2); }
button, input, select, textarea { font: inherit; color: var(--ink); }
p { margin: 0; }
.ico { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.55; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- shell ---------- */
.shell-app, .shell-dash { height: 100dvh; overflow: hidden; }
.frame {
  position: fixed; inset: 20px;
  display: grid; grid-template-columns: 256px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr);
  background: var(--surface); border-radius: 22px; overflow: hidden; box-shadow: var(--lift);
}
.side { display: flex; flex-direction: column; padding: 1.9rem 1.1rem 1.3rem 1.4rem; min-height: 0; overflow: auto; }
.side-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
.side-head .mark { flex: 1; min-width: 0; }
.menu-close { display: none; }
.nav-toggle { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.topbar { display: none; }
.nav-mask { display: none; }
.mark { display: flex; align-items: center; gap: 0.6rem; font-size: 1.28rem; font-weight: 600; letter-spacing: -0.025em; padding: 0 0.3rem 1.4rem; min-width: 0; }
.mark-glyph { width: 30px; height: 30px; flex: 0 0 auto; border-radius: 8px; background: var(--ink); display: grid; place-items: center; }
.mark-glyph svg { width: 18px; height: 18px; fill: #fff; }
.nav-group { margin-bottom: 1.1rem; }
.side-k { font-size: 0.86rem; color: var(--muted); padding: 0 0.3rem 0.4rem; }
.nav { display: flex; flex-direction: column; gap: 0.1rem; }
.nav a { display: flex; align-items: center; gap: 0.7rem; min-height: 40px; color: var(--ink-2); padding: 0 0.75rem; margin-left: -0.45rem; border-radius: 11px; font-size: 1rem; min-width: 0; }
.nav a .ico { color: var(--ink-2); width: 19px; height: 19px; }
.nav a:hover { background: var(--soft); }
.nav a.on { background: var(--pill); color: var(--ink); font-weight: 500; }
.side-foot { margin-top: auto; padding: 1rem 0.3rem 0; display: grid; gap: 0.7rem; }
.side-foot .who { display: flex; align-items: center; gap: 0.6rem; font-size: 0.96rem; min-width: 0; }
.side-foot .who span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .out { display: inline-flex; align-items: center; gap: 0.15rem; color: var(--muted); font-size: 0.96rem; }
.side-foot .out .ico { width: 16px; height: 16px; }
.side-foot .out:hover { color: var(--ink); }
.canvas { min-width: 0; min-height: 0; overflow: auto; padding: 3rem 3.5rem 5rem; container: canvas / inline-size; }
.wrap { max-width: 1180px; min-width: 0; }
.wrap.wide { max-width: none; }

/* ---------- type ---------- */
h1 { font-family: var(--serif); font-weight: 400; font-size: 2.75rem; letter-spacing: -0.025em; line-height: 1.08; margin: 0; }
h2 { font-size: 1.22rem; font-weight: 600; letter-spacing: -0.015em; margin: 2.4rem 0 0.9rem; }
h3 { font-size: 1.05rem; font-weight: 600; margin: 0; }
.k { font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 0 0 0.45rem; }
.mono-k { font-family: var(--mono); font-size: 0.82rem; letter-spacing: 0.03em; text-transform: uppercase; color: var(--ink-2); }
.mono-k.soft { color: var(--faint); }
.mono-k.ink { color: var(--ink); }
.v { font-size: 2.2rem; font-weight: 500; letter-spacing: -0.03em; line-height: 1.05; }
.muted { color: var(--muted); font-size: 0.95rem; }
.ok { color: var(--ok); } .risk { color: var(--risk); } .late { color: var(--late); }
.u { text-decoration: underline; text-decoration-thickness: 1px; text-decoration-color: #cfcfca; text-underline-offset: 0.18em; }
a.peek { text-decoration: underline; text-decoration-thickness: 1px; text-decoration-color: transparent; text-underline-offset: 3px; transition: text-decoration-color 120ms; }
a.peek:hover { text-decoration-color: currentColor; }
.empty { color: var(--muted); padding: 1.2rem 0; list-style: none; }

.toasts { position: fixed; right: 28px; bottom: 28px; z-index: 70; display: grid; gap: 0.5rem; width: min(22rem, calc(100vw - 40px)); pointer-events: none; }
.toast { pointer-events: auto; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; padding: 0.85rem 1.15rem; box-shadow: var(--lift);
  animation: toast-in 220ms ease-out, toast-out 280ms ease-in 3.4s forwards; }
.toast.err { background: var(--late-bg); color: var(--late); border-color: transparent; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }
#busy { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 72%, transparent); opacity: 0; pointer-events: none; transition: opacity 180ms 420ms; }
body.htmx-request #busy, body.is-busy #busy { opacity: 1; pointer-events: auto; }
.spin { width: 36px; height: 36px; border: 2.5px solid var(--line-2); border-top-color: var(--ink); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.photo-pick, .cover-pick { position: relative; display: grid; justify-items: start; gap: 0.45rem; cursor: pointer; width: max-content; }
.photo-pick > span:not(.slot), .cover-pick > span:not(.slot) { font-size: 0.86rem; color: var(--muted); }
.photo-pick:hover > span:not(.slot), .cover-pick:hover > span:not(.slot) { color: var(--ink); }
.photo-pick input, .cover-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.photo-pick .slot, .cover-pick .slot { position: relative; display: grid; }
.slot-spin { position: absolute; inset: 0; display: none; place-items: center; border-radius: inherit; background: color-mix(in srgb, var(--surface) 62%, transparent); }
.slot-spin:not([hidden]) { display: grid; }
.slot-spin .spin { width: 22px; height: 22px; border-width: 2px; }
.photo-pick.is-drop, .cover-pick.is-drop { outline: 2px dashed var(--ink); outline-offset: 4px; border-radius: 16px; }
.cover-pick .cover { width: 88px; height: 88px; border-radius: 12px; }
.photo-open { padding: 0; min-height: 0; width: auto; height: auto; background: transparent; border-radius: 50%; }
.photo-open:hover { background: transparent; transform: scale(1.03); }
.photo-open .avatar { pointer-events: none; }
input[data-money] { font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) {
  .toast, .spin, .photo-open, .fold > summary::after { animation: none; transition: none; }
  #busy { transition: none; }
}

/* ---------- page head: title left, actions right ---------- */
.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem 1.5rem; margin-bottom: 2.2rem; flex-wrap: wrap; }
.head-text { flex: 1 1 22rem; min-width: 0; }
.head-sub { color: var(--muted); font-size: 1rem; margin-top: 0.55rem; max-width: 46rem; display: flex; align-items: center; flex-wrap: nowrap; gap: 0.7rem; }
.head-sub > span:not(.board-nav) { min-width: 0; }
.board-nav { display: inline-flex; gap: 0.3rem; flex: 0 0 auto; }
.board-nav .icon-btn { width: 32px; height: 32px; }
.board-nav .icon-btn .ico { width: 15px; height: 15px; }
/* Actions sit on the title's line: kicker height + half of (title line − control). */
.head-actions { flex: 0 1 auto; display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 0.6rem; margin-left: auto; margin-top: calc(0.78rem * 1.5 + 0.45rem + (2.75rem * 1.08 - var(--control)) / 2); min-width: 0; }
.head-text:not(:has(> .k)) + .head-actions { margin-top: calc((2.75rem * 1.08 - var(--control)) / 2); }

/* ---------- buttons, pills, chips ---------- */
/* One control size: every button, input and select is --control tall unless it is an icon/inline control. */
button, .btn, .btn-new {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: var(--control); padding: 0 1.25rem; max-width: 100%;
  background: var(--ink); color: #fff; border: 0; border-radius: 999px;
  cursor: pointer; font-size: 0.98rem; font-weight: 500; line-height: 1.2; text-align: center; white-space: nowrap;
}
button:hover, .btn:hover, .btn-new:hover { background: #000; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
button.ghost, a.ghost, .pill { background: var(--pill); color: var(--ink); }
button.ghost:hover, a.ghost:hover, a.pill:hover { background: #e7e7e4; }
a.pill, button.pill { min-height: var(--control); padding: 0 1.15rem; border-radius: 999px; }
.btn-new { padding: 0 1.25rem 0 1rem; gap: 0.45rem; }
.btn-new .ico { width: 18px; height: 18px; stroke-width: 1.9; }
.icon-btn { width: 38px; height: 38px; min-height: 0; flex: 0 0 auto; padding: 0; display: inline-flex; align-items: center; justify-content: center; background: var(--pill); color: var(--ink); border-radius: 50%; text-decoration: none; }
.icon-btn:hover { background: #e7e7e4; }
.icon-btn .ico { width: 18px; height: 18px; }
.icon-btn.flip .ico { transform: scaleX(-1); }
.chip { display: inline-flex; align-items: center; gap: 0.3rem; min-height: 28px; padding: 0 0.8rem; border-radius: 999px; background: var(--pill); color: var(--ink-2); font-size: 0.86rem; line-height: 1.2; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
a.chip:hover { background: #e7e7e4; }
.chip.late { background: var(--late-bg); color: var(--late); }
.delta { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.18rem 0.55rem; border-radius: 7px; font-size: 0.82rem; font-weight: 600; vertical-align: middle; letter-spacing: 0; }
.delta svg { width: 9px; height: 9px; fill: currentColor; }
.delta.up { background: var(--ok-bg); color: var(--ok); }
.delta.down { background: var(--late-bg); color: var(--late); }
.pill-select { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 40px; padding: 0 0.95rem; white-space: nowrap; border: 1px solid var(--line-2); border-radius: 12px; font-size: 0.95rem; color: var(--ink-2); background: var(--surface); font-weight: 400; max-width: 100%; }
button.pill-select:hover { background: var(--soft); color: var(--ink); }
.pill-select::after { content: ""; width: 7px; height: 7px; flex: 0 0 auto; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg) translateY(-2px); }

/* ---------- avatars ---------- */
.avatar { width: 34px; height: 34px; min-width: 34px; aspect-ratio: 1; flex: 0 0 auto; border-radius: 50%; display: inline-grid; place-items: center; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.02em; color: #2d2d2b; background: #ececea; }
.avatar.sm { width: 26px; height: 26px; min-width: 26px; font-size: 0.66rem; }
.avatar.lg { width: 64px; height: 64px; min-width: 64px; font-size: 1.2rem; }
.avatar.t0 { background: #e9e4dc; } .avatar.t1 { background: #dfe7e2; } .avatar.t2 { background: #e3e2ec; }
.avatar.t3 { background: #efe2dc; } .avatar.t4 { background: #dde6ec; } .avatar.t5 { background: #ebe7d6; }
.avatar.more { background: var(--pill); color: var(--muted); }
.avatar.empty { background: transparent; border: 1px dashed var(--line-2); padding: 0; }
.avatar.photo { padding: 0; overflow: hidden; background: var(--soft); }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit; }
.cover { width: 44px; height: 44px; min-width: 44px; border-radius: 8px; overflow: hidden; background: var(--soft); flex: 0 0 auto; display: grid; place-items: center; }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover.empty { border: 1px dashed var(--line-2); background: transparent; }
.side-foot .who { color: inherit; text-decoration: none; }
.side-foot a.who:hover span:last-child { text-decoration: underline; }
.stackav { display: inline-flex; }
.stackav .avatar { box-shadow: 0 0 0 2px var(--surface); }
.stackav .avatar + .avatar { margin-left: -7px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 0.35rem 0.7rem; margin: 2.2rem 0 0.3rem; font-size: 0.98rem; flex-wrap: wrap; align-items: center; }
.tabs a { color: var(--muted); display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.2rem 0; }
.tabs a:hover, .tabs a.on { color: var(--ink); }
.tabs:not(.mono) a { min-height: 36px; padding: 0.3rem 0.75rem; border: 1px solid transparent; border-radius: 999px; }
.tabs:not(.mono) a.on { border-color: var(--line-2); background: var(--surface); color: var(--ink); }
.tab-n { font-size: 0.78rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.tabs a.on .tab-n { color: var(--muted); }
.tabs form { display: inline-flex; align-items: center; margin-left: 0.55rem; }
.tabs .pick { height: 36px; min-height: 36px; width: auto; max-width: 14rem; border: 0; background: transparent; padding: 0.15rem 0.45rem 0.15rem 0.1rem; color: var(--muted); font-weight: 400; font-size: inherit; }
.tabs .pick:hover { background: transparent; color: var(--ink); }
.tabs .pick .avatar { width: 22px; height: 22px; min-width: 22px; font-size: 0.62rem; }
.tabs select { height: auto; width: auto; max-width: 14rem; border: 0; background-color: transparent; padding: 0.2rem 1.6rem 0.2rem 0; color: var(--muted); font-size: inherit; }
.tabs select:hover, .tabs select:focus { color: var(--ink); outline: none; }
.tabs.mono { margin: 0; gap: 1.6rem; font-family: var(--mono); text-transform: uppercase; font-size: 0.9rem; letter-spacing: 0.02em; }
.tabs.mono a { color: var(--faint); }
.tabs.mono a.on, .tabs.mono a:hover { color: var(--ink); }

/* ---------- home (reference: Narwhal shell) ---------- */
.home { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 2.5rem 4rem; max-width: 1180px; }
.home-main { min-width: 0; max-width: 760px; }
.home-wide { grid-column: 1 / -1; min-width: 0; }
.greet { font-size: 2.75rem; line-height: 1.14; display: grid; margin: 0.5rem 0 1.3rem; }
.greet-soft { color: var(--muted); }
.home-main .composer { margin: 0 0 2.2rem; }
.composer { background: var(--soft); border-radius: 16px; padding: 1.45rem 1.55rem 1.1rem; display: grid; gap: 0.85rem; }
.composer textarea { background: transparent; border: 0; padding: 0.35rem 0.2rem 0.55rem; min-height: 5.2rem; resize: none; outline: none; font-size: 1.02rem; line-height: 1.45; }
.composer textarea::placeholder { color: var(--muted); }
.composer-bar { display: flex; align-items: center; gap: 0.55rem; min-width: 0; }
.composer-spark { color: var(--accent); display: inline-grid; margin-right: auto; flex: 0 0 auto; }
.composer-bar .pick { height: 36px; min-height: 36px; max-width: 14rem; padding: 0 0.85rem 0 0.2rem; background: transparent; border: 0; color: var(--muted); font-weight: 400; font-size: 0.92rem; flex: 0 1 auto; }
.composer-bar .pick:hover { background: transparent; color: var(--ink); }
.composer-bar .pick .cover { width: 22px; height: 22px; min-width: 22px; border-radius: 5px; }
.send { width: 36px; height: 36px; min-height: 0; flex: 0 0 auto; padding: 0; border-radius: 50%; background: var(--accent); color: #fff; }
.send:hover { background: #f25a18; }
.send .ico { width: 18px; height: 18px; stroke-width: 2; }
.tasklist { list-style: none; padding: 0; margin: 0.4rem 0 0; }
.taskrow { display: flex; align-items: flex-start; gap: 0.9rem; padding: 1.05rem 0 1.2rem; border-bottom: 1px solid var(--line); }
.taskrow:last-child { border-bottom: 0; }
.taskrow form { display: contents; }
.tick { width: 19px; height: 19px; min-height: 0; margin-top: 0.2rem; padding: 0; flex: 0 0 auto; border-radius: 5px; border: 1.5px solid #cfcfcb; background: var(--surface); color: transparent; }
.tick .ico { width: 13px; height: 13px; stroke-width: 2.4; }
button.tick:hover { background: var(--surface); color: var(--ink); border-color: var(--ink); }
.taskrow-text { flex: 1; min-width: 0; display: grid; gap: 0.25rem; }
.taskrow-text a { font-size: 1.02rem; }
.taskrow .avatar, .taskrow .stackav { margin-top: 0.05rem; }
.rail { min-width: 0; display: grid; gap: 1.25rem; align-content: start; }
.rail-card { border: 1px solid var(--line); border-radius: 16px; padding: 1.4rem 1.4rem 0.6rem; }
.rail-quote { font-family: var(--serif); font-size: 1.22rem; line-height: 1.4; color: var(--muted); margin: 0 0 1.4rem; }
.rail-item { padding-bottom: 1.4rem; display: grid; gap: 0.6rem; justify-items: start; }
.rail-item p { font-size: 0.97rem; line-height: 1.45; }
.rail-item b { font-weight: 500; }
.charts { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); gap: 1.4rem; margin-top: 1.5rem; align-items: stretch; }

/* ---------- Overview chart (reference: hatched columns) ---------- */
.chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 1.5rem 1.6rem 1.1rem; box-shadow: var(--lift); min-width: 0; }
.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem 1rem; flex-wrap: wrap; }
.chart-head h2 { margin: 0; font-size: 1.4rem; font-weight: 600; min-width: 0; }
.chart-label { color: var(--muted); margin-top: 1.1rem; font-size: 0.98rem; }
.chart-value { font-size: 1.95rem; font-weight: 600; letter-spacing: -0.03em; line-height: 1.15; display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem 0.8rem; margin-top: 0.2rem; }
.overview { width: 100%; height: auto; max-height: 280px; display: block; margin-top: 0.3rem; overflow: visible; }
.hatch-bg { fill: #ededeb; }
.hatch-bg.dark { fill: #8f8f8c; }
.hatch-line { stroke: #d6d6d3; stroke-width: 1.4; }
.hatch-line.dark { stroke: #6c6c69; }
.grid-line { stroke: #e7e7e4; stroke-width: 1; stroke-dasharray: 5 6; }
.col-cap { fill: #f6f6f4; stroke: #e6e6e3; stroke-width: 1; }
.col-cap.on { fill: #262625; stroke: #262625; }
.col-body.on { stroke: #262625; stroke-width: 1.6; }
.axis { fill: var(--muted); font-size: 15px; font-family: var(--sans); text-anchor: middle; }
.tip { fill: #262625; }
.tip-k { fill: #cfcfcc; font-size: 13px; font-family: var(--sans); text-anchor: middle; }
.tip-v { fill: #fff; font-size: 16px; font-weight: 600; font-family: var(--sans); text-anchor: middle; }
.tip-dot { fill: #fff; stroke: #262625; stroke-width: 2.2; }

/* ---------- Dots chart (reference: mono revenue card) ---------- */
.dots-card { background: #f7f7f6; border: 1px solid #e6e6e3; border-radius: 28px; overflow: hidden; min-width: 0; display: flex; flex-direction: column; }
.dots-head { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 0.8rem 1rem; padding: 1.6rem 1.8rem 1.4rem; border-bottom: 1px solid #e4e4e1; }
.dots-head > div { min-width: 0; }
.dots-value { font-size: clamp(2.2rem, 5cqi, 3.1rem); font-weight: 400; letter-spacing: -0.045em; line-height: 1; margin-top: 0.7rem; font-variant-numeric: tabular-nums; }
.dots-body { padding: 1.6rem 1.8rem 1.5rem; display: grid; gap: 0.9rem; margin-top: auto; }
.dots { width: 100%; height: auto; max-height: 180px; display: block; }
.dot-on { fill: #5e5e5c; }
.dot-off { fill: #c6c6c3; }
.dot-zero { fill: #e5e5e2; }
.dots-foot { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.dots-foot .mono-k { overflow-wrap: anywhere; }
.dots-foot .mono-k:first-child { color: var(--faint); }

/* ---------- Steps (reference: onboarding workflow) ---------- */
.steps { list-style: none; padding: 0; margin: 0; display: grid; }
.step { position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 1rem; padding-bottom: 1.45rem; }
.step:not(:last-child)::before { content: ""; position: absolute; left: 16.5px; top: 38px; bottom: 4px; width: 1px; background: var(--line-2); }
.step-mark { width: 34px; height: 34px; border-radius: 50%; background: var(--soft); display: grid; place-items: center; font-size: 0.9rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.step-mark .ico { width: 15px; height: 15px; stroke-width: 2.1; color: var(--ink); }
.step.now .step-mark::after { content: ""; width: 15px; height: 15px; border-radius: 50%; border: 1.5px dotted var(--ink-2); }
.step-text { display: grid; gap: 0.2rem; padding-top: 0.25rem; min-width: 0; }
.step-text b { font-weight: 500; font-size: 1.04rem; }
.step-text span { color: var(--muted); font-size: 0.95rem; }
.step.next .step-text b { color: var(--muted); }

/* ---------- Hub (reference: hub-and-spoke) ---------- */
.hub-wrap { display: grid; place-items: center; background: var(--soft); border-radius: 26px; padding: 1.5rem; }
.hub { width: 100%; max-width: 560px; height: auto; display: block; overflow: visible; }
.hub-line { stroke: #d2d2ce; stroke-width: 1.2; }
.hub-node { fill: #fff; stroke: #e3e3df; stroke-width: 1; filter: drop-shadow(0 6px 14px rgba(20, 20, 18, 0.06)); }
.hub-text { fill: var(--ink); font-size: 15px; font-family: var(--mono); text-anchor: middle; }
.hub-core { fill: #121211; }
.hub-mark { fill: #fff; }
.hub-label { fill: #fff; font-size: 14px; font-family: var(--sans); font-weight: 500; text-anchor: middle; }

/* ---------- meters ---------- */
.meters { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.85rem; }
.meter { display: grid; grid-template-columns: minmax(0, 10rem) minmax(3rem, 1fr) minmax(3.6rem, auto); gap: 0.9rem; align-items: center; font-size: 0.96rem; }
.meter-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.meter-track { display: block; height: 8px; border-radius: 999px; overflow: hidden; background: #ebebe8; }
.meter-track progress { display: block; width: 100%; height: 8px; margin: 0; border: 0; appearance: none; background: transparent; }
.meter-track progress::-webkit-progress-bar { background: transparent; }
.meter-track progress::-webkit-progress-value { background: var(--ink); }
.meter-track progress::-moz-progress-bar { background: var(--ink); }
.meter-track progress.late::-webkit-progress-value, .meter-track progress.late::-moz-progress-bar { background: var(--late); }
.meter-track progress.risk::-webkit-progress-value, .meter-track progress.risk::-moz-progress-bar { background: var(--risk); }
.meter-num { font-family: var(--mono); font-size: 0.86rem; text-align: right; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ---------- stats, cards, rows ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); gap: 0.8rem; margin: 1.4rem 0; }
.stat { border: 1px solid var(--line); border-radius: 16px; padding: 1.1rem 1.25rem; display: grid; gap: 0.45rem; align-content: start; min-width: 0; }
.stat-v { font-size: clamp(1.45rem, 3.2cqi, 1.85rem); font-weight: 500; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem 1.5rem; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem 1rem; margin-bottom: 1.2rem; }
.card-head h2 { margin: 0; min-width: 0; }
.split { display: grid; gap: 1.4rem; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); margin-top: 0.4rem; align-items: start; }
.split > *, .charts > *, .home > * { min-width: 0; }
.split > section > h2:first-child { margin-top: 0; }
.rows { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.rows.flat { border-top: 0; }
.rowitem { display: flex; align-items: center; gap: 1rem; padding: 1rem 0.2rem; border-bottom: 1px solid var(--line); min-width: 0; }
.rows.flat .rowitem:last-child { border-bottom: 0; }
.rowitem-main { flex: 1 1 14rem; min-width: 0; display: grid; gap: 0.2rem; }
.rowitem-main > a, .rowitem-main > b { font-size: 1.02rem; font-weight: 500; }
.rowitem-progress { width: min(20rem, 34%); flex: 0 0 auto; min-width: 0; }
.rowitem > .chip, .rowitem > .stackav, .rowitem > form, .rowitem > .avatar, .rowitem > .cover { flex: 0 0 auto; }
.rowitem-progress .meter { grid-template-columns: 4.4rem minmax(0, 1fr) 3.2rem; }
.rowitem-num { font-family: var(--mono); font-size: 0.92rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.doc-ico { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 12px; background: var(--soft); display: grid; place-items: center; color: var(--ink-2); }

/* person / product cards (reference: bordered cards, round avatars) */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 1rem; }
.person-card { display: flex; align-items: center; gap: 1.3rem; border: 1px solid var(--line-2); border-radius: 6px; padding: 1.5rem 1.6rem; min-width: 0; transition: background 160ms ease; }
.person-card:hover { background: var(--soft); }
.person-text { flex: 1; min-width: 0; display: grid; gap: 0.25rem; justify-items: start; }
.person-text > a, .person-text > b { font-size: 1.1rem; font-weight: 500; }
.person-text .meters { width: 100%; margin-top: 0.6rem; }
.person-text .meter { grid-template-columns: 2.8rem minmax(0, 1fr) 3.4rem; }
.product-card { border: 1px solid var(--line-2); border-radius: 6px; padding: 1.5rem 1.6rem 0.4rem; display: grid; gap: 1.3rem; min-width: 0; }
.product-card header { display: grid; gap: 0.25rem; }
.product-card header a { font-size: 1.1rem; font-weight: 500; }
.product-card .step { padding-bottom: 1rem; }

/* ---------- forms ---------- */
table { width: 100%; border-collapse: collapse; font-size: 1rem; }
th, td { text-align: left; padding: 0.8rem 0.4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; }
form.stack, .stack { display: grid; gap: 1rem; max-width: 34rem; margin-top: 0.4rem; }
.stack + .stack { margin-top: 1.4rem; }
.stack > * { min-width: 0; }
.panel form.stack { max-width: none; }
.panel form.stack + form.stack { margin-top: 1.6rem; }
.row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem; }
label { display: grid; gap: 0.45rem; font-size: 0.92rem; line-height: 1.3; color: var(--muted); min-width: 0; }
label > input, label > select, label > textarea, label > .date-btn, label > .editor, label > .pick { width: 100%; }
input, select, textarea { background-color: var(--surface); border: 1px solid var(--line-2); border-radius: var(--control-r); padding: 0 0.9rem; font-size: 1rem; line-height: 1.3; min-width: 0; }
input:where(:not([type="checkbox"], [type="radio"], [type="hidden"])), select { height: var(--control); }
textarea { padding: 0.75rem 0.9rem; min-height: 9rem; resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: 2px solid #1b1b1a22; outline-offset: 0; border-color: #c9c9c5; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; margin: 0; padding: 0; flex: 0 0 auto; accent-color: var(--ink); }
select { appearance: none; padding-right: 2.4rem; cursor: pointer; text-overflow: ellipsis; white-space: nowrap;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.stack > button { justify-self: start; margin-top: 0.4rem; }
.row { display: flex; gap: 0.65rem; flex-wrap: wrap; align-items: end; }
fieldset.checks { border: 1px solid var(--line-2); border-radius: 14px; padding: 0.5rem 1rem 0.7rem; display: grid; gap: 0; margin: 0; min-width: 0; }
fieldset.checks legend { color: var(--muted); font-size: 0.92rem; padding: 0 0.35rem; }
label.check { display: flex; gap: 0.7rem; align-items: center; min-height: 40px; color: var(--ink); font-size: 0.98rem; }
label.check .avatar { flex: 0 0 auto; }
.pick { min-width: 0; max-width: min(22rem, 100%); min-height: 44px; padding: 0.2rem 1.15rem 0.2rem 0.3rem; gap: 0.65rem; background: var(--surface); color: var(--ink); border: 1px solid var(--line-2); border-radius: 14px; font-weight: 500; text-align: left; }
.pick:hover { background: var(--soft); }
.pick .cover { width: 32px; height: 32px; min-width: 32px; border-radius: 7px; }
.pick.who { max-width: none; }
.pick.who .avatar { width: 28px; height: 28px; min-width: 28px; font-size: 0.68rem; }
.pick::after { content: ""; width: 7px; height: 7px; flex: 0 0 auto; margin-left: 0.15rem; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg) translateY(-2px); }
.pick-list { position: fixed; inset: auto; margin: 0; padding: 0.4rem; min-width: var(--pick-w, 16rem); width: max(16rem, var(--pick-w, 16rem)); max-width: calc(100vw - 24px); max-height: min(24rem, 70vh); overflow: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: var(--lift); }
.pick-list .rows { border-top: 0; }
.pick-list .rowitem { width: 100%; justify-content: flex-start; min-height: 0; padding: 0.5rem 0.65rem; border-bottom: 0; border-radius: 10px; background: transparent; color: inherit; text-decoration: none; font-weight: 400; text-align: left; white-space: normal; gap: 0.7rem; }
.pick-list .rowitem:hover, .pick-list .rowitem.on { background: var(--soft); color: inherit; }
.pick-list .cover { width: 32px; height: 32px; min-width: 32px; border-radius: 7px; }
.pick-list .rowitem .avatar { flex: 0 0 auto; }

.auth { min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem; }
.auth .box { width: min(28rem, 92vw); padding: 2rem; background: var(--surface); border-radius: 22px; box-shadow: var(--lift); }
pre.brief { white-space: pre-wrap; margin: 0; font: 1rem/1.55 var(--sans); }
.dot { width: 0.55rem; height: 0.55rem; border-radius: 50%; display: inline-block; margin-right: 0.45rem; background: var(--ok); vertical-align: 0.05em; }
.dot.risk { background: var(--risk); } .dot.late { background: var(--late); }
ul.plain { list-style: none; padding: 0; margin: 0 0 1rem; }
ul.plain li { padding: 0.65rem 0; border-bottom: 1px solid var(--line); }
.grid { display: grid; gap: 0.9rem; grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr)); }

/* ---------- kanban ---------- */
.kanban { display: flex; gap: 0.9rem; align-items: flex-start; overflow-x: auto; padding-bottom: 1.2rem; margin: 0 -0.2rem; }
.col { width: 312px; flex: 0 0 312px; background: var(--soft); border-radius: 18px; padding: 0.6rem; min-height: 14rem; }
.col.done { background: #f1f4f1; }
.col-head { display: flex; align-items: center; gap: 0.3rem; padding: 0.35rem 0.3rem 0.65rem 0.1rem; position: relative; }
.col-head form { flex: 1; min-width: 0; }
.col-head input { width: 100%; height: 34px; background-color: transparent; border: 0; border-radius: 8px; font-weight: 600; font-size: 1.02rem; padding: 0 0.4rem; text-overflow: ellipsis; }
.col-head input:focus { background-color: var(--surface); outline: 0; }
.col-head h3 { flex: 1; min-width: 0; padding: 0 0.4rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-grip { width: 28px; height: 28px; min-height: 0; padding: 0; border-radius: 8px; background: transparent; color: var(--ink-2); cursor: grab; display: grid; place-items: center; flex: 0 0 auto; }
.col-grip:hover { background: var(--pill); color: var(--ink); }
.col-grip:active { cursor: grabbing; }
.col-grip .ico { width: 16px; height: 16px; stroke-width: 2.4; }
.count { color: var(--muted); font-size: 0.88rem; font-variant-numeric: tabular-nums; padding: 0 0.3rem; }
.col-menu { position: relative; flex: 0 0 auto; }
.fold { border-top: 1px solid var(--line); margin-top: 1.4rem; padding-top: 0.15rem; }
.fold > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 0.55rem; min-height: 2.6rem; color: var(--ink); }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after { content: ''; width: 8px; height: 8px; margin-left: auto; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); transition: transform 180ms ease; }
.fold[open] > summary::after { transform: rotate(225deg); }
.fold-body { padding: 0.15rem 0 0.85rem; display: grid; gap: 1rem; }
.mention-src { display: none; }

.col-menu summary { list-style: none; cursor: pointer; }
.col-menu summary::-webkit-details-marker { display: none; }
.col-menu .icon-btn { width: 28px; height: 28px; border-radius: 8px; }
.col-menu .icon-btn .ico { width: 16px; height: 16px; stroke-width: 2.2; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 5; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--lift); padding: 0.35rem; display: grid; gap: 0.15rem; min-width: 13.5rem; }
.menu form { margin: 0; }
.menu button { width: 100%; justify-content: flex-start; min-height: 40px; border-radius: 10px; background: transparent; color: var(--ink); font-weight: 400; padding: 0 0.75rem; }
.menu button:hover { background: var(--soft); }
.menu button.menu-danger { color: var(--late); }
.menu button.menu-danger:hover { background: var(--late-bg); }
.col-tasks { min-height: 8rem; display: flex; flex-direction: column; gap: 0.55rem; }
.task { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 0.9rem 1rem 0.85rem; cursor: grab; box-shadow: 0 1px 2px rgba(20, 20, 18, 0.03); }
.task:hover { border-color: var(--line-2); }
.task-top { display: flex; gap: 0.5rem; align-items: flex-start; }
.task-top a { font-size: 0.99rem; line-height: 1.4; min-width: 0; }
.task-check { width: 18px; height: 18px; margin-top: 0.15rem; flex: 0 0 auto; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; }
.task-check .ico { width: 11px; height: 11px; stroke-width: 2.6; }
.task.is-done .task-top a { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.task-top a { min-width: 0; }
.task-meta { display: flex; align-items: center; gap: 0.55rem; margin-top: 0.75rem; min-width: 0; }
.task-meta .muted { font-size: 0.84rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.task-meta .chip { font-size: 0.8rem; min-height: 24px; padding: 0 0.6rem; }
.task-meta .avatar, .task-meta .stackav { margin-left: auto; }
.task-ghost { opacity: 0.4; }
.sortable-fallback { opacity: 0.95; }
.add-task { width: 100%; margin-top: 0.55rem; min-height: 40px; justify-content: flex-start; gap: 0.45rem; background: transparent; color: var(--muted); border-radius: 12px; font-weight: 400; padding: 0 0.7rem; }
.add-task:hover { background: var(--surface); color: var(--ink); }
.add-task .ico { width: 16px; height: 16px; }
.col-new { display: grid; gap: 0.6rem; align-content: start; background: transparent; border: 1px dashed var(--line-2); padding: 1rem; }
.col-new button { justify-self: start; }

/* ---------- panels: drawer + sheets ---------- */
.panel {
  position: fixed; inset: 12px 12px 12px auto; width: min(500px, calc(100vw - 24px)); height: auto; max-height: none;
  margin: 0; padding: 0; border: 0; background: var(--surface); color: var(--ink); overflow: hidden;
  border-radius: 22px; box-shadow: -18px 0 60px rgba(20, 20, 18, 0.12);
  opacity: 0; transform: translateX(18px);
  transition: transform 220ms ease, opacity 220ms ease, overlay 220ms allow-discrete, display 220ms allow-discrete;
}
.panel:popover-open { opacity: 1; transform: none; }
@starting-style { .panel:popover-open { opacity: 0; transform: translateX(18px); } }
.panel::backdrop { background: rgba(20, 20, 18, 0.16); }
.drawer-body { display: flex; flex-direction: column; height: 100%; container: panel / inline-size; }
.drawer-top { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; padding: 1.6rem 1.6rem 0.8rem; }
.drawer-top > div { min-width: 0; }
.drawer-top h2 { font-family: var(--serif); font-size: 2rem; font-weight: 400; letter-spacing: -0.02em; margin: 0; line-height: 1.12; }
.drawer-scroll { overflow: auto; overscroll-behavior: contain; padding: 0.4rem 1.6rem 2rem; font-size: 1rem; flex: 1; min-height: 0; }
.drawer-scroll > p + p { margin-top: 0.45rem; }
.drawer-scroll h2, .drawer-scroll h3 { font-family: var(--sans); font-size: 1.02rem; font-weight: 600; margin: 1.8rem 0 0.8rem; }
.drawer-scroll .steps { margin-top: 0.2rem; }

/* ---------- date picker + editor (app.js) ---------- */
.date-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
button.date-btn { justify-content: flex-start; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--control-r); padding: 0 0.9rem; color: var(--ink); font-weight: 400; font-size: 1rem; }
button.date-btn:hover { background: var(--soft); }
.composer-bar button.date-btn { min-height: 36px; background: transparent; border: 0; color: var(--muted); padding: 0 0.6rem; font-size: 0.92rem; flex: 0 0 auto; }
.composer-bar button.date-btn:hover { color: var(--ink); }
/* Positioned by app.js anchor(): under its trigger, flipped when it would leave the viewport. */
.cal { position: fixed; inset: auto; margin: 0; padding: 0.9rem 0.9rem 0.7rem; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); width: 19.5rem; max-width: calc(100vw - 24px); box-shadow: var(--lift); color: var(--ink); }
.cal header { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; font-size: 1rem; }
.cal header b { font-weight: 600; }
.cal header b::first-letter { text-transform: uppercase; }
.cal table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cal th, .cal td { padding: 2px; border: 0; text-align: center; }
.cal th { font-size: 0.72rem; }
.cal button { width: 100%; min-height: 34px; padding: 0; background: transparent; color: var(--ink); border-radius: 9px; font-weight: 400; font-size: 0.95rem; }
.cal header button { width: 34px; flex: 0 0 auto; font-size: 1.2rem; }
.cal button:hover { background: var(--pill); }
.cal button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.editor { border: 1px solid var(--line-2); border-radius: var(--control-r); overflow: hidden; }
.editor-bar { display: flex; flex-wrap: wrap; gap: 0.3rem; padding: 0.4rem; background: var(--soft); }
.editor-bar button { min-height: 34px; background: transparent; color: var(--ink); padding: 0 0.75rem; border-radius: 8px; }
.editor-bar button:hover { background: var(--pill); }
.editor-surface { min-height: 9rem; padding: 0.8rem; outline: none; }
.prose p { margin: 0.4rem 0; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade-out { to { opacity: 0; } }
::view-transition-old(root) { animation: 140ms ease both fade-out; }
::view-transition-new(root) { animation: 220ms ease both rise; }

@container canvas (max-width: 900px) {
  .home { grid-template-columns: minmax(0, 1fr); }
  .home-main { max-width: none; }
  .charts, .split { grid-template-columns: minmax(0, 1fr); }
}
@container canvas (max-width: 720px) {
  .rowitem { flex-wrap: wrap; }
  .rowitem-progress { width: 100%; order: 5; }
  .head-actions, .head-text:not(:has(> .k)) + .head-actions { margin-top: 0; justify-content: flex-start; }
}
@container panel (max-width: 380px) {
  .row2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 800px) {
  .shell-app, .shell-dash { height: 100dvh; overflow: hidden; }
  .frame {
    position: fixed; inset: 0; min-height: 100dvh; border-radius: 0; box-shadow: none;
    display: flex; flex-direction: column; grid-template-columns: none;
  }
  .topbar {
    display: flex; flex: 0 0 auto; align-items: center; gap: 0.55rem; padding: 0.65rem 0.9rem;
    border-bottom: 1px solid var(--line); background: var(--surface); min-width: 0; z-index: 40;
  }
  .topbar .mark { padding: 0; font-size: 1.05rem; flex: 1; min-width: 0; }
  .topbar .mark-glyph { width: 26px; height: 26px; }
  .topbar .mark-glyph svg { width: 15px; height: 15px; }
  .topbar .who { flex: 0 0 auto; }
  .side {
    position: fixed; inset: 0 auto 0 0; width: min(20rem, 88vw); height: 100dvh;
    z-index: 60; background: var(--surface); box-shadow: var(--lift);
    transform: translateX(-105%); transition: transform 220ms ease;
  }
  .nav-toggle:checked ~ .frame .side { transform: none; }
  .nav-mask { display: none; position: fixed; inset: 0; z-index: 55; background: rgba(20, 20, 18, 0.16); }
  .nav-toggle:checked ~ .frame .nav-mask { display: block; }
  .menu-close { display: inline-flex; margin-top: 0.15rem; }
  .side-head .mark { padding-bottom: 1rem; }
  .canvas { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 1.2rem 1rem 3rem; }
  .rowitem { flex-wrap: wrap; }
  .rowitem-progress { width: 100%; }
  h1, .greet { font-size: 2rem; }
  .head { margin-bottom: 1.4rem; }
  .composer-bar { flex-wrap: wrap; }
  .panel { inset: 0; width: 100%; max-width: none; border-radius: 0; }
  .toasts { right: 12px; bottom: 12px; }
  .kanban { margin: 0; }
  .row2 { grid-template-columns: minmax(0, 1fr); }
}
