/* Defense Brief — Editorial Executive Design System
   Light-first ivory/slate aesthetic + crisp obsidian dark mode toggle
   Responsive Desktop Split-Pane + Native iPhone Standalone PWA */

:root {
  --bg: #F8F7F4;
  --surface: #FFFFFF;
  --surface-2: #F1EFEA;
  --surface-3: #E8E5DD;
  --border: #E2DFD7;
  --border-strong: #CCC7BA;
  --ink: #141923;
  --ink-2: #3D4657;
  --muted: #667085;

  --navy: #142847;
  --navy-hover: #1D3A66;
  --navy-soft: rgba(20, 40, 71, 0.08);
  --gold: #9A6E24;
  --gold-soft: rgba(154, 110, 36, 0.11);

  --quant: #0F6B5E;
  --quant-soft: rgba(15, 107, 94, 0.10);
  --qual: #2B4C7E;
  --qual-soft: rgba(43, 76, 126, 0.10);
  --spec: #B45309;
  --spec-soft: rgba(180, 83, 9, 0.11);
  --danger: #9B1C1C;
  --danger-soft: rgba(155, 28, 28, 0.10);

  --shadow-sm: 0 1px 2px rgba(17, 28, 45, 0.05);
  --shadow-md: 0 6px 20px rgba(17, 28, 45, 0.07);
  --radius: 12px;
  --radius-sm: 8px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --font-serif: "Iowan Old Style", "Georgia", "Palatino Linotype", "Book Antiqua", serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --sidebar-w: 256px;
  --mobile-header-h: 54px;
  --bottom-nav-h: 64px;
}

[data-theme="dark"] {
  --bg: #0D1117;
  --surface: #151B24;
  --surface-2: #1C2431;
  --surface-3: #252F40;
  --border: #273142;
  --border-strong: #39475F;
  --ink: #EEF2F7;
  --ink-2: #C2CAD8;
  --muted: #8B96AA;

  --navy: #6CA0EE;
  --navy-hover: #89B4F4;
  --navy-soft: rgba(108, 160, 238, 0.14);
  --gold: #E5B96B;
  --gold-soft: rgba(229, 185, 107, 0.14);

  --quant: #34D399;
  --quant-soft: rgba(52, 211, 153, 0.13);
  --qual: #7AA7F0;
  --qual-soft: rgba(122, 167, 240, 0.13);
  --spec: #FBBF24;
  --spec-soft: rgba(251, 191, 36, 0.14);
  --danger: #F87171;
  --danger-soft: rgba(248, 113, 113, 0.14);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.42);
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}

/* App Shell */
.app-shell {
  display: flex;
  min-height: 100dvh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  position: sticky;
  top: 0;
  height: 100dvh;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 6px 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}

.brand-icon { width: 36px; height: 36px; border-radius: 9px; flex-shrink: 0; }
.brand-icon-sm { width: 26px; height: 26px; border-radius: 6px; }
.brand-title { font-family: var(--font-serif); font-weight: 700; font-size: 17px; letter-spacing: -0.01em; line-height: 1.15; }
.brand-title-sm { font-family: var(--font-serif); font-weight: 700; font-size: 16px; }
.brand-sub { font-size: 11.5px; color: var(--muted); }

.nav-list { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-btn {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: background 0.14s, color 0.14s;
}
.nav-btn:hover { background: var(--surface-2); color: var(--ink); }
.nav-btn.active { background: var(--navy-soft); color: var(--navy); font-weight: 600; }
.nav-glyph { font-size: 13px; width: 16px; text-align: center; opacity: 0.85; }

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.sidebar-focus-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
}
.sidebar-focus-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.status-meta-row { display: flex; gap: 6px; flex-wrap: wrap; }
.status-pill {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 99px;
  letter-spacing: 0.02em;
}
.status-pill.online { background: var(--quant-soft); color: var(--quant); }
.status-pill.offline { background: var(--spec-soft); color: var(--spec); }
.status-pill.muted { background: var(--surface-2); color: var(--muted); }

.offline-mini { display: flex; flex-direction: column; gap: 4px; }
.offline-mini-head { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.cache-track { height: 5px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.cache-fill { height: 100%; background: var(--navy); border-radius: 99px; transition: width 0.25s; }

.sidebar-actions { display: flex; gap: 6px; }
.sidebar-actions button { flex: 1; }

/* Mobile Header & Bottom Nav */
.mobile-header, .bottom-nav { display: none; }

.main-view {
  flex: 1;
  min-width: 0;
  padding: 24px 28px 40px;
  max-width: 1260px;
  width: 100%;
  margin: 0 auto;
}

/* Typography & Utilities */
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.015em; line-height: 1.25; }
h1 { font-family: var(--font-serif); font-size: 26px; font-weight: 700; }
h2 { font-family: var(--font-serif); font-size: 21px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 650; }
h4 { font-size: 14px; font-weight: 650; }
p { margin: 0; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}
.mono { font-family: var(--font-mono); }
.muted-text { color: var(--muted); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11.5px; }

.stack-xs { display: flex; flex-direction: column; gap: 6px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.stack-md { display: flex; flex-direction: column; gap: 16px; }
.stack-lg { display: flex; flex-direction: column; gap: 22px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.row-gap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Page Header & Subtabs */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}

.subtabs {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 3px;
  gap: 3px;
  flex-wrap: wrap;
}
.subtab-btn {
  border: none;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.14s;
}
.subtab-btn.active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.card-subtle {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 15px;
}
.card-clickable { cursor: pointer; transition: border-color 0.14s, transform 0.12s; }
.card-clickable:hover { border-color: var(--navy); }

/* Badges & Lenses */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 5px;
  white-space: nowrap;
}
.badge-pillar { background: var(--navy-soft); color: var(--navy); }
.badge-quant { background: var(--quant-soft); color: var(--quant); }
.badge-qual { background: var(--qual-soft); color: var(--qual); }
.badge-spec { background: var(--spec-soft); color: var(--spec); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-gold { background: var(--gold-soft); color: var(--gold); }
.badge-muted { background: var(--surface-2); color: var(--muted); }

/* Buttons */
button { font-family: inherit; }
.btn-primary, .btn-secondary, .btn-ghost, .btn-danger-ghost, .chip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 14px;
  cursor: pointer;
  transition: all 0.14s;
  border: 1px solid transparent;
}
.btn-primary { background: var(--navy); color: #FFFFFF; }
[data-theme="dark"] .btn-primary { color: #0A101A; }
.btn-primary:hover:not(:disabled) { background: var(--navy-hover); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { border-color: var(--navy); color: var(--navy); }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: var(--danger-soft); }
.btn-danger-ghost:hover:not(:disabled) { background: var(--danger-soft); }
.btn-sm { padding: 6px 10px; font-size: 12.5px; }
.btn-xs { padding: 4px 8px; font-size: 11.5px; }
.btn-full { width: 100%; }
button:disabled { opacity: 0.52; cursor: not-allowed; }

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}
.icon-btn:hover { background: var(--surface-2); }

.chip-btn {
  padding: 5px 11px;
  font-size: 12.5px;
  font-weight: 500;
  background: var(--surface);
  border-color: var(--border);
  color: var(--ink-2);
  border-radius: 99px;
}
.chip-btn:hover { border-color: var(--navy); color: var(--navy); background: var(--navy-soft); }
.chip-btn.active { background: var(--navy); color: #FFF; border-color: var(--navy); }
[data-theme="dark"] .chip-btn.active { color: #0A101A; }

/* Inputs */
input[type="text"], input[type="password"], input[type="url"], textarea, select {
  width: 100%;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.5;
  transition: border-color 0.14s, box-shadow 0.14s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px var(--navy-soft);
}
textarea { resize: vertical; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }

/* Chat & Coach Thread */
.coach-layout {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 140px);
  min-height: 500px;
}

.focus-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 12px;
}

.chat-stream {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 2px 16px;
}

.msg-row { display: flex; flex-direction: column; max-width: 840px; }
.msg-row.user { align-self: flex-end; align-items: flex-end; width: 100%; }
.msg-row.coach { align-self: flex-start; align-items: flex-start; width: 100%; }

.msg-bubble {
  border-radius: var(--radius);
  padding: 13px 16px;
  font-size: 14.5px;
  line-height: 1.6;
  max-width: 100%;
}
.msg-row.user .msg-bubble {
  background: var(--navy);
  color: #FFFFFF;
  max-width: 82%;
  border-bottom-right-radius: 4px;
}
[data-theme="dark"] .msg-row.user .msg-bubble { color: #0B121E; font-weight: 500; }

.msg-row.coach .msg-bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink);
  width: 100%;
  box-shadow: var(--shadow-sm);
  border-bottom-left-radius: 4px;
}

.msg-meta {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.prose p + p { margin-top: 10px; }
.prose ul, .prose ol { margin: 8px 0 8px 18px; padding: 0; }
.prose li { margin-bottom: 4px; }
.prose strong { font-weight: 680; }
.prose code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 4px;
}

/* Pushback & Spoken Critique Boxes */
.pushback-box {
  margin-top: 10px;
  background: var(--danger-soft);
  border: 1px solid rgba(155, 28, 28, 0.25);
  border-left: 3px solid var(--danger);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 13.5px;
}
.spoken-critique-box {
  margin-top: 10px;
  background: var(--gold-soft);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
}
.whisper-box {
  margin-top: 10px;
  background: var(--surface-2);
  border-left: 3px solid var(--navy);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
}

/* Agent Action Cards inside Chat */
.action-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 8px;
  margin-top: 12px;
  width: 100%;
}
.action-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.14s;
  color: var(--ink);
}
.action-card:hover { border-color: var(--navy); background: var(--navy-soft); }
.action-card-title { font-size: 13px; font-weight: 650; color: var(--navy); }
.action-card-detail { font-size: 12px; color: var(--muted); line-height: 1.4; }
.action-card.passive { cursor: default; }
.action-card.passive:hover { border-color: var(--border-strong); background: var(--surface-2); }

/* Composer */
.composer {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}
.composer-row { display: flex; align-items: flex-end; gap: 8px; }
.composer textarea {
  border: none;
  box-shadow: none !important;
  padding: 6px 8px;
  min-height: 44px;
  max-height: 150px;
  background: transparent;
}
.mic-btn {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 99px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.14s;
}
.mic-btn:hover { border-color: var(--navy); }
.mic-btn.recording {
  background: var(--danger);
  border-color: var(--danger);
  color: #FFF;
  animation: pulse 1.2s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(155, 28, 28, 0.45); }
  50% { box-shadow: 0 0 0 8px rgba(155, 28, 28, 0); }
}

/* Split-Pane Layouts (Laptop Writing Studio & Intel Reader) */
.split-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: start;
}
.split-grid-wide {
  display: grid;
  grid-template-columns: 330px 1fr;
  gap: 18px;
  align-items: start;
}

/* Lens Cards (Quantitative / Qualitative / Speculative) */
.lens-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.lens-card {
  border-radius: var(--radius-sm);
  padding: 14px 15px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lens-card.quant { border-top: 3px solid var(--quant); }
.lens-card.qual { border-top: 3px solid var(--qual); }
.lens-card.spec { border-top: 3px solid var(--spec); background: var(--spec-soft); }
.lens-list { margin: 0 0 0 16px; padding: 0; font-size: 13.5px; display: flex; flex-direction: column; gap: 6px; }

/* Talk-the-Talk Compare Cards */
.ttt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 12px;
}
.ttt-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.ttt-amateur {
  background: var(--danger-soft);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
}
.ttt-insider {
  background: var(--quant-soft);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 500;
}

/* Line-Level Essay Upgrades */
.upgrade-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.upgrade-before { color: var(--danger); font-size: 13px; text-decoration: line-through; opacity: 0.88; }
.upgrade-after { color: var(--quant); font-size: 13.5px; font-weight: 600; }

/* Pillar Dossier Cards */
.pillar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 12px;
}

/* Reader Mode Typography */
.reader-body {
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.72;
  color: var(--ink);
  max-width: 72ch;
}
.reader-body h2 { font-size: 19px; margin: 18px 0 8px; }
.reader-body p + p { margin-top: 13px; }

/* Source Links */
.source-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.source-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--navy);
  background: var(--navy-soft);
  padding: 4px 9px;
  border-radius: 6px;
  text-decoration: none;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-link:hover { text-decoration: underline; }

/* Modals & Toast */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 25, 0.58);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 100;
}
.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  width: 100%;
  max-width: 500px;
  max-height: 90dvh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
}
.modal-sm { max-width: 400px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.auth-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }

.error-banner {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(155, 28, 28, 0.25);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #141923;
  color: #F8F7F4;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  z-index: 150;
  max-width: 380px;
}
[data-theme="dark"] .toast { background: #EEF2F7; color: #0D1117; }

.hidden { display: none !important; }

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 64px 20px;
  color: var(--muted);
}
.spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid var(--border-strong);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Flip Card Drill */
.flip-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 24px;
  max-width: 640px;
  margin: 0 auto;
  box-shadow: var(--shadow-md);
}

/* Responsive Breakpoints (iPhone & Tablet) */
@media (max-width: 960px) {
  .split-grid, .split-grid-wide, .lens-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .sidebar { display: none; }

  .app-shell { flex-direction: column; }

  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 30;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: calc(env(safe-area-inset-top, 0px) + 8px) 14px 8px;
  }
  .mobile-brand { display: flex; align-items: center; gap: 8px; }
  .mobile-header-actions { display: flex; gap: 6px; }

  .main-view {
    padding: 14px 14px calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px) + 20px);
  }

  .coach-layout {
    height: calc(100dvh - 180px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    min-height: 420px;
  }

  .bottom-nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 40;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 6px 6px calc(env(safe-area-inset-bottom, 0px) + 6px);
  }
  .bnav-btn {
    border: none;
    background: transparent;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 11px;
    font-weight: 600;
    padding: 5px 4px;
    border-radius: 8px;
    cursor: pointer;
  }
  .bnav-btn.active { color: var(--navy); background: var(--navy-soft); }
  .bnav-glyph { font-size: 15px; line-height: 1.1; }

  .toast {
    bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px) + 12px);
    left: 14px;
    right: 14px;
    max-width: none;
  }

  .msg-row.user .msg-bubble { max-width: 92%; }
}
