/* DataKitHub Fixer — design tokens per datakithub-page-design-spec.md §2 */

/* A [hidden] element must never be laid out. Classes below set display (flex, grid,
   block) and, being more specific than the UA rule, would otherwise show elements
   the markup marks hidden — the empty "Drop your CSV" trigger button was visible
   for exactly that reason. */
[hidden] { display: none !important; }
:root {
  --ink-900: #0b1220;
  --ink-700: #334155;
  --ink-500: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --bg: #ffffff;
  --bg-subtle: #f8fafc;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --ok: #047857;
  --warn: #b45309;
  --danger: #b91c1c;
  --diff-add-bg: #ecfdf5;
  --diff-del-bg: #fef2f2;
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, monospace;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink-700);
  background: var(--bg);
}
h1, h2, h3 { color: var(--ink-900); line-height: 1.35; margin: 0 0 12px; }
h1 { font-size: 44px; line-height: 1.2; letter-spacing: -0.02em; max-width: 20ch; }
h2 { font-size: 20px; margin-top: 32px; }
h3 { font-size: 16px; }
p { margin: 0 0 12px; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
code, .mono { font-family: var(--mono); font-size: 13px; font-variant-numeric: tabular-nums; }
a:focus-visible, button:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; background: #fff; padding: 8px; z-index: 10; }
.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;
}
/* One container width for the whole site: the header uses 1184px, and a 1120px
   .wrap put the hero 32px to the right of the logo on a wide screen. */
.wrap { max-width: 1184px; margin: 0 auto; padding: 0 32px; }
.muted { color: var(--ink-500); }
.small { font-size: 13px; }

/* nav */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 16px 32px; border-bottom: 1px solid var(--line);
  max-width: 1184px; margin: 0 auto;
}
.brand { color: var(--ink-900); font-weight: 600; display: flex; align-items: center; gap: 8px; margin-right: auto; }
.brand-mark {
  display: inline-grid; place-items: center; width: 26px; height: 26px;
  border-radius: 6px; background: var(--ink-900); color: #fff; font-size: 12px; letter-spacing: .02em;
}
.brand-sub { color: var(--ink-500); font-weight: 400; }
.nav-links { display: flex; align-items: center; gap: 20px; font-size: 14px; }
.nav-links a { color: var(--ink-700); }
.nav-links a.btn { color: #fff; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; font: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; min-height: 44px;
}
.btn:hover { background: var(--accent-hover); color: #fff; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-sm { height: 34px; min-height: 34px; font-size: 13px; padding: 0 12px; }
.btn-lg { height: 44px; padding: 0 20px; }
.btn-ghost { background: #fff; color: var(--ink-700); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--bg-subtle); color: var(--ink-900); }
.link { font-size: 14px; }

/* hero */
.hero { display: grid; grid-template-columns: 7fr 5fr; gap: 48px; padding-top: 64px; padding-bottom: 32px; align-items: start; }
.lede { font-size: 17px; max-width: 46ch; }
.hero-actions { display: flex; align-items: center; gap: 20px; margin-top: 24px; }
.dropzone {
  border: 1px dashed var(--line-strong); border-radius: 12px; background: var(--bg-subtle);
  padding: 32px 24px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone.over { border-color: var(--accent); background: #eff6ff; }
.dz-icon { display: inline-flex; color: var(--ink-500); margin-bottom: 10px; }
.dz-icon svg { display: block; }
.dropzone strong { display: block; color: var(--ink-900); font-size: 16px; }
.dz-note { display: block; font-size: 13px; color: var(--ink-500); margin-top: 4px; }
.dz-facts {
  list-style: none; padding: 16px 0 0; margin: 16px 0 0; border-top: 1px solid var(--line);
  font-size: 13px; color: var(--ink-500);
  /* inline-grid stays centred in the dropzone; justify-items keeps the ✓ ticks on one line */
  display: inline-grid; gap: 6px; justify-items: start; text-align: left;
}

/* evidence + steps */
.evidence {
  display: flex; flex-wrap: wrap; gap: 8px 24px; padding-top: 16px; padding-bottom: 16px;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  font-size: 13px; color: var(--ink-500);
}
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; padding-top: 24px; padding-bottom: 24px; font-size: 14px; }
.steps b {
  display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 8px;
  border-radius: 999px; border: 1px solid var(--line-strong); color: var(--ink-700); font-size: 12px;
}
.section { padding-top: 16px; padding-bottom: 40px; }
.rules { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 32px; }
.rules li { border-top: 1px solid var(--line); padding-top: 12px; }
.rules code { display: block; color: var(--ink-900); margin-bottom: 4px; }
.rules span { font-size: 14px; color: var(--ink-500); }
details { border-top: 1px solid var(--line); padding: 12px 0; }
details summary { cursor: pointer; color: var(--ink-900); font-size: 15px; }
details p { margin-top: 8px; max-width: 72ch; }

/* fixer shell */
.fixbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  /* The bar keeps its full-width border and background, but its contents line up with
     the 1184px header container instead of sitting 130px to the left of the logo. */
  padding: 12px max(24px, calc((100% - 1184px) / 2 + 32px));
  border-bottom: 1px solid var(--line); background: #fff; position: sticky; top: 0; z-index: 5;
}
.fixbar-file { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.fixbar-file strong { color: var(--ink-900); font-size: 15px; }
.fixbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.badge {
  font-size: 12px; color: var(--ok); background: var(--diff-add-bg);
  border: 1px solid #a7f3d0; border-radius: 999px; padding: 2px 8px;
}
.status {
  padding: 10px max(24px, calc((100% - 1184px) / 2 + 32px));
  font-size: 14px; background: var(--bg-subtle);
  border-bottom: 1px solid var(--line); color: var(--ink-700);
}
.status[data-tone="ok"] { color: var(--ok); }
.status[data-tone="warn"] { color: var(--warn); }
.status[data-tone="busy"] { color: var(--ink-500); }

.fixgrid {
  display: grid; grid-template-columns: 280px minmax(0, 1fr) 420px;
  max-width: 1184px; margin: 0 auto; padding: 0 32px;
  min-height: calc(100vh - 130px); align-items: stretch;
}
.overview { border-right: 1px solid var(--line); padding: 20px; background: var(--bg-subtle); }
.overview h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-500); margin: 16px 0 8px; }
.overview dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: 13px; }
.overview dt { color: var(--ink-500); }
.overview dd { margin: 0; color: var(--ink-900); font-family: var(--mono); text-align: right; }
.summary { display: grid; gap: 6px; font-size: 13px; }
.sum-row { display: flex; align-items: center; gap: 8px; }
.sum-label { color: var(--ink-700); }
.sum-count { margin-left: auto; font-family: var(--mono); color: var(--ink-900); }
.dot { width: 8px; height: 8px; border-radius: 999px; display: inline-block; flex: none; }
.dot.blocker { background: var(--danger); }
.dot.warning { background: var(--warn); }
.dot.info { background: var(--ink-500); }
.license { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }
.license label { display: block; font-size: 12px; color: var(--ink-500); margin-bottom: 6px; }
.license-row { display: flex; gap: 8px; }
.license-row input {
  flex: 1; min-width: 0; height: 34px; padding: 0 8px; border: 1px solid var(--line-strong);
  border-radius: 8px; font-family: var(--mono); font-size: 12px; color: var(--ink-900);
}

.issues { min-width: 0; display: flex; flex-direction: column; }
.issues-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 12px 20px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--ink-500);
}
.issue-list { list-style: none; margin: 0; padding: 0; overflow: auto; max-height: calc(100vh - 190px); }
.issue {
  display: grid; grid-template-columns: 60px 168px minmax(0, 1fr) 60px; gap: 12px; align-items: start;
  min-height: 48px; padding: 10px 20px; border-bottom: 1px solid #f1f5f9; cursor: pointer; font-size: 13px;
  line-height: 1.45;
}
.issue:hover { background: var(--bg-subtle); }
.issue[aria-selected="true"] { background: #eff6ff; box-shadow: inset 2px 0 0 var(--accent); }
.issue-line { font-family: var(--mono); color: var(--ink-500); text-align: right; font-variant-numeric: tabular-nums; padding-top: 2px; }
.issue-col { font-family: var(--mono); color: var(--ink-700); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-top: 2px; }
.issue-msg {
  color: var(--ink-900); min-width: 0;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
}
.issue-msg .dot { margin-right: 6px; }
.issue-fix { font-size: 11px; color: var(--ink-500); text-align: right; padding-top: 2px; }
.issue-list .empty, .issue-list .skeleton { padding: 24px 20px; color: var(--ink-500); font-size: 14px; }
.empty-state { padding: 24px 20px; color: var(--ink-500); }
.gate {
  margin: 20px; padding: 20px; border: 1px solid var(--line-strong); border-radius: 12px;
  background: #fff; box-shadow: 0 8px 24px rgba(11, 18, 32, .12);
}
.gate h3 { margin-top: 0; }
.gate p { font-size: 14px; }

.diffpanel { border-left: 1px solid var(--line); padding: 20px; background: #fff; overflow: auto; }
.diff-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-500); margin-bottom: 8px; }
.diff-msg { font-size: 14px; color: var(--ink-900); }
.diff-block { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin: 12px 0; }
.diff-line { display: flex; gap: 8px; padding: 6px 10px; font-size: 13px; }
.diff-line code { font-family: var(--mono); white-space: pre-wrap; word-break: break-all; }
.diff-line.del { background: var(--diff-del-bg); color: #7f1d1d; }
.diff-line.add { background: var(--diff-add-bg); color: #065f46; }
.diff-line .sign { color: var(--ink-500); }
.diff-actions { display: flex; align-items: center; gap: 16px; }
.rule-id { font-size: 12px; }

.foot { border-top: 1px solid var(--line); margin-top: 40px; padding: 20px 0; font-size: 12px; color: var(--ink-500); }
.foot .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* subscription flow */
.pay-steps { display: flex; gap: 20px; list-style: none; padding: 0; margin: 24px 0; flex-wrap: wrap; font-size: 14px; color: var(--ink-700); }
.pay-steps li { display: flex; align-items: center; gap: 8px; }
.pay-steps span { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--ink-900); color: #fff; font-size: 12px; }
.coin-row { display: flex; gap: 12px; flex-wrap: wrap; }
.pay-card, .key-card { border: 1px solid var(--line-strong); border-radius: 12px; padding: 20px; background: var(--bg-subtle); margin: 16px 0; }
.pay-label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-500); margin: 0 0 4px; }
.pay-amount { font-size: 32px; font-weight: 600; margin: 0 0 16px; font-variant-numeric: tabular-nums; }
.pay-address { margin: 0 0 10px; word-break: break-all; }
.pay-form { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.pay-form input {
  flex: 1 1 320px; min-width: 0; height: 40px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: 8px; font: inherit; font-size: 14px;
}
.pay-form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.pay-error { color: #b91c1c; font-size: 14px; margin-top: 8px; }
.key-value { font-size: 20px; margin: 0 0 12px; word-break: break-all; }

/* plan picker */
.plan-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 12px 0 20px; }
.plan {
  display: grid; gap: 4px; border: 1px solid var(--line-strong); border-radius: 10px;
  padding: 14px 16px; cursor: pointer; background: #fff;
}
.plan:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.plan input { margin: 0 0 2px; }
.plan-name { font-size: 15px; color: var(--ink-900); }
.plan-note { font-size: 12px; color: var(--ink-500); }
.days-input { display: flex; align-items: center; gap: 10px; margin: 8px 0; flex-wrap: wrap; }
.days-input input {
  width: 100px; height: 38px; padding: 0 10px; font: inherit; font-size: 14px;
  border: 1px solid var(--line-strong); border-radius: 8px;
}
@media (max-width: 700px) { .plan-row { grid-template-columns: 1fr; } }

/* payment QR + automatic watcher */
.pay-qr { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 4px 0 20px; }
.pay-qr > div { background: #fff; padding: 10px; border: 1px solid var(--line); border-radius: 12px; line-height: 0; }
.pay-qr svg { display: block; width: 200px; height: 200px; }
.watch-state {
  display: flex; align-items: center; gap: 10px; margin: 20px 0 0;
  padding: 12px 14px; border: 1px solid #bfdbfe; background: #eff6ff; border-radius: 10px;
  color: #1e40af; font-size: 14px;
}
.watch-state.is-paid { border-color: #a7f3d0; background: #ecfdf5; color: #065f46; }
.watch-state.is-warn { border-color: #fde68a; background: #fffbeb; color: #92400e; }
.watch-state .dot {
  width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: 0 0 8px;
  animation: watch-pulse 1.6s ease-in-out infinite;
}
.watch-state.is-paid .dot, .watch-state.is-warn .dot { animation: none; }
@keyframes watch-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
details.manual { margin: 20px 0 0; }
details.manual > summary { cursor: pointer; font-size: 14px; color: var(--ink-700); }
details.manual > summary:hover { color: var(--ink-900); }
details.manual .pay-form { margin-top: 12px; }
@media (prefers-reduced-motion: reduce) { .watch-state .dot { animation: none; } }

/* big-file progress: a hairline at the top plus a card, so a 55-second parse never
   looks like a frozen page */
.progress { position: fixed; inset: 0 0 auto 0; z-index: 60; pointer-events: none; }
.progress-rail { height: 3px; background: rgba(37, 99, 235, .15); }
.progress-fill { height: 100%; width: 0; background: var(--accent); transition: width .25s ease-out; }
.progress-card {
  position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 2px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .12); padding: 12px 16px;
  font-size: 13px; color: var(--ink-700); max-width: 280px;
}
.progress-card strong { color: var(--ink-900); font-weight: 600; font-size: 13px; }
.progress-card span { color: var(--ink-500); font-size: 12px; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .progress-card { right: 12px; bottom: 12px; left: 12px; max-width: none; } }

/* ad slots */
/* margin-block only: `margin: 20px 0` overrode .wrap's `margin: 0 auto` and pushed
   the home slots 41px to the left of everything else. */
[data-ad-slot] { margin-block: 20px; }
.ad-label { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-500); margin: 0 0 6px; }
.ad {
  display: flex; gap: 12px; align-items: center; text-decoration: none;
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: #fff; margin-bottom: 8px;
  color: var(--ink-900);
}
.ad:hover { border-color: var(--line-strong); }
.ad img { max-height: 56px; border-radius: 6px; }
.ad strong { display: block; font-size: 14px; }
.ad span { font-size: 13px; color: var(--ink-500); }
.panel[hidden] { display: none; }

/* static pages */
/* Same centred container as .nav/.wrap (1184px + 32px padding), so the h1 lines up
   with the logo on a wide screen. The 780px column applies to the children, which
   keeps the reading measure short without moving the left edge. */
.doc { max-width: 1184px; margin: 0 auto; padding: 40px 32px 60px; }
.doc > * { max-width: 780px; }
/* Tables benefit from more width than a paragraph does: 780px of text is a
   comfortable measure, 780px of a four-column table is cramped. */
.doc > table { max-width: 980px; }
.doc h1 { font-size: 32px; }
.doc h2 { margin-top: 32px; }
.doc ul { padding-left: 20px; }
.doc table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 16px 0; }
.doc th, .doc td { border-top: 1px solid var(--line); padding: 8px 12px; text-align: left; vertical-align: top; }
.doc th { color: var(--ink-500); font-weight: 600; font-size: 13px; }
/* four plans on the pricing page: two by two in the 780px text column, one per row
   on a phone (three columns left the fourth card stranded on its own line) */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 24px 0; }
@media (max-width: 700px) { .cards { grid-template-columns: 1fr; } }
.cards.two { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .cards.two { grid-template-columns: 1fr; } }
.card { border: 1px solid var(--line); border-radius: 12px; padding: 20px; display: flex; flex-direction: column; }
/* the list stretches so the CTA sits on the same line in every card */
.card > ul { flex: 1 1 auto; }
.card > p { margin-bottom: 0; }
.card > p > .btn { width: 100%; }
.card li { text-wrap: pretty; }
.card.featured { border-color: var(--accent); }
.card h3 { margin-top: 0; }
.price { font-size: 28px; color: var(--ink-900); font-variant-numeric: tabular-nums; }
.card ul { list-style: none; padding: 0; font-size: 14px; display: grid; gap: 6px; }

@media (max-width: 1279px) {
  .fixgrid { grid-template-columns: 260px minmax(0, 1fr); }
  .diffpanel { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); }
  .hero { gap: 32px; }
}
@media (max-width: 1024px) {
  .rules { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  h1 { font-size: 32px; }
  /* Brand + the links + the "Fix a CSV" button do not fit in 390px: the links get
     their own row instead of being clipped at "Secu…". */
  .nav { flex-wrap: wrap; padding: 12px 20px; row-gap: 10px; }
  /* row 1: brand + CTA, row 2: the links */
  .brand { margin-right: 0; flex: 1 1 auto; }
  .nav-links { flex: 1 0 100%; order: 3; justify-content: space-between; gap: 10px; font-size: 13px; }
  .hero { grid-template-columns: 1fr; padding-top: 32px; padding-bottom: 40px; }

  /* .doc used a 32px side padding while .wrap (nav, footer, hero) uses 20px, so the
     text column was offset from the header on a phone. */
  .doc { padding: 24px 20px 40px; }

  /* Data tables (26 rules, four columns) cannot hold four columns in 390px: the last
     two collapse to nothing. Stack each row into a block instead of scrolling. */
  .doc table, .doc thead, .doc tbody, .doc tr, .doc td, .doc th { display: block; width: auto; }
  .doc thead { display: none; }
  .doc tr { border-top: 1px solid var(--line); padding: 12px 0; }
  .doc td { border: 0; padding: 2px 0; }
  .doc td:first-child { color: var(--ink-900); font-weight: 600; }
  .doc td:not(:first-child) { font-size: 13px; }
  /* stacked rows lose the column headers, so name the bare values */
  .rules-table td:nth-child(2)::before { content: 'scope: '; color: var(--ink-500); }
  .rules-table td:nth-child(3)::before { content: 'severity: '; color: var(--ink-500); }
  /* the account page tables lose their headings too once stacked */
  .licence-table td:nth-child(2)::before { content: 'status: '; color: var(--ink-500); }
  .licence-table td:nth-child(3)::before { content: 'expires: '; color: var(--ink-500); }
  .licence-table td:nth-child(4)::before { content: 'verifications: '; color: var(--ink-500); }
  .order-table td:nth-child(2)::before { content: 'plan: '; color: var(--ink-500); }
  .order-table td:nth-child(3)::before { content: 'amount: '; color: var(--ink-500); }
  .order-table td:nth-child(4)::before { content: 'status: '; color: var(--ink-500); }
  .order-table td:nth-child(5)::before { content: 'created: '; color: var(--ink-500); }
  .order-table td:nth-child(6)::before { content: 'paid: '; color: var(--ink-500); }
  .wrap { padding: 0 20px; }
  .steps { grid-template-columns: 1fr 1fr; }
  .fixgrid { grid-template-columns: 1fr; min-height: 0; }
  .overview { border-right: 0; border-bottom: 1px solid var(--line); }
  .issue { grid-template-columns: 56px minmax(0, 1fr) 56px; }
  .issue-col { display: none; }
  .issue-list { max-height: none; }
}
