/* ============================================================================
   SnapDub design system - matches design_handoff_snapdub
   Light canvas (#fafafa), white surfaces, Deep Crimson accent (#C81E3A),
   Inter (UI) + Geist Mono (labels/numerals). Componentized via class names.
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Geist+Mono:wght@400;500;600&family=Inter:wght@400;450;500;600;700;800&display=swap');

:root {
  /* Surfaces */
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f4f4f5;

  /* Hairlines */
  --line: #ececee;
  --line-strong: #e4e4e7;
  --divider: #f4f4f5;

  /* Text */
  --ink: #18181b;
  --ink-soft: #3f3f46;
  --ink-2: #52525b;
  --ink-3: #71717a;
  --muted: #a1a1aa;

  /* Brand - Deep Crimson */
  --primary: #C81E3A;
  --primary-hover: #a8182f;
  --primary-tint: rgba(200, 30, 58, 0.12);

  /* Status */
  --st-pending: #71717a;
  --st-blue: #2563eb;     --st-blue-bg: #eaeef7;
  --st-purple: #7c3aed;   --st-purple-bg: #f1ebfb;
  --st-orange: #ea580c;   --st-orange-bg: #fbeee4;
  --st-green: #15803d;    --st-green-bg: #edf7ef;  --st-green-line: #cfe9d6;
  --st-red: #b42318;      --st-red-bg: #fbedec;    --st-red-line: #f1d3d1;

  /* Radius */
  --r-pill: 6px;
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;

  /* Shadow */
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-elevated: 0 24px 60px -20px rgba(24, 24, 27, 0.18);
  --shadow-primary: 0 1px 2px rgba(200, 30, 58, 0.25);

  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, monospace;

  --sidebar-w: 264px;
  --z-sidebar: 40;
  --z-toast: 1000;
}

/* ---- Reset / base ---------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: -0.01em;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
img, svg, video { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: var(--r-sm); }
::selection { background: var(--primary-tint); }

/* Scrollbar (matches handoff) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d4d4d8; border-radius: 8px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: padding-box; }

/* ---- Typography ------------------------------------------------------------ */
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.1; letter-spacing: -0.03em; }
h1 { font-size: 25px; }
h2 { font-size: 38px; letter-spacing: -0.04em; }
h3 { font-size: 16px; }
p { margin: 0 0 16px; color: var(--ink-2); }

.eyebrow {
  font-family: var(--font-mono); font-size: 11.5px; font-weight: 500;
  letter-spacing: 0.05em; text-transform: uppercase; color: var(--primary);
}
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.text-dim { color: var(--ink-2); }
.text-muted { color: var(--muted); }

/* ---- Layout utilities ------------------------------------------------------ */
.container { width: 100%; max-width: 980px; margin-inline: auto; padding-inline: 40px; }
.stack > * + * { margin-top: 16px; }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.grid-cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

/* ---- Brand mark ------------------------------------------------------------ */
.brand-mark {
  width: 28px; height: 28px; border-radius: 7px; flex-shrink: 0;
  background: var(--primary); color: #fff;
  display: grid; place-items: center;
}
.brand-mark svg { width: 16px; height: 16px; }
.brand-word { font-size: 16px; font-weight: 600; letter-spacing: -0.03em; }
.brand-tag {
  font-family: var(--font-mono); font-size: 10px; font-weight: 500; color: var(--muted);
  border: 1px solid var(--line-strong); border-radius: 4px; padding: 2px 5px;
}

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

.sidebar {
  position: sticky; top: 0; align-self: flex-start;
  width: var(--sidebar-w); flex-shrink: 0; height: 100dvh; z-index: var(--z-sidebar);
  display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--line);
  padding: 20px 16px;
}
.sidebar__brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; }
.sidebar__brand .brand-tag { margin-left: auto; }
.sidebar__section { font-family: var(--font-mono); font-size: 10px; font-weight: 500; letter-spacing: 0.06em; color: var(--muted); text-transform: uppercase; padding: 0 8px 8px; }
.sidebar__nav { display: flex; flex-direction: column; gap: 2px; margin-top: 22px; }
.sidebar__spacer { flex: 1; }

.nav-item {
  display: flex; align-items: center; gap: 11px;
  height: 36px; padding: 0 9px; border-radius: 7px;
  font-size: 13.5px; font-weight: 450; color: var(--ink-2);
  transition: background 140ms ease, color 140ms ease;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item svg { width: 17px; height: 17px; flex: none; }
.nav-item.is-active { background: var(--surface-2); color: var(--ink); font-weight: 600; }
.nav-item.is-active svg { color: var(--primary); }
.nav-item__badge { margin-left: auto; font-family: var(--font-mono); font-size: 11px; font-weight: 500; color: var(--muted); }

/* Balance card (sidebar) */
.balance-card { border: 1px solid var(--line); border-radius: var(--r-md); padding: 13px 14px; margin-bottom: 12px; background: var(--bg); }
.balance-card__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; font-size: 12px; font-weight: 500; color: var(--ink-2); }
.balance-card__value { display: flex; align-items: baseline; gap: 5px; margin-bottom: 9px; }
.balance-card__value b { font-family: var(--font-mono); font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.balance-card__value span { font-size: 12px; color: var(--ink-3); }

/* Profile snippet */
.account { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r-sm); width: 100%; text-align: left; background: none; border: none; }
.account:hover { background: var(--surface-2); }
.account__meta { min-width: 0; flex: 1; }
.account__name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account__sub { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account svg { width: 15px; height: 15px; color: var(--muted); flex: none; }

.avatar { width: 32px; height: 32px; flex: none; border-radius: var(--r-sm); background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 600; }

/* Main column */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: 57px; flex-shrink: 0;
  display: flex; align-items: center; gap: 16px; padding: 0 26px;
  background: rgba(255,255,255,0.8); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.breadcrumb span.sep { color: #d4d4d8; display: flex; }
.breadcrumb svg { width: 14px; height: 14px; color: #d4d4d8; }
.breadcrumb .crumb-muted { color: var(--muted); }
.breadcrumb .crumb-current { font-weight: 500; }
.content { padding: 28px 26px 40px; flex: 1; }

.menu-btn { display: none; }

/* ---- Buttons --------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px;
  font-family: var(--font-sans); font-size: 13px; font-weight: 600;
  border: 1px solid transparent; border-radius: var(--r-sm);
  transition: background 140ms ease, border-color 140ms ease, filter 140ms ease;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn--primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-primary); }
.btn--primary:hover { background: var(--primary-hover); }
.btn--dark { background: var(--ink); color: #fff; }
.btn--dark:hover { background: #000; }
.btn--ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); font-weight: 500; }
.btn--ghost:hover { background: var(--surface-2); }
.btn--subtle { background: var(--surface-2); color: var(--ink); font-weight: 500; }
.btn--subtle:hover { background: #e9e9eb; }
.btn--danger { background: var(--st-red-bg); color: var(--st-red); border-color: var(--st-red-line); }
.btn--danger:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn--block { width: 100%; }
.btn--lg { height: 46px; padding: 0 22px; font-size: 15px; border-radius: var(--r-md); }
.btn[disabled], .btn.is-loading { opacity: 0.55; pointer-events: none; }

/* ---- Surfaces -------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-card); }
.card__body { padding: 22px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 26px 24px; box-shadow: var(--shadow-card); }

.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; box-shadow: var(--shadow-card); }
.stat__label { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.stat__value { font-family: var(--font-mono); font-size: 26px; font-weight: 600; letter-spacing: -0.02em; margin-top: 4px; }

/* ---- StatusBadge (reusable) ------------------------------------------------ */
.status { position: relative; min-width: 160px; font-size: 11.5px; }
.status__pill { display: inline-flex; align-items: center; gap: 6px; height: 25px; padding: 0 10px; border-radius: var(--r-pill); font-weight: 600; }
.status__pill svg { width: 13px; height: 13px; }
.status__pill.is-pending { background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--ink-2); font-weight: 500; }
.status__pill.is-completed { background: var(--st-green-bg); border: 1px solid var(--st-green-line); color: var(--st-green); }
.status__pill.is-completed svg { color: #16a34a; }
.status__pill.is-failed { background: var(--st-red-bg); border: 1px solid var(--st-red-line); color: var(--st-red); cursor: default; }
.status__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--st-pending); animation: blink 1.4s ease-in-out infinite; }
.status__info { width: 12px; height: 12px; color: #d99; }

.status__progress .status__row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.status__label { font-size: 11.5px; font-weight: 500; }
.status__pct { font-family: var(--font-mono); font-size: 10.5px; }
.status__bar { height: 5px; border-radius: 3px; overflow: hidden; position: relative; }
.status__bar > i { display: block; height: 100%; border-radius: 3px; }
.status__bar--indet > i { position: absolute; top: 0; width: 42%; animation: indet 1.3s ease-in-out infinite; }

.status--transcribing .status__label { color: var(--st-blue); }
.status--transcribing .status__bar { background: var(--st-blue-bg); }
.status--transcribing .status__bar > i { background: var(--st-blue); }
.status--matching .status__label { color: var(--st-purple); }
.status--matching .status__bar { background: var(--st-purple-bg); }
.status--matching .status__bar > i { background: var(--st-purple); }
.status--lipsync .status__label { color: var(--st-orange); }
.status--lipsync .status__bar { background: var(--st-orange-bg); }
.status--lipsync .status__bar > i { background: var(--st-orange); }

.status__tip { display: none; position: absolute; top: 30px; left: 0; z-index: 20; width: 230px; background: var(--ink); color: var(--bg); font-size: 11.5px; line-height: 1.5; padding: 9px 11px; border-radius: var(--r-sm); box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.status__pill.is-failed:hover + .status__tip,
.status__pill.is-failed:focus + .status__tip { display: block; }

@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.2; } }
@keyframes indet { 0% { left: -42%; } 100% { left: 100%; } }
@keyframes pulseDot { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

/* Simple badge (counts / tags) */
.badge { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: 11px; font-weight: 500; color: var(--muted); background: var(--bg); border-radius: 5px; padding: 1px 6px; }
.badge--active { color: var(--ink); background: var(--surface-2); }

/* Progress bar (generic) */
.progress { height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; }
.progress__bar { height: 100%; background: var(--primary); border-radius: 3px; transition: width 400ms ease; }

/* ---- Forms ----------------------------------------------------------------- */
.field { display: block; margin-bottom: 16px; }
.field__label { display: block; font-size: 13px; font-weight: 500; color: var(--ink); margin-bottom: 6px; }
.field__label .req { color: var(--primary); }
.input, .textarea, select.input {
  width: 100%; height: 40px; padding: 0 12px;
  font: inherit; font-size: 13.5px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  outline: none; transition: border-color 140ms ease, box-shadow 140ms ease;
}
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.input:focus, .textarea:focus, select.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.textarea { height: auto; min-height: 120px; padding: 11px 12px; resize: vertical; line-height: 1.5; }
.check { display: flex; align-items: flex-start; gap: 10px; padding: 7px 0; font-size: 13.5px; color: var(--ink); cursor: pointer; }
.check input { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--primary); flex: none; }
.check input:disabled { opacity: .5; }
.check span { line-height: 1.45; }
.field__error { color: var(--st-red); font-size: 12.5px; margin-top: 6px; }
.field__hint { color: var(--muted); font-size: 12.5px; margin-top: 6px; }

.error-summary { background: var(--st-red-bg); border: 1px solid var(--st-red-line); border-radius: var(--r-sm); padding: 12px 14px; margin-bottom: 16px; color: var(--st-red); font-size: 13px; }
.error-summary ul { margin: 6px 0 0; padding-left: 18px; }

/* ---- Toasts ---------------------------------------------------------------- */
.toast-stack { position: fixed; right: 24px; bottom: 24px; z-index: var(--z-toast); display: flex; flex-direction: column; gap: 10px; width: min(360px, calc(100vw - 32px)); }
.toast { display: flex; gap: 11px; align-items: flex-start; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line-strong); border-left: 3px solid var(--muted); border-radius: var(--r-sm); box-shadow: var(--shadow-elevated); animation: toast-in 240ms cubic-bezier(.2,.8,.2,1); }
.toast.is-leaving { animation: toast-out 180ms ease forwards; }
.toast--success { border-left-color: #16a34a; }
.toast--error { border-left-color: var(--primary); }
.toast--info { border-left-color: var(--st-blue); }
.toast__icon { flex: none; margin-top: 1px; }
.toast--success .toast__icon { color: #16a34a; }
.toast--error .toast__icon { color: var(--primary); }
.toast__title { font-weight: 600; font-size: 13px; }
.toast__body { color: var(--ink-2); font-size: 12.5px; }
.toast__close { margin-left: auto; background: none; border: none; color: var(--muted); padding: 2px; }
.toast__close:hover { color: var(--ink); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }

/* ---- Empty state ----------------------------------------------------------- */
.empty { text-align: center; padding: 56px 24px; border: 1px dashed var(--line-strong); border-radius: var(--r-lg); background: var(--surface); }
.empty__icon { width: 44px; height: 44px; margin: 0 auto 16px; color: var(--muted); }
.empty h3 { font-size: 16px; }

/* ---- Library table --------------------------------------------------------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 22px; gap: 16px; }
.page-head h1 { margin-bottom: 5px; }
.page-head p { font-size: 13.5px; color: var(--ink-3); margin: 0; }

.tabs { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.tab { display: flex; align-items: center; gap: 7px; height: 38px; padding: 0 12px; background: none; border: none; border-bottom: 2px solid transparent; font-size: 13px; font-weight: 450; color: var(--ink-3); margin-bottom: -1px; }
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }

.lib-cols, .lib-row { display: grid; grid-template-columns: 1fr 120px 150px 200px 44px; gap: 16px; align-items: center; }
.lib-cols { padding: 14px 16px 10px; font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
/* overflow visible so row dropdown menus aren't clipped; corners rounded on end rows */
.lib-table { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.lib-row { padding: 13px 16px; border-top: 1px solid var(--divider); transition: background 120ms ease; }
.lib-row:first-child { border-top: none; border-radius: var(--r-lg) var(--r-lg) 0 0; }
.lib-row:last-child { border-radius: 0 0 var(--r-lg) var(--r-lg); }
.lib-row:only-child { border-radius: var(--r-lg); }

/* Dropdown menu */
.menu { position: relative; justify-self: end; }
.menu__panel {
  position: absolute; right: 0; top: 34px; z-index: 50; min-width: 150px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  box-shadow: var(--shadow-elevated); padding: 5px; display: flex; flex-direction: column;
}
.menu__panel[hidden] { display: none; } /* [hidden] must beat the display:flex above */
.menu__item {
  display: flex; align-items: center; width: 100%; text-align: left;
  padding: 8px 10px; border: none; background: none; border-radius: var(--r-pill);
  font-size: 13px; color: var(--ink); cursor: pointer;
}
.menu__item:hover { background: var(--surface-2); }
.menu__item--danger { color: var(--st-red); }
.menu__item--danger:hover { background: var(--st-red-bg); }
.menu form { margin: 0; }

/* Confirmation modal (native <dialog>) */
.modal {
  border: none; padding: 0; background: var(--surface); color: var(--ink);
  border-radius: var(--r-lg); box-shadow: var(--shadow-elevated);
  max-width: 380px; width: calc(100vw - 40px);
}
.modal::backdrop { background: rgba(24, 24, 27, 0.45); backdrop-filter: blur(2px); }
.modal__card { padding: 22px; display: flex; flex-direction: column; }
.modal__title { font-size: 16px; margin-bottom: 6px; }
.modal__message { color: var(--ink-2); font-size: 13.5px; margin: 0; }
.modal__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.lib-row:hover { background: var(--bg); }
.lib-row a.lib-video { display: flex; align-items: center; gap: 13px; min-width: 0; color: inherit; }
.lib-thumb { position: relative; width: 74px; height: 46px; border-radius: var(--r-pill); border: 1px solid var(--line-strong); flex-shrink: 0; background: repeating-linear-gradient(135deg,#f4f4f5,#f4f4f5 6px,#eaeaec 6px,#eaeaec 12px); display: flex; align-items: flex-end; justify-content: flex-end; padding: 4px; }
.lib-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.lib-thumb__dur { position: relative; font-family: var(--font-mono); font-size: 8.5px; color: var(--ink); background: rgba(255,255,255,.87); border-radius: 3px; padding: 1px 4px; }
.lib-title { font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 3px; }
.lib-meta { font-size: 11.5px; color: var(--muted); font-family: var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-dur { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-2); }
.lib-langs { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 500; color: var(--ink-soft); }
.lib-langs .mono { font-family: var(--font-mono); }
.lib-langs svg { width: 13px; height: 13px; color: #c4c4c8; }
.lib-actions { width: 30px; height: 30px; border: none; background: none; border-radius: 7px; display: grid; place-items: center; color: var(--muted); justify-self: end; }
.lib-actions:hover { background: var(--surface-2); color: var(--ink); }

/* ---- Clip card (inline player) --------------------------------------------- */
.clip-card { overflow: hidden; }
.clip-card__stage { position: relative; aspect-ratio: 9 / 16; background: var(--ink); display: flex; }
/* contain keeps the true 9:16 aspect in the card AND in native fullscreen (no stretch) */
.clip-card__media { width: 100%; height: 100%; object-fit: contain; display: block; background: var(--ink); }
.clip-card__placeholder { width: 100%; height: 100%; display: grid; place-items: center; color: var(--muted); }
.clip-card__tag, .clip-card__score { z-index: 2; }

/* ---- Contact chat widget (bottom-left) ------------------------------------- */
.chat-widget { position: fixed; left: 24px; bottom: 24px; z-index: 900; }
.chat-widget__btn {
  list-style: none; cursor: pointer; width: 52px; height: 52px; border-radius: 50%;
  background: var(--primary); color: #fff; display: grid; place-items: center;
  box-shadow: 0 8px 24px rgba(200,30,58,.35); transition: transform 140ms ease, background 140ms ease;
}
.chat-widget__btn::-webkit-details-marker { display: none; }
.chat-widget__btn:hover { background: var(--primary-hover); transform: translateY(-2px); }
.chat-widget[open] .chat-widget__btn { background: var(--ink); box-shadow: var(--shadow-elevated); }
.chat-widget__panel {
  position: absolute; left: 0; bottom: 64px; width: min(320px, calc(100vw - 48px));
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  box-shadow: var(--shadow-elevated); padding: 18px;
  animation: toast-in 200ms cubic-bezier(.2,.8,.2,1);
}
.chat-widget__head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.chat-widget__title { font-weight: 600; font-size: 14px; }
.chat-widget__sub { font-size: 11.5px; color: var(--muted); }
.chat-widget__text { font-size: 13px; color: var(--ink-2); line-height: 1.5; margin: 0 0 14px; }

/* ---- Marketing / landing --------------------------------------------------- */
.marketing { display: flex; flex-direction: column; min-height: 100dvh; }
.marketing-nav { position: sticky; top: 0; z-index: 50; height: 62px; display: flex; align-items: center; gap: 4px; padding: 0 40px; background: rgba(250,250,250,.8); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.marketing-nav__brand { display: flex; align-items: center; gap: 9px; }
.marketing-nav__brand .brand-mark { width: 26px; height: 26px; }
.marketing-nav__links { display: flex; align-items: center; gap: 4px; margin-left: 36px; }
.marketing-nav__links a { font-size: 13.5px; color: var(--ink-2); padding: 6px 11px; border-radius: 7px; }
.marketing-nav__links a:hover { background: #f0f0f1; color: var(--ink); }
.marketing-nav__spacer { flex: 1; }
.marketing-nav__cta { display: flex; align-items: center; gap: 10px; }
.marketing-nav__cta a.signin { font-size: 13.5px; font-weight: 500; color: var(--ink); padding: 8px 12px; }

.hero { position: relative; padding: 88px 40px 56px; background-image: radial-gradient(var(--line-strong) 1px, transparent 1px); background-size: 22px 22px; background-position: center top; }
.hero__fade { position: absolute; inset: 0; background: linear-gradient(to bottom, transparent, var(--bg) 78%); pointer-events: none; }
.hero__inner { position: relative; max-width: 880px; margin: 0 auto; text-align: center; }
.hero__pill { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 11.5px; font-weight: 500; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 6px 13px; margin-bottom: 26px; }
.hero__pill .dot { width: 6px; height: 6px; border-radius: 50%; background: #16a34a; animation: pulseDot 2s ease-in-out infinite; }
.hero h1 { font-size: 62px; line-height: 1.02; font-weight: 700; letter-spacing: -0.045em; margin-bottom: 22px; text-wrap: balance; }
.hero__sub { font-size: 18px; line-height: 1.55; color: var(--ink-2); max-width: 600px; margin: 0 auto 34px; }
.hero__cta { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.hero__micro { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }

/* Before/After player */
.player { position: relative; max-width: 880px; margin: 54px auto 0; }
.player__frame { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-elevated); overflow: hidden; }
.player__bar { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 16px; border-bottom: 1px solid var(--divider); }
.player__dots { display: flex; gap: 6px; }
.player__dots span { width: 11px; height: 11px; border-radius: 50%; }
.player__file { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }
.player__toggle { margin-left: auto; display: flex; background: var(--surface-2); border-radius: 9px; padding: 3px; gap: 2px; }
.player__toggle button { height: 30px; padding: 0 14px; border: none; border-radius: 7px; font-size: 12.5px; font-weight: 450; color: var(--ink-3); background: transparent; }
.player__toggle button[aria-pressed="true"] { color: var(--ink); font-weight: 600; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.player__stage { position: relative; height: 430px; background: var(--ink); display: flex; align-items: center; justify-content: center; gap: 34px; overflow: hidden; }
.player__layer { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 34px; transition: opacity .45s ease, transform .45s ease; }
.player__layer[hidden] { display: flex; opacity: 0; transform: scale(.96); pointer-events: none; }
.player__16x9 { position: relative; width: 620px; height: 349px; border-radius: 10px; background: repeating-linear-gradient(135deg,#2a2a2e,#2a2a2e 9px,#242427 9px,#242427 18px); display: flex; align-items: center; justify-content: center; }
.player__9x16 { position: relative; width: 218px; height: 388px; border-radius: var(--r-lg); background: repeating-linear-gradient(135deg,#2a2a2e,#2a2a2e 9px,#242427 9px,#242427 18px); border: 1px solid #3f3f46; flex-shrink: 0; }
.player__play { width: 54px; height: 54px; border-radius: 50%; background: rgba(255,255,255,.9); display: grid; place-items: center; }
.player__play svg { color: var(--ink); margin-left: 3px; }
.player__play--sm { width: 46px; height: 46px; position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); }
.player__cap { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); font-size: 15px; font-weight: 600; color: #fff; background: rgba(0,0,0,.5); padding: 6px 14px; border-radius: var(--r-sm); white-space: nowrap; }
.player__cap--es { bottom: 16px; left: 12px; right: 12px; transform: none; text-align: center; white-space: normal; font-size: 13.5px; font-weight: 700; background: none; text-shadow: 0 2px 4px rgba(0,0,0,.5); padding: 0; line-height: 1.3; }
.player__tag { position: absolute; top: 10px; left: 10px; font-family: var(--font-mono); font-size: 9.5px; color: #fff; background: var(--primary); border-radius: 5px; padding: 3px 6px; }
.player__src-tag { position: absolute; top: 12px; left: 12px; font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); background: rgba(0,0,0,.4); border-radius: 5px; padding: 3px 7px; }
.player__score { position: absolute; top: 10px; right: 10px; display: flex; align-items: center; gap: 5px; background: rgba(0,0,0,.5); border-radius: 6px; padding: 3px 7px; font-family: var(--font-mono); font-size: 11px; font-weight: 600; color: #fff; }
.player__score svg { width: 12px; height: 12px; color: var(--st-orange); }
.player__chips { display: flex; flex-direction: column; gap: 11px; align-items: flex-end; }
.player__chip { display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 9px; padding: 8px 12px; box-shadow: 0 6px 18px rgba(0,0,0,.25); font-size: 12.5px; font-weight: 500; }
.player__chip svg { width: 15px; height: 15px; }

/* Pricing */
.section-head { max-width: 980px; margin: 0 auto 42px; text-align: center; }
.section-head .eyebrow { display: block; margin-bottom: 12px; }
.section-head h2 { margin-bottom: 12px; }
.section-head p { font-size: 16px; color: var(--ink-2); margin: 0; }
.pricing-grid { max-width: 980px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; align-items: start; }

.pricing-card { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 26px 24px; box-shadow: var(--shadow-card); }
.pricing-card.is-highlighted { border-color: var(--primary); box-shadow: 0 12px 32px rgba(200,30,58,.12); }
.pricing-card__badge { position: absolute; top: -11px; left: 24px; font-family: var(--font-mono); font-size: 10px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: #fff; background: var(--primary); border-radius: var(--r-pill); padding: 4px 9px; }
.pricing-card__name { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.pricing-card__blurb { font-size: 12.5px; color: var(--ink-3); line-height: 1.45; margin-bottom: 18px; min-height: 36px; }
.pricing-card__price { display: flex; align-items: baseline; gap: 4px; margin-bottom: 20px; }
.pricing-card__price b { font-family: var(--font-mono); font-size: 34px; font-weight: 600; letter-spacing: -0.03em; }
.pricing-card__price span { font-size: 13px; color: var(--muted); }
.pricing-card__cta { display: inline-flex; align-items: center; justify-content: center; width: 100%; height: 40px; border-radius: 9px; font-size: 13.5px; font-weight: 600; margin-bottom: 22px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); }
.pricing-card.is-highlighted .pricing-card__cta { background: var(--primary); color: #fff; border-color: var(--primary); }
.pricing-card__cta:hover { filter: brightness(0.97); }
.pricing-card__features { display: flex; flex-direction: column; gap: 11px; }
.pricing-card__feature { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; color: var(--ink-soft); line-height: 1.4; }
.pricing-card__feature svg { width: 15px; height: 15px; color: var(--primary); flex-shrink: 0; margin-top: 1px; }

.notice { max-width: 980px; margin: 24px auto 0; display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 18px; font-size: 13px; color: var(--ink-soft); line-height: 1.45; }
.notice svg { width: 18px; height: 18px; color: #16a34a; flex-shrink: 0; }

/* Non-blocking "confirm your email" reminder */
.confirm-banner { display: flex; align-items: center; gap: 12px; margin: 0 0 20px; padding: 11px 14px; background: var(--st-orange-bg); border: 1px solid #f3d9c4; border-radius: var(--r-md); font-size: 13px; line-height: 1.45; color: #7c3a12; }
.confirm-banner__icon { display: inline-flex; }
.confirm-banner__icon svg { width: 16px; height: 16px; color: var(--st-orange); flex-shrink: 0; }
.confirm-banner__text { margin: 0; flex: 1; }
.confirm-banner__action { flex-shrink: 0; background: transparent; border: 1px solid #e6bd97; color: #7c3a12; padding: 5px 12px; border-radius: var(--r-pill); font-size: 12px; font-weight: 600; cursor: pointer; }
.confirm-banner__action:hover { background: #fff; border-color: var(--st-orange); color: var(--st-orange); }

.cta-band { max-width: 980px; margin: 50px auto; text-align: center; padding: 56px 40px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-card); }
.cta-band h2 { margin: 0 0 10px; }
.cta-band p { max-width: 520px; margin: 0 auto 24px; color: var(--ink-2); }

/* Landing: how-it-works steps + feature grid + FAQ */
.steps { max-width: 980px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; box-shadow: var(--shadow-card); }
.step__num { font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--primary); }
.step h3 { font-size: 14.5px; margin: 8px 0 6px; }
.step p { font-size: 12.5px; color: var(--ink-2); line-height: 1.5; margin: 0; }

.feature-grid { max-width: 980px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; box-shadow: var(--shadow-card); }
.feature__icon { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--primary-tint); color: var(--primary); margin-bottom: 14px; }
.feature h3 { font-size: 15px; margin: 0 0 6px; }
.feature p { font-size: 13px; color: var(--ink-2); line-height: 1.5; margin: 0; }

.faq { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.faq__item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 18px 20px; }
.faq__item h3 { font-size: 14px; margin: 0 0 6px; }
.faq__item p { font-size: 13px; color: var(--ink-2); line-height: 1.55; margin: 0; }

@media (max-width: 860px) { .feature-grid, .steps { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .feature-grid, .steps { grid-template-columns: 1fr; } }

.marketing-footer { margin-top: 50px; border-top: 1px solid var(--line); padding: 30px 40px; }
.marketing-footer .container { display: flex; align-items: center; gap: 10px; max-width: 1360px; }
.marketing-footer .brand-mark { width: 22px; height: 22px; }
.marketing-footer .copy { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); margin-left: 8px; }
.marketing-footer__links { margin-left: auto; display: flex; gap: 18px; font-size: 12.5px; }
.marketing-footer__links a { color: var(--ink-3); }
.marketing-footer__links a:hover { color: var(--ink); }

/* ---- Auth ------------------------------------------------------------------ */
.auth-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(420px, 100%); }
.auth-head { text-align: center; margin-bottom: 24px; }
.auth-head .brand-mark { margin: 0 auto 14px; }
.auth-head h2 { font-size: 24px; }
.auth-head p { margin: 6px 0 0; }
.auth-foot { text-align: center; margin-top: 16px; color: var(--ink-3); font-size: 13px; }
.auth-foot a { color: var(--primary); font-weight: 500; }
.auth-row { display: flex; align-items: center; justify-content: space-between; margin: -4px 0 16px; font-size: 13px; }
.auth-row .checkbox { display: flex; align-items: center; gap: 8px; color: var(--ink-2); cursor: pointer; user-select: none; }
.auth-row .checkbox input { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }
.auth-link { color: var(--primary); font-weight: 500; }

/* Per-option credit cost chip on the upload form */
.check__cost { display: inline-block; margin-left: 6px; font-family: var(--font-mono); font-size: 11px; font-weight: 500; color: var(--primary); background: var(--primary-tint); border-radius: var(--r-pill); padding: 1px 7px; }

/* Billing monthly/annual toggle */
.interval-toggle { display: inline-flex; background: var(--surface-2); border-radius: 9px; padding: 3px; gap: 2px; }
.interval-toggle button { height: 32px; padding: 0 14px; border: none; border-radius: 7px; font-size: 12.5px; font-weight: 450; color: var(--ink-3); background: transparent; cursor: pointer; }
.interval-toggle button[aria-pressed="true"] { color: var(--ink); font-weight: 600; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.pricing-card__save { font-size: 11.5px; font-weight: 600; color: var(--primary); margin: -14px 0 16px; }

/* Out-of-credits modal */
.credits-modal { position: fixed; inset: 0; z-index: 1100; display: grid; place-items: center; padding: 20px; background: rgba(24,24,27,0.45); animation: cm-fade .18s ease-out; }
.credits-modal__card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-elevated); padding: 28px 26px; text-align: center; }
.credits-modal__icon { display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; background: var(--primary-tint); color: var(--primary); margin-bottom: 14px; }
.credits-modal__card h3 { font-size: 18px; margin: 0 0 8px; }
.credits-modal__card p { font-size: 14px; color: var(--ink-2); line-height: 1.55; margin: 0 0 20px; }
.credits-modal__actions { display: flex; gap: 10px; justify-content: center; }
.credits-modal__dismiss { display: inline-block; margin-top: 14px; font-size: 13px; color: var(--ink-3); }
@keyframes cm-fade { from { opacity: 0; } to { opacity: 1; } }

/* Cookie consent banner */
.cookie-consent {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  z-index: 1000; width: min(680px, calc(100vw - 32px));
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  box-shadow: var(--shadow-elevated); padding: 14px 18px;
  animation: cookie-rise 0.28s ease-out;
}
.cookie-consent__text { flex: 1; min-width: 220px; font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.cookie-consent__text a { color: var(--primary); font-weight: 500; }
.cookie-consent__actions { display: flex; gap: 10px; margin-left: auto; }
.cookie-consent__actions .btn { height: 34px; padding: 0 16px; font-size: 13px; }
.cookie-consent.is-leaving { opacity: 0; transform: translateX(-50%) translateY(8px); transition: opacity .2s, transform .2s; }
@keyframes cookie-rise { from { opacity: 0; transform: translateX(-50%) translateY(12px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@media (max-width: 520px) { .cookie-consent__actions { width: 100%; } .cookie-consent__actions .btn { flex: 1; } }

/* ---- Prose / legal --------------------------------------------------------- */
.prose { max-width: 720px; margin-inline: auto; padding: 48px 0; }
.prose h1 { font-size: 32px; }
.prose h2 { font-size: 20px; margin: 28px 0 12px; }
.prose p, .prose li { color: var(--ink-2); }
.prose ul { padding-left: 22px; }

/* ---- Settings -------------------------------------------------------------- */
.settings-grid { display: grid; gap: 24px; grid-template-columns: 1fr; max-width: 720px; }

/* ---- Upload dropzone ------------------------------------------------------- */
.upload-drop { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 48px 24px; text-align: center; cursor: pointer; border: 1px dashed var(--line-strong); border-radius: var(--r-lg); background: var(--bg); color: var(--ink-3); transition: border-color 140ms ease, background 140ms ease; }
.upload-drop:hover { border-color: var(--primary); background: var(--surface); }
.upload-drop svg { color: var(--primary); }
.upload-drop__hint { color: var(--ink); font-weight: 500; }
.upload-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---- Responsive ------------------------------------------------------------ */
@media (max-width: 900px) {
  .shell { display: block; }
  .sidebar { position: fixed; inset: 0 auto 0 0; transform: translateX(-100%); transition: transform 220ms ease; box-shadow: var(--shadow-elevated); }
  .sidebar.is-open { transform: none; }
  .menu-btn { display: inline-flex; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; }
  .hero h1 { font-size: 40px; }
  .container { padding-inline: 20px; }
  .pricing-grid { grid-template-columns: 1fr; }
  .lib-cols { display: none; }
  .lib-row { grid-template-columns: 1fr auto; gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
