/* =========================================================================
   Mail Hygiene — application stylesheet
   Everything is driven by tokens so light/dark stay consistent and a colour
   is never defined in only one theme.
   ========================================================================= */

:root {
  --ground:       #FBFAF7;
  --surface:      #FFFFFF;
  --surface-2:    #F4F5F2;
  --surface-3:    #ECEEEA;
  --ink:          #16211E;
  --ink-muted:    #5A6B66;
  --ink-faint:    #8A9791;
  --rule:         #E2E6E2;
  --rule-strong:  #C9D1CD;

  --accent:       #0B6B4F;
  --accent-hover: #095A42;
  --accent-ink:   #075038;
  --accent-soft:  #E7F2ED;
  --accent-on:    #FFFFFF;

  --good:         #0B6B4F;
  --good-soft:    #E7F2ED;
  --warn:         #8A6212;
  --warn-soft:    #FAF1DF;
  --bad:          #A32F2A;
  --bad-soft:     #F8EAE9;
  --info:         #1F5673;
  --info-soft:    #E6EFF4;

  --radius:       10px;
  --radius-sm:    6px;
  --shadow-sm:    0 1px 2px rgba(22,33,30,.06);
  --shadow:       0 1px 2px rgba(22,33,30,.05), 0 8px 24px -14px rgba(22,33,30,.22);
  --shadow-lg:    0 2px 4px rgba(22,33,30,.05), 0 20px 48px -20px rgba(22,33,30,.28);

  --font-sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Newsreader", ui-serif, Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --sidebar-w: 232px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground:      #0E1412;
    --surface:     #151D1A;
    --surface-2:   #1B2521;
    --surface-3:   #222E29;
    --ink:         #E8EDEA;
    --ink-muted:   #9BABA5;
    --ink-faint:   #6C7C76;
    --rule:        #26302C;
    --rule-strong: #35423D;

    --accent:       #4FBF92;
    --accent-hover: #63CDA2;
    --accent-ink:   #7FD6B0;
    --accent-soft:  #12271F;
    --accent-on:    #08110D;

    --good:      #4FBF92;
    --good-soft: #12271F;
    --warn:      #D9A441;
    --warn-soft: #26200F;
    --bad:       #E2726B;
    --bad-soft:  #2A1917;
    --info:      #6FB3D6;
    --info-soft: #12222B;

    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow:    0 1px 2px rgba(0,0,0,.4), 0 8px 24px -14px rgba(0,0,0,.7);
    --shadow-lg: 0 2px 4px rgba(0,0,0,.4), 0 20px 48px -20px rgba(0,0,0,.75);
    color-scheme: dark;
  }
}

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

/* An author `display` rule beats the UA stylesheet's [hidden] { display:none },
   so components like .alert (display:flex) would otherwise ignore the hidden
   attribute entirely. This keeps `hidden` meaning hidden, everywhere. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

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

h1, h2, h3, h4 { margin: 0; line-height: 1.25; text-wrap: balance; font-weight: 600; }

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

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.num  { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-muted); }
.faint { color: var(--ink-faint); }
.small { font-size: 13px; }
.tiny  { font-size: 12px; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ===================== buttons ===================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--accent-on);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .05s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

.btn-outline {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule-strong);
}
.btn-outline:hover { background: var(--surface-2); border-color: var(--ink-faint); }

.btn-ghost { background: transparent; color: var(--ink-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }

.btn-danger { background: var(--bad); color: #fff; }
.btn-danger:hover { background: var(--bad); filter: brightness(1.08); }

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

/* ===================== forms ===================== */

.field { margin-bottom: 18px; }

.field label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink);
}

.input, input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="search"], textarea, select {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus, input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input.has-error, input.has-error { border-color: var(--bad); }

.field-error { color: var(--bad); font-size: 13px; margin-top: 6px; }
.field-hint  { color: var(--ink-faint); font-size: 12.5px; margin-top: 6px; }

/* ===================== alerts ===================== */

.alert {
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid;
  font-size: 14px;
  margin-bottom: 20px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.alert a { text-decoration: underline; }
.alert-success { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.alert-error   { background: var(--bad-soft);  border-color: var(--bad);  color: var(--bad); }
.alert-warn    { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.alert-info    { background: var(--info-soft); border-color: var(--info); color: var(--info); }

/* ===================== cards & panels ===================== */

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

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--rule);
}
.panel-head h2 { font-size: 15px; font-weight: 600; }
.panel-head .panel-sub { font-size: 13px; color: var(--ink-faint); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ===================== pills / badges ===================== */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
  line-height: 1.5;
}
.pill-deliverable, .pill-completed, .pill-captured, .pill-active {
  background: var(--good-soft); color: var(--good); border-color: var(--good);
}
.pill-undeliverable, .pill-failed, .pill-suspended {
  background: var(--bad-soft); color: var(--bad); border-color: var(--bad);
}
.pill-risky, .pill-disposable, .pill-queued, .pill-created {
  background: var(--warn-soft); color: var(--warn); border-color: var(--warn);
}
.pill-unknown, .pill-pending, .pill-cancelled {
  background: var(--surface-2); color: var(--ink-muted); border-color: var(--rule-strong);
}
.pill-running, .pill-authorized {
  background: var(--info-soft); color: var(--info); border-color: var(--info);
}
.pill-refunded { background: var(--surface-3); color: var(--ink-muted); border-color: var(--rule-strong); }

/* ===================== tables ===================== */

.table-wrap { overflow-x: auto; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.data th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 10px 14px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface-2);
  white-space: nowrap;
}
table.data td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
}
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data .col-num { text-align: right; font-variant-numeric: tabular-nums; }

.empty {
  padding: 44px 24px;
  text-align: center;
  color: var(--ink-faint);
}
.empty strong { display: block; color: var(--ink-muted); margin-bottom: 4px; font-weight: 600; }

/* ===================== public site chrome ===================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--ground) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.site-header-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.site-nav { display: flex; align-items: center; gap: 8px; }
.site-nav a.navlink {
  color: var(--ink-muted);
  font-size: 14.5px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}
.site-nav a.navlink:hover { color: var(--ink); background: var(--surface-2); text-decoration: none; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 16px;
  color: var(--ink);
  letter-spacing: -.01em;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 26px; height: 26px;
  border-radius: 7px;
  background: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--accent-on);
  font-size: 14px; font-weight: 700;
  flex: none;
}

.wrap { max-width: 1140px; margin: 0 auto; padding: 0 24px; }
.wrap-narrow { max-width: 780px; margin: 0 auto; padding: 0 24px; }

.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: 80px;
  padding: 36px 0;
  color: var(--ink-faint);
  font-size: 13.5px;
}
.site-footer-inner {
  max-width: 1140px; margin: 0 auto; padding: 0 24px;
  display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center;
}

/* ===================== landing ===================== */

.hero { padding: 80px 0 64px; }
.hero-inner { max-width: 1140px; margin: 0 auto; padding: 0 24px; }

.hero h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(38px, 6.2vw, 64px);
  line-height: 1.04;
  letter-spacing: -.022em;
  max-width: 17ch;
  margin-bottom: 22px;
}
.hero .lede {
  font-size: clamp(17px, 2.1vw, 20px);
  line-height: 1.55;
  color: var(--ink-muted);
  max-width: 58ch;
  margin-bottom: 32px;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.hero-note { font-size: 13.5px; color: var(--ink-faint); margin-top: 18px; }

.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 56px;
}
.stat-strip .stat { background: var(--surface); padding: 20px 22px; }
.stat-strip .stat-value {
  font-size: 26px; font-weight: 600; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; margin-bottom: 2px;
}
.stat-strip .stat-label { font-size: 12.5px; color: var(--ink-faint); }

.section { padding: 72px 0; }
.section-head { margin-bottom: 40px; max-width: 62ch; }
.section-head h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(28px, 3.6vw, 38px);
  letter-spacing: -.018em;
  margin: 10px 0 12px;
}
.section-head p { color: var(--ink-muted); font-size: 16px; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}
.feature {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 24px;
}
.feature h3 { font-size: 15.5px; margin-bottom: 8px; }
.feature p { font-size: 14px; color: var(--ink-muted); line-height: 1.6; }
.feature-icon {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px; font-size: 17px;
}

/* ===================== pricing ===================== */

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 20px;
  align-items: start;
}

.plan {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 28px 26px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Pro is the one we want chosen: raised, accent-bordered, slightly larger. */
.plan.is-popular {
  border-color: var(--accent);
  border-width: 2px;
  box-shadow: var(--shadow-lg);
  padding-top: 34px;
}
@media (min-width: 900px) {
  .plan.is-popular { transform: scale(1.035); z-index: 2; }
}

.plan-badge {
  position: absolute;
  top: -11px; left: 50%; transform: translateX(-50%);
  background: var(--accent);
  color: var(--accent-on);
  font-size: 11px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  padding: 5px 13px;
  border-radius: 999px;
  white-space: nowrap;
}

.plan-name { font-size: 14px; font-weight: 600; letter-spacing: .02em; color: var(--ink-muted); }
.plan-price { display: flex; align-items: baseline; gap: 3px; }
.plan-price .amount {
  font-size: 42px; font-weight: 600; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums; line-height: 1;
}
.plan-price .currency { font-size: 22px; font-weight: 600; }
.plan-credits { font-size: 15px; font-weight: 600; color: var(--accent); }
.plan-rate { font-size: 12.5px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.plan-blurb { font-size: 13.5px; color: var(--ink-muted); }

.plan-features { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.plan-features li {
  font-size: 13.5px; color: var(--ink-muted);
  display: flex; gap: 9px; align-items: flex-start; line-height: 1.5;
}
.plan-features li::before {
  content: "✓"; color: var(--accent); font-weight: 700; flex: none; font-size: 13px; line-height: 1.5;
}

.pricing-note {
  display: flex; flex-wrap: wrap; gap: 10px 28px;
  justify-content: center; margin-top: 30px;
  font-size: 13.5px; color: var(--ink-muted);
}
.pricing-note span { display: inline-flex; align-items: center; gap: 7px; }
.pricing-note strong { color: var(--ink); font-weight: 600; }

/* ===================== FAQ ===================== */

.faq { display: flex; flex-direction: column; gap: 0; border-top: 1px solid var(--rule); }
.faq details { border-bottom: 1px solid var(--rule); }
.faq summary {
  padding: 18px 0;
  font-size: 15.5px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; color: var(--accent); font-size: 20px; font-weight: 400; flex: none; line-height: 1;
}
.faq details[open] summary::after { content: "−"; }
.faq .faq-body { padding: 0 0 20px; color: var(--ink-muted); font-size: 14.5px; max-width: 68ch; }

/* ===================== auth pages ===================== */

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 20px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 34px 32px;
}
.auth-card h1 { font-size: 23px; margin-bottom: 6px; letter-spacing: -.015em; }
.auth-card .auth-sub { color: var(--ink-muted); font-size: 14.5px; margin-bottom: 26px; }
.auth-brand { display: flex; justify-content: center; margin-bottom: 24px; }
.auth-alt { margin-top: 22px; text-align: center; font-size: 14px; color: var(--ink-muted); }
.auth-side-note {
  margin-top: 18px; padding: 13px 15px;
  background: var(--accent-soft); border-radius: var(--radius-sm);
  font-size: 13px; color: var(--accent-ink);
}

/* ===================== app shell ===================== */

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: var(--surface);
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand { padding: 20px 20px 16px; }

.sidebar-cta { padding: 0 16px 18px; }

.balance-card {
  margin: 0 16px 18px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
}
.balance-label {
  font-size: 11px; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--accent-ink); margin-bottom: 4px;
}
.balance-value {
  font-size: 30px; font-weight: 700; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums; color: var(--accent-ink); line-height: 1.05;
}
.balance-sub { font-size: 12px; color: var(--accent-ink); opacity: .85; margin-top: 3px; }
.balance-reserved {
  margin-top: 9px; padding-top: 9px;
  border-top: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent);
  font-size: 12px; color: var(--accent-ink);
  display: flex; justify-content: space-between; gap: 8px;
}

.sidenav { padding: 0 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidenav-label {
  font-size: 10.5px; font-weight: 600; letter-spacing: .11em; text-transform: uppercase;
  color: var(--ink-faint); padding: 16px 10px 6px;
}
.sidenav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-muted);
  font-size: 14px; font-weight: 500;
}
.sidenav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.sidenav a.is-active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.sidenav-icon { width: 17px; text-align: center; flex: none; opacity: .85; }

.sidebar-foot { padding: 14px 16px; border-top: 1px solid var(--rule); }
.user-chip { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--surface-3); color: var(--ink-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 700; flex: none;
}
.user-chip-meta { min-width: 0; flex: 1; }
.user-chip-name { font-size: 13px; font-weight: 600; }
.user-chip-email { font-size: 11.5px; color: var(--ink-faint); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
  position: sticky; top: 0; z-index: 30;
}
.topbar-balance {
  display: inline-flex; align-items: baseline; gap: 6px;
  background: var(--accent-soft); color: var(--accent-ink);
  padding: 6px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 600;
}
.topbar-balance b { font-size: 15px; font-variant-numeric: tabular-nums; }

.content { padding: 30px 32px 64px; flex: 1; }
.content-narrow { max-width: 880px; }

.page-head { margin-bottom: 26px; display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: flex-start; }
.page-head h1 { font-size: 25px; letter-spacing: -.02em; margin-bottom: 4px; }
.page-head .page-sub { color: var(--ink-muted); font-size: 14.5px; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.stack { display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-tight { display: flex; gap: 8px; align-items: center; }
.spacer { flex: 1; }

/* ===================== stat tiles ===================== */

.tile {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.tile-label {
  font-size: 11.5px; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--ink-faint); margin-bottom: 7px;
}
.tile-value {
  font-size: 27px; font-weight: 600; letter-spacing: -.025em;
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.tile-sub { font-size: 12.5px; color: var(--ink-faint); margin-top: 4px; }
.tile-accent .tile-value { color: var(--accent); }
.tile-bad .tile-value { color: var(--bad); }
.tile-warn .tile-value { color: var(--warn); }

/* ===================== dropzone ===================== */

.dropzone {
  border: 2px dashed var(--rule-strong);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 40px 28px;
  text-align: center;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease;
  position: relative;
}
.dropzone:hover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.is-dragging { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.is-busy { pointer-events: none; opacity: .7; }
.dropzone input[type="file"] { display: none; }
.dropzone-icon { font-size: 30px; margin-bottom: 10px; color: var(--accent); }
.dropzone-title { font-size: 16px; font-weight: 600; margin-bottom: 5px; }
.dropzone-hint { font-size: 13.5px; color: var(--ink-faint); }

/* ===================== preview ===================== */

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 20px;
}
.preview-cell { background: var(--surface); padding: 14px 16px; }
.preview-cell .k { font-size: 11.5px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.preview-cell .v { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.preview-cell.is-cost .v { color: var(--accent); }

/* ===================== progress ===================== */

.progress-track {
  height: 8px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width .4s ease;
  width: 0;
}
.progress-meta {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 13px; color: var(--ink-muted); margin-top: 9px;
  font-variant-numeric: tabular-nums;
}

/* ===================== results breakdown ===================== */

.breakdown { display: flex; flex-direction: column; gap: 12px; }

.breakdown-bar {
  display: flex;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-3);
}
.breakdown-bar span { display: block; height: 100%; }
.seg-deliverable   { background: var(--good); }
.seg-risky         { background: var(--warn); }
.seg-unknown       { background: var(--rule-strong); }
.seg-undeliverable { background: var(--bad); }
.seg-disposable    { background: color-mix(in srgb, var(--bad) 55%, var(--warn)); }

.legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.legend-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
}
.legend-item:hover { border-color: var(--rule-strong); text-decoration: none; background: var(--surface-2); }
.legend-item.is-active { border-color: var(--accent); background: var(--accent-soft); }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; flex: none; }
.legend-name { font-size: 12.5px; color: var(--ink-muted); font-weight: 500; }
.legend-value { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.legend-pct { font-size: 12px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }

/* ===================== tabs & pagination ===================== */

.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab {
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-muted);
  border: 1px solid transparent;
}
.tab:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.tab.is-active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; border-color: var(--accent); }

.pagination { display: flex; gap: 6px; align-items: center; justify-content: center; margin-top: 22px; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: 7px 12px; border-radius: var(--radius-sm);
  font-size: 13.5px; border: 1px solid var(--rule);
  color: var(--ink-muted); background: var(--surface);
}
.pagination a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.pagination .is-current { background: var(--accent); border-color: var(--accent); color: var(--accent-on); font-weight: 600; }

/* ===================== misc ===================== */

.kv { display: flex; flex-direction: column; gap: 10px; }
.kv-row { display: flex; justify-content: space-between; gap: 16px; font-size: 13.5px; }
.kv-row dt { color: var(--ink-faint); }
.kv-row dd { margin: 0; font-weight: 500; text-align: right; }

.divider { height: 1px; background: var(--rule); margin: 22px 0; border: 0; }

.spinner {
  width: 15px; height: 15px;
  border: 2px solid color-mix(in srgb, currentColor 30%, transparent);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); display: inline-block;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

.sparkline { display: block; width: 100%; height: 56px; }

/* ===================== responsive ===================== */

@media (max-width: 900px) {
  .sidebar { display: none; }
  .topbar { display: flex; }
  .content { padding: 20px 18px 56px; }
  .page-head h1 { font-size: 22px; }
  .hero { padding: 52px 0 40px; }
  .section { padding: 52px 0; }
  .site-nav .navlink.hide-sm { display: none; }
}

@media (max-width: 560px) {
  body { font-size: 14.5px; }
  .auth-card { padding: 26px 22px; }
  .card-pad { padding: 18px; }
  .plan { padding: 24px 20px; }
  .plan.is-popular { transform: none; }
  table.data th, table.data td { padding: 10px; }
  .hero-actions .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

@media print {
  .sidebar, .topbar, .site-header, .site-footer, .btn { display: none !important; }
  body { background: #fff; }
}
