/* Poimens — Sermon Studio. One hand-written stylesheet: no preprocessor,
   no build step, no external assets. Sections:
   01 tokens · 02 dark · 03 base · 04 icons · 05 layout · 06 buttons · 07 forms
   08 badges · 09 cards · 10 shell · 11 topbar · 12 landing · 13 toasts · 14 modals
   15 empty/loading · 16 library · 17 voice · 18 sermons · 19 report · 20 bible
   21 series/calendar · 22 utilities · 23 responsive · 24 touch/phones
   25 printing · 26 motion */

/* ===== 01. Design tokens (light) ===== */
:root {
  color-scheme: light;
  /* Surfaces */
  --bg: #f5f6f8; --surface: #ffffff; --surface-2: #fafbfc; --surface-3: #f0f2f5;
  /* Text */
  --text: #161c26; --text-soft: #3f4a5c; --muted: #6a7686; --muted-2: #98a2b1;
  /* Lines */
  --border: #e5e8ed; --border-strong: #d2d8e0;
  /* Accent — used sparingly */
  --accent: #4f46e5; --accent-strong: #4338ca; --accent-ink: #4338ca; --accent-soft: #eef1fe;
  --accent-ring: rgba(79, 70, 229, 0.28); --on-accent: #ffffff;
  /* Status tones */
  --ok: #12805c; --ok-ink: #0f6b4d; --ok-soft: #e8f6f0; --ok-border: #bce3d3; --warn: #b06a06; --warn-ink: #8f5605;
  --warn-soft: #fdf4e5; --warn-border: #efdcb6; --err: #c0392b; --err-ink: #a92c1f; --err-soft: #fdeeec;
  --err-border: #f2cbc5; --info: #1e63c4; --info-ink: #17539f; --info-soft: #ebf2fd; --info-border: #c7daf6;
  /* Corpus pairing: research (blue) vs sermons (violet) */
  --research: #2563eb; --research-ink: #1d4ed8; --research-soft: #eaf1fe; --research-border: #c9dbfb;
  --sermon: #7c3aed; --sermon-ink: #6d28d9; --sermon-soft: #f3edfe; --sermon-border: #ded0fb;
  /* Elevation & radii */
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05); --shadow: 0 6px 16px -6px rgba(16, 24, 40, 0.14);
  --shadow-lg: 0 18px 44px -18px rgba(16, 24, 40, 0.32); --radius-sm: 8px; --radius: 10px; --radius-lg: 14px;
  /* Type */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sidebar-w: 252px; --topbar-h: 65px;
}

/* ===== 02. Dark theme ===== */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark; --bg: #0c0f14; --surface: #14181f; --surface-2: #191e26; --surface-3: #202632;
    --text: #e8ebf1; --text-soft: #b9c1ce; --muted: #8892a3; --muted-2: #6b7484; --border: #232a35;
    --border-strong: #333c4a; --accent: #818cf8; --accent-strong: #a5b4fc; --accent-ink: #a5b4fc;
    --accent-soft: rgba(129, 140, 248, 0.14); --accent-ring: rgba(129, 140, 248, 0.32); --on-accent: #10131a;
    --ok: #34d399; --ok-ink: #6ee7b7; --ok-soft: rgba(52, 211, 153, 0.13); --ok-border: rgba(52, 211, 153, 0.32);
    --warn: #fbbf24; --warn-ink: #fcd34d; --warn-soft: rgba(251, 191, 36, 0.13);
    --warn-border: rgba(251, 191, 36, 0.32); --err: #f87171; --err-ink: #fca5a5;
    --err-soft: rgba(248, 113, 113, 0.13); --err-border: rgba(248, 113, 113, 0.32); --info: #60a5fa;
    --info-ink: #93c5fd; --info-soft: rgba(96, 165, 250, 0.13); --info-border: rgba(96, 165, 250, 0.32);
    --research: #60a5fa; --research-ink: #93c5fd; --research-soft: rgba(96, 165, 250, 0.13);
    --research-border: rgba(96, 165, 250, 0.30); --sermon: #a78bfa; --sermon-ink: #c4b5fd;
    --sermon-soft: rgba(167, 139, 250, 0.14); --sermon-border: rgba(167, 139, 250, 0.32);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.40); --shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.55);
    --shadow-lg: 0 22px 50px -20px rgba(0, 0, 0, 0.70);
  }
}

/* ===== 03. Base & reset ===== */
*,
*::before,
*::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; font-family: var(--font-sans); font-size: 14px; line-height: 1.5; color: var(--text);
  background: var(--bg); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
h1,
h2,
h3,
h4 { margin: 0; font-weight: 640; letter-spacing: -0.01em; line-height: 1.3; color: var(--text); }
p { margin: 0; }
ul,
ol { margin: 0; padding: 0; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
code,
kbd,
samp {
  font-family: var(--font-mono); font-size: 0.92em; padding: 1px 5px; border: 1px solid var(--border);
  border-radius: 5px; background: var(--surface-3); color: var(--text-soft);
}
hr { border: 0; }
::selection { background: var(--accent-ring); color: var(--text); }
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ===== 04. Icons ===== */
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-lg { width: 28px; height: 28px; stroke-width: 1.6; }

/* ===== 05. Layout primitives ===== */
.stack { display: grid; gap: 14px; align-content: start; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.row-tight { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-right { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.grid-2,
.grid-3,
.grid-2-wide { display: grid; gap: 20px; align-items: start; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-2-wide { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid { display: grid; gap: 12px 14px; align-items: start; }
.form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.scroll-list {
  max-height: 460px; overflow-y: auto; overscroll-behavior: contain; padding: 10px; display: grid; gap: 8px;
  align-content: start; scrollbar-width: thin;
}
.scroll-list::-webkit-scrollbar { width: 10px; }
.scroll-list::-webkit-scrollbar-thumb {
  background: var(--border-strong); border: 3px solid transparent; background-clip: content-box; border-radius: 999px;
}

/* ===== 06. Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 13px;
  border: 1px solid var(--border-strong); border-radius: 9px; background: var(--surface); color: var(--text);
  font-family: inherit; font-size: 13px; font-weight: 550; line-height: 1.2; white-space: nowrap; cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease,
    color 0.14s ease, box-shadow 0.14s ease, transform 0.06s ease;
}
.btn:hover:not(:disabled) { background: var(--surface-3); border-color: var(--border-strong); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled,
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 570;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent);
}
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-soft); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); border-color: transparent; color: var(--text); }
.btn-danger { background: transparent; border-color: transparent; color: var(--err-ink); }
.btn-danger:hover:not(:disabled) { background: var(--err-soft); border-color: transparent; color: var(--err-ink); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn-lg { padding: 11px 20px; font-size: 15px; border-radius: 11px; }
.btn-block { width: 100%; }
.btn-icon { width: 34px; height: 34px; padding: 0; flex: none; }
.btn-icon.btn-sm { width: 28px; height: 28px; }

/* ===== 07. Forms ===== */
.field { display: grid; gap: 6px; min-width: 0; }
/* An input with a button beside it — e.g. Title + "Suggest". */
.inline-field { display: flex; align-items: center; gap: 8px; min-width: 0; }
.inline-field .input { flex: 1 1 auto; min-width: 0; }
.inline-field .btn { flex: none; }
.field-label {
  font-size: 12px; font-weight: 560; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em;
}
.input,
.select,
.textarea {
  width: 100%; min-width: 0; padding: 8px 10px; font-family: inherit; font-size: 14px; line-height: 1.4;
  color: var(--text); background-color: var(--surface); border: 1px solid var(--border-strong); border-radius: 9px;
  transition: border-color 0.14s ease, box-shadow 0.14s ease,
    background-color 0.14s ease;
}
.input::placeholder,
.textarea::placeholder { color: var(--muted-2); }
.input:hover,
.select:hover,
.textarea:hover { border-color: var(--muted-2); }
.input:focus,
.select:focus,
.textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring);
}
.input:disabled,
.select:disabled,
.textarea:disabled {
  background-color: var(--surface-2); color: var(--muted); cursor: not-allowed;
}
.textarea { min-height: 84px; padding: 9px 11px; line-height: 1.6; resize: vertical; }
.select {
  appearance: none; padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat; cursor: pointer;
}
.select-sm {
  padding: 5px 26px 5px 9px; font-size: 12px; border-radius: 8px;
  background-position: calc(100% - 14px) 52%, calc(100% - 9px) 52%;
}
.field-inline { display: flex; align-items: center; gap: 8px; flex: 1 1 200px; min-width: 0; }
.field-inline > .icon { color: var(--muted); }
.field-inline > .input { flex: 1 1 auto; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-soft); cursor: pointer; }
.checkbox > input { width: 16px; height: 16px; margin: 0; flex: none; accent-color: var(--accent); }
.form-error { margin: 8px 0 0; min-height: 18px; font-size: 13px; color: var(--err-ink); }

/* ===== 08. Badges, chips & meta ===== */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border: 1px solid var(--border);
  border-radius: 999px; background: var(--surface-2); color: var(--text-soft); font-size: 12px; font-weight: 520;
  line-height: 1.6; white-space: nowrap;
}
.badge-ok { background: var(--ok-soft); border-color: var(--ok-border); color: var(--ok-ink); }
.badge-warn { background: var(--warn-soft); border-color: var(--warn-border); color: var(--warn-ink); }
.badge-err { background: var(--err-soft); border-color: var(--err-border); color: var(--err-ink); }
.badge-info { background: var(--info-soft); border-color: var(--info-border); color: var(--info-ink); }
.badge-muted { background: var(--surface-2); border-color: var(--border); color: var(--muted); }
.badge-dot { padding-left: 7px; }
.dot { display: block; width: 6px; height: 6px; flex: none; border-radius: 50%; background: currentColor; }
.chips { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border: 1px solid var(--border);
  border-radius: 999px; background: var(--surface-2); color: var(--text-soft); font-size: 12px; line-height: 1.6;
  max-width: 100%; overflow-wrap: anywhere;
}
.chip-remove {
  display: inline-grid; place-items: center; width: 15px; height: 15px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); font-family: inherit; font-size: 13px; line-height: 1;
  cursor: pointer;
}
.chip-remove:hover { background: var(--border); color: var(--text); }
.chips-ref .chip {
  background: var(--research-soft); border-color: var(--research-border); color: var(--research-ink);
  font-family: var(--font-mono); font-size: 11px;
}
.meta-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--muted); }
.meta-item { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.sep { font-style: normal; color: var(--muted-2); }

/* ===== 09. Cards, stats & metrics ===== */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-sm);
  min-width: 0;
}
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.card-title { font-size: 16px; font-weight: 640; }
.card-sub { margin: 3px 0 0; max-width: 68ch; font-size: 13px; font-weight: 400; color: var(--muted); }
.card-body { padding: 16px 18px; }
.card-body + .card-body { border-top: 1px solid var(--border); }
.card-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stats-grid-4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat {
  padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-sm); min-width: 0;
}
.stat-value { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-label { margin-top: 4px; font-size: 13px; color: var(--text-soft); }
.stat-meta { margin-top: 2px; font-size: 12px; color: var(--muted); }
.stat-accent { border-color: var(--accent-ring); }
.stat-accent .stat-value { color: var(--accent-ink); }
.stat-voice { border-color: var(--sermon-border); }
.stat-voice .stat-value { color: var(--sermon-ink); }
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.metric {
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2);
  min-width: 0;
}
.metric-value {
  font-size: 18px; font-weight: 640; letter-spacing: -0.01em; font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.metric-label {
  margin-top: 2px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em;
}
.metric-groups { grid-column: 1 / -1; display: grid; gap: 14px; }
.metric-group { display: grid; gap: 8px; }

/* ===== 10. App shell & sidebar ===== */
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.sidebar {
  display: flex; flex-direction: column; gap: 14px; padding: 14px 12px; background: var(--surface);
  border-right: 1px solid var(--border); position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto;
  overscroll-behavior: contain;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px; padding: 4px 6px 12px; border-bottom: 1px solid var(--border);
  min-width: 0;
}
.brand-mark {
  display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 9px;
  background: var(--accent); color: var(--on-accent);
}
.brand-text { display: grid; gap: 2px; min-width: 0; }
.brand-text strong { font-size: 14px; font-weight: 650; letter-spacing: -0.01em; color: var(--text); }
.brand-text small { font-size: 12px; color: var(--muted); }
.sidebar-nav { display: grid; gap: 2px; align-content: start; flex: 1 1 auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 1px solid transparent;
  border-radius: 9px; background: transparent; color: var(--text-soft); font-family: inherit; font-size: 14px;
  font-weight: 500; text-align: left; cursor: pointer; transition: background-color 0.14s ease, color 0.14s ease;
}
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.is-active {
  background: var(--accent-soft); border-color: var(--accent-ring); color: var(--accent-ink); font-weight: 600;
}
.nav-item > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-footer {
  display: grid; gap: 10px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border);
}
.nav-provider {
  display: flex; align-items: center; gap: 8px; padding: 0 4px; font-size: 12px; color: var(--muted); min-width: 0;
}
.nav-provider .dot { color: var(--ok); }
.nav-provider-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-user { display: flex; align-items: center; gap: 10px; padding: 0 4px; min-width: 0; }
.avatar {
  display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface-3); color: var(--text-soft); font-size: 13px;
  font-weight: 600;
}
.nav-user-text { display: grid; gap: 1px; min-width: 0; }
.nav-user-text strong {
  font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-user-text small {
  font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.scrim { position: fixed; inset: 0; z-index: 55; background: rgba(12, 16, 23, 0.5); backdrop-filter: blur(1.5px); }

/* ===== 11. Topbar & views ===== */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 13px 24px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar-titles { flex: 1 1 auto; min-width: 0; }
.topbar-titles h1 { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.topbar-titles p { margin-top: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.topbar .topbar-menu { display: none; }
.content { flex: 1 1 auto; min-width: 0; padding: 20px 24px 56px; }
.view { display: grid; gap: 20px; align-content: start; min-width: 0; }

/* ===== 12. Landing page (signed out) =====
   A real marketing page rather than a bare login form. The auth card lives
   at the bottom in #get-started; the CTAs scroll to it. */
.landing { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }
.landing a { color: inherit; text-decoration: none; }

.landing-nav {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px;
  padding: 13px clamp(18px, 4vw, 48px); border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(12px);
}
.landing-links { display: flex; gap: 22px; margin-left: auto; font-size: 14px; color: var(--text-soft); }
.landing-links a { transition: color 0.14s ease; }
.landing-links a:hover { color: var(--text); }
.landing-nav-actions { display: flex; gap: 8px; flex: none; }

.landing main { flex: 1 1 auto; }
.landing-foot {
  display: flex; flex-wrap: wrap; gap: 10px 24px; justify-content: space-between;
  padding: 22px clamp(18px, 4vw, 48px); border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--muted);
}
.landing-foot code { font-family: var(--font-mono); font-size: 11.5px; }

.band { padding: clamp(46px, 6.5vw, 86px) clamp(18px, 4vw, 48px); }
.band-tight { padding-top: 0; }
.band-tint { background: var(--surface); border-block: 1px solid var(--border); }
.band-cta { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 440px);
  gap: clamp(24px, 5vw, 64px); align-items: center; max-width: 1120px; margin: 0 auto; }
.band-head {
  max-width: 70ch; margin: 0 auto clamp(26px, 4vw, 44px); display: grid; gap: 12px;
  justify-items: center; text-align: center;
}
.band-head h2 { font-size: clamp(23px, 3.1vw, 33px); line-height: 1.2; letter-spacing: -0.022em; font-weight: 640; }
.band-sub { font-size: 15.5px; line-height: 1.68; color: var(--text-soft); max-width: 66ch; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 640;
  letter-spacing: 0.07em; text-transform: uppercase; color: var(--accent-ink);
}
.eyebrow .icon { width: 15px; height: 15px; flex: none; }

/* ---- hero ---- */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.04fr) minmax(0, 1fr);
  gap: clamp(28px, 4.5vw, 60px); align-items: center;
  max-width: 1180px; margin: 0 auto; padding: clamp(40px, 6vw, 82px) clamp(18px, 4vw, 48px);
}
.hero-copy { display: grid; gap: 18px; justify-items: start; }
.hero h1 { font-size: clamp(31px, 5vw, 54px); line-height: 1.06; letter-spacing: -0.035em; font-weight: 660; }
.hero-sub { font-size: clamp(15px, 1.35vw, 17px); line-height: 1.7; color: var(--text-soft); max-width: 58ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-note { display: flex; align-items: center; gap: 8px; font-size: 12.8px; color: var(--muted); max-width: 52ch; }
.hero-note .icon { width: 16px; height: 16px; flex: none; color: var(--accent-ink); }

.hero-art { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-content: center; }
.art-panel, .art-out {
  display: grid; gap: 8px; padding: 14px; border: 1px solid var(--border);
  border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm);
}
.art-out { grid-column: 1 / -1; box-shadow: var(--shadow); }
.art-panel.alt { border-color: var(--sermon-border); background: var(--sermon-soft); }
.art-panel:first-child { border-color: var(--research-border); background: var(--research-soft); }
.art-label { font-size: 10.5px; font-weight: 660; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.art-chip {
  display: block; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); font-size: 12.5px; color: var(--text-soft);
}
.art-doc { display: grid; gap: 7px; }
.art-line { display: block; height: 7px; border-radius: 99px; background: var(--surface-3); }
.art-verdict { display: flex; align-items: center; gap: 11px; margin-top: 5px; }
.art-score {
  display: grid; place-items: center; flex: none; width: 46px; height: 46px; border-radius: 13px;
  background: var(--warn-soft); color: var(--warn-ink); font-size: 17px; font-weight: 700;
  border: 1px solid var(--warn-border);
}
.art-verdict-text { display: grid; }
.art-verdict-text strong { font-size: 13px; }
.art-verdict-text small { font-size: 11.5px; color: var(--muted); }

/* ---- two corpora ---- */
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px; max-width: 1060px; margin: 0 auto; }
.corpus-card { display: grid; gap: 12px; padding: 24px; align-content: start; }
.corpus-card.is-research { border-top: 3px solid var(--research); }
.corpus-card.is-sermon { border-top: 3px solid var(--sermon); }
.corpus-tag {
  justify-self: start; padding: 3px 9px; border-radius: 99px; font-size: 11px; font-weight: 660;
  letter-spacing: 0.06em; text-transform: uppercase;
  background: var(--research-soft); color: var(--research-ink);
}
.corpus-tag.alt { background: var(--sermon-soft); color: var(--sermon-ink); }
.corpus-card h3 { font-size: 19px; letter-spacing: -0.01em; }
.corpus-card p { font-size: 14.5px; line-height: 1.66; color: var(--text-soft); }
.tick-list { list-style: none; display: grid; gap: 8px; margin-top: 2px; }
.tick-list li { display: flex; align-items: flex-start; gap: 9px; font-size: 13.5px; color: var(--text-soft); }
.tick-list .icon { width: 15px; height: 15px; flex: none; margin-top: 3px; color: var(--ok); }

/* ---- how it works ---- */
.steps { list-style: none; counter-reset: step; display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(232px, 1fr)); max-width: 1120px; margin: 0 auto; }
.steps li { display: grid; gap: 9px; padding: 22px; border: 1px solid var(--border);
  border-radius: var(--radius-lg); background: var(--surface); align-content: start; }
.step-num {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: var(--accent-soft); color: var(--accent-ink); font-size: 13.5px; font-weight: 700;
}
.steps h3 { font-size: 16.5px; }
.steps p { font-size: 13.8px; line-height: 1.62; color: var(--text-soft); }

/* ---- review showcase ---- */
.review-demo { display: grid; grid-template-columns: minmax(200px, 250px) minmax(0, 1fr);
  gap: 18px; max-width: 1000px; margin: 0 auto; align-items: start; }
.review-score { display: grid; gap: 6px; justify-items: center; padding: 24px; text-align: center; }
.review-dial {
  display: grid; place-items: center; width: 84px; height: 84px; border-radius: 50%;
  background: var(--warn-soft); color: var(--warn-ink); border: 3px solid var(--warn-border);
  font-size: 27px; font-weight: 700; letter-spacing: -0.02em;
}
.review-level { font-size: 13.5px; font-weight: 620; color: var(--warn-ink); }
.review-facts { display: grid; gap: 7px; width: 100%; margin-top: 8px; }
.review-facts div { display: flex; justify-content: space-between; gap: 10px;
  font-size: 12.5px; padding-top: 7px; border-top: 1px solid var(--border); }
.review-facts dt { color: var(--muted); }
.review-facts dd { color: var(--text); font-weight: 560; }
.review-flags { list-style: none; display: grid; gap: 11px; }
.review-flags li { display: flex; align-items: flex-start; gap: 11px; padding: 15px 17px;
  border: 1px solid var(--border); border-left-width: 3px; border-radius: var(--radius);
  background: var(--surface); }
.review-flags li.is-error { border-left-color: var(--err); }
.review-flags li.is-warn { border-left-color: var(--warn); }
.review-flags .icon { width: 17px; height: 17px; flex: none; margin-top: 2px; }
.review-flags li.is-error .icon { color: var(--err); }
.review-flags li.is-warn .icon { color: var(--warn); }
.review-flags strong { display: block; font-size: 14px; margin-bottom: 3px; }
.review-flags p { font-size: 13px; line-height: 1.6; color: var(--text-soft); }

/* ---- features ---- */
.feature-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(268px, 1fr));
  max-width: 1120px; margin: 0 auto; }
.feature { display: grid; gap: 10px; padding: 22px; align-content: start; }
.feature-icon {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius);
  background: var(--accent-soft); color: var(--accent-ink);
}
.feature-icon .icon { width: 18px; height: 18px; }
.feature h3 { font-size: 16.5px; }
.feature p { font-size: 13.8px; line-height: 1.62; color: var(--text-soft); }

/* ---- privacy ---- */
.privacy { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(240px, 320px);
  gap: clamp(22px, 4vw, 48px); align-items: center; max-width: 1000px; margin: 0 auto; padding: 28px; }
.privacy h2 { font-size: clamp(20px, 2.5vw, 26px); line-height: 1.25; letter-spacing: -0.018em; margin: 10px 0; }
.privacy p { font-size: 14.5px; line-height: 1.68; color: var(--text-soft); }
.privacy-facts { display: grid; gap: 9px; }
.privacy-facts div { display: grid; gap: 2px; padding-top: 9px; border-top: 1px solid var(--border); }
.privacy-facts dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.privacy-facts dd { font-size: 13.5px; font-weight: 550; }
.privacy-facts code { font-family: var(--font-mono); font-size: 12px; }

/* ---- get started ---- */
.cta-copy { display: grid; gap: 12px; }
.cta-copy h2 { font-size: clamp(24px, 3.2vw, 34px); line-height: 1.18; letter-spacing: -0.024em; }
.cta-copy p { font-size: 15px; line-height: 1.68; color: var(--text-soft); max-width: 46ch; }

.brand-lockup { display: flex; align-items: center; gap: 10px; min-width: 0; }
.auth-card { width: 100%; display: grid; gap: 18px; padding: 22px; }
.segmented {
  display: flex; gap: 4px; width: 100%; padding: 3px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2);
}
.segment {
  flex: 1 1 0; padding: 7px 12px; border: 1px solid transparent; border-radius: 8px; background: transparent;
  color: var(--muted); font-family: inherit; font-size: 13px; font-weight: 550; cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease;
}
.segment:hover { color: var(--text); }
.segment.is-active {
  background: var(--surface); border-color: var(--border); color: var(--text); box-shadow: var(--shadow-sm);
}

/* ===== 13. Toasts ===== */
.toast-stack {
  position: fixed; right: 18px; bottom: 18px; z-index: 130; display: grid; gap: 10px;
  width: min(360px, calc(100vw - 36px)); pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px;
  border: 1px solid var(--border); border-radius: 11px; background: var(--surface); box-shadow: var(--shadow-lg);
  font-size: 13px; animation: toast-in 0.16s ease-out;
}
.toast > .icon { margin-top: 1px; color: var(--muted); }
.toast-ok { border-color: var(--ok-border); }
.toast-ok > .icon { color: var(--ok-ink); }
.toast-error { border-color: var(--err-border); }
.toast-error > .icon { color: var(--err-ink); }
.toast-warn { border-color: var(--warn-border); }
.toast-warn > .icon { color: var(--warn-ink); }
.toast-info { border-color: var(--info-border); }
.toast-info > .icon { color: var(--info-ink); }
.toast-message { flex: 1 1 auto; min-width: 0; line-height: 1.5; color: var(--text); overflow-wrap: anywhere; }
.toast-close {
  display: grid; place-items: center; width: 22px; height: 22px; flex: none; padding: 0; border: 0;
  border-radius: 6px; background: transparent; color: var(--muted); font-family: inherit; font-size: 14px;
  line-height: 1; cursor: pointer;
}
.toast-close::before { content: "\00d7"; }
.toast-close:hover { background: var(--surface-3); color: var(--text); }
.is-leaving { opacity: 0; transform: translateX(14px); transition: opacity 0.18s ease, transform 0.18s ease; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ===== 14. Modals ===== */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px;
  background: rgba(12, 16, 23, 0.52); backdrop-filter: blur(3px); animation: fade-in 0.14s ease-out;
}
.modal {
  display: flex; flex-direction: column; width: min(640px, 100%); max-height: 90vh; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden;
  animation: modal-in 0.16s ease-out;
}
.modal-sm { width: min(440px, 100%); }
.modal-lg { width: min(900px, 100%); }
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 640; }
.modal-sub { margin-top: 3px; font-size: 13px; color: var(--muted); }
.modal-body {
  flex: 1 1 auto; min-height: 0; max-height: 80vh; overflow-y: auto; overscroll-behavior: contain; padding: 18px;
}
.modal-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 18px;
  border-top: 1px solid var(--border); background: var(--surface-2);
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(0.99); }
  to { opacity: 1; transform: none; }
}

/* ===== 15. Empty, loading & inline status ===== */
.empty {
  display: grid; justify-items: center; gap: 8px; padding: 34px 20px; border: 1px dashed var(--border-strong);
  border-radius: 12px; background: var(--surface-2); text-align: center;
}
.empty > .icon { color: var(--muted-2); }
.empty-title { font-size: 16px; font-weight: 620; }
.empty-text { max-width: 60ch; font-size: 13px; line-height: 1.6; color: var(--muted); }
.empty-hint { max-width: 60ch; font-size: 12px; color: var(--muted-2); }
.empty .btn { margin-top: 6px; }
.loading { display: flex; align-items: center; gap: 10px; padding: 16px 4px; font-size: 13px; color: var(--muted); }
.loading-label { min-width: 0; }
.spinner {
  display: inline-block; width: 16px; height: 16px; flex: none; border: 2px solid var(--border-strong);
  border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite;
}
.spinner-lg { width: 28px; height: 28px; border-width: 3px; }
@keyframes spin {
  to { transform: rotate(360deg); }
}
.skeleton {
  min-height: 12px; border-radius: 6px;
  background: linear-gradient(
    90deg,
    var(--surface-3) 0%,
    var(--surface-2) 50%,
    var(--surface-3) 100%
  );
  background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer {
  from { background-position: 150% 0; }
  to { background-position: -50% 0; }
}
.inline-status {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface-2); font-size: 13px; color: var(--text-soft);
}
.inline-status.is-ok { border-color: var(--ok-border); background: var(--ok-soft); }
.inline-status.is-err { border-color: var(--err-border); background: var(--err-soft); }
.inline-status-text { min-width: 0; overflow-wrap: anywhere; }
.inline-status-sample {
  flex: 1 1 200px; min-width: 0; max-width: 100%; padding: 2px 6px; border-color: var(--border);
  background: var(--surface); color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
}
.error-list {
  list-style: none; width: 100%; margin-top: 4px; display: grid; gap: 4px; font-size: 12px; color: var(--err-ink);
}
.error-list li { overflow-wrap: anywhere; }

/* ===== 16. Library ===== */
.corpus-panel { display: flex; flex-direction: column; overflow: hidden; }
.corpus-head { padding: 16px 18px 12px; }
.corpus-name { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 16px; font-weight: 640; }
.corpus-tag {
  display: inline-flex; align-items: center; padding: 2px 8px; border: 1px solid transparent; border-radius: 999px;
  font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em;
}
.corpus-tag.research {
  background: var(--research-soft); border-color: var(--research-border); color: var(--research-ink);
}
.corpus-tag.sermon { background: var(--sermon-soft); border-color: var(--sermon-border); color: var(--sermon-ink); }
.corpus-desc { margin-top: 6px; max-width: 70ch; font-size: 13px; line-height: 1.6; color: var(--muted); }
.corpus-meta { display: grid; gap: 8px; padding: 0 18px 14px; }
.corpus-meta-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.corpus-meta-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.corpus-import { padding: 0 18px 16px; border-bottom: 1px solid var(--border); }
.dropzone {
  display: grid; justify-items: center; gap: 6px; padding: 16px; border: 1px dashed var(--border-strong);
  border-radius: var(--radius); background: var(--surface-2); text-align: center; cursor: pointer;
  transition: border-color 0.14s ease, background-color 0.14s ease,
    box-shadow 0.14s ease;
}
.dropzone > .icon { color: var(--muted); }
.dropzone:hover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.is-over {
  border-style: solid; border-color: var(--accent); background: var(--accent-soft);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.dropzone-lg { gap: 8px; padding: 30px 20px; }
.dropzone-lg > .icon-lg { color: var(--accent); }
.dropzone-title { font-size: 14px; font-weight: 600; }
.dropzone-hint { font-size: 12px; color: var(--muted); }
.file-name {
  display: inline-block; max-width: 44ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  vertical-align: bottom;
}
.toolbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 12px 18px;
  border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.doc-row {
  display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2);
}
.doc-row.is-failed { border-color: var(--err-border); background: var(--err-soft); }
.doc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.doc-main { flex: 1 1 auto; display: grid; gap: 4px; min-width: 0; }
.doc-title { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.doc-flags { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.doc-tags { display: grid; gap: 6px; }
.doc-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.chunk-list { display: grid; gap: 8px; }
.chunk {
  display: grid; gap: 6px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface-2);
}
.chunk-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.chunk-heading { font-size: 12px; font-weight: 600; color: var(--text-soft); }
.chunk-preview { max-width: 80ch; font-size: 13px; line-height: 1.6; color: var(--muted); overflow-wrap: anywhere; }
.result-list { display: grid; gap: 10px; margin-top: 14px; }
.result {
  display: grid; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2);
}
.result-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.result-main { flex: 1 1 auto; display: grid; gap: 4px; min-width: 0; }
.result-title { font-size: 14px; font-weight: 620; overflow-wrap: anywhere; }
.result-scores { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.score-pill {
  display: inline-flex; align-items: center; padding: 2px 8px; border: 1px solid var(--accent-ring);
  border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-family: var(--font-mono);
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.rank-pill {
  display: inline-flex; align-items: center; padding: 2px 8px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--muted); font-family: var(--font-mono); font-size: 11px;
  white-space: nowrap;
}
.result-body {
  max-width: 80ch; font-size: 14px; line-height: 1.65; color: var(--text-soft); overflow-wrap: anywhere;
}

/* ===== 17. Voice ===== */
.metric-groups > .mini-title:first-child,
.metric-group > .mini-title { margin-bottom: 0; }

/* ===== 18. Sermons ===== */
.sermon-layout {
  display: grid; grid-template-columns: minmax(280px, 320px) minmax(0, 1fr); gap: 20px; align-items: start;
  min-width: 0;
}
.sermon-sidebar {
  display: flex; flex-direction: column; position: sticky; top: calc(var(--topbar-h) + 16px);
  max-height: calc(100vh - var(--topbar-h) - 32px); overflow: hidden;
}
.sermon-sidebar > .card-head { flex: none; }
.sermon-sidebar .scroll-list { flex: 1 1 auto; max-height: none; border-top: 1px solid var(--border); }
.sermon-detail { display: grid; gap: 20px; align-content: start; min-width: 0; }
.sermon-card {
  display: grid; gap: 6px; width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface-2); color: inherit; font-family: inherit; text-align: left;
  cursor: pointer; transition: background-color 0.14s ease, border-color 0.14s ease;
}
.sermon-card:hover { background: var(--surface-3); border-color: var(--border-strong); }
.sermon-card.is-active { border-color: var(--accent); background: var(--accent-soft); }
.sermon-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.sermon-card-title {
  min-width: 0; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.stage-dots { display: inline-flex; align-items: center; gap: 4px; flex: none; }
/* A list row: the card, plus a menu button and the menu it opens. */
.sermon-item { display: grid; gap: 6px; }
.sermon-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: center; }
.sermon-menu-toggle { opacity: 0; transition: opacity 0.14s ease; }
/* Hover is a desktop convenience, never the only way in: the menu also appears
   on keyboard focus, and stays visible on touch (see the pointer: coarse block). */
.sermon-item:hover .sermon-menu-toggle,
.sermon-menu-toggle:focus-visible,
.sermon-menu-toggle.is-open { opacity: 1; }
.sermon-menu {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface-2);
}
.sermon-rename {
  display: grid; gap: 8px; padding: 8px; border: 1px solid var(--accent);
  border-radius: var(--radius); background: var(--surface-2);
}
.sermon-rename-actions { display: flex; gap: 6px; }
.stage-dot {
  display: inline-grid; place-items: center; width: 16px; height: 16px; flex: none;
  border: 1px solid var(--border-strong); border-radius: 50%; background: var(--surface); color: var(--muted);
  font-size: 9px; font-weight: 700; line-height: 1;
}
.stage-dot.is-done { border-color: var(--ok); background: var(--ok-soft); color: var(--ok-ink); }
.sermon-header .card-head { align-items: center; }
.stage {
  display: grid; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface-2); transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
.stage.is-filled { background: var(--surface); border-color: var(--border-strong); }
.stage.is-busy { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.stage-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stage-title { font-size: 14px; font-weight: 620; }
.stage-hint { margin-top: 2px; max-width: 70ch; font-size: 12px; color: var(--muted); }
.stage-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.stage-text {
  width: 100%; min-height: 200px; max-width: 70ch; padding: 12px 14px; font-family: var(--font-sans); font-size: 16px;
  line-height: 1.7; white-space: pre-wrap; overflow-wrap: break-word;
}
.stage-progress {
  display: flex; align-items: center; gap: 8px; padding-top: 2px; font-size: 12px; color: var(--muted);
}
.stage-elapsed { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.preview-list { display: grid; gap: 10px; }
.preview-item {
  display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2);
}
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.preview-title { min-width: 0; font-size: 13px; font-weight: 600; }
.preview-excerpt { max-width: 80ch; font-size: 13px; line-height: 1.6; color: var(--muted); overflow-wrap: anywhere; }
.list { list-style: none; display: grid; gap: 8px; }
.list-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface-2); min-width: 0;
}
.list-row.is-clickable { cursor: pointer; transition: background-color 0.14s ease, border-color 0.14s ease; }
.list-row.is-clickable:hover { background: var(--surface-3); border-color: var(--border-strong); }
.list-main { flex: 1 1 auto; display: grid; gap: 3px; min-width: 0; }
.list-title { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.date-block {
  display: grid; place-items: center; min-width: 42px; flex: none; padding: 4px 6px; border-radius: 9px;
  background: var(--accent-soft); color: var(--accent-ink);
}
.date-day { font-size: 16px; font-weight: 650; line-height: 1.1; font-variant-numeric: tabular-nums; }
.date-month { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }

/* ===== 19. Verification report ===== */
.report { display: grid; gap: 18px; }
.report-top { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 22px; align-items: start; }
.dial-wrap { display: grid; justify-items: center; gap: 8px; }
.dial {
  position: relative; display: grid; place-items: center; width: 108px; height: 108px; border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--score) * 1%), var(--border) 0);
}
.dial::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--surface); }
.dial-value {
  position: relative; z-index: 1; font-size: 28px; font-weight: 650; line-height: 1; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.dial-max { position: relative; z-index: 1; margin-top: 2px; font-size: 12px; color: var(--muted); }
.dial-caption { display: grid; justify-items: center; gap: 4px; text-align: center; }
.dial-pass { --accent: var(--ok); }
.dial-review { --accent: var(--warn); }
.dial-attention { --accent: var(--err); }
.flag-groups { display: grid; gap: 16px; min-width: 0; }
.flag-group { display: grid; gap: 8px; min-width: 0; }
.flag-group-title { display: flex; align-items: center; gap: 8px; margin-bottom: 0; }
.flag-list { list-style: none; display: grid; gap: 8px; min-width: 0; }
.flag-list.compact { gap: 6px; }
.flag {
  display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--border); border-left-width: 3px;
  border-radius: 9px; background: var(--surface-2); min-width: 0;
}
.flag-error { border-left-color: var(--err); }
.flag-warning { border-left-color: var(--warn); }
.flag-info { border-left-color: var(--info); }
.flag-list.compact .flag { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; padding: 7px 10px; }
.flag-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; }
.flag-code {
  padding: 2px 6px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface-3);
  color: var(--muted); font-family: var(--font-mono); font-size: 11px; white-space: nowrap;
}
.flag-message { flex: 1 1 200px; min-width: 0; font-size: 13px; color: var(--text-soft); overflow-wrap: anywhere; }
.flag-evidence {
  list-style: none; display: grid; gap: 4px; padding-left: 10px; border-left: 1px solid var(--border);
  font-size: 12px; color: var(--muted);
}
.flag-evidence li { overflow-wrap: anywhere; }
.report-block {
  display: grid; gap: 10px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface);
}
.ref-list { list-style: none; display: grid; gap: 6px; }
.ref-row {
  display: grid; grid-template-columns: minmax(96px, max-content) auto minmax(0, 1fr); gap: 10px;
  align-items: baseline; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-2); font-size: 13px;
}
.ref-label {
  font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--accent-ink); white-space: nowrap;
}
.ref-text { min-width: 0; color: var(--text-soft); overflow-wrap: anywhere; }
.match-list { display: grid; gap: 10px; }
.match {
  display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2);
}
.match-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.match-title { font-size: 13px; font-weight: 600; }
.match-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.match-side {
  display: grid; gap: 4px; min-width: 0; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface);
}
.match-text { font-size: 13px; line-height: 1.6; color: var(--text-soft); overflow-wrap: anywhere; }
.mini-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.mini-stat {
  display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface-2);
}
.mini-stat-value { font-size: 18px; font-weight: 640; font-variant-numeric: tabular-nums; }
.mini-stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* ===== 20. Bible ===== */
.pill-list { display: grid; gap: 8px; }
.translation {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); min-width: 0;
}
.translation > div { min-width: 0; }
.translation-code { font-family: var(--font-mono); font-size: 13px; font-weight: 650; letter-spacing: 0.02em; }
.translation-name { margin-top: 2px; font-size: 13px; color: var(--text-soft); overflow-wrap: anywhere; }
.translation .hint { margin-top: 2px; }
.passage-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
}
.passage-label { font-size: 16px; font-weight: 620; }
.passage { display: grid; gap: 10px; max-width: 70ch; font-size: 16px; line-height: 1.75; color: var(--text-soft); }
.verse { overflow-wrap: anywhere; }
.verse-num {
  margin-right: 6px; font-size: 11px; font-weight: 650; color: var(--accent-ink); font-variant-numeric: tabular-nums;
}
.verse-text { color: var(--text-soft); overflow-wrap: anywhere; }
.verse-list { display: grid; gap: 8px; }
.verse-row {
  display: grid; grid-template-columns: minmax(96px, max-content) minmax(0, 1fr) auto; gap: 4px 10px;
  align-items: baseline; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-2); font-size: 13px;
}
.verse-ref {
  font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--accent-ink); white-space: nowrap;
}
.overview-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
}
.overview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.overview-cell {
  display: grid; gap: 2px; padding: 8px 6px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-2); text-align: center;
}
.overview-cell.has-text { border-color: var(--accent-ring); background: var(--accent-soft); }
.overview-chapter { font-size: 13px; font-weight: 620; font-variant-numeric: tabular-nums; }
.overview-verses { font-size: 11px; color: var(--muted); }

/* ===== 21. Series & calendar ===== */
.series-card {
  display: grid; gap: 4px; width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface-2); color: inherit; font-family: inherit; text-align: left;
  cursor: pointer; transition: background-color 0.14s ease, border-color 0.14s ease;
}
.series-card:hover { background: var(--surface-3); border-color: var(--border-strong); }
.series-card.is-active { border-color: var(--accent); background: var(--accent-soft); }
.series-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.series-card-title {
  min-width: 0; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.series-card-desc {
  font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.arc { list-style: none; display: grid; gap: 10px; }
.arc-item {
  display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); min-width: 0;
}
.arc-week { display: grid; gap: 2px; }
.arc-week-label {
  font-size: 12px; font-weight: 620; color: var(--accent-ink); text-transform: uppercase; letter-spacing: 0.05em;
}
.arc-week-date { font-size: 12px; color: var(--muted); }
.arc-main { display: grid; gap: 4px; min-width: 0; }
.arc-title { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.arc-passage { font-size: 12px; color: var(--text-soft); }
.arc-aim { max-width: 70ch; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.calendar { display: grid; gap: 8px; min-width: 0; }
.cal-dow { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; }
.cal-dow > span {
  padding: 4px 6px; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.06em; text-align: center;
}
.cal-grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--border); overflow: hidden;
}
.cal-day {
  display: flex; flex-direction: column; gap: 4px; min-height: 96px; min-width: 0; padding: 4px;
  background: var(--surface-2);
  /* Entries must clip rather than widen the seven-column grid on a phone. */
  overflow: hidden;
}
.cal-day.has-entries { background: var(--surface); }
.cal-day.is-out { background: var(--surface-3); }
.cal-day.is-out .cal-date { color: var(--muted-2); }
.cal-day.is-today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-day-head {
  display: flex; align-items: center; justify-content: space-between; gap: 4px; width: 100%; padding: 3px 5px;
  border: 0; border-radius: 6px; background: transparent; color: inherit; font-family: inherit; cursor: pointer;
}
.cal-day-head:hover { background: var(--surface-3); }
.cal-date { font-size: 12px; font-weight: 600; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.cal-add {
  font-size: 14px; font-weight: 650; line-height: 1; color: var(--accent-ink); opacity: 0;
  transition: opacity 0.14s ease;
}
.cal-day:hover .cal-add,
.cal-day-head:focus-visible .cal-add { opacity: 1; }
.cal-entries { display: grid; gap: 3px; min-width: 0; }
.cal-entry {
  display: grid; gap: 1px; width: 100%; min-width: 0; padding: 3px 6px; border: 1px solid transparent;
  border-left-width: 3px; border-radius: 6px; background: var(--surface-2); color: var(--text-soft);
  font-family: inherit; text-align: left; cursor: pointer; transition: filter 0.14s ease;
}
.cal-entry:hover { filter: brightness(0.97); }
.cal-entry-title {
  display: block; font-size: 12px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cal-entry-passage {
  display: block; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-entry.status-planned { border-left-color: var(--warn); background: var(--warn-soft); color: var(--warn-ink); }
.cal-entry.status-preparing { border-left-color: var(--info); background: var(--info-soft); color: var(--info-ink); }
.cal-entry.status-ready { border-left-color: var(--ok); background: var(--ok-soft); color: var(--ok-ink); }
.cal-entry.status-preached {
  border-left-color: var(--sermon); background: var(--sermon-soft); color: var(--sermon-ink);
}
.cal-entry.status-planned .cal-entry-passage,
.cal-entry.status-preparing .cal-entry-passage,
.cal-entry.status-ready .cal-entry-passage,
.cal-entry.status-preached .cal-entry-passage {
  color: inherit; opacity: 0.75;
}
.legend { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.swatch {
  display: inline-block; width: 10px; height: 10px; flex: none; border: 1px solid var(--border-strong);
  border-radius: 3px; background: var(--muted-2);
}
.swatch.planned { background: var(--warn); }
.swatch.preparing { background: var(--info); }
.swatch.ready { background: var(--ok); }
.swatch.preached { background: var(--sermon); }

/* ===== 22. Utilities ===== */
.mini-title {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12px; font-weight: 620;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em;
}
.prose { max-width: 70ch; font-size: 16px; line-height: 1.7; color: var(--text-soft); }
.prose p { margin-bottom: 12px; }
.prose-text {
  max-width: 70ch; font-size: 16px; line-height: 1.7; color: var(--text-soft); white-space: pre-wrap;
  overflow-wrap: break-word;
}
.rule { height: 1px; margin: 18px 0; border: 0; background: var(--border); }
.kv { display: grid; }
.kv-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 8px 0;
  border-bottom: 1px solid var(--border); font-size: 13px;
}
.kv-row:last-child { border-bottom: 0; }
.kv-key { color: var(--muted); }
.kv-val { min-width: 0; color: var(--text); text-align: right; overflow-wrap: anywhere; }
.hint { font-size: 12px; line-height: 1.55; color: var(--muted); }
.small { font-size: 12px; }
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); font-size: 0.95em; }
.link {
  color: var(--accent-ink); text-decoration: underline; text-decoration-color: var(--accent-ring);
  text-underline-offset: 2px; cursor: pointer;
}
.link:hover { text-decoration-color: var(--accent-ink); }
.warn-text { color: var(--warn-ink); }
.ok-text { color: var(--ok-ink); }
.danger-text { color: var(--err-ink); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; border: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.noscript {
  max-width: 62ch; margin: 56px auto; padding: 0 20px; font-size: 14px; line-height: 1.6; color: var(--muted);
  text-align: center;
}
.boot-splash {
  position: fixed; inset: 0; z-index: 200; display: grid; place-content: center; justify-items: center; gap: 14px;
  background: var(--bg);
}
.boot-text { font-size: 13px; color: var(--muted); }

/* ===== 23. Responsive ===== */
@media (max-width: 1180px) {
  .sermon-layout { grid-template-columns: minmax(0, 1fr); }
  .sermon-sidebar { position: static; max-height: none; }
  .sermon-sidebar .scroll-list { max-height: 460px; }
}
@media (max-width: 1024px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 60; width: 264px; height: 100%;
    transform: translateX(-102%); transition: transform 0.22s ease; box-shadow: var(--shadow-lg);
  }
  .sidebar.is-open { transform: translateX(0); }
  .topbar .topbar-menu { display: inline-flex; }
  .grid-2,
  .grid-2-wide,
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .form-grid-3,
  .form-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content { padding: 16px 18px 48px; }
  .topbar { padding: 12px 18px; }
  .report-top { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .flag-groups { width: 100%; }
  /* Landing: stack the two-column bands and drop the nav links. */
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero-art { max-width: 560px; }
  .band-cta { grid-template-columns: minmax(0, 1fr); }
  .review-demo { grid-template-columns: minmax(0, 1fr); }
  .review-score { max-width: 340px; }
  .privacy { grid-template-columns: minmax(0, 1fr); }
  .landing-links { display: none; }
}
@media (max-width: 768px) {
  .match-pair { grid-template-columns: minmax(0, 1fr); }
  .arc-item { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .arc-week { display: flex; align-items: baseline; gap: 8px; }
  .cal-day { min-height: 76px; padding: 3px; }
  .cal-entry { padding: 2px 4px; }
  .dial { width: 96px; height: 96px; }
  .verse-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .ref-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .flag-list.compact .flag { display: grid; }
}
@media (max-width: 560px) {
  .content { padding: 14px 12px 40px; }
  .topbar { padding: 10px 12px; gap: 8px; }
  .topbar-titles h1 { font-size: 18px; }
  .topbar-actions .badge { display: none; }
  .card-head,
  .card-body { padding-left: 14px; padding-right: 14px; }
  .corpus-head,
  .corpus-meta,
  .corpus-import,
  .toolbar { padding-left: 14px; padding-right: 14px; }
  .form-grid-2,
  .form-grid-3,
  .form-grid-4 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .stats-grid,
  .stats-grid-4,
  .metrics-grid { grid-template-columns: minmax(0, 1fr); }
  .mini-stats { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
  /* Landing on a phone: one column throughout, and the nav CTA stays reachable. */
  .landing-nav { flex-wrap: wrap; gap: 10px; }
  .landing-nav-actions { margin-left: auto; }
  .hero { padding-top: 28px; }
  .hero-art { grid-template-columns: minmax(0, 1fr); }
  .art-out { grid-column: auto; }
  .steps,
  .feature-grid { grid-template-columns: minmax(0, 1fr); }
  .landing-foot { flex-direction: column; }
  .toast-stack { right: 12px; left: 12px; bottom: 12px; width: auto; }
  .cal-dow > span { font-size: 10px; padding: 4px 0; letter-spacing: 0; }
  .cal-day { min-height: 62px; }
  .cal-date { font-size: 11px; }
  .cal-entry-passage { display: none; }
  .cal-entry-title { font-size: 11px; }
  .overview-grid { grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); }
  .empty { padding: 26px 14px; }
  .date-block { min-width: 38px; }
}

/* ===== 24. Touch devices and phones =====
   Deliberately last: these are the ergonomics that decide whether the app is
   usable on a phone, so they must win over the width-based layout rules above.
   Pointer rules key on the input device, not the window: a tablet needs 44px
   targets even when it has room for the desktop layout. */
@media (pointer: coarse) {
  /* Apple and Google both put the comfortable minimum tap target at ~44px.
     Desktop sizing is deliberately tighter, so this only loosens it. */
  .btn { min-height: 44px; padding-inline: 15px; }
  .btn-sm { min-height: 38px; }
  .btn-icon { width: 44px; height: 44px; }
  .nav-item { min-height: 46px; }
  .segment { min-height: 42px; }
  .cal-day-head { min-height: 32px; }
  .cal-add { opacity: 0.55; }
  /* Hover never fires on touch, so the row menu is always reachable. */
  .sermon-menu-toggle { opacity: 0.7; }
  .sermon-item:hover .sermon-menu-toggle { opacity: 1; }
  /* Hover never fires on touch, so the affordance is always visible. */
  .cal-day:active .cal-add,
  .cal-day-head:focus .cal-add { opacity: 1; }
}

@media (max-width: 768px) {
  /* iOS Safari zooms the whole page when a focused field is under 16px, which
     then leaves the layout scrolled sideways. 16px is the entire fix. */
  .input,
  .select,
  .textarea,
  input,
  select,
  textarea { font-size: 16px; }

  /* 14px is comfortable on a desktop monitor and cramped on a phone. */
  body { font-size: 15px; }

  /* A centred dialog on a short screen pushes its own header off the top.
     Anchor it to the bottom as a sheet instead, and reserve the home bar. */
  .modal-backdrop { align-items: end; padding: 0; }
  .modal,
  .modal-sm,
  .modal-lg {
    width: 100%; max-width: none; max-height: 92dvh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0; border-bottom: 0;
  }
  .modal-body { max-height: 66dvh; padding: 16px; }
  .modal-head { padding: 14px 16px; }
  .modal-foot {
    padding: 12px 16px max(12px, env(safe-area-inset-bottom));
    flex-wrap: wrap;
  }
  .modal-foot .btn { flex: 1 1 auto; }

  /* Long unbroken strings — model ids, filenames, hashes — must wrap rather
     than push the whole page sideways. */
  .prose,
  .ref-text,
  .flag-evidence,
  .doc-title,
  code { overflow-wrap: anywhere; }
}

/* Notches and home indicators: keep controls out from under the hardware. */
@media (max-width: 1024px) {
  .sidebar {
    padding-top: max(14px, env(safe-area-inset-top));
    padding-bottom: max(14px, env(safe-area-inset-bottom));
    padding-left: max(12px, env(safe-area-inset-left));
  }
}
@supports (padding: env(safe-area-inset-bottom)) {
  .topbar {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
  .content { padding-bottom: max(40px, env(safe-area-inset-bottom)); }
  .toast-stack { bottom: max(12px, env(safe-area-inset-bottom)); }
  .landing-nav { padding-top: max(13px, env(safe-area-inset-top)); }
  .landing-foot { padding-bottom: max(22px, env(safe-area-inset-bottom)); }
}

/* ===== 25. Printing from inside the app =====
   Cmd/Ctrl-P is intercepted and sent to /sermons/{id}/print, but the browser's
   own File > Print cannot be. This makes that path presentable rather than
   printing the sidebar, the sermon list and three scrollable textareas. */
@media print {
  .sidebar, .topbar, .toast-stack, .modal-backdrop, .scrim,
  .sermon-sidebar, .card-actions, .stage-actions, .card-actions *,
  .landing-nav, .landing-foot, .topbar-actions { display: none !important; }

  body { background: #fff; color: #000; }
  .app-shell { display: block; min-height: 0; }
  .content { padding: 0; }
  .view, .sermon-layout, .sermon-detail, .stack { display: block; }
  .card { border: 0; box-shadow: none; background: transparent; }
  .card-head { border-bottom: 1px solid #d8dde5; }
  .stage { border: 0; padding: 0; background: transparent; }
  /* Nothing generated yet means nothing worth a sheet of paper. */
  .stage:not(.is-filled) { display: none; }

  /* The manuscript lives in a textarea; let it flow as text instead of
     printing as a scrollable box. */
  .stage-text, .textarea {
    height: auto; min-height: 0; max-height: none; overflow: visible;
    padding: 0; border: 0; font-size: 12pt; line-height: 1.6; color: #000;
    field-sizing: content;
  }
  .prose, .prose-text { max-width: none; color: #000; font-size: 12pt; }
  .badge { border-color: #d8dde5; color: #000; }
}

/* ===== 26. Motion preferences ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important; scroll-behavior: auto !important;
  }
}
