/* Runstate office. Tokens: DESIGN.md 10.1 (office.html palette + house, gold, scrim, radius, type). */
@font-face { font-family: Inter; font-weight: 400; font-display: swap; src: url(fonts/inter-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: Inter; font-weight: 500; font-display: swap; src: url(fonts/inter-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: Inter; font-weight: 600; font-display: swap; src: url(fonts/inter-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-weight: 600; font-display: swap; src: url(fonts/space-grotesk-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-weight: 700; font-display: swap; src: url(fonts/space-grotesk-latin-700-normal.woff2) format('woff2'); }

:root {
  --bg: #F2F4F1; --surface: #FFFFFF; --ink: #17211E; --muted: #58665F; --line: #D3DAD5;
  --accent: #0E7C6B; --accent-soft: #DDF0EB; --on-accent: #FFFFFF; --warn: #A8670E; --warn-soft: #FBEFD9; --bad: #B42318; --bad-soft: #FBE4E1; --good: #1F7A45;
  --gold: #8A6516; --gold-soft: #F6EBD0;
  --house-client: #237A6C; --house-growth: #6D4BA8; --house-eng: #2F5AA0; --house-ops: #A4551F; --house-hq: #46505E; --house-townhall: #8A6516;
  --scrim: rgba(14, 20, 18, .40);
  --shadow-pop: 0 12px 32px rgba(14, 20, 18, .18);
  --r-sm: 6px; --r: 10px; --r-lg: 14px;
  --display: "Space Grotesk", system-ui, sans-serif; --body: Inter, system-ui, sans-serif;
  --top-h: 56px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0F1513; --surface: #161E1B; --ink: #E4EBE7; --muted: #97A59F; --line: #2B3632;
  --accent: #3CC4AA; --accent-soft: #163A33; --on-accent: #0F1513; --warn: #E3A64B; --warn-soft: #3A2C14; --bad: #F07167; --bad-soft: #3A1A17; --good: #5CCB8A;
  --gold: #E8C15A; --gold-soft: #3A2F12;
  --house-client: #3CC4AA; --house-growth: #B497F0; --house-eng: #7FA6EE; --house-ops: #E3A64B; --house-hq: #97A59F; --house-townhall: #E8C15A;
  --scrim: rgba(0, 0, 0, .55); --shadow-pop: 0 12px 32px rgba(0, 0, 0, .5); color-scheme: dark;
} }
:root[data-theme="dark"] {
  --bg: #0F1513; --surface: #161E1B; --ink: #E4EBE7; --muted: #97A59F; --line: #2B3632;
  --accent: #3CC4AA; --accent-soft: #163A33; --on-accent: #0F1513; --warn: #E3A64B; --warn-soft: #3A2C14; --bad: #F07167; --bad-soft: #3A1A17; --good: #5CCB8A;
  --gold: #E8C15A; --gold-soft: #3A2F12;
  --house-client: #3CC4AA; --house-growth: #B497F0; --house-eng: #7FA6EE; --house-ops: #E3A64B; --house-hq: #97A59F; --house-townhall: #E8C15A;
  --scrim: rgba(0, 0, 0, .55); --shadow-pop: 0 12px 32px rgba(0, 0, 0, .5); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 var(--body); -webkit-font-smoothing: antialiased; min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -48px; z-index: 50; background: var(--surface); padding: 8px 12px; border-radius: var(--r-sm); border: 1px solid var(--line); }
.skip:focus { top: 8px; }
.muted { color: var(--muted); }
.phone-only { display: none !important; }
[hidden] { display: none !important; }

/* ---------- buttons */
.btn { min-height: 44px; padding: 0 16px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); font-weight: 500; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: background .15s, border-color .15s, color .15s; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--bad); }
.btn.small { min-height: 44px; padding: 0 12px; font-size: 13px; }
.btn[disabled], .btn[aria-busy="true"] { opacity: .6; cursor: progress; }
.btn .spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; min-height: 24px; }
.icon-btn { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); display: grid; place-items: center; cursor: pointer; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); padding: 2px; background: var(--surface); }
.seg button { min-height: 36px; padding: 0 12px; border: 0; border-radius: 8px; background: none; cursor: pointer; font-weight: 500; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--ink); }
.chip { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--line); color: var(--ink); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.switch-wrap { display: flex; align-items: center; gap: 8px; font-weight: 500; }
/* 48x44 tap target; the visible track is 44x26 */
.switch { width: 48px; height: 44px; border: 0; background: none; position: relative; cursor: pointer; padding: 0; border-radius: var(--r); }
.switch::before { content: ""; position: absolute; left: 2px; top: 9px; width: 44px; height: 26px; border-radius: 999px; border: 1px solid var(--line); background: var(--line); box-sizing: border-box; transition: background .18s; }
.switch span { position: absolute; top: 12px; left: 5px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); transition: transform .18s; }
.switch[aria-checked="true"]::before { background: var(--accent); border-color: var(--accent); }
.switch[aria-checked="true"] span { transform: translateX(18px); }
.switch-wrap:has(.switch) { min-height: 44px; }

/* ---------- top bar + action bar */
.topbar { position: sticky; top: 0; z-index: 20; height: var(--top-h); display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 24px; background: var(--bg); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; font: 600 16px/1 var(--display); }
.mark { width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font: 700 13px/1 var(--display); }
.top-right { display: flex; align-items: center; gap: 12px; }
.clock { font-weight: 500; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--muted); }
.watcher { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px 0 6px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); cursor: pointer; font-weight: 500; }
.watcher img { width: 28px; height: 28px; border-radius: 6px; background: var(--accent-soft); image-rendering: pixelated; }
.menu { position: absolute; right: 24px; top: calc(var(--top-h) - 4px); width: 264px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); padding: 8px; z-index: 30; }
.menu-group + .menu-group { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
.menu-label { font-size: 12px; color: var(--muted); padding: 4px 8px; }
.menu-item { width: 100%; min-height: 44px; text-align: left; padding: 0 8px 0 32px; border: 0; background: none; border-radius: var(--r-sm); cursor: pointer; position: relative; }
.menu-item:hover { background: var(--bg); }
.menu-item[aria-pressed="true"]::before, .menu-item[aria-checked="true"]::before { content: ""; position: absolute; left: 12px; top: 50%; width: 8px; height: 4px; border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: translateY(-70%) rotate(-45deg); }
.menu-note { font-size: 12px; color: var(--muted); padding: 4px 8px; line-height: 1.8; }
kbd { font: 600 11px/1 var(--body); border: 1px solid var(--line); border-radius: 4px; padding: 2px 5px; background: var(--bg); }

.actionbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 24px; max-width: 1600px; margin: 0 auto; }
.summary { color: var(--muted); }
.summary b { color: var(--ink); font-weight: 600; }
.actions { display: flex; gap: 8px; }

/* ---------- layout */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 464px; gap: 16px; padding: 0 24px 24px; max-width: 1600px; margin: 0 auto; align-items: start; }
.village { min-width: 0; }
.stage { position: relative; aspect-ratio: 640 / 416; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); touch-action: none; user-select: none; -webkit-user-select: none; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; transition: filter .4s; }
.stage.quiet canvas { filter: saturate(.4); }
.stage.grab { cursor: grab; }
.overlay { position: absolute; inset: 0; pointer-events: none; }
.overlay > * { position: absolute; left: 0; top: 0; pointer-events: auto; will-change: transform; }
.demo-line { font-size: 12px; color: var(--muted); margin-top: 8px; }
/* view toggle sits under the village, so it never covers anyone */
.stage-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.stage-foot .demo-line { margin: 0; }
.viewtoggle { margin-left: auto; flex: none; }
.viewtoggle button { min-height: 44px; font-size: 13px; }
.stage-banner { position: absolute; left: 0; right: 0; top: 0; z-index: 4; padding: 8px 12px; background: var(--warn-soft); color: var(--warn); font-size: 13px; font-weight: 500; display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; }
.quiet-banner { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 6;  /* above the decision card */ background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-pop);
  padding: 16px 24px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; max-width: calc(100% - 24px); }

.rail { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); display: flex; flex-direction: column; height: var(--stage-h, 640px); overflow: hidden; }
.tabs { flex: none; display: grid; grid-template-columns: repeat(7, max-content); justify-content: space-between; border-bottom: 1px solid var(--line); padding: 0 4px; overflow-x: auto; scrollbar-width: none; }   /* a tab never shrinks under its count; if they ever don't fit, the bar scrolls */
.tabs::-webkit-scrollbar { display: none; }
.tabs button { min-height: 44px; border: 0; background: none; padding: 0 8px; font-weight: 500; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; display: inline-flex; align-items: center; justify-content: center; gap: 4px; white-space: nowrap; font-size: 13px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 600; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.badge:empty { display: none; }
.badge.gold { background: var(--gold-soft); color: var(--gold); }
.badge.pulse { animation: pulse .6s ease-out; }
@keyframes pulse { 50% { transform: scale(1.3); } }
.panel { flex: 1; min-height: 0; overflow-y: auto; position: relative; overscroll-behavior: contain; }
.panel:focus-visible { outline-offset: -2px; }
.subbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }

/* ---------- list rows: minimum info + one button */
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.row .av, .av { width: 28px; height: 28px; flex: none; border-radius: 6px; background: var(--bg); image-rendering: pixelated; }
.row .main { flex: 1; min-width: 0; }
.row .t { font-weight: 500; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.row .s { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.row .s.bad { color: var(--bad); }
.row.hl { background: var(--accent-soft); }
.tagpill { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 999px; margin-right: 6px; vertical-align: 1px; }
.tagpill.gold { background: var(--gold-soft); color: var(--gold); }
.tagpill.warn { background: var(--warn-soft); color: var(--warn); }
.tagpill.bad { background: var(--bad-soft); color: var(--bad); }
.tagpill.good { background: var(--accent-soft); color: var(--good); }
.tagpill.soft { background: var(--bg); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
/* Work header: the view switch on its own line; under it the day's own-work line, with "+ Add goal" on the right in the Goals view */
.workbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.workbar .seg { grid-column: 1 / -1; justify-self: start; max-width: 100%; }
.workbar .own { grid-column: 1; grid-row: 2; align-self: center; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.workbar .btn { grid-column: 2; grid-row: 2; }
.row .s.what { font-size: 13px; color: var(--ink); }
.rows .ghead { display: flex; justify-content: space-between; gap: 12px; padding: 16px 16px 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.rows .ghead span { font-weight: 400; }
.dl dd.bad { color: var(--bad); }
.skel { height: 52px; margin: 12px 16px; border-radius: var(--r-sm); background: var(--line); opacity: .6; }
@media (prefers-reduced-motion: no-preference) { .skel { animation: fade 1.2s ease-in-out infinite alternate; } }
@keyframes fade { to { opacity: .25; } }
.empty { padding: 32px 24px; text-align: center; color: var(--muted); display: grid; gap: 12px; justify-items: center; }
.empty p { max-width: 280px; }

/* talk feed */
.talk { list-style: none; margin: 0; padding: 4px 0 16px; }
.talk li { display: flex; gap: 12px; padding: 8px 16px; }
.talk li .main { min-width: 0; flex: 1; }
.talk .who { font-weight: 600; }
.talk .meta { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.talk .txt { overflow-wrap: anywhere; font-size: 13px; }
.talk li.log { padding: 2px 16px 2px 56px; color: var(--muted); font-size: 12px; }
.talk li.mhead { padding: 12px 16px 4px; font-size: 12px; font-weight: 600; color: var(--gold); border-top: 1px solid var(--line); margin-top: 4px; }
.talk li.decision .txt { color: var(--gold); font-weight: 600; }
.talk .avbtn { border: 0; padding: 8px; margin: -8px; background: none; cursor: pointer; border-radius: 10px; width: 44px; height: 44px; flex: none; box-sizing: border-box; }
.ico { display: inline-block; width: 12px; height: 12px; vertical-align: -1px; margin-right: 4px; background: currentColor; -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat; }
.ico.phone { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 1h3l1 4-2 1a8 8 0 0 0 4 4l1-2 4 1v3c0 1-1 2-2 2C7 14 2 9 2 3c0-1 1-2 2-2z'/%3E%3C/svg%3E"); }
.pinned { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 16px; background: var(--gold-soft); color: var(--ink); font-weight: 500; font-size: 13px; }
.newpill { position: sticky; bottom: 12px; left: 50%; transform: translateX(-50%); display: block; margin: -40px auto 0; z-index: 2; }

/* ---------- overlay: tags, signs, bubbles */
.tag { font: 600 12px/16px var(--body); padding: 4px 8px; border-radius: var(--r-sm); background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--line); color: var(--ink); cursor: pointer; white-space: nowrap; }
.tag::before { content: ""; position: absolute; inset: -10px -4px; }
.tag.tier-founder { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tag.tier-manager { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.tag.tier-director { box-shadow: inset 3px 0 0 var(--house); padding-left: 10px; }
.tag:hover, .tag:focus-visible, .tag.hl { background: var(--ink); color: var(--bg); border-color: var(--ink); z-index: 2; }
.tag:hover::after, .tag:focus-visible::after { content: attr(data-tip); position: absolute; left: 50%; top: calc(100% + 6px); transform: translateX(-50%); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 6px 8px; font-weight: 400; white-space: normal; width: max-content; max-width: 220px; box-shadow: var(--shadow-pop); }
/* unread dot drawn as a background, so it never fights the hover tooltip (::after) */
.tag.unread, .tag.unread:hover, .tag.unread:focus-visible { background-image: radial-gradient(circle at calc(100% - 4px) 4px, var(--bad) 3.5px, transparent 4px); padding-right: 12px; }
.sign { font: 600 12px/16px var(--body); padding: 2px 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--ink); display: flex; align-items: center; gap: 6px; pointer-events: none !important; white-space: nowrap; }
.sign i { width: 8px; height: 8px; border-radius: 50%; display: block; }
.sign.hiring { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.ground-label { font: 500 12px/16px var(--body); color: var(--muted); pointer-events: none !important; }
.pin-btn { width: 44px; height: 44px; border: 0; background: none; cursor: pointer; border-radius: var(--r-sm); padding: 0; }
.pin-btn:hover { outline: 1px dashed var(--muted); }
.postbox-btn[data-count]:not([data-count=""])::after { content: attr(data-count); position: absolute; right: -8px; top: -10px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px; background: var(--bad); color: #fff; font: 600 11px/18px var(--body); text-align: center; }
.board-btn { width: auto; height: auto; }
.bubble { font: 400 13px/18px var(--body); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; max-width: 240px; width: max-content;
  pointer-events: none !important; opacity: 0; box-shadow: 0 1px 0 rgba(0, 0, 0, .04); z-index: 3; }
.bubble::after { content: ""; position: absolute; left: var(--tail, 50%); bottom: -7px; width: 10px; height: 10px; background: inherit; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); transform: translateX(-50%) rotate(45deg); border-color: inherit; border-top: 0; border-left: 0; margin-left: 0; }
.bubble[data-side="below"]::after { bottom: auto; top: -7px; transform: translateX(-50%) rotate(225deg); }
.bubble[data-side="right"]::after { bottom: auto; left: -6px; top: var(--tail-y, 50%); transform: translateY(-50%) rotate(135deg); }
.bubble[data-side="left"]::after { bottom: auto; left: auto; right: -6px; top: var(--tail-y, 50%); transform: translateY(-50%) rotate(-45deg); }
.bubble b { font-weight: 600; }
.bubble .to { color: var(--muted); }
.bubble .pg { display: block; text-align: right; font-size: 11px; color: var(--muted); line-height: 14px; }
.bubble.founder { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.bubble.founder .to, .bubble.founder .pg { color: color-mix(in srgb, var(--bg) 70%, transparent); }
.bubble.nox { box-shadow: inset 3px 0 0 var(--accent); padding-left: 12px; }
.bubble.question { border-color: var(--warn); }
.bubble.decision { border-color: var(--gold); }
.bubble .ph { display: inline-block; width: 11px; height: 11px; margin-right: 4px; vertical-align: -1px; background: var(--accent); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 1h3l1 4-2 1a8 8 0 0 0 4 4l1-2 4 1v3c0 1-1 2-2 2C7 14 2 9 2 3c0-1 1-2 2-2z'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 1h3l1 4-2 1a8 8 0 0 0 4 4l1-2 4 1v3c0 1-1 2-2 2C7 14 2 9 2 3c0-1 1-2 2-2z'/%3E%3C/svg%3E") center/contain no-repeat; }
.bubble.in { opacity: 1; transition: opacity .16s; }
.bubble.out { opacity: 0; transition: opacity .12s; }
.meeting-banner { font: 600 12px/16px var(--body); background: var(--gold-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--gold) 40%, transparent); border-radius: var(--r-sm); padding: 2px 8px; display: flex; flex-direction: column; width: max-content; z-index: 2; }
.meeting-banner .mb-top { display: flex; gap: 8px; align-items: center; white-space: nowrap; min-width: 0; }
.meeting-banner .mb-top span { overflow: hidden; text-overflow: ellipsis; }
.meeting-banner .link { color: var(--gold); font-size: 12px; min-height: 44px; margin: -12px 0; display: inline-flex; align-items: center; padding: 0 4px; }
.meeting-banner .mb-line { font: 400 13px/18px var(--body); padding: 2px 0 4px; border-top: 1px solid color-mix(in srgb, var(--gold) 30%, transparent); margin-top: 2px; white-space: normal; overflow-wrap: anywhere; }
.meeting-banner .mb-line b { font-weight: 600; }
.meeting-banner .to, .meeting-banner .pg { color: var(--muted); }
.meeting-banner .pg { font-size: 11px; }
.turn-strip { display: flex; align-items: center; gap: 4px; background: color-mix(in srgb, var(--surface) 90%, transparent); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 3px 6px; pointer-events: none !important; font-size: 11px; white-space: nowrap; z-index: 1; }
.turn-strip .label { font-weight: 600; margin-right: 4px; }
.turn-strip img { width: 20px; height: 20px; border-radius: 4px; image-rendering: pixelated; background: var(--bg); }
.turn-strip img.cur { box-shadow: 0 0 0 2px var(--gold); }
.turn-strip img.done, .turn-strip img.later { opacity: .6; }
.turn-strip .think { color: var(--muted); margin-left: 4px; }
.turn-strip.mini { display: none; }

/* ---------- decision moment */
.decision-layer { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; }
.decision-layer .scrim { position: absolute; border-radius: var(--r); box-shadow: 0 0 0 4000px var(--scrim); opacity: 0; transition: opacity .2s; pointer-events: none; }
.decision-layer .scrim.on { opacity: 1; }
.dcard { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px 28px; max-width: min(560px, calc(100% - 24px)); box-shadow: var(--shadow-pop);
  opacity: 0; transform: translate(var(--from-x, 0), var(--from-y, 0)) scale(.6); }
.dcard.in { opacity: 1; transform: none; transition: transform .35s cubic-bezier(.2, .9, .3, 1.15), opacity .2s; }
.dmeta { font: 500 13px/18px var(--body); color: var(--muted); margin-bottom: 8px; padding-right: 88px; }
.dtext { font: 600 28px/34px var(--display); text-wrap: balance; }
.dcard.long .dtext { font-size: 22px; line-height: 28px; }
.downer { display: flex; align-items: center; gap: 8px; margin-top: 16px; font-weight: 500; }
.downer img { width: 42px; height: 42px; border-radius: 8px; background: var(--bg); image-rendering: pixelated; }
.stamp { position: absolute; right: 20px; top: 16px; font: 700 15px/1 var(--display); color: var(--gold); border: 2px solid var(--gold); border-radius: 8px; padding: 6px 10px; transform: rotate(-6deg) scale(1.6); opacity: 0; }
.dcard.stamped .stamp { opacity: 1; transform: rotate(-6deg) scale(1); transition: transform .18s ease-in, opacity .18s; }
.dcard.stamped { animation: dip .08s ease-out .18s; }
@keyframes dip { 50% { translate: 0 2px; } }
.dnext { position: absolute; right: 16px; bottom: 16px; }
.dcard .downer { padding-right: 72px; }

/* ---------- toasts */
.toasts { position: fixed; right: 24px; bottom: 24px; z-index: 60; display: grid; gap: 8px; justify-items: end; pointer-events: none; }
.toast { pointer-events: auto; background: var(--ink); color: var(--bg); border-radius: var(--r); padding: 12px 16px; box-shadow: var(--shadow-pop); display: flex; gap: 12px; align-items: center; max-width: 360px; animation: toastIn .18s ease-out; }
.toast .link { color: var(--accent-soft); }
.toast.bad { background: var(--bad); color: #fff; }
.toast.out { opacity: 0; transition: opacity .14s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* ---------- dialogs */
dialog { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 0; background: var(--surface); color: var(--ink); width: min(560px, calc(100vw - 32px)); max-height: min(86vh, 860px); box-shadow: var(--shadow-pop); }
dialog::backdrop { background: var(--scrim); }
dialog[open] { animation: dlgIn .18s ease-out; display: flex; flex-direction: column; }
dialog.closing { opacity: 0; transition: opacity .14s; }
@keyframes dlgIn { from { opacity: 0; transform: translateY(8px); } }
.dlg-head { display: flex; align-items: flex-start; gap: 16px; padding: 24px 24px 0; }
.dlg-head h2 { font: 600 20px/28px var(--display); flex: 1; }
.dlg-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.dlg-close { width: 44px; height: 44px; margin: -10px -10px 0 0; border: 0; background: none; border-radius: var(--r); cursor: pointer; display: grid; place-items: center; color: var(--muted); }
.dlg-close:hover { background: var(--bg); }
.dlg-body { padding: 16px 24px; overflow-y: auto; display: grid; gap: 16px; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px 24px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.dlg-foot .spacer { flex: 1; }
.dlg-foot .err { width: 100%; color: var(--bad); font-size: 13px; text-align: right; }
fieldset { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 16px 16px; margin: 0; display: grid; gap: 12px; min-width: 0; }
legend { font-weight: 600; padding: 0 4px; font-size: 13px; }
.field { display: grid; gap: 6px; }
.field label, .field .lbl { font-weight: 500; font-size: 13px; }
.field .hint { font-size: 12px; color: var(--muted); }
.field .ferr { font-size: 12px; color: var(--bad); }
input[type=text], input[type=date], input[type=password], select, textarea { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); }
textarea { min-height: 88px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
[aria-invalid="true"] { border-color: var(--bad) !important; }
.radios { display: flex; gap: 8px; flex-wrap: wrap; }
.radios label, .check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; font-weight: 500; font-size: 13px; }
.radios input, .check input { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; }
.check.plain { border: 0; padding: 0; }
.people-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.people-grid label { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px 8px; border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; font-size: 13px; min-width: 0; }
.people-grid label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people-grid img { width: 24px; height: 24px; border-radius: 4px; image-rendering: pixelated; background: var(--bg); flex: none; }
.people-grid input { accent-color: var(--accent); margin: 0; flex: none; }
.people-grid label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.note { font-size: 13px; color: var(--muted); }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; overflow-wrap: anywhere; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.box { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 16px; }
.banner-test { background: var(--warn-soft); color: var(--warn); border-radius: var(--r); padding: 8px 12px; font-weight: 500; font-size: 13px; }
.email-head { display: grid; gap: 2px; font-size: 13px; padding-bottom: 8px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.post-card { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 16px; display: grid; gap: 8px; }
.post-card .post-head { display: flex; gap: 8px; align-items: center; font-weight: 600; font-size: 13px; }
.wa { background: #DCF8C6; color: #111; border-radius: 10px 10px 2px 10px; padding: 8px 12px; justify-self: end; max-width: 85%; white-space: pre-wrap; }
.person-head { display: flex; gap: 16px; align-items: center; }
.person-head img { width: 56px; height: 56px; border-radius: var(--r); background: var(--bg); image-rendering: pixelated; }
/* Nox tab: the chat fills the panel, the box stays at the bottom */
.panel.chat { display: flex; flex-direction: column; }
.nox-head { justify-content: flex-start; gap: 12px; }
.nox-head .main { flex: 1; min-width: 0; }
.nox-head::after { content: ""; position: absolute; left: 0; right: 0; top: calc(100% + 1px); height: 16px; background: linear-gradient(var(--surface), transparent); pointer-events: none; }   /* older messages fade out under the header */
.nox-head .t { font-weight: 600; }
.nox-head .s { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nox-head .link { min-height: 44px; margin: -8px 0; flex: none; }
.thread { flex: 1 0 auto; display: grid; gap: 8px; align-content: end; padding: 16px; }
.nox-foot { position: sticky; bottom: 0; z-index: 1; display: grid; gap: 8px; padding: 12px 16px; background: var(--surface); border-top: 1px solid var(--line); }
.nox-foot .err { color: var(--bad); font-size: 13px; }
.nox-foot .err:empty { display: none; }
.msg { white-space: pre-wrap; max-width: 85%; padding: 8px 12px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); overflow-wrap: anywhere; font-size: 14px; }
.msg.report { max-width: 100%; background: var(--surface); border-left: 3px solid var(--accent); display: grid; gap: 4px; }
.msg.report .rhead { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.msg.report .rhead span { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.msg.me { justify-self: end; background: var(--ink); color: var(--bg); border-color: var(--ink); }
.typing { font-size: 13px; color: var(--muted); }
.compose { display: flex; gap: 8px; align-items: flex-end; }
.compose textarea { min-height: 44px; height: 44px; }
.transcript { display: grid; gap: 8px; max-height: 300px; overflow-y: auto; }
.transcript p { font-size: 13px; overflow-wrap: anywhere; }
.big-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.big-choice button { display: grid; justify-items: center; gap: 8px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg); cursor: pointer; font-weight: 600; min-height: 44px; }
.big-choice button:hover { border-color: var(--accent); }
.big-choice img { width: 72px; height: 72px; image-rendering: pixelated; }
.big-choice small { font-weight: 400; color: var(--muted); }
.sheet-grab { display: none; }

/* ---------- 1024-1279 */
@media (min-width: 600px) { .tabs button { padding: 0 3px; } .tabs .badge { padding: 0 4px; } }   /* seven tabs with their counts fit the 464px rail */

/* ---------- 768-1023: rail under the village */
@media (max-width: 1279px) {
  .layout { grid-template-columns: 1fr; }
  .rail { height: auto; min-height: 420px; max-height: 70vh; }
}
/* ---------- phone */
@media (max-width: 599px) {
  :root { --top-h: 52px; }
  .desk-only { display: none !important; }
  .phone-only { display: revert !important; }
  .caption.phone-only { display: flex !important; }
  .topbar { padding: 0 16px; }
  .menu { right: 16px; left: 16px; width: auto; }
  .layout { padding: 0 0 calc(80px + env(safe-area-inset-bottom)); gap: 0; }
  .village { position: sticky; top: var(--top-h); z-index: 10; background: var(--bg); padding: 8px 16px 0; }
  .stage { border-radius: var(--r); }
  .stage-foot { margin: 4px 0 8px; }
  .stage-foot .demo-line { font-size: 11px; line-height: 14px; }
  .caption { width: 100%; min-height: 44px; margin-top: 8px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); text-align: left; padding: 6px 10px; cursor: pointer; align-items: center; }
  .cap-text { display: flex; gap: 8px; align-items: center; font-size: 12px; line-height: 16px; min-width: 0; }
  .cap-text img { width: 24px; height: 24px; border-radius: 4px; image-rendering: pixelated; background: var(--bg); flex: none; }
  .cap-text > span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .rail { border-radius: 0; border-left: 0; border-right: 0; height: auto; max-height: none; min-height: 50vh; overflow: visible; }
  .tabs { position: sticky; top: calc(var(--top-h) + var(--village-h, 300px)); z-index: 9; background: var(--surface); justify-content: start; }
  .tabs button { padding: 0 8px; font-size: 13px; gap: 3px; }
  .panel { overflow: visible; }
  .nox-foot { bottom: calc(65px + env(safe-area-inset-bottom)); }   /* sits on the fixed action bar */
  .layout:has(.panel.chat) { padding-bottom: calc(65px + env(safe-area-inset-bottom)); }   /* no empty strip under the box */
  .talk { display: flex; flex-direction: column-reverse; overflow-anchor: none; }   /* phone: newest first, right under the tabs; no scroll anchoring, or each new message would push the page down and hide under the tab bar */
  .subbar { top: calc(var(--top-h) + var(--village-h, 300px) + 45px); }
  .pinned { top: calc(var(--top-h) + var(--village-h, 300px) + 45px); }
  .phone-actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; display: grid !important; grid-template-columns: 1fr 1fr 1fr 1.45fr; gap: 6px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line); }
  .phone-actions .btn { padding: 0 8px; }
  .toasts { left: 16px; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); justify-items: stretch; }
  .toast { max-width: none; }
  .bubble { font-size: 12px; line-height: 17px; max-width: 200px; }
  .dtext { font-size: 22px; line-height: 28px; }
  .dcard { padding: 16px; max-width: calc(100% - 24px); }
  .dmeta { font-size: 12px; padding-right: 76px; }
  .downer { margin-top: 8px; font-size: 13px; }
  .downer img { width: 32px; height: 32px; }
  .stamp { right: 12px; top: 12px; font-size: 13px; }
  dialog { width: 100vw; max-width: 100vw; max-height: 90vh; margin: auto 0 0; border-radius: var(--r-lg) var(--r-lg) 0 0; border-bottom: 0; }
  dialog[open] { animation: sheetIn .22s ease-out; }
  @keyframes sheetIn { from { transform: translateY(40px); opacity: 0; } }
  .sheet-grab { display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 8px auto 0; }
  .dlg-head { padding: 12px 16px 0; }
  .dlg-body { padding: 16px; font-size: 16px; }
  .dlg-foot { padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); }
  .dlg-foot .btn { flex: 1; }
  .dlg-foot .spacer { display: none; }
  .people-grid { grid-template-columns: 1fr 1fr; }
  input[type=text], input[type=date], input[type=password], select, textarea { font-size: 16px; }
  .big-choice img { width: 56px; height: 56px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
  .bubble.in, .bubble.out { transition-duration: .15s !important; }
}
/* while a decision card shows, the Quiet banner moves to the top edge so both stay readable */
.stage:has(.decision-layer:not([hidden])) .quiet-banner { top: 12px; transform: translateX(-50%); flex-direction: row; padding: 8px 12px; gap: 12px; }

/* small bubbles in the town hall: the full words read in the meeting banner */
.bubble.mini { font-size: 12px; line-height: 16px; padding: 4px 8px; max-width: 180px; }
/* a tag that would sit under a bubble steps aside until the bubble is gone */
.tag.away { visibility: hidden; }
/* 44 px tap targets */
.topbar .seg button { min-height: 44px; }
.summary .link { min-height: 44px; display: inline-flex; align-items: center; vertical-align: middle; }
.pinned .btn { min-height: 44px; }
.tabs button { min-width: 44px; }
@media (min-width: 1280px) { .tabs button { min-width: 0; gap: 3px; } }   /* narrow rail, mouse: seven tabs fit even with every count at 99+ */

/* Talk to Nox button, clients */
.btn-av { width: 22px; height: 22px; border-radius: 5px; image-rendering: pixelated; background: color-mix(in srgb, var(--on-accent) 85%, transparent); margin-left: -4px; }
.row.client { align-items: flex-start; }
.row.client .btn { margin-top: 2px; }
.row .team { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; }
.row .team .kind { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; }
.av.mini { width: 20px; height: 20px; border-radius: 4px; }
ul.plain { margin: 4px 0 0; padding-left: 18px; font-size: 13px; display: grid; gap: 4px; }
.talk li.mhead.inbound { color: var(--accent); }
.subbar .btn + .btn { margin-left: auto; }
