/* Dermatouch SEO Analyzer — blue-led editorial product UI. */

:root {
  --primary: #075fc7;
  --primary-active: #004eaa;
  --primary-tint: #edf5ff;
  --primary-tint-border: #cce1f8;
  --secondary: #142f67;
  --on-primary: #ffffff;
  --canvas: #ffffff;
  --canvas-soft: #f3f6fa;
  --surface: #ffffff;
  --ink: #12233c;
  --ink-secondary: #33445b;
  --ink-muted: #586a80;
  --ink-faint: #62738a;
  --hairline: #dce5ef;
  --nav-glass: rgba(255,255,255,.82);
  --hero-glow: rgba(61,144,233,.16);
  --accent-purple: #d6b6f6;
  --accent-pink: #ff64c8;
  --accent-orange: #dd5b00;
  --accent-teal: #2a9d99;
  --accent-green: #1aae39;
  --accent-sky: #62aef0;
  --existing-surface: #f5f7fa;
  --suggested-surface: #edf5ff;
  --suggested-border: #c8e0fb;
  --r-xs: 6px; --r-sm: 9px; --r-md: 12px; --r-lg: 16px; --r-xl: 20px; --r-2xl: 28px; --r-full: 9999px;
  --shadow-1: 0 .175px 1.041px rgba(0,0,0,.01), 0 .8px 2.925px rgba(0,0,0,.02),
              0 2.025px 7.847px rgba(0,0,0,.027), 0 4px 18px rgba(0,0,0,.04);
  --shadow-2: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06), 0 24px 56px rgba(0,0,0,.06);
}

/* ---------- Dark theme (toggled via [data-theme="dark"] on <html>) ---------- */
html[data-theme="dark"] {
  --primary: #87c7ff;
  --primary-active: #a8d8ff;
  --primary-tint: #1b3a57;
  --primary-tint-border: #47769c;
  --secondary: #c3d9ff;
  --on-primary: #09213a;
  --canvas: #162336;
  --canvas-soft: #0d1725;
  --surface: #1b2b3d;
  --ink: #f5f9ff;
  --ink-secondary: #deebf8;
  --ink-muted: #b9cadd;
  --ink-faint: #a9bdd1;
  --hairline: #3c526b;
  --nav-glass: rgba(13,23,37,.94);
  --hero-glow: rgba(42,105,183,.12);
  --accent-orange: #ffb17a;
  --accent-teal: #74ded4;
  --accent-green: #80dfaa;
  --existing-surface: #243345;
  --suggested-surface: #1b3b59;
  --suggested-border: #4c7191;
  --shadow-1: 0 1px 2px rgba(0,0,0,.22), 0 10px 28px rgba(0,0,0,.24);
  --shadow-2: 0 2px 6px rgba(0,0,0,.26), 0 20px 52px rgba(0,0,0,.34);
}
/* Overrides for the few hardcoded (non-token) colors */
html[data-theme="dark"] .nav { background: var(--nav-glass); }
html[data-theme="dark"] .nav .logo { filter: brightness(0) invert(1); } /* dark logo → white */
html[data-theme="dark"] .login-logo { filter: brightness(0) invert(1); }
html[data-theme="dark"] textarea#links { border-color: var(--hairline); }
html[data-theme="dark"] .banner-error { background: var(--surface); }
html[data-theme="dark"] .badge-post { background: #2a2342; color: #cbabf2; }
html[data-theme="dark"] .badge-post .dot { background: #cbabf2; }
html[data-theme="dark"] .badge-error { background: #3a1f1e; color: #f0a8a3; }
html[data-theme="dark"] .badge-error .dot { background: #f0a8a3; }
html[data-theme="dark"] .score-high { background: #173524; color: #7ed79b; }
html[data-theme="dark"] .score-high .dot { background: #7ed79b; }
html[data-theme="dark"] .score-mid { background: #3a2f15; color: #f0c073; }
html[data-theme="dark"] .score-mid .dot { background: #f0c073; }
html[data-theme="dark"] .score-low { background: #3a1f1e; color: #f0a8a3; }
html[data-theme="dark"] .score-low .dot { background: #f0a8a3; }

* { box-sizing: border-box; }

/* Smooth the swap between themes */
body, .nav, .input-card, textarea#links, .result-card, .rc-head, .rc-tabs,
.chip, .pill, .kv, .script, .s-text, .source-text, .cta, footer.foot, .theme-toggle {
  transition: background-color .25s ease, color .25s ease, border-color .25s ease;
}
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--canvas-soft);
  color: var(--ink);
  font-family: Inter, -apple-system, system-ui, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* decorative multi-colour top strip (sticker palette — decoration only) */
body::before {
  content: ""; position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 50;
  background: linear-gradient(90deg, var(--accent-sky), var(--accent-purple),
    var(--accent-pink), var(--accent-orange), var(--accent-teal), var(--accent-green));
}

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

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 3px; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(255,255,255,.85); backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--hairline);
  padding: 16px 32px;
}
.nav .logo { height: 38px; width: auto; display: block; }
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-tag {
  font-size: 12px; font-weight: 600; letter-spacing: .8px; text-transform: uppercase;
  color: var(--ink-muted);
  background: var(--canvas-soft); border: 1px solid var(--hairline);
  padding: 6px 12px; border-radius: var(--r-full);
}
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; padding: 0; cursor: pointer;
  color: var(--ink-secondary); background: var(--canvas-soft);
  border: 1px solid var(--hairline); border-radius: var(--r-full);
  transition: background .15s ease, color .15s ease, transform .08s ease;
}
.theme-toggle:hover { color: var(--ink); background: var(--surface); }
.theme-toggle:active { transform: scale(.94); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: block; }

/* ---------- Layout ---------- */
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 32px; }

.hero { padding: 64px 0 8px; }
.eyebrow-pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase;
  color: var(--primary); background: var(--primary-tint);
  border: 1px solid var(--primary-tint-border);
  padding: 5px 12px; border-radius: var(--r-full); margin-bottom: 18px;
}
.eyebrow-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }
.hero h1 {
  font-size: 50px; font-weight: 700; line-height: 1.04; letter-spacing: -1.8px;
  margin: 0 0 14px; max-width: 18ch;
}
.hero .sub { color: var(--ink-muted); font-size: 18px; margin: 0; max-width: 60ch; line-height: 1.5; }

/* ---------- Input card ---------- */
.input-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-1);
  padding: 28px;
  margin-top: 32px;
}
.input-card label {
  display: block; font-size: 12px; font-weight: 600; letter-spacing: .6px;
  text-transform: uppercase; color: var(--ink-muted); margin-bottom: 10px;
}
.input-card label strong { color: var(--primary); font-weight: 700; }
textarea#links {
  width: 100%; min-height: 120px; resize: vertical;
  border: 1px solid #dcdcdc; border-radius: var(--r-md);
  padding: 14px 16px; font: inherit; font-size: 15px; line-height: 1.6; color: var(--ink);
  background: var(--canvas);
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea#links::placeholder { color: var(--ink-faint); }
textarea#links:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }

.actions { display: flex; align-items: center; gap: 12px; margin-top: 18px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font: inherit; font-size: 16px; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; border-radius: var(--r-full);
  padding: 11px 24px; transition: transform .08s ease, background .15s ease, box-shadow .15s ease;
}
.btn:active { transform: scale(.96); }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--primary); color: var(--on-primary); box-shadow: 0 1px 2px rgba(0,117,222,.35); }
.btn-primary:hover { background: var(--primary-active); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--hairline); box-shadow: var(--shadow-1); }
.btn-secondary:hover { background: var(--canvas-soft); }
.hint { color: var(--ink-faint); font-size: 14px; }
/* More specific than `.input-card label` so it isn't forced to block/uppercase. */
.input-card label.check {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  color: var(--ink-muted); font-size: 14px; font-weight: 500;
  letter-spacing: normal; text-transform: none; margin-bottom: 0; user-select: none;
}
.input-card label.check input {
  accent-color: var(--primary); width: 15px; height: 15px;
  margin: 0; flex: none; cursor: pointer;
}

/* ---------- Status / errors ---------- */
.status { margin: 22px 0 0; color: var(--ink-muted); font-size: 15px; display: none; }
.status.show { display: flex; align-items: center; gap: 10px; }
.spinner { width: 17px; height: 17px; border: 2px solid var(--hairline); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.banner-error {
  background: #fff; border: 1px solid var(--hairline); border-left: 3px solid var(--accent-orange);
  border-radius: var(--r-md); padding: 12px 16px; color: var(--ink-secondary); margin: 16px 0; font-size: 15px;
}

/* ---------- Results ---------- */
.results-bar {
  display: none; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  margin: 36px 0 4px;
}
.results-bar.show { display: flex; }
.results-bar h2 { font-size: 22px; font-weight: 700; letter-spacing: -.4px; margin: 0; }
.results-bar .summary { color: var(--ink-muted); font-size: 14px; margin-top: 2px; }

.results { padding: 16px 0 72px; display: flex; flex-direction: column; gap: 24px; }

.result-card {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r-xl); box-shadow: var(--shadow-1); overflow: hidden;
  animation: rise .35s cubic-bezier(.2,.7,.3,1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.rc-head {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 18px 26px; border-bottom: 1px solid var(--hairline); background: var(--canvas);
}
/* Tabbed cards: the tab strip provides the divider, so drop the head's line. */
.result-card.tabbed .rc-head { border-bottom: none; padding-bottom: 12px; }

/* ---------- Per-card tabs (sectioned content, less scrolling) ---------- */
.rc-tabs {
  display: flex; gap: 2px; flex-wrap: wrap;
  padding: 0 26px; background: var(--canvas);
  border-bottom: 1px solid var(--hairline);
}
.tab {
  appearance: none; background: none; border: none; font: inherit;
  font-size: 14px; font-weight: 500; color: var(--ink-muted); cursor: pointer;
  padding: 12px 14px; border-bottom: 2px solid transparent; margin-bottom: -1px;
  display: inline-flex; align-items: center; gap: 7px;
  transition: color .15s ease, border-color .15s ease;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-count {
  font-size: 11px; font-weight: 700; line-height: 1;
  background: var(--primary-tint); color: var(--primary);
  border-radius: var(--r-full); padding: 3px 7px;
}
.rc-panel { display: none; }
.rc-panel.active { display: flex; flex-direction: column; gap: 22px; }
.source-text {
  white-space: pre-wrap; font-size: 15px; line-height: 1.6; color: var(--ink-secondary);
  background: var(--canvas-soft); border: 1px solid var(--hairline);
  border-radius: var(--r-md); padding: 14px 16px; max-height: 380px; overflow: auto;
}
.rc-head .url { font-size: 14px; font-weight: 500; word-break: break-all; flex: 1; min-width: 200px; color: var(--ink-secondary); }
.rc-metrics { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--canvas-soft); border: 1px solid var(--hairline);
  border-radius: var(--r-full); padding: 5px 12px; font-size: 13px; color: var(--ink-secondary);
}
.chip b { color: var(--ink); font-weight: 600; }
.chip svg { width: 14px; height: 14px; opacity: .7; }

.rc-body { padding: 22px 26px; display: flex; flex-direction: column; gap: 22px; }

.badge { display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase;
  border-radius: var(--r-full); padding: 5px 12px; }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; }
.badge-reel { background: var(--primary-tint); color: var(--primary); }
.badge-reel .dot { background: var(--primary); }
.badge-post { background: #f3eefb; color: #6b3fa0; }
.badge-post .dot { background: #9a6fd0; }
.badge-error { background: #fdecec; color: #b3261e; }
.badge-error .dot { background: #b3261e; }

/* sections */
.section .eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .7px; text-transform: uppercase;
  color: var(--ink-faint); margin: 0 0 9px; }
.section p.body { margin: 0; color: var(--ink-secondary); font-size: 15px; }

.pills { display: flex; flex-wrap: wrap; gap: 7px; }
.pill { font-size: 13px; border-radius: var(--r-full); padding: 5px 11px;
  background: var(--canvas-soft); color: var(--ink-secondary); border: 1px solid var(--hairline); }
.pill-tag { color: var(--ink-secondary); }
.pill-suggest { background: var(--primary-tint); color: var(--primary); border-color: var(--primary-tint-border); font-weight: 500; }

/* A single comparison card for each analyzed component. */
.compare-list { display: grid; gap: 16px; }
.compare-card {
  overflow: hidden; background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r-xl); box-shadow: var(--shadow-1);
}
.compare-title {
  margin: 0; padding: 15px 18px; font-size: 15px; line-height: 1.35;
  font-weight: 700; letter-spacing: -.2px; border-bottom: 1px solid var(--hairline);
}
.compare-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.compare-side { min-width: 0; padding: 18px; }
.compare-existing { background: var(--existing-surface); }
.compare-suggested {
  background: var(--suggested-surface); border-left: 1px solid var(--suggested-border);
}
.compare-label {
  display: flex; align-items: center; gap: 7px; margin-bottom: 13px;
  font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .09em;
  color: var(--ink-muted);
}
.compare-label svg { width: 16px; height: 16px; flex: none; }
.compare-suggested .compare-label { color: var(--primary); }
.compare-content { font-size: 14px; line-height: 1.55; }
.compare-content .pills { gap: 8px; }
.compare-content .pill { max-width: 100%; overflow-wrap: anywhere; }
.compare-content .empty, .compare-text, .compare-note, .older-note { margin: 0; }
.compare-text { color: var(--ink); font-weight: 550; }
.compare-note { color: var(--ink-muted); margin-top: 10px; }
.older-note { color: var(--ink-muted); font-size: 13px; font-style: italic; }
.pill-existing { background: var(--surface); }
.compare-suggested .tier-label { color: var(--ink-muted); }
@media (max-width: 700px) {
  .compare-grid { grid-template-columns: minmax(0, 1fr); }
  .compare-suggested { border-left: 0; border-top: 1px solid var(--suggested-border); }
}

.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px;
  background: var(--canvas-soft); border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: 18px; }
.kv .section .eyebrow { color: var(--ink-muted); }

/* scripts */
.scripts { display: flex; flex-direction: column; gap: 16px; }
.script { border: 1px solid var(--hairline); border-left: 3px solid var(--primary);
  border-radius: var(--r-md); background: var(--canvas); padding: 18px 20px; box-shadow: var(--shadow-1); }
.script .s-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.s-num { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px;
  border-radius: 50%; background: var(--primary); color: #fff; font-size: 13px; font-weight: 700; flex: none; }
.script .s-title { font-size: 17px; font-weight: 700; letter-spacing: -.3px; }
.script .s-angle { font-size: 12px; color: var(--ink-muted); background: var(--canvas-soft);
  border: 1px solid var(--hairline); padding: 3px 9px; border-radius: var(--r-full); }
.script .s-text { font-size: 15px; line-height: 1.6; color: var(--ink); white-space: pre-wrap;
  margin: 10px 0 14px; padding: 12px 14px; background: var(--canvas-soft); border-radius: var(--r-sm); }
.script .s-sub { display: flex; flex-direction: column; gap: 12px; }
.script .s-why { font-size: 14px; color: var(--ink-muted); margin-top: 12px;
  padding-top: 12px; border-top: 1px dashed var(--hairline); }
.script .s-why b { color: var(--ink-secondary); }

details.collapse { border-top: 1px solid var(--hairline); padding-top: 16px; }
details.collapse > summary { cursor: pointer; font-size: 11px; font-weight: 600; letter-spacing: .7px;
  text-transform: uppercase; color: var(--ink-muted); list-style: none; user-select: none; }
details.collapse > summary::-webkit-details-marker { display: none; }
details.collapse > summary::before { content: "▸"; color: var(--ink-faint); margin-right: 6px; display: inline-block; }
details.collapse[open] > summary::before { content: "▾"; }
details.collapse .collapse-body { margin-top: 12px; color: var(--ink-secondary); font-size: 15px;
  line-height: 1.6; white-space: pre-wrap; }

.empty { color: var(--ink-faint); font-size: 14px; }

/* ---------- Engagement score badge ---------- */
.score-badge { letter-spacing: 0; }
.score-badge .score-of { font-weight: 500; opacity: .6; margin-left: 1px; }
.score-high { background: #e7f7ec; color: #137a32; }
.score-high .dot { background: var(--accent-green); }
.score-mid { background: #fff4e0; color: #9a5b00; }
.score-mid .dot { background: var(--accent-orange); }
.score-low { background: #fdecec; color: #b3261e; }
.score-low .dot { background: #b3261e; }

/* ---------- Pending (streaming) card ---------- */
.result-card.pending .rc-head { background: var(--canvas-soft); }
.badge-pending { background: var(--canvas-soft); color: var(--ink-muted);
  border: 1px solid var(--hairline); text-transform: none; letter-spacing: .3px; }
.badge-pending .spinner { width: 12px; height: 12px; border-width: 2px; }
.pending-note { margin: 0; color: var(--ink-faint); font-size: 14px; }

/* ---------- Hashtag reach tiers ---------- */
.tiers { display: flex; flex-direction: column; gap: 12px; }
.tier { display: flex; flex-direction: column; gap: 6px; }
.tier-label { font-size: 11px; font-weight: 600; letter-spacing: .4px;
  color: var(--ink-muted); text-transform: uppercase; }

/* ---------- Call-to-action block ---------- */
.cta { background: var(--canvas-soft); border: 1px solid var(--hairline);
  border-radius: var(--r-lg); padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.cta-row { display: flex; gap: 10px; align-items: baseline; }
.cta-label { flex: none; width: 64px; font-size: 11px; font-weight: 600; letter-spacing: .5px;
  text-transform: uppercase; color: var(--ink-faint); padding-top: 1px; }
.cta-label-strong { color: var(--primary); }
.cta-text { font-size: 15px; color: var(--ink-secondary); }
.cta-text.muted { color: var(--ink-faint); font-style: italic; }
.cta-text.strong { color: var(--ink); font-weight: 600; }

/* per-script CTA line + score alignment */
.script .s-cta { font-size: 14px; color: var(--ink-secondary); margin: 0 0 14px;
  padding: 8px 12px; background: var(--primary-tint); border: 1px solid var(--primary-tint-border);
  border-radius: var(--r-sm); }
.script .s-cta b { color: var(--primary); }
.script .s-head .score-badge { margin-left: auto; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .result-card { animation: none; }
}

footer.foot { background: var(--canvas-soft); border-top: 1px solid var(--hairline);
  color: var(--ink-secondary); font-size: 14px; padding: 32px; text-align: center; }

@media (max-width: 640px) {
  .hero { padding: 40px 0 4px; }
  .hero h1 { font-size: 34px; letter-spacing: -1px; }
  .hero .sub { font-size: 16px; }
  .wrap, .nav { padding-left: 18px; padding-right: 18px; }
  .input-card { padding: 20px; }
  .rc-head, .rc-body, .rc-tabs { padding-left: 18px; padding-right: 18px; }
  .tab { padding: 11px 10px; font-size: 13px; }
}

/* ---------- History ---------- */
.hidden { display: none !important; }

.nav-btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 38px; padding: 0 14px; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 600;
  color: var(--ink-secondary); background: var(--canvas-soft);
  border: 1px solid var(--hairline); border-radius: var(--r-full);
  transition: background .15s ease, color .15s ease, transform .08s ease;
}
.nav-btn:hover { color: var(--ink); background: var(--surface); }
.nav-btn, .nav-btn:hover { text-decoration: none; }
.nav-btn:active { transform: scale(.96); }
.nav-btn svg { width: 16px; height: 16px; }
.nav-btn.active { color: var(--on-primary); background: var(--primary); border-color: transparent; }

.history { padding: 48px 0 64px; }
.hist-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 24px; margin-bottom: 24px;
}
.hist-head h2 { font-size: 26px; font-weight: 700; letter-spacing: -.5px; margin: 0; }
.hist-head .hint { margin: 6px 0 0; max-width: 62ch; line-height: 1.5; }

.hist-list { display: flex; flex-direction: column; gap: 10px; }

.hist-item {
  display: flex; align-items: center; gap: 16px; width: 100%; text-align: left;
  padding: 16px 18px; cursor: pointer; font: inherit;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r-lg); box-shadow: var(--shadow-1);
  transition: border-color .15s ease, transform .08s ease, box-shadow .15s ease;
}
.hist-item:hover { border-color: var(--primary); box-shadow: var(--shadow-2); }
.hist-item:active { transform: scale(.995); }

.hist-when { flex: 0 0 168px; }
.hist-when b { display: block; font-size: 15px; font-weight: 700; color: var(--ink); }
.hist-when span { display: block; font-size: 13px; color: var(--ink-muted); margin-top: 2px; }

.hist-mid { flex: 1; min-width: 0; }
.hist-urls {
  font-size: 13.5px; color: var(--ink-muted); line-height: 1.45;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hist-counts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.hist-chip {
  font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: var(--r-full);
  color: var(--ink-secondary); background: var(--canvas-soft); border: 1px solid var(--hairline);
}
.hist-chip.reel { color: var(--accent-teal); }
.hist-chip.fail { color: var(--accent-orange); }
.hist-chip.running { color: var(--primary); }

.hist-open { flex: 0 0 auto; color: var(--ink-faint); }
.hist-open svg { width: 18px; height: 18px; display: block; }
.hist-item:hover .hist-open { color: var(--primary); }

.hist-empty {
  padding: 40px 24px; text-align: center; color: var(--ink-muted);
  background: var(--canvas-soft); border: 1px dashed var(--hairline);
  border-radius: var(--r-lg); line-height: 1.6;
}

/* ---------- Translation + data freshness ---------- */
.lang-tag {
  display: inline-block; margin-left: 8px; padding: 2px 8px;
  font-size: 11px; font-weight: 600; letter-spacing: .3px; text-transform: none;
  color: var(--accent-teal); background: var(--canvas-soft);
  border: 1px solid var(--hairline); border-radius: var(--r-full);
}
.source-text.translation {
  border-left: 3px solid var(--accent-teal);
  padding-left: 14px; background: var(--canvas-soft);
}
.muted-note { color: var(--ink-muted); font-style: italic; }

.chip.chip-live { color: var(--accent-green); }
.chip.chip-live svg { color: var(--accent-green); }
.chip.chip-stale {
  color: var(--accent-orange);
  border-color: color-mix(in srgb, var(--accent-orange) 35%, transparent);
  cursor: help;
}
.chip.chip-stale svg { color: var(--accent-orange); }

/* ---------- Sign-in ---------- */
.login-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 32px; background: var(--canvas-soft);
}
.login-card {
  width: 100%; max-width: 440px; padding: 40px 36px 30px; text-align: center;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r-2xl); box-shadow: var(--shadow-2);
}
.login-logo { height: 40px; width: auto; margin: 0 auto 22px; display: block; }
.login-card h1 {
  font-size: 24px; font-weight: 700; letter-spacing: -.5px; margin: 0 0 8px;
}
.login-sub { color: var(--ink-muted); font-size: 15px; margin: 0 0 26px; }

.login-msg {
  text-align: left; font-size: 14px; line-height: 1.55; margin-bottom: 22px;
  padding: 14px 16px; border-radius: var(--r-md);
  color: var(--ink-secondary); background: var(--canvas-soft);
  border: 1px solid var(--hairline);
}
.login-msg b { color: var(--ink); display: block; margin-bottom: 4px; }
.login-msg code {
  font-size: 12.5px; padding: 1px 5px; border-radius: var(--r-xs);
  background: var(--surface); border: 1px solid var(--hairline);
}
.login-msg-warn {
  color: var(--accent-orange);
  background: color-mix(in srgb, var(--accent-orange) 7%, var(--surface));
  border-color: color-mix(in srgb, var(--accent-orange) 28%, transparent);
}
.login-msg-warn b { color: var(--accent-orange); }

.btn-google {
  display: inline-flex; align-items: center; justify-content: center; gap: 11px;
  width: 100%; padding: 12px 18px; font-size: 15px; font-weight: 600;
  text-decoration: none; cursor: pointer;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--hairline); border-radius: var(--r-md);
  box-shadow: var(--shadow-1); transition: background .15s ease, transform .08s ease;
}
.btn-google:hover { background: var(--canvas-soft); }
.btn-google:active { transform: scale(.985); }

.login-form { margin-bottom: 18px; }
.login-form .btn { width: 100%; justify-content: center; }
.login-foot {
  margin: 22px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--ink-faint);
}

/* Signed-in identity + sign-out in the main nav */
.nav-user {
  font-size: 13px; color: var(--ink-muted); max-width: 210px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.logout-form { display: inline-flex; margin: 0; }

/* ---------- Premium layout and interaction layer ---------- */
body { background: radial-gradient(circle at 82% 4%, var(--hero-glow), transparent 32rem), var(--canvas-soft); }
body::before { height: 4px; background: linear-gradient(90deg, #073b8b, #0c70cf 46%, #84c7f3); }
.wrap { max-width: 1200px; }
.nav {
  top: 4px; padding: 13px clamp(18px, 3vw, 48px);
  background: var(--nav-glass); backdrop-filter: saturate(155%) blur(18px);
  box-shadow: 0 8px 26px rgba(20,52,94,.055);
}
.nav .logo { height: 34px; }
.nav-tag { background: var(--primary-tint); color: var(--secondary); border-color: var(--primary-tint-border); }
.nav-btn, .theme-toggle { min-height: 44px; min-width: 44px; border-radius: 12px; }
.nav-btn:hover, .theme-toggle:hover { transform: translateY(-2px); box-shadow: var(--shadow-1); }
.hero { position: relative; padding-top: clamp(44px, 7vw, 86px); }
.hero-intro {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr);
  align-items: center; gap: clamp(24px, 5vw, 64px);
}
.hero-copy { position: relative; z-index: 1; }
.eyebrow-pill { letter-spacing: .11em; margin-bottom: 22px; padding: 8px 14px; }
.hero h1 {
  max-width: 15ch; margin-bottom: 20px; font-size: clamp(43px, 5.3vw, 70px);
  line-height: 1.06; letter-spacing: -.06em; font-weight: 700;
}
.hero h1 span { color: var(--primary); }
.hero .sub { max-width: 56ch; line-height: 1.7; font-size: 17px; color: var(--ink-secondary); }
.hero-aside {
  position: relative; overflow: hidden; color: #eff6ff;
  background: linear-gradient(147deg, #102e61, #0b5dbb 75%, #317fcb);
  border: 1px solid rgba(255,255,255,.18); border-radius: 28px;
  padding: 24px 26px 21px; box-shadow: 0 28px 64px rgba(7,69,145,.22);
}
.hero-aside::before {
  content: ""; position: absolute; width: 260px; height: 260px; right: -95px; top: -110px;
  border-radius: 50%; border: 1px solid rgba(255,255,255,.2); box-shadow: 0 0 0 45px rgba(255,255,255,.04), 0 0 0 90px rgba(255,255,255,.035);
}
.hero-aside-top { position: relative; display: flex; align-items: center; gap: 10px; padding-bottom: 18px;
  border-bottom: 1px solid rgba(255,255,255,.2); font-size: 12px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.hero-aside-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px;
  background: #fff; color: #124d9b; font-size: 18px; font-weight: 800; letter-spacing: -.08em; }
.hero-aside-mark img { display: block; width: 23px; height: 23px; object-fit: contain; }
.hero-step { position: relative; display: flex; gap: 16px; padding: 18px 0; border-bottom: 1px solid rgba(255,255,255,.15); }
.hero-step:last-child { border-bottom: 0; padding-bottom: 3px; }
.hero-step > span { color: #9dceff; font-size: 12px; font-weight: 700; letter-spacing: .08em; padding-top: 3px; }
.hero-step b, .hero-step small { display: block; }
.hero-step b { font-size: 16px; margin-bottom: 2px; }
.hero-step small { color: #cee4ff; font-size: 12px; line-height: 1.5; }
.input-card {
  position: relative; padding: clamp(22px, 3vw, 38px); margin-top: 48px;
  border-radius: 24px; box-shadow: 0 24px 60px rgba(17,58,106,.09);
}
.input-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.input-step { font-size: 18px; font-weight: 700; letter-spacing: -.025em; }
.input-help { color: var(--ink-muted); font-size: 12px; font-weight: 650; }
.input-card label { letter-spacing: .04em; color: var(--ink-secondary); }
textarea#links { min-height: 132px; border-color: var(--hairline); border-radius: 13px; background: var(--canvas-soft); }
.btn { min-height: 46px; font-weight: 650; }
.btn-primary { box-shadow: 0 8px 18px rgba(7,95,199,.24); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 24px rgba(7,95,199,.28); }
.btn-secondary:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.hint { color: var(--ink-muted); }
.results-bar { margin-top: 48px; padding: 0 2px; }
.results-bar h2 { font-size: 27px; letter-spacing: -.04em; }
.results { gap: 22px; }
.slot .result-card { animation-delay: calc(var(--stagger, 0) * 55ms); }
.result-card { border-radius: 22px; box-shadow: 0 14px 34px rgba(18,45,79,.075); }
.result-card:not(.pending):hover { box-shadow: 0 20px 48px rgba(18,45,79,.12); }
.rc-head { gap: 13px; padding: 19px 26px; }
.rc-head .url { font-weight: 600; }
.rc-head .url a { overflow-wrap: anywhere; }
.rc-metrics { width: 100%; margin-top: 2px; }
.chip { background: var(--canvas-soft); transition: transform .18s ease, border-color .18s ease, background-color .25s ease; }
.chip:hover, .pill:hover { transform: translateY(-2px); border-color: var(--primary-tint-border); }
.rc-tabs { gap: 8px; padding-top: 3px; }
.tab { padding: 13px 14px; font-weight: 650; border-bottom-width: 3px; transition: color .2s ease, border-color .2s ease, background-color .2s ease; }
.tab:hover { background: var(--primary-tint); }
.rc-panel.active { animation: panel-in .26s ease both; }
@keyframes panel-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.compare-card { transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease; }
.compare-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: var(--primary-tint-border); }
.compare-card:nth-child(1) { animation: rise .35s ease both .04s; }
.compare-card:nth-child(2) { animation: rise .35s ease both .08s; }
.compare-card:nth-child(3) { animation: rise .35s ease both .12s; }
.compare-card:nth-child(4) { animation: rise .35s ease both .16s; }
.compare-card:nth-child(5) { animation: rise .35s ease both .20s; }
.compare-card:nth-child(6) { animation: rise .35s ease both .24s; }
.compare-title { font-size: 16px; }
.compare-side { padding: 19px 21px 22px; }
.kv { padding: 22px; gap: 20px; }
.script { border-left-width: 4px; border-radius: 15px; padding: 22px; transition: transform .2s ease, box-shadow .2s ease; }
.script:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.pill { transition: transform .18s ease, border-color .18s ease, background-color .25s ease; }
.history { padding-top: 56px; }
.hist-head h2 { font-size: 31px; letter-spacing: -.045em; }
.hist-item { padding: 20px 23px; border-radius: 16px; transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.hist-item:hover { transform: translateY(-2px); }
.hist-open { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--primary-tint); color: var(--primary); }
.hist-urls { color: var(--ink-secondary); }

/* Score animation remains visual; the exact numeric value is always readable. */
.score-badge { position: relative; width: 64px; height: 64px; padding: 0; justify-content: center; flex: none; background: transparent !important; }
.score-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.score-ring circle { fill: none; stroke-width: 5; }
.score-track { stroke: var(--hairline); }
.score-fill { stroke: currentColor; stroke-linecap: round; stroke-dasharray: 151; stroke-dashoffset: 151; animation: score-draw .85s cubic-bezier(.2,.75,.2,1) .18s forwards; }
@keyframes score-draw { to { stroke-dashoffset: var(--ring-end); } }
.score-number { display: flex; flex-direction: column; align-items: center; line-height: 1; font-size: 18px; font-weight: 800; letter-spacing: -.04em; }
.score-number small { margin-top: 3px; font-size: 9px; font-weight: 650; letter-spacing: 0; }
.script .score-badge { width: 54px; height: 54px; }
.script .score-number { font-size: 15px; }
.script .score-number small { font-size: 8px; }

/* Stable skeletons reserve space while NDJSON cards stream in. */
.result-card.pending .rc-body { min-height: 172px; }
.pending-note { color: var(--ink-muted); }
.skeleton-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.skeleton-panel { display: flex; flex-direction: column; gap: 12px; min-height: 84px; padding: 17px;
  background: var(--canvas-soft); border: 1px solid var(--hairline); border-radius: 14px; }
.skeleton-line { display: block; width: 100%; height: 11px; border-radius: 99px; background: var(--hairline); opacity: .8; }
.skeleton-line.short { width: 32%; }
.skeleton-line.medium { width: 68%; }
.skeleton-panel, .skeleton-line { background-image: linear-gradient(100deg, transparent 15%, rgba(255,255,255,.45) 46%, transparent 80%);
  background-size: 220% 100%; animation: shimmer 1.65s linear infinite; }
html[data-theme="dark"] .skeleton-panel, html[data-theme="dark"] .skeleton-line {
  background-image: linear-gradient(100deg, transparent 15%, rgba(255,255,255,.055) 46%, transparent 80%);
}
@keyframes shimmer { to { background-position-x: -220%; } }

/* Sign-in uses the same visual language without touching auth behaviour. */
.login-body { padding: clamp(18px, 4vw, 52px); }
.login-shell { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 440px); width: min(100%, 960px);
  overflow: hidden; border-radius: 28px; box-shadow: 0 30px 80px rgba(12,42,79,.18); background: var(--surface); }
.login-story { display: flex; flex-direction: column; justify-content: space-between; min-height: 520px; padding: 42px;
  color: #f0f6ff; background: radial-gradient(circle at 85% 22%, #377dd0, transparent 45%), linear-gradient(145deg, #0c2d62, #075cb5); }
.login-story-kicker { font-size: 12px; font-weight: 750; text-transform: uppercase; letter-spacing: .11em; color: #c9e3ff; }
.login-story-symbol { display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: 24px;
  border-radius: 19px; background: rgba(255,255,255,.95); color: #1555a2; font-size: 39px; font-weight: 800; letter-spacing: -.08em; }
.login-story-symbol img { width: 46px; height: 46px; object-fit: contain; }
.login-story h2 { font-size: clamp(30px, 3vw, 43px); line-height: 1.12; letter-spacing: -.045em; max-width: 12ch; margin: 0 0 14px; }
.login-story p { color: #d9eafa; max-width: 38ch; margin: 0; }
.login-story-foot { font-size: 12px; color: #bad7f5; }
.login-card { max-width: none; border: 0; border-radius: 0; box-shadow: none; padding: 52px 38px 34px;
  display: flex; flex-direction: column; justify-content: center; }
.login-logo { margin-bottom: 28px; }
.login-card h1 { font-size: 27px; letter-spacing: -.04em; }
.btn-google { min-height: 48px; border-radius: 12px; transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease; }
.btn-google:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }

:where(button, a, textarea):focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }

@media (max-width: 900px) {
  .hero-intro { grid-template-columns: 1fr; }
  .hero-aside { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; padding: 19px 22px; }
  .hero-aside-top { grid-column: 1 / -1; }
  .hero-step { border-bottom: 0; padding: 10px 0 4px; }
  .hero-step + .hero-step { border-left: 1px solid rgba(255,255,255,.18); padding-left: 14px; }
}
@media (max-width: 680px) {
  .nav { gap: 12px; padding: 12px 18px; }
  .nav-tag, .nav-user, .logout-form .nav-btn span { display: none; }
  .nav-right { gap: 7px; }
  .nav .logo { height: 29px; max-width: 142px; object-fit: contain; }
  .wrap { padding-inline: 17px; }
  .hero { padding-top: 40px; }
  .hero h1 { font-size: clamp(39px, 10.2vw, 52px); }
  .hero .sub { font-size: 16px; }
  .hero-aside { display: none; }
  .input-card { margin-top: 27px; padding: 22px 18px; }
  .input-head { flex-wrap: wrap; }
  .actions .btn { width: 100%; justify-content: center; }
  .rc-head, .rc-body, .rc-tabs { padding-left: 17px; padding-right: 17px; }
  .rc-tabs { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
  .rc-tabs::-webkit-scrollbar { display: none; }
  .tab { white-space: nowrap; font-size: 12px; }
  .rc-head .url { min-width: 0; width: calc(100% - 90px); }
  .skeleton-grid { grid-template-columns: 1fr; }
  .skeleton-panel:nth-child(2) { display: none; }
  .hist-head { flex-direction: column; }
  .hist-item { align-items: flex-start; flex-wrap: wrap; }
  .hist-when { flex: 1 1 100%; }
  .hist-open { margin-left: auto; }
  .login-shell { grid-template-columns: 1fr; border-radius: 20px; }
  .login-story { display: none; }
  .login-card { padding: 40px 25px 30px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .score-fill { stroke-dashoffset: var(--ring-end); }
  .btn-primary:hover, .btn-secondary:hover, .nav-btn:hover, .theme-toggle:hover,
  .chip:hover, .pill:hover, .compare-card:hover, .script:hover, .hist-item:hover { transform: none !important; }
}

/* ---------- Results workspace and standalone History ---------- */
.brand-link { display: inline-flex; align-items: center; }
.brand-link:hover { text-decoration: none; }
.workspace-kicker {
  display: block; color: var(--primary); font-size: 11px; font-weight: 800;
  letter-spacing: .12em; text-transform: uppercase; margin-bottom: 7px;
}
.results-mode .hero { display: none; }
.results-mode .results-bar { margin-top: 34px; }
.results-heading { min-width: 0; }
.results-bar h2, .results-bar h1 {
  font-size: clamp(27px, 3vw, 36px); line-height: 1.15; letter-spacing: -.045em;
  margin: 0; color: var(--ink);
}
.results-bar .summary { margin-top: 6px; }
.results-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.results-actions .btn { white-space: nowrap; }
.results-bar .status { margin-top: 9px; }
.results-mode .results { padding-top: 20px; }
.history-shell { min-height: calc(100vh - 175px); }
.history { padding-top: 38px; }
.hist-hero {
  position: relative; overflow: hidden; padding: clamp(26px, 4vw, 42px);
  border: 1px solid var(--hairline); border-radius: 22px;
  background: linear-gradient(125deg, var(--surface), var(--primary-tint));
  box-shadow: var(--shadow-1); margin-bottom: 34px;
}
.hist-hero::after {
  content: ""; position: absolute; width: 230px; height: 230px; right: -85px; top: -115px;
  border: 1px solid var(--primary-tint-border); border-radius: 50%; opacity: .55;
  pointer-events: none;
}
.back-link {
  display: inline-flex; align-items: center; min-height: 44px; margin: -8px 0 20px;
  font-size: 14px; font-weight: 700; color: var(--ink-secondary);
}
.back-link:hover { color: var(--primary); }
.hist-head { align-items: end; position: relative; z-index: 1; margin: 0; }
.hist-head h1 { font-size: clamp(34px, 4.4vw, 52px); line-height: 1.06; letter-spacing: -.055em; margin: 0 0 10px; }
.hist-head p { margin: 0; color: var(--ink-secondary); font-size: 16px; }
.hist-list-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin: 0 0 16px; }
.hist-list-head h2 { font-size: 21px; letter-spacing: -.035em; margin: 0; }
.hist-list-head span { color: var(--ink-muted); font-size: 13px; font-weight: 600; }
.hist-item { color: inherit; text-decoration: none; }
.hist-item:hover { text-decoration: none; }
.hist-detail-nav { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-top: 25px; }
.hist-detail-nav .back-link { margin: 0; }
.hist-new-link { font-size: 14px; font-weight: 700; }
.history-detail .results-bar { margin-top: 20px; }

/* The dark theme uses readable, filled chips and clearer surface boundaries. */
html[data-theme="dark"] body { background: radial-gradient(circle at 80% 3%, var(--hero-glow), transparent 30rem), var(--canvas-soft); }
html[data-theme="dark"] .nav { border-bottom-color: #33475c; box-shadow: 0 8px 24px rgba(0,0,0,.15); }
html[data-theme="dark"] .hero-aside { background: linear-gradient(145deg, #1a3b62, #225c99); box-shadow: 0 22px 50px rgba(0,0,0,.27); }
html[data-theme="dark"] .input-card, html[data-theme="dark"] .result-card,
html[data-theme="dark"] .hist-item { border-color: #496078; }
html[data-theme="dark"] .rc-head, html[data-theme="dark"] .rc-tabs,
html[data-theme="dark"] .compare-title { background: #203248; }
html[data-theme="dark"] .pill { background: #2c3c50; color: #e7f0fb; border-color: #50647c; }
html[data-theme="dark"] .pill-existing { background: #35475c; }
html[data-theme="dark"] .pill-suggest {
  background: #28577c; color: #edf8ff; border-color: #5689af; font-weight: 650;
}
html[data-theme="dark"] .compare-suggested .compare-label { color: #c4e6ff; }
html[data-theme="dark"] .compare-suggested .tier-label { color: #c4d8eb; }
html[data-theme="dark"] .nav-tag { background: #1e3b5b; color: #d1e6ff; border-color: #3a6188; }
html[data-theme="dark"] .hist-open { background: #28577c; color: #e1f2ff; }
html[data-theme="dark"] .hist-chip { background: #253b52; border-color: #4c6580; }
html[data-theme="dark"] .hist-chip.reel { color: #8fe7db; }
html[data-theme="dark"] .login-body { background: var(--canvas-soft); }

@media (max-width: 680px) {
  .results-mode .results-bar { margin-top: 24px; }
  .results-actions { width: 100%; }
  .results-actions .btn { flex: 1 1 auto; justify-content: center; }
  .hist-hero { padding: 24px; }
  .hist-head { align-items: stretch; }
  .hist-head .btn { justify-content: center; }
  .hist-list-head { align-items: flex-start; }
}

/* ==========================================================================
   Content Studio shell: tool tabs in the nav, shared by all three tools.
   ========================================================================== */
.nav { gap: 18px; }
.nav-tabs {
  display: flex; align-items: center; gap: 4px; padding: 4px;
  background: var(--canvas-soft); border: 1px solid var(--hairline); border-radius: 14px;
  margin-right: auto; margin-left: clamp(8px, 2vw, 28px);
}
.nav-tab {
  display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 15px;
  border-radius: 10px; font-size: 14px; font-weight: 650; color: var(--ink-muted);
  white-space: nowrap; transition: background-color .18s ease, color .18s ease, box-shadow .18s ease;
}
.nav-tab svg { width: 16px; height: 16px; flex: none; }
.nav-tab:hover { color: var(--ink); background: var(--surface); text-decoration: none; }
.nav-tab.active { color: var(--primary); background: var(--surface); box-shadow: var(--shadow-1); }
html[data-theme="dark"] .nav-tabs { background: #0f1c2d; border-color: #33475c; }
html[data-theme="dark"] .nav-tab.active { background: #1f3a58; color: #d7ecff; }

@media (max-width: 1080px) {
  .nav-user { display: none; }
}
@media (max-width: 860px) {
  .nav { flex-wrap: wrap; row-gap: 10px; }
  .nav-tabs { order: 3; width: 100%; margin: 0; overflow-x: auto; scrollbar-width: none; }
  .nav-tabs::-webkit-scrollbar { display: none; }
  .nav-tab { flex: 1 0 auto; justify-content: center; }
}
@media (max-width: 420px) {
  .nav-tab { padding: 0 10px; font-size: 13px; gap: 6px; }
  .nav-tab svg { display: none; }
}

/* ---------- Tool pages (Profile Audit, Weekly Tracker) ---------- */
.tool-page { padding-bottom: 72px; }
.tool-hero {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(320px, .95fr);
  gap: clamp(22px, 4vw, 56px); align-items: center; padding: clamp(38px, 6vw, 72px) 0 12px;
}
.tool-hero h1 {
  margin: 0 0 16px; max-width: 16ch; font-size: clamp(38px, 4.6vw, 60px);
  line-height: 1.06; letter-spacing: -.055em; font-weight: 700;
}
.tool-hero h1 span { color: var(--primary); }
.tool-hero .sub { margin: 0; max-width: 54ch; font-size: 17px; line-height: 1.7; color: var(--ink-secondary); }
.tool-input { margin-top: 0; }
.field-row { display: flex; gap: 10px; }
.text-input {
  flex: 1; min-width: 0; min-height: 50px; padding: 0 16px; font: inherit; font-size: 15px;
  color: var(--ink); background: var(--canvas-soft); border: 1px solid var(--hairline); border-radius: 13px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.text-input::placeholder { color: var(--ink-faint); }
.text-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.tool-input .hint { margin: 12px 0 0; font-size: 13.5px; }
.tool-page > .back-link { margin: 26px 0 0; }

/* progress */
.progress-card {
  margin-top: 30px; padding: 22px 24px; background: var(--surface);
  border: 1px solid var(--hairline); border-radius: 20px; box-shadow: var(--shadow-1);
}
.progress-head { display: flex; align-items: center; gap: 14px; }
.progress-head .spinner { width: 22px; height: 22px; flex: none; }
.progress-text b { display: block; font-size: 17px; letter-spacing: -.02em; }
.progress-text span { display: block; color: var(--ink-muted); font-size: 14px; margin-top: 2px; }
.progress-bar { height: 6px; margin: 18px 0 14px; border-radius: 99px; background: var(--canvas-soft); overflow: hidden; }
.progress-bar span { display: block; height: 100%; width: 8%; border-radius: inherit;
  background: linear-gradient(90deg, #0b5dbb, #62aef0); transition: width .6s ease; }
.progress-steps { display: flex; gap: 8px; flex-wrap: wrap; margin: 0; padding: 0; list-style: none; }
.progress-steps li {
  font-size: 12.5px; font-weight: 650; color: var(--ink-faint); padding: 5px 11px;
  border-radius: var(--r-full); border: 1px solid var(--hairline); background: var(--canvas-soft);
}
.progress-steps li.current { color: var(--primary); border-color: var(--primary-tint-border); background: var(--primary-tint); }
.progress-steps li.done { color: var(--accent-green); }
.progress-steps li.done::before { content: "✓ "; }

.recent-section { margin-top: 44px; }
.title-sub { font-size: .5em; font-weight: 600; letter-spacing: -.01em; color: var(--ink-muted); margin-left: 6px; }

/* stat tiles */
.stat-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin: 22px 0; }
.stat-grid.wide { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.stat-tile {
  display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 18px 18px 16px;
  background: var(--surface); border: 1px solid var(--hairline); border-radius: 18px; box-shadow: var(--shadow-1);
}
.stat-label { font-size: 11px; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-muted); }
.stat-value { font-size: clamp(24px, 2.4vw, 32px); font-weight: 750; letter-spacing: -.04em; line-height: 1.15; color: var(--ink); }
.stat-sub { font-size: 12.5px; color: var(--ink-muted); overflow-wrap: anywhere; }

.delta { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: var(--r-full); white-space: nowrap; }
.delta.up { color: #137a32; background: #e7f7ec; }
.delta.down { color: #b3261e; background: #fdecec; }
.delta.flat { color: var(--ink-muted); background: var(--canvas-soft); }
html[data-theme="dark"] .delta.up { color: #7ed79b; background: #173524; }
html[data-theme="dark"] .delta.down { color: #f0a8a3; background: #3a1f1e; }
.muted { color: var(--ink-faint); }

/* status badges (audit labels, tracker verdicts) */
.status-badge {
  display: inline-block; font-size: 11.5px; font-weight: 700; padding: 3px 9px;
  border-radius: var(--r-full); white-space: nowrap;
}
.s-viral { color: #6b3fa0; background: #f3eefb; }
.s-top { color: #137a32; background: #e7f7ec; }
.s-good { color: var(--primary); background: var(--primary-tint); }
.s-avg { color: #9a5b00; background: #fff4e0; }
.s-weak { color: #b3261e; background: #fdecec; }
.s-none { color: var(--ink-muted); background: var(--canvas-soft); }
html[data-theme="dark"] .s-viral { color: #cbabf2; background: #2a2342; }
html[data-theme="dark"] .s-top { color: #7ed79b; background: #173524; }
html[data-theme="dark"] .s-avg { color: #f0c073; background: #3a2f15; }
html[data-theme="dark"] .s-weak { color: #f0a8a3; background: #3a1f1e; }
.type-tag {
  display: inline-block; font-size: 11.5px; font-weight: 650; padding: 2px 8px; border-radius: 7px;
  color: var(--ink-secondary); background: var(--canvas-soft); border: 1px solid var(--hairline); white-space: nowrap;
}

/* insight cards */
.insight-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.insight-card {
  padding: 22px 24px; background: var(--surface); border: 1px solid var(--hairline);
  border-radius: 20px; box-shadow: var(--shadow-1); border-top: 4px solid var(--primary);
}
.insight-card.good { border-top-color: var(--accent-green); }
.insight-card.warn { border-top-color: var(--accent-orange); }
.insight-card.plan { margin: 16px 0 24px; border-top-color: #6b3fa0; }
.insight-card h3 { margin: 0 0 14px; font-size: 17px; letter-spacing: -.02em; }
.facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.facts li { display: grid; gap: 1px; padding-bottom: 12px; border-bottom: 1px dashed var(--hairline); }
.facts li:last-child { border-bottom: 0; padding-bottom: 0; }
.fact-label { font-size: 11px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); }
.facts b { font-size: 16px; color: var(--ink); overflow-wrap: anywhere; }
.facts small { font-size: 13px; color: var(--ink-muted); }
.plan-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 14px 24px; }
.plan-list li { display: flex; gap: 12px; align-items: flex-start; }
.plan-list .s-num { background: #6b3fa0; margin-top: 1px; }
.plan-list b { display: block; font-size: 15px; }
.plan-list p { margin: 3px 0 0; font-size: 14px; color: var(--ink-secondary); line-height: 1.5; }
html[data-theme="dark"] .insight-card.plan { border-top-color: #cbabf2; }
html[data-theme="dark"] .plan-list .s-num { background: #8f6cc4; }

/* data tables */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th {
  position: sticky; top: 0; text-align: left; padding: 11px 14px; white-space: nowrap;
  font-size: 11px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-muted); background: var(--canvas-soft); border-bottom: 1px solid var(--hairline);
}
.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--hairline); vertical-align: top; color: var(--ink-secondary); }
.data-table tbody tr:hover td { background: color-mix(in srgb, var(--primary-tint) 55%, transparent); }
.data-table tr.hilite td { background: var(--primary-tint); }
.data-table tr.in-progress td { color: var(--ink-muted); }
.data-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.data-table.compact td, .data-table.compact th { padding: 9px 12px; }
.cell-main { display: block; color: var(--ink); font-weight: 600; white-space: nowrap; }
.cell-sub { display: block; font-size: 12px; color: var(--ink-faint); margin-top: 1px; }
.cell-caption { max-width: 300px; min-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-caption.wide { max-width: 520px; white-space: normal; }
.row-link { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: var(--ink-muted); }
.row-link:hover { color: var(--primary); background: var(--primary-tint); }
.row-link svg { width: 15px; height: 15px; }
.result-card.tabbed > .rc-panel > .table-wrap { max-height: 640px; }
html[data-theme="dark"] .data-table th { background: #203248; }

/* bars */
.bar-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px 32px; }
.bar-block h4 { margin: 0 0 12px; font-size: 12px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); }
.bar-row { display: grid; grid-template-columns: minmax(110px, 38%) 1fr auto; align-items: center; gap: 12px; padding: 6px 0; }
.bar-label { font-size: 14px; font-weight: 600; color: var(--ink); }
.bar-label small { display: block; font-size: 12px; font-weight: 500; color: var(--ink-faint); }
.bar-track { height: 10px; border-radius: 99px; background: var(--canvas-soft); border: 1px solid var(--hairline); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: inherit; background: #9dc4ee; }
.bar-row.best .bar-fill { background: var(--primary); }
.bar-row.best .bar-label { color: var(--primary); }
.bar-value { font-size: 13.5px; font-weight: 700; color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.bar-value small { font-weight: 500; color: var(--ink-faint); }
html[data-theme="dark"] .bar-fill { background: #3f6f9c; }

/* transcripts */
.tx-list { display: grid; gap: 8px; }
.tx-item { border: 1px solid var(--hairline); border-radius: 14px; background: var(--canvas); }
.tx-item > summary { display: flex; align-items: center; gap: 10px; padding: 12px 16px; cursor: pointer; list-style: none; }
.tx-item > summary::-webkit-details-marker { display: none; }
.tx-hook { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-source { font-size: 11.5px; font-weight: 700; color: var(--ink-faint); }
.tx-source.spoken { color: var(--accent-teal); }
.tx-item .source-text { margin: 0 16px; }
.tx-open { display: inline-flex; align-items: center; gap: 6px; margin: 10px 16px 14px; font-size: 13px; font-weight: 650; }
.tx-open svg { width: 13px; height: 13px; }

/* tracker */
.tracker-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.tracker-actions .btn { min-height: 44px; font-size: 15px; padding: 9px 18px; }
.profile-card {
  position: relative; overflow: hidden; color: #eff6ff; padding: 24px 26px;
  background: linear-gradient(147deg, #102e61, #0b5dbb 75%, #317fcb);
  border: 1px solid rgba(255,255,255,.18); border-radius: 28px; box-shadow: 0 28px 64px rgba(7,69,145,.22);
}
.profile-card::before {
  content: ""; position: absolute; width: 260px; height: 260px; right: -95px; top: -110px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.2); box-shadow: 0 0 0 45px rgba(255,255,255,.04), 0 0 0 90px rgba(255,255,255,.035);
  pointer-events: none;
}
.profile-card-top { position: relative; display: flex; align-items: center; gap: 10px; padding-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,.2); font-size: 12px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.profile-card-body { display: grid; gap: 12px; padding-top: 18px; }
.pc-followers { position: relative; padding: 18px 0 12px; }
.pc-followers b { display: block; font-size: clamp(38px, 4vw, 52px); letter-spacing: -.05em; line-height: 1; }
.pc-followers span { display: flex; align-items: center; gap: 8px; margin-top: 6px; color: #cee4ff; font-size: 14px; }
.profile-card .delta.up { color: #0d4d23; background: #9ff0bb; }
.profile-card .delta.down { color: #6d1510; background: #ffc2bd; }
.profile-card .delta.flat { color: #d9eafa; background: rgba(255,255,255,.14); }
.pc-row { position: relative; display: flex; justify-content: space-between; gap: 12px; padding: 9px 0;
  border-top: 1px solid rgba(255,255,255,.14); font-size: 14px; }
.pc-row span { color: #cee4ff; }
.pc-row b { text-align: right; }
.pc-foot { position: relative; margin-top: 10px; font-size: 12px; color: #b6d5f5; }
.pc-empty { position: relative; color: #d9eafa; margin: 16px 0; }
html[data-theme="dark"] .profile-card { background: linear-gradient(145deg, #1a3b62, #225c99); box-shadow: 0 22px 50px rgba(0,0,0,.27); }

.run-banner {
  display: flex; gap: 14px; align-items: flex-start; margin-top: 24px; padding: 16px 20px;
  border-radius: 16px; border: 1px solid var(--primary-tint-border); background: var(--primary-tint);
}
.run-banner b { display: block; color: var(--ink); }
.run-banner span { display: block; font-size: 14px; color: var(--ink-secondary); margin-top: 2px; }
.run-banner .spinner { flex: none; margin-top: 2px; }
.run-banner.failed { background: color-mix(in srgb, var(--accent-orange) 8%, var(--surface));
  border-color: color-mix(in srgb, var(--accent-orange) 30%, transparent); }
.run-banner.failed b { color: var(--accent-orange); }

.section-block { margin: 34px 0 8px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; }
.section-head h2 { margin: 0; font-size: clamp(22px, 2.4vw, 28px); letter-spacing: -.04em; }
.section-note { font-size: 13.5px; color: var(--ink-muted); font-weight: 600; }
.section-block .stat-grid { margin: 16px 0 10px; }
.fine-print { margin: 0 0 16px; font-size: 13px; line-height: 1.55; color: var(--ink-muted); }
.section-block .fine-print { margin: 0; }
.tracker-body .result-card { margin-top: 26px; }
.hist-empty.big { padding: 56px 24px; margin-top: 28px; font-size: 15px; }

.week-block { border: 1px solid var(--hairline); border-radius: 16px; background: var(--canvas); margin-bottom: 12px; overflow: hidden; }
.week-block > summary { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 14px 18px; cursor: pointer; list-style: none; }
.week-block > summary::-webkit-details-marker { display: none; }
.week-block > summary::before { content: "▸"; color: var(--ink-faint); }
.week-block[open] > summary::before { content: "▾"; }
.week-block > summary b { font-size: 15px; }
.week-sum { margin-left: auto; font-size: 13px; color: var(--ink-muted); }
.week-block .table-wrap { border-top: 1px solid var(--hairline); }

.trend-chart { margin: 0 0 22px; padding: 16px 18px; border: 1px solid var(--hairline); border-radius: 16px; background: var(--canvas); }
.trend-chart figcaption { font-size: 12px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 10px; }
.trend-chart svg { display: block; width: 100%; height: 150px; overflow: visible; }
.trend-line { fill: none; stroke: var(--primary); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.trend-area { fill: var(--primary-tint); }
.trend-dot { fill: var(--surface); stroke: var(--primary); stroke-width: 2; vector-effect: non-scaling-stroke; }
.trend-scale { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-faint); margin-top: 6px; }

@media (max-width: 1100px) {
  .stat-grid.wide { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .tool-hero { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .insight-grid, .bar-grid, .plan-list { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .stat-grid, .stat-grid.wide { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-tile { padding: 14px; }
  .field-row { flex-direction: column; }
  .field-row .btn { justify-content: center; }
  .tracker-actions .btn { flex: 1 1 auto; justify-content: center; }
  .insight-card { padding: 18px; }
  .bar-row { grid-template-columns: 1fr auto; }
  .bar-row .bar-track { grid-column: 1 / -1; grid-row: 2; }
  .week-sum { margin-left: 0; width: 100%; }
}

/* Profile Audit: profile strip, verified mark, table note */
.profile-strip {
  margin: 18px 0 0; padding: 16px 20px; background: var(--surface);
  border: 1px solid var(--hairline); border-radius: 18px; box-shadow: var(--shadow-1);
}
.ps-stats { display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 14px; color: var(--ink-muted); }
.ps-stats b { color: var(--ink); font-weight: 700; }
.ps-bio { margin: 10px 0 0; font-size: 14px; line-height: 1.55; color: var(--ink-secondary); white-space: pre-line; }
.ps-link { display: inline-block; margin-top: 8px; font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.verified { color: var(--primary); font-size: .6em; vertical-align: middle; }
.table-note { margin: 0; padding: 14px 18px; border-bottom: 1px solid var(--hairline); }
