/* ═══════════════════════════════════════════════════════════
   Slop O'Meter Web App — app.css
   Left sidebar + main content layout. Extension panel style.
   ═══════════════════════════════════════════════════════════ */

/* ───── Reset ───── */
*,*::before,*::after{margin:0;padding:0;box-sizing:border-box}

/* ───── Theme tokens (dark = default) ───── */
:root {
  --bg: #08090d;
  --surface: #12131a;
  --surface-2: #1a1b24;
  --surface-3: #23242f;
  --border: rgba(255,255,255,0.06);
  --border-strong: rgba(255,255,255,0.12);
  --border-accent: rgba(99,102,241,0.15);
  --text: #f5f5f5;
  --text-2: rgba(255,255,255,0.55);
  --text-3: rgba(255,255,255,0.3);
  --accent: #eab308;
  --accent-light: rgba(234,179,8,0.1);
  --accent-glow: rgba(234,179,8,0.15);
  --accent-solid: #eab308;
  --accent-2: #6366f1;
  --green: #22c55e;
  --green-bg: rgba(34,197,94,0.1);
  --lime: #a3e635;
  --yellow: #eab308;
  --orange: #f97316;
  --red: #ef4444;
  --blue: #3b82f6;
  --blue-bg: rgba(59,130,246,0.12);
  --purple: #a78bfa;
  --purple-bg: rgba(167,139,250,0.12);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --shadow: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.25), 0 2px 4px rgba(0,0,0,0.2);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.3), 0 4px 12px rgba(0,0,0,0.2);
  --shadow-xl: 0 24px 60px rgba(0,0,0,0.35);
  --header-h: 52px;
  --sidebar-w: 200px;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', ui-monospace, monospace;
  --panel-w: 380px;
}

/* ───── Theme tokens (light) ───── */
[data-theme="light"] {
  --bg: #fafaf9;
  --surface: #f2f2f0;
  --surface-2: #eaeae8;
  --surface-3: #e0e0de;
  --border: rgba(0,0,0,0.07);
  --border-strong: rgba(0,0,0,0.14);
  --text: #111111;
  --text-2: #555555;
  --text-3: #999999;
  --accent: #d97706;
  --accent-light: rgba(217,119,6,0.08);
  --accent-glow: rgba(217,119,6,0.12);
  --accent-solid: #d97706;
  --green: #16a34a;
  --green-bg: rgba(22,163,74,0.08);
  --lime: #65a30d;
  --yellow: #d97706;
  --orange: #ea580c;
  --red: #dc2626;
  --blue: #2563eb;
  --blue-bg: rgba(37,99,235,0.08);
  --purple: #7c3aed;
  --purple-bg: rgba(124,58,237,0.08);
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.04);
  --shadow-lg: 0 20px 50px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.04);
}

/* First-time visitors (nothing saved in localStorage, so no data-theme
   attribute is set at all) get their OS preference instead of always being
   forced into the dark brand default. `:not([data-theme="dark"])` means an
   explicit dark toggle still wins even on a light-OS system — this only
   fills in for visitors who haven't chosen either way yet. Values duplicated
   from [data-theme="light"] above rather than shared, since this project has
   no CSS build step to factor them out. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #fafaf9;
    --surface: #f2f2f0;
    --surface-2: #eaeae8;
    --surface-3: #e0e0de;
    --border: rgba(0,0,0,0.07);
    --border-strong: rgba(0,0,0,0.14);
    --text: #111111;
    --text-2: #555555;
    --text-3: #999999;
    --accent: #d97706;
    --accent-light: rgba(217,119,6,0.08);
    --accent-glow: rgba(217,119,6,0.12);
    --accent-solid: #d97706;
    --green: #16a34a;
    --green-bg: rgba(22,163,74,0.08);
    --lime: #65a30d;
    --yellow: #d97706;
    --orange: #ea580c;
    --red: #dc2626;
    --blue: #2563eb;
    --blue-bg: rgba(37,99,235,0.08);
    --purple: #7c3aed;
    --purple-bg: rgba(124,58,237,0.08);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.04);
    --shadow-lg: 0 20px 50px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.04);
  }
}

/* ───── Base ───── */
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background 0.3s, color 0.3s;
  min-height: 100vh;
}

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

/* ═══════════════════════════════════════════════════════════
   APP LAYOUT — Header + (Sidebar | Editor | Results Panel)
   ═══════════════════════════════════════════════════════════ */

/* ───── TOP HEADER BAR (52px, fixed, full width) ───── */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  background: linear-gradient(180deg, rgba(12,13,26,0.92) 0%, rgba(12,13,26,0.85) 100%);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  backdrop-filter: blur(32px) saturate(1.6);
  -webkit-backdrop-filter: blur(32px) saturate(1.6);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}
[data-theme="light"] .app-header {
  background: rgba(255, 255, 255, 0.97);
  border-bottom-color: rgba(0,0,0,0.08);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-hamburger {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.6);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.header-hamburger:hover { color: #fff; background: rgba(255,255,255,0.06); }
[data-theme="light"] .header-hamburger { color: rgba(0,0,0,0.5); }
[data-theme="light"] .header-hamburger:hover { color: #000; background: rgba(0,0,0,0.04); }

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #fff;
}
.header-brand:hover { text-decoration: none; opacity: 0.85; }
.header-brand svg { flex-shrink: 0; }
.header-brand-text {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.03em;
  white-space: nowrap;
}
[data-theme="light"] .header-brand { color: #111; }

.header-center {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: rgba(255,255,255,0.4);
}
.header-mode-label { font-weight: 500; }
.header-mode-value { font-weight: 600; color: var(--accent); }
[data-theme="light"] .header-center { color: rgba(0,0,0,0.4); }

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-icon-btn {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255,255,255,0.08);
  background: transparent;
  color: rgba(255,255,255,0.5);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.header-icon-btn:hover { border-color: rgba(255,255,255,0.15); color: #fff; }
[data-theme="light"] .header-icon-btn { border-color: rgba(0,0,0,0.08); color: rgba(0,0,0,0.4); }
[data-theme="light"] .header-icon-btn:hover { border-color: rgba(0,0,0,0.15); color: #000; }

.header-auth { display: flex; align-items: center; gap: 8px; }
.header-auth-link {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.15s;
}
.header-auth-link:hover { color: #fff; background: rgba(255,255,255,0.04); text-decoration: none; }
[data-theme="light"] .header-auth-link { color: rgba(0,0,0,0.5); }
[data-theme="light"] .header-auth-link:hover { color: #000; background: rgba(0,0,0,0.04); }


.header-user {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.header-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-light);
  border: 2px solid var(--accent);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
  flex-shrink: 0;
}
.header-user-name {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.8);
  white-space: nowrap;
}
[data-theme="light"] .header-user-name { color: rgba(0,0,0,0.7); }
.header-user-caret {
  color: rgba(255,255,255,0.35);
  flex-shrink: 0;
  transition: transform 0.15s;
}
[data-theme="light"] .header-user-caret { color: rgba(0,0,0,0.3); }
.header-user[aria-expanded="true"] .header-user-caret { transform: rotate(180deg); }

/* ── Dropdown panel ── */
.header-user-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 220px;
  background: rgba(20, 20, 28, 0.98);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 6px;
  backdrop-filter: blur(16px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.4);
  z-index: 400;
  animation: hlTooltipIn 0.15s ease-out both;
  cursor: default;
}
[data-theme="light"] .header-user-menu {
  background: #fff;
  border-color: rgba(0,0,0,0.1);
  box-shadow: 0 12px 32px rgba(0,0,0,0.12);
}
.header-user-menu-info { padding: 8px 10px 10px; }
.header-user-menu-name { font-size: 13px; font-weight: 700; color: var(--text); }
.header-user-menu-email {
  font-size: 11.5px; color: rgba(255,255,255,0.45); margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
[data-theme="light"] .header-user-menu-email { color: rgba(0,0,0,0.45); }
.header-user-menu-plan {
  display: inline-block; margin-top: 7px;
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase;
  color: var(--accent); background: var(--accent-light);
  border: 1px solid var(--border-accent);
  padding: 3px 8px; border-radius: 100px;
}
.header-user-menu-usage {
  display: block; margin-top: 6px;
  font-size: 11px; color: var(--text-3);
}
.header-user-menu-usage.hidden { display: none; }
.header-user-menu-divider { height: 1px; background: var(--border); margin: 6px 4px; }
.header-user-menu-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; box-sizing: border-box;
  padding: 8px 10px; border-radius: 7px;
  font-size: 12.5px; font-weight: 500; color: rgba(255,255,255,0.8);
  background: none; border: none; text-align: left; text-decoration: none;
  font-family: inherit; cursor: pointer;
}
[data-theme="light"] .header-user-menu-item { color: rgba(0,0,0,0.75); }
.header-user-menu-item svg { flex-shrink: 0; opacity: 0.6; }
.header-user-menu-item:hover { background: rgba(255,255,255,0.06); text-decoration: none; }
[data-theme="light"] .header-user-menu-item:hover { background: rgba(0,0,0,0.05); }
.header-user-menu-logout:hover { color: var(--red); background: rgba(239,68,68,0.08); }
.header-user-menu-logout:hover svg { opacity: 1; }

/* ───── APP BODY (below header, fills viewport) ───── */
.app-body {
  display: flex;
  margin-top: 52px;
  min-height: calc(100vh - 52px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Login/signup: header only, no sidebar — see Layout.inject()'s isAuthPage() branch */
.app-auth-shell {
  margin-top: 52px;
  min-height: calc(100vh - 52px);
}

/* ───── LEFT SIDEBAR (200px, collapsible) ───── */
.app-sidebar {
  position: fixed;
  top: 52px;
  left: 0;
  bottom: 0;
  width: 200px;
  background: rgba(20, 20, 28, 0.97);
  border-right: 1px solid rgba(255,255,255,0.06);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  color: rgba(255,255,255,0.7);
  z-index: 200;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.app-sidebar::-webkit-scrollbar { width: 4px; }
.app-sidebar::-webkit-scrollbar-track { background: transparent; }
.app-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 2px; }

[data-theme="light"] .app-sidebar {
  background: rgba(250, 250, 252, 0.97);
  border-right-color: rgba(0,0,0,0.08);
  color: rgba(0,0,0,0.55);
}

/* Sidebar collapsed state (desktop) */
.app-sidebar.collapsed {
  width: 0;
  overflow: hidden;
  border-right: none;
}
body.sidebar-collapsed .app-sidebar { width: 0; overflow: hidden; border-right: none; }

/* Sidebar close/minimize control */
.sidebar-head { display: flex; justify-content: flex-end; padding: 6px 8px 0; }
.sidebar-close {
  background: transparent; border: none; cursor: pointer;
  color: rgba(255,255,255,0.45); padding: 5px; border-radius: 6px;
  display: inline-flex; line-height: 0; transition: color 0.15s, background 0.15s;
}
.sidebar-close:hover { color: rgba(255,255,255,0.9); background: rgba(255,255,255,0.07); }
[data-theme="light"] .sidebar-close { color: rgba(0,0,0,0.4); }
[data-theme="light"] .sidebar-close:hover { color: rgba(0,0,0,0.75); background: rgba(0,0,0,0.05); }

/* Sidebar dividers */
.sidebar-divider {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: 4px 16px;
}
[data-theme="light"] .sidebar-divider { background: rgba(0,0,0,0.06); }

/* Sidebar section */
.sidebar-section { padding: 8px 0; }

/* Sidebar section title */
.sidebar-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: rgba(255,255,255,0.3);
  padding: 10px 18px 6px;
  margin: 0;
  white-space: nowrap;
}
[data-theme="light"] .sidebar-title { color: rgba(0,0,0,0.35); }

/* Sidebar nav links */
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: all 0.15s ease-out;
  cursor: pointer;
  background: none;
  border-top: none;
  border-bottom: none;
  border-right: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  white-space: nowrap;
}
.sidebar-link svg { width: 14px; height: 14px; flex-shrink: 0; opacity: 0.6; }
.sidebar-link:hover { color: rgba(255,255,255,0.9); background: rgba(255,255,255,0.04); text-decoration: none; }
.sidebar-link:hover svg { opacity: 1; }
.sidebar-link.active { color: var(--accent); border-left-color: var(--accent); background: var(--accent-light); }
.sidebar-link.active svg { opacity: 1; color: var(--accent); }

[data-theme="light"] .sidebar-link { color: rgba(0,0,0,0.5); }
[data-theme="light"] .sidebar-link:hover { color: rgba(0,0,0,0.85); background: rgba(0,0,0,0.04); }

/* Mobile overlay (for sidebar on small screens) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  top: 52px;
  background: rgba(0,0,0,0.5);
  z-index: 150;
  opacity: 0;
  transition: opacity 0.3s;
}
.sidebar-overlay.open { display: block; opacity: 1; }

/* ───── EDITOR AREA (flexible center column) ───── */
.app-editor-area {
  flex: 1;
  margin-left: 200px;
  min-height: calc(100vh - 52px);
  display: flex;
  flex-direction: column;
  background: var(--bg);
  padding: 24px 32px;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1), margin-right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-x: hidden;
}
body.sidebar-collapsed .app-editor-area { margin-left: 0; }
body.panel-open .app-editor-area { margin-right: var(--panel-w); }
body.sidebar-collapsed.panel-open .app-editor-area { margin-left: 0; margin-right: var(--panel-w); }

.app-main-inner {
  flex: 1;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 0;
}
/* Editor page: no max-width constraint — editor fills available space */
.app-main-inner.editor-full-width {
  max-width: none;
}

/* ───── RIGHT RESULTS PANEL (380px, fixed, pushes content) ───── */
.app-results-panel {
  position: fixed;
  top: 52px;
  right: 0;
  bottom: 0;
  width: var(--panel-w);
  background: rgba(12, 13, 26, 0.88);
  border-left: 1px solid rgba(255,255,255,0.06);
  backdrop-filter: blur(32px) saturate(1.6);
  -webkit-backdrop-filter: blur(32px) saturate(1.6);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
  z-index: 200;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  color: #e0e0e0;
}
[data-theme="light"] .app-results-panel {
  background: rgba(250, 250, 252, 0.97);
  border-left-color: rgba(0,0,0,0.08);
  color: var(--text);
}
.app-results-panel.closed { transform: translateX(100%); opacity: 0; }
.app-results-panel.open { transform: translateX(0); opacity: 1; }

/* Panel toggle tab — FIXED to screen edge, not inside panel */
.panel-toggle-tab {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 64px;
  background: rgba(20, 20, 28, 0.97);
  border: 1px solid rgba(255,255,255,0.06);
  border-right: none;
  border-radius: 8px 0 0 8px;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  z-index: 250;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.panel-toggle-tab:hover { color: #fff; background: rgba(30, 30, 40, 1); }
[data-theme="light"] .panel-toggle-tab { background: rgba(250,250,252,0.97); border-color: rgba(0,0,0,0.08); color: rgba(0,0,0,0.4); }
[data-theme="light"] .panel-toggle-tab:hover { color: #000; }
body.panel-open .panel-toggle-tab { display: none; }

/* Panel content wrapper */
.panel-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* Panel header */
/* Panel header — matches extension's .panel-header */
.panel-header {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
  position: relative;
}
[data-theme="light"] .panel-header { border-bottom-color: rgba(0,0,0,0.06); }

.panel-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 30px;
  height: 30px;
  border: none;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.4);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease-out;
}
.panel-close-btn:hover { background: rgba(255,255,255,0.12); color: #fff; transform: scale(1.05); }
[data-theme="light"] .panel-close-btn { background: rgba(0,0,0,0.05); color: rgba(0,0,0,0.4); }
[data-theme="light"] .panel-close-btn:hover { background: rgba(0,0,0,0.1); color: #000; }

/* Originality line (subtle, under main score) */
.panel-originality-line {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.panel-originality-line span {
  font-weight: 700;
}
[data-theme="light"] .panel-originality-line {
  color: rgba(0,0,0,0.4);
  border-top-color: rgba(0,0,0,0.06);
}

/* Score ring background */
.score-ring-bg { stroke: rgba(255,255,255,0.1); }
[data-theme="light"] .score-ring-bg { stroke: rgba(0,0,0,0.08); }

/* Panel score — matches extension's .score-big + .tier-label */
.panel-score-number {
  font-size: 56px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -1px;
  text-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
[data-theme="light"] .panel-score-number { text-shadow: none; }
.panel-score-tier {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-top: 6px;
  text-align: center;
  width: 100%;
}
.panel-score-summary {
  font-size: 13px;
  color: rgba(255,255,255,0.55);
  margin-top: 10px;
  line-height: 1.5;
}
[data-theme="light"] .panel-score-summary { color: rgba(0,0,0,0.45); }
/* The AI verdict — the panel's TL;DR: how it reads + the top thing to fix. */
.panel-ai-summary {
  margin-top: 9px;
  padding-left: 11px;
  border-left: 2px solid rgba(99,102,241,0.55);
  font-size: 12.5px;
  line-height: 1.55;
  color: rgba(255,255,255,0.84);
}
[data-theme="light"] .panel-ai-summary { color: rgba(0,0,0,0.76); border-left-color: rgba(99,102,241,0.5); }

/* Panel X-RAY bar (legacy, now in Controls section) */
.panel-xray-bar {
  padding: 8px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
[data-theme="light"] .panel-xray-bar { border-bottom-color: rgba(0,0,0,0.06); }

.panel-xray-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.03);
  color: rgba(255,255,255,0.5);
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.5px;
  transition: all 0.15s;
  width: 100%;
  justify-content: center;
}
.panel-xray-btn:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.8); }
.panel-xray-btn.active {
  background: rgba(59,130,246,0.12);
  border-color: rgba(59,130,246,0.3);
  color: #3b82f6;
}
[data-theme="light"] .panel-xray-btn { border-color: rgba(0,0,0,0.1); background: rgba(0,0,0,0.02); color: rgba(0,0,0,0.4); }
[data-theme="light"] .panel-xray-btn:hover { background: rgba(0,0,0,0.04); color: rgba(0,0,0,0.7); }
[data-theme="light"] .panel-xray-btn.active { background: rgba(37,99,235,0.08); border-color: rgba(37,99,235,0.2); color: #2563eb; }

/* Panel body (scrollable) */
.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}
.panel-body::-webkit-scrollbar { width: 5px; }
.panel-body::-webkit-scrollbar-track { background: transparent; }
.panel-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }

/* Panel empty state */
.panel-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}
.panel-empty-icon { color: rgba(255,255,255,0.15); margin-bottom: 12px; }
[data-theme="light"] .panel-empty-icon { color: rgba(0,0,0,0.1); }
.panel-empty-text { font-size: 13px; color: rgba(255,255,255,0.3); }
[data-theme="light"] .panel-empty-text { color: rgba(0,0,0,0.3); }

/* ───── Footer ───── */
.app-footer {
  padding: 24px 32px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: rgba(255,255,255,0.35);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}
.footer-links { display: flex; gap: 16px; }
.footer-links a { color: rgba(255,255,255,0.35); text-decoration: none; font-size: 12px; }
.footer-links a:hover { color: rgba(255,255,255,0.6); }
[data-theme="light"] .app-footer { color: var(--text-3); }
[data-theme="light"] .footer-links a { color: var(--text-3); }
[data-theme="light"] .footer-links a:hover { color: var(--text-2); }

/* ───── Legacy compat (hidden) ───── */
.app-nav, .nav-inner, .nav-left, .nav-brand, .nav-links, .nav-right { display: none; }
.app-layout { display: flex; min-height: 100vh; }
.app-main { flex: 1; margin-left: 200px; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); transition: margin-left 0.3s; }
body.sidebar-collapsed .app-main { margin-left: 0; }
.page-topbar { display: none; }
.hamburger, .user-menu { display: none; }
.sidebar-hamburger { display: none; }
.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.15s;
}
.icon-btn:hover { border-color: var(--text-3); color: var(--text); }
.auth-buttons { display: flex; gap: 8px; align-items: center; }

/* ═══════════════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════════════ */

.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  margin-bottom: 6px;
}
[data-theme="light"] .form-label { color: var(--text); }
.form-hint { font-size: 12px; color: rgba(255,255,255,0.4); margin-top: 4px; }
[data-theme="light"] .form-hint { color: var(--text-3); }

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-3);
}

.form-textarea {
  resize: vertical;
  min-height: 200px;
  line-height: 1.7;
}
.form-textarea.large { min-height: 300px; }

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23999' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
}
.form-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.form-row {
  display: flex;
  gap: 16px;
}
.form-row .form-group { flex: 1; }

.form-error { color: var(--red); font-size: 12px; margin-top: 4px; }

/* ═══════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
  font-family: inherit;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn svg { width: 16px; height: 16px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { opacity: 0.88; transform: translateY(-1px); }

.btn-accent { background: var(--accent); color: #111827; }
.btn-accent:hover { opacity: 0.9; transform: translateY(-1px); }

.btn-secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--text-3); }

.btn-ghost { background: transparent; color: var(--text-2); padding: 8px 14px; }
.btn-ghost:hover { color: var(--text); background: var(--surface); }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { opacity: 0.9; }

.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-lg { padding: 14px 32px; font-size: 16px; }
.btn-block { width: 100%; }

/* ═══════════════════════════════════════════════════════════
   CARDS — redesigned
   ═══════════════════════════════════════════════════════════ */

.card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  padding: 28px;
  transition: border-color 0.2s;
}
[data-theme="light"] .card {
  background: var(--surface);
  border-color: var(--border);
}
.card:hover { border-color: var(--border-strong); }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.card-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.card-body { font-size: 14px; color: rgba(255,255,255,0.65); line-height: 1.6; }
[data-theme="light"] .card-body { color: var(--text-2); }

.card-compact { padding: 20px; }
.card-flat { box-shadow: none; }
.card-accent { border-color: var(--accent); border-width: 2px; }

/* ═══════════════════════════════════════════════════════════
   SCORE DISPLAY
   ═══════════════════════════════════════════════════════════ */

.score-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px;
}
.score-number {
  font-size: 72px;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
}
.score-tier-badge {
  display: inline-block;
  padding: 4px 16px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 8px;
}
.score-label {
  font-size: 14px;
  color: var(--text-3);
  margin-top: 8px;
}

/* Score tier colors */
.tier-fresh { color: var(--green); }
.tier-fresh .score-tier-badge { background: var(--green-bg); color: var(--green); }
.tier-clean { color: var(--lime); }
.tier-clean .score-tier-badge { background: rgba(101,163,13,0.1); color: var(--lime); }
.tier-mid { color: var(--yellow); }
.tier-mid .score-tier-badge { background: var(--accent-light); color: var(--yellow); }
.tier-sloppy { color: var(--orange); }
.tier-sloppy .score-tier-badge { background: rgba(234,88,12,0.1); color: var(--orange); }
.tier-slop { color: var(--red); }
.tier-slop .score-tier-badge { background: rgba(220,38,38,0.08); color: var(--red); }

/* Score gauge (circular) */
.score-gauge {
  width: 180px;
  height: 180px;
  position: relative;
  margin: 0 auto 16px;
}
.score-gauge svg { width: 100%; height: 100%; }
.score-gauge .gauge-bg { fill: none; stroke: var(--surface-2); stroke-width: 10; }
.score-gauge .gauge-fill { fill: none; stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset 1s ease; }
.score-gauge-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

/* Signal bars */
.signal-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.signal-bar-label {
  width: 170px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  text-align: left;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.signal-bar-track {
  flex: 1;
  height: 8px;
  background: var(--surface-2);
  border-radius: 100px;
  overflow: hidden;
}
.signal-bar-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 0.8s ease;
}
.signal-bar-value {
  width: 36px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   UPLOAD AREA
   ═══════════════════════════════════════════════════════════ */

.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--surface);
}
.upload-area:hover, .upload-area.dragover {
  border-color: var(--accent);
  background: var(--accent-light);
}
.upload-area .upload-icon { font-size: 40px; margin-bottom: 12px; color: var(--text-3); }
.upload-area .upload-text { font-size: 14px; color: var(--text-2); margin-bottom: 4px; }
.upload-area .upload-hint { font-size: 12px; color: var(--text-3); }
.upload-area input[type="file"] { display: none; }

/* ═══════════════════════════════════════════════════════════
   MODALS
   ═══════════════════════════════════════════════════════════ */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-overlay.open { display: flex; }
[data-theme="light"] .modal-overlay { background: rgba(0,0,0,0.5); }

.modal {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.modal-title { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.15s;
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }

/* ═══════════════════════════════════════════════════════════
   TABS
   ═══════════════════════════════════════════════════════════ */

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.tab-btn {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text-2); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* ═══════════════════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════════════════ */

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  text-align: left;
  font-weight: 600;
  color: rgba(255,255,255,0.6);
  padding: 10px 14px;
  border-bottom: 2px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: rgba(255,255,255,0.8);
}
tr:hover td { background: var(--surface); }
[data-theme="light"] th { color: var(--text-2); }
[data-theme="light"] td { color: var(--text); }

/* ═══════════════════════════════════════════════════════════
   PRICING CARDS
   ═══════════════════════════════════════════════════════════ */

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  max-width: 880px;
  margin: 0 auto;
}
.pricing-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  padding: 28px 24px;
  text-align: center;
  transition: transform 0.2s, border-color 0.2s;
  position: relative;
}
[data-theme="light"] .pricing-card { background: var(--surface); border-color: var(--border); }
.pricing-card:hover { transform: translateY(-4px); }
.pricing-card.featured {
  border-color: var(--accent);
  border-width: 2px;
}
.pricing-card.featured::before {
  content: 'Most Popular';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 14px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.pricing-name { font-size: 18px; font-weight: 700; margin-bottom: 12px; }
.pricing-price {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0;
  margin-bottom: 4px;
  line-height: 1;
}
.price-dollar {
  font-size: 44px;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.price-period {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-2);
}
.pricing-billed {
  font-size: 13px;
  color: rgba(255,255,255,0.4);
  margin-bottom: 28px;
}
[data-theme="light"] .pricing-billed { color: var(--text-3); }
.pricing-features {
  list-style: none;
  text-align: left;
  margin-bottom: 28px;
}
.pricing-features li {
  padding: 8px 0;
  font-size: 13px;
  color: rgba(255,255,255,0.65);
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.pricing-features li::before {
  content: '\2713';
  color: var(--green);
  font-weight: 700;
  flex-shrink: 0;
}
.pricing-features li.disabled { color: rgba(255,255,255,0.3); }
.pricing-features li.disabled::before { content: '\2715'; color: rgba(255,255,255,0.3); }
.pricing-note { font-size: 12px; color: var(--accent); font-weight: 600; margin-top: 12px; }
[data-theme="light"] .pricing-features li { color: var(--text-2); }
[data-theme="light"] .pricing-features li.disabled { color: var(--text-3); }

/* Annual toggle */
.billing-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 40px;
}
.billing-toggle span { font-size: 14px; font-weight: 500; color: var(--text-2); }
.billing-toggle span.active { color: var(--text); font-weight: 600; }
.toggle-switch {
  width: 48px;
  height: 26px;
  border-radius: 100px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle-switch.active { background: var(--accent); border-color: var(--accent); }
.toggle-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.toggle-switch.active::after { transform: translateX(22px); }
.billing-save {
  font-size: 12px;
  font-weight: 700;
  color: var(--green);
  background: var(--green-bg);
  padding: 3px 10px;
  border-radius: 100px;
}

/* ═══════════════════════════════════════════════════════════
   HISTORY LIST — redesigned cards
   ═══════════════════════════════════════════════════════════ */

.history-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}
.history-item:hover {
  border-color: rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
[data-theme="light"] .history-item { background: var(--surface); border-color: var(--border); }
[data-theme="light"] .history-item:hover { background: var(--surface-2); box-shadow: var(--shadow-md); }

/* Score circle */
.history-score {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}

/* Body */
.history-body { flex: 1; min-width: 0; }
.history-preview {
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  font-weight: 400;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 8px;
}
[data-theme="light"] .history-preview { color: var(--text); }

.history-meta {
  font-size: 11px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Mode badge pill */
.history-mode-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.5);
}
[data-theme="light"] .history-mode-badge { background: var(--surface-2); color: var(--text-3); }

/* Tier badge pill */
.history-tier-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Meta dot separator */
.history-meta-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-3);
  flex-shrink: 0;
}

/* Actions — show on hover */
.history-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s;
}
.history-item:hover .history-actions { opacity: 1; }
/* Always show on touch devices */
@media (hover: none) {
  .history-actions { opacity: 1; }
}

.history-delete-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.history-delete-btn:hover { background: rgba(239,68,68,0.1); color: var(--red); }

/* ───── History Filter Bar — cleaner pills ───── */
.history-filter-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.history-filter-bar .filter-select {
  padding: 6px 28px 6px 10px;
  font-size: 12px;
  font-weight: 500;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 100px;
  color: rgba(255,255,255,0.7);
  font-family: inherit;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='%23888' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  cursor: pointer;
  outline: none;
  transition: all 0.15s;
}
.history-filter-bar .filter-select:hover { border-color: rgba(255,255,255,0.15); }
.history-filter-bar .filter-select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-light); }
[data-theme="light"] .history-filter-bar .filter-select {
  background-color: var(--surface);
  border-color: var(--border);
  color: var(--text-2);
}
.history-filter-bar .filter-date {
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 500;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 100px;
  color: rgba(255,255,255,0.7);
  font-family: inherit;
  outline: none;
  transition: all 0.15s;
}
.history-filter-bar .filter-date:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-light); }
[data-theme="light"] .history-filter-bar .filter-date {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text-2);
}
.history-filter-bar .filter-count {
  font-size: 11px;
  color: var(--text-3);
  margin-left: auto;
  white-space: nowrap;
}

/* ───── History Header Bar ───── */
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 12px;
  flex-wrap: wrap;
}
.history-header-left h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}
.history-header-left p {
  font-size: 13px;
  color: var(--text-3);
}
.history-header-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ───── History Empty State — inviting ───── */
.history-empty-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  text-align: center;
  padding: 80px 32px;
}
[data-theme="light"] .history-empty-card { background: var(--surface); border-color: var(--border); }
.history-empty-card .empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
}
.history-empty-card .empty-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.history-empty-card .empty-text {
  font-size: 14px;
  color: var(--text-3);
  margin-bottom: 28px;
  max-width: 340px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}

/* ───── History Detail Modal — redesigned ───── */
.history-detail-modal .modal {
  max-width: 640px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0;
  overflow: hidden;
}
.history-detail-modal .modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}
.detail-gauge-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 24px 20px;
  border-bottom: 1px solid var(--border);
}
.detail-meta-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-3);
  flex-wrap: wrap;
}
.detail-section {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.detail-section:last-child { border-bottom: none; }
[data-theme="light"] .detail-section { border-bottom-color: var(--border); }
.detail-section-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-3);
  margin-bottom: 12px;
}
.detail-text-preview {
  font-size: 13px;
  color: var(--text-2);
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 16px;
  max-height: 200px;
  overflow-y: auto;
  line-height: 1.7;
  white-space: pre-wrap;
  word-wrap: break-word;
}
[data-theme="light"] .detail-text-preview { background: var(--surface); border-color: var(--border); }
.detail-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════════════
   FLAGGED ITEMS
   ═══════════════════════════════════════════════════════════ */

.flagged-list { display: flex; flex-direction: column; gap: 8px; }
.flagged-item {
  padding: 14px 16px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
[data-theme="light"] .flagged-item { border-color: var(--border); }
.flagged-item .flag-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.flagged-item .flag-text { color: var(--text-2); line-height: 1.5; }
.flagged-item .flag-text strong { color: var(--text); }
.flagged-item.severity-high { border-left: 3px solid var(--red); }
.flagged-item.severity-medium { border-left: 3px solid var(--orange); }
.flagged-item.severity-low { border-left: 3px solid var(--yellow); }

/* ═══════════════════════════════════════════════════════════
   SUGGESTIONS
   ═══════════════════════════════════════════════════════════ */

.suggestion-item {
  padding: 16px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  margin-bottom: 8px;
  background: rgba(255,255,255,0.03);
}
[data-theme="light"] .suggestion-item { background: var(--surface); border-color: var(--border); }
.suggestion-original {
  font-size: 13px;
  color: var(--red);
  text-decoration: line-through;
  margin-bottom: 6px;
}
.suggestion-replacement {
  font-size: 13px;
  color: var(--green);
  font-weight: 500;
}
.suggestion-reason {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 6px;
}

/* ═══════════════════════════════════════════════════════════
   STATS ROW
   ═══════════════════════════════════════════════════════════ */

.stats-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.stat-item {
  flex: 1;
  min-width: 100px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
}
[data-theme="light"] .stat-item { background: var(--surface); border-color: var(--border); }
.stat-value { font-size: 24px; font-weight: 800; letter-spacing: -0.03em; color: var(--text); }
.stat-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-3); margin-top: 4px; }

/* ═══════════════════════════════════════════════════════════
   LOADING / SPINNER
   ═══════════════════════════════════════════════════════════ */

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--surface-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.spinner-lg { width: 48px; height: 48px; border-width: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(10,10,10,0.8);
  z-index: 10;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  border-radius: var(--radius);
}
[data-theme="light"] .loading-overlay { background: rgba(255,255,255,0.8); }
.loading-overlay.active { display: flex; }
.loading-text { font-size: 14px; color: var(--text-2); font-weight: 500; }

/* ═══════════════════════════════════════════════════════════
   TOAST / NOTIFICATIONS
   ═══════════════════════════════════════════════════════════ */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--bg);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  max-width: 360px;
}
.toast.success { background: var(--green); color: #fff; }
.toast.error { background: var(--red); color: #fff; }
.toast.warning { background: var(--orange); color: #fff; }
.toast-close {
  background: none;
  border: none;
  color: inherit;
  opacity: 0.7;
  cursor: pointer;
  font-size: 16px;
  padding: 0 0 0 8px;
}
.toast-close:hover { opacity: 1; }

@keyframes toastIn {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes toastOut {
  from { transform: translateY(0); opacity: 1; }
  to { transform: translateY(16px); opacity: 0; }
}

/* ═══════════════════════════════════════════════════════════
   SOCIAL LOGIN
   ═══════════════════════════════════════════════════════════ */

.social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-xs);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 8px;
}
.social-btn:hover { border-color: var(--border-strong); background: rgba(255,255,255,0.06); }
.social-btn svg { width: 18px; height: 18px; }
[data-theme="light"] .social-btn { background: var(--surface); border-color: var(--border); }

.divider-text {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 20px 0;
  font-size: 12px;
  color: var(--text-3);
}
.divider-text::before,
.divider-text::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ═══════════════════════════════════════════════════════════
   FAQ ACCORDION
   ═══════════════════════════════════════════════════════════ */

.faq-item {
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  margin-bottom: 8px;
  overflow: hidden;
}
[data-theme="light"] .faq-item { border-color: var(--border); }
.faq-question {
  width: 100%;
  padding: 16px 20px;
  background: none;
  border: none;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  cursor: pointer;
  font-family: inherit;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.15s;
}
[data-theme="light"] .faq-question { color: var(--text); }
.faq-question:hover { background: rgba(255,255,255,0.03); }
[data-theme="light"] .faq-question:hover { background: var(--surface); }
.faq-question .faq-icon {
  font-size: 18px;
  color: var(--text-3);
  transition: transform 0.2s;
}
.faq-item.open .faq-question .faq-icon { transform: rotate(45deg); }
.faq-answer {
  display: none;
  padding: 0 20px 16px;
  font-size: 13px;
  color: rgba(255,255,255,0.65);
  line-height: 1.7;
}
[data-theme="light"] .faq-answer { color: var(--text-2); }
.faq-item.open .faq-answer { display: block; }

/* ═══════════════════════════════════════════════════════════
   FEATURE COMPARISON TABLE
   ═══════════════════════════════════════════════════════════ */

.comparison-table { margin-top: 32px; }
.comparison-table .card { padding: 0; overflow: hidden; }
.comparison-table table { width: 100%; border-collapse: collapse; font-size: 13px; }
.comparison-table th { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; padding: 14px 16px; color: var(--text-2); border-bottom: 1px solid var(--border); }
.comparison-table td { padding: 11px 16px; border-bottom: 1px solid var(--border); color: var(--text-2); }
.comparison-table tr:last-child td { border-bottom: none; }
.comparison-table th:not(:first-child),
.comparison-table td:not(:first-child) { text-align: center; width: 100px; }
.comparison-table .check { color: var(--green); font-weight: 700; font-size: 15px; }
.comparison-table .no { color: var(--text-3); }

/* ═══════════════════════════════════════════════════════════
   AUTH PAGES — centered card
   ═══════════════════════════════════════════════════════════ */

.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 100px);
  padding: 40px 24px;
}
.auth-card {
  width: 100%;
  max-width: 400px;
}
.auth-card .card {
  padding: 40px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
}
[data-theme="light"] .auth-card .card {
  background: var(--surface);
  border-color: var(--border);
}
.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 800;
  font-size: 22px;
  margin-bottom: 28px;
  color: var(--text);
}
.auth-logo svg { width: 32px; height: 32px; }
.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-3);
}
.auth-footer a { color: var(--accent); font-weight: 500; }

/* ═══════════════════════════════════════════════════════════
   ACCOUNT SECTIONS
   ═══════════════════════════════════════════════════════════ */

.account-section { margin-bottom: 24px; }
.account-section .card-title { margin-bottom: 16px; }
.account-avatar-wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
}
.account-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent-light);
  border: 3px solid var(--accent);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 800;
}
.usage-bar-wrap { margin-bottom: 16px; }
.usage-bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
}
.usage-bar-header span:first-child { color: var(--text-2); }
.usage-bar-header span:last-child { font-weight: 600; color: var(--text); }
.usage-bar-track { height: 8px; background: var(--surface-2); border-radius: 100px; overflow: hidden; }
.usage-bar-fill { height: 100%; border-radius: 100px; background: var(--accent); transition: width 0.5s ease; }

/* ═══════════════════════════════════════════════════════════
   FILTER BAR
   ═══════════════════════════════════════════════════════════ */

.filter-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.filter-bar .form-select,
.filter-bar .form-input {
  width: auto;
  min-width: 140px;
}

/* ═══════════════════════════════════════════════════════════
   PAGE TITLES
   ═══════════════════════════════════════════════════════════ */

.page-header { margin-bottom: 32px; }
.page-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}
.page-subtitle { font-size: 15px; color: rgba(255,255,255,0.55); }
[data-theme="light"] .page-subtitle { color: var(--text-2); }

/* ═══════════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════════ */

.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-3);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state .empty-title { font-size: 18px; font-weight: 600; color: var(--text-2); margin-bottom: 8px; }
.empty-state .empty-text { font-size: 14px; margin-bottom: 24px; }

/* ═══════════════════════════════════════════════════════════
   FACT CHECK
   ═══════════════════════════════════════════════════════════ */

.fact-check-item {
  padding: 16px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  margin-bottom: 10px;
}
.fact-claim { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.fact-verdict {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.fact-verdict.verified { background: var(--green-bg); color: var(--green); }
.fact-verdict.unverified { background: rgba(234,179,8,0.1); color: var(--yellow); }
.fact-verdict.false { background: rgba(220,38,38,0.08); color: var(--red); }
.fact-explanation { font-size: 13px; color: var(--text-2); line-height: 1.6; }

/* ═══════════════════════════════════════════════════════════
   UNIFIED ANALYZER — TOOLBAR
   ═══════════════════════════════════════════════════════════ */

.analyzer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px 12px 0 0;
  margin-bottom: 0;
  flex-wrap: wrap;
}
[data-theme="light"] .analyzer-toolbar {
  background: var(--surface);
  border-color: var(--border);
}

/* ───── MODE CHIP BAR — use-case picker ───── */
.mode-chipbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px 16px;
  margin-top: -1px;
  background: rgba(255,255,255,0.015);
  border: 1px solid rgba(255,255,255,0.06);
}
[data-theme="light"] .mode-chipbar {
  background: var(--surface);
  border-color: var(--border);
}

/* Per-mode extras row (platform picker / ATS job posting) */
.mode-extras {
  padding: 8px 16px;
  margin-top: -1px;
  background: rgba(255,255,255,0.015);
  border: 1px solid rgba(255,255,255,0.06);
  border-top: none;
}
[data-theme="light"] .mode-extras { background: var(--surface); border-color: var(--border); border-top: none; }
.mode-extras.hidden { display: none; }

.mode-extras-row { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.mode-extras-row.hidden { display: none; }

.mode-extras-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-3);
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.mode-extras-label .info-icon { vertical-align: 0; margin-left: 2px; }

.platform-pills { display: flex; gap: 6px; flex-wrap: wrap; }

.platform-pill {
  padding: 4px 13px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-2);
  background: transparent;
  border: 1px solid var(--border-strong);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.platform-pill:hover { color: var(--text); border-color: var(--text-3); }
.platform-pill.active { color: var(--accent); border-color: var(--accent); background: var(--accent-light); }

.ats-textarea {
  width: 100%;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  resize: vertical;
}
.ats-textarea:focus { outline: none; border-color: var(--accent); }
.ats-textarea.hidden { display: none; }
.mode-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid var(--border);
  color: var(--text-2);
  background: transparent;
  transition: all 0.15s;
  white-space: nowrap;
}
.mode-chip svg { flex-shrink: 0; opacity: 0.75; }
.mode-chip.active svg { opacity: 1; }
.mode-chip:hover { border-color: var(--text-3); color: var(--text); }
.mode-chip.active {
  background: var(--accent-light);
  border-color: var(--border-accent);
  color: var(--accent);
  font-weight: 600;
}
/* Collapsed by default (see mode-chipbar-toggle): only the active chip and
   the toggle stay visible, so 9 modes don't sit expanded at all times.
   Re-collapses automatically on every mode change (updateModeUX in
   index.html), so it always resets to a clean breadcrumb after a pick. */
.mode-chipbar:not(.expanded) .mode-chip:not(.active),
.create-modebar:not(.expanded) .mode-chip:not(.active) { display: none; }
.mode-chipbar-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  border: 1px dashed var(--border-strong);
  color: var(--text-3);
  background: transparent;
  transition: all 0.15s;
  white-space: nowrap;
}
.mode-chipbar-toggle:hover { color: var(--text-2); border-color: var(--text-3); }
.mode-chipbar-toggle svg { flex-shrink: 0; transition: transform 0.15s; }
.mode-chipbar.expanded .mode-chipbar-toggle svg,
.create-modebar.expanded .mode-chipbar-toggle svg { transform: rotate(180deg); }
/* The mode hint sits on its OWN line beneath the chips, left-aligned under
   the first chip, and wraps in full instead of truncating on the right. */
.mode-hint {
  flex: 1 0 100%;
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-3);
  white-space: normal;
}
.mode-hint:empty { display: none; }

/* ───── USE-CASE EMPTY STATE — "What are you checking?" ───── */
.usecase-overlay {
  position: absolute;
  inset: 0;
  top: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 24px;
  pointer-events: none;
  z-index: 5;
}
.usecase-overlay.hidden { display: none; }
/* While the use-case cards are up, they join normal layout instead of
   floating absolutely — the wrap grows to fit both rows at any window
   size, so nothing clips against the container's bottom edge */
.analyzer-editor-wrap.showing-usecases .usecase-overlay {
  position: static;
  padding-top: 0;
  padding-bottom: 32px;
}
.analyzer-editor-wrap.showing-usecases .analyzer-editor {
  min-height: 150px;
  max-height: none;
}
.usecase-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 18px;
}
.usecase-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 730px;
}
.usecase-card {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 168px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,0.02);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: all 0.15s;
}
[data-theme="light"] .usecase-card { background: var(--surface); }
.usecase-card:hover { border-color: var(--text-3); transform: translateY(-1px); }
.usecase-card.active {
  border-color: var(--border-accent);
  background: var(--accent-light);
}
.usecase-card-icon { line-height: 1; color: var(--accent); }
.usecase-card-label { font-size: 12.5px; font-weight: 600; color: var(--text); }
.usecase-card-desc { font-size: 11px; color: var(--text-3); line-height: 1.4; }
.usecase-footer {
  pointer-events: auto;
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-3);
}
.usecase-sample-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  padding: 2px 4px;
}
.usecase-sample-btn:hover { text-decoration: underline; }
/* Suppress the one-line placeholder while the use-case panel is showing */
.analyzer-editor-wrap.showing-usecases .analyzer-editor:empty::before { opacity: 0.5; animation: none; }

/* ───── Link fetch bar — pasted a URL, offer to fetch it ───── */
.link-fetch-bar {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 8px 16px;
  border-radius: 100px;
  background: var(--surface);
  border: 1px solid var(--border-accent);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}
.link-fetch-bar.hidden { display: none; }
[data-theme="light"] .link-fetch-bar { box-shadow: 0 6px 20px rgba(0,0,0,0.1); }

/* "Did you mean?" document-type suggestion — a gentle, dismissible nudge */
.doctype-suggest {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(92%, 560px);
  padding: 8px 8px 8px 14px;
  border-radius: 100px;
  background: var(--surface);
  border: 1px solid rgba(99,102,241,0.4);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
  animation: doctypeSuggestIn 0.22s ease-out;
}
@keyframes doctypeSuggestIn { from { opacity: 0; transform: translate(-50%, -6px); } to { opacity: 1; transform: translate(-50%, 0); } }
@media (prefers-reduced-motion: reduce) { .doctype-suggest { animation: none; } }
.doctype-suggest.hidden { display: none; }
.doctype-suggest-icon { flex: 0 0 auto; color: #818cf8; }
.doctype-suggest-text { font-size: 12.5px; line-height: 1.4; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doctype-suggest-switch {
  flex: 0 0 auto;
  font-size: 12px; font-weight: 600;
  color: #fff; background: #6366f1; border: none;
  border-radius: 100px; padding: 6px 14px; cursor: pointer;
  transition: background 0.15s;
}
.doctype-suggest-switch:hover { background: #4f46e5; }
.doctype-suggest-dismiss {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  color: var(--text-dim); background: transparent; border: none;
  border-radius: 50%; cursor: pointer; transition: background 0.15s, color 0.15s;
}
.doctype-suggest-dismiss:hover { background: rgba(255,255,255,0.08); color: var(--text); }
[data-theme="light"] .doctype-suggest { box-shadow: 0 6px 20px rgba(0,0,0,0.1); }
[data-theme="light"] .doctype-suggest-dismiss:hover { background: rgba(0,0,0,0.06); }
@media (max-width: 560px) { .doctype-suggest-text { white-space: normal; } }
.link-fetch-label { font-size: 12px; font-weight: 600; color: var(--text-2); white-space: nowrap; }

/* ───── Live transcript timestamps + card collapse ───── */
.live-ts { color: var(--text-3); font-size: 11px; font-weight: 600; }
.live-ts-active {
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 4px;
  padding: 1px 4px;
}
.live-card-collapsible { position: relative; }
.live-card-collapse {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-3);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  z-index: 3;
  padding: 0;
  opacity: 0.55;
}
.live-card-collapse:hover { color: var(--text); border-color: var(--text-3); opacity: 1; }

/* ───── Selection actions — fact-check highlighted text ───── */
.selection-actions {
  position: fixed;
  z-index: 1001;
  display: flex;
  gap: 6px;
  padding: 6px;
  border-radius: 100px;
  background: var(--surface);
  border: 1px solid var(--border-accent);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}
.selection-results {
  position: fixed;
  z-index: 1001;
  width: 340px;
  max-height: 50vh;
  overflow-y: auto;
  padding: 14px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  box-shadow: 0 12px 36px rgba(0,0,0,0.45);
  font-size: 12px;
}
[data-theme="light"] .selection-results { box-shadow: 0 12px 36px rgba(0,0,0,0.15); }
.selection-results-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 15px;
  cursor: pointer;
}
.selfc-item { padding: 8px 0; border-bottom: 1px solid var(--border); }
.selfc-item:last-child { border-bottom: none; }
.selfc-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 100px;
  margin-bottom: 4px;
}

/* ───── Highlight hover tooltip — why was this flagged? ───── */
.hl-hovertip {
  position: fixed;
  z-index: 1000;
  max-width: 280px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #1c1c24;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
  pointer-events: none;
  font-size: 12px;
  line-height: 1.5;
}
[data-theme="light"] .hl-hovertip {
  background: #fff;
  border-color: var(--border);
  box-shadow: 0 8px 24px rgba(0,0,0,0.14);
}
.hl-hovertip-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text);
}
.hl-hovertip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.hl-hovertip-sev {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.hl-hovertip-body {
  margin-top: 5px;
  color: var(--text-2);
}
.hl-hovertip-foot {
  margin-top: 6px;
  font-size: 10.5px;
  color: var(--text-3);
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar-mode-select {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.45);
}
[data-theme="light"] .toolbar-label { color: var(--text-3); }

.toolbar-dropdown {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: rgba(255,255,255,0.9);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 32px 7px 12px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='%23888' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: all 0.2s;
  outline: none;
}
.toolbar-dropdown:hover {
  border-color: rgba(255,255,255,0.2);
  background-color: rgba(255,255,255,0.08);
}
.toolbar-dropdown:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}
.toolbar-dropdown option {
  background: #1a1a2e;
  color: #fff;
}
[data-theme="light"] .toolbar-dropdown {
  background-color: var(--bg);
  border-color: var(--border);
  color: var(--text);
}
[data-theme="light"] .toolbar-dropdown:hover {
  border-color: var(--border-strong);
  background-color: var(--surface);
}
[data-theme="light"] .toolbar-dropdown option {
  background: #fff;
  color: #111;
}

.toolbar-stat {
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding: 0 8px;
}
.toolbar-stat-value {
  font-size: 16px;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
  font-variant-numeric: tabular-nums;
}
.toolbar-stat-label {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  font-weight: 500;
}
[data-theme="light"] .toolbar-stat-value { color: var(--text); }
[data-theme="light"] .toolbar-stat-label { color: var(--text-3); }

.toolbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
  color: rgba(255,255,255,0.65);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  /* Never wrap a button's own label — with both sidebars open the toolbar
     runs out of room fast, and text wrapping inside one button (vs. the
     row wrapping around it) is what made "Fix with AI" balloon to two
     lines and look broken. The row wraps instead now (see .toolbar-right). */
  white-space: nowrap;
}
.toolbar-btn:hover {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.9);
  border-color: rgba(255,255,255,0.14);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
/* Fix with AI, not yet used this analysis — violet cue that an AI action is waiting */
.toolbar-btn.ai-accent {
  color: #a78bfa;
  border-color: rgba(139,92,246,0.45);
  background: rgba(139,92,246,0.10);
  box-shadow: 0 0 14px rgba(139,92,246,0.18);
}
.toolbar-btn.ai-accent:hover {
  color: #c4b5fd;
  border-color: rgba(139,92,246,0.65);
  background: rgba(139,92,246,0.16);
}
.toolbar-btn:active {
  transform: translateY(0) scale(0.98);
  transition-duration: 0.1s;
}
/* Don't draw the browser's default black focus ring on mouse/programmatic
   focus (e.g. when focus returns to Upload after the file dialog closes);
   keyboard users still get a clear accent ring. */
.toolbar-btn:focus { outline: none; }
.toolbar-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.toolbar-btn svg { flex-shrink: 0; }
/* Without this, a disabled button (e.g. TL;DR before 150 words) looks
   identical to an active one and just silently eats clicks — the only cue
   was a title tooltip nobody hovers. Disabled must look disabled. */
.toolbar-btn:disabled, .toolbar-btn:disabled:hover {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.toolbar-btn-accent {
  /* Flat, not a gradient — --accent-2 is a deliberately separate "AI accent"
     color (used for AI-touched UI elsewhere, distinct from the brand
     accent), not a lighter shade of --accent. A gradient between the two
     read as an unintentional two-tone clash, not a design choice. */
  background: var(--accent);
  border-color: transparent;
  color: #000;
  font-weight: 700;
  position: relative;
  overflow: hidden;
}
/* Current text already has a verified analysis — gold means "press me",
   green means "done"; typing flips it back to gold */
.toolbar-btn-accent.analyzed {
  background: rgba(34,197,94,0.14);
  border: 1px solid rgba(34,197,94,0.5);
  color: #4ade80;
}
[data-theme="light"] .toolbar-btn-accent.analyzed {
  background: rgba(22,163,74,0.08);
  border-color: rgba(22,163,74,0.45);
  color: #16a34a;
}
.toolbar-btn-accent::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 0%, rgba(255,255,255,0.2) 50%, transparent 100%);
  transform: translateX(-100%);
  transition: transform 0.5s;
}
.toolbar-btn-accent:hover::before {
  transform: translateX(100%);
}
.toolbar-btn-accent:hover {
  color: #000;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--accent-glow), 0 0 0 2px var(--accent-light);
}
.toolbar-btn-accent:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 2px 8px var(--accent-glow);
}

[data-theme="light"] .toolbar-btn {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text-2);
}
[data-theme="light"] .toolbar-btn.ai-accent {
  color: #7c3aed;
  border-color: rgba(124,58,237,0.35);
  background: rgba(124,58,237,0.07);
  box-shadow: none;
}
[data-theme="light"] .toolbar-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

/* ═══════════════════════════════════════════════════════════
   UNIFIED ANALYZER — EDITOR (hero element)
   ═══════════════════════════════════════════════════════════ */

.analyzer-editor-wrap {
  position: relative;
  margin-top: -1px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 0 0 14px 14px;
  overflow: hidden;
  background: rgba(255,255,255,0.02);
}
[data-theme="light"] .analyzer-editor-wrap {
  background: var(--bg);
  border-color: var(--border);
}

.analyzer-editor {
  min-height: calc(100vh - 280px);
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  padding: 32px 36px;
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  line-height: 1.75;
  color: rgba(255,255,255,0.92);
  outline: none;
  white-space: pre-wrap;
  word-wrap: break-word;
  flex: 1;
  caret-color: var(--accent);
  max-width: 800px;
  margin: 0 auto;
}
[data-theme="light"] .analyzer-editor { color: var(--text); }

.analyzer-editor-wrap:focus-within {
  border-color: var(--border-accent);
  box-shadow: 0 0 0 1px var(--accent-glow);
  transition: border-color 0.3s, box-shadow 0.3s;
}

.analyzer-editor:empty::before {
  content: attr(data-placeholder);
  color: rgba(255,255,255,0.35);
  pointer-events: none;
  font-size: 17px;
  font-weight: 500;
  animation: placeholderPulse 3s ease-in-out infinite;
  position: absolute;
}
[data-theme="light"] .analyzer-editor:empty::before { color: var(--text-3); }

.analyzer-editor::-webkit-scrollbar { width: 6px; }
.analyzer-editor::-webkit-scrollbar-track { background: transparent; }
.analyzer-editor::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }
.analyzer-editor::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.14); }

/* Editor highlights */
.editor-highlight {
  border-radius: 3px;
  padding: 1px 3px;
  cursor: pointer;
  transition: border-color 0.2s;
}
/* Same treatment as the landing-page demo: color tint + solid inset underline */
.editor-highlight.hl-high {
  background: rgba(239,68,68,0.14);
  box-shadow: inset 0 -2px 0 #ef4444;
}
.editor-highlight.hl-medium {
  background: rgba(234,179,8,0.13);
  box-shadow: inset 0 -2px 0 #eab308;
}
.editor-highlight.hl-low {
  background: rgba(234,179,8,0.09);
  box-shadow: inset 0 -2px 0 rgba(234,179,8,0.55);
}
.editor-highlight:hover {
  transition: all 0.2s;
}
.editor-highlight.hl-high:hover {
  background: rgba(239,68,68,0.08);
  box-shadow: 0 0 0 3px rgba(239,68,68,0.1);
}
.editor-highlight.hl-medium:hover {
  background: rgba(234,179,8,0.08);
  box-shadow: 0 0 0 3px rgba(234,179,8,0.1);
}
.editor-highlight.hl-low:hover {
  background: rgba(255,255,255,0.04);
}

/* Model-signature tells — violet, distinct from severity colors */
.editor-highlight.hl-sig {
  background: rgba(139,92,246,0.13);
  box-shadow: inset 0 -2px 0 #8b5cf6;
}
[data-theme="light"] .editor-highlight.hl-sig {
  background: rgba(124,58,237,0.10);
  box-shadow: inset 0 -2px 0 #7c3aed;
}

/* Voice mismatch highlights — blue/indigo underline */
.voice-highlight {
  border-bottom: 2px solid #6366f1;
  cursor: pointer;
  border-radius: 2px;
  padding: 1px 2px;
  transition: all 0.2s;
}
.voice-highlight:hover {
  background: rgba(99,102,241,0.08);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
[data-theme="light"] .voice-highlight { border-bottom-color: #4f46e5; }
[data-theme="light"] .voice-highlight:hover { background: rgba(79,70,229,0.06); }

.sev-voice {
  background: rgba(99,102,241,0.15) !important;
  color: #818cf8 !important;
}
[data-theme="light"] .sev-voice { color: #4f46e5 !important; }

/* Voice rewrite card in tooltip */
.hl-voice-rewrite {
  margin-top: 8px;
  padding: 8px 10px;
  background: rgba(99,102,241,0.06);
  border: 1px solid rgba(99,102,241,0.15);
  border-radius: 8px;
}
.hl-voice-rewrite-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #818cf8;
  margin-bottom: 4px;
}
.hl-voice-rewrite-text {
  font-size: 12px;
  color: rgba(255,255,255,0.75);
  line-height: 1.5;
  margin-bottom: 8px;
}
[data-theme="light"] .hl-voice-rewrite { background: rgba(79,70,229,0.04); border-color: rgba(79,70,229,0.12); }
[data-theme="light"] .hl-voice-rewrite-label { color: #4f46e5; }
[data-theme="light"] .hl-voice-rewrite-text { color: rgba(0,0,0,0.65); }

/* Swap applied animation */
@keyframes swapApplied {
  0% { background: rgba(34,197,94,0.3); box-shadow: 0 0 0 4px rgba(34,197,94,0.15); }
  100% { background: transparent; box-shadow: none; }
}
.editor-highlight.applied { animation: swapApplied 0.6s ease-out forwards; }

/* Placeholder pulse */
@keyframes placeholderPulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* Spell check errors — red wavy underline */
.spell-error {
  text-decoration: underline wavy #ef4444;
  text-decoration-skip-ink: none;
  text-underline-offset: 3px;
  cursor: help;
}
[data-theme="light"] .spell-error {
  text-decoration-color: #dc2626;
}
.editor-highlight.highlight-flash {
  animation: highlightFlash 1.2s ease;
}
@keyframes highlightFlash {
  0%,100% { box-shadow: none; }
  30% { box-shadow: 0 0 0 4px rgba(234,179,8,0.4); }
  60% { box-shadow: 0 0 0 2px rgba(234,179,8,0.2); }
}

[data-theme="light"] .editor-highlight.hl-high {
  background: rgba(220,38,38,0.11);
  box-shadow: inset 0 -2px 0 #dc2626;
}
[data-theme="light"] .editor-highlight.hl-medium {
  background: rgba(217,119,6,0.12);
  box-shadow: inset 0 -2px 0 #d97706;
}
[data-theme="light"] .editor-highlight.hl-low {
  background: rgba(217,119,6,0.08);
  box-shadow: inset 0 -2px 0 rgba(180,83,9,0.55);
}
[data-theme="light"] .editor-highlight:hover {
  background-color: rgba(0,0,0,0.03);
}

/* Highlight tooltip — scale-up + fade-in animation */
@keyframes hlTooltipIn {
  0% { opacity: 0; transform: scale(0.92); }
  100% { opacity: 1; transform: scale(1); }
}
.hl-tooltip {
  position: absolute;
  z-index: 1000;
  background: rgba(20, 20, 28, 0.96);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 12px 16px;
  max-width: 340px;
  min-width: 220px;
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: hlTooltipIn 0.18s ease-out both;
}

/* Header row — category pill + dismiss */
.hl-tooltip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.hl-tooltip-category {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 2px 8px;
  border-radius: 999px;
  line-height: 1.5;
  color: #fff;
}
.hl-tooltip-category.sev-high   { background: #ef4444; }
.hl-tooltip-category.sev-medium { background: #f97316; }
.hl-tooltip-category.sev-low    { background: #eab308; color: #1a1a1a; }
.hl-tooltip-dismiss {
  background: none;
  border: none;
  color: rgba(255,255,255,0.4);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 0 0 8px;
  font-family: inherit;
  transition: color 0.15s;
}
.hl-tooltip-dismiss:hover { color: rgba(255,255,255,0.8); }

/* Why card */
.hl-tooltip-why {
  font-size: 11px;
  color: rgba(200,210,255,0.85);
  margin-bottom: 10px;
  line-height: 1.5;
  padding: 6px 10px;
  background: rgba(99,102,241,0.12);
  border-radius: 8px;
  border-left: 3px solid rgba(99,102,241,0.5);
}

/* Chip grid */
.hl-tooltip-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.hl-chip {
  display: inline-block;
  padding: 4px 12px;
  border: 1px solid rgba(34,197,94,0.35);
  background: rgba(34,197,94,0.1);
  color: #22c55e;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hl-chip:hover, .hl-chip.hl-chip-active {
  background: rgba(34,197,94,0.22);
  border-color: rgba(34,197,94,0.6);
}
.hl-chip.hl-chip-delete {
  border-color: rgba(239,68,68,0.35);
  background: rgba(239,68,68,0.1);
  color: #fca5a5;
}
.hl-chip.hl-chip-delete:hover, .hl-chip.hl-chip-delete.hl-chip-active {
  background: rgba(239,68,68,0.22);
  border-color: rgba(239,68,68,0.6);
}

/* AI fix action inside the popover */
.hl-ai-fix {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.hl-chip.hl-chip-ai {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-color: rgba(167,139,250,0.4);
  background: rgba(167,139,250,0.12);
  color: #c4b5fd;
}
.hl-chip.hl-chip-ai:hover {
  background: rgba(167,139,250,0.25);
  border-color: rgba(167,139,250,0.7);
}
[data-theme="light"] .hl-chip.hl-chip-ai { color: #6d28d9; background: rgba(124,58,237,0.08); border-color: rgba(124,58,237,0.3); }
[data-theme="light"] .hl-ai-fix { border-top-color: rgba(0,0,0,0.08); }

/* No-alternative fallback */
.hl-tooltip-suggestion {
  font-size: 12px;
  color: #a3e635;
  font-weight: 500;
  margin-bottom: 8px;
}

/* Context preview */
.hl-tooltip-preview {
  display: block;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 8px;
  margin-top: 4px;
}
.hl-preview-label {
  display: block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: rgba(255,255,255,0.35);
  margin-bottom: 4px;
}
.hl-preview-text {
  font-size: 11px;
  color: rgba(255,255,255,0.6);
  line-height: 1.5;
  word-break: break-word;
}
.hl-preview-text .hl-pv-old {
  text-decoration: line-through;
  color: #ef4444;
}
.hl-preview-text .hl-pv-new {
  color: #22c55e;
  font-weight: 600;
}

/* Apply flash animation on replaced text */
@keyframes applyFlash {
  0%   { background: rgba(34,197,94,0.35); }
  100% { background: transparent; }
}
.editor-highlight-applied {
  animation: applyFlash 0.6s ease-out both;
  border-radius: 3px;
}

/* Light theme overrides */
[data-theme="light"] .hl-tooltip {
  background: #fff;
  border-color: var(--border);
  box-shadow: var(--shadow-lg);
}
[data-theme="light"] .hl-tooltip-dismiss { color: rgba(0,0,0,0.3); }
[data-theme="light"] .hl-tooltip-dismiss:hover { color: rgba(0,0,0,0.7); }
[data-theme="light"] .hl-tooltip-category { color: #fff; }
[data-theme="light"] .hl-tooltip-category.sev-low { color: #1a1a1a; }
[data-theme="light"] .hl-tooltip-suggestion { color: #16a34a; }
[data-theme="light"] .hl-tooltip-why {
  color: rgba(55,48,107,0.85);
  background: rgba(99,102,241,0.08);
  border-left-color: rgba(99,102,241,0.35);
}
[data-theme="light"] .hl-chip {
  border-color: rgba(22,163,74,0.3);
  background: rgba(22,163,74,0.08);
  color: #16a34a;
}
[data-theme="light"] .hl-chip:hover, [data-theme="light"] .hl-chip.hl-chip-active {
  background: rgba(22,163,74,0.18);
  border-color: rgba(22,163,74,0.5);
}
[data-theme="light"] .hl-chip.hl-chip-delete {
  border-color: rgba(220,38,38,0.3);
  background: rgba(220,38,38,0.06);
  color: #dc2626;
}
[data-theme="light"] .hl-chip.hl-chip-delete:hover, [data-theme="light"] .hl-chip.hl-chip-delete.hl-chip-active {
  background: rgba(220,38,38,0.14);
}
[data-theme="light"] .hl-tooltip-preview {
  border-top-color: rgba(0,0,0,0.06);
}
[data-theme="light"] .hl-preview-label { color: rgba(0,0,0,0.35); }
[data-theme="light"] .hl-preview-text { color: rgba(0,0,0,0.6); }
[data-theme="light"] .hl-preview-text .hl-pv-old { color: #dc2626; }
[data-theme="light"] .hl-preview-text .hl-pv-new { color: #16a34a; }

/* Drop overlay */
.editor-drop-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}
.drop-overlay-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  background: rgba(20,20,28,0.9);
  border: 2px dashed var(--accent);
  border-radius: 12px;
  padding: 40px;
  width: calc(100% - 24px);
  height: calc(100% - 24px);
}
[data-theme="light"] .drop-overlay-inner { background: rgba(255,255,255,0.92); }

/* ═══════════════════════════════════════════════════════════
   UNIFIED ANALYZER — SELECTION POPUP
   ═══════════════════════════════════════════════════════════ */

.selection-popup {
  position: absolute;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(20, 20, 28, 0.96);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 4px;
  transform: translateX(-50%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
[data-theme="light"] .selection-popup {
  background: #fff;
  border-color: var(--border);
  box-shadow: var(--shadow-lg);
}

.sel-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  background: transparent;
  border: none;
  border-radius: 7px;
  color: rgba(255,255,255,0.6);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: all 0.15s;
  white-space: nowrap;
}
.sel-btn:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}
.sel-btn-red { color: #ef4444; }
.sel-btn-red:hover { background: rgba(239,68,68,0.12); color: #ef4444; }
.sel-btn-green { color: #22c55e; }
.sel-btn-green:hover { background: rgba(34,197,94,0.12); color: #22c55e; }

.sel-divider {
  width: 1px;
  height: 20px;
  background: rgba(255,255,255,0.1);
  margin: 0 2px;
}
[data-theme="light"] .sel-btn { color: var(--text-2); }
[data-theme="light"] .sel-btn:hover { background: var(--surface); color: var(--text); }
[data-theme="light"] .sel-divider { background: var(--border); }

/* ═══════════════════════════════════════════════════════════
   UNIFIED ANALYZER — LOADING
   ═══════════════════════════════════════════════════════════ */

/* Docked over the results sidebar — progress shows exactly where the
   score will land, without blocking the editor. (It used to render below
   the editor, where a full page of text pushed it off-screen and Analyze
   looked dead.) Geometry mirrors .app-results-panel; z-index sits above
   it so stale results are covered while re-analyzing. */
.analyzer-loading {
  position: fixed;
  top: 52px;
  right: 0;
  bottom: 0;
  width: var(--panel-w);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  background: rgba(12, 13, 26, 0.94);
  border-left: 1px solid rgba(255,255,255,0.06);
  backdrop-filter: blur(32px) saturate(1.6);
  -webkit-backdrop-filter: blur(32px) saturate(1.6);
}
.analyzer-loading.hidden { display: none; }
[data-theme="light"] .analyzer-loading {
  background: rgba(250, 250, 252, 0.97);
  border-left-color: rgba(0,0,0,0.08);
}
@media (max-width: 600px) {
  .analyzer-loading { width: 100%; }
}
.analyzer-loading-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* Progress ring */
.progress-ring-wrap {
  position: relative;
  width: 64px;
  height: 64px;
}
.progress-ring-wrap svg { display: block; }
.progress-ring-bg {
  fill: none;
  stroke: rgba(255,255,255,0.08);
  stroke-width: 4;
}
.progress-ring-fg {
  fill: none;
  stroke: var(--accent, #eab308);
  stroke-width: 4;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  transition: stroke-dashoffset 0.4s ease;
}
[data-theme="light"] .progress-ring-bg { stroke: rgba(0,0,0,0.06); }

/* Stage list */
.loading-stages {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}
.loading-stage {
  font-size: 13px;
  color: rgba(255,255,255,0.25);
  transition: color 0.3s, opacity 0.3s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.loading-stage.stage-active {
  color: var(--accent, #eab308);
  font-weight: 600;
}
.loading-stage.stage-done {
  color: var(--green, #22c55e);
}
.loading-stage-check {
  display: inline-block;
  width: 14px;
  text-align: center;
  font-size: 12px;
}
[data-theme="light"] .loading-stage { color: rgba(0,0,0,0.2); }
[data-theme="light"] .loading-stage.stage-active { color: var(--accent); }
[data-theme="light"] .loading-stage.stage-done { color: var(--green); }

/* ═══════════════════════════════════════════════════════════
   MINI SCORECARD + FACT TOOLTIP
   ═══════════════════════════════════════════════════════════ */

.mini-scorecard,
.fact-tooltip {
  position: absolute;
  z-index: 1001;
  background: rgba(20, 20, 28, 0.96);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 14px 16px;
  min-width: 180px;
  max-width: 280px;
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
[data-theme="light"] .mini-scorecard,
[data-theme="light"] .fact-tooltip {
  background: #fff;
  border-color: var(--border);
  box-shadow: var(--shadow-lg);
}

.mini-scorecard-close,
.fact-tooltip-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.3);
  font-size: 16px;
  cursor: pointer;
  padding: 2px;
}
.mini-scorecard-close:hover,
.fact-tooltip-close:hover { color: rgba(255,255,255,0.7); }
[data-theme="light"] .mini-scorecard-close,
[data-theme="light"] .fact-tooltip-close { color: rgba(0,0,0,0.35); }
[data-theme="light"] .mini-scorecard-close:hover,
[data-theme="light"] .fact-tooltip-close:hover { color: rgba(0,0,0,0.7); }

.mini-scorecard-score {
  font-size: 36px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.5px;
}
.mini-scorecard-tier {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 4px;
}
.mini-scorecard-text {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  margin-top: 8px;
  line-height: 1.4;
}

.fact-tooltip-verdict {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 3px 10px;
  border-radius: 6px;
  margin-bottom: 8px;
}
.fact-tooltip-text {
  font-size: 12px;
  color: rgba(255,255,255,0.65);
  line-height: 1.4;
  font-style: italic;
}
[data-theme="light"] .fact-tooltip-text { color: var(--text-2); }
[data-theme="light"] .mini-scorecard-text { color: var(--text-3); }

/* ═══════════════════════════════════════════════════════════
   EXPORT TOOLBAR (below editor)
   ═══════════════════════════════════════════════════════════ */

/* Bucketed behind the "More" button (see toolbar-more-wrap) instead of a
   standing second toolbar row — same dropdown-panel treatment as the
   header's account menu, just anchored bottom-left of its trigger instead
   of top-right. */
.toolbar-more-wrap { position: relative; }
.export-toolbar {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  flex-direction: column;
  min-width: 180px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 400;
}
.export-toolbar.hidden { display: none; }
.export-toolbar:not(.hidden) { display: flex; }
.export-toolbar .toolbar-btn {
  width: 100%;
  justify-content: flex-start;
  background: transparent;
  border: none;
  border-radius: 7px;
}
.export-toolbar .toolbar-btn:hover { background: var(--surface-2); transform: none; }

/* ═══════════════════════════════════════════════════════════
   INFO ICON + TOOLTIP PANEL
   ═══════════════════════════════════════════════════════════ */

.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--text-3);
  transition: color 0.15s;
  vertical-align: -3px;
  margin-left: 4px;
  flex-shrink: 0;
}
.info-icon:hover { color: var(--accent); }

.info-tooltip-panel {
  position: absolute;
  z-index: 1100;
  max-width: 280px;
  padding: 12px 16px;
  background: rgba(20, 20, 28, 0.96);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  line-height: 1.5;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
[data-theme="light"] .info-tooltip-panel {
  background: #fff;
  border-color: var(--border);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}

/* ═══════════════════════════════════════════════════════════
   DETAIL PANEL — slide-out right panel
   ═══════════════════════════════════════════════════════════ */

.detail-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.detail-panel-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 360px;
  height: 100%;
  z-index: 2001;
  background: rgba(20,20,28,0.97);
  border-left: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: -8px 0 40px rgba(0,0,0,0.5);
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.detail-panel.open {
  transform: translateX(0);
}
[data-theme="light"] .detail-panel {
  background: rgba(255,255,255,0.97);
  border-left-color: var(--border);
  box-shadow: -8px 0 40px rgba(0,0,0,0.1);
}

.detail-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
[data-theme="light"] .detail-panel-header {
  border-bottom-color: var(--border);
}
.detail-panel-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.detail-panel-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: rgba(255,255,255,0.06);
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.detail-panel-close:hover {
  background: rgba(255,255,255,0.12);
  color: var(--text);
}
[data-theme="light"] .detail-panel-close {
  background: var(--surface-2);
  color: var(--text-2);
}
[data-theme="light"] .detail-panel-close:hover {
  background: var(--surface-3);
  color: var(--text);
}

.detail-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  -webkit-overflow-scrolling: touch;
}
.detail-panel-body h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  margin-top: 20px;
  letter-spacing: -0.01em;
}
.detail-panel-body h3:first-child {
  margin-top: 0;
}
.detail-panel-body p {
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-2);
  margin-bottom: 12px;
}
.detail-panel-body ul {
  list-style: none;
  padding: 0;
  margin-bottom: 16px;
}
.detail-panel-body ul li {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.55;
  padding: 6px 0;
  padding-left: 18px;
  position: relative;
}
.detail-panel-body ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 13px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.6;
}
.detail-panel-body .detail-tier {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  margin-right: 6px;
  margin-bottom: 6px;
}
.detail-panel-body .detail-divider {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: 20px 0;
}
[data-theme="light"] .detail-panel-body .detail-divider {
  background: var(--border);
}

@media (max-width: 480px) {
  .detail-panel {
    width: 100%;
  }
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
  .pricing-grid { grid-template-columns: 1fr; max-width: 360px; margin-left: auto; margin-right: auto; }
}

@media (max-width: 768px) {
  /* Sidebar: off-screen on mobile, slides in on .open */
  .app-sidebar {
    width: 240px;
    transform: translateX(-100%);
  }
  .app-sidebar.open {
    transform: translateX(0);
  }

  .app-editor-area {
    margin-left: 0 !important;
  }
  body.panel-open .app-editor-area {
    margin-right: 0 !important;
  }
  .app-main {
    margin-left: 0 !important;
  }
  .app-main-inner {
    padding: 20px 16px 20px;
  }

  .app-results-panel {
    width: 100%;
  }

  .header-center { display: none; }

  .app-footer { flex-direction: column; text-align: center; padding: 20px 16px; }

  .stats-row { gap: 8px; }
  .stat-item { min-width: 80px; padding: 12px; }
  .stat-value { font-size: 18px; }

  .signal-bar-label { width: 100px; font-size: 11px; }

  .form-row { flex-direction: column; gap: 0; }

  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar .form-select,
  .filter-bar .form-input { width: 100%; }

  .history-filter-bar { gap: 6px; }
  .history-filter-bar .filter-count { margin-left: 0; width: 100%; text-align: right; }
  .history-item { gap: 12px; padding: 14px 16px; }
  .history-actions { opacity: 1; }

  .analyzer-toolbar {
    gap: 8px;
    padding: 10px 12px;
  }
  .toolbar-left, .toolbar-right {
    gap: 6px;
    flex-wrap: wrap;
  }
  .toolbar-stat { display: none; }
  .results-signal-bar-wrap { width: 80px; }
  .results-score-number { font-size: 36px; }
  .results-gauge .gauge-svg { width: 140px; height: 78px; }
}

@media (max-width: 480px) {
  .page-title { font-size: 22px; }
  .score-number { font-size: 56px; }
  .score-gauge { width: 140px; height: 140px; }
  .auth-card .card { padding: 24px; }
  .pricing-card { padding: 24px 20px; }
  .price-dollar { font-size: 36px; }
  .toolbar-right { width: 100%; justify-content: flex-end; }
  /* Buttons keep their labels (they're bare text nodes, not spans) —
     shrink chrome so the row fits a phone-width toolbar instead */
  .toolbar-btn { padding: 6px 9px; font-size: 11px; gap: 4px; }
  .toolbar-btn svg { width: 14px; height: 14px; }
  .results-stats-row { flex-wrap: wrap; }
  .results-stat { min-width: 80px; }
}

/* ═══════════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════════ */

.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-accent { color: var(--accent); }
.text-muted { color: var(--text-3); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }

/* ═══════════════════════════════════════════════════════════
   PAGE-SPECIFIC LAYOUT OVERRIDES
   ═══════════════════════════════════════════════════════════ */

/* Pricing needs slightly wider for 3-column grid */
.pricing-page .app-main-inner {
  max-width: 880px;
}
/* Dashboard page — full width like editor */
.dashboard-page .app-main-inner {
  max-width: none;
}

/* ═══════════════════════════════════════════════════════════
   FLOATING GAUGE — REMOVED (score now in right panel)
   Gauge JS is a no-op shim. Hide any leftover DOM.
   ═══════════════════════════════════════════════════════════ */
#webapp-gauge-container { display: none !important; }

/* ═══════════════════════════════════════════════════════════
   RESULTS PANEL — section styles (shared by new panel layout)
   Old overlay/webapp-panel classes removed; panel shell is now
   .app-results-panel in the layout section above.
   ═══════════════════════════════════════════════════════════ */

/* Panel sections (used inside .panel-body) */
.wpp-section {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.wpp-section:last-child {
  border-bottom: none;
}

.wpp-section-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.35);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.wpp-count {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.5);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 100px;
}

.wpp-empty {
  font-size: 13px;
  color: rgba(255,255,255,0.3);
  padding: 4px 0;
}

/* Signal breakdown bars */
.wpp-signal-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.wpp-signal-label {
  font-size: 12px;
  color: rgba(255,255,255,0.65);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wpp-signal-bar-wrap {
  width: 90px;
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
}
.wpp-signal-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease-out;
}
.wpp-signal-score {
  font-size: 11px;
  width: 26px;
  text-align: right;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* Flagged items */
.wpp-flagged-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 350px;
  overflow-y: auto;
}
.wpp-flagged-list::-webkit-scrollbar { width: 4px; }
.wpp-flagged-list::-webkit-scrollbar-track { background: transparent; }
.wpp-flagged-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 2px; }

/* "Fix all N flags" banner — a real button that runs Fix with AI */
.wpp-improvement-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: calc(100% - 32px);
  margin: 12px 16px;
  padding: 11px 14px;
  background: linear-gradient(135deg,#065f46,#047857,#059669);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  color: #d1fae5;
  line-height: 1.5;
  text-align: left;
  box-shadow: 0 2px 8px rgba(5,150,105,0.25);
  transition: transform 0.15s, box-shadow 0.15s;
}
.wpp-improvement-banner:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(5,150,105,0.4);
}
.wpp-improvement-banner:active { transform: translateY(0); }
.wpp-improvement-banner svg { flex-shrink: 0; transition: transform 0.15s; }
.wpp-improvement-banner:hover svg { transform: translateX(3px); }

.wpp-flag-dismiss {
  background: none;
  border: none;
  color: rgba(255,255,255,0.25);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  margin-top: 2px;
  transition: all 0.15s;
}
.wpp-flag-dismiss:hover { color: #fff; background: rgba(255,255,255,0.1); }
[data-theme="light"] .wpp-flag-dismiss { color: rgba(0,0,0,0.3); }
[data-theme="light"] .wpp-flag-dismiss:hover { color: #000; background: rgba(0,0,0,0.06); }
.wpp-claim-item { position: relative; }
.wpp-claim-dismiss { position: absolute; top: 8px; right: 8px; }

/* Model signature section */
.wpp-modelsig-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.wpp-modelsig-name { font-size: 13px; font-weight: 700; color: #fff; }
[data-theme="light"] .wpp-modelsig-name { color: #111; }
.wpp-modelsig-conf {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 100px;
  white-space: nowrap;
}
.wpp-modelsig-patterns { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.wpp-modelsig-pattern {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 100px;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.6);
}
[data-theme="light"] .wpp-modelsig-pattern { background: rgba(0,0,0,0.05); color: rgba(0,0,0,0.55); }
.wpp-modelsig-secondary { font-size: 11px; line-height: 1.5; color: rgba(255,255,255,0.55); margin-bottom: 6px; }
[data-theme="light"] .wpp-modelsig-secondary { color: rgba(0,0,0,0.5); }
.wpp-modelsig-note { font-size: 10px; line-height: 1.5; color: rgba(255,255,255,0.35); }
[data-theme="light"] .wpp-modelsig-note { color: rgba(0,0,0,0.4); }

/* Hidden-character / watermark scan */
.wpp-wm-clean {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 12px; line-height: 1.5; color: rgba(255,255,255,0.5);
}
[data-theme="light"] .wpp-wm-clean { color: rgba(0,0,0,0.5); }
.wpp-wm-clean svg { flex-shrink: 0; margin-top: 2px; opacity: 0.7; }

.wpp-wm-alert {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 12px; line-height: 1.5; color: rgba(255,255,255,0.75);
  border: 1px solid rgba(255,255,255,0.12); border-radius: 8px;
  padding: 10px 12px; margin-bottom: 14px;
}
[data-theme="light"] .wpp-wm-alert { color: rgba(0,0,0,0.72); }
.wpp-wm-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }

.wpp-wm-cat { margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.wpp-wm-cat-last { border-bottom: none; margin-bottom: 4px; }
.wpp-wm-cat-head { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.wpp-wm-cat-label { font-size: 12.5px; font-weight: 700; color: #fff; flex: 1; min-width: 0; }
[data-theme="light"] .wpp-wm-cat-label { color: #111; }
.wpp-wm-note { font-size: 11.5px; line-height: 1.5; color: rgba(255,255,255,0.5); margin-bottom: 7px; }
[data-theme="light"] .wpp-wm-note { color: rgba(0,0,0,0.5); }
.wpp-wm-codes { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 7px; }
.wpp-wm-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.04em;
  background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.7);
  padding: 2px 6px; border-radius: 5px;
}
[data-theme="light"] .wpp-wm-code { background: rgba(0,0,0,0.05); color: rgba(0,0,0,0.6); }
.wpp-wm-samples { display: flex; flex-direction: column; gap: 4px; }
.wpp-wm-sample {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; line-height: 1.5; color: rgba(255,255,255,0.6);
  background: rgba(255,255,255,0.04); border-radius: 5px; padding: 4px 8px;
  overflow-x: auto; white-space: nowrap;
}
[data-theme="light"] .wpp-wm-sample { color: rgba(0,0,0,0.6); background: rgba(0,0,0,0.04); }

.wpp-wm-clean-btn {
  width: 100%; margin-top: 6px; padding: 9px 12px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  background: var(--accent-light); color: var(--accent);
  border: 1px solid var(--accent); border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.wpp-wm-clean-btn:hover { background: var(--accent); color: #fff; }
.wpp-wm-clean-btn:disabled { opacity: 0.6; cursor: progress; }

.wpp-wm-stat { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); }
.wpp-wm-stat-title {
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: rgba(255,255,255,0.4); margin-bottom: 6px;
}
[data-theme="light"] .wpp-wm-stat-title { color: rgba(0,0,0,0.4); }
.wpp-wm-stat-body { font-size: 11px; line-height: 1.55; color: rgba(255,255,255,0.42); margin-bottom: 6px; }
.wpp-wm-stat-body:last-child { margin-bottom: 0; }
[data-theme="light"] .wpp-wm-stat-body { color: rgba(0,0,0,0.45); }

/* Empty rewrite-panel chrome renders as stray bands — hide until filled */
.rewrite-panel-stats:empty { display: none; }
.rewrite-chat-messages:empty { display: none; }

/* PDF export dialog controls */
.pdf-export-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 0; }
.pdf-export-row label { font-size: 12.5px; font-weight: 600; color: var(--text); }
.pdf-export-row select {
  background: var(--bg); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 10px; font-size: 12.5px; font-family: inherit; min-width: 170px;
}
.pdf-export-go { margin-top: 14px; width: 100%; }

/* Live session report — format picker */
.report-format-list { display: flex; flex-direction: column; gap: 8px; }
.report-format-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.report-format-btn:hover { border-color: var(--border-accent); background: var(--accent-light); }
.report-format-btn strong { font-size: 13px; font-weight: 700; }
.report-format-btn span { font-size: 11.5px; color: var(--text-3); }

/* ───── Info modal (shared "what does this do?" surface) —
   .info-icon itself is defined once in the INFO ICON + TOOLTIP PANEL section ───── */
.info-modal-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,0.55); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; transition: opacity 0.18s;
}
.info-modal-overlay.open { opacity: 1; }
.info-modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  max-width: 480px; width: 100%; max-height: 80vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  transform: translateY(8px); transition: transform 0.18s;
}
.info-modal-overlay.open .info-modal { transform: translateY(0); }
.info-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 0;
}
.info-modal-head h3 { font-size: 16px; font-weight: 800; letter-spacing: -0.01em; }
.info-modal-close {
  background: none; border: none; cursor: pointer; padding: 6px;
  color: var(--text-3); border-radius: 8px; display: flex;
}
.info-modal-close:hover { color: var(--text); background: rgba(255,255,255,0.06); }
[data-theme="light"] .info-modal-close:hover { background: rgba(0,0,0,0.05); }
.info-modal-body { padding: 12px 20px 20px; font-size: 13px; line-height: 1.65; color: var(--text-2); }
.info-modal-body h4 { font-size: 12.5px; font-weight: 700; color: var(--text); margin: 14px 0 3px; }
.info-modal-body h4:first-child { margin-top: 0; }
.info-modal-body p { margin: 0 0 6px; }

/* ───── Shared page polish utilities (used by all standalone pages) ───── */
/* .page-glow no longer paints its own background — it sits inset inside
   .app-editor-area's 24px top padding, so a gradient painted here left a
   flat gap above it (same bug #workspace-dashboard had). It's now just a
   marker class: the actual gradient is painted on .app-editor-area itself
   via :has(.page-glow), see near .dash-greeting below. */
.page-header .page-title { font-size: clamp(24px, 3.5vw, 30px); font-weight: 800; letter-spacing: -0.03em; }
.page-header .page-subtitle { color: var(--text-2); }

/* ───── Dashboard (home workspace) — landing-page design language ───── */
.dash { max-width: 880px; margin: 0 auto; padding: 20px 0 48px; }
.dash-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  margin-bottom: 28px; padding: 28px 0 4px;
}
/* Full-bleed glow for the dashboard hero. This paints on .app-editor-area
   (the flush-with-header wrapper), NOT #workspace-dashboard — that element
   sits inset 24px below .app-editor-area's own top padding, so a gradient
   painted only on it left a flat, un-gradiented strip between the header and
   where the glow started. Scoped with :has() so every other workspace
   (Editor, Text, Image…) keeps its plain background. */
.app-editor-area:has(> .app-main-inner > #workspace-dashboard:not(.hidden)) {
  background-image: radial-gradient(ellipse 55% 320px at 50% 0px, var(--accent-glow), transparent 75%);
  background-color: var(--bg);
}
/* Same fix, same bug, on every OTHER page injected through Layout — history,
   faq, account, pricing, login, signup all share this one .page-glow class
   for their hero. Audited all six; all six had the identical gap. */
.app-editor-area:has(> .app-main-inner > .page-glow) {
  background-image: radial-gradient(ellipse 55% 300px at 50% 0px, var(--accent-glow), transparent 75%);
  background-color: var(--bg);
}
.dash-greeting { font-size: clamp(26px, 4vw, 34px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.dash-sub { font-size: 14px; color: var(--text-2); margin-top: 6px; }
.dash-plan {
  font-size: 10px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase;
  color: var(--accent); background: var(--accent-light);
  border: 1px solid var(--border-accent);
  padding: 5px 12px; border-radius: 100px; white-space: nowrap; margin-top: 10px;
}
.dash-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.dash-usage { margin-bottom: 20px; }
.dash-usage.hidden { display: none; }
.dash-stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px 18px; position: relative; overflow: hidden;
}
.dash-stat::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent 70%);
  opacity: 0.5;
}
.dash-stat-value { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--text); }
.dash-stat-label { font-size: 10px; font-weight: 600; letter-spacing: 0.7px; text-transform: uppercase; color: var(--text-2); margin-top: 4px; }
.dash-continue {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: linear-gradient(135deg, var(--accent-light), transparent 60%), var(--surface);
  border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: 14px; padding: 16px 18px; margin-bottom: 20px;
}
.dash-continue-label { font-size: 10px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: var(--accent); }
.dash-continue-text { font-size: 13.5px; color: var(--text); margin-top: 5px; line-height: 1.55; }
.dash-continue-meta { font-size: 11.5px; color: var(--text-2); margin-top: 4px; }
.dash-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 26px; }
.dash-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 18px; cursor: pointer; font-family: inherit;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.dash-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.25); }
[data-theme="light"] .dash-card:hover { box-shadow: 0 6px 18px rgba(0,0,0,0.08); }
.dash-card-icon {
  width: 40px; height: 40px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px; flex-shrink: 0;
}
.dash-card-name { font-size: 14.5px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.dash-card-desc { font-size: 12px; line-height: 1.5; color: var(--text-2); margin-top: 2px; }
.dash-account { margin-bottom: 26px; }
.dash-account-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.dash-card-sm { flex-direction: row; align-items: center; gap: 11px; padding: 13px 15px; text-decoration: none; }
.dash-card-sm .dash-card-icon {
  margin-bottom: 0; width: 32px; height: 32px; border-radius: 9px;
  background: rgba(255,255,255,0.06); color: var(--text-2);
}
[data-theme="light"] .dash-card-sm .dash-card-icon { background: rgba(0,0,0,0.05); }
.dash-card-sm:hover .dash-card-icon { color: var(--accent); background: var(--accent-light); }
.dash-card-sm .dash-card-name { font-size: 13.5px; }
@media (max-width: 720px) { .dash-account-grid { grid-template-columns: repeat(2, 1fr); } }
.dash-recent-head { display: flex; align-items: center; justify-content: space-between; font-size: 11px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: var(--text-3); margin-bottom: 8px; }
.dash-recent-head a { color: var(--accent); text-transform: none; letter-spacing: 0; font-weight: 600; }
.dash-recent-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 12px 16px; margin-bottom: 8px; text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}
.dash-recent-row:hover { border-color: var(--accent); transform: translateY(-1px); }
.dash-recent-score { font-size: 17px; font-weight: 800; min-width: 34px; text-align: center; font-variant-numeric: tabular-nums; }
.dash-recent-preview { flex: 1; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-recent-meta { font-size: 11.5px; color: var(--text-2); white-space: nowrap; }
@media (max-width: 720px) {
  .dash-stats { grid-template-columns: repeat(2, 1fr); }
  .dash-cards { grid-template-columns: repeat(2, 1fr); }
  .dash-continue { flex-direction: column; align-items: flex-start; }
}

/* Citation suggestions (essay mode) */
.wpp-cite-btn {
  margin-top: 8px;
  background: none;
  border: 1px solid rgba(139,92,246,0.4);
  color: #a78bfa;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.wpp-cite-btn:hover { border-color: #8b5cf6; background: rgba(139,92,246,0.08); }
.wpp-cite-btn:disabled { opacity: 0.5; cursor: default; }
[data-theme="light"] .wpp-cite-btn { color: #7c3aed; border-color: rgba(124,58,237,0.4); }
.wpp-cite-item { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: rgba(139,92,246,0.06); border: 1px solid rgba(139,92,246,0.15); }
.wpp-cite-source { font-size: 12px; font-weight: 600; color: #fff; }
[data-theme="light"] .wpp-cite-source { color: #111; }
.wpp-cite-unsure { color: rgba(255,255,255,0.55); font-weight: 500; }
[data-theme="light"] .wpp-cite-unsure { color: rgba(0,0,0,0.5); }
.wpp-cite-type { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: #a78bfa; margin-left: 4px; }
.wpp-cite-how { font-size: 11px; line-height: 1.5; color: rgba(255,255,255,0.65); margin-top: 3px; }
[data-theme="light"] .wpp-cite-how { color: rgba(0,0,0,0.6); }
.wpp-cite-caution { font-size: 11px; line-height: 1.5; color: #eab308; margin-top: 3px; }
[data-theme="light"] .wpp-cite-caution { color: #b45309; }
.wpp-cite-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.wpp-cite-intext {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  color: #a7f3d0;
  background: rgba(34,197,94,0.12);
  padding: 2px 8px;
  border-radius: 6px;
}
[data-theme="light"] .wpp-cite-intext { color: #15803d; background: rgba(34,197,94,0.12); }
.wpp-cite-insert, .wpp-cite-copy {
  background: none;
  border: 1px solid rgba(34,197,94,0.4);
  color: #4ade80;
  font-size: 10px;
  font-weight: 600;
  font-family: inherit;
  padding: 3px 9px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.wpp-cite-insert:hover, .wpp-cite-copy:hover { border-color: #22c55e; background: rgba(34,197,94,0.1); }
.wpp-cite-copy { border-color: rgba(255,255,255,0.2); color: rgba(255,255,255,0.6); }
.wpp-cite-copy:hover { border-color: rgba(255,255,255,0.4); background: rgba(255,255,255,0.06); }
[data-theme="light"] .wpp-cite-insert { color: #15803d; }
[data-theme="light"] .wpp-cite-copy { border-color: rgba(0,0,0,0.2); color: rgba(0,0,0,0.55); }
.wpp-cite-verify { display: inline-block; font-size: 10px; font-weight: 600; color: #a78bfa; text-decoration: underline; }
[data-theme="light"] .wpp-cite-verify { color: #7c3aed; }
.wpp-cite-disclaimer { margin-top: 8px; font-size: 10px; line-height: 1.5; color: rgba(255,255,255,0.35); }
[data-theme="light"] .wpp-cite-disclaimer { color: rgba(0,0,0,0.4); }

/* Pass/fail verdict pill under the tier */
.panel-passfail { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 8px 0 4px; cursor: help; width: 100%; }
.panel-passfail-pill {
  font-size: 10px; font-weight: 800; letter-spacing: 1.2px;
  padding: 3px 12px; border-radius: 100px;
}
.panel-passfail-note { font-size: 11px; color: var(--text-2); }
/* Traffic light: verdict dot lit and glowing, the others dormant */
.pf-light {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 7px; border-radius: 100px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
}
[data-theme="light"] .pf-light { background: rgba(0,0,0,0.05); }
.pf-dot { width: 9px; height: 9px; border-radius: 50%; transition: all 0.3s; }
.pf-red { background: rgba(239,68,68,0.18); }
.pf-yellow { background: rgba(234,179,8,0.18); }
.pf-green { background: rgba(34,197,94,0.18); }
.pf-red.on { background: #ef4444; box-shadow: 0 0 8px rgba(239,68,68,0.7); }
.pf-yellow.on { background: #eab308; box-shadow: 0 0 8px rgba(234,179,8,0.7); }
.pf-green.on { background: #22c55e; box-shadow: 0 0 8px rgba(34,197,94,0.7); }

/* Dismissed-flags restore row */
.wpp-dismissed-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.wpp-dismissed-note { font-size: 11px; color: rgba(255,255,255,0.4); }
[data-theme="light"] .wpp-dismissed-note { color: rgba(0,0,0,0.4); }
.wpp-restore-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.6);
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.wpp-restore-btn:hover { color: #fff; border-color: rgba(255,255,255,0.35); }
[data-theme="light"] .wpp-restore-btn { border-color: rgba(0,0,0,0.15); color: rgba(0,0,0,0.55); }
[data-theme="light"] .wpp-restore-btn:hover { color: #000; border-color: rgba(0,0,0,0.35); }

/* Cards render directly in the section (no list wrapper) — space them here */
.wpp-flagged-item + .wpp-flagged-item,
.wpp-claim-item + .wpp-claim-item { margin-top: 8px; }

.wpp-flagged-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.025);
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.03);
  cursor: pointer;
  transition: all 0.2s;
}
.wpp-flagged-item:hover {
  background: rgba(255,255,255,0.06);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.wpp-flagged-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}

.wpp-flagged-body {
  flex: 1;
  min-width: 0;
}

.wpp-flagged-text {
  font-size: 12px;
  color: #fff;
  line-height: 1.4;
  margin-bottom: 5px;
}

.wpp-flagged-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}

.wpp-flagged-category {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.55);
}

.wpp-flagged-count {
  font-size: 10px;
  color: rgba(255,255,255,0.35);
  font-weight: 600;
}

.wpp-flagged-goal {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(34,197,94,0.12);
  color: #22c55e;
  font-weight: 600;
  white-space: nowrap;
}

.wpp-flagged-advice {
  margin-top: 5px;
  font-size: 11px;
  line-height: 1.5;
  color: rgba(255,255,255,0.5);
  border-left: 2px solid rgba(34,197,94,0.4);
  padding-left: 8px;
}

/* Effectiveness (goal) checks */
.wpp-goal-desc {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  margin-bottom: 10px;
  line-height: 1.5;
}

.wpp-goal-check {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.wpp-goal-check:last-child { border-bottom: none; }

.wpp-goal-check-icon { flex-shrink: 0; margin-top: 1px; display: flex; }

.wpp-goal-check-body { flex: 1; min-width: 0; }

.wpp-goal-check-name {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.wpp-goal-check-score {
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,0.35);
  font-variant-numeric: tabular-nums;
}

.wpp-goal-check-detail {
  font-size: 11px;
  line-height: 1.5;
  color: rgba(255,255,255,0.5);
  margin-top: 2px;
}

/* ── AI argument/credibility: one-line diagnosis + where-it's-weak cards ── */
.wpp-goal-summary {
  font-size: 12px;
  line-height: 1.5;
  color: rgba(255,255,255,0.82);
  margin: 2px 0 10px;
  padding-left: 10px;
  border-left: 2px solid rgba(255,255,255,0.18);
}
.wpp-weak-head {
  display: flex; align-items: center; gap: 7px;
  margin: 14px 0 2px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: rgba(255,255,255,0.72);
}
.wpp-weak-sub { font-size: 10.5px; color: rgba(255,255,255,0.4); margin-bottom: 9px; }
.wpp-weakspot {
  border: 1px solid rgba(255,255,255,0.08);
  border-left: 3px solid #eab308;
  border-radius: 8px;
  padding: 9px 11px;
  margin-bottom: 8px;
  background: rgba(255,255,255,0.02);
}
.wpp-weakspot-high { border-left-color: #f97316; }
.wpp-weakspot-medium { border-left-color: #eab308; }
.wpp-weakspot-low { border-left-color: #a3e635; }
.wpp-weakspot-top { margin-bottom: 4px; }
.wpp-weakspot-issue {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase;
  color: rgba(255,255,255,0.62);
}
.wpp-weakspot .wpp-flagged-text {
  font-size: 12px; font-style: italic; color: rgba(255,255,255,0.9);
  margin: 0 0 5px; line-height: 1.45;
}
.wpp-weakspot-why { font-size: 11px; line-height: 1.5; color: rgba(255,255,255,0.55); margin-bottom: 7px; }
.wpp-weakspot-fix {
  display: flex; gap: 7px; align-items: flex-start;
  font-size: 11.5px; line-height: 1.5; color: rgba(255,255,255,0.85);
  background: rgba(34,197,94,0.07);
  border: 1px solid rgba(34,197,94,0.16);
  border-radius: 6px; padding: 7px 9px;
}
.wpp-weakspot-fix-label {
  flex: 0 0 auto; font-size: 9.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  color: #22c55e; margin-top: 2px;
}
.wpp-strengths {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-top: 12px;
}
.wpp-strengths-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: rgba(34,197,94,0.85);
}
.wpp-strength-chip {
  font-size: 11px; color: rgba(255,255,255,0.75);
  background: rgba(34,197,94,0.08); border: 1px solid rgba(34,197,94,0.18);
  border-radius: 100px; padding: 3px 10px;
}
/* Legal "not legal advice" notice */
.wpp-legal-notice {
  display: flex; align-items: flex-start; gap: 11px;
  /* Inset to line up with .wpp-section content (padding 16px 20px), with
     breathing room above and below so it doesn't crowd the dividers. */
  margin: 14px 20px 16px;
  padding: 14px 16px;
  font-size: 11.5px; line-height: 1.6;
  color: rgba(255,255,255,0.62);
  background: rgba(148,163,184,0.08);
  border: 1px solid rgba(148,163,184,0.16);
  border-radius: 10px;
}
.wpp-legal-notice svg { flex: 0 0 auto; margin-top: 2px; color: #94a3b8; }
.wpp-legal-notice strong { color: rgba(255,255,255,0.82); font-weight: 600; }
[data-theme="light"] .wpp-goal-summary { color: rgba(0,0,0,0.78); border-left-color: rgba(0,0,0,0.15); }
[data-theme="light"] .wpp-weak-head { color: rgba(0,0,0,0.7); }
[data-theme="light"] .wpp-weakspot { background: rgba(0,0,0,0.02); border-color: rgba(0,0,0,0.07); }
[data-theme="light"] .wpp-weakspot .wpp-flagged-text { color: rgba(0,0,0,0.85); }
[data-theme="light"] .wpp-weakspot-why { color: rgba(0,0,0,0.55); }
[data-theme="light"] .wpp-weakspot-fix { color: rgba(0,0,0,0.8); }
[data-theme="light"] .wpp-strength-chip { color: rgba(0,0,0,0.7); }
[data-theme="light"] .wpp-legal-notice { color: rgba(0,0,0,0.6); background: rgba(100,116,139,0.07); border-color: rgba(100,116,139,0.16); }
[data-theme="light"] .wpp-legal-notice strong { color: rgba(0,0,0,0.82); }

[data-theme="light"] .wpp-flagged-goal { background: rgba(22,163,74,0.1); color: #16a34a; }
[data-theme="light"] .wpp-flagged-advice { color: rgba(0,0,0,0.55); border-left-color: rgba(22,163,74,0.4); }
[data-theme="light"] .wpp-goal-desc { color: rgba(0,0,0,0.45); }
[data-theme="light"] .wpp-goal-check { border-bottom-color: rgba(0,0,0,0.05); }
[data-theme="light"] .wpp-goal-check-name { color: rgba(0,0,0,0.8); }
[data-theme="light"] .wpp-goal-check-score { color: rgba(0,0,0,0.4); }
[data-theme="light"] .wpp-goal-check-detail { color: rgba(0,0,0,0.55); }

/* Fact check claims */
.wpp-claim-item {
  padding: 10px 12px;
  background: rgba(255,255,255,0.025);
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.03);
}

.wpp-claim-verdict {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 2px 8px;
  border-radius: 6px;
  margin-bottom: 6px;
}
.wpp-verdict-verified {
  background: rgba(34,197,94,0.15);
  color: #22c55e;
  border: 1px solid rgba(34,197,94,0.25);
}
.wpp-verdict-unverified {
  background: rgba(234,179,8,0.15);
  color: #eab308;
  border: 1px solid rgba(234,179,8,0.25);
}
.wpp-verdict-false {
  background: rgba(239,68,68,0.15);
  color: #ef4444;
  border: 1px solid rgba(239,68,68,0.25);
}
.wpp-verdict-misleading {
  background: rgba(249,115,22,0.15);
  color: #f97316;
  border: 1px solid rgba(249,115,22,0.25);
}
/* A recounted first-hand event — neutral slate, deliberately un-alarming. */
.wpp-verdict-testimony {
  background: rgba(148,163,184,0.14);
  color: #94a3b8;
  border: 1px solid rgba(148,163,184,0.24);
}
/* Reassurance strip: "N statements read as your own account — not graded." */
.wpp-testimony-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 4px 0 10px;
  padding: 9px 11px;
  font-size: 11.5px;
  line-height: 1.5;
  color: rgba(255,255,255,0.62);
  background: rgba(148,163,184,0.08);
  border: 1px solid rgba(148,163,184,0.16);
  border-radius: 8px;
}
.wpp-testimony-note svg { flex: 0 0 auto; margin-top: 1px; color: #94a3b8; opacity: 0.9; }
[data-theme="light"] .wpp-verdict-testimony { background: rgba(100,116,139,0.12); color: #475569; border-color: rgba(100,116,139,0.22); }
[data-theme="light"] .wpp-testimony-note { color: #475569; background: rgba(100,116,139,0.07); border-color: rgba(100,116,139,0.16); }

.wpp-claim-source {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 100px;
  padding: 3px 10px;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
a.wpp-claim-source:hover { color: #818cf8; border-color: rgba(99,102,241,0.4); background: rgba(99,102,241,0.08); }
.wpp-src-ext { opacity: 0.6; margin-left: 1px; }
/* Claims with no cited source — a quiet "go look it up" web-search link. */
.wpp-claim-verify {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  font-size: 10.5px;
  font-weight: 600;
  color: rgba(255,255,255,0.4);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s;
}
.wpp-claim-verify:hover { color: #818cf8; text-decoration: underline; text-underline-offset: 2px; }
[data-theme="light"] .wpp-verdict-misleading { background: rgba(234,88,12,0.1); color: #ea580c; border-color: rgba(234,88,12,0.25); }
[data-theme="light"] .wpp-claim-source { color: rgba(0,0,0,0.55); background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.08); }
[data-theme="light"] a.wpp-claim-source:hover { color: #4f46e5; border-color: rgba(99,102,241,0.4); background: rgba(99,102,241,0.06); }
[data-theme="light"] .wpp-claim-verify { color: rgba(0,0,0,0.42); }

.wpp-claim-text {
  font-size: 12px;
  color: rgba(255,255,255,0.85);
  line-height: 1.4;
  margin-bottom: 4px;
  font-style: italic;
}
/* Clickable claims jump to the passage in the document, like flagged items. */
.wpp-claim-text[data-phrase] { transition: color 0.15s; }
.wpp-claim-text[data-phrase]:hover { color: #fff; text-decoration: underline; text-decoration-color: rgba(255,255,255,0.35); text-underline-offset: 2px; }
[data-theme="light"] .wpp-claim-text[data-phrase]:hover { color: #111; text-decoration-color: rgba(0,0,0,0.3); }

/* Who said it — the key attribute for debate/podcast/transcript fact-checking */
.wpp-claim-speaker {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  margin-left: 6px;
  margin-bottom: 6px;
}

/* Document insights — readability / reading time / stats chips + PII scan */
.wpp-insight-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.wpp-insight-chip {
  font-size: 11.5px;
  color: var(--text-2);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
  line-height: 1.4;
}
.wpp-insight-chip b { color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }
[data-theme="light"] .wpp-insight-chip { background: rgba(0,0,0,0.03); }
.wpp-pii {
  margin-top: 10px;
  border: 1px solid rgba(234,179,8,0.35);
  background: rgba(234,179,8,0.08);
  border-radius: 10px;
  padding: 10px 12px;
}
[data-theme="light"] .wpp-pii { background: rgba(202,138,4,0.07); border-color: rgba(202,138,4,0.3); }
.wpp-pii-head {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: #d9a520; margin-bottom: 7px; line-height: 1.35;
}
[data-theme="light"] .wpp-pii-head { color: #a16207; }
.wpp-pii-row {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 12px; padding: 3px 0; border-top: 1px solid rgba(234,179,8,0.15);
}
.wpp-pii-type { color: var(--text-2); font-weight: 600; }
.wpp-pii-sample { color: var(--text-3); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }

/* Web overlap — on-demand, paid check (button + results) */
.wpp-webcheck-intro { font-size: 12px; color: var(--text-2); line-height: 1.5; margin-bottom: 10px; }
.wpp-webcheck-btn {
  font-size: 12px; font-weight: 600;
  padding: 7px 14px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; transition: border-color 0.15s, color 0.15s;
}
.wpp-webcheck-btn:hover { border-color: var(--accent); color: var(--accent); }
.wpp-webcheck-btn:disabled { opacity: 0.6; cursor: progress; }
.wpp-webcheck-results { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.wpp-webcheck-note { font-size: 12px; color: var(--text-2); line-height: 1.5; }
.wpp-webcheck-hit { border-left: 3px solid #eab308; background: rgba(234,179,8,0.06); border-radius: 0 8px 8px 0; padding: 8px 12px; }
.wpp-webcheck-crit { border-left-color: #ef4444; background: rgba(239,68,68,0.06); }
.wpp-webcheck-passage { font-size: 12px; font-style: italic; color: var(--text); margin-bottom: 3px; line-height: 1.4; }
.wpp-webcheck-label { font-size: 11px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
.wpp-webcheck-src { display: block; font-size: 11.5px; color: var(--accent); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wpp-webcheck-src:hover { text-decoration: underline; }

.wpp-claim-explanation {
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  line-height: 1.4;
}

/* Suggestions */
.wpp-suggestion-item {
  padding: 10px 12px;
  background: rgba(255,255,255,0.025);
  border-radius: 10px;
  margin-bottom: 6px;
  border: 1px solid rgba(255,255,255,0.03);
}

.wpp-suggestion-original {
  font-size: 12px;
  color: #ef4444;
  text-decoration: line-through;
  line-height: 1.4;
}

.wpp-suggestion-arrow {
  font-size: 12px;
  color: rgba(255,255,255,0.25);
  margin: 4px 0;
}

.wpp-suggestion-replacement {
  font-size: 12px;
  color: #22c55e;
  font-weight: 500;
  line-height: 1.4;
}

.wpp-suggestion-reason {
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  margin-top: 4px;
  line-height: 1.4;
}

/* ───── LIGHT MODE: Results panel + wpp sections ───── */
[data-theme="light"] .wpp-section {
  border-bottom-color: rgba(0,0,0,0.06);
}
[data-theme="light"] .wpp-section-title {
  color: rgba(0,0,0,0.45);
}
[data-theme="light"] .wpp-count {
  background: rgba(0,0,0,0.06);
  color: rgba(0,0,0,0.5);
}
[data-theme="light"] .wpp-empty {
  color: rgba(0,0,0,0.35);
}
[data-theme="light"] .wpp-signal-label {
  color: rgba(0,0,0,0.65);
}
[data-theme="light"] .wpp-signal-bar-wrap {
  background: rgba(0,0,0,0.06);
}
[data-theme="light"] .wpp-flagged-list::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.1);
}
[data-theme="light"] .wpp-flagged-item {
  background: rgba(0,0,0,0.025);
  border-color: rgba(0,0,0,0.06);
}
[data-theme="light"] .wpp-flagged-item:hover {
  background: rgba(0,0,0,0.05);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
[data-theme="light"] .wpp-flagged-text {
  color: #111;
}
[data-theme="light"] .wpp-flagged-category {
  background: rgba(0,0,0,0.05);
  color: rgba(0,0,0,0.55);
}
[data-theme="light"] .wpp-flagged-count {
  color: rgba(0,0,0,0.4);
}
[data-theme="light"] .wpp-claim-item {
  background: rgba(0,0,0,0.02);
  border-color: rgba(0,0,0,0.06);
}
[data-theme="light"] .wpp-claim-text {
  color: rgba(0,0,0,0.8);
}
[data-theme="light"] .wpp-claim-explanation {
  color: rgba(0,0,0,0.5);
}
[data-theme="light"] .wpp-verdict-verified {
  background: rgba(22,163,74,0.1);
  color: #16a34a;
  border-color: rgba(22,163,74,0.2);
}
[data-theme="light"] .wpp-verdict-unverified {
  background: rgba(217,119,6,0.1);
  color: #d97706;
  border-color: rgba(217,119,6,0.2);
}
[data-theme="light"] .wpp-verdict-false {
  background: rgba(220,38,38,0.1);
  color: #dc2626;
  border-color: rgba(220,38,38,0.2);
}
[data-theme="light"] .wpp-suggestion-item {
  background: rgba(0,0,0,0.02);
  border-color: rgba(0,0,0,0.06);
}
[data-theme="light"] .wpp-suggestion-original {
  color: #dc2626;
}
[data-theme="light"] .wpp-suggestion-arrow {
  color: rgba(0,0,0,0.25);
}
[data-theme="light"] .wpp-suggestion-replacement {
  color: #16a34a;
}
[data-theme="light"] .wpp-suggestion-reason {
  color: rgba(0,0,0,0.4);
}

/* ───── Info body (collapsible) ───── */
.wpp-info-body {
  color: rgba(255,255,255,0.5);
}
.wpp-info-body strong {
  color: rgba(255,255,255,0.8);
}
[data-theme="light"] .wpp-info-body {
  color: rgba(0,0,0,0.5);
}
[data-theme="light"] .wpp-info-body strong {
  color: rgba(0,0,0,0.75);
}

/* ───── Context grid ───── */
.wpp-context-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.wpp-context-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.wpp-context-label {
  font-size: 10px;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.wpp-context-value {
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  font-weight: 500;
}
[data-theme="light"] .wpp-context-label { color: rgba(0,0,0,0.35); }
[data-theme="light"] .wpp-context-value { color: rgba(0,0,0,0.75); }

/* ───── Panel footer ───── */
.panel-footer {
  padding: 16px 20px;
  font-size: 10px;
  color: var(--text-3);
  line-height: 1.5;
  text-align: center;
  border-top: 1px solid rgba(255,255,255,0.04);
  flex-shrink: 0;
}
[data-theme="light"] .panel-footer {
  color: var(--text-3);
  border-top-color: rgba(0,0,0,0.04);
}

/* ───── Controls: toggle + slider (matches extension) ───── */
.wpp-controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.wpp-control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.wpp-control-label {
  font-size: 13px;
  color: rgba(255,255,255,0.7);
}
[data-theme="light"] .wpp-control-label { color: rgba(0,0,0,0.65); }

/* Toggle switch (matches extension's .toggle) */
.wpp-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  background: rgba(255,255,255,0.12);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.25s ease-out;
  border: none;
  padding: 0;
  flex-shrink: 0;
}
.wpp-toggle.active { background: #22c55e; }
.wpp-toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.wpp-toggle.active .wpp-toggle-knob { transform: translateX(20px); }
[data-theme="light"] .wpp-toggle { background: rgba(0,0,0,0.12); }
/* Keep the green "on" state in light theme — the rule above (equal specificity,
   later in source) was overriding the active color, so the toggle read gray. */
[data-theme="light"] .wpp-toggle.active { background: #22c55e; }

/* Sensitivity slider (matches extension) */
.wpp-slider-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.wpp-slider-label {
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  flex-shrink: 0;
}
[data-theme="light"] .wpp-slider-label { color: rgba(0,0,0,0.35); }

.wpp-slider {
  -webkit-appearance: none;
  flex: 1;
  height: 5px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  outline: none;
  transition: background 0.2s;
}
.wpp-slider:hover { background: rgba(255,255,255,0.14); }
.wpp-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 1px 6px rgba(0,0,0,0.25);
  transition: transform 0.15s ease-out;
}
.wpp-slider::-webkit-slider-thumb:hover { transform: scale(1.1); }
[data-theme="light"] .wpp-slider { background: rgba(0,0,0,0.1); }
[data-theme="light"] .wpp-slider:hover { background: rgba(0,0,0,0.14); }

/* Training hint */
.wpp-training-hint {
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  margin-top: 10px;
  line-height: 1.5;
}
[data-theme="light"] .wpp-training-hint { color: rgba(0,0,0,0.35); }

/* ───── Editor fills available vertical space ───── */
.analyzer-editor-wrap.no-results-below .analyzer-editor {
  max-height: calc(100vh - 180px);
}

/* ───── Responsive: panel on small screens ───── */
@media (max-width: 480px) {
  .app-results-panel {
    width: 100%;
  }
}

/* ═══════════════════════════════════════════════════════════
   VOICE & STYLE
   ═══════════════════════════════════════════════════════════ */

.toolbar-voice-select {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Voice match section in panel */
.voice-match-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.voice-match-score {
  font-size: 32px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  flex-shrink: 0;
}
.voice-match-desc {
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  line-height: 1.4;
}
[data-theme="light"] .voice-match-desc { color: rgba(0,0,0,0.45); }

.voice-deviations { display: flex; flex-direction: column; gap: 10px; }
.voice-dev-row { padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.04); }
.voice-dev-row:last-child { border-bottom: none; }
[data-theme="light"] .voice-dev-row { border-bottom-color: rgba(0,0,0,0.04); }
.voice-dev-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.voice-dev-label { font-size: 12px; font-weight: 500; color: rgba(255,255,255,0.7); }
[data-theme="light"] .voice-dev-label { color: rgba(0,0,0,0.65); }
.voice-dev-values { font-size: 11px; color: rgba(255,255,255,0.5); font-variant-numeric: tabular-nums; }
[data-theme="light"] .voice-dev-values { color: rgba(0,0,0,0.45); }
.voice-dev-vs { font-size: 9px; opacity: 0.5; text-transform: uppercase; letter-spacing: 0.5px; }
.voice-dev-bar-wrap { width: 100%; height: 4px; background: rgba(255,255,255,0.06); border-radius: 2px; overflow: hidden; }
[data-theme="light"] .voice-dev-bar-wrap { background: rgba(0,0,0,0.06); }
.voice-dev-bar { height: 100%; border-radius: 2px; transition: width 0.5s ease-out; }
.voice-dev-suggestion { font-size: 11px; color: rgba(255,255,255,0.4); margin-top: 4px; line-height: 1.4; }
[data-theme="light"] .voice-dev-suggestion { color: rgba(0,0,0,0.4); }

/* Training modal */
.voice-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 10000; display: flex; align-items: center; justify-content: center; padding: 24px; }
[data-theme="light"] .voice-modal-overlay { background: rgba(0,0,0,0.4); }
.voice-modal { background: var(--bg); border: 1px solid var(--border); border-radius: 16px; padding: 28px; width: 100%; max-width: 600px; max-height: 85vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.4); }
.voice-modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.voice-modal-title { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.voice-modal-close { width: 32px; height: 32px; border: none; background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.4); border-radius: 8px; cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center; transition: all 0.15s; }
.voice-modal-close:hover { background: rgba(255,255,255,0.1); color: #fff; }
[data-theme="light"] .voice-modal-close { background: rgba(0,0,0,0.05); color: rgba(0,0,0,0.4); }
.voice-modal-desc { font-size: 13px; color: var(--text-2); line-height: 1.6; margin-bottom: 20px; }
.voice-modal-samples { display: flex; flex-direction: column; gap: 16px; margin-bottom: 12px; }
.voice-sample { display: flex; flex-direction: column; gap: 6px; }
.voice-sample-header { display: flex; justify-content: space-between; align-items: center; }
.voice-sample-label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.voice-sample-wc { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.voice-sample-textarea { width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font-family: inherit; font-size: 13px; line-height: 1.6; resize: vertical; outline: none; transition: border-color 0.2s; }
.voice-sample-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.voice-sample-textarea::placeholder { color: var(--text-3); }
.voice-modal-add { background: none; border: 1px dashed var(--border); border-radius: 8px; color: var(--text-3); font-size: 13px; font-family: inherit; padding: 10px; cursor: pointer; transition: all 0.15s; width: 100%; margin-bottom: 16px; }
.voice-modal-add:hover { border-color: var(--accent); color: var(--accent); }
.voice-modal-name-row { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.voice-modal-label { font-size: 12px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.voice-modal-input { flex: 1; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font-family: inherit; font-size: 13px; outline: none; }
.voice-modal-input:focus { border-color: var(--accent); }
.voice-modal-status { font-size: 13px; font-weight: 500; margin-bottom: 12px; min-height: 20px; }
.voice-modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ═══════════════════════════════════════════════════════════
   REWRITE SPLIT VIEW
   ═══════════════════════════════════════════════════════════ */
.rewrite-panel {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  margin-top: 16px;
  overflow: hidden;
  animation: rewriteSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes rewriteSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.rewrite-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}
.rewrite-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.rewrite-voice-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 100px;
  background: rgba(99,102,241,0.12);
  color: #818cf8;
}
[data-theme="light"] .rewrite-voice-badge { color: #4f46e5; background: rgba(79,70,229,0.08); }
.rewrite-panel-actions { display: flex; gap: 8px; align-items: center; }
.rewrite-panel-actions .toolbar-btn:last-child {
  width: 32px; height: 32px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--text-3);
}

.rewrite-panel-body {
  display: flex;
  gap: 0;
  min-height: 120px;
  max-height: 350px;
  overflow-y: auto;
}
.rewrite-col {
  flex: 1;
  padding: 16px;
  min-width: 0;
}
.rewrite-col-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-3);
  margin-bottom: 10px;
}
.rewrite-col-label-new { color: #22c55e; }
[data-theme="light"] .rewrite-col-label-new { color: #16a34a; }
.rewrite-col-text {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-2);
  white-space: pre-wrap;
  word-wrap: break-word;
}
.rewrite-col:first-child .rewrite-col-text { opacity: 0.6; }
.rewrite-divider {
  width: 1px;
  background: var(--border);
  flex-shrink: 0;
}

/* Inline diff marks in the rewritten text */
.rw-added {
  background: rgba(34,197,94,0.12);
  color: #22c55e;
  border-radius: 3px;
  padding: 0 2px;
}
.rw-removed {
  background: rgba(239,68,68,0.1);
  color: #ef4444;
  text-decoration: line-through;
  border-radius: 3px;
  padding: 0 2px;
  opacity: 0.6;
}
[data-theme="light"] .rw-added { color: #16a34a; background: rgba(22,163,74,0.08); }
[data-theme="light"] .rw-removed { color: #dc2626; background: rgba(220,38,38,0.06); }

/* Chat refinement changes — purple */
.rw-chat-change {
  background: rgba(167,139,250,0.15);
  color: #a78bfa;
  border-radius: 3px;
  padding: 0 2px;
}
[data-theme="light"] .rw-chat-change { color: #7c3aed; background: rgba(124,58,237,0.08); }

.rewrite-panel-stats {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-3);
  display: flex;
  gap: 16px;
}
.rewrite-stat-item { display: flex; align-items: center; gap: 4px; }
.rewrite-stat-value { font-weight: 700; color: var(--text-2); }

/* Rewrite voice select */
.rewrite-voice-select {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 24px 4px 8px;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='%23888' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  outline: none;
}
.rewrite-voice-select:focus { border-color: var(--accent); }
[data-theme="light"] .rewrite-voice-select { background-color: var(--surface); border-color: var(--border); color: var(--text); }

.rewrite-goal-toggle {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  overflow: hidden;
  margin-left: 8px;
}

.rewrite-goal-btn {
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  background: transparent;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.rewrite-goal-btn + .rewrite-goal-btn { border-left: 1px solid var(--border-strong); }
.rewrite-goal-btn:hover { color: var(--text); }
.rewrite-goal-btn.active { background: var(--accent-light); color: var(--accent); }

/* Length preset toggle — same look as the goal toggle */
.rewrite-length-btn {
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  background: transparent;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.rewrite-length-btn + .rewrite-length-btn { border-left: 1px solid var(--border-strong); }
.rewrite-length-btn:hover { color: var(--text); }
.rewrite-length-btn.active { background: var(--accent-light); color: var(--accent); }

/* Rewrite chat */
.rewrite-chat {
  border-top: 1px solid var(--border);
  padding: 12px 16px;
}
.rewrite-chat-messages {
  max-height: 120px;
  overflow-y: auto;
  margin-bottom: 8px;
}
.rewrite-chat-msg {
  font-size: 12px;
  line-height: 1.5;
  padding: 6px 10px;
  border-radius: 8px;
  margin-bottom: 6px;
  max-width: 85%;
}
.rewrite-chat-msg.user {
  background: rgba(99,102,241,0.12);
  color: #a5b4fc;
  margin-left: auto;
  text-align: right;
}
.rewrite-chat-msg.ai {
  background: rgba(255,255,255,0.04);
  color: var(--text-2);
}
[data-theme="light"] .rewrite-chat-msg.user { background: rgba(79,70,229,0.08); color: #4f46e5; }
[data-theme="light"] .rewrite-chat-msg.ai { background: rgba(0,0,0,0.03); }

.rewrite-chat-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.rewrite-chat-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.rewrite-chat-input:focus { border-color: var(--accent); }
.rewrite-chat-input::placeholder { color: var(--text-3); }
[data-theme="light"] .rewrite-chat-input { background: var(--surface); }

.rewrite-chat-send {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--accent);
  color: #000;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.rewrite-chat-send:hover { opacity: 0.85; transform: scale(1.05); }
.rewrite-chat-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
/* Outline-style variant (transparent bg, e.g. the attach-photo button) needs
   a theme-aware icon color — the solid variant's white/black icon color is
   tuned for the accent-colored background and disappears once that
   background is removed. */
#create-image-btn { color: var(--text-2); }

/* ═══════════════════════════════════════════════════════════
   CREATE WORKSPACE — a writing coach, deliberately not Analyze's
   toolbar/mode-chipbar/export chrome with a chat panel bolted on.
   ═══════════════════════════════════════════════════════════ */
.create-shell { display: flex; flex-direction: column; gap: 16px; max-width: 1100px; margin: 0 auto; height: calc(100vh - 140px); }
.create-modebar { display: flex; gap: 6px; flex-wrap: wrap; }
.create-type-extras { display: flex; flex-direction: column; gap: 8px; margin-top: -8px; }
.create-type-extras.hidden { display: none; }
.create-body { display: flex; gap: 20px; flex: 1; min-height: 0; }
.create-write-col { flex: 1.3; display: flex; flex-direction: column; min-width: 0; }
.create-write-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.create-write-label { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.create-write-head-right { display: flex; align-items: center; gap: 12px; }
.create-write-count { font-size: 11px; color: var(--text-3); }
.create-write-score { display: flex; align-items: baseline; gap: 5px; font-size: 11px; }
.create-write-score.hidden { display: none; }
.create-score-num { font-weight: 800; font-size: 13px; }
.create-score-tier { color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; font-size: 10px; }
.create-open-editor-btn { font-size: 11px; padding: 5px 10px; gap: 4px; }
.create-flagged { margin-bottom: 12px; }
.create-flagged.hidden { display: none; }
.create-flagged-label { font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); margin-bottom: 6px; }
.create-flagged-list { display: flex; flex-direction: column; gap: 4px; }
.create-flagged-item { display: flex; align-items: center; gap: 7px; font-size: 11.5px; padding: 5px 9px; border-radius: 7px; background: var(--surface-2); cursor: pointer; transition: background 0.15s; }
.create-flagged-item:hover { background: var(--surface-3); }
.create-flagged-item .create-flagged-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.create-flagged-item .create-flagged-text { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.create-flagged-item .create-flagged-cat { color: var(--text-3); font-size: 10px; flex-shrink: 0; margin-left: auto; }
.create-signal-note { font-size: 11.5px; line-height: 1.5; color: var(--text-3); padding: 8px 10px; border-radius: 7px; background: var(--surface-2); margin-bottom: 12px; }
.create-signal-note.hidden { display: none; }
.create-write-area {
  flex: 1;
  min-height: 200px;
  padding: 20px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  overflow-y: auto;
  outline: none;
  margin-bottom: 12px;
  transition: border-color 0.2s;
}
.create-write-area:focus { border-color: var(--border-accent); }
.create-write-area:empty::before { content: attr(data-placeholder); color: var(--text-3); }
.create-coach-suggestions { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 2px 10px; }
.create-coach-suggestions:empty { display: none; }
.create-suggestion-chip {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.create-suggestion-chip:hover { border-color: var(--border-accent); color: var(--text); background: var(--accent-light); }
.create-coach-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
}
.create-coach-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.create-coach-messages { flex: 1; max-height: none; overflow-y: auto; margin-bottom: 10px; }
.create-coach-messages .rewrite-chat-msg { max-width: 92%; font-size: 13px; }
@media (max-width: 860px) {
  .create-shell { height: auto; }
  .create-body { flex-direction: column; }
  .create-write-area { min-height: 240px; }
  .create-coach-col { min-height: 320px; }
}

/* Social post panel */
.social-platform-pills {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-left: 8px;
}
.social-pill {
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: transparent;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.social-pill:hover { border-color: var(--accent); color: var(--accent); }
.social-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  font-weight: 600;
}

.social-post-body {
  padding: 0;
  min-height: 80px;
}
.social-post-content {
  padding: 20px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.social-post-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-3);
  display: flex;
  gap: 16px;
  align-items: center;
}

/* Wider panel on large screens */
@media (min-width: 1440px) {
  /* Widen the panel by bumping the SHARED token — so the reserved content margin
     always tracks the panel width. (Previously the panel widened to 420 but a
     higher-specificity sidebar-collapsed rule pinned the margin at 380, leaving
     the editor 40px under the panel.) */
  :root { --panel-w: 420px; }
}

/* ═══════════════════════════════════════════════════════════
   Live Mode indicator
   ═══════════════════════════════════════════════════════════ */
.toolbar-btn-live.active {
  background: rgba(34,197,94,0.12);
  border-color: rgba(34,197,94,0.3);
  color: #22c55e;
}
.live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #22c55e; display: inline-block;
  animation: livePulse 1.5s ease-in-out infinite;
}
.live-dot-wrap {
  display: inline-flex;
  align-items: center;
  margin-right: 2px;
}
@keyframes livePulse {
  0%, 100% { opacity: 1; } 50% { opacity: 0.3; }
}

/* ═══════════════════════════════════════════════════════════
   WORKSPACE SYSTEM — switchable full-page workspaces
   ═══════════════════════════════════════════════════════════ */
.workspace { min-height: 200px; }
.workspace.hidden { display: none !important; }
.workspace-header { margin-bottom: 20px; }
.workspace-header h2 { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 4px; }
.workspace-header p { font-size: 13px; color: var(--text-3); }
.ws-upload-area {
  border: 2px dashed var(--border);
  border-radius: 14px;
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.ws-upload-area:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

/* Live dot */
.sidebar-live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #ef4444; display: inline-block;
  opacity: 0.5;
  flex-shrink: 0;
}
/* Quiet when idle (signals the live capability), pulses only while capturing */
.sidebar-live-link.live-active .sidebar-live-dot {
  opacity: 1;
  animation: liveBlink 1.2s ease-in-out infinite;
}
@keyframes liveBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.2; } }
.sidebar-live-link { color: #ef4444 !important; }
.sidebar-live-link:hover { color: #ef4444 !important; background: rgba(239,68,68,0.06) !important; }

/* ═══════════════════════════════════════════════════════════
   LIVE WORKSPACE — full-featured live analysis tool
   ═══════════════════════════════════════════════════════════ */

.live-transcript:empty::before {
  content: 'Transcript will appear here...';
  color: var(--text-3);
  font-style: italic;
}

/* Flagged words in transcript */
.live-flag-high {
  text-decoration: underline;
  text-decoration-color: #ef4444;
  text-underline-offset: 3px;
  text-decoration-thickness: 2px;
}
.live-flag-medium {
  text-decoration: underline;
  text-decoration-color: #eab308;
  text-underline-offset: 3px;
  text-decoration-thickness: 2px;
}

/* Scores dashboard */
.live-score-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
.live-score-box {
  text-align: center;
  padding: 8px 4px;
  background: var(--surface-2);
  border-radius: 8px;
}
.live-score-num {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.2;
}
.live-score-lbl {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  margin-top: 2px;
}

/* Flagged pills */
.live-flags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
  max-height: 80px;
  overflow-y: auto;
}
.live-flag-pill {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 100px;
  border: 1px solid;
  white-space: nowrap;
}

/* Fact check section */
.live-factcheck-section {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.live-factcheck-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  margin-bottom: 6px;
}
.live-factcheck-item {
  margin-bottom: 5px;
  font-size: 11px;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 5px;
}
.live-verdict-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
  /* Fixed width so "VERIFIED" vs "UNVERIFIED" vs "MOSTLY TRUE" don't each
     push the claim text column to a different starting position row to
     row — every card's badge occupies the same width regardless of label
     length, so the text column lines up consistently. */
  min-width: 64px;
  text-align: center;
  box-sizing: border-box;
}
.live-factcheck-claim {
  color: var(--text-2);
}

.live-chat-loading {
  color: var(--text-3);
  font-style: italic;
}

/* ═══ LIVE v3 — polished ═══ */
.live-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
/* Long status messages must truncate, never crush the controls */
.live-topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}
.live-topbar-right {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  flex: 1 1 100%;
  min-width: 0;
}
/* Controls sit on their own row beneath the full-width link field, aligned right */
.live-topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}
/* Toolbar button feedback: a dim "running" state, and a green "ready" glow
   that draws the eye when a result (TL;DR, split transcript) just landed. */
.toolbar-btn.is-running { opacity: 0.6; cursor: progress; }
@keyframes btnReadyPulse {
  0%   { box-shadow: 0 0 0 0 rgba(34,197,94,0.55); }
  70%  { box-shadow: 0 0 0 7px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}
.toolbar-btn.is-ready {
  border-color: var(--green) !important;
  color: var(--green);
  animation: btnReadyPulse 1.5s ease-out 2;
}
/* Active/pressed toolbar toggle (e.g. Split speakers while it holds a result) */
.toolbar-btn.is-active {
  border-color: var(--accent) !important;
  color: var(--accent);
  background: var(--accent-light);
}
/* Guided flow: the button the user should press next radiates a pulsing gold
   halo so the order (link -> Embed -> Start) is unmistakable. A static ring was
   invisible on the already-gold accent Start button and too faint on the plain
   Embed button — the live pulse reads clearly on both. The pulse loops until
   the user acts (the class is removed on click / next step). */
@keyframes btnNextPulse {
  0%   { box-shadow: 0 0 0 0 var(--accent-glow); }
  70%  { box-shadow: 0 0 0 9px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.toolbar-btn.next-step {
  border-color: var(--accent) !important;
  animation: btnNextPulse 1.5s ease-out infinite;
}
/* A one-time flash on a primary action the moment it becomes usable (text
   added, doc uploaded, transcript ready). The inner ring is the page bg, so
   there's a visible GAP separating the amber pulse from the button — this
   reads clearly even on the gold accent button (a plain gold glow on a gold
   button is invisible). Pulses three times, then settles. */
@keyframes btnReadyFlash {
  0%   { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px rgba(245,158,11,0.9); }
  70%  { box-shadow: 0 0 0 2px var(--bg), 0 0 0 12px rgba(245,158,11,0); }
  100% { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px rgba(245,158,11,0); }
}
.toolbar-btn.btn-ready-flash {
  animation: btnReadyFlash 0.85s ease-out 3;
}
/* Persistent "ready to analyze" state: the primary button turns solid gold
   and breathes gently until you act. The !important beats the light-theme
   .toolbar-btn surface override that otherwise leaves the accent button pale. */
@keyframes btnReadyBreathe {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  50%      { box-shadow: 0 0 0 4px var(--accent-glow); }
}
.toolbar-btn.btn-ready {
  background: var(--accent) !important;
  border-color: transparent !important;
  color: #000 !important;
  animation: btnReadyBreathe 2.2s ease-in-out infinite;
}
.live-topbar-right button {
  flex-shrink: 0;
  white-space: nowrap;
}
#live-new-speaker {
  white-space: nowrap;
  flex-shrink: 0;
}
.live-timer {
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
}
.live-status {
  font-size: 12px;
  color: var(--text-3);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.live-url-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
}
.live-url-input:focus { border-color: var(--accent); }
[data-theme="light"] .live-url-input { background: var(--bg); }

.live-main {
  display: flex;
  gap: 12px;
  height: calc(100vh - 220px);
  min-height: 460px;
  max-height: 860px;
}
.live-left {
  flex: 1.2;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.live-video-area {
  position: relative;
  flex: 0 0 auto;
  height: 240px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
}
.live-video-area iframe { width: 100%; height: 100%; }
/* Playback-speed control overlaid on the embedded video. Sits on the black
   video chrome, so it's styled light-on-dark in both themes. Auto-shows/hides
   with the video area (it's a child), so it only exists when there's a video
   to speed up. */
.live-speed {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 5px;
  background: rgba(0,0,0,0.62);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
}
.live-speed-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.65);
  margin-right: 1px;
}
.live-speed-btn {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid transparent;
  background: rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.live-speed-btn:hover { background: rgba(255,255,255,0.20); }
.live-speed-btn.is-active {
  background: var(--accent);
  color: #000;
}
.live-video-hint {
  padding: 8px 12px;
  background: var(--accent-light);
  border: 1px solid var(--border-accent);
  border-radius: 8px;
  font-size: 12px;
  color: var(--accent);
  line-height: 1.5;
  text-align: center;
}
.live-transcript {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  word-wrap: break-word;
  min-height: 0;
}
.live-empty-state {
  color: var(--text-3);
  font-size: 13px;
  text-align: center;
  padding: 40px 20px;
}
.live-right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.live-scores-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-3);
}
.live-scores {
  flex: 0 0 auto;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  overflow-y: auto;
  max-height: 40vh;
  min-height: 80px;
}
.live-scores-empty {
  color: var(--text-3);
  font-size: 12px;
  text-align: center;
  padding: 20px 12px;
}
.live-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
  min-height: 0;
}
.live-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  min-height: 0;
}
.live-chat-input-row {
  display: flex;
  border-top: 1px solid var(--border);
  padding: 0;
}
.live-chat-input-row input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
  outline: none;
}
.live-chat-input-row input::placeholder { color: var(--text-3); }
.live-chat-input-row button {
  border: none;
  background: transparent;
  color: var(--accent);
  padding: 10px 14px;
  cursor: pointer;
  font-size: 16px;
  transition: opacity 0.15s;
}
.live-chat-input-row button:hover { opacity: 0.7; }
.live-chat-msg {
  font-size: 12px;
  line-height: 1.5;
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 6px;
  max-width: 88%;
  word-wrap: break-word;
}
.live-chat-msg-ai {
  background: rgba(255,255,255,0.04);
  color: var(--text-2);
  border: 1px solid var(--border);
  margin-right: auto;
}
.live-chat-msg-user {
  background: rgba(99,102,241,0.1);
  color: #a5b4fc;
  margin-left: auto;
  text-align: right;
  border: 1px solid rgba(99,102,241,0.15);
}
[data-theme="light"] .live-chat-msg-ai { background: rgba(0,0,0,0.02); }
[data-theme="light"] .live-chat-msg-user { background: rgba(79,70,229,0.06); color: #4f46e5; }

@media (max-width: 800px) {
  .live-chat-messages { max-height: 300px; }
}

/* Audio level meter */
.audio-meter {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 18px;
  padding: 0 4px;
}
.audio-meter-bar {
  width: 3px;
  min-height: 3px;
  border-radius: 1.5px;
  background: var(--green);
  transition: height 0.08s ease-out;
}

/* Live transcript paragraphs */
.live-para {
  margin-bottom: 10px;
  line-height: 1.7;
}
.live-para:last-child { margin-bottom: 0; }
/* Speaker labels in the live transcript (manual or AI-split) */
.live-speaker-label {
  display: inline-block;
  color: #818cf8;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 6px;
  margin-bottom: 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(129,140,248,0.15);
}
.live-speaker-label:first-child { margin-top: 0; }
[data-theme="light"] .live-speaker-label { color: #4f46e5; border-bottom-color: rgba(79,70,229,0.1); }
.live-timestamp {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
  background: rgba(255,255,255,0.04);
  padding: 1px 6px;
  border-radius: 4px;
  margin: 0 4px;
  vertical-align: middle;
}
[data-theme="light"] .live-timestamp { background: rgba(0,0,0,0.03); }
.live-interim {
  color: var(--text-3);
  font-style: italic;
}

/* Live slop gauge */
.live-gauge { margin-bottom: 12px; }
.live-gauge-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}
.live-gauge-track {
  position: relative;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  background: rgba(255,255,255,0.06);
}
[data-theme="light"] .live-gauge-track { background: rgba(0,0,0,0.06); }
.live-gauge-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease, background 0.3s;
}
.live-gauge-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 3px;
}

/* Live help icon + tooltip */
.live-help-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: help;
  color: var(--text-3);
  transition: color 0.15s;
}
.live-help-icon:hover, .live-help-icon:focus { color: var(--accent); }
.live-help-tooltip {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  width: 320px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
  z-index: 1000;
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.6;
}
[data-theme="light"] .live-help-tooltip {
  background: #fff;
  box-shadow: 0 12px 40px rgba(0,0,0,0.1);
}
.live-help-icon:hover .live-help-tooltip,
.live-help-icon:focus .live-help-tooltip,
.live-help-icon:focus-within .live-help-tooltip {
  display: block;
}
.live-help-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}
.live-help-section {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.live-help-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.live-help-section strong {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text);
  margin-bottom: 4px;
}
.live-help-section em {
  font-style: normal;
  font-weight: 600;
  color: var(--accent);
}

/* ═══ LIVE — responsive + collapse polish (append-last overrides) ═══ */

/* Stack the two columns below 1100px; let the video keep its shape */
@media (max-width: 1100px) {
  .live-main {
    flex-direction: column;
    height: auto;
    min-height: 0;
  }
  .live-transcript { max-height: 40vh; }
  .live-video-area {
    height: auto;
    aspect-ratio: 16 / 9;
    max-height: 340px;
  }
  .live-right-panel { min-height: 0; }
  .live-chat { min-height: 220px; }
  .live-topbar-left { flex-basis: 100%; }
  .live-topbar-actions { justify-content: flex-start; }
}

/* Minimized cards: a clean labeled strip, not clipped content */
.live-scores.live-card-min,
.live-chat.live-card-min {
  max-height: none;
  height: auto;
  min-height: 0;
  flex: 0 0 auto;
  padding: 9px 14px;
  overflow: visible;
}
.live-card-min > *:not(.live-card-collapse) { display: none !important; }
.live-card-min::before {
  content: attr(data-min-label);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-3);
}

/* Editor-page metadata slot: aligned to the document column, above the text. */
/* ═══════════ File metadata bottom sheet (editor page) ═══════════
   Opened from the toolbar Metadata button; slides up over the bottom of the
   editor, respects the sidebar + results panel, and is easily dismissed. */
.editor-meta-sheet {
  position: fixed;
  left: 200px;
  right: 0;
  bottom: 0;
  z-index: 150;
  display: flex;
  flex-direction: column;
  max-height: 42vh;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -10px 34px rgba(0,0,0,0.14);
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
.editor-meta-sheet[hidden] { display: none; }
body.sidebar-collapsed .editor-meta-sheet { left: 0; }
body.panel-open .editor-meta-sheet { right: var(--panel-w); }
.editor-meta-sheet.open { transform: translateY(0); }
.meta-sheet-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.meta-sheet-icon { color: var(--text-3); flex-shrink: 0; }
.meta-sheet-title { font-weight: 600; font-size: 12.5px; color: var(--text-2); flex-shrink: 0; }
.meta-sheet-summary { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.meta-sheet-close {
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0;
  border: none; background: none; color: var(--text-3);
  border-radius: 7px; cursor: pointer;
}
.meta-sheet-close:hover { background: var(--surface-2); color: var(--text); }
.meta-sheet-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.meta-sheet-body { padding: 12px 20px 20px; overflow-y: auto; }
@media (max-width: 768px) {
  .editor-meta-sheet { left: 0 !important; right: 0 !important; max-height: 60vh; }
}
@media (prefers-reduced-motion: reduce) { .editor-meta-sheet { transition: none; } }

/* ═══════════ File metadata / provenance card ═══════════
   Deliberately DISCRETE: a slim one-line strip that recedes (metadata is rarely
   the first thing the reader wants). It expands in place, height-capped so it
   never takes over the view. Shown on upload in Editor, Text, Image, Audio. */
.meta-card {
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  overflow: hidden;
}
.meta-card[data-flag="warn"] { border-color: rgba(234,179,8,0.5); }
.meta-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  text-align: left;
  font: inherit;
}
.meta-head:hover { background: var(--surface-2); }
.meta-icon { color: var(--text-3); flex-shrink: 0; width: 14px; height: 14px; }
.meta-head-text { display: flex; align-items: baseline; gap: 8px; min-width: 0; flex: 1; }
.meta-title { font-weight: 600; font-size: 12px; color: var(--text-2); flex-shrink: 0; }
.meta-summary { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta-chev { color: var(--text-3); flex-shrink: 0; transition: transform 0.2s; }
.meta-open .meta-chev { transform: rotate(180deg); }
.meta-body { padding: 10px 14px 14px; max-height: 300px; overflow-y: auto; border-top: 1px solid var(--border); }
.meta-body.hidden { display: none; }
.meta-flags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.meta-flag { font-size: 11px; padding: 3px 8px; border-radius: 20px; line-height: 1.35; }
.meta-flag-warn { background: rgba(234,179,8,0.14); color: #a16207; border: 1px solid rgba(234,179,8,0.35); }
[data-theme="dark"] .meta-flag-warn { color: #fbbf24; }
.meta-flag-info { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.meta-flag-good { background: rgba(34,197,94,0.12); color: #16a34a; border: 1px solid rgba(34,197,94,0.3); }
.meta-group { margin-top: 10px; }
.meta-group-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  font-weight: 600;
  margin-bottom: 3px;
}
.meta-row {
  display: flex;
  gap: 12px;
  padding: 3px 0;
  border-bottom: 1px solid var(--border);
  align-items: baseline;
}
.meta-row:last-child { border-bottom: none; }
.meta-label { flex: 0 0 34%; color: var(--text-3); font-size: 12px; }
.meta-value { flex: 1; min-width: 0; color: var(--text); font-size: 12px; word-break: break-word; }
.meta-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.meta-link { color: var(--accent); text-decoration: underline; }
.meta-actions { margin-top: 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.meta-strip-btn {
  font-size: 11px;
  padding: 5px 11px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.meta-strip-btn:hover { border-color: var(--accent); color: var(--accent); }
.meta-strip-btn:disabled { opacity: 0.6; cursor: default; }
.meta-strip-note { font-size: 10px; color: var(--text-3); }
