/* VESYNTRA prototype styles. Tokens follow Vesyntra-fINAL docs/design/DESIGN-SYSTEM.md v2 (direction A, tonal fields),
   which derives from K-46: ink #313C43, champagne #C3B3A0, off-white #F5F2EE, white cards; status as colour + text. */
@font-face { font-family: "Inter"; src: url("/fonts/Inter-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/Inter-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url("/fonts/CormorantGaramond-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }

:root {
  --ink: #313C43; --ink-muted: #5E666B; --accent: #C3B3A0; --accent-hover: #B5A28C; --accent-tint: #EFE8DF;
  --bg: #F5F2EE; --surface: #FFFFFF; --row-tint: #FAF8F5; --selected: #F8F4EE; --control-border: #8A7F72;
  --on-ink: #F5F2EE; --on-ink-muted: #D9D2C8; --notice: #FBF3DC;
  --overdue: #A8433A; --today: #80651B; --planned: #3F7552; --none: #5E666B;
  --tint-overdue: #F6E4E1; --tint-today: #F3EBD7; --tint-planned: #E4EEE7;
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r-ctl: 10px; --r-card: 16px; --shadow: 0 8px 24px rgb(49 60 67 / 0.18);
  --rail: 248px;
  /* Premium layer (19 October): deeper rail, hairlines instead of boxes, bronze eyebrows (5.1:1 on paper). */
  --ink-deep: #263036; --line: #E6E0D8; --bronze: #7A6343;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 400 14px/20px var(--sans); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.rail :focus-visible, .next-call :focus-visible, .tabbar :focus-visible { outline-color: var(--accent); }
#main:focus { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell */
.app { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }
.rail { background: var(--ink-deep); color: var(--on-ink); padding: 30px 18px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.wordmark { font: 600 25px/1 var(--serif); letter-spacing: .16em; padding: 4px 12px 4px; }
.wordmark-sub { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--on-ink-muted); padding: 0 12px 30px; border-bottom: 1px solid rgb(255 255 255 / 0.08); margin-bottom: 14px; }
.nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: var(--r-ctl); text-decoration: none; color: var(--on-ink); font-weight: 600; min-height: 40px; }
.nav a:hover { background: rgb(255 255 255 / 0.05); }
.nav a[aria-current="page"] { background: rgb(195 179 160 / 0.12); color: var(--accent); box-shadow: inset 2px 0 0 var(--accent); border-radius: 0 var(--r-ctl) var(--r-ctl) 0; }
.nav .count { font-size: 12px; font-weight: 600; background: rgb(255 255 255 / 0.12); border-radius: 999px; padding: 1px 8px; }
.nav a[aria-current="page"] .count { background: rgb(49 60 67 / 0.12); }
.rail-foot { margin-top: auto; display: grid; gap: 8px; font-size: 12px; color: var(--on-ink-muted); padding: 8px 10px; }
.proto-badge { border: 1px dashed var(--on-ink-muted); border-radius: var(--r-ctl); padding: 8px 10px; line-height: 16px; }
.user-switch { display: flex; gap: 4px; background: rgb(255 255 255 / 0.08); border-radius: var(--r-ctl); padding: 3px; }
.user-switch button { flex: 1; border: 0; background: transparent; color: var(--on-ink); border-radius: 8px; padding: 6px; cursor: pointer; font-weight: 600; }
.user-switch button[aria-pressed="true"] { background: var(--accent); color: var(--ink); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 18px 48px; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; background: var(--bg); }
.topbar .search { flex: 1; max-width: 520px; position: relative; }
.topbar .search input { width: 100%; height: 40px; border-radius: var(--r-ctl); border: 1px solid var(--control-border); padding: 0 12px 0 36px; background: var(--surface); }
.topbar .search svg { flex: none; }
.kbd { font-size: 11px; border: 1px solid var(--control-border); border-radius: 5px; padding: 0 5px; color: var(--ink-muted); margin-left: 6px; }
.btn.primary .kbd { color: var(--on-ink); border-color: var(--on-ink-muted); }
.content { padding: 28px 48px 64px; max-width: 1440px; width: 100%; }
.tabbar { display: none; }

/* ---------- type and fields */
h1.page { font: 600 48px/52px var(--serif); margin: 4px 0 8px; letter-spacing: -.005em; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--bronze); }
.lede { color: var(--ink-muted); margin: 0 0 20px; max-width: 72ch; font-size: 15px; line-height: 22px; }
h2 { font: 600 18px/24px var(--sans); margin: 0 0 12px; }
h3 { font: 600 15px/20px var(--sans); margin: 0 0 8px; }
.muted { color: var(--ink-muted); }
.small { font-size: 12px; line-height: 16px; }
.field { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 24px; min-width: 0; }
.field.tint { background: var(--accent-tint); }
.grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.today-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.stack { display: grid; gap: 16px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.spacer { flex: 1; }
hr.soft { border: 0; height: 1px; background: var(--row-tint); margin: 12px 0; }

/* ---------- buttons, chips, status */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--control-border); background: transparent; cursor: pointer; font-weight: 600; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.btn.primary:hover { background: var(--ink-deep); border-color: var(--ink-deep); }
.btn.quiet { border-color: transparent; background: transparent; padding: 0 8px; }
.btn.quiet:hover { text-decoration: underline; background: transparent; }
.btn.danger { color: var(--overdue); }
/* T-46: a disabled control keeps readable text (no opacity) and shows its state by a dashed border; it wins over variants. */
.btn[disabled], .btn[disabled]:hover { background: var(--row-tint) !important; border: 1px dashed var(--control-border) !important; color: var(--ink-muted) !important; cursor: not-allowed; text-decoration: none; }
::placeholder { color: var(--ink-muted); opacity: 1; }
.i:disabled { color: var(--ink-muted); -webkit-text-fill-color: var(--ink-muted); background: var(--row-tint); border-style: dashed; opacity: 1; }
.btn.lg { min-height: 44px; padding: 0 18px; font-size: 15px; }
/* T-46: a chip with its own background sets its own ink, so a chip on the dark next-call card stays readable;
   transparent chips (ghost, broad) inherit the text colour of whatever they sit on. */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; background: var(--accent-tint); color: var(--ink); font-size: 12px; font-weight: 600; line-height: 20px; max-width: 100%; overflow-wrap: anywhere; }
.chip.notice { background: var(--notice); }
.chip.ghost { background: transparent; border: 1px solid var(--control-border); color: inherit; }
.chip.sim { background: var(--notice); border: 1px dashed var(--today); }
.chip.top { background: var(--ink); color: var(--on-ink); }
.chip.near { background: var(--accent); color: var(--ink); }
.chip.close { background: var(--accent-tint); color: var(--ink); }
.chip.broad { background: transparent; border: 1px solid var(--accent); color: inherit; }
.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12px; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.status.overdue { color: var(--overdue); } .status.today { color: var(--today); } .status.planned { color: var(--planned); } .status.none { color: var(--none); }
.edge { border-left: 2px solid transparent; }
.edge.overdue { border-left-color: var(--overdue); } .edge.today { border-left-color: var(--today); } .edge.planned { border-left-color: var(--planned); } .edge.none { border-left-color: var(--accent-tint); }
.prio { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; font: 600 12px/1 var(--sans); vertical-align: middle; background: var(--accent-tint); color: var(--ink); }
.prio.A { background: var(--accent); }
.fit { font-weight: 600; font-size: 15px; }
.fitbar { height: 6px; border-radius: 3px; background: var(--row-tint); overflow: hidden; width: 80px; }
.fitbar > span { display: block; height: 100%; background: var(--ink); }

/* ---------- lists */
.list { display: grid; gap: 2px; }
.item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px 6px; border-radius: 0; background: transparent; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item:hover { background: var(--row-tint); }
.item.sel { background: var(--selected); box-shadow: inset 3px 0 0 var(--ink); }
.item .title { font-weight: 600; }
.item .meta { color: var(--ink-muted); font-size: 12px; line-height: 18px; }
.why { font-size: 12px; line-height: 18px; color: var(--ink); }
.why b { font-weight: 600; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; }
table.t th { text-align: left; font-size: 12px; color: var(--ink-muted); font-weight: 600; padding: 8px 10px; position: sticky; top: 72px; background: var(--bg); }
table.t td { padding: 10px; vertical-align: top; background: var(--surface); }
table.t tr:nth-child(even) td { background: var(--row-tint); }
table.t tr.clickable { cursor: pointer; }
table.t tr.clickable:hover td { background: var(--selected); }
.scroll-x { overflow-x: auto; }

/* ---------- Today */
.briefing { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile { background: var(--surface); border-radius: 20px; padding: 18px 20px; border: 1px solid var(--line); text-align: left; cursor: pointer; }
.tile .n { font: 600 44px/46px var(--serif); }
.tile .l { color: var(--ink-muted); font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.tile .l::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 8px; background: var(--accent); vertical-align: 1px; }
.tile.overdue .l::before { background: var(--overdue); } .tile.today .l::before { background: var(--today); } .tile.planned .l::before { background: var(--planned); }
.tile:hover { border-color: var(--ink); }
.next-call { background: var(--ink-deep); color: var(--on-ink); border-radius: 24px; padding: 30px; border: 1px solid rgb(195 179 160 / 0.35); display: grid; gap: 14px; }
.next-call .eyebrow { color: var(--accent); font-weight: 600; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.next-call h2 { font: 600 38px/42px var(--serif); margin: 0; }
.next-call .meta { color: var(--on-ink-muted); }
.next-call .why { color: var(--on-ink); }
.next-call .btn { border-color: var(--on-ink-muted); background: transparent; color: var(--on-ink); }
.next-call .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.prop-line { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 8px 10px; border-radius: 10px; background: rgb(255 255 255 / 0.06); }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.section-title h2 { margin: 0; }

/* ---------- panels, dialogs */
.panel-wrap { position: fixed; inset: 0; z-index: 40; display: flex; justify-content: flex-end; background: rgb(49 60 67 / 0.28); }
.panel { width: min(560px, 100%); height: 100%; background: var(--bg); box-shadow: var(--shadow); display: flex; flex-direction: column; min-width: 0; }
.panel.wide { width: min(980px, 100%); }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; background: var(--surface); }
.panel-head h2 { margin: 0; flex: 1; font: 600 22px/26px var(--serif); }
.panel-body { padding: 16px 20px 24px; overflow: auto; display: grid; gap: 14px; align-content: start; grid-template-columns: minmax(0, 1fr); }
.panel-foot { padding: 12px 20px; background: var(--surface); display: flex; gap: 8px; align-items: center; }
.dialog-wrap { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgb(49 60 67 / 0.32); padding: 16px; }
.dialog { background: var(--bg); border-radius: var(--r-card); box-shadow: var(--shadow); width: min(640px, 100%); max-height: 90vh; overflow: auto; }
.dialog .panel-body { padding: 18px 20px; }
.palette { width: min(640px, 100%); align-self: start; margin-top: 10vh; }

/* ---------- forms */
label.f { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--ink-muted); }
input.i, select.i, textarea.i { height: 40px; border-radius: 12px; border: 1px solid var(--control-border); background: var(--surface); padding: 0 10px; width: 100%; min-width: 0; font-weight: 400; color: var(--ink); font-size: 14px; }
textarea.i { height: auto; min-height: 88px; padding: 10px; line-height: 20px; resize: vertical; }
/* 22 px, not fully round: still a pill on one line, a rounded box when it wraps on a phone (not a stretched oval). */
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--control-border); border-radius: 22px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; border-radius: 999px; padding: 6px 10px; cursor: pointer; font-weight: 600; min-height: 32px; }
.seg button[aria-checked="true"] { background: var(--ink); color: var(--on-ink); }
.check { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; background: var(--surface); cursor: pointer; }
.check input[type="checkbox"] { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--ink); }
/* T-46: deselected stays at full text contrast; the dashed border on the page background marks it, the box states it. */
.check.off { background: var(--bg); border: 1px dashed var(--control-border); padding: 7px 9px; }
.pick { display: flex; gap: 6px; flex-wrap: wrap; }
.pick button { border: 1px solid var(--control-border); background: var(--surface); border-radius: 999px; padding: 4px 10px; cursor: pointer; font-size: 12px; }
.pick button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.err { color: var(--overdue); font-size: 12px; }
.banner { border-radius: 12px; padding: 10px 14px; background: var(--notice); }
.banner.bad { background: var(--tint-overdue); }
.banner.good { background: var(--tint-planned); }
.banner.sim { background: var(--notice); border: 1px dashed var(--today); }
.savestate { font-size: 12px; font-weight: 600; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--on-ink); padding: 10px 16px; border-radius: 12px; z-index: 60; box-shadow: var(--shadow); max-width: min(560px, 92vw); }

/* ---------- boards */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { background: var(--row-tint); border-radius: var(--r-card); padding: 10px; min-height: 160px; display: grid; gap: 8px; align-content: start; }
.col.drop { background: var(--accent-tint); }
.col h3 { display: flex; justify-content: space-between; font-size: 13px; margin: 2px 4px 4px; }
.card { background: var(--surface); border-radius: 12px; padding: 12px; display: grid; gap: 6px; cursor: grab; }
.card:active { cursor: grabbing; }
.card .title { font-weight: 600; }

/* ---------- read-in viewer */
.reader { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.doc { background: var(--surface); border-radius: 12px; padding: 12px; font-size: 13px; line-height: 20px; }
.doc .ln { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 8px; padding: 1px 4px; border-radius: 6px; }
.doc .ln .no { color: var(--ink-muted); text-align: right; font-size: 11px; }
.doc .ln.cited { background: var(--accent-tint); }
.doc .ln.hot { background: var(--notice); box-shadow: inset 3px 0 0 var(--today); }
.fieldrow { display: grid; grid-template-columns: 140px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--surface); }
.fieldrow.uncertain { background: var(--notice); }

/* ---------- teaser preview (K-38 design) */
.teaser { background: #fff; color: var(--ink); padding: 28px; border-radius: 6px; font-size: 13px; }
.teaser .rule { width: 30px; height: 3px; background: var(--accent); margin-bottom: 10px; }
.teaser .brand { font: 600 12px/1 var(--sans); letter-spacing: .12em; margin: 0 0 8px; }
.teaser h1 { font: 600 28px/32px var(--serif); margin: 0 0 4px; }
.teaser .ref { color: var(--ink-muted); margin: 0 0 16px; }
.teaser dl { display: grid; grid-template-columns: 180px 1fr; gap: 6px 12px; margin: 0 0 14px; }
.teaser dt { color: var(--ink-muted); } .teaser dd { margin: 0; font-weight: 600; }
.teaser footer { margin-top: 16px; padding-top: 10px; border-top: 1px solid var(--accent); color: var(--ink-muted); font-size: 12px; }
.briefing h1 { font: 600 24px/28px var(--serif); }

/* ---------- responsive (phone first-class for calling, K-45) */
@media (max-width: 1100px) {
  .today-grid { grid-template-columns: minmax(0, 1fr); }
  .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
  body { font-size: 16px; line-height: 22px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .topbar { padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left)); }
  .topbar .hide-phone { display: none; }
  .content { padding: 16px 16px calc(84px + env(safe-area-inset-bottom)); }
  h1.page { font-size: 32px; line-height: 36px; }
  .briefing { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-2, .cols-3, .reader { grid-template-columns: minmax(0, 1fr); }
  .panel, .panel.wide { width: 100%; }
  .panel-head { flex-wrap: wrap; padding: 12px 16px; }
  .panel-head h2 { order: 3; flex-basis: 100%; font-size: 20px; line-height: 24px; } .panel-body { padding: 14px 16px 24px; } .panel-foot { flex-wrap: wrap; }
  .btn { min-height: 44px; }
  input.i, select.i { height: 44px; font-size: 16px; }
  textarea.i { font-size: 16px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--ink); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { color: var(--on-ink); text-decoration: none; text-align: center; padding: 12px 4px; font-size: 12px; font-weight: 600; min-height: 52px; }
  .tabbar a[aria-current="page"] { background: var(--accent); color: var(--ink); }
  .fieldrow { grid-template-columns: minmax(0, 1fr); }
  .teaser dl { grid-template-columns: 1fr; }
  table.t th { top: 60px; }
}
/* ---------- Constellation (presentation mock-up, not in the blueprint): CSS 3D, rotated through --spin and --tilt */
.cst { position: relative; height: 600px; background: var(--ink); color: var(--on-ink); border-radius: var(--r-card); overflow: hidden; perspective: 1300px; touch-action: none; cursor: grab; user-select: none; --spin: -20deg; --tilt: 62deg; --k: 1; --inv: 1; }
.cst.dragging { cursor: grabbing; }
.cst:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.cst-world { position: absolute; left: 50%; top: 52%; width: 0; height: 0; transform-style: preserve-3d; transform: scale(var(--k)) rotateX(var(--tilt)) rotateZ(var(--spin)); }
.cst-g, .cst-ring, .cst-bb, .cst-foot, .cst-stem { position: absolute; left: 0; top: 0; }
.cst-g { transform-style: preserve-3d; }
.cst-ring { border: 1px solid rgba(217, 210, 200, .3); border-radius: 50%; }
.cst-ring.top { background: rgba(195, 179, 160, .12); }
.cst-ring.others { border-style: dashed; }
.cst-bb { transform: translate3d(var(--x), var(--y), var(--z)) rotateZ(calc(-1 * var(--spin))) rotateX(calc(-1 * var(--tilt))) translate(-50%, -50%) scale(var(--inv)); }
.cst.compact .cst-node .nm { display: none; }
.cst-label { font-size: 12px; letter-spacing: .05em; color: var(--on-ink-muted); white-space: nowrap; pointer-events: none; }
.cst-centre { position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); z-index: 1; background: var(--surface); color: var(--ink); border-radius: 999px; padding: 2px 12px; font: 600 18px/26px var(--serif); white-space: nowrap; pointer-events: none; }
.cst-foot { width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: rgba(217, 210, 200, .5); transform: translate3d(var(--x), var(--y), 0); }
.cst-stem { width: 1px; background: rgba(217, 210, 200, .4); transform-origin: 0 0; transform: translate3d(var(--x), var(--y), 0) rotateX(90deg); }
.cst-node { display: inline-flex; align-items: center; gap: 6px; max-width: 180px; min-height: 26px; padding: 2px 10px; border-radius: 999px; border: 1px solid transparent; font: 600 12px/20px var(--sans); white-space: nowrap; cursor: pointer; }
.cst-node .nm { overflow: hidden; text-overflow: ellipsis; }
.cst-node b { font-weight: 700; }
.cst-node.top { background: var(--accent); color: var(--ink); }
.cst-node.near { background: var(--accent-tint); color: var(--ink); }
.cst-node.close { background: var(--surface); color: var(--ink); border: 1px dashed var(--ink); }
.cst-node.broad { background: var(--ink); color: var(--on-ink); border-color: var(--on-ink-muted); }
.cst-node.others { background: var(--ink); color: var(--on-ink-muted); border: 1px dashed var(--on-ink-muted); }
.cst-node:focus-visible, .cst-node.on { outline: 3px solid var(--notice); outline-offset: 2px; }
.cst-empty { position: absolute; left: 0; right: 0; bottom: 16px; text-align: center; color: var(--on-ink-muted); margin: 0; }
@media (max-width: 767px) { .cst { height: 380px; } .cst-centre { font-size: 15px; line-height: 22px; } }
/* Key figures in the sans: this Cormorant file has only old-style numerals, whose 1 reads as I. Headings stay serif. */
.tile .n, .figures dd, .rank-no, .pk-no, .mx-no { font-family: var(--sans) !important; font-weight: 600; letter-spacing: -.02em; }
.tile .n { font-size: 38px; } .figures dd { font-size: 24px; } .rank-no { font-size: 24px; } .pk-no { font-size: 15px; padding-top: 2px; } .mx-no { font-size: 15px; }

/* ---------- Matching studio: fit ring, criteria fingerprint (shape-coded: square = must), ranking and matrix */
.ring { position: relative; display: inline-grid; place-items: center; flex: none; }
.ring svg { position: absolute; inset: 0; }
.ring-track { fill: none; stroke: var(--line); stroke-width: 3; }
.ring-val { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.ring-n { font: 600 17px/1 var(--sans); letter-spacing: -.03em; }
.print { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.pip { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--ink); background: var(--ink); flex: none; vertical-align: -1px; }
.pip.must { border-radius: 2px; }
.pip.close { background: linear-gradient(90deg, var(--ink) 50%, transparent 50%); }
.pip.unknown { background: transparent; border-style: dashed; border-color: var(--ink-muted); }
.pip.missed { background: transparent; border-color: var(--overdue); position: relative; }
.pip.missed::after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1.5px; background: var(--overdue); transform: rotate(45deg); }
.studio-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; margin-bottom: 28px; }
.studio-head .lede { margin-bottom: 0; }
.side-switch { display: inline-flex; border: 1px solid var(--control-border); border-radius: 999px; padding: 3px; background: var(--surface); }
.side-switch button { border: 0; background: transparent; border-radius: 999px; padding: 8px 16px; font-weight: 600; cursor: pointer; }
.side-switch button[aria-checked="true"] { background: var(--ink); color: var(--on-ink); }
.studio-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 28px; align-items: start; }
.picker { display: grid; gap: 6px; position: sticky; top: 92px; max-height: calc(100vh - 110px); overflow: auto; padding-right: 4px; }
.picker .i { margin-bottom: 6px; }
.pk { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 10px; text-align: left; border: 1px solid transparent; background: transparent; border-radius: 16px; padding: 12px; cursor: pointer; }
.pk:hover { background: var(--surface); border-color: var(--line); }
.pk.on { background: var(--surface); border-color: var(--ink); }
.pk-no { font: 600 20px/24px var(--serif); color: var(--bronze); }
.pk-body { display: grid; gap: 3px; min-width: 0; }
.pk-title { font-weight: 600; }
.pk-meta { font-size: 12px; color: var(--ink-muted); }
.pk-bar { display: flex; gap: 4px; flex-wrap: wrap; font-size: 11px; font-weight: 600; margin-top: 4px; }
.pk-bar > span { padding: 1px 8px; border-radius: 999px; background: var(--accent-tint); color: var(--ink); }
.pk-bar .seg-top { background: var(--ink); color: var(--on-ink); }
.pk-bar .seg-near { background: var(--accent); }
.pk-bar .seg-broad { background: transparent; border: 1px solid var(--accent); }
.pk-bar .muted { background: transparent; color: var(--ink-muted); padding: 0; }
.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 32px; min-width: 0; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.sheet-title { font: 600 38px/42px var(--serif); margin: 6px 0 0; }
.link { font-weight: 600; text-decoration: none; border-bottom: 1px solid var(--accent); padding-bottom: 1px; }
.link:hover { border-bottom-color: var(--ink); }
.figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 26px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.figures > div { padding: 16px 18px 14px 0; }
.figures > div + div { border-left: 1px solid var(--line); padding-left: 18px; }
.figures dt { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-muted); }
.figures dd { margin: 6px 0 0; font: 600 26px/30px var(--serif); }
.sheet-tools { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
/* The hairline is an inset shadow so the strip can scroll sideways on a phone without clipping the selected underline. */
.tabs { display: flex; gap: 22px; box-shadow: inset 0 -1px var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs > * { border: 0; background: none; padding: 10px 0; font-weight: 600; color: var(--ink-muted); cursor: pointer; text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; flex: none; }
.tabs > :focus-visible { outline-offset: -2px; }
.tabpanel { margin-top: 14px; }
.tabs > [aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.toggle { display: inline-flex; gap: 8px; align-items: center; font-size: 13px; cursor: pointer; }
.toggle input { accent-color: var(--ink); width: 16px; height: 16px; }
.ranking { list-style: none; margin: 0; padding: 0; }
.rank-group { display: flex; align-items: center; gap: 10px; margin: 26px 0 6px; font-size: 12px; color: var(--ink-muted); }
.match { display: grid; grid-template-columns: 40px minmax(0, 1fr) 52px auto; gap: 20px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line); }
.match.open { background: var(--row-tint); margin: 0 -16px; padding: 16px; border-radius: 16px; }
.rank-no { font: 600 30px/1 var(--serif); color: var(--bronze); text-align: right; align-self: start; padding-top: 2px; }
.match-who { min-width: 0; }
.match-name { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 16px; }
.match-name a { text-decoration: none; }
.match-name a:hover { text-decoration: underline; }
.match-why { font-size: 13px; line-height: 19px; color: var(--ink-muted); margin-top: 6px; max-width: 70ch; }
.match-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 6px; font-size: 12px; color: var(--ink-muted); }
.state { font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--control-border); white-space: nowrap; }
.state.none { border-style: dashed; color: var(--ink-muted); }
.tag { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--accent-tint); color: var(--ink); }
.match-act { display: flex; gap: 6px; justify-content: flex-end; }
.why-table { grid-column: 2 / -1; width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 4px; }
.why-table th { text-align: left; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-muted); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.why-table td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.matrix-wrap { overflow-x: auto; margin-top: 18px; }
.matrix { border-collapse: separate; border-spacing: 0; font-size: 12px; min-width: 100%; }
.matrix th, .matrix td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: center; vertical-align: middle; }
.matrix thead th { vertical-align: bottom; font-weight: 600; min-width: 110px; }
.matrix thead th a { display: block; text-decoration: none; font-size: 13px; line-height: 17px; }
.matrix tbody th, .matrix .mx-fit th, .matrix .corner { text-align: left; position: sticky; left: 0; background: var(--surface); font-weight: 600; white-space: nowrap; z-index: 1; }
.matrix .corner { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-muted); }
.mx-no { display: block; font: 600 18px/1 var(--serif); color: var(--bronze); margin-bottom: 4px; }
.mx-class { display: block; font-size: 11px; color: var(--ink-muted); font-weight: 400; margin-top: 2px; }
.mx-must { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--bronze); }
.mx-word { display: block; font-size: 11px; color: var(--ink-muted); margin-top: 3px; }
.matrix tbody tr:hover td, .matrix tbody tr:hover th { background: var(--row-tint); }
.match.greyed { background: var(--row-tint); border-radius: 12px; padding-left: 12px; padding-right: 12px; }
.match.greyed .match-name a { color: var(--ink-muted); }
.match-reason { font-size: 12px; line-height: 18px; color: var(--ink); margin-top: 4px; }
.match-sub { font-size: 12px; line-height: 18px; color: var(--ink-muted); margin-top: 4px; }
.origin { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--bronze); }
.row-actions { grid-column: 2 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; margin: -6px 0 0 -8px; }
.row-actions .btn.quiet { min-height: 28px; font-size: 13px; color: var(--ink-muted); }
.row-actions .btn.quiet:hover { color: var(--ink); }
.inline-form { display: inline-flex; gap: 6px; align-items: center; margin-left: 6px; }
.inline-form .i { height: 34px; width: auto; }
.banner.proposal { background: var(--accent-tint); margin: 0 0 16px; }
.assign { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.assign .i { max-width: 360px; }
@media (max-width: 1100px) {
  .studio-grid { grid-template-columns: minmax(0, 1fr); }
  .picker { position: static; max-height: none; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); overflow-x: auto; }
  .picker .i { display: none; }
  .match { grid-template-columns: 32px minmax(0, 1fr) 52px; }
  .match-act { grid-column: 2 / -1; justify-content: flex-start; }
}
@media (max-width: 767px) {
  .sheet { padding: 20px; border-radius: 20px; }
  .sheet-title { font-size: 28px; line-height: 32px; }
  .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .figures > div:nth-child(3) { border-left: 0; padding-left: 0; }
  .figures > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .studio-head { margin-bottom: 18px; }
  .tabs > * { min-height: 44px; }
}
@media (prefers-reduced-motion: no-preference) { .panel { animation: slide .16s ease-out; } @keyframes slide { from { transform: translateX(24px); opacity: .6; } } }
.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 14px; }
.tbl th, .tbl td { text-align: right; padding: 8px 10px; border-bottom: 1px solid var(--hairline, #E4DED6); white-space: nowrap; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl thead th { font-weight: 600; color: var(--ink-muted); font-size: 12px; }

/* Sign-in (K-48.01) */
.signin { min-height: 100vh; display: grid; place-items: center; background: var(--ink-deep); padding: 16px; }
.signin-card { width: min(420px, 100%); background: var(--surface); border-radius: 18px; padding: 32px 28px; box-shadow: 0 24px 60px rgb(0 0 0 / 0.25); }
.signin-card .wordmark { color: var(--ink); }
.signin-card .wordmark-sub { color: var(--ink-muted); margin-bottom: 18px; }
.signin-card h1.page { font-size: 32px; margin: 8px 0 14px; }
.signin-card .btn.primary { width: 100%; justify-content: center; margin-top: 6px; }
.signin-key { font: 600 18px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0.06em; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; word-spacing: 0.4em; user-select: all; }
.rail-foot .signout { color: var(--on-ink); padding: 4px 8px; }
/* Overview (K-78) */
.briefing.metrics { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.briefing.metrics .tile { text-decoration: none; color: inherit; display: block; }
.metric-filter { margin-top: 8px; font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.tile.not-set .n { color: var(--ink-muted); font-size: 28px; }
/* Figures with units (project file) shrink with their tile instead of running out of it; count tiles keep 38 px (DESIGN 5.3). */
.briefing.figs .tile { container-type: inline-size; cursor: default; }
.briefing.figs .tile .n { font-size: clamp(18px, 13cqi, 30px); line-height: 1.2; }
.next-critical { margin-bottom: 16px; }
.metric-caption { color: var(--ink-muted); max-width: 72ch; }
/* Merge (K-08) */
.dialog.merge { width: min(920px, 100%); }
.merge-row { display: grid; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.merge-row:last-child { border-bottom: 0; }
.origin-badge { font-size: 11px; margin-left: 6px; }
/* Acquisition (K-63 to K-67) */
.research-strip { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; margin: 8px 0; font-size: 13px; }
.msg-body { white-space: pre-wrap; font: 13px/1.5 var(--sans); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 0; }
.row.wrap { flex-wrap: wrap; }

/* ---------- UX pass 2 November 2026: grouped rail with counts, command palette, flatter sections (brand tokens unchanged) */
.skip { position: absolute; left: 12px; top: -48px; z-index: 50; background: var(--surface); color: var(--ink); padding: 10px 14px; border-radius: var(--r-ctl); box-shadow: var(--shadow); font-weight: 600; }
.skip:focus { top: 12px; }
.rail { overflow-y: auto; }
.nav-sub { margin-top: 18px; padding-top: 14px; border-top: 1px solid rgb(255 255 255 / 0.08); }
.nav-sub a { font-weight: 500; min-height: 34px; padding: 7px 12px; color: var(--on-ink-muted); }
.nav-sub a[aria-current="page"] { color: var(--accent); }
.nav-label { font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--on-ink-muted); padding: 0 12px 6px; opacity: .8; }
.count { font-size: 12px; font-weight: 600; line-height: 18px; border-radius: 999px; padding: 0 7px; background: var(--accent-tint); color: var(--ink); font-variant-numeric: tabular-nums; }
.nav .count { color: var(--on-ink); }
.nav .count.bad, .count.bad { background: var(--overdue); color: #fff; }
.proto-badge { display: grid; gap: 2px; }
.palette-list { display: grid; max-height: min(60vh, 520px); overflow-y: auto; margin-top: 10px; }
.palette-list .item { text-align: left; border: 0; cursor: pointer; width: 100%; background: transparent; border-radius: var(--r-ctl); }
.palette-list .item:hover, .palette-list .item:focus-visible { background: var(--selected); }
.palette-group { font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--bronze); margin: 12px 0 4px; }
.palette-hint { margin: 10px 0 0; }
/* DESIGN 1.1: only form controls are outlined boxes; a field group inside a section is not a second card. */
.field .field { background: none; border: 0; border-radius: 0; padding: 0; margin: 0 0 14px; }
.tabbar a { position: relative; }
.tabbar .count { position: absolute; top: 6px; right: calc(50% - 30px); font-size: 11px; line-height: 16px; padding: 0 5px; }
.today-note { font-size: 13px; line-height: 20px; padding: 8px 2px; border-bottom: 1px solid var(--line); margin: 0; }
.today-note.notice { background: var(--notice); padding: 8px 12px; border-radius: var(--r-ctl); border: 0; margin: 6px 0; }
.today-note .btn.quiet { min-height: 0; padding: 0 4px; font-weight: 600; }
.briefing + .today-note { margin-top: 12px; }
.jump { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; }
.jump .chip { cursor: pointer; font: inherit; font-size: 12px; font-weight: 600; }
.jump .chip:hover { border-color: var(--ink); }
[id^="set-"] { scroll-margin-top: 96px; }
.nav a[aria-current="page"] .count.bad { background: var(--overdue); color: #fff; }
.more-list .item { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; text-decoration: none; padding: 12px 4px; min-height: 52px; }
.more-list .item .title { display: flex; align-items: center; gap: 8px; }
.more-list .item .meta { text-align: left; }
