/* ═══════════════════════════════════════════════════════════
   Parcane — Design System
   
   The Weaver's Study: dark fantasy aesthetic inspired by the
   Parcae (Roman Fates) and arcane knowledge. Golden threads
   on midnight indigo. Swappable via CSS custom properties.
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;500;600;700&family=Inter:wght@400;500;600;700&family=Lora:ital,wght@0,400;0,600;1,400&display=swap');

/* ── Tokens ──────────────────────────────────────────────── */

/* ═══════════════════════════════════════════════════════════
   Design Tokens — The Weaver's Study (dark-only)

   Parcane is dark-only (light mode retired 2026-07-09). These are the
   canonical tokens: deep indigo + golden thread, inspired by the Parcae.
   There is intentionally no light palette and no [data-theme] variable
   switch — `data-theme="dark"` is hardcoded on <html> purely so the
   element-level "Arcane Visual Layer" selectors below keep matching.
   ═══════════════════════════════════════════════════════════ */

:root {
  /* Deep indigo surfaces */
  --bg:          #0b0d17;
  --bg-subtle:   #10132a;
  --surface:     #161929;
  --surface-alt: #1c1f35;
  --border:      rgba(212, 163, 77, 0.12);
  --border-strong: rgba(212, 163, 77, 0.22);

  /* Text */
  --ink:         #e8e0d4;
  --ink-muted:   #a89e90;
  --ink-faint:   #6e6458;

  /* Golden thread accent */
  --accent:      #d4a34d;
  --accent-hover:#f0c86e;
  --accent-soft: rgba(212, 163, 77, 0.10);
  --accent-border: rgba(212, 163, 77, 0.25);

  /* Arcane glow token — used for hover effects and emphasis */
  --glow:        rgba(212, 163, 77, 0.35);
  --glow-strong: rgba(240, 200, 110, 0.5);

  /* Success / Status */
  --success:     #6aad7c;
  --success-bg:  rgba(106, 173, 124, 0.1);
  --error:       #e05a4c;
  --error-bg:    rgba(224, 90, 76, 0.1);

  /* Layout */
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   20px;
  --shadow-sm:   0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md:   0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg:   0 12px 40px rgba(0, 0, 0, 0.5);

  --max-width:   1080px;
  --header-h:    88px;

  color-scheme: dark;
}

/* Dark theme overrides for elements with hardcoded colors */
[data-theme="dark"] .site-header {
  background: rgba(11, 13, 23, 0.95);
}

[data-theme="dark"] .mode-tab:hover {
  background: rgba(22, 25, 41, 0.5);
}

[data-theme="dark"] textarea,
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] select {
  background: var(--surface);
  color: var(--ink);
}

/* ── Reset & Base ────────────────────────────────────────── */

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

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: 'Lora', Georgia, serif;
  font-weight: 600;
  line-height: 1.3;
  margin: 0;
}

/* Arcane display font for dark theme headlines */
[data-theme="dark"] h1,
[data-theme="dark"] h2 {
  font-family: 'Cinzel', 'Lora', Georgia, serif;
  font-weight: 500;
  letter-spacing: 0.02em;
}

p { margin: 0 0 1em; }

/* ── Layout ──────────────────────────────────────────────── */

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.page-section {
  padding: 80px 0;
}

.page-section + .page-section {
  border-top: 1px solid var(--border);
}

/* ── Header ──────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: rgba(250, 248, 245, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.site-logo {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.site-logo:hover {
  text-decoration: none;
  color: var(--ink);
}

.site-logo .logo-icon {
  font-size: 1.4rem;
}

.logo-icon-img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  flex: 0 0 auto;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.header-nav a {
  color: var(--ink-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.15s, opacity 0.15s;
}

/* Smooth show/hide for auth-aware nav items */
.header-nav .nav-guest,
.header-nav .nav-auth {
  transition: opacity 0.15s ease;
}

.header-nav a:hover {
  color: var(--ink);
  text-decoration: none;
}

.header-nav a.btn-primary {
  color: #fff;
}

.header-nav a.btn-primary:hover {
  color: #fff;
}

/* Active page indicator */
.header-nav a.nav-active {
  color: var(--accent);
  position: relative;
}

.header-nav a.nav-active::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}

/* Sync indicator */
.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--ink-faint);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.sync-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--ink-faint);
}

.sync-pill.pending {
  background: rgba(212, 163, 77, 0.1);
  border-color: rgba(212, 163, 77, 0.3);
  color: var(--accent);
  animation: pulseSync 2s infinite;
}

.sync-pill.is-offline {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

.sync-pill .sync-icon {
  display: inline-block;
}

.sync-pill .sync-icon.syncing {
  animation: rotateSync 1.5s linear infinite;
}

@keyframes rotateSync {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes pulseSync {
  0% { box-shadow: 0 0 0 0 rgba(212, 163, 77, 0.2); }
  70% { box-shadow: 0 0 0 6px rgba(212, 163, 77, 0); }
  100% { box-shadow: 0 0 0 0 rgba(212, 163, 77, 0); }
}

/* ── Buttons ─────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  color: #fff;
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border-strong);
}

.btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: var(--ink-faint);
  text-decoration: none;
}

.btn-large {
  font-size: 1rem;
  padding: 14px 28px;
  border-radius: var(--radius-lg);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* ── Cards ───────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}

/* ── Form Elements ───────────────────────────────────────── */

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.form-hint {
  font-size: 0.85rem;
  color: var(--ink-faint);
  margin-top: 4px;
}

textarea, input[type="text"], input[type="email"], input[type="password"], input[type="number"] {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
  resize: vertical;
}

textarea:focus, input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea {
  min-height: 180px;
  line-height: 1.6;
}

select {
  font: inherit;
  font-size: 0.95rem;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

/* ── Checkbox / Consent ──────────────────────────────────── */

.consent-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin: 24px 0;
}

.consent-box h4 {
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--ink);
}

.consent-box p {
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin-bottom: 12px;
  line-height: 1.6;
}

.consent-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.consent-check input[type="checkbox"] {
  margin-top: 3px;
  accent-color: var(--accent);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.consent-check label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}

/* ── Hero ────────────────────────────────────────────────── */

.hero {
  text-align: center;
  padding: 100px 0 80px;
}

.hero-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}

.hero-text {
  text-align: left;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  max-width: 640px;
  margin: 0 0 20px;
  color: var(--ink);
}

.hero .subtitle {
  font-size: 1.15rem;
  color: var(--ink-muted);
  max-width: 520px;
  margin: 0 0 36px;
  line-height: 1.65;
}

.hero-cta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ── Trust Strip (below hero CTA) ────────────────────────── */

.trust-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
  animation: trustFadeIn 0.8s ease 0.3s both;
}

@keyframes trustFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.trust-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink);
  padding: 6px 14px;
  border-radius: 100px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  white-space: nowrap;
  transition: all 0.2s ease;
  letter-spacing: 0.01em;
  box-shadow: var(--shadow-sm);
}

.trust-pill-link {
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
}

.trust-pill-link:hover {
  background: rgba(212, 163, 77, 0.18);
  color: var(--accent-hover);
  text-decoration: none;
  box-shadow: 0 0 12px var(--accent-soft);
}

.hero-illustration {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 480px;
}

.hero-illustration picture {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  flex: 0 0 100%;
  min-width: 0;
  margin-top: -210px;
}

.hero-book-img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 480px;
  object-fit: contain;
  animation: bookFloat 6s ease-in-out infinite;
  filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.4));
  /* Fade edges so the image bg blends into the hero gradient */
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, black 40%, transparent 72%);
  mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, black 40%, transparent 72%);
}

@keyframes bookFloat {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-12px) rotate(0.5deg); }
}

/* ── Hero — Typographic Accent (reserved for future variants) ─ */

.hero-accent {
  position: absolute;
  right: 4%;
  bottom: -60px;
  left: 4%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: 36px 40px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.hero-accent-inner {
  display: flex;
  align-items: center;
  gap: 20px;
}

.hero-accent-divider {
  display: block;
  width: 48px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  border-radius: 1px;
}

.hero-accent-tagline {
  font-family: 'Lora', Georgia, serif;
  font-size: clamp(1.2rem, 2.5vw, 1.6rem);
  font-weight: 600;
  font-style: italic;
  color: var(--ink);
  margin: 0;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.hero-accent-stats {
  display: flex;
  gap: 40px;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.hero-stat-value {
  font-family: 'Lora', Georgia, serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.hero-stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}

/* ── Transformation Demo ─────────────────────────────────── */

.demo-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 24px;
  align-items: start;
}

.demo-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 48px;
  font-size: 1.7rem;
  color: var(--accent);
}

.demo-panel {
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.demo-panel-header {
  padding: 12px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.demo-input .demo-panel-header {
  background: var(--bg-subtle);
  color: var(--ink-faint);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.demo-output .demo-panel-header {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  border-bottom: none;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.demo-content {
  padding: 20px;
  font-size: 0.88rem;
  line-height: 1.7;
}

.demo-input .demo-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  color: var(--ink-muted);
  font-family: 'Inter', monospace;
  white-space: pre-wrap;
}

.demo-output .demo-content {
  background: var(--surface);
  border: 1px solid var(--accent-border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  color: var(--ink);
}

.demo-output .demo-content h3 {
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.demo-output .demo-content blockquote {
  margin: 12px 0;
  padding: 8px 16px;
  border-left: 3px solid var(--accent);
  color: var(--ink-muted);
  font-style: italic;
}

/* ── Features ────────────────────────────────────────────── */

.features-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
}

.feature-card {
  flex: 1 1 280px;
  max-width: 400px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.2s;
  display: flex;
  flex-direction: column;
  overflow-wrap: break-word;
  hyphens: auto;
}

.feature-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.feature-icon {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  font-size: 1.6rem;
  margin-bottom: 12px;
}

.custom-icon-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.feature-card h3 {
  font-size: 1rem;
  margin-bottom: 6px;
}

.feature-card p {
  font-size: 0.88rem;
  color: var(--ink-muted);
  margin: 0;
}

.feature-see-more {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.2s, color 0.2s;
}

.feature-see-more:hover {
  opacity: 1;
  color: var(--accent-hover);
  text-decoration: none;
}

.feature-card:hover .feature-see-more {
  opacity: 1;
}

/* ── Trust / How It Works ────────────────────────────────── */

.trust-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  text-align: center;
}

.trust-item {
  padding: 20px;
}

.trust-item .trust-icon {
  display: inline-grid;
  place-items: center;
  width: 52px;
  height: 52px;
  font-size: 2rem;
  margin-bottom: 12px;
}

.trust-item h4 {
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.trust-item p {
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin: 0;
}

/* ── Recap Output Rendering ──────────────────────────────── */

.recap-result {
  display: none;
}

.recap-result.visible {
  display: block;
  animation: fadeSlideIn 0.4s ease;
}

.recap-narrative {
  font-family: 'Lora', Georgia, serif;
  font-size: 1rem;
  line-height: 1.8;
}

.recap-narrative h2, .recap-narrative h3 {
  margin-top: 24px;
  margin-bottom: 8px;
}

.recap-narrative blockquote {
  margin: 16px 0;
  padding: 12px 20px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: var(--ink-muted);
}

.recap-narrative p {
  margin-bottom: 16px;
}

.recap-metadata {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 28px;
}

.meta-section {
  padding: 20px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.meta-section h4 {
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  margin-bottom: 10px;
}

.meta-section ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.meta-section li {
  padding: 6px 0;
  font-size: 0.9rem;
  color: var(--ink);
  border-bottom: 1px solid var(--border);
}

.meta-section li:last-child {
  border-bottom: none;
}

.meta-section li::before {
  margin-right: 8px;
}

.meta-events li::before { content: "⚔️"; }
.meta-npcs li::before { content: "🎭"; }
.meta-threads li::before { content: "🧵"; }
.meta-highlights li::before { content: "✨"; }
.meta-name-questions li::before { content: "?"; color: var(--accent); font-weight: 700; }

/* ── Loading State ───────────────────────────────────────── */

.loading-overlay {
  display: none;
  text-align: center;
  padding: 60px 20px;
}

.loading-overlay.visible {
  display: block;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

.loading-text {
  font-size: 0.95rem;
  color: var(--ink-muted);
}

.loading-subtext {
  font-size: 0.85rem;
  color: var(--ink-faint);
  margin-top: 4px;
}

/* ── Error / Notice ──────────────────────────────────────── */

.notice {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  margin-bottom: 20px;
  display: none;
}

.notice.visible { display: block; }

.notice-error {
  background: var(--error-bg);
  border: 1px solid rgba(192, 57, 43, 0.15);
  color: var(--error);
}

.notice-success {
  background: var(--success-bg);
  border: 1px solid rgba(74, 140, 92, 0.15);
  color: var(--success);
}

/* ── Footer ──────────────────────────────────────────────── */

.site-footer {
  padding: 40px 0;
  border-top: 1px solid var(--border);
  text-align: center;
}

.site-footer p {
  font-size: 0.85rem;
  color: var(--ink-faint);
  margin: 4px 0;
}

.site-footer a {
  color: var(--ink-muted);
}

/* ── Utilities ───────────────────────────────────────────── */

.text-center { text-align: center; }
.text-muted { color: var(--ink-muted); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-40 { margin-top: 40px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.gap-12 { gap: 12px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* ── Input Mode Toggle ───────────────────────────────────── */

.input-mode-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 20px;
}

.mode-tab {
  flex: 1 1 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-tab:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.5);
}

.mode-tab.active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.mode-icon {
  font-size: 1.1rem;
}

/* ── Upload Zone ─────────────────────────────────────────── */

.upload-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--surface-alt);
  margin-bottom: 20px;
  position: relative;
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.upload-zone.drag-over {
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.upload-zone.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.upload-zone-icon {
  font-size: 2.4rem;
  margin-bottom: 12px;
}

.upload-zone-title {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}

.upload-zone-subtitle {
  font-size: 0.9rem;
  color: var(--ink-muted);
  margin-bottom: 12px;
}

.upload-zone-formats {
  font-size: 0.8rem;
  color: var(--ink-faint);
  letter-spacing: 0.02em;
}

/* ── Upload Progress ─────────────────────────────────────── */

.upload-progress {
  text-align: center;
}

.upload-progress-icon {
  font-size: 2rem;
  margin-bottom: 12px;
  animation: pulse 1.5s ease-in-out infinite;
}

.upload-progress-title {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 16px;
}

.upload-progress-bar-track {
  width: 100%;
  max-width: 400px;
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  margin: 0 auto 12px;
  overflow: hidden;
}

.upload-progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.upload-progress-detail {
  font-size: 0.85rem;
  color: var(--ink-muted);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ── Audio Consent Box ───────────────────────────────────── */

.audio-consent-box {
  background: var(--surface-alt);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 20px;
}

.audio-consent-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.audio-consent-icon {
  font-size: 1.2rem;
}

.audio-consent-box h4 {
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}

.audio-consent-box p {
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin-bottom: 12px;
  line-height: 1.6;
}

/* ── Transcription Method Toggle ────────────────────────── */

.transcription-method-toggle {
  margin-bottom: 16px;
}

.method-options {
  display: flex;
  gap: 8px;
}

.method-option {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--surface-alt);
}

.method-option:hover {
  border-color: var(--border-strong);
  background: var(--surface);
}

.method-option.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.method-option input[type="radio"] {
  display: none;
}

.method-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.method-icon {
  font-size: 1.2rem;
  margin-bottom: 2px;
}

.method-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
}

.method-desc {
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.method-option.active .method-name {
  color: var(--accent);
}

/* ── Local Model Status ─────────────────────────────────── */

.local-model-status {
  margin-top: 10px;
  font-size: 0.82rem;
}

.model-status-text {
  display: flex;
  align-items: center;
  gap: 6px;
}

.model-status-loading {
  color: var(--ink-muted);
}

.model-status-ready {
  color: var(--success, #4a8c5c);
  font-weight: 500;
}

.model-status-error {
  color: var(--error, #c0392b);
}

.model-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.model-download-bar {
  width: 100%;
  max-width: 300px;
  height: 4px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 6px;
}

.model-download-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  padding: 0;
  text-decoration: underline;
}

.btn-link:hover {
  color: var(--accent-hover);
}

.model-retry-cloud {
  margin-top: 4px;
  display: block;
}

/* ── Model Quality Picker ───────────────────────────────── */

.model-picker {
  margin-bottom: 8px;
}

.model-picker-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.model-picker-select {
  width: 100%;
  max-width: 340px;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.2s;
}

.model-picker-select:focus {
  outline: none;
  border-color: var(--accent);
}

@media (max-width: 600px) {
  .method-options {
    flex-direction: column;
  }
}

/* ── Animations ──────────────────────────────────────────── */

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 768px) {

  /* ── Container — tighter side padding ───────────────────── */
  .container {
    padding: 0 16px;
  }

  /* ── Header — hide anchor links, keep CTAs ─────────────── */
  .header-nav a:not(.btn):not([href="/app"]):not([href="/"]) {
    display: none;
  }

  .header-nav {
    gap: 12px;
  }

  .header-nav .btn-primary {
    padding: 8px 16px;
    font-size: 0.85rem;
  }

  /* ── Hero — tight, CTA above fold ──────────────────────── */
  .hero {
    padding: 48px 0 32px;
  }

  .hero-layout {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 24px;
  }

  .hero-text {
    text-align: center;
    order: 1;
  }

  .hero-illustration {
    order: 2;
    flex-direction: column;
    align-items: center;
    min-height: 0;
  }

  .hero h1 {
    font-size: clamp(1.5rem, 6vw, 2.4rem);
    margin-bottom: 12px;
  }

  .hero .subtitle {
    font-size: 0.95rem;
    margin-bottom: 24px;
    line-height: 1.55;
  }

  .hero-book-img {
    max-height: 260px;
  }

  .hero-illustration picture {
    margin-top: -20px;
  }

  .hero-accent {
    position: relative;
    right: auto;
    bottom: auto;
    left: auto;
    width: 100%;
    margin-top: -36px;
    padding: 24px 20px;
  }

  .hero-accent-inner {
    gap: 12px;
  }

  .hero-accent-tagline {
    font-size: 1rem;
    white-space: normal;
    text-align: center;
  }

  .hero-accent-divider {
    width: 28px;
  }

  .hero-accent-stats {
    gap: 24px;
  }

  .hero-stat-value {
    font-size: 1.5rem;
  }

  .hero-stat-label {
    font-size: 0.68rem;
  }

  .hero-cta {
    justify-content: center;
  }

  .trust-strip {
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
  }

  .trust-pill {
    font-size: 0.74rem;
    padding: 6px 12px;
  }

  /* ── Touch Targets — 44px minimum ──────────────────────── */
  .btn {
    min-height: 44px;
  }

  .btn-large {
    padding: 12px 24px;
    font-size: 0.95rem;
  }

  .mode-tab {
    min-height: 44px;
    padding: 10px 12px;
  }

  .consent-check {
    min-height: 44px;
    padding: 4px 0;
  }

  .consent-check input[type="checkbox"] {
    width: 20px;
    height: 20px;
  }

  /* ── Page Sections — reduced padding ───────────────────── */
  .page-section {
    padding: 40px 0;
  }

  /* ── Section Typography ────────────────────────────────── */
  .page-section h2 {
    font-size: 1.4rem;
  }

  .page-section h3 {
    font-size: 0.95rem;
  }

  /* ── Demo Section ──────────────────────────────────────── */
  .demo-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .demo-arrow {
    transform: rotate(90deg);
    padding: 0;
    font-size: 1.2rem;
  }

  .demo-content {
    padding: 14px;
    font-size: 0.82rem;
  }

  .demo-panel-header {
    padding: 10px 14px;
    font-size: 0.75rem;
  }

  /* ── Feature Cards ─────────────────────────────────────── */
  .feature-card {
    padding: 16px;
  }

  .feature-icon {
    font-size: 2rem;
    margin-bottom: 10px;
  }

  .feature-card p {
    font-size: 0.82rem;
  }

  /* ── Trust / How It Works ──────────────────────────────── */
  .trust-item {
    padding: 12px;
  }

  .trust-item .trust-icon {
    font-size: 1.6rem;
    margin-bottom: 8px;
  }

  .trust-item p {
    font-size: 0.82rem;
  }

  /* ── Recap Metadata ────────────────────────────────────── */
  .recap-metadata {
    grid-template-columns: 1fr;
  }

  /* ── Input Mode Toggle ─────────────────────────────────── */
  .input-mode-toggle {
    flex-direction: column;
  }

  /* ── Form Grids — stack 2-col to 1-col ─────────────────── */
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* ── Upload Zone — tighter on mobile ───────────────────── */
  .upload-zone {
    padding: 32px 16px;
  }

  .upload-zone-icon {
    font-size: 2rem;
  }

  .upload-zone-title {
    font-size: 1rem;
  }

  /* ── Footer ────────────────────────────────────────────── */
  .site-footer {
    padding: 28px 0;
  }
}

/* ── Session Search ──────────────────────────────────────── */

/* Notebook Management UI */
.btn-icon-sm {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.btn-icon-sm:hover {
  background: var(--bg-soft);
  color: var(--accent);
}

.notebook-add-btn {
  padding: 10px 12px;
  margin-top: 8px;
  border: 1px dashed var(--border-subtle);
  border-radius: 8px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
}

.notebook-add-btn:hover {
  background: var(--bg-soft);
  color: var(--accent);
  border-style: solid;
}

.notebook-select-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.notebook-select-item {
  padding: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
  transition: all 0.2s;
}

.notebook-select-item:hover {
  background: var(--surface);
  border-color: var(--accent);
  transform: translateX(4px);
}

.notebook-select-item span {
  font-size: 1.2rem;
}

.note-mode-toggle {
  display: flex;
  gap: 4px;
  background: var(--bg-soft);
  padding: 2px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

.note-mode-toggle .btn-icon {
  width: 24px;
  height: 24px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  border-radius: 4px;
  color: var(--text-dim);
  background: transparent;
  border: none;
  cursor: pointer;
}

.note-mode-toggle .btn-icon.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.badge-sparkle {
  background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  color: white;
  border: none;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.3);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  display: inline-flex;
  align-items: center;
}

.badge-sparkle i {
  margin-right: 4px;
  font-size: 0.6rem;
}

/* Notes */
.note-card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  margin-bottom: 16px;
  overflow: hidden;
  transition: all 0.2s ease;
}

.campaign-search {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 24px;
}

.search-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.search-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.search-icon {
  font-size: 1.2rem;
}

.search-bar {
  display: flex;
  gap: 8px;
}

.search-bar input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-size: 0.95rem;
  background: var(--bg-subtle);
  color: var(--ink);
  transition: border-color 0.2s;
}

.search-bar input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}

.search-bar button {
  white-space: nowrap;
  padding: 10px 16px;
}

.search-result-card {
  margin-top: 16px;
  padding: 16px 20px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  line-height: 1.6;
}

.search-result-card p {
  margin: 0 0 8px;
}

.search-result-card p:last-child {
  margin-bottom: 0;
}

.search-refs {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.search-ref-label {
  font-size: 0.82rem;
  color: var(--ink-muted);
  font-weight: 500;
}

.search-ref-badge {
  display: inline-block;
  padding: 2px 10px;
  background: var(--accent);
  color: #fff;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.search-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto;
  animation: search-spin 0.8s linear infinite;
}

@keyframes search-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 600px) {
  .search-bar {
    flex-direction: column;
  }
}

/* ═══════════════════════════════════════════════════════════
   ARCANE VISUAL LAYER — Dark Theme Atmospheric Enhancements
   
   Everything below only applies to [data-theme="dark"].
   To revert to the plain dark theme, delete this entire section.
   To swap brand directions, replace these styles.
   ═══════════════════════════════════════════════════════════ */

/* ── Arcane: Logo ────────────────────────────────────────── */

[data-theme="dark"] .site-logo {
  font-family: 'Cinzel', 'Lora', Georgia, serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 1.5rem;
}

@media (max-width: 768px) {
  [data-theme="dark"] .site-logo {
    font-size: 1.32rem;
    letter-spacing: 0.05em;
  }
}

/* ── Arcane: Hero Section ────────────────────────────────── */

[data-theme="dark"] .hero {
  position: relative;
  /* WebP with responsive resolution (browsers pick best match for device pixel ratio) */
  background: url('/img/hero-bg-1920.webp') center center / cover no-repeat;
  background: -webkit-image-set(
    url('/img/hero-bg-1920.webp') 1x,
    url('/img/hero-bg-1920@2x.webp') 2x
  ) center center / cover no-repeat;
  background: image-set(
    url('/img/hero-bg-1920.webp') 1x,
    url('/img/hero-bg-1920@2x.webp') 2x
  ) center center / cover no-repeat;
  padding: 120px 0 100px;
  overflow: hidden;
}

/* Ensure text sits above background */
[data-theme="dark"] .hero .container {
  position: relative;
  z-index: 2;
}

[data-theme="dark"] .hero h1 {
  color: #f0e8d8;
  text-shadow: 0 2px 20px rgba(212, 163, 77, 0.15);
}

[data-theme="dark"] .hero .subtitle {
  color: #a89e90;
}

/* Glassmorphic backdrop so text reads over the hero bg image */
[data-theme="dark"] .hero-accent {
  background: rgba(11, 13, 23, 0.7);
  border: 1px solid rgba(212, 163, 77, 0.15);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .hero-accent-tagline {
  color: #f0e8d8;
  text-shadow: 0 1px 8px rgba(212, 163, 77, 0.15);
}

[data-theme="dark"] .hero-stat-label {
  color: #a89e90;
}

/* ── Arcane: Buttons ─────────────────────────────────────── */

[data-theme="dark"] .btn-primary {
  background: linear-gradient(135deg, #c4923a, #d4a34d);
  color: #0b0d17;
  font-weight: 700;
  box-shadow: 0 2px 12px rgba(212, 163, 77, 0.25);
  border: 1px solid rgba(240, 200, 110, 0.3);
}

[data-theme="dark"] .btn-primary:hover {
  background: linear-gradient(135deg, #d4a34d, #f0c86e);
  box-shadow: 0 4px 24px rgba(212, 163, 77, 0.45), 0 0 40px rgba(212, 163, 77, 0.15);
  color: #0b0d17;
  transform: translateY(-2px);
}

[data-theme="dark"] .btn-secondary {
  background: rgba(22, 25, 41, 0.6);
  border: 1px solid rgba(212, 163, 77, 0.2);
  color: var(--ink);
  backdrop-filter: blur(8px);
}

[data-theme="dark"] .btn-secondary:hover {
  background: rgba(28, 31, 53, 0.8);
  border-color: rgba(212, 163, 77, 0.4);
  box-shadow: 0 0 20px rgba(212, 163, 77, 0.1);
}

/* ── Arcane: Section Dividers ────────────────────────────── */

[data-theme="dark"] .page-section + .page-section {
  border-top: 1px solid rgba(212, 163, 77, 0.08);
}

[data-theme="dark"] .page-section {
  position: relative;
}

/* ── Arcane: Feature Cards — Glassmorphism ────────────────── */

[data-theme="dark"] .feature-card {
  background: rgba(22, 25, 41, 0.5);
  border: 1px solid rgba(212, 163, 77, 0.1);
  backdrop-filter: blur(12px);
  transition: all 0.3s ease;
}

[data-theme="dark"] .feature-card:hover {
  background: rgba(28, 31, 53, 0.7);
  border-color: rgba(212, 163, 77, 0.3);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(212, 163, 77, 0.15),
    inset 0 1px 0 rgba(212, 163, 77, 0.1);
  transform: translateY(-4px);
}

[data-theme="dark"] .feature-card h3 {
  color: #f0e8d8;
}

[data-theme="dark"] .feature-icon {
  filter: saturate(1.2) brightness(1.1);
}

/* ── Arcane: Demo Panels ─────────────────────────────────── */

[data-theme="dark"] .demo-input .demo-panel-header {
  background: rgba(16, 19, 42, 0.8);
  border-color: rgba(212, 163, 77, 0.1);
}

[data-theme="dark"] .demo-input .demo-content {
  background: rgba(22, 25, 41, 0.4);
  border-color: rgba(212, 163, 77, 0.1);
}

[data-theme="dark"] .demo-output .demo-panel-header {
  background: rgba(212, 163, 77, 0.08);
  border-color: rgba(212, 163, 77, 0.2);
}

[data-theme="dark"] .demo-output .demo-content {
  background: rgba(22, 25, 41, 0.4);
  border-color: rgba(212, 163, 77, 0.2);
}

[data-theme="dark"] .demo-arrow {
  color: var(--accent);
  text-shadow: 0 0 12px rgba(212, 163, 77, 0.4);
}

/* ── Arcane: Trust / How It Works ────────────────────────── */

[data-theme="dark"] .trust-item {
  padding: 24px;
  border-radius: var(--radius-lg);
  transition: background 0.3s ease;
}

[data-theme="dark"] .trust-item:hover {
  background: rgba(212, 163, 77, 0.04);
}

[data-theme="dark"] .trust-item .trust-icon {
  filter: saturate(1.2) brightness(1.1);
}

/* ── Arcane: Footer ──────────────────────────────────────── */

[data-theme="dark"] .site-footer {
  background: rgba(8, 10, 18, 0.6);
  border-top-color: rgba(212, 163, 77, 0.08);
}

/* ── Arcane: Search ──────────────────────────────────────── */

[data-theme="dark"] .campaign-search {
  background: rgba(22, 25, 41, 0.5);
  border-color: rgba(212, 163, 77, 0.12);
  backdrop-filter: blur(8px);
}

[data-theme="dark"] .search-result-card {
  background: rgba(16, 19, 42, 0.6);
  border-color: rgba(212, 163, 77, 0.1);
}

/* ── Arcane: Cards / Surfaces ────────────────────────────── */

[data-theme="dark"] .card {
  background: rgba(22, 25, 41, 0.5);
  border-color: rgba(212, 163, 77, 0.1);
  backdrop-filter: blur(12px);
}

[data-theme="dark"] .consent-box,
[data-theme="dark"] .audio-consent-box {
  background: rgba(22, 25, 41, 0.4);
  border-color: rgba(212, 163, 77, 0.15);
}

/* ── Arcane: Upload Zone ─────────────────────────────────── */

[data-theme="dark"] .upload-zone {
  background: rgba(22, 25, 41, 0.3);
  border-color: rgba(212, 163, 77, 0.2);
}

[data-theme="dark"] .upload-zone:hover,
[data-theme="dark"] .upload-zone.drag-over {
  border-color: var(--accent);
  background: rgba(212, 163, 77, 0.06);
  box-shadow: 0 0 30px rgba(212, 163, 77, 0.1);
}

/* ── Arcane: Meta Sections ───────────────────────────────── */

[data-theme="dark"] .meta-section {
  background: rgba(22, 25, 41, 0.4);
  border-color: rgba(212, 163, 77, 0.1);
}

/* ── Arcane: Loading Spinner ─────────────────────────────── */

[data-theme="dark"] .loading-spinner {
  border-color: rgba(212, 163, 77, 0.15);
  border-top-color: var(--accent);
}

/* ── Arcane: Input Mode Toggle ───────────────────────────── */

[data-theme="dark"] .input-mode-toggle {
  background: rgba(16, 19, 42, 0.6);
  border-color: rgba(212, 163, 77, 0.1);
}

[data-theme="dark"] .mode-tab.sync-pill.pending {
  background: rgba(212, 163, 77, 0.1);
  border-color: rgba(212, 163, 77, 0.3);
  color: var(--accent);
}

.sync-pill.is-offline {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

.sync-pill .sync-icon {
  display: inline-block;
  transition: transform 0.3s ease;
}

.sync-pill .sync-icon.syncing {
  animation: rotateSync 1.5s linear infinite;
}

@keyframes rotateSync {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ── Arcane: Focus States ────────────────────────────────── */

[data-theme="dark"] textarea:focus,
[data-theme="dark"] input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(212, 163, 77, 0.12), 0 0 20px rgba(212, 163, 77, 0.08);
}

/* ── Arcane: Scrollbar ───────────────────────────────────── */

[data-theme="dark"] ::-webkit-scrollbar {
  width: 8px;
}

[data-theme="dark"] ::-webkit-scrollbar-track {
  background: var(--bg);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: rgba(212, 163, 77, 0.2);
  border-radius: 4px;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(212, 163, 77, 0.35);
}

/* ── Arcane: Animations ──────────────────────────────────── */

@keyframes threadWeave {
  0%, 100% {
    transform: translateX(-5%) scaleX(0.8) rotate(-1deg);
    opacity: 0.4;
  }
  50% {
    transform: translateX(5%) scaleX(1) rotate(1deg);
    opacity: 0.8;
  }
}

/* Subtle golden shimmer for accented elements */
@keyframes arcaneShimmer {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* ── Arcane: Mobile Overrides ────────────────────────────── */

@media (max-width: 768px) {
  [data-theme="dark"] .hero {
    padding: 48px 0 32px;
  }

  [data-theme="dark"] .hero h1 {
    font-size: clamp(1.5rem, 6vw, 2.4rem);
  }

  /* Reduce book float animation on mobile for less motion */
  .hero-book-img {
    animation: bookFloat 8s ease-in-out infinite;
  }

  @keyframes bookFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-6px); }
  }

  /* Compact feature cards in dark theme */
  [data-theme="dark"] .feature-card:hover {
    transform: translateY(-2px);
  }

  [data-theme="dark"] .trust-item {
    padding: 16px;
  }
}

/* ═══════════════════════════════════════════════════════════
   Auth Integration — Header, Modals, Credits
   ═══════════════════════════════════════════════════════════ */

/* ── Credit Pill ─────────────────────────────────────────── */

.credit-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.credit-pill .credit-icon {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  font-size: 0.9rem;
}

.credit-pill .credit-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.credit-pill.credit-low {
  color: #c0392b;
  background: var(--error-bg);
  border-color: rgba(192, 57, 43, 0.2);
}

.credit-pill.credit-zero {
  color: #c0392b;
  background: var(--error-bg);
  border-color: rgba(192, 57, 43, 0.3);
  animation: creditPulse 2s ease-in-out infinite;
}

@keyframes creditPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ── User Menu / Dropdown ────────────────────────────────── */

/* ── Profile Switcher ────────────────────────────────────── */
.profile-switcher {
  position: relative;
  display: flex;
  align-items: center;
  margin-right: 8px;
}

.profile-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(212, 163, 77, 0.08);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 6px 12px;
  color: var(--accent);
  font-weight: 500;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.profile-trigger:hover {
  background: rgba(212, 163, 77, 0.15);
  border-color: var(--accent);
  box-shadow: 0 0 10px var(--accent-soft);
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 8px;
  display: none;
  z-index: 1000;
  backdrop-filter: blur(12px);
  animation: dropdownFadeIn 0.2s ease-out;
}

.profile-switcher.open .profile-dropdown {
  display: block;
}

.profile-item {
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-item:hover {
  background: var(--surface-hover);
  color: var(--ink);
}

.profile-item.active {
  background: rgba(212, 163, 77, 0.12);
  color: var(--accent);
  font-weight: 600;
}

.profile-settings-link {
  display: block;
  padding: 8px 12px;
  font-size: 0.82rem;
  color: var(--ink-faint) !important;
  text-decoration: none;
  transition: color 0.2s ease;
}

.profile-settings-link:hover {
  color: var(--ink) !important;
}

.user-menu {
  position: relative;
}

.user-menu-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 4px 10px;
  cursor: pointer;
  font: inherit;
  font-size: 0.88rem;
  color: var(--ink-muted);
  transition: all 0.15s;
}

.user-menu-trigger:hover {
  background: var(--bg-subtle);
  border-color: var(--border);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  flex-shrink: 0;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.user-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.dropdown-arrow {
  font-size: 0.7rem;
  opacity: 0.6;
  transition: transform 0.2s;
}

.user-menu.open .dropdown-arrow {
  transform: rotate(180deg);
}

.user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  padding: 6px 0;
  animation: dropdownIn 0.15s ease;
}

.user-menu.open .user-dropdown {
  display: block;
}

@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.user-dropdown .dropdown-header {
  padding: 10px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.user-dropdown .dropdown-header .text-muted {
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-dropdown hr {
  margin: 4px 0;
  border: none;
  border-top: 1px solid var(--border);
}

.user-dropdown a {
  display: block;
  padding: 8px 14px;
  font-size: 0.88rem;
  color: var(--ink);
  text-decoration: none;
  transition: background 0.1s;
}

.user-dropdown a:hover {
  background: var(--bg-subtle);
  text-decoration: none;
}

.tier-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 10px;
  line-height: 1.4;
}

.tier-badge.tier-free {
  background: var(--bg-subtle);
  color: var(--ink-faint);
  border: 1px solid var(--border);
}

.tier-badge.tier-scribe {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

.tier-badge.tier-loremaster {
  background: rgba(130, 80, 223, 0.08);
  color: #8250df;
  border: 1px solid rgba(130, 80, 223, 0.2);
}

/* ── Generic Modal (.modal) ─────────────────────────────── */
/* Used by Notebook and Move-Note modals (distinct from .modal-overlay) */

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: modalFadeIn 0.2s ease;
}

.modal.active {
  display: flex;
}

.modal .modal-content {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: modalSlideIn 0.25s ease;
  max-height: 90vh;
  overflow-y: auto;
}

.modal .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal .modal-header h2 {
  font-size: 1.2rem;
  margin: 0;
}

.modal .btn-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--ink-faint);
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s;
  line-height: 1;
}

.modal .btn-close:hover {
  background: var(--bg-subtle);
  color: var(--ink);
}

[data-theme="dark"] .modal {
  background: rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .modal .modal-content {
  background: var(--surface-alt);
  border-color: rgba(212, 163, 77, 0.15);
}

/* ── Modal Overlay ───────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: modalSlideIn 0.25s ease;
  max-height: 90vh;
  overflow-y: auto;
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header h3 {
  font-size: 1.2rem;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--ink-faint);
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s;
}

.modal-close:hover {
  background: var(--bg-subtle);
  color: var(--ink);
}

/* ── Image Lightbox ───────────────────────────────────────── */

.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(8px);
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: modalFadeIn 0.2s ease;
}

.lightbox-content {
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

#lightbox-image {
  max-width: 100%;
  max-height: calc(90vh - 60px);
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

.lightbox-caption {
  color: #fff;
  font-size: 0.95rem;
  text-align: center;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 16px;
  max-width: 80%;
  word-break: break-word;
}

.lightbox-close {
  position: fixed;
  top: 24px;
  right: 24px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 1.5rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 610;
}

.lightbox-close:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: scale(1.1);
}

.lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 2.5rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 610;
  line-height: 1;
  padding: 0;
}

.lightbox-nav:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
  left: 24px;
}

.lightbox-next {
  right: 24px;
}

@media (max-width: 768px) {
  .lightbox-close {
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }
  
  .lightbox-nav {
    width: 44px;
    height: 44px;
    font-size: 2rem;
  }
  
  .lightbox-prev {
    left: 16px;
  }
  
  .lightbox-next {
    right: 16px;
  }
}

/* ── New Session Options ──────────────────────────────────── */

.session-details-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 16px;
  margin-bottom: 18px;
}

.session-details-heading,
.session-step-heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.session-step-heading {
  margin: 0 0 12px;
}

.session-step-heading-compact {
  margin-top: 18px;
}

.session-details-heading h3,
.session-step-heading h3 {
  margin: 0 0 3px;
  color: var(--ink);
  font-size: 1rem;
}

.session-details-heading p,
.session-step-heading p {
  margin: 0;
  color: var(--ink-faint);
  font-size: 0.84rem;
  line-height: 1.4;
}

.session-step-label {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  flex: 0 0 auto;
}

.session-details-grid {
  display: grid;
  grid-template-columns: minmax(120px, 160px) minmax(160px, 220px);
  gap: 14px;
  margin-top: 14px;
}

.new-session-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.new-session-option {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  text-align: left;
}

.new-session-option:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

.session-option-icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.session-option-content {
  flex: 1;
}

.session-option-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}

.session-option-desc {
  font-size: 0.85rem;
  color: var(--ink-faint);
  line-height: 1.4;
}

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

  .new-session-option {
    padding: 16px;
    align-items: flex-start;
  }
}

/* ── Credit Packs ────────────────────────────────────────── */

.credit-packs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.credit-pack {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s;
  background: var(--surface);
}

.credit-pack:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.pack-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pack-amount {
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink);
}

.pack-detail {
  font-size: 0.82rem;
  color: var(--ink-faint);
}

.pack-price {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent);
}

/* ── Insufficient Credits Banner ─────────────────────────── */

.credits-error {
  background: var(--error-bg);
  border: 1px solid rgba(192, 57, 43, 0.15);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
}

.credits-error p {
  margin: 0 0 12px;
  color: var(--error);
  font-weight: 500;
}

.credits-error .credit-cta {
  display: inline-flex;
  gap: 8px;
}

/* ── Dark Theme Overrides ────────────────────────────────── */

[data-theme="dark"] .user-dropdown {
  background: var(--surface-alt);
  border-color: rgba(212, 163, 77, 0.15);
}

[data-theme="dark"] .user-dropdown a:hover {
  background: rgba(212, 163, 77, 0.06);
}

[data-theme="dark"] .modal-overlay {
  background: rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .modal-card {
  background: var(--surface-alt);
  border-color: rgba(212, 163, 77, 0.15);
}

[data-theme="dark"] .credit-pack:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(212, 163, 77, 0.08);
}

[data-theme="dark"] .tier-badge.tier-loremaster {
  background: rgba(180, 140, 255, 0.1);
  color: #b48cff;
  border-color: rgba(180, 140, 255, 0.2);
}

/* ── Mobile: Auth Components ─────────────────────────────── */

@media (max-width: 768px) {
  .credit-pill {
    font-size: 0.78rem;
    padding: 3px 8px;
  }

  .user-name {
    display: none;
  }

  .user-dropdown {
    right: -12px;
    min-width: 200px;
  }

  .modal-card {
    padding: 24px;
    margin: 16px;
  }

  .credit-packs {
    gap: 8px;
  }
}

/* ═══════════════════════════════════════════════════════════
   Bulk Import — Session Preview, Progress, Credit Estimate
   ═══════════════════════════════════════════════════════════ */

.bulk-import-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-top: 24px;
}

.bulk-import-panel h3 { margin-bottom: 16px; }

.bulk-import-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.session-preview-list {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin: 16px 0;
}

.session-preview-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

.session-preview-item:last-child { border-bottom: none; }

.session-preview-num {
  font-weight: 700;
  font-size: 0.82rem;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  border-radius: 6px;
  padding: 2px 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

.session-preview-info { flex: 1; min-width: 0; }

.session-preview-header {
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-preview-meta {
  font-size: 0.8rem;
  color: var(--ink-faint);
}

.session-preview-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-faint);
  padding: 4px;
  font-size: 0.9rem;
  border-radius: 4px;
  transition: all 0.15s;
  flex-shrink: 0;
}

.session-preview-remove:hover {
  color: var(--error);
  background: var(--error-bg);
}

.credit-estimate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  margin: 16px 0;
  flex-wrap: wrap;
  gap: 8px;
}

.credit-estimate-text { font-size: 0.9rem; color: var(--ink); }
.credit-estimate-text strong { color: var(--accent); }

.credit-estimate.insufficient {
  background: var(--error-bg);
  border-color: rgba(192, 57, 43, 0.2);
}

.credit-estimate.insufficient .credit-estimate-text { color: var(--error); }

.term-highlight-wrap {
  position: relative;
  width: 100%;
  background: var(--surface);
  border-radius: var(--radius-md);
}

.term-highlight-wrap.dark-wrap {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
}

.term-highlight-wrap textarea {
  position: relative;
  z-index: 2;
  background: transparent !important;
}

.term-highlight-backdrop {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: none;
  overflow: hidden;
  box-sizing: border-box;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: transparent;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.6;
  pointer-events: none;
  resize: none;
  white-space: pre-wrap;
  word-break: break-word;
}

.term-highlight-wrap.dark-wrap .term-highlight-backdrop {
  padding: 12px;
  border-radius: 6px;
  font-size: 0.9rem;
}

.term-highlight-backdrop .term-mark {
  color: transparent;
  border-radius: 3px;
  padding: 1px 0;
}

.term-highlight-backdrop .term-mark.correction {
  background: rgba(245, 158, 11, 0.34);
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.18);
}

.term-highlight-backdrop .term-mark.possible {
  background: rgba(59, 130, 246, 0.22);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.15);
}

.term-highlight-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  padding: 9px 10px;
  border: 1px solid rgba(200, 151, 62, 0.28);
  border-radius: 8px;
  background: rgba(200, 151, 62, 0.1);
}

.term-highlight-action-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  font-size: 0.86rem;
}

.term-highlight-action-kicker {
  color: var(--ink-faint);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.term-highlight-action-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.term-review-panel {
  margin-top: 10px;
  border: 1px solid rgba(200, 151, 62, 0.28);
  background: rgba(200, 151, 62, 0.08);
  border-radius: 8px;
  padding: 12px;
}

.term-review-panel.dark-panel {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
}

.term-review-header,
.term-review-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.term-review-header {
  margin-bottom: 10px;
}

.term-review-header strong {
  display: block;
  font-size: 0.88rem;
}

.term-review-header p,
.term-review-reason {
  margin: 2px 0 0;
  color: var(--ink-faint);
  font-size: 0.78rem;
}

.term-review-row {
  border-top: 1px solid rgba(200, 151, 62, 0.18);
  padding-top: 9px;
  margin-top: 9px;
}

.term-review-term {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.9rem;
}

.term-original {
  color: var(--warning, #b45309);
  text-decoration: line-through;
}

.term-canonical {
  color: var(--ink);
  font-weight: 700;
}

.term-arrow {
  color: var(--ink-faint);
}

.term-review-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .term-review-header,
  .term-review-row {
    align-items: stretch;
    flex-direction: column;
  }

  .term-review-actions {
    justify-content: flex-start;
  }

  .term-highlight-action {
    align-items: stretch;
    flex-direction: column;
  }

  .term-highlight-action-buttons {
    justify-content: flex-start;
  }
}

.batch-progress { padding: 24px; text-align: center; }

.batch-progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-subtle);
  border-radius: 4px;
  overflow: hidden;
  margin: 16px 0 12px;
}

.batch-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.batch-progress-status {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}

.batch-progress-detail { font-size: 0.85rem; color: var(--ink-muted); }
.batch-progress-estimate { font-size: 0.82rem; color: var(--ink-faint); margin-top: 4px; }

.detection-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 8px;
  margin-left: 8px;
  cursor: default;
  user-select: none;
}

.detection-badge.high { background: var(--success-bg); color: var(--success); border: 1px solid rgba(74, 140, 92, 0.15); }
.detection-badge.medium { background: rgba(230, 160, 40, 0.08); color: #b8860b; border: 1px solid rgba(230, 160, 40, 0.2); }
.detection-badge.low { background: var(--error-bg); color: var(--error); border: 1px solid rgba(192, 57, 43, 0.15); }

.file-drop-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 12px;
}

.file-drop-zone:hover, .file-drop-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.file-drop-zone-text { font-size: 0.88rem; color: var(--ink-muted); }
.file-drop-zone-formats { font-size: 0.78rem; color: var(--ink-faint); margin-top: 4px; }

[data-theme="dark"] .session-preview-list { border-color: rgba(212, 163, 77, 0.1); }
[data-theme="dark"] .session-preview-item { border-color: rgba(212, 163, 77, 0.08); }
[data-theme="dark"] .batch-progress-bar { background: rgba(212, 163, 77, 0.08); }

/* ── Shared Recap Page ──────────────────────────────────── */

.shared-campaign-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 12px;
}

.shared-cta-banner {
  display: none;
  border-top: 1px solid var(--accent-border);
  background: var(--accent-soft);
  padding: 28px 0;
  text-align: center;
}

.shared-cta-banner p {
  font-size: 0.95rem;
  color: var(--ink-muted);
  margin: 0 0 12px;
}

.shared-cta-banner strong {
  color: var(--accent);
}

/* ── Share Button & Badge ───────────────────────────────── */

.btn-share {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

.btn-share:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  text-decoration: none;
}

.share-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  transition: all 0.15s;
}

.share-badge:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Share popover for timeline entries */
.share-popover {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 6px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: var(--shadow-md);
  z-index: 50;
  min-width: 280px;
}

.share-popover.visible {
  display: block;
  animation: fadeSlideIn 0.2s ease;
}

.share-popover-url {
  font-size: 0.82rem;
  font-family: 'Inter', monospace;
  color: var(--ink-muted);
  background: var(--bg-subtle);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  word-break: break-all;
  user-select: all;
}

.share-popover-actions {
  display: flex;
  gap: 8px;
}

.share-popover-actions .btn {
  font-size: 0.8rem;
  padding: 6px 12px;
}

/* Dark theme overrides for share elements */
[data-theme="dark"] .share-popover {
  background: var(--surface-alt);
  border-color: rgba(212, 163, 77, 0.2);
}

[data-theme="dark"] .share-popover-url {
  background: var(--bg-subtle);
}

/* ── Marketing Carousel — "See It In Action" ─────────────── */

.gallery-header {
  display: none; /* Hidden by default on desktop — auto-detects device */
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 20px 0 28px;
}

/* Only show the toggle on mobile-sized viewports (for context, not switching) */
@media (max-width: 768px) {
  .gallery-header {
    display: none; /* Hide entirely — auto-detection handles it */
  }
}

.gallery-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.gallery-toggle:hover {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
}

.gallery-toggle.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Gallery section ─────────────────────────────────────── */
/* The heading & toggle stay in the normal .container (960px).
   The carousel breaks out to fill up to 1320px of the viewport
   so the screenshots are large and impressive. */

/* ── Carousel container — full-bleed breakout ────────────── */

.carousel {
  position: relative;
  /* Break out of the .container */
  width: 100vw;
  max-width: 1320px;
  margin-left: 50%;
  transform: translateX(-50%);
  padding: 0 32px; /* Room for arrows on desktop */
}

.carousel-viewport {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}

.carousel-track {
  display: flex;
  transition: transform 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
}

.carousel-slide {
  flex: 0 0 100%;
  min-width: 100%;
}

/* ── Desktop image sizing ────────────────────────────────── */
/* Scale height with viewport width, clamped between 340–640px.
   The desktop screenshots are 1280×800 (16:10), so a 56vw height
   roughly matches that ratio inside a ~1100px container. */

.carousel-slide img {
  width: 100%;
  height: clamp(340px, 56vw, 640px);
  object-fit: cover;
  object-position: top left;
  display: block;
  border-bottom: 1px solid var(--border);
  background: #0e0f1a;
}

/* ── Mobile view — portrait screenshots in a phone frame ── */
/* Instead of cramming portrait images into a landscape frame,
   show them centered in a taller, narrower column with dark
   bleed on the sides — like a phone sitting on a dark desk. */

.carousel.mobile-view .carousel-slide {
  display: flex;
  flex-direction: column;
}

.carousel.mobile-view .carousel-slide img {
  height: clamp(380px, 56vw, 640px);
  object-fit: contain;
  object-position: top center;
  background: #0e0f1a;
}

.carousel-caption {
  padding: 18px 24px 20px;
}

.carousel-caption h4 {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--ink);
}

.carousel-caption p {
  font-size: 0.9rem;
  color: var(--ink-muted);
  margin: 0;
  line-height: 1.5;
}

/* ── Arrow buttons — positioned INSIDE the viewport ──────── */
/* Use percentage-based top to stay centered as height scales. */

.carousel-arrow {
  position: absolute;
  top: calc(clamp(170px, 28vw, 320px) - 22px);
  z-index: 10;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(20, 22, 38, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: #fff;
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.carousel-arrow:hover {
  background: rgba(20, 22, 38, 0.9);
  border-color: var(--accent);
  color: var(--accent);
  transform: scale(1.08);
}

.carousel-prev {
  left: 14px;
}

.carousel-next {
  right: 14px;
}

/* ── Dot indicators ──────────────────────────────────────── */

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
  padding: 0 28px;
}

.carousel-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: none;
  background: var(--border-strong);
  cursor: pointer;
  padding: 0;
  transition: all 0.2s ease;
}

.carousel-dot:hover {
  background: var(--accent-border);
  transform: scale(1.2);
}

.carousel-dot.active {
  background: var(--accent);
  transform: scale(1.15);
}

/* ── View toggle link (below dots) ───────────────────────── */

.carousel-view-toggle {
  text-align: center;
  margin-top: 10px;
}

.carousel-view-toggle a {
  font-size: 0.78rem;
  color: var(--ink-faint);
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.2s, color 0.2s;
}

.carousel-view-toggle a:hover {
  opacity: 1;
  color: var(--accent);
  text-decoration: none;
}

/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 900px) {
  .carousel {
    padding: 0 12px;
  }

  .carousel-arrow {
    width: 40px;
    height: 40px;
    font-size: 1.3rem;
  }

  .carousel-prev { left: 8px; }
  .carousel-next { right: 8px; }
}

@media (max-width: 600px) {
  .carousel {
    padding: 0 4px;
  }

  /* Default (desktop view on small screen): landscape screenshots need
     a reasonable height. clamp keeps them usable. */
  .carousel-slide img {
    height: clamp(200px, 45vw, 320px);
  }

  /* Mobile view: portrait screenshots are taller */
  .carousel.mobile-view .carousel-slide img {
    height: 380px;
  }

  .carousel-arrow {
    top: calc(clamp(100px, 22vw, 160px) - 18px);
    width: 34px;
    height: 34px;
    font-size: 1.1rem;
  }

  .carousel.mobile-view .carousel-arrow {
    top: calc(190px - 18px);
  }

  .carousel-prev { left: 6px; }
  .carousel-next { right: 6px; }

  .carousel-caption {
    padding: 14px 16px 16px;
  }

  .carousel-caption h4 {
    font-size: 0.92rem;
  }

  .carousel-caption p {
    font-size: 0.82rem;
  }
}

/* ── Voice Input Components ─────────────────────────────── */

.voice-input-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  vertical-align: middle;
}

.voice-mic-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--ink-muted);
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: var(--shadow-sm);
  padding: 0;
  flex-shrink: 0;
}

.voice-mic-sm {
  width: 32px;
  height: 32px;
  font-size: 0.9rem;
}

.voice-mic-lg {
  width: 48px;
  height: 48px;
  font-size: 1.4rem;
}

.voice-mic-btn:hover {
  background: var(--bg-subtle);
  border-color: var(--accent);
  color: var(--accent);
  transform: scale(1.1);
  box-shadow: var(--shadow-md);
}

.voice-mic-btn.listening {
  background: var(--error-bg);
  color: var(--error);
  border-color: var(--error);
  animation: voicePulse 1.5s infinite;
  transform: scale(1.1);
}

.voice-mic-btn.transcribing {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

@keyframes voicePulse {
  0% { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(192, 57, 43, 0); }
  100% { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0); }
}

.voice-engine-label {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.voice-engine-local {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(74, 140, 92, 0.15);
}

.voice-engine-cloud {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

.voice-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: voiceSpin 0.8s linear infinite;
}

@keyframes voiceSpin {
  to { transform: rotate(360deg); }
}

/* Specific integrations */
.search-bar .voice-input-wrapper {
  margin: 0 4px;
}

.wiki-ai-edit-bar .voice-input-wrapper {
  margin: 0 8px;
}

/* ── Quick Capture FAB ───────────────────────────────────── */

.quick-capture-fab {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.fab-main {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4), 0 0 20px var(--accent-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
}

.fab-main:hover {
  transform: scale(1.1) rotate(10deg);
  background: var(--accent-hover);
  box-shadow: 0 12px 32px rgba(0,0,0,0.5), 0 0 40px var(--glow);
}

.fab-main::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255,255,255,0.2), transparent);
  transform: rotate(45deg);
  transition: all 0.6s;
  pointer-events: none;
}

.fab-main:hover::after {
  left: 120%;
}

.fab-icon {
  font-size: 28px;
}

.fab-menu {
  position: absolute;
  bottom: 72px;
  right: 0;
  background: rgba(26, 26, 46, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 200px;
  opacity: 0;
  transform: translateY(15px) scale(0.9);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: bottom right;
}

.fab-menu.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.fab-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  font-size: 0.95rem;
  font-weight: 500;
  width: 100%;
  transition: all 0.2s ease;
}

.fab-item:hover {
  background: rgba(255, 215, 0, 0.1);
  color: var(--accent);
  transform: translateX(-4px);
}

.fab-item-icon {
  font-size: 1.3rem;
  width: 28px;
  text-align: center;
}

.fab-menu hr {
  margin: 6px 0;
  border: 0;
  border-top: 1px solid var(--border);
}

/* ── Capture Modal Refinements ────────────────────────────── */

.capture-card {
  max-width: 550px !important;
  background: var(--surface-strong);
  border: 1px solid var(--border-strong);
}

.capture-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  gap: 16px;
}

.capture-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.photo-preview-zone {
  margin: 15px 0;
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  display: none;
}

.photo-preview-img {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  background: #000;
  display: block;
}

.photo-remove-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.photo-remove-btn:hover {
  background: var(--error);
}

.voice-pulse {
  width: 80px;
  height: 80px;
  background: var(--accent);
  border-radius: 50%;
  margin: 20px auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px var(--accent-soft);
}

.voice-pulse::before, .voice-pulse::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.6;
  z-index: -1;
}

.voice-pulse.active::before {
  animation: pulse-ring 1.5s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

.voice-pulse.active::after {
  animation: pulse-ring 1.5s cubic-bezier(0.215, 0.61, 0.355, 1) 0.3s infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(2.5); opacity: 0; }
}

.transcript-preview {
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
  min-height: 60px;
  margin-top: 15px;
  font-style: italic;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.5;
  border-left: 3px solid var(--accent);
}

.form-select-sm {
  font-size: 0.8rem;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--ink-muted);
}

/* ── Voice Capture Visuals ────────────────────────────────── */

.voice-pulse {
  width: 80px;
  height: 80px;
  background: var(--accent);
  border-radius: 50%;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 0 0 0 rgba(212, 163, 77, 0.4);
}

.voice-pulse::after {
  content: "🎙️";
  font-size: 32px;
}

.voice-pulse.active {
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(212, 163, 77, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 15px rgba(212, 163, 77, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(212, 163, 77, 0); }
}

.transcript-preview {
  min-height: 40px;
  font-style: italic;
  color: var(--ink);
  margin-top: 12px;
  padding: 10px;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
}

/* ── Notebooks Search Results ────────────────────────────── */

.search-active-banner {
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.search-active-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.search-active-count {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent);
}

.search-active-nav {
  display: flex;
  gap: 4px;
  align-items: center;
}

.search-nav-btn {
  padding: 4px 10px;
  font-size: 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink-soft);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 4px;
}

.search-nav-btn:hover:not(:disabled) {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
  color: var(--ink);
}

.search-nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.search-nav-btn kbd {
  font-size: 0.7rem;
  padding: 1px 4px;
  background: var(--bg-subtle);
  border-radius: 3px;
  font-family: monospace;
  margin-left: 2px;
}

.search-clear-btn {
  padding: 6px 12px;
  font-size: 0.8rem;
  background: none;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.search-clear-btn:hover {
  background: var(--accent);
  color: var(--surface);
}

/* Search results in sidebar */
#search-results-sidebar {
  padding: 16px !important;
}

.search-sidebar-header {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  margin-bottom: 12px;
  font-weight: 600;
}

/* ── Note Checkboxes ────────────────────────────────────────── */

.note-checkbox {
  cursor: pointer !important;
  width: 16px;
  height: 16px;
  margin-right: 8px;
  accent-color: var(--accent);
  vertical-align: middle;
  position: relative;
  top: -1px;
}

.note-content ul {
  list-style-type: none;
  padding-left: 0;
}

.note-content li.task-list-item {
  display: flex;
  align-items: flex-start;
  margin-bottom: 4px;
}

.note-content li.task-list-item input {
  margin-top: 4px;
}


.search-result-item {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 4px;
  border: 1px solid transparent;
}

.search-result-item:hover {
  background: var(--bg-subtle);
}

.search-result-item.active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
}

.search-result-title {
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result-preview {
  font-size: 0.75rem;
  color: var(--ink-faint);
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.search-result-meta {
  font-size: 0.7rem;
  color: var(--ink-faint);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Notebooks Layout ────────────────────────────────────── */

.notebooks-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.notebooks-sidebar {
  padding: 16px !important;
}

.notebooks-main {
  min-width: 0;
}

.notebook-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-bottom: 4px;
  transition: all 0.2s;
}

.notebook-item:hover {
  background: var(--bg-subtle);
}

.notebook-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.notebook-item-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
}

.notebook-count {
  font-size: 0.75rem;
  opacity: 0.6;
}

/* ── Note Cards ───────────────────────────────────────────── */

.note-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

.note-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.note-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.note-title {
  font-weight: 600;
  font-size: 1rem;
  overflow-wrap: break-word;
}

.note-date {
  font-size: 0.75rem;
  color: var(--ink-faint);
  white-space: nowrap;
}

.note-content {
  font-size: 0.92rem;
  color: var(--ink-muted);
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.note-content table {
  width: 100% !important;
  max-width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
}

.note-content img {
  max-width: 100%;
  height: auto;
}

.understanding-digest {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* ── Collapsible notes ────────────────────────────────────── */
/* Long notes collapse by default so the list stays scannable.  */

.note-header-main {
  cursor: pointer;
  min-width: 0;
  flex: 1;
}

.note-collapse-chevron {
  display: inline-block;
  margin-right: 6px;
  color: var(--ink-faint);
  font-size: 0.75rem;
  transition: transform 0.15s ease;
  user-select: none;
}

.note-card:not(.collapsed) .note-collapse-chevron {
  transform: rotate(90deg);
}

.note-card.collapsed .note-body {
  max-height: 78px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, #000 45%, transparent);
  mask-image: linear-gradient(180deg, #000 45%, transparent);
}

/* Search-match highlight */
mark.note-highlight {
  background: #facc15;
  color: #1a1a1a;
  border-radius: 3px;
  padding: 0 2px;
}

.note-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.note-tag {
  font-size: 0.7rem;
  padding: 2px 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 100px;
  color: var(--ink-muted);
}

.note-context-link {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 500;
}

.note-source-icon {
  font-size: 0.8rem;
  opacity: 0.6;
}

@media (max-width: 768px) {
  .notebooks-layout {
    grid-template-columns: 1fr;
  }
  .notebooks-sidebar {
    display: none; /* TODO: Mobile dropdown for notebooks */
  }
  .quick-capture-fab {
    bottom: 20px;
    right: 20px;
  }
  body.campaign-workspace-active .quick-capture-fab {
    bottom: 14px;
    right: 14px;
    opacity: 0.72;
  }
  body.campaign-workspace-active .quick-capture-fab:hover,
  body.campaign-workspace-active .quick-capture-fab:focus-within {
    opacity: 1;
  }
  body.campaign-workspace-active .fab-main {
    width: 50px;
    height: 50px;
  }
}

/* ── Ambient Scribe (Long Form) ────────────────────────── */
.ambient-scribe-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(26, 21, 15, 0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--accent);
  padding: 12px 24px;
  display: none; /* Hidden by default */
  align-items: center;
  justify-content: space-between;
  z-index: 2000;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
  animation: slideUp 0.3s ease;
}

.ambient-scribe-info {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--text-light);
}

.ambient-pulse {
  width: 12px;
  height: 12px;
  background: var(--error);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

#ambient-timer {
  font-family: monospace;
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--accent);
}

.ambient-meter {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 18px;
  margin: 0 10px;
}

.meter-bar {
  width: 3px;
  height: 4px;
  background: var(--accent);
  border-radius: 2px;
  transition: height 0.08s ease;
}

.ambient-chunks-label {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink-muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
  white-space: nowrap;
}

.ambient-last-heard {
  font-size: 0.78rem;
  color: var(--success);
  white-space: nowrap;
}

.ambient-last-heard.waiting {
  color: var(--ink-muted);
}

.ambient-last-heard.warning {
  color: #fca5a5;
  font-weight: 600;
}

.ambient-last-heard.unavailable {
  color: var(--ink-muted);
}

@media (max-width: 768px) {
  .ambient-scribe-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px 16px;
  }

  .ambient-scribe-info {
    flex-wrap: wrap;
    gap: 8px 12px;
  }

  .ambient-last-heard {
    flex-basis: 100%;
  }

  .ambient-scribe-bar > div:last-child {
    justify-content: flex-end;
  }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes ambient-meter-fallback {
  from { height: 4px; }
  to { height: 18px; }
}

/* ── Session Recording Button ──────────────────────────── */
.btn-record {
  background: linear-gradient(135deg, #c0392b, #e74c3c);
  color: #fff;
  border: 1px solid rgba(231, 76, 60, 0.3);
  box-shadow: 0 2px 12px rgba(231, 76, 60, 0.2);
  transition: all 0.3s ease;
}

.btn-record:hover {
  background: linear-gradient(135deg, #a93226, #c0392b);
  box-shadow: 0 4px 20px rgba(231, 76, 60, 0.35);
  transform: translateY(-1px);
}

.btn-record:active {
  transform: translateY(0);
}

/* Campaign label in the ambient scribe status bar */
.ambient-campaign-label {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Session Recording Finish Modal ────────────────────── */
.session-finish-card {
  max-width: 560px !important;
}

.session-progress-visual {
  text-align: center;
  padding: 24px 0 0;
}

.session-progress-bar-track {
  width: 100%;
  height: 6px;
  background: var(--bg-subtle);
  border-radius: 3px;
  overflow: hidden;
}

.session-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #e8a849);
  border-radius: 3px;
  transition: width 0.5s ease;
}

.session-transcript-preview {
  margin-bottom: 20px;
}

.session-preview-text {
  max-height: 200px;
  overflow-y: auto;
  padding: 12px 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--ink-muted);
  white-space: pre-wrap;
}

.session-finish-actions {
  display: flex;
  gap: 12px;
}

@media (max-width: 500px) {
  .session-finish-actions {
    flex-direction: column;
  }
}

/* ── Deep Recall (Universal Search) ────────────────────── */
.recall-card {
  max-width: 800px;
  width: 95%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.recall-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.search-box {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.search-box input {
  flex: 1;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 1.1rem;
  color: var(--ink);
  transition: border-color 0.2s;
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent);
}

.recall-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 40px 0;
  color: var(--ink-muted);
}

.recall-result {
  line-height: 1.7;
  font-size: 1.05rem;
  background: var(--surface-subtle);
  padding: 20px;
  border-radius: 12px;
  border-left: 4px solid var(--accent);
  margin-bottom: 20px;
  animation: fadeIn 0.4s ease;
}

.recall-result blockquote {
  border-left: 2px solid var(--border);
  margin: 1em 0;
  padding-left: 1em;
  font-style: italic;
  color: var(--ink-muted);
}

.recall-stats {
  font-size: 0.85rem;
  color: var(--ink-muted);
  text-align: right;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

@media (max-width: 768px) {
  .search-box {
    flex-direction: column;
  }
}

/* ── Note Card Images ── */
.note-card-image {
  margin: 12px -16px;
  max-height: 250px;
  overflow: hidden;
  cursor: zoom-in;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: #000;
}

.note-card-image img {
  width: 100%;
  height: 250px;
  object-fit: cover;
  transition: transform 0.3s;
}

.note-card-image:hover img {
  transform: scale(1.05);
}

/* ── Local OCR (V9) ── */
.ocr-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-subtle);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 10px;
}

.ocr-progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
  box-shadow: 0 0 10px var(--accent-soft);
}

.scan-notes-btn {
  gap: 6px;
  white-space: nowrap;
}

.recap-ocr-status {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.recap-ocr-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}

.recap-ocr-status-row p {
  margin: 0;
  font-size: 0.8rem;
}

.ocr-reliability-note {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.35;
}

@media (max-width: 640px) {
  .scan-notes-btn {
    width: 100%;
    justify-content: center;
  }

  #input-paste-mode .form-group > div:first-child {
    align-items: flex-start !important;
    gap: 10px;
  }

  #input-paste-mode .form-group > div:first-child > div {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .recap-ocr-status-row {
    align-items: stretch;
    flex-direction: column;
  }

  #recap-ocr-premium-btn {
    justify-content: center;
    width: 100%;
  }
}

.photo-preview-actions {
  position: absolute;
  bottom: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  padding: 6px;
  border-radius: var(--radius-md);
}

.note-classification-badge {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
  border: 1px solid rgba(255,255,255,0.1);
}

.note-classification-badge.idea { color: #f6ad55; border-color: rgba(246,173,85,0.3); }
.note-classification-badge.task { color: #63b3ed; border-color: rgba(99,179,237,0.3); }
.note-classification-badge.journal { color: #68d391; border-color: rgba(104,211,145,0.3); }
.note-classification-badge.reference { color: #a0aec0; border-color: rgba(160,174,192,0.3); }

/* ── Triage Clarification UI (V10.2.2) ─────────────────── */

/* Flagged count badge on notebooks sidebar */
.triage-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 700;
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: #fff;
  cursor: default;
  user-select: none;
  line-height: 1;
  animation: triage-badge-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

@keyframes triage-badge-pop {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}

/* Flagged note card indicator */
.note-card.note-flagged {
  border-left: 3px solid #f97316;
  box-shadow: var(--shadow-sm), inset 0 0 0 1px rgba(249, 115, 22, 0.15);
}

.note-triage-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.note-triage-indicator.needs_clarification {
  background: rgba(249, 115, 22, 0.12);
  color: #f97316;
  border: 1px solid rgba(249, 115, 22, 0.25);
}

.note-triage-indicator.review {
  background: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.25);
}

.note-triage-indicator.stale_resolved {
  background: rgba(148, 163, 184, 0.1);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.2);
  font-style: italic;
}

.note-triage-indicator.user_resolved {
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

/* Glass-box reasoning panel */
.triage-reasoning-panel {
  margin-top: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--ink-muted);
  animation: triage-expand 0.3s ease;
}

@keyframes triage-expand {
  from { opacity: 0; max-height: 0; margin-top: 0; padding: 0 14px; }
  to { opacity: 1; max-height: 500px; margin-top: 12px; padding: 12px 14px; }
}

.triage-reasoning-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 2px 0;
  border: none;
  background: none;
  transition: color 0.2s;
}

.triage-reasoning-toggle:hover {
  color: var(--accent);
}

.triage-reasoning-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.triage-reasoning-header .triage-icon {
  font-size: 0.9rem;
}

.triage-confidence-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.triage-confidence-track {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  overflow: hidden;
}

.triage-confidence-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.triage-confidence-fill.high { background: #68d391; }
.triage-confidence-fill.medium { background: #fbbf24; }
.triage-confidence-fill.low { background: #ef4444; }

.triage-confidence-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--ink-faint);
  min-width: 32px;
  text-align: right;
}

/* Triage question callout */
.triage-question {
  padding: 12px 14px;
  background: rgba(249, 115, 22, 0.06);
  border: 1px solid rgba(249, 115, 22, 0.15);
  border-left: 3px solid #f97316;
  border-radius: var(--radius-sm);
  margin-top: 10px;
  font-size: 0.88rem;
  color: var(--ink);
  line-height: 1.5;
}

.triage-question-icon {
  margin-right: 6px;
  font-size: 0.9rem;
}

/* Alternatives / resolution buttons */
.triage-alternatives {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.triage-alt-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--ink);
  transition: all 0.2s;
}

.triage-alt-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateX(3px);
}

.triage-alt-confidence {
  font-size: 0.7rem;
  color: var(--ink-faint);
  font-weight: 600;
}

.triage-resolve-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.triage-resolve-actions .btn {
  font-size: 0.78rem;
  padding: 6px 14px;
}

/* Triage Inbox banner */
.triage-review-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.08), rgba(251, 191, 36, 0.05));
  border: 1px solid rgba(249, 115, 22, 0.2);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  gap: 16px;
  animation: fadeIn 0.4s ease;
}

.triage-review-banner-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.triage-review-banner-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.triage-review-banner-text {
  font-size: 0.88rem;
  color: var(--ink);
}

.triage-review-banner-text strong {
  color: #f97316;
}

.triage-review-banner-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .triage-review-banner {
    flex-direction: column;
    text-align: center;
  }
  .triage-review-banner-actions {
    width: 100%;
    justify-content: center;
  }
}

/* ── Daily Digest Card (V10.7) ────────────────────────────── */

.daily-digest-card {
  background: linear-gradient(135deg, rgba(196, 164, 105, 0.06) 0%, rgba(30, 25, 18, 0.9) 100%);
  border: 1px solid rgba(196, 164, 105, 0.15);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  animation: digestSlideIn 0.4s ease-out;
}

.daily-digest-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold-warm) 0%, var(--gold-light) 50%, var(--gold-warm) 100%);
  opacity: 0.6;
}

@keyframes digestSlideIn {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

.daily-digest-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.daily-digest-greeting {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
}

.daily-digest-greeting span {
  color: var(--gold-warm);
}

.daily-digest-dismiss {
  background: none;
  border: none;
  color: var(--ink-faint);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  line-height: 1;
}

.daily-digest-dismiss:hover {
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.05);
}

.daily-digest-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.digest-stat {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  min-width: 120px;
}

button.digest-stat,
button.digest-notebook-chip,
button.digest-note-preview {
  font: inherit;
  text-align: left;
  appearance: none;
  -webkit-appearance: none;
}

.digest-stat-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.digest-stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
}

.digest-stat-label {
  font-size: 0.7rem;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.digest-stat.streak .digest-stat-value {
  color: var(--gold-warm);
}

.digest-stat.flagged {
  border-color: rgba(232, 150, 57, 0.25);
  cursor: pointer;
  transition: all 0.2s ease;
}

.digest-stat.flagged:hover {
  background: rgba(232, 150, 57, 0.08);
  border-color: rgba(232, 150, 57, 0.4);
}

.digest-stat.flagged .digest-stat-value {
  color: #e89639;
}

.digest-action {
  cursor: pointer;
  position: relative;
}

.digest-stat.digest-action:hover,
.digest-note-preview.digest-action:hover {
  background: rgba(196, 164, 105, 0.08);
  border-color: rgba(196, 164, 105, 0.18);
}

.digest-open-label {
  margin-left: auto;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--gold-warm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Streak fire animation */
.digest-streak-fire {
  animation: fireGlow 1.5s ease-in-out infinite alternate;
}

@keyframes fireGlow {
  from { filter: brightness(1); }
  to { filter: brightness(1.3) drop-shadow(0 0 3px rgba(232, 150, 57, 0.4)); }
}

/* Notebook activity list */
.digest-notebooks {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.digest-notebook-label {
  font-size: 0.75rem;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.digest-notebook-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.digest-notebook-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 100px;
  font-size: 0.8rem;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.2s ease;
}

.digest-notebook-chip:hover {
  background: rgba(196, 164, 105, 0.08);
  border-color: rgba(196, 164, 105, 0.2);
  color: var(--ink);
}

.digest-notebook-chip .chip-count {
  color: var(--ink-faint);
  font-weight: 600;
  font-size: 0.72rem;
}

.digest-notebook-chip.has-recent {
  border-color: rgba(196, 164, 105, 0.15);
}

/* Flagged callout inside digest */
.digest-flagged-callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(232, 150, 57, 0.06);
  border: 1px solid rgba(232, 150, 57, 0.15);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.digest-flagged-callout:hover {
  background: rgba(232, 150, 57, 0.1);
  border-color: rgba(232, 150, 57, 0.25);
}

.digest-flagged-text {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.digest-flagged-text strong {
  color: #e89639;
}

.digest-flagged-action {
  font-size: 0.78rem;
  color: var(--gold-warm);
  white-space: nowrap;
  font-weight: 600;
}

/* Yesterday note previews */
.digest-yesterday {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.digest-yesterday-label {
  font-size: 0.75rem;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.digest-note-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.digest-note-preview .preview-icon {
  font-size: 0.75rem;
  color: var(--ink-faint);
}

.digest-note-preview .preview-class {
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink-faint);
}

.note-card-highlight {
  animation: noteCardHighlight 1.8s ease-out;
}

@keyframes noteCardHighlight {
  0% {
    box-shadow: 0 0 0 2px rgba(212, 163, 77, 0.8), var(--shadow-md);
    border-color: rgba(212, 163, 77, 0.8);
  }
  100% {
    box-shadow: var(--shadow-sm);
  }
}

@media (max-width: 600px) {
  .daily-digest-card {
    padding: 16px;
  }
  .daily-digest-stats {
    gap: 8px;
  }
  .digest-stat {
    min-width: 100px;
    padding: 6px 10px;
    flex: 1;
  }
  .digest-stat-value {
    font-size: 1.2rem;
  }
  .digest-flagged-callout {
    flex-direction: column;
    text-align: center;
  }
}

.processing-options-panel {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 16px;
}

.option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
}

.switch-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  cursor: pointer;
}

.file-icon-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  background: rgba(0,0,0,0.2);
  border-radius: var(--radius-lg);
  margin-bottom: 12px;
}

/* ── Universal Archetypes ── */
.camp-header-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.camp-archetype-icon {
  font-size: 1.2rem;
  opacity: 0.8;
  flex-shrink: 0;
}

.camp-role-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--ink-faint);
  margin-top: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

[data-archetype-label] {
  transition: all 0.2s ease;
}

/* ── Universal Voice Input Integration ──────────────────── */

.voice-input-container {
  position: relative;
  display: block;
  width: 100%;
}

.voice-input-enabled {
  padding-right: 42px !important;
}

/* Integrated mic button - absolute positioned inside the input */
.voice-mic-integrated {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  opacity: 0.7;
  transition: opacity 0.2s, transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.voice-mic-integrated .voice-mic-btn {
  background: var(--surface) !important;
  border: 1px solid var(--border-main) !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15) !important;
}

.voice-mic-integrated:hover {
  opacity: 1;
  transform: translateY(-50%) scale(1.15);
}

.voice-mic-integrated.listening {
  opacity: 1;
  background: var(--error-bg) !important;
  border-radius: 50%;
  padding: 4px;
}

/* Ensure the engine label doesn't clutter the input */
.voice-mic-integrated + .voice-engine-label {
  position: absolute;
  right: 44px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.65rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.voice-input-container:hover .voice-engine-label,
.voice-input-container:focus-within .voice-engine-label {
  opacity: 0.8;
}

/* Textarea specific positioning */
textarea.voice-input-enabled + .voice-mic-integrated {
  top: 22px;
  transform: none;
}

textarea.voice-input-enabled + .voice-mic-integrated:hover {
  transform: scale(1.15);
}

/* ── Voice Router Feedback ──────────────────────────────── */

.voice-router-feedback {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface-2);
  color: var(--text-main);
  padding: 12px 20px;
  border-radius: 30px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.4), 0 0 0 1px var(--border-main);
  z-index: 10000;
  font-size: 0.9rem;
  font-weight: 500;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.voice-router-feedback.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Omni-Mic UI variant */
.voice-mic-omni {
  background: linear-gradient(135deg, var(--accent-main), #f59e0b) !important;
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.4) !important;
  border: none !important;
  color: white !important;
}

.voice-mic-omni.listening {
  animation: omni-pulse 1.5s infinite;
}

@keyframes omni-pulse {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.6); }
  70% { box-shadow: 0 0 0 15px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

.fab-item-slot {
  width: 100%;
}

.fab-item-slot .voice-input-wrapper {
  width: 100%;
  display: flex !important;
}

.fab-item-slot .voice-mic-btn {
  width: 100%;
  border-radius: var(--radius-md) !important;
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 12px 16px !important;
  background: transparent !important;
  border: none !important;
  color: var(--ink) !important;
  justify-content: flex-start !important;
  font-size: 0.95rem !important;
  font-weight: 500 !important;
  height: auto !important;
  transition: all 0.2s ease !important;
}

.fab-item-slot .voice-mic-btn::before {
  content: '✨';
  font-size: 1.3rem;
  width: 28px;
  text-align: center;
}

.fab-item-slot .voice-mic-btn::after {
  content: 'Smart Voice';
}

.fab-item-slot .voice-mic-btn:hover {
  background: rgba(255, 215, 0, 0.1) !important;
  color: var(--accent) !important;
  transform: translateX(-4px) !important;
}

/* ══════════════════════════════════════════════════════════
   Notebook Enhancements (V11.3)
   ══════════════════════════════════════════════════════════ */

/* ── Bulk Selection Checkboxes ─────────────────────────── */

.note-bulk-checkbox {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 20px;
  height: 20px;
  cursor: pointer;
  z-index: 5;
  accent-color: var(--accent);
}

/* ── Notebook Color Dots ───────────────────────────────── */

.notebook-color-dot {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 20px;
  border-radius: 2px;
  opacity: 0.8;
}

.notebook-item {
  position: relative;
  padding-left: 12px;
}

.notebook-item.drop-target {
  background-color: var(--accent) !important;
  color: var(--surface) !important;
  transform: scale(1.02);
  box-shadow: 0 0 0 2px var(--accent);
}

/* ── Recently Viewed ───────────────────────────────────── */

.notebook-item-compact {
  padding: 6px 8px;
  font-size: 0.9rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background-color 0.2s;
  margin-bottom: 4px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
}

.notebook-item-compact:hover {
  background-color: var(--surface-dim);
}

/* ── Note Drag & Drop ──────────────────────────────────── */

.note-card[draggable="true"] {
  cursor: move;
}

.note-card[draggable="true"]:active {
  cursor: grabbing;
}

/* ── Grounded retrieval citations (Deep Recall + Session Search) ── */
.citations {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.citations-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  margin-bottom: 8px;
}
.citations-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.citation {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
  opacity: 0.62;
}
.citation-used {
  opacity: 1;
  border-color: var(--accent-border);
  background: var(--accent-soft);
}
.citation-num {
  font-weight: 700;
  color: var(--accent);
  margin-right: 4px;
}
.citation-label { font-weight: 600; color: var(--ink); }
.citation-score {
  float: right;
  font-size: 0.7rem;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.citation-excerpt {
  margin-top: 4px;
  font-size: 0.82rem;
  color: var(--ink-muted);
  line-height: 1.4;
}

/* ── Browser Text-To-Speech Controls ───────────────────── */
.speech-control {
  min-width: 72px;
}

.speech-control.is-speaking {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.speech-control:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.note-speech-btn {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-alt);
  color: var(--ink-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  cursor: pointer;
}

.note-speech-btn:hover,
.note-speech-btn.is-speaking {
  border-color: var(--accent-border);
  color: var(--accent);
  background: var(--accent-soft);
}

.readable-block {
  position: relative;
}

.readable-speech-btn {
  float: right;
  margin: 0 0 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-alt);
  color: var(--ink-muted);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  padding: 6px 9px;
  cursor: pointer;
}

.readable-speech-btn:hover,
.readable-speech-btn.is-speaking {
  border-color: var(--accent-border);
  color: var(--accent);
  background: var(--accent-soft);
}

.premium-narration-btn {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.premium-narration-btn.is-speaking {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.premium-narration-settings {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
}

.premium-narration-settings h5 {
  margin: 0 0 10px;
  font-size: 0.9rem;
  color: var(--ink);
}

.speech-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.speech-range-label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--ink-muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.speech-range-label span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.speech-range-label input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

@media (max-width: 560px) {
  .speech-settings-grid {
    grid-template-columns: 1fr;
  }
}
