/* =========================================================================
   Boardroom — StartupBoD design system (paper / brass editorial)
   Light default; dark under [data-theme="dark"]. One primary hue (brass).
   No gradients, no glass, no 3D. Two continuous animations only:
   waveform bars and the active speaker's ring.
   ========================================================================= */

/* ----- Tokens ----- */

:root {
    --paper: #FBFAF7;
    --surface: #FFFFFF;
    --raised: #FFFFFF;
    --sunken: #F4F1EA;
    --line: #E1DACD;
    --line-soft: #EDE7DC;
    --ink-900: #141210;
    --ink-700: #332E27;
    --ink-500: #564E44;
    --ink-400: #6E6659;
    --brand: #96601A;
    --brand-ink: #FFFFFF;
    --brand-tint: #F6ECD9;
    --good: #186B4D;
    --good-tint: #E1F0E9;
    --bad: #A4322A;
    --bad-tint: #F8E5E2;

    --shadow-sm: 0 1px 3px rgba(22, 19, 15, .06), 0 1px 2px rgba(22, 19, 15, .04);
    --shadow-md: 0 4px 12px rgba(22, 19, 15, .06), 0 2px 4px rgba(22, 19, 15, .04);
    --shadow-lg: 0 16px 40px rgba(22, 19, 15, .10), 0 4px 8px rgba(22, 19, 15, .04);

    --sans: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;

    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] {
    --paper: #131110;
    --surface: #1B1917;
    --raised: #232019;
    --sunken: #0E0D0C;
    --line: #302B24;
    --line-soft: #252118;
    --ink-900: #F6F2EB;
    --ink-700: #DAD3C7;
    --ink-500: #ABA294;
    --ink-400: #9E9483;  /* lifted for AA on dark surfaces (was #8B8272) */
    --brand: #E0A44A;
    --brand-ink: #1A1408;
    --brand-tint: #2A2114;
    --good: #4FBF92;
    --good-tint: #152A22;
    --bad: #E0705F;
    --bad-tint: #2C1A17;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .5);
    --shadow-md: 0 6px 18px rgba(0, 0, 0, .45);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, .55);
}

/* ----- Base ----- */

*, *::before, *::after { box-sizing: border-box; }

/* Author display rules (flex cards etc.) must never defeat the hidden
   attribute — !important restores its authority over inline styles too. */
[hidden] { display: none !important; }

html { height: 100%; }

body {
    margin: 0;
    height: 100vh;
    height: 100dvh;
    background: var(--paper);
    color: var(--ink-900);
    font-family: var(--sans);
    font-size: 13.5px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior-y: none;
    -webkit-tap-highlight-color: transparent;
}

::selection { background: var(--brand-tint); color: var(--ink-900); }

button { font-family: inherit; cursor: pointer; }

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: 4px;
}
input, textarea, select { font-family: inherit; color: var(--ink-900); }
button, a, [role="button"] { touch-action: manipulation; }

h1, h2, h3, p { margin: 0; }
img { max-width: 100%; display: block; }

@media (max-width: 819px) {
    input, textarea, select { font-size: 16px !important; } /* no zoom-on-focus */
}

/* Scrollbars */
.scroll { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.scroll::-webkit-scrollbar { width: 5px; height: 5px; }
.scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; }
.scroll::-webkit-scrollbar-track { background: transparent; }

/* ----- Type helpers ----- */

.overline {
    font-family: var(--mono);
    font-size: 10.5px;
    line-height: 16px;
    font-weight: 600;
    letter-spacing: 0.085em;
    text-transform: uppercase;
    color: var(--ink-400);
}

.mono { font-family: var(--mono); }

.h1 {
    font-size: clamp(21px, 5vw, 26px);
    line-height: 1.22;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--ink-900);
}

.lede {
    font-size: 15px;
    line-height: 1.55;
    color: var(--ink-500);
    max-width: 58ch;
}

/* ----- App shell ----- */

#app {
    display: flex;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* Desktop rail */
#rail {
    width: 248px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--line);
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

/* Mobile: the rail becomes a slide-in drawer opened by the hamburger. */
body.narrow #rail {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: min(82vw, 300px);
    z-index: 60;
    box-shadow: var(--shadow-lg);
    transform: translateX(-100%);
    transition: transform 240ms var(--ease);
    padding-top: max(20px, env(safe-area-inset-top));
}
body.narrow.nav-open #rail { transform: translateX(0); }

#nav-backdrop {
    position: fixed; inset: 0; z-index: 55;
    background: rgba(22, 19, 15, 0.45);
    opacity: 0; transition: opacity 240ms var(--ease);
}
body.narrow.nav-open #nav-backdrop { opacity: 1; }
body:not(.nav-open) #nav-backdrop, body:not(.narrow) #nav-backdrop { display: none; }

.brand-lockup { display: flex; align-items: center; gap: 10px; padding: 0 6px 18px; }

.brand-mark {
    width: 32px; height: 32px; flex-shrink: 0;
    background: var(--brand); color: var(--brand-ink);
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
}
.brand-mark svg { width: 18px; height: 18px; }

.brand-name { font-size: 15px; font-weight: 600; line-height: 1.2; }
.brand-sub { font-family: var(--mono); font-size: 11px; color: var(--ink-400); }

.nav-group { padding: 12px 6px 4px; }

a.nav-item, a.pill-nav-item { text-decoration: none; }

.nav-item {
    display: flex; align-items: center; gap: 10px;
    width: 100%;
    padding: 9px 8px;
    border: none; background: transparent;
    border-radius: 8px;
    font-size: 13.5px; font-weight: 500;
    color: var(--ink-700);
    text-align: left;
    transition: background 160ms var(--ease), color 160ms var(--ease);
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; color: var(--ink-400); }
.nav-item:hover { background: var(--sunken); }
.nav-item.active { background: var(--brand-tint); color: var(--brand); }
.nav-item.active svg { color: var(--brand); }
.nav-count { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--ink-400); }

.live-dot {
    width: 6px; height: 6px; border-radius: 99px;
    background: var(--bad); margin-left: auto; flex-shrink: 0;
    display: none;
}
body.in-live-session .live-dot { display: block; }

.rail-footer { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 16px; }

.rail-persona {
    display: flex; align-items: center; gap: 10px;
    width: 100%;
    background: var(--sunken);
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 9px 10px;
    text-align: left;
    transition: border-color 160ms var(--ease);
}
.rail-persona:hover { border-color: var(--brand); }
.rail-persona-name { font-size: 12.5px; font-weight: 600; color: var(--ink-900); line-height: 1.25; }
.rail-persona-role { font-size: 10.5px; color: var(--ink-500); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }

.monogram {
    display: flex; align-items: center; justify-content: center;
    border-radius: 99px; flex-shrink: 0;
    background: var(--brand-tint); color: var(--brand);
    font-family: var(--mono); font-weight: 600;
}

.theme-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 4px 10px 0;
    background: transparent; border: none;
    font-size: 12.5px; color: var(--ink-500);
    min-height: 32px;
}
.theme-track {
    width: 26px; height: 15px; border-radius: 99px;
    background: var(--line); position: relative; flex-shrink: 0;
}
.theme-knob {
    position: absolute; top: 2px; left: 2px;
    width: 11px; height: 11px; border-radius: 99px;
    background: var(--brand);
    transition: left 200ms var(--ease);
}
[data-theme="dark"] .theme-knob { left: 13px; }

/* Mobile header */
#mobile-head {
    display: none;
    position: sticky; top: 0; z-index: 20;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding-top: env(safe-area-inset-top);
}
body.narrow #mobile-head { display: block; }

.mh-row1 { display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.mh-titles { min-width: 0; flex: 1; }
.mh-title { font-size: 14px; font-weight: 600; line-height: 1.2; }
.mh-sub { font-family: var(--mono); font-size: 10px; color: var(--ink-400); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mh-btn {
    width: 44px; height: 44px; border-radius: 99px; flex-shrink: 0;
    border: 1px solid var(--line); background: var(--surface);
    display: flex; align-items: center; justify-content: center;
    color: var(--ink-500); font-family: var(--mono); font-size: 12px; font-weight: 600;
}
.mh-btn svg { width: 18px; height: 18px; }

.pill-nav {
    display: flex; gap: 6px; padding: 0 14px 10px;
    overflow-x: auto;
    scrollbar-width: none;
}
.pill-nav::-webkit-scrollbar { display: none; }
.pill-nav-item {
    display: inline-flex; align-items: center; gap: 6px;
    border: 1px solid var(--line); background: var(--surface);
    border-radius: 99px; padding: 0 15px; min-height: 44px;
    font-size: 12.5px; font-weight: 500; color: var(--ink-700);
    white-space: nowrap; flex-shrink: 0;
    transition: background 160ms var(--ease);
}
.pill-nav-item.active { background: var(--brand-tint); border-color: var(--brand); color: var(--brand); }
.pill-nav-item .live-dot { margin-left: 0; }

/* Main column */
#main {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column;
    overflow: hidden;
}
body.narrow #app { flex-direction: column; }

.screen {
    flex: 1; min-height: 0;
    overflow-y: auto;
    padding: clamp(20px, 4.6vw, 36px) clamp(14px, 3.4vw, 28px);
    /* Keep the last content clear of the iOS home indicator. */
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
}
.screen[hidden] { display: none; }

.screen-inner { max-width: 840px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.screen-inner.wide { max-width: 1080px; }
.screen-inner.mid { max-width: 880px; }

.screen-head { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }

/* ----- Cards & controls ----- */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
    padding: clamp(15px, 3.4vw, 20px);
}
.card.flat { box-shadow: none; }
.card.big { border-radius: 16px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border-radius: 9px;
    padding: 10px 18px;
    min-height: 44px;
    font-size: 13.5px; font-weight: 600;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink-900);
    transition: background 160ms var(--ease), border-color 160ms var(--ease), opacity 160ms var(--ease);
}
.btn:hover { background: var(--sunken); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn svg { width: 16px; height: 16px; }

.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { opacity: 0.92; }
/* Waiting on the first clip to be generated — the button stays clickable so
   the wait can be cancelled, it just reads as busy. */
.btn.is-busy { animation: holdpulse 1.4s ease-in-out infinite; }

.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-500); }
.btn.ghost:hover { background: var(--sunken); color: var(--ink-700); }

.btn.danger-text { border-color: transparent; background: transparent; color: var(--bad); }

.seg-pill {
    border: 1px solid var(--line); background: var(--surface);
    border-radius: 99px; padding: 6px 13px; min-height: 34px;
    font-size: 12.5px; font-weight: 500; color: var(--ink-700);
    transition: background 160ms var(--ease);
}
.seg-pill.selected { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

/* Voices on/off sound switch (transcript header) */
.voice-switch {
    display: inline-flex; align-items: center; gap: 7px;
    border: 1px solid var(--line); background: var(--surface);
    border-radius: 99px; padding: 7px 14px; min-height: 34px;
    font-family: var(--sans); font-size: 12.5px; font-weight: 600;
    color: var(--ink-400); white-space: nowrap;
    transition: background 160ms var(--ease), color 160ms var(--ease), border-color 160ms var(--ease);
}
.voice-switch svg { width: 15px; height: 15px; flex-shrink: 0; }
.voice-switch.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

.chip {
    display: inline-flex; align-items: center;
    background: var(--sunken); border-radius: 99px;
    padding: 5px 11px; font-size: 11.5px; color: var(--ink-700);
}

.chip.good { background: var(--good-tint); color: var(--good); }
.chip.bad { background: var(--bad-tint); color: var(--bad); }
.chip.brand { background: var(--brand-tint); color: var(--brand); }

.avatar-img {
    border-radius: 99px; object-fit: cover;
    border: 2px solid var(--line);
    background: var(--sunken);
}

/* Switch toggle (38 x 22) */
.switch {
    width: 38px; height: 22px; border-radius: 99px; flex-shrink: 0;
    background: var(--line); border: none; position: relative;
    transition: background 180ms var(--ease);
    padding: 0;
}
.switch::after {
    content: '';
    position: absolute; top: 3px; left: 3px;
    width: 16px; height: 16px; border-radius: 99px;
    background: var(--surface);
    transition: left 180ms var(--ease);
    box-shadow: var(--shadow-sm);
}
.switch[aria-pressed="true"] { background: var(--brand); }
.switch[aria-pressed="true"]::after { left: 19px; }

/* ----- Toasts ----- */

#toasts {
    position: fixed;
    top: max(12px, env(safe-area-inset-top));
    right: 12px; left: 12px;
    z-index: 100;
    display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
    pointer-events: none;
}
.toast {
    pointer-events: auto;
    display: flex; align-items: center; gap: 9px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 2px solid var(--ink-400);
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    padding: 11px 15px;
    font-size: 12.5px; color: var(--ink-700);
    max-width: 380px;
    animation: toastIn 240ms var(--ease) both;
}
.toast.error { border-left-color: var(--bad); }
.toast.success { border-left-color: var(--good); }
.toast.exit { animation: toastOut 160ms var(--ease) both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; } }

/* ----- Screen 1 · Bring an issue ----- */

.intake-card { border-radius: 16px; padding: 18px; }

.intake-textarea {
    width: 100%;
    border: none; outline: none; resize: none;
    background: transparent;
    font-size: 16px; line-height: 1.6;
    color: var(--ink-900);
    min-height: 120px;
    field-sizing: content;
}
.intake-textarea::placeholder { color: var(--ink-400); }

.intake-foot {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    border-top: 1px solid var(--line-soft);
    padding-top: 13px; margin-top: 10px;
}
.intake-foot .overline { margin-right: 2px; }
.intake-foot .btn.primary { margin-left: auto; }

.ctx-selects { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ctx-select {
    appearance: none; -webkit-appearance: none;
    background-color: var(--sunken);
    border: 1px solid var(--line);
    border-radius: 99px;
    font-size: 12px; color: var(--ink-700);
    padding: 7px 26px 7px 12px;
    min-height: 34px;
    max-width: 190px;
    text-overflow: ellipsis; white-space: nowrap; overflow: hidden;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236E6659' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 9px center; background-size: 11px;
}
.ctx-select:focus { outline: none; border-color: var(--brand); }
.ctx-select.is-set { border-color: var(--brand); color: var(--brand); }

.deep-card { display: none; flex-direction: column; gap: 8px; }
.deep-card.open { display: flex; }
.deep-row {
    display: flex; gap: 12px; align-items: flex-start;
    background: var(--sunken); border-radius: 10px; padding: 12px 14px;
}
.deep-num { font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--brand); padding-top: 3px; }
.deep-q { font-size: 12.5px; color: var(--ink-700); line-height: 1.5; }
.deep-a {
    width: 100%;
    border: none; border-bottom: 1px solid var(--line);
    background: transparent; outline: none;
    font-size: 13px; padding: 6px 0 5px;
    color: var(--ink-900);
}
.deep-a:focus { border-bottom-color: var(--brand); }

.seat-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.seat-pill {
    display: inline-flex; align-items: center; gap: 8px;
    border: 1px solid var(--line); background: transparent;
    border-radius: 99px; padding: 5px 14px 5px 5px; min-height: 44px;
    font-size: 12.5px; font-weight: 500; color: var(--ink-700);
    transition: background 160ms var(--ease), border-color 160ms var(--ease);
}
.seat-pill img { width: 32px; height: 32px; border-radius: 99px; object-fit: cover; }
.seat-pill.seated { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.seat-pill:not(.seated) img { opacity: 0.4; }

/* ----- Screen 2 · Moderator framing ----- */

.framing-head { display: flex; gap: 14px; align-items: flex-start; }
.framing-head-icon {
    width: 42px; height: 42px; border-radius: 99px; flex-shrink: 0;
    background: var(--brand-tint); color: var(--brand);
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--line);
}
.framing-head-icon svg { width: 20px; height: 20px; }

.context-card { display: flex; flex-wrap: wrap; gap: 24px; }
.context-col { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }

.who-head { display: flex; align-items: center; gap: 12px; }
.who-name { font-size: 14.5px; font-weight: 600; }
.who-role { font-size: 12px; color: var(--ink-500); }

.kv-row { display: flex; gap: 10px; align-items: baseline; }
.kv-label {
    width: 92px; flex-shrink: 0;
    font-family: var(--mono); font-size: 10px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-400);
}
.kv-value { font-size: 13px; color: var(--ink-700); min-width: 0; }

.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

.framing-quote { border-left: 2px solid var(--brand); border-radius: 14px; }

.confirm-bar { display: flex; flex-direction: column; gap: 12px; }
.confirm-q { font-size: 14.5px; font-weight: 600; }
.confirm-input {
    width: 100%;
    background: var(--sunken);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 11px 13px;
    font-size: 13.5px; line-height: 1.55;
    outline: none; resize: none;
    min-height: 64px;
    field-sizing: content;
}
.confirm-input:focus { border-color: var(--brand); }
.confirm-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.confirm-actions .btn { min-height: 48px; }

.avatar-stack { display: flex; align-items: center; }
.avatar-stack img {
    width: 28px; height: 28px; border-radius: 99px; object-fit: cover;
    border: 2px solid var(--surface);
    margin-left: -8px;
}
.avatar-stack img:first-child { margin-left: 0; }

/* ----- Screen 3 · Live session ----- */

.live-head {
    display: flex; flex-direction: column; gap: 10px;
}
.live-status { display: flex; align-items: center; gap: 8px; }
.live-status .dot { width: 6px; height: 6px; border-radius: 99px; background: var(--bad); }
.live-q {
    font-size: clamp(15.5px, 3.6vw, 19px);
    line-height: 1.45; font-weight: 600; letter-spacing: -0.012em;
    max-width: 62ch;
}
.live-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.live-actions .btn { min-height: 44px; }

.live-body { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.stage-col { flex: 1 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.transcript-col { flex: 1 1 340px; max-width: 440px; min-width: 0; }
body.narrow .transcript-col { max-width: none; }

.stage-card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: 16px; box-shadow: var(--shadow-md);
    padding: 16px;
    display: flex; flex-direction: column; gap: 14px;
}

/* Voice bar */
.voice-bar {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    background: var(--sunken); border-radius: 12px; padding: 12px 14px;
}
.voice-avatar {
    width: 38px; height: 38px; border-radius: 99px; flex-shrink: 0;
    background-color: var(--brand-tint);
    background-size: cover; background-position: center;
    display: flex; align-items: center; justify-content: center;
    color: var(--brand); font-family: var(--mono); font-size: 12px; font-weight: 600;
    border: 1px solid var(--line);
}
.voice-meta { min-width: 0; }
.voice-name { font-size: 13.5px; font-weight: 600; line-height: 1.25; }
.voice-sub { font-size: 11px; color: var(--ink-500); }

.waveform {
    display: flex; align-items: flex-end; gap: 2px;
    height: 34px; flex: 1; min-width: 120px; overflow: hidden;
}
.waveform span {
    flex: 1; max-width: 4px; border-radius: 2px;
    background: var(--brand);
    transform-origin: bottom;
    animation: wavebar 760ms ease alternate infinite;
    animation-play-state: paused;
}
.waveform.playing span { animation-play-state: running; }
@keyframes wavebar { from { transform: scaleY(0.22); } to { transform: scaleY(1); } }

.voice-time { font-family: var(--mono); font-size: 11px; color: var(--ink-500); }
.voice-play {
    width: 34px; height: 34px; border-radius: 99px; flex-shrink: 0;
    border: 1px solid var(--line); background: var(--surface); color: var(--ink-700);
    display: flex; align-items: center; justify-content: center;
}
.voice-play svg { width: 14px; height: 14px; }

/* Round table */
.table-wrap {
    position: relative;
    container-type: inline-size;
    aspect-ratio: 1 / 1.05;
    min-height: 330px;
    max-height: 470px;
    width: 100%;
}
.table-felt {
    position: absolute; inset: 13% 11%;
    border-radius: 50%;
    background: var(--sunken);
    border: 1px solid var(--line);
}
.table-center {
    position: absolute; left: 50%; top: 51%;
    transform: translate(-50%, -50%);
    width: min(42%, 230px);
    display: flex; flex-direction: column; align-items: center; gap: 5px;
    text-align: center;
}
.table-motion-label {
    display: flex; align-items: center; gap: 4px;
    font-family: var(--mono); font-size: clamp(8px, 2.4cqw, 9px);
    font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--good);
}
.table-motion {
    font-size: clamp(9.5px, 3.1cqw, 13px);
    line-height: 1.4; font-weight: 500; color: var(--ink-700);
}
.table-link {
    font-family: var(--mono); font-size: 9.5px; color: var(--brand);
    background: none; border: none; padding: 4px;
    text-decoration: underline; text-underline-offset: 2px;
}
body.narrow .table-link { display: none; }

.seat {
    position: absolute;
    transform: translate(-50%, -50%);
    width: clamp(62px, 24cqw, 104px);
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    background: none; border: none; padding: 0;
}
.seat.special { width: clamp(66px, 26cqw, 118px); }
.seat-avatar {
    position: relative;
    width: clamp(36px, 14cqw, 56px);
    height: clamp(36px, 14cqw, 56px);
    border-radius: 99px;
    border: 2px solid var(--line);
    background: var(--surface);
    overflow: visible;
    transition: border-color 160ms var(--ease), opacity 240ms var(--ease);
    display: flex; align-items: center; justify-content: center;
}
.seat-avatar img { width: 100%; height: 100%; border-radius: 99px; object-fit: cover; }
.seat:hover .seat-avatar { border-color: var(--brand); }

.seat.mod .seat-avatar { background: var(--brand-tint); border-color: var(--brand); color: var(--brand); }
.seat.mod .seat-avatar svg { width: 45%; height: 45%; }
.seat.you .seat-avatar {
    border-style: dashed; border-color: var(--ink-400);
    background: var(--surface);
    color: var(--ink-700); font-family: var(--mono); font-weight: 600;
    font-size: clamp(11px, 3.4cqw, 15px);
}

.seat-ring {
    position: absolute; inset: -6px;
    border: 2px solid var(--brand); border-radius: 99px;
    opacity: 0;
    pointer-events: none;
}
.seat.speaking .seat-ring { animation: seatring 1.6s var(--ease) infinite; }
@keyframes seatring {
    from { transform: scale(1); opacity: 0.55; }
    to { transform: scale(1.28); opacity: 0; }
}

.seat-name {
    font-size: clamp(9.5px, 3.2cqw, 12px);
    line-height: 1.2; font-weight: 600; color: var(--ink-900);
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.seat-stance {
    font-family: var(--mono);
    font-size: clamp(7.5px, 2.5cqw, 9.5px);
    letter-spacing: 0.05em; text-transform: uppercase;
    color: var(--ink-400);
}
.seat.speaking .seat-stance, .seat.you .seat-stance { color: var(--brand); }
.seat.absent .seat-avatar { opacity: 0.35; }
.seat.absent .seat-name { color: var(--ink-400); }

/* Composer */
.composer {
    display: flex; align-items: center; gap: 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 12px;
}
.composer-mic {
    width: 38px; height: 38px; border-radius: 99px; flex-shrink: 0;
    background: var(--brand); color: var(--brand-ink); border: none;
    display: flex; align-items: center; justify-content: center;
}
.composer-mic svg { width: 17px; height: 17px; }
.composer-mic.recording { background: var(--bad); }
.composer-input {
    flex: 1; min-width: 0;
    border: none; outline: none; background: transparent; resize: none;
    font-size: 13.5px; line-height: 1.5;
    color: var(--ink-900);
    max-height: 92px;
    field-sizing: content;
}
.composer-input::placeholder { color: var(--ink-400); }
.composer-hint { font-family: var(--mono); font-size: 10px; color: var(--ink-400); white-space: nowrap; }
body.narrow .composer-hint { display: none; }
.composer-send {
    width: 38px; height: 38px; border-radius: 99px; flex-shrink: 0;
    border: 1px solid var(--line); background: var(--surface); color: var(--ink-700);
    display: flex; align-items: center; justify-content: center;
    transition: opacity 160ms var(--ease);
}
.composer-send:not(:disabled) { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.composer-send:disabled { opacity: 0.4; }
.composer-send svg { width: 16px; height: 16px; }
.composer-attach {
    background: none; border: none; color: var(--ink-400); flex-shrink: 0;
    width: 34px; height: 38px; display: flex; align-items: center; justify-content: center;
}
.composer-attach svg { width: 17px; height: 17px; }
.composer-attach:hover { color: var(--brand); }

.attach-note {
    display: flex; align-items: center; gap: 8px;
    background: var(--sunken); border-radius: 10px;
    padding: 8px 12px;
    font-size: 12px; color: var(--ink-700);
}
.attach-note .x { margin-left: auto; background: none; border: none; color: var(--ink-400); padding: 6px; }
.attach-privacy { font-size: 10.5px; color: var(--ink-400); line-height: 1.5; }

/* Action bars (confirm / comment) shown above the composer */
.stage-actions { display: flex; flex-direction: column; gap: 8px; }
.stage-actions-label { font-size: 12px; color: var(--ink-500); }
.stage-actions-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* Transcript */
.transcript-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    display: flex; flex-direction: column;
    overflow: hidden;
}
.transcript-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 13px 16px;
    border-bottom: 1px solid var(--line-soft);
    font-size: 13.5px; font-weight: 600;
}
.transcript-list {
    overflow-y: auto;
    max-height: 640px;
    display: flex; flex-direction: column;
    padding: 6px 0;
    overscroll-behavior: contain;
}
body.narrow .transcript-list { max-height: 60vh; }

.t-row {
    display: flex; gap: 10px;
    padding: 11px 16px;
    animation: rowIn 240ms var(--ease) both;
}
@keyframes rowIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.t-row.current { background: var(--brand-tint); }
.t-avatar { width: 30px; height: 30px; border-radius: 99px; object-fit: cover; flex-shrink: 0; border: 1px solid var(--line); }
.t-mono-avatar {
    width: 30px; height: 30px; border-radius: 99px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--mono); font-size: 10.5px; font-weight: 600;
    background: var(--sunken); color: var(--ink-500);
    border: 1px solid var(--line);
}
.t-row.user-row .t-mono-avatar { background: var(--brand-tint); color: var(--brand); }
.t-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.t-head { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.t-name { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.t-meta { font-family: var(--mono); font-size: 10px; color: var(--ink-400); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-stance { margin-left: auto; font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-400); flex-shrink: 0; }
.t-msg { font-size: 13px; line-height: 1.55; color: var(--ink-700); overflow-wrap: break-word; }
.t-msg p { margin: 5px 0; }
.t-msg p:first-child { margin-top: 0; }
.t-msg h2 { font-size: 13px; font-weight: 600; color: var(--ink-900); margin: 10px 0 4px; }
.t-msg h3 { font-size: 12.5px; font-weight: 600; color: var(--ink-700); margin: 8px 0 3px; }
.t-msg ul, .t-msg ol { margin: 5px 0; padding-left: 18px; }
.t-msg ul { list-style: disc; }
.t-msg ol { list-style: decimal; }
.t-msg li { margin: 3px 0; }
.t-msg code {
    font-family: var(--mono); font-size: 0.85em;
    background: var(--sunken); border-radius: 4px; padding: 1px 5px;
}
.t-msg strong { color: var(--ink-900); }

.t-play {
    align-self: flex-start;
    display: inline-flex; align-items: center; gap: 6px;
    border: 1px solid var(--line); background: transparent;
    border-radius: 99px; padding: 4px 12px; min-height: 30px;
    font-family: var(--mono); font-size: 10px; color: var(--ink-500);
    transition: border-color 160ms var(--ease), color 160ms var(--ease);
}
.t-play:hover { border-color: var(--brand); color: var(--brand); }
.t-play.playing { border-color: var(--brand); color: var(--brand); background: var(--brand-tint); }
.t-play svg { width: 10px; height: 10px; }
.t-play.muted { opacity: 0.6; pointer-events: none; }

.t-badge {
    font-family: var(--mono); font-size: 9px; font-weight: 600;
    letter-spacing: 0.06em; text-transform: uppercase;
    background: var(--brand-tint); color: var(--brand);
    border-radius: 99px; padding: 2px 8px;
    flex-shrink: 0;
}

/* Research row */
.research-row {
    margin: 6px 16px;
    border: 1px solid var(--line); border-radius: 12px;
    background: var(--sunken);
    overflow: hidden;
    animation: rowIn 240ms var(--ease) both;
}
.research-row summary {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 13px; min-height: 44px;
    cursor: pointer; list-style: none;
    font-family: var(--mono); font-size: 10.5px; font-weight: 600;
    letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-500);
    user-select: none;
}
.research-row summary::-webkit-details-marker { display: none; }
.research-row summary svg { width: 13px; height: 13px; }
.research-row .chev { margin-left: auto; transition: transform 160ms var(--ease); }
.research-row[open] .chev { transform: rotate(180deg); }
.research-body { padding: 0 13px 12px; font-size: 12.5px; color: var(--ink-700); border-top: 1px solid var(--line-soft); padding-top: 10px; }

/* Divider row (synthesis marker in transcript) */
.t-divider {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px 4px;
    font-family: var(--mono); font-size: 9.5px; font-weight: 600;
    letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-400);
}
.t-divider::before, .t-divider::after { content: ''; flex: 1; height: 1px; background: var(--line-soft); }

/* ----- Screen 4 · Synthesis ----- */

.synth-cols { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.synth-main { flex: 1 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.synth-aside { flex: 1 1 300px; max-width: 400px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
body.narrow .synth-aside { max-width: none; }

.synth-content { font-size: 13.5px; line-height: 1.6; color: var(--ink-700); }
.synth-content h2 {
    font-size: 14.5px; font-weight: 600; color: var(--ink-900);
    margin: 16px 0 6px; letter-spacing: -0.01em;
}
.synth-content h2:first-child { margin-top: 0; }
.synth-content h3 { font-size: 13.5px; font-weight: 600; color: var(--ink-700); margin: 12px 0 4px; }
.synth-content ul, .synth-content ol { margin: 6px 0; padding-left: 20px; }
.synth-content ul { list-style: disc; }
.synth-content ol { list-style: decimal; }
.synth-content li { margin: 4px 0; }
.synth-content strong { color: var(--ink-900); }
.synth-content p { margin: 6px 0; }

.member-vote-row {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line-soft);
    font-size: 13px;
}
.member-vote-row:last-child { border-bottom: none; }
.member-vote-row img { width: 26px; height: 26px; border-radius: 99px; object-fit: cover; }

/* ----- Screen 5 · Members ----- */

.members-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
    gap: 14px;
}
.member-card {
    display: flex; flex-direction: column; gap: 13px;
    border-left: 2px solid transparent;
    padding: 18px;
}
.member-card.seated { border-left-color: var(--brand); }
.member-card-head { display: flex; gap: 12px; align-items: center; }
.member-card-head img { width: 52px; height: 52px; border-radius: 99px; object-fit: cover; transition: opacity 240ms var(--ease); }
.member-card:not(.seated) .member-card-head img { opacity: 0.4; }
.member-name { font-size: 15px; font-weight: 600; line-height: 1.25; }
.member-title { font-size: 12px; color: var(--ink-500); }
.member-role { font-size: 12.5px; color: var(--ink-700); line-height: 1.5; }
.member-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.member-tags .chip { font-size: 11px; padding: 4px 10px; }
.member-foot {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    border-top: 1px solid var(--line-soft); padding-top: 12px; margin-top: auto;
}
.member-voice { font-family: var(--mono); font-size: 10.5px; color: var(--ink-400); }
.seat-toggle {
    border-radius: 99px; padding: 6px 16px; min-height: 34px;
    font-size: 12px; font-weight: 600;
    border: 1px solid var(--line); background: transparent; color: var(--ink-700);
    transition: background 160ms var(--ease);
}
.seat-toggle.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

/* ----- Screen 6 · Who you are ----- */

.persona-cols { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.persona-main { flex: 1 1 460px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.persona-aside { flex: 1 1 300px; max-width: 380px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
body.narrow .persona-aside { max-width: none; }

.profile-switch { display: flex; flex-wrap: wrap; gap: 8px; }
.profile-card {
    display: flex; align-items: center; gap: 9px;
    border: 1px solid var(--line); background: var(--surface);
    border-radius: 12px; padding: 9px 14px 9px 9px; min-height: 48px;
    font-size: 12.5px; font-weight: 500; color: var(--ink-700);
    text-align: left;
    transition: background 160ms var(--ease), border-color 160ms var(--ease);
}
.profile-card.selected { background: var(--brand-tint); border-color: var(--brand); color: var(--brand); }
.profile-card.dashed { border-style: dashed; color: var(--ink-500); }

.field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label {
    font-family: var(--mono); font-size: 10px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-400);
}
.field input, .field textarea {
    border: none; border-bottom: 1px solid var(--line);
    background: transparent; outline: none;
    font-size: 13.5px; padding: 6px 0;
    resize: none;
    color: var(--ink-900);
}
.field input:focus, .field textarea:focus { border-bottom-color: var(--brand); }

.learned-list { display: flex; flex-direction: column; gap: 10px; }
.learned-item { display: flex; gap: 9px; font-size: 12.5px; color: var(--ink-700); line-height: 1.55; }
.learned-item::before {
    content: ''; width: 5px; height: 5px; border-radius: 99px;
    background: var(--brand); flex-shrink: 0; margin-top: 7px;
}

/* ----- Screen 7 · Past sessions ----- */

.session-rows { display: flex; flex-direction: column; }
.session-row {
    display: flex; gap: 14px; align-items: center;
    width: 100%; text-align: left;
    background: transparent; border: none;
    border-bottom: 1px solid var(--line-soft);
    padding: 14px 6px;
    transition: background 160ms var(--ease);
    border-radius: 8px;
    min-height: 56px;
}
.session-row:last-child { border-bottom: none; }
.session-row:hover { background: var(--sunken); }
.sr-date { width: 52px; flex-shrink: 0; font-family: var(--mono); font-size: 10.5px; color: var(--ink-400); line-height: 1.4; }
.sr-body { min-width: 0; flex: 1; }
.sr-q { font-size: 14px; font-weight: 500; color: var(--ink-900); line-height: 1.4; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sr-meta { font-family: var(--mono); font-size: 10px; color: var(--ink-400); margin-top: 3px; }
.sr-chip { flex-shrink: 0; }

/* ----- Screen 8 · Voice & settings ----- */

.cast-row {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line-soft);
}
.cast-row:last-child { border-bottom: none; }
.cast-row img { width: 30px; height: 30px; border-radius: 99px; object-fit: cover; }
.cast-name { font-size: 13px; font-weight: 500; flex: 1; min-width: 0; }
.cast-voice {
    font-family: var(--mono); font-size: 10.5px; color: var(--ink-500);
    border: 1px solid var(--line); border-radius: 99px; padding: 4px 11px;
}
.cast-preview {
    background: none; border: none; color: var(--brand);
    font-size: 12px; font-weight: 600; padding: 8px;
}

.toggle-row {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line-soft);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-text { flex: 1; min-width: 0; }
.toggle-label { font-size: 13.5px; font-weight: 500; }
.toggle-hint { font-size: 12px; color: var(--ink-500); margin-top: 1px; }

.theme-previews { display: flex; gap: 12px; flex-wrap: wrap; }
.theme-preview {
    flex: 1 1 140px; max-width: 200px;
    border: 2px solid var(--line); border-radius: 12px;
    padding: 12px;
    display: flex; flex-direction: column; gap: 6px;
    transition: border-color 160ms var(--ease);
}
.theme-preview.selected { border-color: var(--brand); }
.theme-preview .sw-name { font-size: 12px; font-weight: 600; }
.tp-light { background: #FBFAF7; }
.tp-light .sw-name { color: #141210; }
.tp-dark { background: #131110; }
.tp-dark .sw-name { color: #F6F2EB; }
.tp-line { height: 6px; border-radius: 3px; }
.tp-light .tp-line { background: #E1DACD; }
.tp-dark .tp-line { background: #302B24; }
.tp-line.accent { width: 40%; }
.tp-light .tp-line.accent { background: #96601A; }
.tp-dark .tp-line.accent { background: #E0A44A; }

/* Segmented control (Voice / Text) */
.seg-track {
    display: inline-flex; gap: 2px;
    background: var(--sunken);
    border: 1px solid var(--line);
    border-radius: 9px; padding: 3px;
}
.seg-opt {
    border: none; background: transparent; cursor: pointer;
    border-radius: 7px; padding: 6px 15px; min-height: 34px;
    font-size: 12px; font-weight: 600; color: var(--ink-500);
    transition: background 160ms var(--ease), color 160ms var(--ease);
}
.seg-opt:hover { color: var(--ink-900); }
/* Selected reads unmistakably as the active mode (brass). */
.seg-opt.selected { background: var(--brand); color: var(--brand-ink); box-shadow: var(--shadow-sm); }

/* Meeting-on-hold banner */
.hold-banner {
    display: flex; align-items: center; gap: 10px;
    background: var(--brand-tint);
    border: 1px solid var(--brand);
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 13px; color: var(--ink-900);
}
.hold-dot {
    width: 8px; height: 8px; border-radius: 99px; flex-shrink: 0;
    background: var(--brand);
    animation: holdpulse 1.6s ease-in-out infinite;
}
@keyframes holdpulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* Typing / status line */
.status-line {
    display: flex; align-items: center; gap: 9px;
    padding: 8px 16px;
    font-size: 12px; color: var(--ink-500);
}
.status-dots { display: flex; gap: 3px; }
.status-dots span {
    width: 5px; height: 5px; border-radius: 99px; background: var(--ink-400);
    animation: statusdot 1.2s ease-in-out infinite;
}
.status-dots span:nth-child(2) { animation-delay: 0.15s; }
.status-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes statusdot { 0%, 60%, 100% { opacity: 0.35; } 30% { opacity: 1; } }

/* Empty states */
.empty-note {
    padding: 28px 20px; text-align: center;
    color: var(--ink-500); font-size: 13px;
    display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.empty-note svg { width: 26px; height: 26px; color: var(--ink-400); }

/* ----- Reduced motion ----- */

@media (prefers-reduced-motion: reduce) {
    .waveform span, .seat.speaking .seat-ring, .status-dots span { animation: none !important; }
    .seat.speaking .seat-ring { opacity: 0.5; transform: none; }
    .t-row, .toast, .research-row { animation: none !important; }
    * { transition-duration: 0.01ms !important; }
}

/* ----- Live error / resume card (stream failure) ----- */
.t-error-card {
    display: flex; flex-direction: column; gap: 12px;
    padding: 16px 18px; margin: 12px 0;
    border: 1px solid var(--line); border-left: 4px solid var(--bad);
    border-radius: 10px; background: var(--surface);
}
.t-error-msg { font-size: 14px; color: var(--ink-700); line-height: 1.5; }
.btn.small { min-height: 40px; padding: 8px 16px; font-size: 13px; align-self: flex-start; }

/* ----- Touch targets: >=44px hit area on mobile ----- */
@media (max-width: 819px) {
    .seg-opt, .seg-pill, .voice-switch, .t-play, .voice-play,
    .composer-mic, .composer-send, .composer-attach {
        min-height: 44px; min-width: 44px;
    }
    #pwa-install-btn { bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important; }
}
