:root {
  /* Neutral working canvas — charcoal / near-black ONLY (Constitution §9). */
  --bg: #0F0F0F;          /* primary canvas (brand surface-canvas) */
  --surface: #1C1C1C;     /* raised panels (brand surface-raised) */
  --surface-2: #282828;   /* overlays, rows, controls (brand surface-overlay) */
  --border: #2E2E2E;      /* neutral hairline */
  --border-strong: #3D3D3D;

  --text: #E6E4DA;        /* brand ivory */
  --text-muted: #B4B2A9;  /* stepped-down ivory */
  --text-dim: #7C7B74;    /* least emphasis */
  --text-inverse: #010101;/* on light accent fills */

  /* Semantic accents — text/border/small fills, never large working fields. */
  --nav: #F2EE70;         /* YELLOW: navigation, orientation, attention, focus */
  --attention: #F2EE70;
  --action: #23B397;      /* GREEN: the one dominant positive action */
  --ok: #26C0A2;          /* healthy / success state */
  --success: #26C0A2;
  --danger: #FF4848;      /* genuine failure / destructive ONLY */
  --warn: #FF9B73;        /* peach caution accent */
  --identity: #FF8080;    /* coral brand-identity accent (never a state) */
  --provisional: #FF9B73; /* imported provisional data marker */

  /* The ONE transient brand-moment field (sign-in gate), per semantic.json. */
  --brand-field: #0A332B;

  --radius: 8px;
  --radius-ctl: 6px;
  --gap: 12px;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  --focus-ring: 2px solid var(--nav);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 14.5px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--nav); text-underline-offset: 2px; }
a:focus-visible { outline: var(--focus-ring); outline-offset: 2px; border-radius: 3px; }

h1, h2, h3 { font-weight: 650; letter-spacing: -0.01em; }

.app-root { min-height: 100vh; display: flex; flex-direction: column; }

/* Every interactive control shares the same yellow focus treatment. */
button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, [tabindex]:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 1px;
}

/* ── App shell ───────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}
/* The product identity doubles as the Home entry point (a real button). */
.brand {
  display: flex; align-items: center; gap: 10px;
  font: inherit; font-weight: 650; letter-spacing: 0.01em;
  background: none; border: none; color: var(--text);
  padding: 4px 6px; margin-left: -6px; cursor: pointer; border-radius: var(--radius-ctl);
}
.brand:hover { background: var(--surface-2); }
.brand img.brand-icon { width: 26px; height: 26px; display: block; }
.brand .brand-sub { color: var(--text-dim); font-weight: 400; }

.nav { display: flex; gap: 2px; margin-left: 10px; }
.nav button {
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 8px 12px 7px;
  cursor: pointer;
  font: inherit;
}
.nav button:hover { color: var(--text); }
/* Active navigation carries the YELLOW orientation accent — text + underline,
   never a fill. */
.nav button.active { color: var(--nav); border-bottom-color: var(--nav); }
.spacer { flex: 1; }

.userchip { display: flex; align-items: center; gap: 10px; }
.userchip .userchip-name {
  background: none; border: none; color: var(--text-muted); font: inherit;
  cursor: pointer; padding: 4px 2px; border-radius: 4px;
}
.userchip .userchip-name:hover { color: var(--text); }

.content { padding: 26px 22px 60px; max-width: 1080px; margin: 0 auto; width: 100%; }

.page-head { display: flex; align-items: baseline; gap: 12px; margin: 0 0 6px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 19px; }
.page-count { color: var(--text-dim); font-size: 13px; }
.page-sub { color: var(--text-muted); margin: 0 0 18px; font-size: 13.5px; }

/* ── Avatars ─────────────────────────────────────────────────────────────── */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--text-muted);
  flex: 0 0 auto;
  user-select: none;
}
.avatar.lg { width: 72px; height: 72px; font-size: 24px; }
.avatar.sm { width: 26px; height: 26px; font-size: 10px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Overlapping member stacks (groups, privilege holders). */
.avatar-stack { display: inline-flex; align-items: center; }
.avatar-stack .avatar { margin-left: -8px; box-shadow: 0 0 0 2px var(--surface); }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* ── Cards / panels ──────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}
.card h2 { margin: 0 0 12px; font-size: 16px; }
.card.clickable { cursor: pointer; transition: border-color 120ms ease; }
.card.clickable:hover { border-color: var(--border-strong); }
.card.clickable:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }
.card.dimmed { opacity: 0.62; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.card-grid .card { margin-bottom: 0; }

.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack.tight { gap: 4px; }
.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); font-size: 13px; }

.section-title {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-dim); margin: 22px 0 8px; font-weight: 600;
}
.section-title:first-child { margin-top: 0; }

/* Key/value definition rows (detail views). */
.kv { display: grid; grid-template-columns: minmax(120px, 170px) 1fr; gap: 4px 14px; font-size: 13.5px; }
.kv dt { color: var(--text-dim); margin: 0; }
.kv dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
input, select, textarea {
  width: 100%;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-ctl);
  padding: 8px 10px;
  font: inherit;
}
input::placeholder, textarea::placeholder { color: var(--text-dim); }
/* Browser autofill paints its own pale field background; repaint it with the
   normal neutral input treatment (inset box-shadow is the only reliable
   override) while keeping the browser's autofill behavior itself intact. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--surface-2) inset;
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  transition: background-color 9999s ease-out 0s;
}
input:autofill {
  box-shadow: 0 0 0 1000px var(--surface-2) inset;
}
.field { margin-bottom: 12px; }
.field .hint { color: var(--text-dim); font-size: 12.5px; margin-top: 4px; }

/* Checkbox / selectable option rows (privileges, roles, member pickers). */
.check-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-ctl);
  cursor: pointer; border: 1px solid transparent;
}
.check-row:hover { background: var(--surface-2); }
.check-row input[type="checkbox"] {
  width: 16px; height: 16px; margin: 2px 0 0; flex: 0 0 auto;
  accent-color: var(--action);
}
.check-row .check-label { color: var(--text); }
.check-row .check-sub { color: var(--text-dim); font-size: 12.5px; display: block; }
.check-row.disabled { opacity: 0.55; cursor: default; }
.check-row input[type="radio"] { width: 16px; height: 16px; margin: 2px 0 0; flex: 0 0 auto; accent-color: var(--action); }

/* Audio Processing — media selector, roles, summary, submissions. */
.audio-crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin: 6px 0 8px; font-size: 13px; }
.audio-crumb { background: transparent; border: none; color: var(--text-muted); padding: 2px 4px; cursor: pointer; font: inherit; font-size: 13px; }
.audio-crumb:hover { color: var(--text); text-decoration: underline; }
.audio-crumb.current { color: var(--text); cursor: default; font-weight: 550; }
.audio-crumb-sep { color: var(--text-dim); }
/* The file/folder viewport scrolls INSIDE the card (≈10 rows); chips + breadcrumb stay above it. */
.list.audio-list { max-height: 480px; overflow-y: auto; overscroll-behavior: contain; }
.audio-index-note { color: var(--text-dim); font-size: 12.5px; margin: 0 0 6px; }
.audio-row { cursor: pointer; }
.audio-row.folder .audio-icon { color: var(--nav); width: 16px; display: inline-block; text-align: center; margin-right: 6px; }
.audio-row.file input[type="checkbox"] { width: 16px; height: 16px; margin: 3px 10px 0 0; flex: 0 0 auto; accent-color: var(--action); }
.audio-row.disabled { opacity: 0.5; cursor: default; }
.audio-row.archive { opacity: 0.6; }
.audio-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; min-height: 30px; }
.audio-chips-empty { color: var(--text-dim); font-size: 13px; }
.audio-row .row-main { display: flex; flex-direction: column; }
.audio-row .row-sub { display: block; }
.audio-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text); border-radius: 999px; padding: 4px 10px; font: inherit; font-size: 13px; cursor: pointer; }
.audio-chip:hover { border-color: var(--danger); }
.audio-chip-x { color: var(--text-dim); }
.audio-roles { margin: 8px 0 4px; }
.audio-role-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.audio-role-row:last-child { border-bottom: none; }
.audio-role-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audio-role-row select { flex: 0 0 260px; width: 260px; max-width: 50%; }
.audio-summary { display: grid; gap: 4px; margin-bottom: 12px; }
.audio-summary-line { color: var(--text); font-size: 14px; }
.audio-summary-line:first-child { font-weight: 600; font-size: 15px; }
.audio-sub { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; background: var(--surface); }
.audio-sub.done { border-color: var(--ok); }
.audio-sub.attention { border-color: var(--danger); }
.audio-sub-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.audio-sub-title { display: flex; flex-direction: column; }
.audio-sub-line { margin-top: 6px; }
.audio-sync { margin-top: 8px; padding: 8px 10px; background: var(--surface-2); border-radius: var(--radius-ctl); font-size: 13px; display: grid; gap: 2px; }
.actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }

/* Segmented filter (status scopes). */
.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-ctl); overflow: hidden; }
.segmented button {
  background: transparent; color: var(--text-muted); border: none;
  padding: 7px 12px; cursor: pointer; font: inherit; font-size: 13px;
}
.segmented button + button { border-left: 1px solid var(--border); }
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--surface-2); color: var(--text); }

/* ── Buttons — one dominant action per view ─────────────────────────────── */
button { font: inherit; border-radius: var(--radius-ctl); cursor: pointer; }
.btn {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
  padding: 8px 14px;
}
.btn:hover { border-color: var(--text-dim); }
.btn:disabled { opacity: 0.5; cursor: default; }
/* The ONE dominant positive action: a solid green fill with inverse text
   (brand action-primary; near-black on this green is 9.09:1). */
.btn.primary {
  background: var(--action);
  border-color: var(--action);
  color: var(--text-inverse);
  font-weight: 600;
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.primary:disabled { filter: none; }
/* Destructive: quiet until hovered — red always means real consequence. */
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: rgba(255, 72, 72, 0.12); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.linklike {
  background: transparent; border-color: transparent; color: var(--nav);
  padding: 4px 0; text-decoration: underline; text-underline-offset: 2px;
}
.btn.linklike:hover { color: var(--text); }
.secondary-link { margin: 8px 0; }

/* ── Lists / tables ──────────────────────────────────────────────────────── */
.controls { display: flex; gap: 10px; margin: 14px 0 14px; flex-wrap: wrap; align-items: center; }
.controls > * { flex: 0 0 auto; }
.controls .grow { flex: 1 1 220px; }
.controls input[type="search"] { max-width: 340px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--text-dim); font-weight: 500; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.05em; }

/* Person rows: a bordered list, avatar-first, whole row is the door. */
.list { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; cursor: pointer; width: 100%;
  background: transparent; border: none; border-bottom: 1px solid var(--border);
  color: var(--text); text-align: left; font: inherit; border-radius: 0;
}
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: var(--surface-2); }
.list-row:focus-visible { outline: var(--focus-ring); outline-offset: -2px; }
.list-row .row-main { flex: 1 1 auto; min-width: 0; }
.list-row .row-name { font-weight: 550; }
.list-row .row-sub { color: var(--text-dim); font-size: 12.5px; }
.list-row .row-side { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

/* ── Status pills / chips — shape + text, never color alone ─────────────── */
.pill {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 10px;
  font-size: 12px;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  white-space: nowrap;
}
.pill.active { color: var(--ok); border-color: var(--ok); }
.pill.inactive { color: var(--text-dim); }
.pill.archived { color: var(--text-dim); border-style: dashed; }
.pill.warn { color: var(--warn); border-color: var(--warn); }
.pill.synced { color: var(--ok); border-color: var(--ok); }
.pill.pending { color: var(--warn); border-color: var(--warn); }
.pill.attention { color: var(--danger); border-color: var(--danger); }

/* ---- Relay Status (read-only rollout monitor) ---- */
.rs-meta { margin: 2px 0 10px; }
.rs-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; margin: 6px 0 14px; }
.rs-stat { padding: 12px 14px; }
.rs-stat-n { font-size: 1.5rem; font-weight: 650; line-height: 1.1; }
.rs-stat-l { margin-top: 2px; font-size: 0.8rem; }
.rs-stat.synced .rs-stat-n { color: var(--ok, inherit); }
.rs-stat.attention .rs-stat-n { color: var(--danger); }
.rs-filters { margin: 0 0 12px; }
.rs-table-wrap { overflow-x: auto; }
.rs-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.rs-table th { text-align: left; font-weight: 600; font-size: 0.75rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted, inherit); padding: 6px 10px 8px; border-bottom: 1px solid var(--border-strong); }
.rs-table td { padding: 9px 10px; border-bottom: 1px solid var(--border, var(--border-strong)); vertical-align: top; }
.rs-cell { display: inline-flex; flex-direction: column; gap: 3px; }
.rs-sub { font-size: 0.78rem; }
.rs-table td:first-child .pill { margin-top: 4px; align-self: flex-start; }
.rs-holds { margin-top: 12px; }

.tag { display: inline-block; padding: 1px 8px; border: 1px solid var(--border-strong);
       border-radius: 4px; font-size: 12px; margin: 2px 4px 0 0; color: var(--text-muted); }

/* Removable membership chips (person + groups). */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border-strong); border-radius: 14px;
  padding: 2px 6px 2px 10px; font-size: 12.5px; color: var(--text);
  margin: 2px 6px 4px 0; background: var(--surface-2);
}
.chip-x {
  background: none; border: none; color: var(--text-dim); cursor: pointer;
  padding: 0 4px; font-size: 13px; line-height: 1; border-radius: 8px;
}
.chip-x:hover { color: var(--danger); }

/* Provisional / not-recorded compensation markers. */
.provisional {
  color: var(--provisional);
  border: 1px dashed var(--provisional);
  border-radius: 4px;
  padding: 0 6px;
  font-size: 12px;
}
.not-recorded { color: var(--text-dim); font-style: italic; }

/* ── Drawer (detail layer) ──────────────────────────────────────────────── */
.drawer-scrim {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex; justify-content: flex-end;
  z-index: 10;
}
.drawer {
  width: min(620px, 100%);
  height: 100%;
  overflow-y: auto;
  background: var(--surface);
  border-left: 1px solid var(--border-strong);
  padding: 22px 24px 40px;
  box-shadow: var(--shadow);
}
.drawer h2 { margin-top: 0; }
.drawer .close { float: right; }

/* ── Dialogs (confirmations, code entry) ────────────────────────────────── */
.dialog-scrim {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 20; padding: 20px;
}
.dialog {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  width: min(440px, 100%);
}
.dialog h3 { margin: 0 0 8px; font-size: 16px; }
.dialog .dialog-body { color: var(--text-muted); font-size: 13.5px; margin-bottom: 14px; }
.dialog .dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.dialog input.code {
  font-size: 20px; letter-spacing: 0.35em; text-align: center; font-variant-numeric: tabular-nums;
}

/* ── Messages — quiet success, loud exception ───────────────────────────── */
.msg { padding: 10px 12px; border-radius: var(--radius-ctl); margin: 10px 0; border: 1px solid var(--border); font-size: 13.5px; }
.msg.ok { color: var(--ok); border-color: var(--ok); }
.msg.err { color: var(--danger); border-color: var(--danger); }
.msg.info { color: var(--text-muted); }
.warn { color: var(--warn); font-size: 13px; }

/* ── Empty / loading states ─────────────────────────────────────────────── */
.empty {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 28px 22px;
  text-align: center;
  color: var(--text-muted);
}
.empty .empty-title { color: var(--text); font-weight: 600; margin-bottom: 4px; }
.empty .empty-hint { font-size: 13px; color: var(--text-dim); margin-bottom: 14px; }

.loading { color: var(--text-dim); font-size: 13px; padding: 12px 2px; }

/* Advanced / on-demand detail (collapsed by default; depth on demand). */
details.advanced { margin: 10px 0; }
details.advanced summary {
  cursor: pointer; color: var(--text-dim); font-size: 13px;
  list-style: none; padding: 4px 0;
}
details.advanced summary::-webkit-details-marker { display: none; }
details.advanced summary::before { content: "\25B8\00A0"; }
details.advanced[open] summary::before { content: "\25BE\00A0"; }
details.advanced summary:hover { color: var(--text); }
details.advanced .advanced-body { padding: 8px 0 2px; }

/* ── Sign-in gate — the ONE transient deep-green brand moment ───────────── */
.gate {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 24px;
  /* The canonical brand deep-green as the PRIMARY sign-in background — an
     explicit James design ruling (2026-08-11 follow-up), sanctioned by
     semantic.json surface-brand as the transient brand-moment surface. The
     operational Portal canvas stays neutral (§9); this field never extends
     past the gate. The form card itself stays dark neutral (var(--surface)). */
  background: var(--brand-field);
}
/* The approved full-color primary (wide) logo carries the brand alone above
   the form. ONE integrated composition directly on the deep-green canvas —
   no card, panel, shadow, gradient, or glass container (James ruling,
   2026-08-11). The logo stays proportionate to the form column. */
.gate-brand { display: flex; justify-content: center; margin-bottom: 30px; }
.gate-brand img.gate-logo { width: min(250px, 66vw); height: auto; display: block; }
.gate-form { width: min(340px, 100%); }
.gate-form h2 { margin: 0 0 14px; font-size: 17px; }
.gate-form .btn.primary { width: 100%; margin-top: 4px; }
.gate-secondary { text-align: center; margin-top: 14px; }

.center-narrow { max-width: 380px; margin: 8vh auto 0; }

/* ── Home — the temporary authenticated landing ─────────────────────────── */
.home {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; gap: 6px;
  margin: 16vh auto 0; max-width: 560px;
}
.home .avatar.lg { margin-bottom: 12px; }
.home .home-title { font-size: 24px; margin: 0; }
.home .home-line { margin: 2px 0; }
/* The tool launcher: three large product cards. */
.home { max-width: 1040px; margin-top: 10vh; }
.home-cards {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px;
  width: 100%; margin-top: 22px; text-align: left;
}
@media (max-width: 860px) { .home-cards { grid-template-columns: 1fr; } }
.home-card {
  display: flex; flex-direction: column; gap: 10px; min-height: 200px;
  padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.home-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.home-card-title { margin: 0; font-size: 17px; }
.home-card-desc { margin: 0; flex: 1; color: var(--muted); line-height: 1.45; }
.home-card .btn { align-self: flex-start; }
.home-card-action { padding: 10px 16px; font-size: 14px; }
.home-card.disabled { opacity: 0.55; }
.home-card.disabled .btn { cursor: not-allowed; }
.badge-soon {
  font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap;
  padding: 3px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted);
}
.audio-help { margin: -4px 0 12px; }

/* ── Audio Processing: two-column desktop layout INSIDE the existing .content width ────────────
   Left ≈ 2/3 = the workflow cards; right = the queue/history rail (~330px). Nothing here changes
   .content or any global width — the grid only divides the space the page already has. */
.audio-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.audio-main { min-width: 0; }
.audio-rail { min-width: 0; position: sticky; top: 74px; max-height: calc(100vh - 90px); display: flex; flex-direction: column; }
.audio-rail > .card { margin-bottom: 0; display: flex; flex-direction: column; min-height: 0; max-height: 100%; padding: 14px; }
.audio-rail-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; flex: 0 0 auto; }
.audio-rail-head h2 { margin: 0; }
.audio-rail-head .segmented button { padding: 3px 9px; font-size: 12.5px; }
.audio-rail-note { color: var(--text-dim); font-size: 12.5px; margin: 0 0 8px; flex: 0 0 auto; }
.audio-rail-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-right: 2px; }
.audio-q-group { color: var(--text-dim); font-size: 11.5px; letter-spacing: 0.04em; text-transform: uppercase; margin: 10px 0 6px; }
.audio-q-group:first-child { margin-top: 0; }
.audio-q-item { border: 1px solid var(--border); border-radius: var(--radius-ctl); padding: 8px 10px; margin-bottom: 8px; background: var(--surface); }
.audio-q-item.active { border-color: var(--border-strong); }
.audio-q-item.done { border-color: var(--ok); }
.audio-q-item.attention { border-color: var(--danger); }
.audio-q-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; cursor: pointer; background: none; border: none; padding: 0; width: 100%; text-align: left; font: inherit; color: inherit; }
.audio-q-head:focus-visible { outline: var(--focus-ring); outline-offset: 2px; border-radius: 4px; }
.audio-q-titles { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.audio-q-title { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audio-q-meta { color: var(--text-muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audio-q-producer { color: var(--text); font-size: 12.5px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audio-q-state { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: 0 0 auto; }
.audio-q-state .pill { white-space: nowrap; }
.audio-q-when { color: var(--text-dim); font-size: 11.5px; white-space: nowrap; }
.audio-q-detail { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 13px; display: grid; gap: 6px; }
.audio-q-detail .audio-sync { margin-top: 0; }
.audio-q-detail .actions { margin-top: 2px; }
.audio-q-files { color: var(--text-muted); word-break: break-word; }
.audio-q-more { display: flex; justify-content: center; padding: 6px 0 2px; }
@media (max-width: 900px) {
  .audio-layout { grid-template-columns: 1fr; }
  .audio-rail { position: static; max-height: none; }
  .audio-rail-body { max-height: 60vh; }
}
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.dialog-alt { margin-top: 10px; text-align: center; }
.dialog-alt .linklike { background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; font: inherit; text-decoration: underline; }

/* ── View As (James-only read-only preview) ─────────────────────────────── */
.viewas-banner {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 10px; padding: 6px 16px;
  background: #3b2d0b; border-bottom: 1px solid #8f6f1c; color: #f3e6bf; font-size: 13px;
}
.viewas-banner-dot { width: 8px; height: 8px; border-radius: 50%; background: #f2c94c; flex: 0 0 auto; }
.viewas-banner-text { font-weight: 600; }
.viewas-banner-sub { color: #cdb977; }
.viewas-banner .btn { margin-left: auto; }
.viewas-float { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.viewas-toggle { box-shadow: 0 8px 24px rgba(0,0,0,0.45); }
.viewas-float.active .viewas-toggle { background: #f2c94c; color: #1a1400; border-color: #f2c94c; }
.viewas-panel {
  width: 340px; max-width: calc(100vw - 32px); max-height: 70vh;
  display: flex; flex-direction: column; gap: 8px; padding: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 16px 40px rgba(0,0,0,0.5);
}
.viewas-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.viewas-list { overflow-y: auto; max-height: 46vh; display: flex; flex-direction: column; gap: 2px; }
.viewas-row {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px; text-align: left;
  padding: 8px 10px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: inherit; cursor: pointer; font: inherit;
}
.viewas-row:hover { background: var(--surface-2); }
.viewas-row.current { border-color: #f2c94c; }
.viewas-row-name { font-weight: 600; }
.viewas-row-sub { font-size: 12px; color: var(--muted); }
.viewas-row-access { font-size: 11px; color: var(--muted); }
.viewas-row-access.on { color: #8fd3a0; }
.viewas-empty { padding: 8px 10px; }
.llcp-toast {
  position: fixed; left: 50%; bottom: 72px; transform: translateX(-50%); z-index: 70;
  padding: 9px 14px; border-radius: 8px; font-size: 13px;
  background: #222; color: #fff; border: 1px solid var(--border); box-shadow: 0 8px 24px rgba(0,0,0,0.45);
}

/* ── Set-password / forgot-password pages (shared auth-page shell) ──────── */
.reset-wrap {
  max-width: 380px; margin: 10vh auto 0; padding: 22px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.reset-wrap h1 { font-size: 18px; margin: 0 0 10px; }
.reset-wrap p { color: var(--text-muted); font-size: 13.5px; }
.reset-wrap label { margin-top: 10px; }
.reset-wrap button[type="submit"] {
  background: var(--action); border: 1px solid var(--action); color: var(--text-inverse);
  font-weight: 600; padding: 8px 14px; margin-top: 12px;
}
.reset-wrap button[type="submit"]:hover { filter: brightness(1.08); }
.reset-msg { margin-top: 12px; font-size: 13.5px; }
.reset-error { color: var(--danger); }
.reset-info { color: var(--text-muted); }
.reset-link { display: inline-block; margin-top: 12px; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .content { padding: 18px 14px 60px; }
  .topbar { padding: 8px 12px; flex-wrap: wrap; }
  .nav { margin-left: 0; }
  .kv { grid-template-columns: 1fr; gap: 0 0; }
  .kv dt { margin-top: 8px; }
  .drawer { width: 100%; }
}

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