/* ==========================================================================
   TopWapi — design system
   Mobile-first, single stylesheet, no build step, no render-blocking fonts.
   ========================================================================== */

/* ---------------------------------------------------------------- tokens */
:root {
  --violet-50:  #f5f3ff;
  --violet-100: #ede9fe;
  --violet-200: #ddd6fe;
  --violet-300: #c4b5fd;
  --violet-400: #a78bfa;
  --violet-500: #8b5cf6;
  --violet-600: #7c3aed;
  --violet-700: #6d28d9;
  --indigo-500: #6366f1;
  --indigo-600: #4f39f6;
  --indigo-700: #4338ca;

  --ink-900: #0b1020;
  --ink-800: #151b2e;
  --ink-700: #232a41;
  --ink-600: #3b4358;
  --ink-500: #5a6379;
  --ink-400: #7c859b;
  --ink-300: #a3abbd;
  --ink-200: #ccd2de;
  --ink-100: #e6e9f0;
  --ink-50:  #f4f6fa;

  --red-500: #e5484d;
  --red-50:  #fef2f2;
  --amber-500: #f59e0b;
  --amber-50: #fffbeb;
  --green-500: #16a34a;
  --green-50: #f0fdf4;
  --cyan-500: #06b6d4;

  --bg: #ffffff;
  --bg-soft: #f7f8fc;
  --bg-elevated: #ffffff;
  --bg-inset: #f2f4f9;
  --border: #e6e9f0;
  --border-strong: #d3d8e4;
  --text: var(--ink-900);
  --text-muted: var(--ink-500);
  --text-subtle: var(--ink-400);

  --brand: var(--indigo-600);
  --brand-hover: var(--indigo-700);
  --brand-soft: var(--violet-50);
  --brand-contrast: #ffffff;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 26px;
  --radius-pill: 999px;

  --shadow-xs: 0 1px 2px rgba(11, 16, 32, .05);
  --shadow-sm: 0 1px 3px rgba(11, 16, 32, .07), 0 1px 2px rgba(11, 16, 32, .04);
  --shadow: 0 4px 14px rgba(11, 16, 32, .07), 0 1px 3px rgba(11, 16, 32, .05);
  --shadow-lg: 0 18px 40px -12px rgba(11, 16, 32, .16), 0 4px 12px rgba(11, 16, 32, .05);
  --shadow-brand: 0 10px 30px -10px rgba(79, 57, 246, .45);

  --grad-brand: linear-gradient(135deg, #4f39f6 0%, #7c3aed 55%, #a855f7 100%);
  --grad-brand-soft: linear-gradient(135deg, #f5f3ff 0%, #eef2ff 60%, #f0f9ff 100%);
  --grad-gold: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);

  --shell: 1200px;
  --gutter: 1.15rem;
  --header-h: 62px;

  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --ease: cubic-bezier(.32, .72, 0, 1);
  --dur: .22s;
}

[data-theme="dark"] {
  --bg: #0b1020;
  --bg-soft: #0f1526;
  --bg-elevated: #141b30;
  --bg-inset: #1a2238;
  --border: #232c45;
  --border-strong: #313c5a;
  --text: #f2f4f9;
  --text-muted: #a2abc2;
  --text-subtle: #7c869e;

  --brand: #8b83f7;
  --brand-hover: #a39bfa;
  --brand-soft: #1b1f3a;
  --brand-contrast: #0b1020;

  --ink-50: #171f36;
  --ink-100: #1e2740;
  --red-50: #2a1618;
  --amber-50: #2a2110;
  --green-50: #10261a;
  --grad-brand-soft: linear-gradient(135deg, #171b33 0%, #161a2e 60%, #14202b 100%);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .45);
  --shadow: 0 6px 18px rgba(0, 0, 0, .45);
  --shadow-lg: 0 24px 50px -16px rgba(0, 0, 0, .65);
  --shadow-brand: 0 10px 30px -12px rgba(139, 131, 247, .4);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.62;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/*
 * Media defaults.
 *
 * `height: auto` is right for <img> and <video>, which carry intrinsic
 * dimensions. It is WRONG for inline icons: an icon has only a viewBox and no
 * intrinsic size, so `height: auto` collapses it to its default 300x150 ratio
 * (or to zero) unless every ancestor chain happens to set an explicit height.
 * That made bare icons — ones dropped straight into a heading or a meta line,
 * with no wrapper class — render at the wrong size at every breakpoint.
 *
 * So: apply the fit rules to replaced elements only, and give icons a sane
 * square default that any explicit rule can still override.
 */
img, video { max-width: 100%; height: auto; display: block; }

/* Icons get a square default size so they can never collapse. */
svg { flex-shrink: 0; }
.icon,
svg:not([class]) {
  width: 1em;
  height: 1em;
}

h1, h2, h3, h4, h5 {
  margin: 0 0 .5em;
  line-height: 1.2;
  letter-spacing: -.021em;
  font-weight: 700;
  color: var(--text);
}
h1 { font-size: clamp(1.85rem, 1.3rem + 2.6vw, 3.1rem); }
h2 { font-size: clamp(1.42rem, 1.1rem + 1.5vw, 2.1rem); }
h3 { font-size: clamp(1.1rem, 1rem + .5vw, 1.35rem); }
h4 { font-size: 1.05rem; }

p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }

a { color: var(--brand); text-decoration: none; transition: color var(--dur) var(--ease); }
a:hover { color: var(--brand-hover); }

ul, ol { margin: 0 0 1.1em; padding-left: 1.3em; }
li { margin-bottom: .4em; }

button { font: inherit; color: inherit; }

input, select, textarea, button { font-family: inherit; font-size: 1rem; }

code {
  font-family: var(--font-mono);
  font-size: .875em;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: .12em .4em;
}

pre {
  background: var(--ink-900);
  color: #e8eaf2;
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  overflow-x: auto;
  font-size: .82rem;
  line-height: 1.7;
  margin: 0 0 1.3em;
  border: 1px solid rgba(255, 255, 255, .07);
}
[data-theme="dark"] pre { background: #05080f; }
pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }

blockquote {
  margin: 0 0 1.4em;
  padding: .9rem 1.2rem;
  border-left: 3px solid var(--brand);
  background: var(--brand-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 1.03rem;
  color: var(--text);
}
blockquote p:last-child { margin: 0; }

hr { border: 0; border-top: 1px solid var(--border); margin: 2.4rem 0; }

::selection { background: var(--violet-200); color: var(--ink-900); }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------------------------------------------------------------- layout */
.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding: clamp(2.4rem, 1.4rem + 3vw, 4.6rem) 0; }
.section-soft { background: var(--bg-soft); }
.section-tight { padding: clamp(1.6rem, 1rem + 2vw, 2.6rem) 0; }

.stack > * + * { margin-top: var(--stack, 1rem); }

.grid { display: grid; gap: 1.1rem; }
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }

.center { text-align: center; }
.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); }
.small { font-size: .875rem; }
.tiny { font-size: .78rem; }
.strong { font-weight: 650; }
.mono { font-family: var(--font-mono); }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2.2rem; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  padding: .7rem 1.1rem; background: var(--brand); color: #fff;
  border-radius: 0 0 var(--radius) 0; font-weight: 600;
}
.skip-link:focus { left: 0; }

/* --------------------------------------------------------------- headers */
.site-header {
  position: sticky; top: 0; z-index: 90;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
@supports not (backdrop-filter: blur(1px)) { .site-header { background: var(--bg); } }

.header-inner {
  display: flex; align-items: center; gap: .75rem;
  min-height: var(--header-h);
}

.brand { display: inline-flex; align-items: center; gap: .55rem; color: var(--text); font-weight: 700; }
.brand:hover { color: var(--text); }
.brand-mark { width: 30px; height: 30px; flex-shrink: 0; }
.brand-mark svg { width: 100%; height: 100%; border-radius: 9px; }
.brand-text { font-size: 1.16rem; letter-spacing: -.03em; }
.brand-text strong { font-weight: 800; }
.brand-sm .brand-text { font-size: 1rem; }

.main-nav { display: none; }
.main-nav a {
  color: var(--text-muted); font-weight: 500; font-size: .92rem;
  padding: .45rem .6rem; border-radius: var(--radius-sm);
  transition: color var(--dur), background var(--dur);
}
.main-nav a:hover { color: var(--text); background: var(--bg-inset); }
.main-nav a[aria-current="page"] { color: var(--brand); background: var(--brand-soft); font-weight: 620; }

.header-actions { display: flex; align-items: center; gap: .4rem; margin-left: auto; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: transparent;
  color: var(--text-muted); cursor: pointer;
  transition: background var(--dur), color var(--dur);
}
.icon-btn:hover { background: var(--bg-inset); color: var(--text); }
.icon-btn svg { width: 20px; height: 20px; }

.nav-toggle { display: inline-grid; }
.nav-toggle .nav-toggle-close { display: none; }
.nav-toggle[aria-expanded="true"] .nav-toggle-open { display: none; }
.nav-toggle[aria-expanded="true"] .nav-toggle-close { display: inline; }

.search-bar { border-top: 1px solid var(--border); background: var(--bg); }
.search-bar[hidden] { display: none; }
.search-form { display: flex; align-items: center; gap: .6rem; padding: .7rem var(--gutter); position: relative; }
.search-form .search-icon { width: 18px; height: 18px; color: var(--text-subtle); flex-shrink: 0; }
.search-form input {
  flex: 1; min-width: 0; border: 1px solid var(--border-strong);
  background: var(--bg-inset); color: var(--text);
  border-radius: var(--radius-sm); padding: .6rem .8rem;
}
.search-form input:focus { border-color: var(--brand); background: var(--bg); }

.header-ticker {
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  overflow-x: auto;
  scrollbar-width: none;
}
.header-ticker::-webkit-scrollbar { display: none; }
.ticker-inner {
  display: flex; align-items: center; gap: 1.5rem;
  padding-top: .4rem; padding-bottom: .4rem;
  min-width: max-content;
}
.ticker-item { display: inline-flex; align-items: baseline; gap: .4rem; font-size: .76rem; white-space: nowrap; }
.ticker-label { color: var(--text-subtle); }
.ticker-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.ticker-trend { display: inline-flex; align-items: center; gap: .12rem; font-weight: 600; }
.ticker-trend svg { width: 11px; height: 11px; }
.ticker-trend.up { color: var(--green-500); }
.ticker-trend.down { color: var(--red-500); }

/* Mobile nav drawer */
body.nav-open { overflow: hidden; }
@media (max-width: 899px) {
  .main-nav {
    display: flex; flex-direction: column;
    position: fixed; inset: var(--header-h) 0 0 0;
    background: var(--bg); padding: 1.2rem var(--gutter) 3rem;
    gap: .2rem; z-index: 80;
    transform: translateY(-8px); opacity: 0; pointer-events: none;
    transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
    overflow-y: auto;
  }
  .main-nav.is-open { opacity: 1; transform: none; pointer-events: auto; }
  .main-nav a { font-size: 1.12rem; padding: .85rem .8rem; }
  .header-actions .btn-ghost { display: none; }
}

@media (min-width: 900px) {
  :root { --header-h: 66px; }
  .main-nav { display: flex; align-items: center; gap: .15rem; margin-left: 1.4rem; }
  .nav-toggle { display: none; }
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* -------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .68rem 1.15rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-weight: 620; font-size: .93rem; line-height: 1.2;
  cursor: pointer; text-align: center;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur), background var(--dur), color var(--dur), border-color var(--dur);
  white-space: nowrap;
  text-decoration: none;
}
.btn svg { width: 17px; height: 17px; flex-shrink: 0; }
.btn:active { transform: translateY(1px) scale(.995); }
.btn-sm { padding: .48rem .85rem; font-size: .845rem; }
.btn-sm svg { width: 15px; height: 15px; }
.btn-lg { padding: .88rem 1.6rem; font-size: 1.02rem; }
.btn-block { display: flex; width: 100%; }

.btn-primary {
  background: var(--brand); color: #fff;
  box-shadow: var(--shadow-brand);
}
.btn-primary:hover { background: var(--brand-hover); color: #fff; transform: translateY(-1px); }

.btn-gradient { background: var(--grad-brand); color: #fff; box-shadow: var(--shadow-brand); }
.btn-gradient:hover { color: #fff; transform: translateY(-1px); filter: brightness(1.06); }

.btn-outline {
  background: transparent; color: var(--text);
  border-color: var(--border-strong);
}
.btn-outline:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }

.btn-ghost { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover { background: var(--bg-inset); color: var(--text); }

.btn-light { background: var(--bg); color: var(--text); border-color: var(--border); box-shadow: var(--shadow-xs); }
.btn-light:hover { border-color: var(--brand); color: var(--brand); }

.btn[disabled], .btn.is-loading { opacity: .6; pointer-events: none; }
.btn.is-loading::after {
  content: ''; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn-row { display: flex; flex-wrap: wrap; gap: .7rem; }
.btn-row .btn { flex: 1 1 auto; min-width: 150px; }
@media (min-width: 620px) { .btn-row .btn { flex: 0 0 auto; min-width: 0; } }

/* ----------------------------------------------------------------- cards */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  box-shadow: var(--shadow-xs);
}
.card-pad-lg { padding: clamp(1.35rem, 1rem + 1.4vw, 2.1rem); }
.card-hover { transition: transform var(--dur) var(--ease), box-shadow var(--dur), border-color var(--dur); }
.card-hover:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.card-flush { padding: 0; overflow: hidden; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: .8rem; margin-bottom: 1rem; flex-wrap: wrap;
}
.card-head h2, .card-head h3 { margin: 0; }
.card-title-sm { font-size: 1.02rem; }

/*
 * Inline icons in plain headings and meta lines.
 *
 * These icons are emitted as bare <svg viewBox> with no wrapper class, so
 * nothing sized them and they collapsed. They are also inline-level boxes: a
 * bare svg on the text baseline leaves a descender gap and sits too low against
 * the cap height. So each rule sizes the icon AND nudges it onto the optical
 * centre of the text run. Keep them em-based so they scale with the type.
 */
.card-title-sm svg { width: 1em; height: 1em; vertical-align: -.12em; color: var(--brand); }
.article-card-meta svg { width: 1em; height: 1em; vertical-align: -.1em; }
.hero-visual-head h3 svg { width: 1em; height: 1em; vertical-align: -.12em; color: var(--brand); }
/* panel-inset headings — signin "Try the demo platform" and similar callouts */
.panel-inset h3 svg { width: 1em; height: 1em; vertical-align: -.12em; color: var(--brand); }
.panel-inset p svg { width: 1em; height: 1em; vertical-align: -.12em; color: var(--text-subtle); }

.panel-inset {
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}

/* ----------------------------------------------------------------- badges */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .72rem; font-weight: 680; letter-spacing: .015em;
  padding: .24rem .55rem; border-radius: var(--radius-pill);
  background: var(--bg-inset); color: var(--text-muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.badge svg { width: 12px; height: 12px; }
.badge-brand { background: var(--brand-soft); color: var(--brand); border-color: color-mix(in srgb, var(--brand) 26%, transparent); }
.badge-success { background: var(--green-50); color: var(--green-500); border-color: color-mix(in srgb, var(--green-500) 24%, transparent); }
.badge-warn { background: var(--amber-50); color: #b45309; border-color: color-mix(in srgb, var(--amber-500) 30%, transparent); }
.badge-danger { background: var(--red-50); color: var(--red-500); border-color: color-mix(in srgb, var(--red-500) 24%, transparent); }
.badge-gold { background: var(--grad-gold); color: #fff; border-color: transparent; }

.tag {
  display: inline-block; font-size: .72rem; color: var(--text-subtle);
  background: var(--bg-inset); border-radius: var(--radius-pill);
  padding: .16rem .52rem; border: 1px solid var(--border);
}

.verified {
  display: inline-grid; place-items: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--brand); color: #fff; vertical-align: middle;
}
.verified svg { width: 11px; height: 11px; }

/* ---------------------------------------------------------------- alerts */
.alert {
  border-radius: var(--radius);
  padding: .85rem 1rem;
  font-size: .9rem;
  border: 1px solid var(--border);
  background: var(--bg-inset);
  margin-bottom: 1rem;
}
.alert-info { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 24%, transparent); color: var(--text); }
.alert-success { background: var(--green-50); border-color: color-mix(in srgb, var(--green-500) 26%, transparent); color: var(--green-500); font-weight: 560; }
.alert-warn { background: var(--amber-50); border-color: color-mix(in srgb, var(--amber-500) 30%, transparent); color: #92400e; }
.alert-error { background: var(--red-50); border-color: color-mix(in srgb, var(--red-500) 26%, transparent); color: var(--red-500); }
.alert[hidden] { display: none; }

/* ----------------------------------------------------------------- forms */
.form-grid { display: grid; gap: 1.05rem; }
.form-row { display: grid; gap: 1.05rem; }
@media (min-width: 640px) { .form-row-2 { grid-template-columns: 1fr 1fr; } }

.field { display: flex; flex-direction: column; gap: .35rem; }
.field label { font-weight: 600; font-size: .875rem; }
.field .hint { font-size: .79rem; color: var(--text-subtle); }
.field .counter { font-size: .74rem; color: var(--text-subtle); text-align: right; font-variant-numeric: tabular-nums; }
.field .counter.over { color: var(--red-500); }

.input, .select, .textarea {
  width: 100%;
  padding: .68rem .82rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  transition: border-color var(--dur), box-shadow var(--dur), background var(--dur);
}
.input::placeholder, .textarea::placeholder { color: var(--text-subtle); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}
.textarea { min-height: 108px; resize: vertical; line-height: 1.55; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-subtle) 50%), linear-gradient(135deg, var(--text-subtle) 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 2.2rem; }

.field.has-error .input, .field.has-error .select, .field.has-error .textarea {
  border-color: var(--red-500);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--red-500) 14%, transparent);
}
.field-error { font-size: .79rem; color: var(--red-500); font-weight: 560; }
.field-error[hidden] { display: none; }

.input-group { display: flex; gap: .5rem; align-items: stretch; }
.input-group .input { flex: 1; min-width: 0; }
.input-group .btn { flex-shrink: 0; }

.checkbox { display: flex; gap: .6rem; align-items: flex-start; font-size: .875rem; }
.checkbox input { width: 18px; height: 18px; margin-top: .16rem; accent-color: var(--brand); flex-shrink: 0; }
.checkbox span { color: var(--text-muted); }

.password-strength { display: flex; gap: .3rem; margin-top: .2rem; }
.password-strength i { flex: 1; height: 4px; border-radius: 2px; background: var(--border); transition: background var(--dur); }
.password-strength[data-score="1"] i:nth-child(1) { background: var(--red-500); }
.password-strength[data-score="2"] i:nth-child(-n+2) { background: var(--amber-500); }
.password-strength[data-score="3"] i:nth-child(-n+3) { background: #84cc16; }
.password-strength[data-score="4"] i { background: var(--green-500); }

/* ------------------------------------------------------------- site cards */
.site-list { display: flex; flex-direction: column; gap: .9rem; }

.site-card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: .9rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.05rem;
  box-shadow: var(--shadow-xs);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur), border-color var(--dur);
}
.site-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.site-card.is-featured { border-color: color-mix(in srgb, var(--brand) 34%, var(--border)); }
.site-card.is-featured::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--grad-brand);
}

.site-card-rank { display: flex; align-items: center; gap: .5rem; }
.rank-badge {
  display: inline-flex; align-items: center; gap: .3rem;
  font-weight: 800; font-size: .84rem;
  padding: .28rem .62rem; border-radius: var(--radius-pill);
  background: var(--bg-inset); color: var(--text-muted);
  border: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.rank-badge svg { width: 13px; height: 13px; }
.rank-badge.top-1 { background: var(--grad-gold); color: #fff; border-color: transparent; box-shadow: 0 4px 12px -4px rgba(245, 158, 11, .6); }
.rank-badge.top-2 { background: linear-gradient(135deg, #94a3b8, #64748b); color: #fff; border-color: transparent; }
.rank-badge.top-3 { background: linear-gradient(135deg, #d97706, #b45309); color: #fff; border-color: transparent; }
.rank-score { font-size: .76rem; color: var(--text-subtle); font-variant-numeric: tabular-nums; }

.site-card-head { display: flex; gap: .8rem; align-items: flex-start; }
.site-favicon {
  width: 46px; height: 46px; flex-shrink: 0;
  border-radius: var(--radius); overflow: hidden;
  background: var(--bg-inset); border: 1px solid var(--border);
  display: grid; place-items: center;
}
.site-favicon img { width: 100%; height: 100%; object-fit: contain; padding: 5px; }
.fav-fallback {
  width: 100%; height: 100%; display: grid; place-items: center;
  font-weight: 800; font-size: 1.15rem; color: #fff;
  background: var(--grad-brand);
}
.site-card-title { min-width: 0; flex: 1; }
.site-card-title h3 { margin: 0 0 .18rem; font-size: 1.06rem; line-height: 1.3; }
.site-title-link { color: var(--text); }
.site-title-link:hover { color: var(--brand); }
.site-domain { margin: 0; font-size: .8rem; color: var(--text-subtle); }
.site-domain a { color: var(--text-subtle); }
.site-domain a:hover { color: var(--brand); }

.site-desc { margin: .7rem 0 0; font-size: .92rem; color: var(--text-muted); line-height: 1.6; }
.site-tags { display: flex; flex-wrap: wrap; gap: .32rem; margin-top: .6rem; }

.site-metrics {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: .5rem .7rem; margin: .9rem 0 0;
  padding: .75rem .85rem;
  background: var(--bg-inset); border-radius: var(--radius);
  border: 1px solid var(--border);
}
.site-metrics .metric { min-width: 0; }
.site-metrics dt { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-subtle); font-weight: 620; }
.site-metrics dd { margin: .1rem 0 0; font-weight: 700; font-size: .95rem; font-variant-numeric: tabular-nums; }

.site-card-actions { display: flex; flex-direction: column; gap: .45rem; }
.site-card-actions .btn-block { width: 100%; }
.site-card-updated {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .72rem; color: var(--text-subtle); justify-content: center;
}
.site-card-updated svg { width: 12px; height: 12px; }

@media (min-width: 760px) {
  .site-card { grid-template-columns: 118px 1fr 200px; align-items: start; padding: 1.2rem; }
  .site-card-rank { flex-direction: column; align-items: flex-start; gap: .4rem; }
  .site-desc { margin-top: .55rem; }
  .site-card-actions { align-self: stretch; justify-content: center; }
}

/* spotlight rows (top 3) */
.podium { display: grid; gap: 1rem; }
@media (min-width: 800px) { .podium { grid-template-columns: 1.25fr 1fr 1fr; align-items: stretch; } }

.spotlight {
  position: relative;
  display: flex; flex-direction: column; gap: .7rem;
  padding: 1.3rem;
  border-radius: var(--radius-xl);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.spotlight.rank-1 { background: var(--grad-brand); border-color: transparent; color: #fff; box-shadow: var(--shadow-brand); }
.spotlight.rank-1 .spotlight-title, .spotlight.rank-1 .spotlight-title a { color: #fff; }
.spotlight.rank-1 .spotlight-desc { color: rgba(255, 255, 255, .86); }
.spotlight.rank-1 .spotlight-domain { color: rgba(255, 255, 255, .7); }
.spotlight.rank-1 .spotlight-domain a { color: rgba(255, 255, 255, .8); }
.spotlight.rank-1 .spotlight-stat strong { color: #fff; }
.spotlight.rank-1 .spotlight-stat span { color: rgba(255, 255, 255, .72); }
.spotlight.rank-1 .rank-badge { background: rgba(255, 255, 255, .2); color: #fff; border-color: rgba(255, 255, 255, .3); }

.spotlight-crown { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.spotlight-title { margin: 0; font-size: 1.16rem; }
.spotlight-title a { color: var(--text); }
.spotlight-desc { margin: 0; font-size: .89rem; color: var(--text-muted); }
.spotlight-domain { margin: 0; font-size: .78rem; color: var(--text-subtle); }
.spotlight-stats { display: flex; gap: 1.1rem; margin-top: auto; padding-top: .8rem; border-top: 1px solid var(--border); }
.spotlight.rank-1 .spotlight-stats { border-color: rgba(255, 255, 255, .22); }
.spotlight-stat { display: flex; flex-direction: column; }
.spotlight-stat strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.spotlight-stat span { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-subtle); }

/* ---------------------------------------------------------- leaderboard head */
.leaderboard-toolbar {
  display: flex; flex-wrap: wrap; gap: .7rem; align-items: center;
  justify-content: space-between; margin-bottom: 1.2rem;
}
.filter-chips { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .2rem; scrollbar-width: none; }
.filter-chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .4rem .78rem; border-radius: var(--radius-pill);
  border: 1px solid var(--border); background: var(--bg);
  font-size: .82rem; font-weight: 560; color: var(--text-muted);
  white-space: nowrap; cursor: pointer; text-decoration: none;
  transition: all var(--dur) var(--ease);
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip .count { font-size: .72rem; opacity: .7; font-variant-numeric: tabular-nums; }

.sort-select { display: flex; align-items: center; gap: .4rem; font-size: .82rem; color: var(--text-muted); }
.sort-select .select { padding: .42rem 2rem .42rem .6rem; font-size: .84rem; width: auto; }

/* ------------------------------------------------------------ pagination */
.pagination {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: .5rem; margin-top: 1.8rem;
}
.page-numbers { display: flex; gap: .28rem; flex-wrap: wrap; justify-content: center; }
.page-link {
  display: inline-flex; align-items: center; gap: .3rem;
  min-width: 38px; height: 38px; padding: 0 .7rem;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg); color: var(--text-muted);
  font-size: .87rem; font-weight: 580; font-variant-numeric: tabular-nums;
  transition: all var(--dur) var(--ease);
}
.page-link svg { width: 15px; height: 15px; }
.page-link svg.flip { transform: rotate(180deg); }
.page-link:hover { border-color: var(--brand); color: var(--brand); }
.page-link.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.page-link.is-disabled { opacity: .4; pointer-events: none; }
.page-gap { display: inline-grid; place-items: center; width: 22px; color: var(--text-subtle); }
.page-summary { flex-basis: 100%; text-align: center; font-size: .79rem; color: var(--text-subtle); margin: .35rem 0 0; }

@media (min-width: 700px) {
  .pagination { justify-content: space-between; }
  .page-summary { flex-basis: auto; margin: 0 0 0 auto; }
}

/* ----------------------------------------------------------------- stats */
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
@media (min-width: 760px) { .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.stat-tile {
  display: flex; flex-direction: column; gap: .18rem;
  padding: 1rem 1.05rem;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  position: relative; overflow: hidden;
}
.stat-tile-icon {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  background: var(--brand-soft); color: var(--brand); margin-bottom: .3rem;
}
.stat-tile-icon svg { width: 17px; height: 17px; }
.stat-tile-label { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-subtle); font-weight: 620; }
.stat-tile-value { font-size: clamp(1.35rem, 1.1rem + .8vw, 1.8rem); font-weight: 780; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-tile-sub { font-size: .77rem; color: var(--text-subtle); }
.stat-tile.brand { background: var(--grad-brand); border-color: transparent; color: #fff; }
.stat-tile.brand .stat-tile-label { color: rgba(255, 255, 255, .78); }
.stat-tile.brand .stat-tile-icon { background: rgba(255, 255, 255, .18); color: #fff; }
.stat-tile.brand .stat-tile-sub { color: rgba(255, 255, 255, .78); }
.stat-tile.success .stat-tile-icon { background: var(--green-50); color: var(--green-500); }
.stat-tile.warn .stat-tile-icon { background: var(--amber-50); color: #b45309; }
.stat-tile.gold .stat-tile-icon { background: var(--amber-50); color: #b45309; }

.delta { font-weight: 620; font-size: .78rem; }
.delta.up { color: var(--green-500); }
.delta.down { color: var(--red-500); }

/* ---------------------------------------------------------------- tables */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 0 1.3em; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .875rem; min-width: 480px; }
th, td { text-align: left; padding: .62rem .8rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-weight: 660; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-subtle); background: var(--bg-inset); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--bg-soft); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ----------------------------------------------------------------- hero */
.hero {
  position: relative;
  padding: clamp(2.6rem, 1.6rem + 4vw, 5rem) 0 clamp(2rem, 1.4rem + 2.4vw, 3.4rem);
  background: var(--grad-brand-soft);
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.hero::before {
  content: ''; position: absolute; inset: -40% -10% auto -10%; height: 620px;
  background:
    radial-gradient(closest-side, color-mix(in srgb, var(--brand) 22%, transparent), transparent 70%) 18% 30%/46% 60% no-repeat,
    radial-gradient(closest-side, rgba(168, 85, 247, .18), transparent 70%) 82% 10%/40% 55% no-repeat;
  pointer-events: none;
}
.hero-inner { position: relative; }
.hero-grid { display: grid; gap: 2rem; align-items: center; }
@media (min-width: 980px) { .hero-grid { grid-template-columns: 1.05fr .95fr; gap: 3rem; } }

.hero-eyebrow {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .35rem .8rem; border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  border: 1px solid color-mix(in srgb, var(--brand) 26%, transparent);
  font-size: .8rem; font-weight: 620; color: var(--brand);
  backdrop-filter: blur(8px);
  margin-bottom: 1.1rem;
}
.hero-eyebrow svg { width: 14px; height: 14px; }
.hero h1 { margin-bottom: .7rem; }
.hero h1 .accent {
  background: var(--grad-brand);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.hero-lede { font-size: clamp(1rem, .95rem + .35vw, 1.15rem); color: var(--text-muted); max-width: 58ch; }

.hero-stats {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: .8rem; margin-top: 1.6rem;
}
@media (min-width: 560px) { .hero-stats { grid-template-columns: repeat(4, 1fr); } }
.hero-stat { }
.hero-stat strong { display: block; font-size: 1.28rem; font-weight: 780; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.hero-stat span { font-size: .75rem; color: var(--text-subtle); }

.hero-visual {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 1.1rem;
}
.hero-visual-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: .6rem; margin-bottom: .8rem;
}
.hero-visual-head h3 { margin: 0; font-size: .95rem; }
.mini-list { display: flex; flex-direction: column; gap: .5rem; }
.mini-row {
  display: grid; grid-template-columns: 26px 32px 1fr auto;
  gap: .6rem; align-items: center;
  padding: .48rem .55rem; border-radius: var(--radius);
  border: 1px solid transparent;
  transition: background var(--dur), border-color var(--dur);
}
.mini-row:hover { background: var(--bg-inset); border-color: var(--border); }
.mini-rank { font-size: .78rem; font-weight: 700; color: var(--text-subtle); text-align: center; font-variant-numeric: tabular-nums; }
.mini-fav { width: 30px; height: 30px; border-radius: 8px; overflow: hidden; background: var(--bg-inset); border: 1px solid var(--border); display: grid; place-items: center; }
.mini-fav img { width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.mini-info { min-width: 0; }
.mini-info b { display: block; font-size: .84rem; font-weight: 620; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-info span { font-size: .72rem; color: var(--text-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.mini-clicks { font-size: .8rem; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; text-align: right; }

/* --------------------------------------------------------------- feature */
.feature { display: flex; flex-direction: column; gap: .6rem; }
.feature-icon {
  display: inline-grid; place-items: center;
  width: 42px; height: 42px; border-radius: var(--radius);
  background: var(--brand-soft); color: var(--brand); border: 1px solid color-mix(in srgb, var(--brand) 20%, transparent);
}
.feature-icon svg { width: 21px; height: 21px; }
.feature h3 { margin: 0; font-size: 1.05rem; }
.feature p { margin: 0; font-size: .9rem; color: var(--text-muted); }

.step { position: relative; padding-left: 2.6rem; }
.step-num {
  position: absolute; left: 0; top: 0;
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--grad-brand); color: #fff;
  font-weight: 700; font-size: .85rem;
  box-shadow: var(--shadow-brand);
}
.step h3 { margin: .1rem 0 .35rem; font-size: 1.02rem; }
.step p { margin: 0; font-size: .9rem; color: var(--text-muted); }

/* ----------------------------------------------------------- page header */
.page-hero {
  padding: clamp(1.8rem, 1.2rem + 2.2vw, 3rem) 0 clamp(1.3rem, 1rem + 1.4vw, 2rem);
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
}
.page-hero h1 { margin-bottom: .5rem; }
.page-hero .lede { font-size: 1.04rem; color: var(--text-muted); max-width: 68ch; margin: 0; }

.breadcrumbs { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; font-size: .78rem; color: var(--text-subtle); margin-bottom: .8rem; }
.breadcrumbs a { color: var(--text-subtle); }
.breadcrumbs a:hover { color: var(--brand); }
.breadcrumbs span.sep { opacity: .55; }

.layout-sidebar { display: grid; gap: 2rem; }
@media (min-width: 1000px) { .layout-sidebar { grid-template-columns: minmax(0, 1fr) 312px; align-items: start; } }
.sidebar-sticky { display: flex; flex-direction: column; gap: 1rem; }
@media (min-width: 1000px) { .sidebar-sticky { position: sticky; top: calc(var(--header-h) + 1.2rem); } }

.toc {
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1rem 1.1rem;
}
.toc h4 { margin: 0 0 .5rem; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-subtle); }
.toc ol { margin: 0; padding-left: 1.1rem; font-size: .85rem; }
.toc li { margin-bottom: .3rem; }
.toc a { color: var(--text-muted); }
.toc a:hover { color: var(--brand); }
.toc a.is-active { color: var(--brand); font-weight: 620; }

/* --------------------------------------------------------------- prose */
.prose { font-size: 1.02rem; line-height: 1.76; color: var(--text); max-width: 74ch; }
.prose > * + * { margin-top: 1.15em; }
.prose h2 { margin-top: 2.2em; font-size: clamp(1.3rem, 1.1rem + 1vw, 1.7rem); scroll-margin-top: calc(var(--header-h) + 20px); }
.prose h3 { margin-top: 1.8em; font-size: 1.16rem; scroll-margin-top: calc(var(--header-h) + 20px); }
.prose h4 { margin-top: 1.4em; }
.prose ul, .prose ol { padding-left: 1.35em; }
.prose li { margin-bottom: .5em; }
.prose li > ul, .prose li > ol { margin-top: .5em; }
.prose img { border-radius: var(--radius); border: 1px solid var(--border); margin: 1.4em 0; }
.prose a { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--brand) 38%, transparent); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: var(--brand); }
.prose blockquote { margin: 1.6em 0; }
.prose table { min-width: 520px; }
.prose code { font-size: .85em; }

.article-header { margin-bottom: 1.6rem; padding-bottom: 1.4rem; border-bottom: 1px solid var(--border); }
.article-meta { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; font-size: .8rem; color: var(--text-subtle); margin-top: .8rem; }
.article-meta .dot { opacity: .5; }
/* The clock icon lives inside a <span>, not directly under .article-meta. */
.article-meta svg { width: 1em; height: 1em; vertical-align: -.1em; }

.article-card { display: flex; flex-direction: column; gap: .6rem; height: 100%; }
.article-card h3 { margin: 0; font-size: 1.06rem; line-height: 1.35; }
.article-card h3 a { color: var(--text); }
.article-card h3 a:hover { color: var(--brand); }
.article-card p { margin: 0; font-size: .89rem; color: var(--text-muted); flex: 1; }
.article-card-meta { font-size: .76rem; color: var(--text-subtle); display: flex; gap: .5rem; align-items: center; }

/* ------------------------------------------------------------------- faq */
.faq-list { display: flex; flex-direction: column; gap: .6rem; }
details.faq {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--bg-elevated); overflow: hidden;
  transition: border-color var(--dur);
}
details.faq[open] { border-color: color-mix(in srgb, var(--brand) 30%, var(--border)); }
details.faq summary {
  cursor: pointer; padding: 1rem 1.15rem;
  font-weight: 620; font-size: .98rem;
  display: flex; align-items: center; justify-content: space-between; gap: .8rem;
  list-style: none;
}
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after {
  content: ''; width: 9px; height: 9px; flex-shrink: 0;
  border-right: 2px solid var(--text-subtle); border-bottom: 2px solid var(--text-subtle);
  transform: rotate(45deg); transition: transform var(--dur) var(--ease);
  margin-top: -3px;
}
details.faq[open] summary::after { transform: rotate(-135deg); margin-top: 3px; }
details.faq .faq-body { padding: 0 1.15rem 1.15rem; font-size: .92rem; color: var(--text-muted); line-height: 1.68; }
details.faq .faq-body > * + * { margin-top: .8em; }

/* ----------------------------------------------------------- promo block */
.promo-card {
  position: relative;
  border-radius: var(--radius-xl);
  background: var(--grad-brand);
  color: #fff;
  padding: clamp(1.3rem, 1rem + 1.4vw, 2rem);
  box-shadow: var(--shadow-brand);
  overflow: hidden;
}
.promo-card::after {
  content: ''; position: absolute; right: -60px; top: -60px;
  width: 220px; height: 220px; border-radius: 50%;
  background: rgba(255, 255, 255, .12);
}
.promo-card h2, .promo-card h3 { color: #fff; }
.promo-card p { color: rgba(255, 255, 255, .86); }
.promo-card .promo-label { font-size: .76rem; text-transform: uppercase; letter-spacing: .07em; opacity: .8; font-weight: 620; }

.copy-row { display: flex; gap: .5rem; align-items: stretch; margin-top: .7rem; flex-wrap: wrap; }
.copy-row .copy-input {
  flex: 1 1 220px; min-width: 0;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .3);
  color: #fff; border-radius: var(--radius-sm);
  padding: .62rem .8rem; font-family: var(--font-mono); font-size: .82rem;
  text-overflow: ellipsis;
}
.copy-row .copy-input::placeholder { color: rgba(255, 255, 255, .6); }
.copy-row .btn { background: #fff; color: var(--indigo-700); border-color: transparent; }
.copy-row .btn:hover { background: rgba(255, 255, 255, .92); color: var(--indigo-700); }

.share-row { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .9rem; }
.share-btn {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .42rem .8rem; border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .28);
  color: #fff; font-size: .8rem; font-weight: 580; cursor: pointer;
  transition: background var(--dur);
}
.share-btn:hover { background: rgba(255, 255, 255, .26); color: #fff; }
.share-btn svg { width: 14px; height: 14px; }

/* -------------------------------------------------------------- dashboard */
.dash-layout { display: grid; gap: 1.6rem; }
@media (min-width: 1040px) { .dash-layout { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } }

.dash-tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--border); margin-bottom: 1.4rem; overflow-x: auto; scrollbar-width: none; }
.dash-tabs::-webkit-scrollbar { display: none; }
.dash-tab {
  padding: .7rem .95rem; border: 0; background: none; cursor: pointer;
  color: var(--text-muted); font-weight: 580; font-size: .9rem;
  border-bottom: 2px solid transparent; white-space: nowrap;
  transition: color var(--dur), border-color var(--dur);
}
.dash-tab:hover { color: var(--text); }
.dash-tab[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); }
.tab-panel[hidden] { display: none; }

.chart-box { position: relative; width: 100%; }
/*
 * The sparkline is injected with viewBox="0 0 260 56" and NO width/height
 * attributes, so it has no intrinsic size. `height: auto` on such an element
 * makes the browser fall back to the viewBox ratio applied to the *container*
 * width — which in a wide dashboard column produces an absurdly tall chart and
 * in a narrow tile squashes it flat. Giving it an explicit responsive height
 * (and letting preserveAspectRatio stretch the viewBox into it) keeps the line
 * legible at every breakpoint instead of scaling with the column width.
 */
.chart-svg {
  display: block;
  width: 100%;
  height: clamp(56px, 18vw, 96px);
  overflow: visible;
}
.chart-legend { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: .7rem; font-size: .78rem; color: var(--text-muted); }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .32rem; vertical-align: -1px; }

.ledger { display: flex; flex-direction: column; }
.ledger-row {
  display: flex; align-items: center; gap: .8rem;
  padding: .68rem 0; border-bottom: 1px solid var(--border);
  font-size: .87rem;
}
.ledger-row:last-child { border-bottom: 0; }
.ledger-delta { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 58px; text-align: right; }
.ledger-delta.plus { color: var(--green-500); }
.ledger-delta.minus { color: var(--red-500); }
.ledger-reason { flex: 1; min-width: 0; }
.ledger-reason b { display: block; font-weight: 580; font-size: .85rem; }
.ledger-reason span { font-size: .75rem; color: var(--text-subtle); }

.empty-state {
  text-align: center; padding: 2.6rem 1.2rem;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-lg);
  background: var(--bg-soft);
}
.empty-state h3 { margin-bottom: .4rem; }
.empty-state p { color: var(--text-muted); max-width: 52ch; margin: 0 auto 1.1rem; }

/* ---------------------------------------------------------------- footer */
.site-footer {
  background: var(--bg-soft);
  border-top: 1px solid var(--border);
  padding: clamp(2.2rem, 1.4rem + 2.6vw, 3.6rem) 0 1.6rem;
  margin-top: clamp(2.4rem, 1.6rem + 3vw, 4rem);
}

.footer-stats {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .9rem; margin-bottom: 2.2rem;
}
@media (min-width: 820px) { .footer-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.footer-stat {
  padding: 1rem 1.1rem; border-radius: var(--radius-lg);
  background: var(--bg-elevated); border: 1px solid var(--border);
}
.footer-stat-label { display: block; font-size: .73rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-subtle); font-weight: 620; }
.footer-stat-value { display: block; font-size: clamp(1.3rem, 1.1rem + .9vw, 1.75rem); font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin: .18rem 0 .1rem; }
.footer-stat-sub { font-size: .76rem; color: var(--text-subtle); }

.footer-traffic {
  border: 1px solid var(--border); border-radius: var(--radius-xl);
  background: var(--bg-elevated); padding: clamp(1.1rem, .9rem + 1vw, 1.6rem);
  margin-bottom: 2.2rem;
}
.footer-traffic-head { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: baseline; justify-content: space-between; margin-bottom: 1rem; }
.footer-traffic-head h2 { margin: 0; font-size: 1.08rem; }
.footer-traffic-note { font-size: .78rem; color: var(--text-subtle); }
.footer-traffic-grid { display: grid; gap: .8rem; }
@media (min-width: 760px) { .footer-traffic-grid { grid-template-columns: repeat(3, 1fr); } }
.traffic-card {
  display: flex; gap: .8rem; align-items: flex-start;
  padding: .95rem 1rem; border-radius: var(--radius-lg);
  border: 1px solid var(--border); background: var(--bg-inset);
}
.traffic-card.in { border-color: color-mix(in srgb, var(--brand) 24%, var(--border)); }
.traffic-card.out { border-color: color-mix(in srgb, var(--cyan-500) 26%, var(--border)); }
.traffic-icon {
  display: inline-grid; place-items: center; flex-shrink: 0;
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  background: var(--brand-soft); color: var(--brand);
}
.traffic-card.out .traffic-icon { background: color-mix(in srgb, var(--cyan-500) 14%, transparent); color: var(--cyan-500); }
.traffic-card.week .traffic-icon { background: var(--amber-50); color: #b45309; }
.traffic-icon svg { width: 18px; height: 18px; }
.traffic-label { display: block; font-size: .73rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-subtle); font-weight: 620; }
.traffic-card strong { display: block; font-size: 1.22rem; font-weight: 780; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.traffic-sep { opacity: .4; font-weight: 400; }
.traffic-trend { font-size: .75rem; font-weight: 580; display: block; }
.traffic-trend.up { color: var(--green-500); }
.traffic-trend.down { color: var(--red-500); }
.traffic-trend.neutral { color: var(--text-subtle); }
.footer-traffic-cta {
  display: flex; flex-wrap: wrap; gap: .6rem; align-items: center;
  margin: 1.1rem 0 0; padding-top: 1.1rem; border-top: 1px solid var(--border);
  font-size: .9rem; color: var(--text-muted); font-weight: 580;
}
.footer-traffic-cta .btn { flex-shrink: 0; }

.footer-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.6rem 1.2rem; padding-bottom: 1.8rem; border-bottom: 1px solid var(--border); }
@media (min-width: 720px) { .footer-nav { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.footer-col h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-subtle); margin-bottom: .7rem; font-weight: 680; }
.footer-col a { display: block; font-size: .87rem; color: var(--text-muted); padding: .22rem 0; }
.footer-col a:hover { color: var(--brand); }

.footer-bottom { display: flex; flex-wrap: wrap; gap: .8rem 1.4rem; justify-content: space-between; align-items: center; padding-top: 1.4rem; }
.footer-copy { display: flex; align-items: center; gap: .6rem; margin: 0; font-size: .84rem; color: var(--text-subtle); flex-wrap: wrap; }
.footer-meta { display: flex; flex-wrap: wrap; gap: .4rem .6rem; align-items: center; margin: 0; font-size: .78rem; color: var(--text-subtle); }
.footer-meta a { color: var(--text-subtle); }
.footer-meta a:hover { color: var(--brand); }

/* ------------------------------------------------------------- promo page */
.promo-hero {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem var(--gutter);
  background: var(--grad-brand-soft);
}
.promo-panel {
  width: 100%; max-width: 560px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: clamp(1.4rem, 1.1rem + 1.6vw, 2.2rem);
  text-align: center;
}
.promo-panel .site-favicon { margin: 0 auto .9rem; width: 64px; height: 64px; }
.promo-panel h1 { font-size: clamp(1.35rem, 1.15rem + 1vw, 1.8rem); margin-bottom: .5rem; }
.promo-panel .promo-desc { color: var(--text-muted); font-size: .96rem; }
.promo-meta { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin: 1rem 0 1.3rem; }
.promo-foot { margin-top: 1.2rem; font-size: .78rem; color: var(--text-subtle); }
.promo-progress { height: 3px; width: 100%; background: var(--bg-inset); border-radius: 2px; overflow: hidden; margin: 1rem 0; }
.promo-progress i { display: block; height: 100%; width: 0; background: var(--grad-brand); animation: fill 4s linear forwards; }
@keyframes fill { to { width: 100%; } }

.credit-burst {
  display: inline-flex; align-items: center; gap: .4rem;
  margin-top: .9rem; padding: .4rem .85rem;
  border-radius: var(--radius-pill);
  background: var(--green-50); color: var(--green-500);
  border: 1px solid color-mix(in srgb, var(--green-500) 28%, transparent);
  font-size: .84rem; font-weight: 620;
}
.credit-burst svg { width: 15px; height: 15px; }

/* ----------------------------------------------------------------- toast */
.toast-wrap {
  position: fixed; z-index: 300;
  left: 50%; bottom: 1.2rem; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: .5rem;
  width: min(440px, calc(100vw - 2rem));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: .6rem;
  padding: .8rem 1rem; border-radius: var(--radius);
  background: var(--ink-900); color: #f4f6fa;
  font-size: .87rem; line-height: 1.5;
  box-shadow: var(--shadow-lg);
  animation: toastIn .28s var(--ease);
}
[data-theme="dark"] .toast { background: var(--bg-inset); border: 1px solid var(--border-strong); }
.toast.success { background: var(--green-500); }
.toast.error { background: var(--red-500); }
.toast svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: .12rem; }
.toast.is-leaving { animation: toastOut .22s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }

/* --------------------------------------------------------------- reveal */
[data-reveal] { opacity: 0; transform: translateY(14px); }
[data-reveal].is-visible {
  opacity: 1; transform: none;
  transition: opacity .55s var(--ease), transform .55s var(--ease);
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  [data-reveal] { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}

/* --------------------------------------------------------------- print */
@media print {
  .site-header, .site-footer, .btn, .pagination { display: none !important; }
  body { font-size: 12pt; }
  a::after { content: ' (' attr(href) ')'; font-size: 9pt; color: #555; }
}

/* --------------------------------------------------- wide-screen tweaks */
@media (min-width: 1180px) {
  :root { --gutter: 1.5rem; }
  .grid-3 { gap: 1.4rem; }
}
