:root {
  color-scheme: dark;
  --bg: #020617;
  --bg-elev: #0b1227;
  --card: #0f172a;
  --card-elev: #131c33;
  --border: #1e293b;
  --border-strong: #334155;
  --text: #e2e8f0;
  --text-strong: #f8fafc;
  --muted: #94a3b8;
  --accent: #22c55e;
  --accent-strong: #16a34a;
  --warn: #fbbf24;
  --danger: #ef4444;
  --danger-strong: #dc2626;
  --link: #60a5fa;
  --topbar: #020617;
  --shadow: 0 18px 40px -18px rgba(2, 6, 23, 0.85);
  --radius: 14px;
  --radius-sm: 10px;
  --gap: 14px;
}

/* -------------------------------------------------------------------------
 * Reset / base
 * ----------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--link); }
:focus-visible {
  outline: 3px solid #60a5fa;
  outline-offset: 2px;
  border-radius: 6px;
}
.visually-hidden, .sr-only {
  position: absolute !important;
  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;
  top: -40px; left: 12px;
  background: var(--accent); color: #052e16;
  padding: 8px 14px; border-radius: 8px; font-weight: 700; text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus { top: 12px; }

/* -------------------------------------------------------------------------
 * Top bar
 * ----------------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 20px;
  background: var(--topbar);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text-strong); }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--accent);
  color: #052e16; font-weight: 800; font-size: 16px;
}
.brand-name { letter-spacing: 0.2px; }

.primary-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.primary-nav .tab {
  appearance: none; background: transparent; color: var(--muted);
  border: 1px solid transparent; border-radius: 999px;
  padding: 8px 14px; font-weight: 600; cursor: pointer;
  font-size: 14px;
}
.primary-nav .tab:hover { color: var(--text-strong); background: var(--card); }
.primary-nav .tab[aria-selected="true"] {
  color: var(--text-strong);
  background: var(--card-elev);
  border-color: var(--border-strong);
}

/* -------------------------------------------------------------------------
 * Layout
 * ----------------------------------------------------------------------- */
.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}
.hero { margin-bottom: 20px; background: var(--bg); }
.hero h1 {
  margin: 0 0 6px;
  font-size: clamp(1.5rem, 3vw, 2rem);
  color: var(--text-strong);
}
.lede { margin: 0; color: var(--muted); max-width: 60ch; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 14px; font-size: 1.05rem; color: var(--text-strong); }

.row { margin: 12px 0; display: flex; flex-direction: column; gap: 6px; }
.row label { font-size: 13px; color: var(--muted); font-weight: 600; }
.two-col { display: grid; grid-template-columns: 1fr; gap: var(--gap); }
@media (min-width: 640px) { .two-col { grid-template-columns: 1fr 1fr; } }

/* -------------------------------------------------------------------------
 * Form controls
 * ----------------------------------------------------------------------- */
input, textarea, select {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--card);
  color: var(--text);
  padding: 11px 13px;
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--link);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.25);
  outline: none;
}
input[type="file"] { padding: 8px; cursor: pointer; }
textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.45; }

button, .button {
  width: auto;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  padding: 11px 18px;
  font-weight: 700;
  font-size: 14.5px;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.08s ease, background 0.15s, border-color 0.15s;
}
button, a.button { text-decoration: none; }
button:disabled { opacity: 0.55; cursor: not-allowed; }
.primary {
  background: var(--accent); color: #052e16;
}
.primary:hover:not(:disabled) { background: var(--accent-strong); }
button.primary:active:not(:disabled) { transform: translateY(1px); }
.secondary {
  background: var(--card-elev); color: var(--text-strong);
  border-color: var(--border-strong);
}
.secondary:hover:not(:disabled) { border-color: var(--link); }
button.danger {
  background: transparent; color: var(--danger);
  border-color: var(--danger);
}
button.danger:hover:not(:disabled) { background: rgba(239, 68, 68, 0.12); }
form > button[type="submit"] { margin-top: 14px; }

.muted { color: var(--muted); font-size: 14px; }
.field-help { margin: 0; color: var(--muted); font-size: 12.5px; }

/* -------------------------------------------------------------------------
 * Drop zone
 * ----------------------------------------------------------------------- */
.dropzone {
  position: relative;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  background: rgba(96, 165, 250, 0.04);
  padding: 28px 18px;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--link);
  background: rgba(96, 165, 250, 0.10);
}
.dropzone input[type="file"] {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  opacity: 0; cursor: pointer;
}
.dropzone-text { margin: 0 0 6px; font-size: 15px; }
.dropzone-meta { margin: 0; font-size: 13px; color: var(--muted); min-height: 1.2em; }

/* -------------------------------------------------------------------------
 * Result card + status badges
 * ----------------------------------------------------------------------- */
.result-card {
  margin-top: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 18px;
  background: var(--card-elev);
}
.result-card .empty {
  color: var(--muted); margin: 0; font-size: 14px;
}
.result-card .badge-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.result-card .field { display: grid; grid-template-columns: 130px 1fr; gap: 6px 14px; font-size: 14px; }
.result-card .field dt { color: var(--muted); }
.result-card .field dd { margin: 0; word-break: break-word; color: var(--text-strong); }
.result-card .field dd code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; color: #e2e8f0; background: #020817; padding: 2px 6px; border-radius: 6px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid transparent;
}
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge.ok { color: #dcfce7; background: #14532d; border-color: #166534; }
.badge.warn { color: var(--warn); background: rgba(251, 191, 36, 0.12); border-color: rgba(251, 191, 36, 0.25); }
.badge.bad { color: #fee2e2; background: #7f1d1d; border-color: #991b1b; }

.malware-panel {
  margin-top: 20px;
  padding: 18px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: rgba(96, 165, 250, 0.04);
}
.malware-panel h3 { margin: 0 0 6px; color: var(--text-strong); }
.malware-panel p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.malware-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.malware-panel .result-card { margin-top: 14px; }
.malware-panel .field-help { margin-top: 10px; }
.text-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--link);
  box-shadow: none;
}
.text-button:hover:not(:disabled) { background: transparent; text-decoration: underline; }

.advanced { margin: 14px 0; }
.advanced summary { color: var(--muted); cursor: pointer; font-weight: 600; font-size: 14px; }
.advanced summary:hover { color: var(--text-strong); }
.advanced > *:not(summary) { margin-top: 10px; }

/* -------------------------------------------------------------------------
 * QR
 * ----------------------------------------------------------------------- */
.qr-wrap {
  margin-top: 14px;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-start;
}
.qr-wrap img {
  width: 220px; max-width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: white; padding: 10px;
}

/* -------------------------------------------------------------------------
 * Dashboard list
 * ----------------------------------------------------------------------- */
.dashboard-controls { display: grid; grid-template-columns: 1fr auto; gap: var(--gap); align-items: end; margin-bottom: 14px; }
@media (max-width: 540px) { .dashboard-controls { grid-template-columns: 1fr; } }
.dash-summary { color: var(--muted); margin-bottom: 14px; font-size: 14px; }

.dash-list { display: flex; flex-direction: column; gap: 10px; }
.dash-list .empty { color: var(--muted); margin: 0; font-size: 14px; }
.dash-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto;
  gap: 8px 14px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--card-elev);
  border: 1px solid var(--border);
}
.dash-row .head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.dash-row .title { font-weight: 700; color: var(--text-strong); }
.dash-row .meta { color: var(--muted); font-size: 13px; }
.dash-row code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.dash-row .actions { display: flex; gap: 8px; align-self: start; }

#dashboardLoadMore { margin-top: 14px; }

/* -------------------------------------------------------------------------
 * Output panes (still rendered, but visually hidden by default)
 * ----------------------------------------------------------------------- */
.output {
  white-space: pre-wrap;
  background: #020817;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  min-height: 56px;
  color: #cbd5e1;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  margin: 14px 0 0;
}

/* -------------------------------------------------------------------------
 * Key/value list
 * ----------------------------------------------------------------------- */
.kv { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.kv li { display: grid; grid-template-columns: 120px 1fr; gap: 14px; font-size: 14px; }
.kv li span:first-child { color: var(--muted); }
.kv li span:last-child { color: var(--text-strong); word-break: break-all; }

/* -------------------------------------------------------------------------
 * Toasts
 * ----------------------------------------------------------------------- */
.toast-region {
  position: fixed; bottom: 18px; right: 18px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 1000;
  pointer-events: none;
  max-width: calc(100vw - 36px);
}
.toast {
  pointer-events: auto;
  background: var(--card-elev);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--link);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 14px;
  color: var(--text-strong);
  transform: translateY(20px); opacity: 0;
  transition: transform 0.18s, opacity 0.18s;
  max-width: 360px;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.ok { border-left-color: var(--accent); }
.toast.warn { border-left-color: var(--warn); }
.toast.error { border-left-color: var(--danger); }
.toast button.close {
  background: transparent; border: 0; color: var(--muted);
  padding: 0 0 0 8px; cursor: pointer; font-weight: 700;
  font-size: 16px;
}

/* -------------------------------------------------------------------------
 * Reduced motion
 * ----------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* -------------------------------------------------------------------------
 * Theme toggle + light theme tokens
 * The site is dark by default; users on light-mode browsers get auto-light,
 * and either preference can be overridden by clicking the toggle (persisted
 * to localStorage as data-theme="light"|"dark" on <html>).
 * ----------------------------------------------------------------------- */
.theme-toggle {
  appearance: none; background: #ffffff; border: 1px solid #64748b;
  color: #000000; border-radius: 999px;
  width: auto; min-width: 36px; height: 36px; padding: 0 10px; display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
  cursor: pointer; transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.theme-toggle:hover { color: #000000; background: #ffffff; border-color: #2563eb; }

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f8fafc;
    --bg-elev: #f1f5f9;
    --card: #ffffff;
    --card-elev: #f8fafc;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --text: #0f172a;
    --text-strong: #020617;
    --muted: #475569;
    /* Darker link on light backgrounds: #60a5fa only hits 2.54:1 on white;
       #2563eb (blue-600) gives ~5.2:1 to pass WCAG AA contrast. */
    --link: #2563eb;
    --topbar: #f8fafc;
    --shadow: 0 8px 20px -10px rgba(15, 23, 42, 0.18);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f8fafc;
  --bg-elev: #f1f5f9;
  --card: #ffffff;
  --card-elev: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-strong: #020617;
  --muted: #475569;
  /* See note above — darker link for AA contrast on light backgrounds. */
  --link: #2563eb;
  --topbar: #f8fafc;
  --shadow: 0 8px 20px -10px rgba(15, 23, 42, 0.18);
}

/* -------------------------------------------------------------------------
 * Trust strip on Verify hero
 * ----------------------------------------------------------------------- */
.trust-strip {
  display: flex; flex-wrap: wrap; gap: 14px;
  list-style: none; padding: 0; margin: 14px 0 0;
}
.trust-strip li {
  font-size: 13px; color: var(--muted);
  padding: 6px 12px; border: 1px solid var(--border);
  border-radius: 999px; background: var(--card);
}
.trust-strip strong { color: var(--text-strong); font-weight: 700; margin-right: 4px; }

/* -------------------------------------------------------------------------
 * Dashboard client-side search
 * ----------------------------------------------------------------------- */
.dash-search {
  width: 100%;
  margin: 8px 0 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  color: var(--text);
  font-size: 14px;
}
.dash-row.is-filtered-out { display: none; }

/* -------------------------------------------------------------------------
 * Skeleton loading state (used while async fetches resolve)
 * ----------------------------------------------------------------------- */
.skeleton {
  position: relative;
  background: linear-gradient(90deg,
    var(--card) 0%, var(--card-elev) 50%, var(--card) 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
  border-radius: var(--radius-sm);
  color: transparent !important;
  user-select: none;
  border: 1px solid var(--border);
  min-height: 18px;
}
.skeleton-row {
  height: 64px;
  margin-bottom: 10px;
}
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
}

/* Batch register results table */
table.batch-results { width: 100%; border-collapse: collapse; margin-top: 1rem; font-size: 0.9rem; }
table.batch-results th, table.batch-results td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border, #e5e7eb); }
table.batch-results th { font-weight: 600; color: var(--muted, #6b7280); }
table.batch-results code { font-size: 0.85em; }
.badge.warn { background: #fef3c7; color: #92400e; }

/* Pricing grid */
.pricing-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-top: 1rem; }
.plan-card { border: 1px solid var(--border, #e5e7eb); border-radius: 12px; padding: 1.25rem; background: var(--card); color: var(--text); display: flex; flex-direction: column; gap: 0.5rem; box-shadow: var(--shadow); }
.plan-card h3 { margin: 0 0 0.25rem; font-size: 1.15rem; }
.plan-price { margin: 0; font-size: 1.6rem; line-height: 1; }
.plan-quota { margin: 0.25rem 0; }
.plan-features { margin: 0.5rem 0; padding-left: 1.1rem; font-size: 0.9rem; color: var(--muted, #6b7280); }
.plan-features li { margin: 0.1rem 0; }
.plan-cta { margin-top: auto; padding-top: 0.5rem; }
.plan-cta .primary, .plan-cta button { width: 100%; display: block; text-align: center; }

/* Product notices, legal/support footer, and standalone policy pages */
.notice {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  color: var(--text);
  background: var(--card);
}
.notice:empty { display: none; }
.notice-info { border-left: 4px solid var(--link); }
.notice-warn { border-left: 4px solid var(--warn); }
.pricing-contact { margin-top: 1rem; }

.site-footer {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 20px 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: var(--muted);
  background: var(--bg);
  font-size: 13px;
}
.site-footer p { margin: 0; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 12px; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--text-strong); }
.noscript {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  z-index: 1001;
  padding: 1rem;
  border: 1px solid var(--warn);
  border-radius: var(--radius-sm);
  color: var(--text-strong);
  background: var(--card);
}

.legal-page {
  max-width: 780px;
  margin: 0 auto;
  padding: 42px 20px 80px;
  line-height: 1.65;
  background: var(--bg);
}
.legal-page header { margin-bottom: 2rem; }
.legal-page h1, .legal-page h2 { color: var(--text-strong); background: var(--bg); }
.legal-page h1 { margin-bottom: 0.35rem; }
.legal-page h2 { margin-top: 2rem; font-size: 1.15rem; }
.legal-page p, .legal-page li { color: var(--text); background: var(--bg); }
.legal-page .updated { color: var(--muted); font-size: 0.9rem; }
.legal-page .back-link { display: inline-block; margin-bottom: 1.5rem; }

@media (max-width: 760px) {
  .topbar { align-items: flex-start; flex-wrap: wrap; }
  .primary-nav { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .primary-nav .tab { flex: 0 0 auto; }
  .site-footer { align-items: flex-start; flex-direction: column; }
  .dash-row { grid-template-columns: 1fr; }
  .dash-row .actions { flex-wrap: wrap; }
}

/* Usage bar */
.usage-bar { height: 10px; background: var(--border, #e5e7eb); border-radius: 999px; overflow: hidden; margin: 0.75rem 0 0.5rem; }
.usage-fill { height: 100%; width: 0%; transition: width 250ms ease; background: #10b981; }
.usage-fill.warn { background: #f59e0b; }
.usage-fill.danger { background: #ef4444; }

/* Code blocks (API docs) */
pre.code-block { background: #0b1020; color: #d8e1ff; padding: 1rem 1.1rem; border-radius: 10px; overflow-x: auto; font-size: 0.85rem; line-height: 1.45; }
pre.code-block code { background: transparent; color: inherit; padding: 0; }
[data-theme="light"] pre.code-block { background: #0f172a; color: #e2e8f0; }
