/* ============================================================
   Ghost Biographer — Shared Design System
   Tokens + component classes used by every page template.
   Adapted from docs/design/styles.css (Claude Design, v0.7)
   ============================================================ */

/* ── Design tokens ──────────────────────────────────────────── */
:root {
  /* Paper / ink — cool off-white with subtle violet undertone */
  --paper:     oklch(0.985 0.004 290);   /* page background */
  --paper-2:   oklch(0.965 0.006 290);   /* sunken surfaces, sidebar */
  --paper-3:   oklch(0.935 0.01  290);   /* chips, hover states */
  --ink:       oklch(0.18  0.025 285);   /* primary text */
  --ink-2:     oklch(0.36  0.02  285);   /* secondary text */
  --ink-3:     oklch(0.54  0.02  285);   /* tertiary, icons */
  --ink-4:     oklch(0.72  0.015 285);   /* placeholders */
  --hairline:  oklch(0.89  0.01  290);   /* light borders */
  --hairline-2:oklch(0.82  0.015 290);   /* input borders */

  /* Brand accent — plum/violet */
  --plum:      oklch(0.5   0.17  295);   /* primary brand */
  --plum-2:    oklch(0.64  0.16  295);   /* hover */
  --plum-3:    oklch(0.78  0.1   295);   /* subtle */
  --plum-bg:   oklch(0.96  0.025 295);   /* plum-tinted surface */
  --plum-ink:  oklch(0.32  0.14  295);   /* text on plum-bg */

  /* Trust / success — sage */
  --sage:      oklch(0.58  0.06  185);
  --sage-bg:   oklch(0.95  0.02  185);

  /* Legacy / amber — warm emphasis */
  --terra:     oklch(0.56  0.13  55);
  --terra-2:   oklch(0.72  0.1   55);
  --terra-bg:  oklch(0.96  0.03  55);

  /* Status */
  --gold:      oklch(0.78  0.1   85);
  --rose:      oklch(0.58  0.15  20);    /* warning / danger */
  --rose-bg:   oklch(0.96  0.025 20);

  /* Shape */
  --radius-sm: 8px;
  --radius:    14px;
  --radius-lg: 20px;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(50,40,30,0.04), 0 1px 1px rgba(50,40,30,0.03);
  --shadow:    0 1px 2px rgba(50,40,30,0.05), 0 8px 24px rgba(50,40,30,0.06);
  --shadow-lg: 0 2px 6px rgba(50,40,30,0.06), 0 24px 48px rgba(50,40,30,0.10);

  /* Typography */
  --font-ui:       "Geist", ui-sans-serif, -apple-system, "Segoe UI", system-ui, sans-serif;
  --font-editorial:"Newsreader", "Iowan Old Style", Georgia, serif;
  --font-mono:     "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;

  /* Shell geometry */
  --shell-header-h: 72px;
  --shell-sidebar-w: 260px;
  --shell-max-w: 1400px;
  --shell-pad: 32px;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-ui);
  background: var(--paper-2);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
  font-size: 15px;
  line-height: 1.5;
}
button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
/* font-size:16px prevents iOS Safari from auto-zooming the viewport on
   input focus (any value below 16px triggers the zoom). iOS audit HIGH-1
   2026-05-29. font-size:inherit would inherit the body's 15px which
   triggers the zoom — explicit 16px is the correct fix. */
input, select, textarea { font-family: inherit; font-size: 16px; color: inherit; }
a { color: inherit; text-decoration: none; }

/* ── App shell header (72px sticky top bar) ─────────────────── */
.app-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--shell-header-h);
  background: var(--paper);
  border-bottom: 1px solid var(--hairline);
  display: flex; align-items: center;
  padding: 0 var(--shell-pad);
  gap: 24px;
}
.app-header-logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; flex-shrink: 0;
}
.app-header-logo-img { height: 36px; width: 36px; object-fit: contain; }
.app-header-logo-name {
  font-family: var(--font-editorial);
  font-size: 18px;
  font-weight: 400;
  color: var(--ink);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.app-header-logo-name span { color: var(--plum); }
.app-header-nav {
  display: flex; align-items: center; gap: 4px;
  flex: 1;
}
.app-header-nav-link {
  display: inline-flex; align-items: center;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  transition: background 120ms, color 120ms;
  min-height: 40px; white-space: nowrap;
}
.app-header-nav-link:hover { background: var(--paper-3); color: var(--ink); }
.app-header-nav-link[data-active="true"] {
  color: var(--plum);
  background: var(--plum-bg);
}
.app-header-actions {
  display: flex; align-items: center; gap: 8px;
  margin-left: auto; flex-shrink: 0;
}
.app-header-user {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; color: var(--ink-2);
}
.app-header-avatar {
  width: 36px; height: 36px;
  border-radius: 999px;
  background: var(--plum-bg);
  color: var(--plum-ink);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
  flex-shrink: 0;
}

/* Dev header variant */
.app-header-dev { background: oklch(0.12 0.03 285); border-bottom-color: oklch(0.22 0.04 285); }
.app-header-dev .app-header-logo-name { color: oklch(0.85 0.02 285); }
.app-header-dev .app-header-nav-link { color: oklch(0.55 0.03 285); }
.app-header-dev .app-header-nav-link:hover { background: oklch(0.18 0.03 285); color: oklch(0.85 0.02 285); }
.app-header-dev .app-header-nav-link[data-active="true"] { background: oklch(0.2 0.04 285); color: oklch(0.75 0.08 295); }

/* ── Page content wrapper ───────────────────────────────────── */
.page-body {
  max-width: var(--shell-max-w);
  margin: 0 auto;
  padding: 32px var(--shell-pad);
}
.page-body-full { max-width: none; padding: 0; }

/* ── Typography ─────────────────────────────────────────────── */
.h1 {
  font-family: var(--font-editorial);
  font-weight: 400; font-size: 40px;
  line-height: 1.1; letter-spacing: -0.02em;
  margin: 0; color: var(--ink);
}
.h2 {
  font-family: var(--font-editorial);
  font-weight: 400; font-size: 28px;
  line-height: 1.2; letter-spacing: -0.015em;
  margin: 0;
}
.h3 { font-weight: 600; font-size: 18px; letter-spacing: -0.005em; margin: 0; }
.small { font-size: 13px; color: var(--ink-3); }
.mono-label {
  font-family: var(--font-mono);
  font-size: 11px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.08em;
}

/* ── Card ───────────────────────────────────────────────────── */
.card {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 24px; }
.card-title {
  font-size: 13px; font-weight: 500;
  color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin: 0 0 12px;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 14px; font-weight: 500;
  min-height: 48px;
  transition: transform 80ms, background 120ms, border-color 120ms;
  border: 1px solid transparent;
  white-space: nowrap; cursor: pointer;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: oklch(0.28 0.012 60); }

.btn-secondary {
  background: var(--paper); color: var(--ink);
  border-color: var(--hairline-2);
}
.btn-secondary:hover { background: var(--paper-2); border-color: var(--ink-4); }

.btn-ghost { color: var(--ink-2); padding: 8px 10px; min-height: 40px; }
.btn-ghost:hover { background: var(--paper-3); }

.btn-plum { background: var(--plum); color: white; }
.btn-plum:hover { background: oklch(0.44 0.18 295); }

.btn-terra { background: var(--terra); color: white; }
.btn-terra:hover { background: oklch(0.5 0.14 55); }

.btn-danger { color: var(--rose); }
.btn-danger:hover { background: var(--rose-bg); }

.btn-sm { padding: 8px 12px; min-height: 36px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 16px 28px; font-size: 16px; border-radius: 12px; }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 500;
  background: var(--paper-3); color: var(--ink-2);
  border: 1px solid var(--hairline);
}
.badge-active {
  background: var(--plum-bg); color: var(--plum-ink);
  border-color: oklch(0.86 0.04 295);
}
.badge-active .badge-dot { background: var(--plum); }
.badge-success {
  background: var(--sage-bg); color: var(--sage);
  border-color: oklch(0.82 0.04 185);
}
.badge-warn {
  background: var(--terra-bg); color: var(--terra);
  border-color: oklch(0.84 0.05 55);
}
.badge-danger {
  background: var(--rose-bg); color: var(--rose);
  border-color: oklch(0.84 0.05 20);
}
.badge-dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }

/* ── Form fields ────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.input, .select, .textarea {
  background: var(--paper);
  border: 1px solid var(--hairline-2);
  border-radius: 10px;
  padding: 12px 14px;
  min-height: 48px;
  transition: border-color 120ms, box-shadow 120ms;
  width: 100%; color: var(--ink);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--plum);
  box-shadow: 0 0 0 3px oklch(0.78 0.12 295 / 0.35);
}
.textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--ink-4); }

/* ── Toggle ─────────────────────────────────────────────────── */
.toggle {
  position: relative; width: 44px; height: 26px;
  background: var(--hairline-2); border-radius: 999px;
  transition: background 160ms; flex-shrink: 0; cursor: pointer;
}
.toggle[data-on="true"] { background: var(--plum); }
.toggle::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px;
  background: white; border-radius: 999px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  transition: left 160ms;
}
.toggle[data-on="true"]::after { left: 21px; }

/* ── Radio card ─────────────────────────────────────────────── */
.radio-card {
  display: flex; gap: 14px; padding: 18px;
  border: 1px solid var(--hairline); border-radius: var(--radius);
  background: var(--paper); cursor: pointer;
  transition: border-color 120ms, background 120ms;
}
.radio-card:hover { border-color: var(--ink-4); }
.radio-card[data-selected="true"] {
  border-color: var(--plum); background: var(--plum-bg);
  box-shadow: 0 0 0 1px var(--plum);
}
.radio-dot {
  flex-shrink: 0; width: 20px; height: 20px;
  border-radius: 999px; border: 1px solid var(--hairline-2);
  margin-top: 2px;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper);
}
.radio-card[data-selected="true"] .radio-dot { border-color: var(--plum); }
.radio-card[data-selected="true"] .radio-dot::after {
  content: ""; width: 10px; height: 10px;
  border-radius: 999px; background: var(--plum);
}

/* ── Checkbox ───────────────────────────────────────────────── */
.check-box {
  flex-shrink: 0; width: 22px; height: 22px;
  border-radius: 6px; border: 1px solid var(--hairline-2);
  background: var(--paper);
  display: flex; align-items: center; justify-content: center;
  margin-top: 1px;
}
.check-box[data-on="true"] { background: var(--plum); border-color: var(--plum); color: white; }

/* ── Table ──────────────────────────────────────────────────── */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-weight: 500; font-size: 12px;
  color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em;
  padding: 10px 14px; border-bottom: 1px solid var(--hairline);
}
.tbl td {
  padding: 14px; border-bottom: 1px solid var(--hairline);
  font-size: 14px; vertical-align: middle;
}
.tbl tr:last-child td { border-bottom: 0; }

/* ── Divider ────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--hairline); border: 0; margin: 0; }

/* ── Modal ──────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(30,25,20,0.35);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  animation: gb-fadeIn 180ms ease-out;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--paper); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 520px; width: calc(100% - 48px);
  max-height: calc(100vh - 80px); overflow: auto;
  animation: gb-slideUp 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.modal-lg { max-width: 720px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 24px 0;
}
.modal-body { padding: 20px 24px 24px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 0 24px 24px;
}
.modal-close {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-3); font-size: 18px; line-height: 1;
  transition: background 120ms;
}
.modal-close:hover { background: var(--paper-3); color: var(--ink); }

/* ── Sidebar nav ────────────────────────────────────────────── */
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 10px;
  font-size: 14px; font-weight: 500;
  color: var(--ink-2); cursor: pointer;
  transition: background 120ms, color 120ms;
  min-height: 44px; width: 100%; text-align: left;
  text-decoration: none;
}
.nav-item:hover { background: var(--paper-3); color: var(--ink); }
.nav-item[data-active="true"] { background: var(--ink); color: var(--paper); }
.nav-item[data-active="true"] .nav-icon { color: var(--paper); }
.nav-icon { width: 18px; height: 18px; color: var(--ink-3); flex-shrink: 0; }
.nav-group-label {
  font-size: 11px; font-weight: 500; color: var(--ink-4);
  text-transform: uppercase; letter-spacing: 0.1em;
  padding: 10px 14px 6px;
}

/* ── Tab nav ────────────────────────────────────────────────── */
.tab-bar {
  display: flex; align-items: stretch; gap: 0;
  border-bottom: 1px solid var(--hairline);
  overflow-x: auto;
}
.tab-item {
  padding: 14px 18px;
  font-size: 14px; font-weight: 500; color: var(--ink-3);
  position: relative; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 48px; cursor: pointer;
  text-decoration: none; flex-shrink: 0;
  transition: color 120ms;
}
.tab-item:hover { color: var(--ink); }
.tab-item[data-active="true"] { color: var(--ink); }
.tab-item[data-active="true"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px;
  height: 2px; background: var(--plum);
}

/* ── Status / service chip ──────────────────────────────────── */
.svc-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px;
  font-size: 13px; color: var(--ink-3);
  background: var(--paper); border: 1px solid var(--hairline);
}
.svc-chip .chip-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--hairline-2); flex-shrink: 0;
}
.svc-chip[data-status="up"] { color: var(--ink-2); }
.svc-chip[data-status="up"] .chip-dot { background: var(--sage); }
.svc-chip[data-status="warn"] .chip-dot { background: var(--terra); }
.svc-chip[data-status="error"] .chip-dot { background: var(--rose); }

/* ── Legacy / hero surfaces ─────────────────────────────────── */
.legacy-hero {
  background:
    radial-gradient(ellipse 80% 120% at 100% 0%, oklch(0.95 0.04 295) 0%, transparent 55%),
    radial-gradient(ellipse 60% 100% at 0% 100%, oklch(0.96 0.03 55) 0%, transparent 55%),
    var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg); padding: 40px 44px;
  position: relative; overflow: hidden;
}
.legacy-hero::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--plum) 20%, var(--terra) 80%, transparent);
  opacity: 0.6;
}

/* Dark plum hero surface (biographer bar, dark panels) */
.plum-dark {
  background:
    radial-gradient(ellipse 80% 100% at 70% -20%, oklch(0.38 0.2 295) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 10% 120%, oklch(0.3 0.12 300) 0%, transparent 60%),
    oklch(0.14 0.04 290);
  color: oklch(0.96 0.01 290);
}

/* ── Animations ─────────────────────────────────────────────── */
@keyframes gb-fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes gb-slideUp {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}
@keyframes gb-sectionIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0);   }
}
.section-in { animation: gb-sectionIn 240ms ease-out; }

/* ── Utilities ──────────────────────────────────────────────── */
.hstack { display: flex; align-items: center; }
.vstack { display: flex; flex-direction: column; }
.gap-4  { gap: 4px;  } .gap-6  { gap: 6px;  } .gap-8  { gap: 8px;  }
.gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-20 { gap: 20px; }
.gap-24 { gap: 24px; } .gap-32 { gap: 32px; }
.grow { flex: 1 1 auto; }
.shrink-0 { flex-shrink: 0; }
.center { display: flex; align-items: center; justify-content: center; }

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--hairline-2); border-radius: 999px;
  border: 2px solid var(--paper-2);
}
::-webkit-scrollbar-thumb:hover { background: var(--ink-4); }

/* ── Placeholder image (avatar / photo slots) ───────────────── */
.placeholder {
  background: repeating-linear-gradient(
    -45deg,
    oklch(0.9 0.008 70) 0 10px,
    oklch(0.93 0.006 70) 10px 20px
  );
  color: var(--ink-3);
  font-family: var(--font-mono); font-size: 10px;
  display: flex; align-items: center; justify-content: center;
  text-transform: uppercase; letter-spacing: 0.08em;
  border-radius: var(--radius-sm);
}

/* ── Biographer bar (shared — dark overlay on every page) ──── */
:root { --bio-h: 260px; }
#bio-panel {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  background: #1e293b; border-top: 2px solid #7c3aed;
  display: flex; flex-direction: column;
  /* Extend the panel through the iOS home-indicator safe-area so the page
     background doesn't show as a white strip below the dark panel on iPad
     Pro / iPhone Safari. Skip 2026-05-07 23:53 (Memory Lens): "the bottom
     of the screen is 1/4 white, below the biographer section." */
  height: calc(var(--bio-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  transform: translateY(100%);
  transition: transform .25s ease;
}
#bio-panel.open { transform: translateY(0); }
#bio-messages {
  flex: 1; overflow-y: auto; padding: .75rem 1rem; display: flex;
  flex-direction: column; gap: .6rem; min-height: 0;
}
.bio-msg { display: flex; gap: .5rem; align-items: flex-start; }
.bio-msg.user { flex-direction: row-reverse; }
.bio-bubble {
  max-width: 82%; padding: .6rem .9rem; border-radius: 8px;
  font-size: 1.1rem; line-height: 1.5; word-break: break-word;
}
.bio-msg.user .bio-bubble { background: #7c3aed; color: #fff; }
.bio-msg.assistant .bio-bubble { background: #273349; color: #e2e8f0; }
.bio-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; background: #273349; color: #94a3b8;
}
.bio-msg.assistant .bio-avatar { background: #7c3aed; color: #fff; }
.bio-page-sep {
  align-self: center; font-size: .7rem; color: #94a3b8;
  background: #1e293b; border: 1px solid #334155;
  border-radius: 99px; padding: .15rem .75rem; margin: .15rem 0;
  flex-shrink: 0; pointer-events: none;
}
#bio-input-row {
  display: flex; align-items: center; gap: .45rem;
  padding: .5rem .6rem; border-top: 1px solid #334155; flex-shrink: 0;
}
#bio-studio {
  display: none; align-items: center; gap: .38rem;
  background: #1a0505; border: 1px solid #7f1d1d; border-radius: 99px;
  padding: .22rem .65rem; flex-shrink: 0;
}
#bio-studio.active { display: flex; }
.bio-studio-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #ef4444;
  animation: bio-blink 1.4s ease-in-out infinite; flex-shrink: 0;
}
.bio-studio-label {
  font-size: .68rem; font-weight: 700; color: #ef4444;
  letter-spacing: .08em; text-transform: uppercase; white-space: nowrap;
}
/* Live mic-level meter — 8 bars that light up as voice amplitude rises.
   Bars 1-3 = green, 4-6 = lime, 7-8 = amber. Each bar gets an `.on`
   class via JS when the current amplitude level exceeds that bar's
   threshold. Hidden by default; shown alongside the On Air dot. */
.bio-mic-meter {
  display: inline-flex; align-items: flex-end; gap: 2px;
  margin-left: .4rem; height: 14px;
}
.bio-mic-meter > span {
  width: 3px; height: 4px; background: rgba(239,68,68,.25);
  border-radius: 1px; transition: background .08s, height .08s;
}
.bio-mic-meter > span.on { background: #22c55e; height: 6px; }
.bio-mic-meter > span:nth-child(n+4).on { background: #84cc16; height: 9px; }
.bio-mic-meter > span:nth-child(n+7).on { background: #f59e0b; height: 13px; }
@keyframes bio-blink { 0%,100% { opacity:1; } 50% { opacity:.45; } }
.bio-text-wrap {
  flex: 1; position: relative; display: flex; align-items: center; min-width: 0;
}
#bio-text {
  width: 100%; background: #273349; border: 1px solid #334155;
  border-radius: 8px; color: #e2e8f0;
  padding: .5rem 2.6rem .5rem .75rem;
  font-size: 1rem; outline: none; resize: none; height: 42px;
  font-family: inherit;
}
#bio-text:focus { border-color: #7c3aed; }
#bio-send-btn {
  position: absolute; right: .35rem; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; border-radius: 50%;
  background: #7c3aed; color: #fff; border: none;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: .85rem; transition: background .15s;
}
#bio-send-btn:hover { background: #a78bfa; }
#bio-mic-btn {
  /* Sized larger than other bar controls — primary action for elderly users.
     Apple HIG minimum touch target is 44px; we go to 56px height + 96px
     width with a 2px green outline so the mic stands out as THE control to
     reach for. (Skip 2026-04-14 ×3: "The microphone button is hard to find
     on my iPad. It should be bigger.") */
  width: 96px; height: 56px; border-radius: 99px;
  background: #273349; color: #e2e8f0; border: 2px solid #4a5d7a;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 1.7rem; transition: background .15s, border-color .15s; flex-shrink: 0;
}
#bio-mic-btn:not(.muted):not(.recording) {
  border-color: #22c55e;
  box-shadow: 0 0 0 1px rgba(34,197,94,0.25);
}
#bio-mic-btn.recording {
  background: #dc2626; color: #fff; border-color: #dc2626;
  animation: bio-blink 1s infinite;
}
#bio-voice-btn, #bio-collapse-btn {
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  font-size: 1.05rem; transition: background .15s; border: none;
}
#bio-voice-btn { background: #1e3a5f; color: #93c5fd; border: 1px solid #3b82f6; }
#bio-voice-btn.muted { background: #273349; color: #94a3b8; border: 1px solid #334155; }
#bio-collapse-btn { background: #273349; color: #94a3b8; border: 1px solid #334155; font-size: .85rem; }
#bio-collapse-btn:hover { color: #e2e8f0; }
#bio-unlock-btn {
  padding: 0 12px; height: 40px; border-radius: 20px; cursor: pointer; flex-shrink: 0;
  background: #7c3aed; color: #fff; border: none; font-size: .85rem; white-space: nowrap;
  animation: bio-blink 1.2s infinite;
}
#bio-tab {
  position: fixed; bottom: 0; right: 1.5rem; z-index: 49;
  background: #7c3aed; color: #fff; border: none;
  border-radius: 8px 8px 0 0;
  padding: .4rem 1rem; font-size: .8rem; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; gap: .4rem; transition: background .15s;
}
#bio-tab:hover { background: #a78bfa; }
#bio-tab.hidden { display: none; }
.bio-scroll-target { transition: padding-bottom .25s; }
.bio-scroll-target.bio-open { padding-bottom: var(--bio-h) !important; }
/* Pages with flex/height layouts respond to bar open/close via body class */
body.bio-bar-open .bio-height-target { height: calc(100vh - var(--bio-h)) !important; max-height: calc(100vh - var(--bio-h)) !important; }
/* Opt-in fallback for pages where the body itself owns the scroll container
   (height: 100vh / 100dvh + flex children). Tag <body class="bio-shell"> on
   those pages and the body shrinks when the bar is open so flex children
   stay visible above the bar. Skip 2026-04-26 "minimize doesn't make the
   screen bigger." Subtracts the bar height + the iOS safe-area-inset-bottom
   so flex children clear the home-indicator strip on iPad Pro Safari too. */
body.bio-shell {
  transition: height .25s ease, max-height .25s ease;
}
body.bio-shell.bio-bar-open {
  height:     calc(100dvh - var(--bio-h) - env(safe-area-inset-bottom, 0px)) !important;
  max-height: calc(100dvh - var(--bio-h) - env(safe-area-inset-bottom, 0px)) !important;
}
