/* LEX HERALD v14.0 — Internal Engine Seal & Dynamic Statutory Architecture */
:root {
  --bg: #0A0C10;
  --elevated: #11151E;
  --elevated-2: #171C28;
  --ink: #E8EAED;
  --muted: #8B93A7;
  --line: rgba(255, 255, 255, 0.08);
  --gold: #D4AF37;
  --gold-2: #E5C158;
  --gold-dim: rgba(212, 175, 55, 0.16);
  --gold-glass: rgba(212, 175, 55, 0.12);
  --gold-glass-border: rgba(212, 175, 55, 0.42);
  --champagne: #F3E3A8;
  --danger: #C45C5C;
  --ok: #6FBF8A;
  --obsidian: var(--bg);
  --obsidian-2: var(--elevated);
  --obsidian-3: var(--elevated-2);
  --panel: var(--elevated);
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "Helvetica Neue", sans-serif;
  --serif: "Times New Roman", Times, Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --composer-h: 72px;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
/* Phase 11.1 — viewport-locked flex shell: header / scroll workspace / docked composer */
body.app-shell {
  height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: 0;
  position: relative;
  padding-bottom: 0;
}
body.app-shell > .topbar {
  flex: 0 0 auto;
  z-index: 20;
}
body.app-shell > .app-workspace {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}
body.app-shell > .composer-dock {
  flex: 0 0 auto;
  z-index: 30;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 480px at 12% -8%, rgba(212,175,55,0.08), transparent 55%),
    radial-gradient(700px 400px at 88% 0%, rgba(80,100,160,0.07), transparent 50%),
    linear-gradient(180deg, #0B0D11 0%, #0E1118 100%);
}

/* ── Top bar — v17.5: wraps cleanly on narrow / split-screen ── */
.topbar {
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
  overflow: visible;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 16px;
  min-height: 52px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 13, 17, 0.82);
  backdrop-filter: blur(18px) saturate(1.2);
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}
.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  flex: 0 1 auto;
  min-width: 0;
}
.brand {
  display: flex;
  gap: .55rem;
  align-items: center;
  flex-shrink: 0;
  white-space: nowrap;
}
.brand-mark {
  width: 2rem; height: 2rem;
  border-radius: 8px;
  border: 1px solid rgba(212,175,55,0.45);
  color: var(--gold-2);
  display: grid; place-items: center;
  font-weight: 700;
  font-size: .78rem;
  letter-spacing: .04em;
  background: var(--gold-dim);
}
.brand h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: .04em;
  color: var(--ink);
}
.brand p { display: none; }

.case-switcher,
#caseSwitcher,
#matterSelect {
  min-width: 120px;
  max-width: 240px;
  flex: 0 1 240px;
  background: var(--elevated);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 10px;
  padding: .4rem .55rem;
  font-family: var(--sans);
  font-size: .8rem;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
@media (max-width: 1050px) {
  .case-switcher { max-width: 190px; }
  .mode-switch-btn { padding: .35rem .65rem; font-size: .78rem; }
  .brand h1 { font-size: .92rem; }
  .btn.compact-lbl { padding: .35rem .5rem; }
}

.mode-switch, .capsule-nav {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  background: #11151E;
  border: 1px solid rgba(212,175,55,0.28);
  gap: 2px;
  flex: 0 0 auto;
}
.mode-switch-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: .4rem .85rem;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: .8rem;
  font-weight: 560;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
/* Champagne glass — NOT solid quest gold */
.mode-switch-btn.active {
  background: var(--gold-glass);
  color: var(--champagne);
  font-weight: 600;
  border: 1px solid var(--gold-glass-border);
  box-shadow: none;
}

.topbar-status {
  font-family: var(--sans);
  font-size: .72rem;
  font-weight: 600;
  color: var(--champagne);
  border: 1px solid var(--gold-glass-border);
  padding: .3rem .65rem;
  border-radius: 999px;
  background: var(--gold-glass);
}
.topbar-status.ready-pill { letter-spacing: .02em; }
.topbar-status.cost[hidden] { display: none !important; }

.btn {
  border: 1px solid var(--line);
  background: var(--elevated-2);
  color: var(--ink);
  padding: .45rem .75rem;
  border-radius: 10px;
  font-family: var(--sans);
  font-size: .82rem;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { border-color: rgba(255,255,255,0.16); }
/* Secondary gold → Champagne Glass (never competes with .quest-cta) */
.btn.gold,
.btn.gold-glass,
.gold-glass {
  background: var(--gold-glass) !important;
  color: var(--champagne) !important;
  border: 1px solid var(--gold-glass-border) !important;
  font-weight: 600;
  box-shadow: none !important;
}
/* SINGLE solid Imperial Gold quest marker */
.btn.quest-cta,
.quest-cta {
  background: linear-gradient(180deg, #E5C158 0%, #D4AF37 100%) !important;
  color: #0A0C10 !important;
  border: 1px solid rgba(212,175,55,0.65) !important;
  font-weight: 700;
  box-shadow: 0 2px 14px rgba(212,175,55,0.32);
}
.btn.ghost { background: transparent; }
.btn.crimson { background: #8b2e2e; color: #f5e6e6; border-color: #c45c5c; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── Simple Mode workspace ── */
.simple-workspace {
  max-width: 920px;
  margin: 0 auto;
  padding: .85rem 1.15rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: .65rem;
}
body[data-ui-mode="advanced"] .simple-workspace { display: none !important; }
body[data-ui-mode="simple"] .advanced-studio { display: none !important; }

.simple-progress-row {
  display: flex;
  align-items: center;
  gap: .55rem;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.simple-stage-bar {
  flex: 1;
  min-width: 260px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-height: 36px;
  height: auto;
  margin-bottom: 10px;
  padding: .3rem .45rem;
  background: var(--elevated);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow-x: visible;
}
.simple-stage-bar .s-step {
  flex: 0 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  border: 1px solid rgba(212,175,55,0.28);
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  font-size: .72rem;
  font-weight: 560;
  white-space: nowrap;
  cursor: pointer;
  padding: 5px 11px;
  border-radius: 999px;
  min-width: 0;
}
.simple-stage-bar .s-step.on { color: var(--gold-2); border-color: rgba(212,175,55,0.45); }
.simple-stage-bar .s-step.current {
  background: var(--gold-glass);
  color: var(--champagne);
  border-color: var(--gold-glass-border);
}
.simple-stage-bar .s-arrow { color: var(--muted); font-size: .65rem; opacity: .5; flex-shrink: 0; display: none; }
.evidence-pill { flex-shrink: 0; }
.simple-readiness {
  font-size: .8rem;
  color: var(--muted);
  margin: -.35rem 0 0;
}

/* Briefing card — compact so quest-cta stays above the fold on 1440×900 */
.briefing-card,
.simple-briefing-card {
  background: var(--elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 20px;
}
.briefing-card h2,
.simple-briefing-card h2 {
  margin: 6px 0;
  font-size: 1.05rem;
  font-weight: 650;
  color: var(--ink);
  line-height: 1.4;
}
.briefing-section { margin-bottom: .7rem; }
.briefing-section:last-child { margin-bottom: 0; }
.briefing-section h3 {
  margin: 6px 0;
  font-size: .88rem;
  font-weight: 620;
  color: var(--gold-2);
  line-height: 1.4;
}
.briefing-section p,
.briefing-section li {
  margin: 6px 0;
  line-height: 1.4;
  color: var(--ink);
  font-size: .9rem;
}
.briefing-section ul,
.briefing-section ol {
  margin: 6px 0;
  padding-left: 1.15rem;
  line-height: 1.4;
}
.path-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .45rem;
}
.path-card {
  background: var(--elevated-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .55rem .65rem;
}
.path-card h4 {
  margin: 0 0 .25rem;
  font-size: .76rem;
  color: var(--gold-2);
  line-height: 1.35;
}
.path-card p {
  margin: 0;
  font-size: .74rem;
  line-height: 1.35;
  color: var(--muted);
}
.briefing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin-top: .55rem;
}
.briefing-actions .btn { padding: .55rem .9rem; font-size: .84rem; }
.next-step-line {
  font-size: .9rem;
  line-height: 1.4;
  margin: 6px 0 !important;
}
.briefing-leverage-mini {
  margin: 6px 0 !important;
  font-size: .8rem !important;
  line-height: 1.35 !important;
  color: var(--muted) !important;
}
.simple-readiness { margin: 0 !important; font-size: .75rem; }

@media (max-width: 1100px) {
  .topbar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
    align-items: flex-start;
  }
  .mode-switch {
    flex: 1 1 auto;
    order: 3;
    min-width: 0;
  }
  .topbar-actions {
    order: 2;
  }
}
@media (max-width: 820px) {
  .path-cards { grid-template-columns: 1fr; }
  .topbar { padding: 8px 10px; }
  .mode-switch { flex-shrink: 1; }
}

/* Letter card — wrapping toolbar, no nested scroll */
.letter-card {
  background: var(--elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 280px;
}
/* Author display:flex must not defeat the HTML hidden attribute (empty black box). */
.letter-card[hidden],
#simpleLetter[hidden],
#studioLetter[hidden],
.live-delib-banner[hidden] {
  display: none !important;
  min-height: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}
.letter-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(19, 23, 32, 0.95);
  position: sticky;
  top: 0;
  z-index: 2;
  flex-shrink: 0;
  overflow-x: visible;
}
.letter-toolbar-label {
  white-space: nowrap;
  font-weight: 600;
  font-size: .84rem;
  color: var(--gold-2);
  flex: 0 1 auto;
}
.letter-toolbar-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  overflow-x: visible;
  flex: 1 1 auto;
}
.letter-toolbar-actions .btn {
  font-size: 12px;
  padding: 5px 10px;
  flex-shrink: 0;
  white-space: nowrap;
}
.letter-hr {
  border: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(212,175,55,0.45), rgba(255,255,255,0.06));
  margin: 18px 0;
}
.letter-body {
  padding: 1.35rem 1.5rem 1.25rem;
  min-height: 240px;
  max-height: none;
  overflow: visible;
  font-size: .95rem;
  line-height: 1.65;
  color: var(--ink);
  position: relative;
}
/* v14.3 — Dark letter mode: crisp light ink; never dark-on-dark */
.letter-body.is-dark,
.letter-card.view-dark .letter-body:not(.is-a4) {
  background: transparent !important;
  color: #E6EAF2 !important;
}
.letter-body.is-dark,
.letter-body.is-dark *,
.letter-card.view-dark .letter-body:not(.is-a4),
.letter-card.view-dark .letter-body:not(.is-a4) * {
  color: #E6EAF2 !important;
}
.letter-body.is-dark .veritas-pill,
.letter-card.view-dark .letter-body:not(.is-a4) .veritas-pill {
  color: #0A0C10 !important;
}
.letter-body.is-dark pre.clean-letter,
.letter-card.view-dark .letter-body:not(.is-a4) pre.clean-letter {
  color: #E6EAF2 !important;
  background: transparent !important;
}
.letter-body.is-collapsed {
  max-height: 520px;
  overflow: hidden;
}
.letter-body.is-collapsed::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 88px;
  background: linear-gradient(180deg, transparent, var(--elevated));
  pointer-events: none;
}
.letter-expand-row {
  display: flex;
  justify-content: center;
  padding: .65rem 1rem 1.1rem;
}
.letter-card.expanded .letter-body {
  max-height: none;
  overflow: visible;
}
.letter-card.expanded .letter-body::after { display: none; }
.letter-body.proof-off .veritas-pill { display: none !important; }
.letter-body.proof-off .veritas-badge {
  background: none !important;
  border: none !important;
  padding: 0 !important;
  color: inherit !important;
  cursor: default;
}
.letter-body pre.clean-letter {
  white-space: pre-wrap;
  font-family: var(--sans);
  font-size: .95rem;
  line-height: 1.65;
  margin: 0;
  color: var(--ink);
}

.simple-chat { display: flex; flex-direction: column; gap: .65rem; }
.simple-chat .bubble {
  background: var(--elevated);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .85rem 1rem;
}
.simple-chat .bubble .meta { display: none; }
.simple-council-report {
  border-color: rgba(212, 175, 55, 0.35) !important;
  background:
    linear-gradient(180deg, rgba(212, 175, 55, 0.08), transparent 48px),
    var(--elevated) !important;
  max-height: none !important;
  overflow: visible !important;
}
.council-report-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 0.65rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid rgba(212, 175, 55, 0.22);
}
.council-report-head h3 {
  margin: 0;
  font-size: 1rem;
  color: #E5C158;
}
.council-report-meta {
  font-size: 0.68rem;
  color: var(--muted);
  white-space: nowrap;
}
.council-report-body {
  max-height: none !important;
  overflow: visible !important;
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.55;
}
.council-report-body h1,
.council-report-body h2,
.council-report-body h3,
.council-report-body h4 {
  color: #F0D778;
  margin: 1rem 0 0.4rem;
}
.council-report-body ul,
.council-report-body ol { padding-left: 1.2rem; }
.council-report-body strong { color: #F6E7A8; }
.hint { color: var(--muted); font-size: .82rem; }

/* Evidence Vault — paste email / text directly */
.drawer-paste {
  margin: 0.75rem 0;
  padding: 0.65rem 0.85rem 0.85rem;
  border: 1px solid rgba(212, 175, 55, 0.28);
  border-radius: 12px;
  background: rgba(19, 23, 32, 0.65);
}
.drawer-paste > summary {
  cursor: pointer;
  font-weight: 600;
  color: #E5C158;
  list-style: none;
}
.drawer-paste > summary::-webkit-details-marker { display: none; }
.drawer-paste label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0.55rem 0;
  font-size: 0.78rem;
  color: var(--muted);
}
.drawer-paste input,
.drawer-paste textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--elevated-2, #131720);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.88rem;
  padding: 0.55rem 0.7rem;
}
.drawer-paste textarea { resize: vertical; min-height: 120px; line-height: 1.45; }
.veritas-pill-mini {
  display: inline-block;
  margin-left: 0.25rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: rgba(212, 175, 55, 0.18);
  color: #C9B36A;
  font-size: 0.68rem;
  font-weight: 600;
  white-space: nowrap;
}
.seat-findings .veritas-badge,
.seat-body .veritas-badge {
  display: inline;
  background: rgba(212, 175, 55, 0.12);
  border-bottom: 1px dotted rgba(212, 175, 55, 0.55);
  cursor: pointer;
}
.seat-findings li { line-height: 1.45; }

/* ── Advanced Studio ── */
body[data-ui-mode="advanced"] > .app-workspace {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.advanced-studio {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.95fr);
  gap: .85rem;
  padding: .85rem 1rem;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  height: 100%;
}
.studio-inspector {
  background: var(--elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}
/* v14.3 — Left pane is a block scroll container; children never flex-squish */
.studio-main {
  background: var(--elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: block !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  min-height: 0 !important;
  height: 100% !important;
  padding: 16px 20px 80px 20px !important;
  box-sizing: border-box !important;
}
.studio-main > * {
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  flex: none !important;
  margin-bottom: 16px !important;
}
.studio-main > .studio-main-head {
  margin-bottom: 12px !important;
  overflow: visible !important;
}
.studio-main > .progress-feed:empty,
.studio-main > .revise-box[hidden],
.studio-main > [hidden] {
  margin-bottom: 0 !important;
}
.studio-main-head, .studio-inspector-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.studio-main-head h2, .studio-inspector-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 620;
}
.sub { margin: .15rem 0 0; font-size: .75rem; color: var(--muted); }

.power-bar {
  display: flex;
  align-items: center;
  gap: .3rem;
  flex-wrap: wrap;
}
.bar-label { font-size: .68rem; color: var(--muted); margin-right: .2rem; }
.tier-btn {
  border: 1px solid var(--line);
  background: var(--elevated-2);
  color: var(--muted);
  border-radius: 8px;
  padding: .35rem .55rem;
  font-size: .72rem;
  cursor: pointer;
  font-family: var(--sans);
}
.tier-btn.active {
  border-color: rgba(212,175,55,0.55);
  color: var(--gold-2);
  background: var(--gold-dim);
}

.stage-tracker {
  display: flex;
  gap: .35rem;
  padding: .55rem .85rem;
  overflow-x: auto;
  flex-shrink: 0;
}
.stage-step {
  flex: 1;
  min-width: 110px;
  border: 1px solid var(--line);
  background: var(--elevated-2);
  color: var(--muted);
  border-radius: 10px;
  padding: .45rem .5rem;
  font-size: .7rem;
  cursor: pointer;
  text-align: left;
  position: relative;
}
.stage-step.on { color: var(--gold-2); border-color: rgba(212,175,55,0.4); }
.stage-step.current { background: var(--gold-dim); }
.stage-check {
  display: none;
  margin-right: .25rem;
  color: var(--gold);
}
.stage-step.on .stage-check { display: inline; }
.stage-popup {
  margin: 0 .85rem .55rem;
  padding: .55rem .75rem;
  border-radius: 10px;
  background: var(--elevated-2);
  border: 1px solid var(--line);
  font-size: .8rem;
  color: var(--muted);
}

.chat-log {
  flex: none;
  overflow: visible;
  padding: .75rem 0;
  display: flex;
  flex-direction: column;
  gap: .65rem;
  min-height: 0;
  height: auto;
}
.bubble {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .75rem .9rem;
  background: var(--elevated-2);
}
.bubble.herald { border-color: rgba(212,175,55,0.25); }
.bubble .meta {
  font-size: .68rem;
  color: var(--muted);
  margin-bottom: .35rem;
  font-family: var(--mono);
}
.bubble.system { color: var(--muted); font-size: .85rem; }

.workflow-bar { display: flex; flex-wrap: wrap; gap: .35rem; }
.progress-feed {
  margin: .4rem .85rem 0; max-height: 100px; overflow: auto;
  font-family: var(--mono); font-size: .68rem; color: var(--gold-2);
  border-left: 2px solid var(--gold); padding-left: .65rem;
}
.progress-feed:empty { display: none; }
.progress-feed .tick { color: var(--muted); margin-right: .35rem; }

.quick-starts { display: none; flex-wrap: wrap; gap: .35rem; padding: .45rem .85rem; }
.quick-starts.show { display: flex; }
.qs-btn {
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  border-radius: 999px; padding: .3rem .65rem; font-size: .72rem; cursor: pointer;
}
.revise-box {
  display: none; grid-template-columns: 1fr auto; gap: .45rem;
  padding: .55rem .85rem; border-top: 1px solid var(--line); align-items: end;
}
.revise-box.show { display: grid; }
.revise-box label { display: flex; flex-direction: column; gap: .25rem; font-size: .72rem; color: var(--muted); }
.revise-box input {
  background: var(--bg); border: 1px solid var(--line); color: var(--ink);
  padding: .5rem .65rem; border-radius: 8px; font-family: var(--sans);
}

/* Inspector tabs */
.right-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  padding: .45rem .55rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.capsule-tabs {
  background: transparent;
}
.right-tab {
  border: 1px solid rgba(212,175,55,0.22);
  background: #11151E;
  color: var(--muted);
  padding: .45rem .55rem;
  font-size: .7rem;
  cursor: pointer;
  border-radius: 999px;
  line-height: 1.25;
  font-family: var(--sans);
}
.right-tab.active {
  border-color: var(--gold-glass-border);
  color: var(--champagne);
  font-weight: 600;
  background: var(--gold-glass);
}
.right-tab.active .tab-badge {
  background: rgba(212,175,55,0.22);
  color: var(--champagne);
}
.tab-badge {
  display: inline-block;
  margin-left: .2rem;
  padding: 0 .35rem;
  border-radius: 999px;
  background: rgba(212,175,55,0.22);
  font-size: .65rem;
}
.right-tab-panels {
  flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden;
}
.right-pane {
  display: none; flex: 1; min-height: 0; overflow: auto; padding: .65rem .7rem 1rem;
}
.right-pane.active { display: block; }
.right-pane .instrument-list,
.right-pane .seat-chamber,
.right-pane .aurum-panel,
.right-pane .firewall-panel {
  max-height: none !important;
  overflow: visible;
}

.seat-chamber { display: flex; flex-direction: column; gap: .45rem; }
.seat-card {
  border: 1px solid var(--line); border-radius: 10px; padding: .65rem .75rem;
  background: var(--elevated-2); cursor: pointer;
}
.seat-card strong { color: var(--gold-2); }
.seat-plain { font-size: .72rem; color: var(--muted); margin-top: .15rem; }
.seat-findings {
  margin-top: .45rem; font-size: .8rem; color: var(--ink); line-height: 1.4;
}
.seat-findings ul { margin: .25rem 0 0; padding-left: 1.1rem; }
.seat-findings li { margin: .15rem 0; }
.seat-body {
  margin-top: .45rem; font-size: .8rem; display: none;
  border-top: 1px solid var(--line); padding-top: .45rem;
}
.seat-card.open .seat-body { display: block; }
.seat-card .seat-expand-hint { font-size: .68rem; color: var(--muted); margin-top: .3rem; }

.aurum-panel, .firewall-panel {
  font-size: .82rem;
  border: none;
  background: transparent;
  max-height: none;
  margin: 0;
  padding: 0;
}
.aurum-panel h4, .firewall-panel h4 {
  margin: 0 0 .5rem; color: var(--gold-2); font-size: .95rem;
}
.aurum-plain {
  border: 1px solid var(--line); background: var(--gold-dim);
  padding: .7rem .8rem; border-radius: 10px; margin-bottom: .75rem;
}
.flag-item { margin: .35rem 0; padding: .4rem; border: 1px dashed rgba(196,92,92,.4); border-radius: 8px; }
.gate-actions { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .5rem; }

.archive-mount, .evidence-search {
  margin: .55rem 0; padding: .55rem; border: 1px solid var(--line);
  background: rgba(255,255,255,0.02); display: grid; gap: .4rem; border-radius: 10px;
}
.archive-mount label, .evidence-search { font-size: .72rem; color: var(--muted); }
.archive-mount input, .evidence-search input {
  width: 100%; margin-top: .25rem; background: var(--bg); border: 1px solid var(--line);
  color: var(--ink); padding: .45rem .55rem; border-radius: 8px; font-family: var(--mono); font-size: .72rem;
}
.archive-actions, .evidence-search { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.archive-tiers { font-size: .75rem; margin: .4rem 0; }
.tier-block { margin: .35rem 0; border: 1px solid var(--line); padding: .4rem .5rem; border-radius: 8px; }
.tier-block summary { cursor: pointer; color: var(--gold-2); font-weight: 600; }
.tier-block .tier-file-list { max-height: 280px; overflow-y: auto; margin-top: .35rem; }
.tier-block .tier-file { font-family: var(--mono); font-size: .68rem; color: var(--muted); padding: .1rem 0; cursor: pointer; }
.tier-block .tier-file:hover { color: var(--gold-2); }
.search-hits { max-height: 140px; overflow: auto; font-size: .72rem; }
.search-hit { padding: .3rem .4rem; border-bottom: 1px solid var(--line); cursor: pointer; }
.dropzone {
  border: 1.5px dashed rgba(255,255,255,0.14); border-radius: 12px;
  padding: 1.1rem; text-align: center; cursor: pointer; color: var(--muted);
}
.dropzone.drag { border-color: var(--gold); background: var(--gold-dim); }
.dropzone strong { display: block; color: var(--ink); margin-bottom: .25rem; }
.evidence-list, .instrument-list { display: flex; flex-direction: column; gap: .4rem; margin-top: .5rem; }
.ev-item, .inst-item {
  border: 1px solid var(--line); border-radius: 10px; padding: .55rem .65rem;
  background: var(--elevated-2); cursor: pointer; font-size: .8rem;
}
.ev-item {
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: .35rem .55rem;
}
.ev-item:hover { border-color: rgba(212,175,55,0.4); }
.sha { font-family: var(--mono); font-size: .65rem; color: var(--muted); }
.inst-actions { display: flex; flex-direction: column; gap: .4rem; margin-top: .55rem; }
.inst-actions .btn, .inst-actions a {
  display: block; width: 100%; text-align: center; padding: .55rem .65rem; white-space: normal;
  text-decoration: none;
}

/* Herald / dashboard (advanced chat) */
.case-dashboard {
  display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; margin: .35rem 0 .75rem;
}
.case-dash-card {
  border: 1px solid var(--line); background: var(--gold-dim);
  border-radius: 10px; padding: .75rem .85rem;
}
.case-dash-card h4 { margin: 0 0 .45rem; color: var(--gold-2); font-size: .9rem; }
.case-dash-card ul, .case-dash-card ol { margin: .25rem 0 0 1.05rem; padding: 0; }
.case-dash-card .btn { margin-top: .55rem; width: 100%; }
@media (max-width: 900px) { .case-dashboard { grid-template-columns: 1fr; } }

.herald-card-b {
  min-height: 320px; max-height: 560px; overflow-y: auto; padding: 0;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
}
.herald-card-b.expanded { min-height: 80vh; max-height: none; }
.weapon-toolbar {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: nowrap; gap: 8px; padding: 12px 14px;
  background: rgba(19,23,32,.96); border-bottom: 1px solid var(--line);
}
.weapon-toolbar > strong {
  white-space: nowrap; font-size: .82rem; color: var(--gold-2); flex-shrink: 0;
}
.weapon-toolbar .btn { font-size: .72rem; padding: .35rem .55rem; flex-shrink: 0; }
.weapon-body { padding: 1.1rem 1.2rem; font-size: .9rem; line-height: 1.55; }
.weapon-body.proof-off .veritas-pill { display: none !important; }
.weapon-body.proof-off .veritas-badge {
  background: none !important; border: none !important; padding: 0 !important; color: inherit !important;
}

.cmd-pill {
  display: inline-block; margin: .25rem 0 .5rem; padding: .35rem .7rem;
  border-radius: 999px; border: 1px solid rgba(212,175,55,.45);
  background: var(--gold-dim); color: var(--gold-2); font-size: .78rem;
}
.user-bubble-compact {
  white-space: pre-wrap; max-height: 160px; overflow-y: auto;
  font-size: .82rem; color: var(--muted);
}
.summon-btn {
  display: inline-block; margin-top: .65rem; border: 1px solid rgba(212,175,55,.5);
  background: var(--gold-dim); color: var(--gold-2); padding: .65rem .9rem;
  cursor: pointer; border-radius: 10px; font-family: var(--sans); font-weight: 600;
}
.herald-card-c details {
  border: 1px solid var(--line); border-radius: 10px; padding: .55rem .75rem;
  background: rgba(255,255,255,.02); margin-top: .55rem;
}
.herald-card-c summary { cursor: pointer; color: var(--gold-2); font-weight: 600; font-size: .85rem; }
.herald-card-c .tech-body { margin-top: .55rem; max-height: 280px; overflow-y: auto; font-size: .78rem; }

/* Veritas */
.veritas-badge {
  display: inline; background: rgba(212,175,55,0.18); border-bottom: 1px dotted rgba(212,175,55,0.55);
  border-radius: 3px; cursor: pointer; padding: 0 2px;
}
.veritas-pill { color: var(--gold-2); font-size: .78em; font-weight: 500; }
.veritas-badge:hover { filter: brightness(1.08); }
body.proof-tags-off .veritas-pill { display: none !important; }
body.proof-tags-off .veritas-badge {
  background: none !important; border: none !important; padding: 0 !important; cursor: text;
}

.md-body h1, .md-body h2, .md-body h3, .md-body h4 { color: var(--gold-2); margin: .85rem 0 .4rem; }
.md-body p { margin: .45rem 0; }
.md-body table { width: 100%; border-collapse: collapse; font-size: .78rem; margin: .5rem 0; }
.md-body th, .md-body td { border: 1px solid var(--line); padding: .35rem .45rem; text-align: left; }
.md-body code { font-family: var(--mono); font-size: .85em; }

/* Live Deliberation Progress Banner (v15.2) */
.live-delib-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 12px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(212, 175, 55, 0.55);
  background:
    linear-gradient(135deg, rgba(212, 175, 55, 0.18), rgba(19, 23, 32, 0.95) 55%),
    #131720;
  box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.12), 0 10px 28px rgba(0, 0, 0, 0.35);
  color: #F4E6B0;
}
.live-delib-banner--dock {
  max-width: 920px;
  margin: 0 auto 10px;
}
/* v17.0 — single deliberation banner (composer dock only) */
#simpleDelibBanner,
#studioDelibBanner {
  display: none !important;
}
.md-body table td br,
.md-body table th br {
  display: block;
  content: "";
  margin-top: 0.25em;
}
.verified-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  background: rgba(111, 191, 138, 0.16);
  border: 1px solid rgba(111, 191, 138, 0.45);
  color: #9ed9b0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.live-delib-spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2.5px solid rgba(212, 175, 55, 0.25);
  border-top-color: #E5C158;
  flex-shrink: 0;
  animation: lh-delib-spin 0.85s linear infinite;
}
@keyframes lh-delib-spin {
  to { transform: rotate(360deg); }
}
.live-delib-copy {
  flex: 1;
  min-width: 0;
}
.live-delib-headline {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #F6E7A8;
  line-height: 1.3;
}
.live-delib-sub {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: #C9B36A;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.live-delib-timer {
  flex-shrink: 0;
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 1.15rem;
  font-weight: 700;
  color: #0A0C10;
  background: linear-gradient(180deg, #F0D778, #C9A227);
  border-radius: 10px;
  padding: 6px 12px;
  min-width: 4.4rem;
  text-align: center;
  letter-spacing: 0.04em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
body.is-deliberating .composer-send {
  opacity: 0.55;
  cursor: wait;
}

/* Docked composer footer (Row 3) — never overlays scrolled content */
.composer-dock {
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
  background: #0B0D11;
  border-top: 1px solid rgba(212,175,55,0.22);
  padding: 12px 20px;
  z-index: 30;
  transition: width 0.22s ease, max-width 0.22s ease, margin-right 0.22s ease;
}
.floating-composer,
.composer-bar {
  position: static;
  left: auto;
  bottom: auto;
  transform: none;
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: .55rem .65rem;
  background: rgba(19, 23, 32, 0.98);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: none;
  backdrop-filter: none;
  z-index: auto;
  box-sizing: border-box;
}
.composer-trailing {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  min-width: 0;
}
.composer-attach {
  width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--elevated-2);
  color: var(--ink); cursor: pointer; flex: 0 0 auto; font-size: 1rem;
}
.floating-composer textarea,
#messageInput {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 64px;
  max-height: 240px;
  height: 64px;
  resize: none;
  overflow-y: hidden;
  border: none;
  background: transparent;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
  line-height: 1.45;
  align-self: flex-end;
  box-sizing: border-box;
}
.composer-mode {
  max-width: 200px;
  background: var(--elevated-2);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 10px;
  padding: .45rem .5rem;
  font-size: .72rem;
  font-family: var(--sans);
  flex: 0 0 auto;
}
.composer-send {
  flex: 0 0 auto;
  padding: .55rem .95rem;
  border-radius: 12px;
  white-space: nowrap;
}
/* v17.7 — narrow: full-width textarea row, tools+send on second row */
@media (max-width: 860px) {
  .floating-composer,
  .composer-bar {
    flex-wrap: wrap;
    align-items: center;
  }
  .floating-composer textarea,
  #messageInput {
    flex: 1 1 100%;
    width: 100%;
    order: 1;
    align-self: stretch;
  }
  .composer-attach { order: 2; }
  .composer-mic { order: 3; }
  .composer-trailing {
    order: 4;
    margin-left: auto;
    flex: 1 1 auto;
    justify-content: flex-end;
    flex-wrap: wrap;
  }
  .composer-mode {
    max-width: min(200px, 46vw);
  }
}
.status-line {
  position: static;
  left: auto; bottom: auto; transform: none;
  text-align: center;
  font-size: .68rem; color: var(--muted); padding: 4px 8px 0;
  max-width: 920px; margin: 0 auto;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Modals */
.modal-shell {
  border: none; padding: 0; background: transparent;
  max-width: min(780px, 94vw); max-height: 92vh;
}
.modal-shell::backdrop { background: rgba(0,0,0,.55); backdrop-filter: blur(4px); }
.modal-card {
  background: var(--elevated); border: 1px solid var(--line);
  border-radius: 16px; padding: 1.1rem 1.25rem; color: var(--ink);
  max-height: 88vh; overflow: auto;
}
.modal-card.drawer { max-width: 640px; }
/* v14.1 — True 3-row flex modal (header | scrolling body | footer). No sticky-in-scroll. */
#matterModal .modal-card,
.modal-card.matter-wizard {
  width: min(780px, 94vw);
  max-width: min(780px, 94vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  box-sizing: border-box;
}
#matterModal .modal-header,
.modal-card.matter-wizard > .modal-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: #131720;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 2;
  position: relative;
  margin-bottom: 0;
  top: auto;
}
#matterModal .matter-form-shell,
.modal-card.matter-wizard > #matterForm.matter-form-shell,
.modal-card.matter-wizard > #matterForm {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  margin: 0;
  padding: 0;
}
#matterModal .modal-body,
.modal-card.matter-wizard .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 24px 24px 24px;
  box-sizing: border-box;
  scroll-padding-top: 20px; /* v14.2 — keep Step 2 labels clear of top edge */
}
#matterModal .modal-footer,
.modal-card.matter-wizard .modal-footer,
.modal-card.matter-wizard .matter-modal-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .45rem;
  padding: 14px 24px;
  background: #131720;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 2;
  position: relative;
  bottom: auto;
  margin: 0;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  margin-bottom: .75rem;
}
.ev-item .ev-meta { flex: 1 1 180px; min-width: 0; }
.ev-preview-pill {
  margin-left: auto;
  font-size: .68rem;
  font-weight: 620;
  color: var(--champagne);
  background: var(--gold-glass);
  border: 1px solid var(--gold-glass-border);
  border-radius: 999px;
  padding: .15rem .55rem;
  white-space: nowrap;
  flex-shrink: 0;
}
.claim-principal-field { margin-top: .35rem; }
.modal-header h2 { margin: 0; font-size: 1.15rem; }
.modal-x {
  border: none; background: transparent; color: var(--muted);
  font-size: 1.1rem; cursor: pointer;
}
.modal-actions { display: flex; justify-content: flex-end; gap: .45rem; margin-top: 1rem; }
.lead { line-height: 1.5; }
.grid-2,
.advanced-settings-grid,
.matter-wizard .grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
  align-items: end;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}
.matter-wizard,
.matter-wizard .modal-card,
.modal-card.matter-wizard,
#matterForm,
.advanced-legal {
  overflow-x: hidden;
  max-width: 100%;
  box-sizing: border-box;
  width: 100%;
}
label {
  display: flex; flex-direction: column; gap: .3rem;
  font-size: .75rem; color: var(--muted); margin-bottom: .65rem;
  min-width: 0; max-width: 100%; width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}
label input, label select,
.matter-wizard input,
.matter-wizard select {
  background: var(--bg); border: 1px solid var(--line); color: var(--ink);
  padding: .55rem .65rem; border-radius: 8px; font-family: var(--sans); font-size: .88rem;
  width: 100%; max-width: 100%; min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.matter-wizard label {
  white-space: nowrap;
  text-overflow: ellipsis;
}
.matter-modal-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .55rem;
  flex-wrap: wrap;
}
.modal-actions-right { display: flex; gap: .45rem; margin-left: auto; }
.btn.crimson-outline {
  background: transparent;
  color: #f0b4b4;
  border: 1px solid rgba(196, 92, 92, 0.65);
  font-weight: 600;
}
.btn.crimson-outline:hover { background: rgba(196, 92, 92, 0.12); }
.studio-letter {
  margin: .65rem 0 1rem;
}
.evidence-drawer-body { display: flex; flex-direction: column; gap: .55rem; }

.toast-stack {
  position: fixed; top: 1rem; right: 1rem; z-index: 9999;
  display: flex; flex-direction: column; gap: .45rem; max-width: min(360px, 92vw);
  pointer-events: none;
}
.toast {
  pointer-events: auto; padding: .7rem .9rem; border: 1px solid rgba(212,175,55,.45);
  background: rgba(19,23,32,.96); color: var(--ink); font-size: .82rem;
  border-radius: 12px; box-shadow: 0 8px 28px rgba(0,0,0,.45);
}
.toast.err { border-color: #c45c5c; }
.toast.ok { border-color: rgba(111,191,138,.7); }

.guide .steps { margin: .5rem 0 1rem 1.1rem; line-height: 1.5; }
.guide-seats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: 10px; margin-bottom: .9rem;
}
.guide-seat {
  border: 1px solid var(--line); background: var(--elevated-2);
  padding: .55rem .65rem; font-size: .78rem; border-radius: 10px;
}
.guide-seat strong { color: var(--gold-2); display: block; margin-bottom: .15rem; }

.matter-card-wrap { display: flex; gap: .25rem; margin-bottom: .35rem; }
.matter-card {
  flex: 1; text-align: left; border: 1px solid var(--line); background: var(--elevated-2);
  color: var(--ink); border-radius: 10px; padding: .55rem .65rem; cursor: pointer;
}
.matter-card.active { border-color: rgba(212,175,55,.5); }
.matter-card strong { display: block; }
.matter-card span { display: block; font-size: .7rem; color: var(--muted); }
.btn-delete {
  border: 1px solid rgba(196,92,92,.4); background: transparent; color: var(--danger);
  border-radius: 8px; padding: 0 .45rem; cursor: pointer;
}
.euro-chip {
  display: inline-block; margin: .15rem; padding: .2rem .45rem;
  border: 1px solid rgba(212,175,55,.45); border-radius: 6px;
  cursor: pointer; font-family: var(--mono); font-size: .7rem;
}
.evidence-meta { font-family: var(--mono); font-size: .72rem; color: var(--muted); margin-bottom: .65rem; }
.evidence-transcript {
  white-space: pre-wrap; background: var(--bg); border: 1px solid var(--line);
  padding: .75rem; max-height: 60vh; overflow-y: auto; overflow-x: hidden; font-size: .78rem; border-radius: 8px;
}
.evidence-transcript .hit { background: rgba(212,175,55,.35); }
.evidence-transcript .hl-money { background: rgba(111,191,138,.28); border-radius: 3px; padding: 0 2px; }
.evidence-transcript .hl-date { background: rgba(120,150,220,.28); border-radius: 3px; padding: 0 2px; }
.evidence-preview { margin: .5rem 0; text-align: center; }
.evidence-preview img {
  max-width: 100%; max-height: 280px; border: 1px solid var(--line);
  object-fit: contain; background: #0a0a0a; border-radius: 8px;
}
.quicklook-card { max-width: 820px; width: min(820px, 94vw); }
.quicklook-toolbar {
  display: flex; flex-wrap: wrap; gap: .45rem; align-items: center;
  margin: .35rem 0 .55rem;
}
.quicklook-toolbar input[type="search"] {
  flex: 1 1 220px; min-width: 0; background: var(--elevated-2); border: 1px solid var(--line);
  color: var(--ink); border-radius: 8px; padding: .4rem .55rem; font-size: .82rem;
}
.quicklook-badges { display: flex; flex-wrap: wrap; gap: .35rem; margin: .25rem 0 .55rem; }
.ql-badge {
  font-family: var(--mono); font-size: .68rem; color: var(--champagne);
  background: var(--gold-glass); border: 1px solid var(--gold-glass-border);
  border-radius: 999px; padding: .15rem .55rem;
}
.command-palette-card { max-width: 560px; width: min(560px, 94vw); padding-bottom: 1rem; }
.command-palette-input {
  width: 100%; background: var(--elevated-2); border: 1px solid var(--line);
  color: var(--ink); border-radius: 10px; padding: .7rem .85rem; font-size: .95rem; margin: .35rem 0 .65rem;
}
.command-palette-list { max-height: 50vh; overflow-y: auto; display: flex; flex-direction: column; gap: .25rem; }
.command-palette-item {
  text-align: left; background: transparent; border: 1px solid transparent;
  color: var(--ink); border-radius: 10px; padding: .55rem .7rem; cursor: pointer; font-size: .88rem;
}
.command-palette-item:hover,
.command-palette-item.active {
  background: var(--gold-glass); border-color: var(--gold-glass-border); color: var(--champagne);
}
.command-palette-item .cmd-hint { float: right; color: var(--muted); font-size: .72rem; }
.topbar .btn-cmdk { font-size: .78rem; letter-spacing: .02em; }
.firewall-badge { font-size: .75rem; color: var(--ok); }

@media (max-width: 1100px) {
  .advanced-studio { grid-template-columns: 1fr; }
}

/* v14.3 — Narrow split / Cursor browser: stack panes; workspace scrolls both */
@media (max-width: 980px) {
  body[data-ui-mode="advanced"] > .app-workspace {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    height: auto !important;
    max-height: none !important;
  }
  .advanced-studio {
    grid-template-columns: 1fr;
    height: auto !important;
    max-height: none !important;
    min-height: 0;
  }
  .studio-main,
  .studio-inspector {
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
  }
  .studio-main {
    overflow: visible !important;
    padding-bottom: 40px !important;
  }
  .studio-inspector {
    overflow: visible !important;
  }
}

/* Print preview serif only */
@media print {
  body { background: white; color: black; font-family: var(--serif); }
  .topbar, .composer-dock, .floating-composer, .status-line { display: none !important; }
}

/* ===== Phase 11 — Suite Edition: mission cards + A4 courtroom ===== */
.mission-grid.show {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
  padding: .85rem 1rem 160px;
}
.mission-card {
  position: relative;
  text-align: left;
  border-radius: 16px;
  border: 1px solid rgba(212,175,55,0.25);
  background: #0A0C10;
  padding: 20px;
  cursor: pointer;
  color: var(--ink);
  font-family: var(--sans);
  transition: border-color .15s ease, transform .15s ease;
}
.mission-card:hover {
  border-color: rgba(212,175,55,0.55);
  transform: translateY(-1px);
}
.mission-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(212,175,55,0.45);
  background: rgba(212,175,55,0.12);
  display: grid; place-items: center;
  font-size: 1.15rem;
  margin-bottom: .75rem;
}
.mission-card strong {
  display: block;
  font-size: .92rem;
  margin-bottom: .35rem;
  color: var(--ink);
}
.mission-card span {
  display: block;
  font-size: .78rem;
  color: var(--muted);
  line-height: 1.4;
}
.mission-badge {
  position: absolute;
  top: 14px; right: 14px;
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .06em;
  padding: .2rem .5rem;
  border-radius: 999px;
  background: var(--gold-glass);
  color: var(--champagne);
  border: 1px solid var(--gold-glass-border);
}
.letter-view-toggle {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: #11151E;
  border: 1px solid rgba(212,175,55,0.28);
  gap: 2px;
  margin-right: .25rem;
  flex-shrink: 0;
}
.letter-view-toggle button {
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  font-family: var(--sans);
  white-space: nowrap;
}
.letter-view-toggle button.active {
  background: var(--gold-glass);
  color: var(--champagne);
  font-weight: 600;
  border: 1px solid var(--gold-glass-border);
}
.letter-body.md-body h1, .letter-body .md-body h1 {
  font-size: 1.25rem; color: var(--gold-2); margin: 0 0 .5rem;
}
.letter-body.md-body h2, .letter-body .md-body h2 {
  font-size: 1.05rem; color: var(--gold-2); margin: 1rem 0 .4rem;
}
.letter-body.md-body h3, .letter-body .md-body h3 {
  font-size: .95rem; color: var(--gold-2); margin: .85rem 0 .35rem;
}
.letter-body.a4-inline {
  background: transparent;
  color: #111827;
  border-radius: 0;
  padding: 12px 14px 18px !important;
}
.letter-body.a4-inline .md-body h1,
.letter-body.a4-inline .md-body h2,
.letter-body.a4-inline .md-body h3 { color: #785A1E; }

/* v14.3 — High-contrast warm-ivory A4 paper (never dark ink on dark card) */
.a4-sheet,
.a4-sheet-embed,
.letter-body.is-a4 {
  background: #FAF8F3 !important;
  color: #111827 !important;
  padding: 28px 32px !important;
  border-radius: 10px !important;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45) !important;
  box-sizing: border-box !important;
}
.letter-body.is-a4 {
  /* Outer shell stays transparent; paper lives on the inner .a4-sheet */
  background: transparent !important;
  box-shadow: none !important;
  padding: 12px 14px 18px !important;
}
.letter-body.is-a4 > .a4-sheet {
  background: #FAF8F3 !important;
  color: #111827 !important;
  padding: 28px 32px !important;
  border-radius: 10px !important;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45) !important;
  width: 100%;
  min-height: 0;
  margin: 0;
}
.a4-sheet *,
.a4-sheet-embed *,
.letter-body.is-a4 *,
.letter-body.is-a4 pre.clean-letter {
  color: #111827 !important;
}
.a4-sheet .a4-muted,
.a4-sheet-embed .a4-sec-title,
.a4-sheet .a4-seal-banner,
.a4-sheet .a4-parties h4,
.a4-sheet .a4-claims h4,
.a4-sheet-embed .a4-seal-banner,
.a4-sheet-embed .a4-parties h4,
.a4-sheet-embed .a4-claims h4,
.letter-body.is-a4 .a4-seal-banner,
.letter-body.is-a4 .a4-parties h4,
.letter-body.is-a4 .a4-claims h4 {
  color: #785A1E !important;
}
.a4-sheet .a4-crest,
.a4-sheet-embed .a4-crest {
  color: #E5C158 !important;
  background: radial-gradient(circle at 35% 30%, #2a2414, #0A0C10 70%) !important;
}

/* Advanced Studio left pane — letter never height-capped */
#studioLetter.letter-card,
.studio-letter.letter-card,
#simpleLetter.letter-card {
  overflow: visible;
  max-height: none;
  height: auto !important;
  flex: none !important;
}
#studioLetter .letter-body,
#studioLetter .letter-body.is-collapsed,
#studioLetter .a4-sheet-embed,
#studioLetter .a4-inline,
#studioLetter .a4-body,
#studioLetter .a4-sheet,
#simpleLetter .letter-body,
#simpleLetter .a4-sheet {
  max-height: none !important;
  overflow: visible !important;
}
#studioLetter .letter-body.is-collapsed::after,
#simpleLetter .letter-body.is-collapsed::after {
  display: none !important;
}
#studioLetter .letter-expand-row {
  display: none; /* full letter always readable via .studio-main scroll */
}

.a4-modal { max-width: min(920px, 96vw); }
.a4-modal-card { max-height: 92vh; display: flex; flex-direction: column; padding: .85rem 1rem 1rem; }
.a4-modal-card .modal-header { flex-shrink: 0; }
.modal-actions-inline { display: flex; gap: .4rem; align-items: center; }
.a4-sheet-scroll {
  overflow: auto; flex: 1; background: #2a2d35;
  border-radius: 12px; padding: 1.25rem; max-height: calc(92vh - 80px);
}
.a4-sheet {
  width: min(210mm, 100%);
  min-height: 297mm;
  margin: 0 auto;
  background: #FAF8F3;
  color: #111827;
  box-shadow: 0 8px 28px rgba(0,0,0,.45);
  padding: 28px 32px;
  font-family: "Times New Roman", Times, Georgia, serif;
  font-size: 11.5pt;
  line-height: 1.45;
  border-radius: 10px;
  box-sizing: border-box;
}
.a4-seal-banner {
  text-align: center;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .12em;
  color: #8a6d12;
  text-transform: uppercase;
  margin-bottom: .55rem;
}
.a4-gold-rule {
  height: 2px;
  background: linear-gradient(90deg, transparent, #D4AF37, transparent);
  margin: 0 0 1rem;
}
.a4-crest-row {
  display: flex; gap: .85rem; align-items: center; margin-bottom: 1rem;
}
.a4-crest {
  width: 52px; height: 52px; border-radius: 50%;
  border: 2px solid #D4AF37;
  background: radial-gradient(circle at 35% 30%, #2a2414, #0A0C10 70%);
  color: #E5C158; display: grid; place-items: center;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 800; font-size: .78rem; letter-spacing: .06em;
  flex-shrink: 0;
}
.a4-crest-meta {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  font-size: 10px; color: #444; line-height: 1.35;
}
.a4-crest-meta strong {
  display: block; color: #0A0C10; font-size: 12px; letter-spacing: .04em;
  margin-bottom: .15rem;
}
.a4-doc-title {
  font-size: 15pt; font-weight: 700; text-align: center;
  margin: .75rem 0 .35rem; color: #0A0C10;
}
.a4-doc-sub {
  text-align: center; font-size: 9.5pt; color: #555; margin-bottom: 1rem;
}
.a4-parties, .a4-claims {
  border: 1px solid #d8c98a; background: #faf6ea;
  padding: .65rem .8rem; margin: .65rem 0 1rem;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 9.5pt;
}
.a4-parties h4, .a4-claims h4 {
  margin: 0 0 .35rem; font-size: 9pt; letter-spacing: .08em;
  color: #8a6d12; text-transform: uppercase;
}
.a4-body h1 { font-size: 13pt; margin: 1rem 0 .4rem; }
.a4-body h2 { font-size: 12pt; margin: .9rem 0 .35rem; }
.a4-body h3 { font-size: 11pt; margin: .75rem 0 .3rem; }
.a4-body p { margin: .4rem 0; }
.a4-body ul, .a4-body ol { margin: .35rem 0 .55rem 1.2rem; }
.a4-body table { width: 100%; border-collapse: collapse; font-size: 9.5pt; margin: .5rem 0; }
.a4-body th, .a4-body td { border: 1px solid #ccc; padding: .3rem .4rem; text-align: left; }
.a4-body hr { border: none; border-top: 1px solid #d8c98a; margin: .85rem 0; }

@media (max-width: 820px) {
  .mission-grid.show { grid-template-columns: 1fr; }
}

/* ── v12.0 Zero-Thinking UX ── */
.empty-vault {
  text-align: center;
  padding: 1.5rem 1rem 1.25rem;
}
.empty-vault h2 { margin: 0 0 .5rem; color: var(--gold-2); }
.empty-vault-actions {
  display: flex; flex-direction: column; gap: .65rem;
  max-width: 420px; margin: 1.1rem auto 0;
}
.empty-vault-actions .btn { width: 100%; }

.archetype-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .65rem;
  margin: .5rem 0 1rem;
}
.archetype-card {
  text-align: left;
  background: var(--elevated-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-family: var(--sans);
  transition: border-color .15s, background .15s;
}
.archetype-card:hover { border-color: rgba(212,175,55,0.4); }
.archetype-card.selected {
  border: 1.5px solid #D4AF37;
  background: rgba(212,175,55,0.12);
  box-shadow: 0 0 0 1px rgba(212,175,55,0.18);
  position: relative;
}
.archetype-card .arch-icon { font-size: 1.35rem; }
.archetype-card strong { font-size: .88rem; }
.archetype-card span:last-child { font-size: .72rem; color: var(--muted); line-height: 1.35; }
.archetype-card .arch-selected-badge {
  position: absolute;
  top: 10px; right: 10px;
  font-size: .65rem;
  font-weight: 700;
  color: #0A0C10;
  background: linear-gradient(180deg, #E5C158 0%, #D4AF37 100%);
  border-radius: 999px;
  padding: .15rem .45rem;
}
.madlibs label { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .7rem; font-size: .82rem; color: var(--muted); }
.madlibs input {
  background: var(--bg); border: 1px solid var(--line); color: var(--ink);
  border-radius: 10px; padding: .55rem .7rem; font-family: var(--sans); font-size: .9rem;
}
.wizard-step-label { font-weight: 600; color: var(--champagne); margin: .75rem 0 .35rem !important; }
.advanced-legal,
#advancedLegalDetails {
  margin: .85rem 0 0;
  margin-top: 10px;
  scroll-margin-top: 20px; /* v14.2 — Advanced expand never clips Step 2 */
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .55rem .75rem;
  background: rgba(0,0,0,0.18);
}
.advanced-legal summary {
  cursor: pointer; color: var(--muted); font-size: .82rem; font-weight: 600;
}
.advanced-legal[open] summary { margin-bottom: .65rem; color: var(--champagne); }
.matter-wizard { max-width: min(780px, 94vw); }

.composer-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  width: 100%;
  max-width: 920px;
  margin: 0 auto 8px;
  padding: 0 2px;
  box-sizing: border-box;
}
.composer-chip {
  border: 1px solid var(--gold-glass-border);
  background: var(--gold-glass);
  color: var(--champagne);
  border-radius: 999px;
  padding: .28rem .7rem;
  font-size: .72rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--sans);
  white-space: nowrap;
}
.composer-chip:hover { filter: brightness(1.08); }
.composer-mic {
  width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--elevated-2);
  color: var(--ink); cursor: pointer; flex-shrink: 0; font-size: 1rem;
}
.composer-mic.listening {
  border-color: var(--gold-glass-border);
  background: var(--gold-glass);
  color: var(--champagne);
  animation: mic-pulse 1.1s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(212,175,55,0.35); }
  50% { box-shadow: 0 0 0 8px rgba(212,175,55,0); }
}

.lifecycle-banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: .55rem;
  padding: .65rem .9rem;
  border-radius: 12px;
  border: 1px solid var(--gold-glass-border);
  background: var(--gold-glass);
  color: var(--champagne);
  font-size: .85rem;
  font-weight: 600;
}
.lifecycle-banner[hidden] { display: none !important; }

.leverage-bar-wrap {
  margin: 0 0 1rem;
  padding: .85rem 1rem;
  background: var(--elevated-2);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.leverage-bar-wrap h4 { margin: 0 0 .55rem; font-size: .9rem; color: var(--gold-2); }
.leverage-track {
  position: relative;
  height: 28px;
  border-radius: 999px;
  background: #0E121A;
  border: 1px solid var(--line);
  overflow: hidden;
  display: flex;
}
.leverage-demand {
  background: linear-gradient(90deg, rgba(212,175,55,0.55), rgba(212,175,55,0.28));
  height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: .68rem; font-weight: 700; color: #0A0C10;
  min-width: 18%;
}
.leverage-contest {
  background: rgba(196,92,92,0.35);
  height: 100%; flex: 1;
  display: flex; align-items: center; justify-content: center;
  font-size: .68rem; font-weight: 600; color: #f5d0d0;
}
.leverage-caption { margin: .45rem 0 0; font-size: .75rem; color: var(--muted); }

.legal-term {
  border-bottom: 1px dotted rgba(212,175,55,0.55);
  cursor: help;
  position: relative;
}
.legal-term[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  left: 0; bottom: calc(100% + 6px);
  z-index: 50;
  min-width: 220px; max-width: 320px;
  padding: .45rem .6rem;
  border-radius: 8px;
  background: #171C28;
  border: 1px solid var(--gold-glass-border);
  color: var(--ink);
  font-size: .72rem;
  font-weight: 500;
  line-height: 1.35;
  white-space: normal;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
  pointer-events: none;
}

.briefing-leverage-mini {
  margin: .75rem 0 0;
  font-size: .82rem;
  color: var(--muted);
}

@media (max-width: 640px) {
  .archetype-grid { grid-template-columns: 1fr; }
}

/* v12.1 — Evidence Vault drawer + studio briefing */
.evidence-vault-dialog { max-width: min(680px, 96vw); }
.evidence-vault-card {
  max-width: 680px;
  width: min(680px, 94vw);
  max-height: 88vh;
  overflow: auto;
  padding: 1rem 1.1rem 1.15rem;
}
.drawer-dropzone {
  border: 1.5px dashed rgba(212,175,55,0.4);
  border-radius: 14px;
  padding: 1.1rem 1rem;
  text-align: center;
  background: rgba(212,175,55,0.05);
  cursor: pointer;
  margin: .55rem 0 .75rem;
}
.drawer-dropzone strong { display: block; color: var(--gold-2); margin-bottom: .25rem; }
.drawer-dropzone span { font-size: .78rem; color: var(--muted); }
.drawer-dropzone.dragover { background: rgba(212,175,55,0.14); border-color: #D4AF37; }
.drawer-actions-row {
  display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: .75rem;
}
.drawer-clean-room {
  margin: 0 0 .85rem;
  padding: .75rem .85rem;
  border: 1px solid rgba(212,175,55,0.35);
  border-radius: 12px;
  background: rgba(212,175,55,0.08);
}
.drawer-clean-room .btn { width: 100%; white-space: normal; line-height: 1.35; }
.drawer-clean-room .hint { margin: .55rem 0 0; }
.drawer-mount {
  display: flex; flex-wrap: wrap; gap: .45rem; align-items: flex-end;
  margin-bottom: .75rem;
}
.drawer-mount label {
  flex: 1 1 240px; display: flex; flex-direction: column; gap: .3rem;
  font-size: .78rem; color: var(--muted);
}
.drawer-mount input {
  background: var(--bg); border: 1px solid var(--line); color: var(--ink);
  border-radius: 10px; padding: .5rem .65rem; font-family: var(--sans);
}
.drawer-search {
  display: flex; gap: .4rem; margin-bottom: .55rem;
}
.drawer-search input {
  flex: 1; background: var(--bg); border: 1px solid var(--line); color: var(--ink);
  border-radius: 10px; padding: .5rem .65rem; font-family: var(--sans);
}
.drawer-evidence-list {
  max-height: 220px; overflow: auto;
  border: 1px solid var(--line); border-radius: 12px;
  padding: .45rem; background: rgba(0,0,0,0.18);
}
.drawer-evidence-list .ev-item {
  padding: .45rem .55rem; border-radius: 8px; cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.drawer-evidence-list .ev-item:hover { background: rgba(212,175,55,0.08); }
.drawer-search-hits { font-size: .78rem; color: var(--muted); margin-bottom: .45rem; }
.drawer-preview {
  margin-top: .75rem; border: 1px solid var(--line); border-radius: 12px;
  padding: .65rem; background: var(--elevated-2);
}
.drawer-preview-head {
  display: flex; justify-content: space-between; align-items: center; gap: .5rem;
  margin-bottom: .4rem;
}
.studio-briefing {
  margin: .65rem 0;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--elevated);
}
.studio-briefing[hidden] { display: none !important; }
.studio-briefing h3 { margin: 0 0 .45rem; color: var(--gold-2); font-size: .95rem; }
.studio-briefing .path-cards { margin-top: .55rem; }

/* ── v17.5 Herald Sidekick drawer + composer dock clearance ── */
body.sidekick-open > .app-workspace {
  margin-right: 380px;
  transition: margin-right 0.22s ease;
}
/* Keep Send ↑ / chips fully left of the 380px drawer — never slide underneath */
body.sidekick-open > .composer-dock,
body.sidekick-open #composerDock {
  width: calc(100% - 380px);
  max-width: calc(100vw - 380px);
  margin-right: 0;
  margin-left: 0;
  padding-left: 20px;
  padding-right: 20px;
  box-sizing: border-box;
  transition: width 0.22s ease, max-width 0.22s ease;
}
body.sidekick-open .composer-chips,
body.sidekick-open .floating-composer,
body.sidekick-open .composer-bar {
  max-width: min(920px, 100%);
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
/* Narrow split-screen: drawer overlays with backdrop; composer stays full-width & wrap-safe */
@media (max-width: 1024px) {
  body.sidekick-open > .app-workspace {
    margin-right: 0;
  }
  body.sidekick-open > .composer-dock,
  body.sidekick-open #composerDock {
    width: 100%;
    max-width: 100vw;
  }
  body.sidekick-open .floating-composer,
  body.sidekick-open .composer-bar {
    flex-wrap: wrap;
    min-width: 0;
  }
  body.sidekick-open .sidekick-backdrop {
    display: block;
  }
  .sidekick-drawer {
    width: min(360px, 92vw);
    z-index: 55;
  }
}
.sidekick-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  top: 52px;
  z-index: 50;
  background: rgba(5, 7, 12, 0.48);
  border: 0;
  padding: 0;
  cursor: pointer;
}
.sidekick-backdrop[hidden] {
  display: none !important;
}
.sidekick-drawer {
  position: fixed;
  top: 52px;
  right: 0;
  bottom: 0;
  width: 380px;
  max-width: min(380px, 100vw);
  z-index: 40;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #121722 0%, #0d1118 100%);
  border-left: 1px solid rgba(212, 175, 55, 0.28);
  box-shadow: -18px 0 40px rgba(0, 0, 0, 0.35);
  transform: translateX(100%);
  transition: transform 0.22s ease;
}
.sidekick-drawer:not([hidden]) {
  transform: translateX(0);
}
.sidekick-drawer[hidden] {
  display: none !important;
}
.sidekick-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem 0.7rem;
  border-bottom: 1px solid var(--line);
}
.sidekick-head h2 {
  margin: 0;
  font-size: 0.98rem;
  color: var(--gold-2);
  font-weight: 650;
}
.sidekick-head .hint {
  margin: 0.25rem 0 0;
  font-size: 0.72rem;
}
.sidekick-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.sidekick-msg {
  max-width: 95%;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  font-size: 0.84rem;
  line-height: 1.45;
  white-space: pre-wrap;
}
.sidekick-msg.user {
  align-self: flex-end;
  background: rgba(212, 175, 55, 0.14);
  border: 1px solid rgba(212, 175, 55, 0.28);
}
.sidekick-msg.assistant {
  align-self: flex-start;
  background: var(--elevated-2);
  border: 1px solid var(--line);
}
.sidekick-msg.pending {
  color: var(--muted);
  font-style: italic;
}
.sidekick-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.45rem 1rem 0.55rem;
  border-top: 1px solid var(--line);
}
.sidekick-pill {
  border: 1px solid rgba(212, 175, 55, 0.35);
  background: rgba(212, 175, 55, 0.08);
  color: var(--champagne);
  border-radius: 999px;
  padding: 0.28rem 0.65rem;
  font-size: 0.7rem;
  cursor: pointer;
  font-family: var(--sans);
}
.sidekick-pill:hover {
  background: rgba(212, 175, 55, 0.16);
}
.sidekick-composer {
  display: flex;
  gap: 0.45rem;
  align-items: flex-end;
  padding: 0.65rem 0.85rem 0.9rem;
  border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.18);
}
.sidekick-composer textarea,
#sidekickInput {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 76px;
  height: 76px;
  max-height: 200px;
  resize: none;
  overflow-y: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.84rem;
  padding: 10px 12px;
  line-height: 1.45;
  box-sizing: border-box;
  align-self: flex-end;
}
.sidekick-composer .btn,
#btnSidekickSend {
  flex: 0 0 auto;
}
/* v17.7 — floating FAB ONLY on wide screens with real right-margin room */
.sidekick-fab {
  display: none;
  position: fixed;
  bottom: 42px;
  right: max(28px, calc((100vw - 1080px) / 2 - 235px));
  z-index: 35;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  min-width: 215px;
  min-height: 58px;
  padding: 12px 20px;
  border-radius: 16px;
  border: 1.5px solid rgba(232, 185, 74, 0.72);
  background:
    linear-gradient(145deg, rgba(232, 185, 74, 0.28), rgba(17, 21, 30, 0.94) 55%),
    rgba(12, 14, 20, 0.92);
  color: var(--champagne);
  cursor: pointer;
  box-shadow:
    0 0 0 1px rgba(212, 175, 55, 0.18),
    0 0 22px rgba(232, 185, 74, 0.28),
    0 12px 32px rgba(0, 0, 0, 0.42);
  font-family: var(--sans);
  text-align: left;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
@media (min-width: 1440px) {
  .sidekick-fab:not([hidden]) {
    display: flex;
  }
}
/* Below 1440px: NEVER float — hide fixed FAB completely */
@media (max-width: 1439px) {
  .sidekick-fab {
    display: none !important;
  }
  /* Highlight topbar Sidekick as the primary launcher on narrow layouts */
  body.sidekick-narrow #btnSidekick {
    box-shadow:
      0 0 0 1px rgba(232, 185, 74, 0.55),
      0 0 14px rgba(232, 185, 74, 0.28);
  }
}
.sidekick-dock-btn {
  display: none;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0.5rem 0.8rem;
  border-radius: 12px;
  border: 1.5px solid rgba(232, 185, 74, 0.65);
  background: linear-gradient(145deg, rgba(232, 185, 74, 0.22), rgba(17, 21, 30, 0.92));
  color: var(--champagne);
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
@media (max-width: 1439px) {
  .sidekick-dock-btn:not([hidden]) {
    display: inline-flex;
  }
}
.sidekick-dock-btn:hover {
  filter: brightness(1.08);
}
.sidekick-fab:hover {
  transform: translateY(-1px);
  box-shadow:
    0 0 0 1px rgba(232, 185, 74, 0.35),
    0 0 28px rgba(232, 185, 74, 0.38),
    0 14px 36px rgba(0, 0, 0, 0.48);
}
.sidekick-fab-title {
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.01em;
}
.sidekick-fab-sub {
  font-size: 11.5px;
  font-weight: 500;
  opacity: 0.82;
  line-height: 1.25;
}
.sidekick-fab[hidden],
.sidekick-dock-btn[hidden] {
  display: none !important;
}
@media (max-width: 820px) {
  .sidekick-drawer {
    width: min(380px, 100vw);
  }
}

/* ═══ v18.0 Sovereign Clearance Gate + Citadel Manager ═══ */
.citadel-gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(900px 520px at 50% 0%, rgba(212,175,55,0.14), transparent 55%),
    linear-gradient(180deg, #07090d 0%, #0b0d11 55%, #050608 100%);
}
.citadel-gate[hidden] { display: none !important; }
.citadel-gate-card {
  width: min(460px, 94vw);
  padding: 2rem 1.6rem 1.5rem;
  border-radius: 20px;
  border: 1px solid rgba(212,175,55,0.35);
  background: linear-gradient(160deg, rgba(22,26,36,0.98), rgba(10,12,18,0.98));
  box-shadow: 0 0 0 1px rgba(212,175,55,0.08), 0 30px 80px rgba(0,0,0,0.55);
  text-align: center;
}
.citadel-seal {
  width: 56px; height: 56px; margin: 0 auto 0.75rem;
  border-radius: 14px;
  display: grid; place-items: center;
  font-weight: 800; letter-spacing: 0.04em;
  color: #0a0c10;
  background: linear-gradient(180deg, #f0d778, #c9a227);
}
.citadel-gate-card h1 {
  margin: 0;
  font-size: 1.55rem;
  letter-spacing: 0.08em;
  color: var(--champagne);
}
.citadel-kicker {
  margin: 0.35rem 0 1.1rem;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: rgba(232,185,74,0.85);
  font-weight: 700;
}
.citadel-tabs {
  display: flex; gap: 6px; margin-bottom: 1rem;
}
.citadel-tab {
  flex: 1;
  border: 1px solid rgba(212,175,55,0.28);
  background: rgba(255,255,255,0.03);
  color: var(--muted);
  border-radius: 10px;
  padding: 0.45rem 0.4rem;
  font-size: 0.68rem;
  font-weight: 650;
  cursor: pointer;
  font-family: var(--sans);
}
.citadel-tab.active {
  color: var(--champagne);
  background: rgba(212,175,55,0.14);
  border-color: rgba(212,175,55,0.55);
}
.citadel-pane[hidden],
.citadel-pane:not(.active) {
  display: none !important;
}
.citadel-pane.active {
  display: block;
}
.citadel-form {
  display: flex; flex-direction: column; gap: 0.65rem; text-align: left;
}
.citadel-form[hidden] {
  display: none !important;
}
.citadel-local-unlock {
  width: 100%;
  margin-top: 0.85rem;
}
.citadel-local-unlock[hidden] {
  display: none !important;
}
.citadel-field {
  margin-bottom: 0.65rem;
  text-align: left;
}
.citadel-field-label {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.citadel-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.4rem;
}
.citadel-chip {
  border: 1px solid rgba(212,175,55,0.35);
  background: rgba(212,175,55,0.08);
  color: var(--champagne);
  border-radius: 999px;
  padding: 0.28rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 650;
  cursor: pointer;
  font-family: var(--sans);
}
.citadel-chip.active {
  background: rgba(212,175,55,0.22);
  border-color: rgba(212,175,55,0.7);
}
.citadel-inline {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.72rem;
  color: var(--muted);
}
.citadel-commander-pass {
  margin-top: 0.85rem;
}
.citadel-form label {
  display: flex; flex-direction: column; gap: 0.28rem;
  font-size: 0.72rem; color: var(--muted); font-weight: 600;
}
.citadel-form input {
  border: 1px solid var(--line);
  background: #0b0d11;
  color: var(--ink);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  font-size: 0.9rem;
  font-family: var(--sans);
}
.citadel-gate-err {
  margin: 0.75rem 0 0;
  color: #ff8f8f;
  font-size: 0.78rem;
}
.citadel-gate-hint { margin-top: 0.9rem; }
body.citadel-locked .app-workspace,
body.citadel-locked .composer-dock,
body.citadel-locked .topbar {
  filter: blur(2px);
  pointer-events: none;
  user-select: none;
}
.citadel-modal-card { max-width: min(920px, 96vw); }
.citadel-actions-row {
  display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.5rem 0 1rem;
}
.citadel-create-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}
@media (max-width: 780px) {
  .citadel-create-grid { grid-template-columns: 1fr; }
}
.citadel-panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.85rem;
  background: var(--elevated);
}
.citadel-panel h3 { margin: 0 0 0.65rem; font-size: 0.9rem; color: var(--gold-2); }
.citadel-panel label {
  display: flex; flex-direction: column; gap: 0.25rem;
  margin-bottom: 0.55rem; font-size: 0.72rem; color: var(--muted);
}
.citadel-panel input, .citadel-panel select {
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
  border-radius: 8px; padding: 0.45rem 0.55rem; font-family: var(--sans);
}
.citadel-issued {
  margin: 0.9rem 0;
  padding: 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(212,175,55,0.4);
  background: rgba(212,175,55,0.08);
}
.citadel-issued code {
  display: block;
  margin: 0.35rem 0 0.55rem;
  font-size: 0.85rem;
  color: var(--champagne);
  word-break: break-all;
}
.citadel-issued input {
  width: 100%;
  margin-bottom: 0.5rem;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
}
.citadel-account-list {
  display: flex; flex-direction: column; gap: 0.55rem;
  max-height: 280px; overflow: auto; margin-bottom: 0.75rem;
}
.citadel-acct {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
  background: var(--elevated-2);
}
.citadel-acct strong { color: var(--champagne); }
.citadel-acct .acct-meta { font-size: 0.72rem; color: var(--muted); margin-top: 0.2rem; }
.citadel-acct .acct-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.45rem; }
