/* ── Accessibility ─────────────────────────────────────────────────── */
.skip-to-content { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; z-index: 9999; background: var(--accent); color: var(--bg); padding: 12px 24px; font-size: 14px; font-weight: 600; border-radius: 0 0 var(--radius) 0; text-decoration: none; }
.skip-to-content:focus { left: 0; top: 0; width: auto; height: auto; overflow: visible; }

/* ── Alpine.js cloak (hide until initialized) ─────────────────────── */
[x-cloak] { display: none !important; }

/* ── Reset ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scrollbar-gutter: stable; }
button { display: inline-flex; align-items: center; justify-content: center; cursor: default; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--bg-card) inset;
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  transition: background-color 5000s ease-in-out 0s;
}

/* ── Selection color ───────────────────────────────────────────────── */
::selection { background: var(--accent-glow); color: var(--text); }
::-moz-selection { background: var(--accent-glow); color: var(--text); }

/* ── Focus-visible ─────────────────────────────────────────────────── */
:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-glow), 0 0 0 1px var(--accent); }
:focus:not(:focus-visible) { outline: none; }

/* ── Theme: Dark (default) ─────────────────────────────────────────── */
:root {
  --bg: #060F0B;
  --bg-card: #0D1B14;
  --bg-card-hover: #162922;
  --bg-input: #213D32;
  --bg-surface: #162922;
  --border: #1E3A2E;
  --border-hover: #2E5442;
  --text: #E8F4ED;
  --text-dim: #7DA892;
  --text-muted: #6A9A84;
  --red: #D4766A;
  --red-bg: rgba(212, 118, 106, 0.1);
  --green: #67E8F9;
  --green-bg: rgba(103, 232, 249, 0.1);
  --yellow: #C4A24E;
  --yellow-bg: rgba(196, 162, 78, 0.1);
  --blue: var(--accent);
  --blue-bg: var(--accent-glow);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --font-heading: 'Manrope', -apple-system, 'Segoe UI', sans-serif;
  --font-body: 'Golos Text', -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;
  --font: var(--font-body);
  --mono: var(--font-mono);

  /* z-index scale */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-modal-backdrop: 300;
  --z-modal: 310;
  --z-popover: 400;
  --z-tooltip: 500;

  /* Shadows — dark mode: light glow for visible depth on dark backgrounds */
  --shadow-xs: 0 1px 3px rgba(0,0,0,0.5), 0 0 0 1px rgba(30,58,46,0.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.4), 0 0 1px rgba(52,211,153,0.05);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.5), 0 0 12px rgba(52,211,153,0.08);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.6), 0 0 24px rgba(52,211,153,0.12);

  /* Animation tokens */
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --dur-fast: 0.15s;
  --dur-mid: 0.25s;
  --dur-slow: 0.35s;

  /* Spacing scale — 4px base, used project-wide instead of hardcoded values */
  --space-2xs: 4px;
  --space-xs: 6px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-2xl: 32px;
  --space-3xl: 48px;
  --space-4xl: 64px;

  /* Typography scale — everything derives from --fs-base */
  --fs-base: 15px;
  --fs-xs: calc(var(--fs-base) - 4px);
  --fs-sm: calc(var(--fs-base) - 2px);
  --fs-md: calc(var(--fs-base) - 1px);
  --fs-lg: var(--fs-base);
  --fs-xl: calc(var(--fs-base) + 1px);
  --fs-metric: calc(var(--fs-base) + 18px);
}

/* ── Theme: Light — Warm Herb "Daylight Forest" ────────────────────── */
/* Palette logic: olive-sage hue (~80°) for backgrounds (low saturation),
   dark forest for text, vivid #1A9648 accent as the green identity anchor.
   Mirrors dark theme: near-neutral bg → slightly lighter card → accent pops. */
.light {
  --bg: #F3F4ED;
  --bg-card: #FAFAF5;
  --bg-card-hover: #EEEEE7;
  --bg-input: #E9E9E1;
  --bg-surface: #E3E4DB;
  --border: #CCCEBE;
  --border-hover: #A8AE98;
  --text: #1E2318;
  --text-dim: #4C5640;
  --text-muted: #7A8A6A;
  --red: #C82020;
  --red-bg: rgba(200,32,32,0.08);
  --green: #1A9648;
  --green-bg: rgba(26,150,72,0.08);
  --yellow: #B87E00;
  --yellow-bg: rgba(184,126,0,0.08);
  --blue: #2060D8;
  --blue-bg: rgba(32,96,216,0.08);
  /* Shadows — warm-tinted base + subtle accent glow (mirrors dark mode logic) */
  --shadow-xs: 0 1px 2px rgba(30,35,24,0.06), 0 0 0 1px rgba(30,35,24,0.04);
  --shadow-sm: 0 1px 3px rgba(30,35,24,0.07), 0 4px 14px rgba(30,35,24,0.06), 0 0 1px rgba(26,150,72,0.04);
  --shadow-md: 0 2px 4px rgba(30,35,24,0.07), 0 8px 28px rgba(30,35,24,0.10), 0 0 8px rgba(26,150,72,0.06);
  --shadow-lg: 0 4px 8px rgba(30,35,24,0.07), 0 16px 48px rgba(30,35,24,0.14), 0 0 20px rgba(26,150,72,0.08);
}

/* ── Accent colors (macOS-style) ──────────────────────────────────── */
/* Default is blue — no class needed */
:root {
  --accent: #34D399; --accent-hover: #6EE7B7; --accent-glow: rgba(52,211,153,0.15);
  --on-accent: #060F0B; /* text/icon on accent background — dark in dark mode (light accent) */
}
.light {
  --accent: #1A9648; --accent-hover: #157538; --accent-glow: rgba(26,150,72,0.15);
  --on-accent: #FFFFFF; /* text/icon on accent background — white in light mode (dark accent) */
}
.accent-purple {
  --accent: #BF5AF2; --accent-hover: #D17DF5; --accent-glow: rgba(191,90,242,0.15);
}
.light.accent-purple {
  --accent: #9333EA; --accent-hover: #7E22CE; --accent-glow: rgba(147,51,234,0.12);
}
.accent-pink {
  --accent: #FF375F; --accent-hover: #FF6482; --accent-glow: rgba(255,55,95,0.15);
}
.light.accent-pink {
  --accent: #EC4899; --accent-hover: #DB2777; --accent-glow: rgba(236,72,153,0.12);
}
.accent-red {
  --accent: #FF453A; --accent-hover: #FF6961; --accent-glow: rgba(255,69,58,0.15);
}
.light.accent-red {
  --accent: #DC2626; --accent-hover: #B91C1C; --accent-glow: rgba(220,38,38,0.12);
}
.accent-orange {
  --accent: #FF9F0A; --accent-hover: #FFB340; --accent-glow: rgba(255,159,10,0.15);
}
.light.accent-orange {
  --accent: #EA580C; --accent-hover: #C2410C; --accent-glow: rgba(234,88,12,0.12);
}
.accent-yellow {
  --accent: #FFD60A; --accent-hover: #FFE040; --accent-glow: rgba(255,214,10,0.15);
}
.light.accent-yellow {
  --accent: #CA8A04; --accent-hover: #A16207; --accent-glow: rgba(202,138,4,0.12);
}
.accent-green {
  --accent: #30D158; --accent-hover: #5ADA7B; --accent-glow: rgba(48,209,88,0.15);
}
.light.accent-green {
  --accent: #15803D; --accent-hover: #166534; --accent-glow: rgba(21,128,61,0.12);
}
.accent-graphite {
  --accent: #98989D; --accent-hover: #B0B0B5; --accent-glow: rgba(152,152,157,0.15);
}
.light.accent-graphite {
  --accent: #6B7280; --accent-hover: #4B5563; --accent-glow: rgba(107,114,128,0.12);
}

/* ── Interface scale (html-level classes set by Settings) ─────────── */
/* Override --fs-base; all --fs-* tokens recalculate automatically */
html.text-xs { --fs-base: 13px; }
html.text-sm { --fs-base: 14px; }
/* md = default (--fs-base: 15px, no class needed) */
html.text-lg { --fs-base: 16px; }
html.text-xl { --fs-base: 17px; }

/* ── Body ──────────────────────────────────────────────────────────── */
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  font-size: var(--fs-xl);
  background-image: radial-gradient(ellipse at 40%% 0%%, rgba(16,185,129,0.09) 0%%, transparent 55%%);
  background-attachment: fixed;
}
.light body {
  background-image: radial-gradient(ellipse at 40%% 0%%, rgba(26,150,72,0.05) 0%%, transparent 55%%);
}

/* ── Headings ─────────────────────────────────────────────────────── */
h1, h2, h3 {
  font-family: var(--font-heading);
  line-height: 1.2;
}

/* ── Scrollbar ─────────────────────────────────────────────────────── */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }
::-webkit-scrollbar-corner { background: transparent; }

/* ── Layout container ────────────────────────────────────────────── */
.layout { padding: 24px 28px; max-width: 1200px; margin: 0 auto; }

/* ── Card (reusable block) ────────────────────────────────────────── */
.card {
  background: rgba(13, 27, 20, 0.55);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,0.4), 0 8px 24px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.05);
  transition: box-shadow var(--dur-mid) var(--ease), transform var(--dur-mid) var(--ease), border-color var(--dur-mid);
}
.card:hover {
  box-shadow: 0 2px 4px rgba(0,0,0,0.5), 0 12px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.08);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}
.light .card {
  background: rgba(250, 250, 245, 0.88);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  border-color: transparent;
  box-shadow: var(--shadow-sm);
}
.light .card:hover {
  box-shadow: var(--shadow-md);
  border-color: transparent;
}
.card + .card { margin-top: 24px; }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  font-size: var(--fs-xl); font-weight: 600; cursor: pointer;
}
.collapsible.collapsed .card-header { border-bottom: none; }
.card-body { padding: 20px 24px; }

@media (max-width: 768px) {
  .layout { padding: 16px; }
  .card-header { padding: 12px 16px; }
  .card-body { padding: 16px; }
  .card + .card { margin-top: 12px; }
}

/* ── Form shared ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 12px; }
.form-label {
  display: block; font-size: var(--fs-sm); font-weight: 500;
  color: var(--text-dim); margin-bottom: 5px;
}
.form-input {
  width: 100%; padding: 9px 12px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-size: var(--fs-md); font-family: inherit;
  outline: none;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow), inset 0 1px 2px rgba(0,0,0,0.08);
}
.light .form-input {
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.04);
}
.light .form-input:focus {
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--bg-card);
}
.form-input.error,
.form-input:invalid:not(:placeholder-shown) {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-bg), inset 0 1px 2px rgba(0,0,0,0.08);
}
.form-input.error:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-bg);
}
.form-input::placeholder { color: var(--text-muted); }
.form-error {
  font-size: var(--fs-sm); color: var(--red); margin-top: var(--space-2xs);
  display: none; line-height: 1.4;
}
.form-error.visible { display: block; }
.form-label .form-error { margin-top: 0; margin-left: auto; font-weight: 400; }
.form-label .form-error.visible { display: inline; }
select.form-input {
  cursor: pointer; appearance: none; -webkit-appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238E8E93' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 14px;
}

/* ── Animations ──────────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}
.anim { animation: fadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both; }
.d1 { animation-delay: .04s; }
.d2 { animation-delay: .08s; }
.d3 { animation-delay: .12s; }
.d4 { animation-delay: .16s; }
.d5 { animation-delay: .20s; }
.d6 { animation-delay: .24s; }
.d7 { animation-delay: .28s; }
.d8 { animation-delay: .32s; }
@media (prefers-reduced-motion: reduce) { .anim { animation: none; } }

/* ── Light mode: shadow-driven depth instead of borders ──────────── */
.light .card,
.light .audit-card,
.light .settings-section,
.light .modal-box,
.light .help-index-card,
.light .cause {
  border-color: transparent;
  box-shadow: var(--shadow-sm);
}
.light .card:hover,
.light .audit-card:hover,
.light .settings-section:hover,
.light .help-index-card:hover {
  box-shadow: var(--shadow-md);
  border-color: transparent;
}

/* ── Collapsible ─────────────────────────────────────────────────── */
.collapsible-toggle { cursor: pointer; user-select: none; }
.collapsible-body {
  overflow: hidden; max-height: 1000px;
  transition: max-height var(--dur-mid) var(--ease), opacity var(--dur-mid) var(--ease); opacity: 1;
}
.collapsible.collapsed .collapsible-body {
  max-height: 0; opacity: 0;
  padding-top: 0 !important; padding-bottom: 0 !important;
}
.collapse-icon {
  font-size: var(--fs-xs); color: var(--text-dim);
  transition: transform var(--dur-mid) var(--ease); flex-shrink: 0;
}
.collapsible.collapsed .collapse-icon { transform: rotate(180deg); }

/* ── Table ──────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-md);
}
.table th {
  text-align: left;
  padding: 8px 12px;
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr { transition: background var(--dur-fast); }
.table tbody tr:hover td { background: var(--bg-card-hover); }
.table tr:last-child td { border-bottom: none; }

@media (max-width: 768px) {
  .table { font-size: var(--fs-sm); }
  .table th, .table td { padding: 6px 8px; }
}

/* ── Button system (Apple HIG) ────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-family: var(--font);
  font-size: var(--fs-md);
  font-weight: 500;
  border: none;
  border-radius: var(--radius-sm);
  cursor: default;
  transition: filter var(--dur-fast), transform var(--dur-fast), background var(--dur-fast);
  white-space: nowrap;
  text-decoration: none;
  user-select: none;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; pointer-events: none; }

/* Variants */
.btn-primary {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent), #fff 10%) 0%, var(--accent) 50%, color-mix(in srgb, var(--accent), #000 20%) 100%);
  color: var(--on-accent);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2), 0 4px 12px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.15);
}
.btn-primary:hover {
  filter: brightness(1.15);
  box-shadow: 0 2px 4px rgba(0,0,0,0.25), 0 6px 20px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.2);
}
.light .btn-primary {
  box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 4px 12px rgba(22,163,74,0.2);
}
.light .btn-primary:hover {
  box-shadow: 0 2px 6px rgba(0,0,0,0.15), 0 6px 20px rgba(22,163,74,0.25);
}

.btn-ghost {
  background: var(--bg-input);
  color: var(--text);
}
.btn-ghost:hover { filter: brightness(1.1); }

.btn-danger {
  background: var(--red-bg);
  color: var(--red);
}
.btn-danger:hover { filter: brightness(1.15); }

.btn-success {
  background: var(--green-bg);
  color: var(--green);
}
.btn-success:hover { filter: brightness(1.15); }

/* Sizes */
.btn-sm  { padding: 5px 12px; font-size: var(--fs-sm); }
.btn-lg  { padding: 12px 24px; font-size: var(--fs-xl); font-weight: 600; border-radius: var(--radius); }
.btn-full { width: 100%; }

/* ── Nav buttons (landing / help nav bars) ────────────────────────── */
.nav-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 20px; font-family: var(--font); font-size: var(--fs-md); font-weight: 500;
  border-radius: var(--radius-sm); cursor: pointer; text-decoration: none;
  transition: filter var(--dur-fast), transform var(--dur-fast); white-space: nowrap; border: none;
}
.nav-btn:active { transform: scale(0.97); }
.nav-btn-ghost { background: var(--bg-input); color: var(--text); }
.nav-btn-ghost:hover { filter: brightness(1.1); text-decoration: none; }
.nav-btn-primary {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent), #fff 10%) 0%, var(--accent) 50%, color-mix(in srgb, var(--accent), #000 20%) 100%);
  color: var(--on-accent); font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2), 0 4px 12px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.15);
}
.nav-btn-primary:hover {
  filter: brightness(1.15); text-decoration: none;
  box-shadow: 0 2px 4px rgba(0,0,0,0.25), 0 6px 20px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.2);
}

/* ── Utility classes ──────────────────────────────────────────────── */

/* Display */
.d-none          { display: none; }
.d-block         { display: block; }
.d-flex          { display: flex; }
.d-inline-flex   { display: inline-flex; }
.d-grid          { display: grid; }

/* Flexbox */
.flex-col        { flex-direction: column; }
.flex-wrap       { flex-wrap: wrap; }
.flex-1          { flex: 1; }
.shrink-0        { flex-shrink: 0; }
.items-center    { align-items: center; }
.items-start     { align-items: flex-start; }
.items-end       { align-items: flex-end; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.justify-between { justify-content: space-between; }

/* Gap */
.gap-4   { gap: 4px; }
.gap-5   { gap: 5px; }
.gap-8   { gap: 8px; }
.gap-10  { gap: 10px; }
.gap-12  { gap: 12px; }
.gap-16  { gap: 16px; }
.gap-20  { gap: 20px; }

/* Margin */
.m-0     { margin: 0; }
.mt-2    { margin-top: 2px; }
.mt-4    { margin-top: 4px; }
.mt-8    { margin-top: 8px; }
.mt-10   { margin-top: 10px; }
.mt-12   { margin-top: 12px; }
.mt-14   { margin-top: 14px; }
.mt-16   { margin-top: 16px; }
.mt-20   { margin-top: 20px; }
.mt-32   { margin-top: 32px; }
.mb-0    { margin-bottom: 0; }
.mb-4    { margin-bottom: 4px; }
.mb-8    { margin-bottom: 8px; }
.mb-10   { margin-bottom: 10px; }
.mb-16   { margin-bottom: 16px; }
.mb-24   { margin-bottom: 24px; }
.ml-auto { margin-left: auto; }
.mr-6    { margin-right: 6px; }

/* Padding */
.p-0     { padding: 0; }
.p-10    { padding: 10px; }
.p-12    { padding: 12px; }
.p-16    { padding: 16px; }
.p-20    { padding: 20px; }
.p-24    { padding: 24px; }
.p-40    { padding: 40px; }
.py-40   { padding-top: 40px; padding-bottom: 40px; }
.px-12   { padding-left: 12px; padding-right: 12px; }
.px-20   { padding-left: 20px; padding-right: 20px; }
.py-8    { padding-top: 8px; padding-bottom: 8px; }
.py-10   { padding-top: 10px; padding-bottom: 10px; }
.py-12   { padding-top: 12px; padding-bottom: 12px; }
.pt-12   { padding-top: 12px; }

/* Width / Height */
.w-full   { width: 100%; }
.w-16     { width: 16px; }
.w-22     { width: 22px; }
.w-100    { width: 100px; }
.w-140    { width: 140px; }
.h-8      { height: 8px; }
.h-16     { height: 16px; }
.h-38     { height: 38px; }
.min-w-0   { min-width: 0; }
.min-w-28  { min-width: 28px; }
.min-w-200 { min-width: 200px; }
.min-w-220 { min-width: 220px; }
.max-w-420 { max-width: 420px; }
.max-w-700 { max-width: 700px; }

/* Typography */
.text-11  { font-size: calc(var(--fs-base) - 3px); }
.text-12  { font-size: var(--fs-sm); }
.text-13  { font-size: var(--fs-md); }
.text-14  { font-size: var(--fs-lg); }
.text-16  { font-size: calc(var(--fs-base) + 2px); }
.text-18  { font-size: calc(var(--fs-base) + 4px); }
.text-28  { font-size: calc(var(--fs-base) + 14px); }
.text-48  { font-size: calc(var(--fs-base) + 34px); }
.fw-400   { font-weight: 400; }
.fw-500   { font-weight: 500; }
.fw-600   { font-weight: 600; }
.fw-700   { font-weight: 700; }
.font-mono { font-family: var(--mono); }
.leading-loose { line-height: 2; }

/* Text color */
.text-accent   { color: var(--accent); }
.text-success  { color: var(--green); }
.text-warning  { color: var(--yellow); }
.text-danger   { color: var(--red); }
.text-muted    { color: var(--text-dim); }
.text-inherit  { color: inherit; }

/* Text alignment */
.text-center { text-align: center; }
.text-left   { text-align: left; }

/* Text misc */
.no-underline { text-decoration: none; }
.uppercase    { text-transform: uppercase; }
.nowrap       { white-space: nowrap; }
.break-all    { word-break: break-all; }
.truncate     { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Background */
.bg-transparent { background: transparent; }
.bg-raised      { background: var(--bg-input); }
.bg-accent      { background: var(--accent); }
.bg-bg          { background: var(--bg); }

/* Border */
.border         { border: 1px solid var(--border); }
.border-2       { border: 2px solid var(--border); }
.border-b       { border-bottom: 1px solid var(--border); }
.border-t       { border-top: 1px solid var(--border); }
.border-none    { border: none; }
.border-danger  { border-color: var(--red); }
.border-accent  { border-color: var(--accent); }
.rounded        { border-radius: var(--radius); }
.rounded-4      { border-radius: 4px; }
.rounded-6      { border-radius: 6px; }
.rounded-10     { border-radius: 10px; }

/* Position */
.relative { position: relative; }
.absolute { position: absolute; }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }

/* Cursor */
.cursor-pointer { cursor: pointer; }
.cursor-default { cursor: default; }

/* Opacity */
.opacity-60 { opacity: 0.6; }

/* Transition */
.transition-opacity { transition: opacity var(--dur-fast); }

/* Grid */
.grid-cols-2 { grid-template-columns: 1fr 1fr; }

/* Icon button — header nav icons */
.icon-btn {
  background: none; border: none; cursor: pointer;
  font-size: calc(var(--fs-base) + 2px); padding: 0; width: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none; opacity: 1; transition: opacity var(--dur-fast);
}
.icon-btn:hover { opacity: 0.6; }

/* ── Badge ────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: calc(var(--fs-base) - 3px);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid transparent;
}

.badge-pending  { background: var(--yellow-bg); color: var(--yellow); border-color: var(--yellow-bg); }
.badge-running  { background: var(--accent-glow); color: var(--accent); border-color: var(--accent-glow); }
.badge-done     { background: var(--green-bg);  color: var(--green); border-color: var(--green-bg); }
.badge-failed   { background: var(--red-bg);  color: var(--red); border-color: var(--red-bg); }
.badge-stopping { background: var(--yellow-bg); color: var(--yellow); border-color: var(--yellow-bg); }
.badge-stopped  { background: rgba(125, 133, 144, 0.1); color: var(--text-dim); border-color: var(--border); }
.badge-ok       { background: var(--green-bg);  color: var(--green); border-color: var(--green-bg); }
.badge-warn     { background: var(--yellow-bg); color: var(--yellow); border-color: var(--yellow-bg); }
.badge-err      { background: var(--red-bg);  color: var(--red); border-color: var(--red-bg); }
.badge-info     { background: var(--accent-glow); color: var(--accent); border-color: var(--accent-glow); }
.badge-muted    { background: rgba(125, 133, 144, 0.1); color: var(--text-dim); border-color: var(--border); }
.badge-active   { background: var(--green-bg);  color: var(--green); border-color: var(--green-bg); }
.badge-paused   { background: var(--yellow-bg); color: var(--yellow); border-color: var(--yellow-bg); }

/* Semantic badge variants (design system) */
.badge-success { background: var(--green-bg); color: var(--green); border-color: var(--green-bg); }
.badge-warning { background: var(--yellow-bg); color: var(--yellow); border-color: var(--yellow-bg); }
.badge-error   { background: var(--red-bg); color: var(--red); border-color: var(--red-bg); }
.badge-neutral { background: var(--bg-input); color: var(--text-dim); border-color: var(--border); }
.badge-accent  { background: var(--accent-glow); color: var(--accent); border-color: var(--accent-glow); }

/* ── Score badge ──────────────────────────────────────────────────── */
.score-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: var(--fs-md);
  font-weight: 700;
  font-family: var(--font-heading);
  box-shadow: var(--shadow-xs);
}
.score-high { background: rgba(0,214,143,0.15);  color: var(--green); }
.score-mid  { background: rgba(255,192,72,0.15); color: var(--yellow); }
.score-low  { background: rgba(255,107,107,0.15);  color: var(--red); }
.score-a    { background: rgba(0,214,143,0.15);  color: var(--green); }
.score-b    { background: rgba(255,192,72,0.15); color: var(--yellow); }
.score-c    { background: rgba(255,107,107,0.15);  color: var(--red); }

/* ── Button: close ────────────────────────────────────────────────── */
.btn-close {
  padding: 4px 8px;
  font-size: calc(var(--fs-base) + 6px);
  line-height: 1;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  transition: color var(--dur-fast);
}
.btn-close:hover { color: var(--text); }

/* ── Button: open URL ─────────────────────────────────────────────── */
.btn-open-url {
  display: inline-block;
  color: var(--text-dim);
  text-decoration: none;
  font-size: calc(var(--fs-base) - 3px);
  margin-left: 6px;
  vertical-align: middle;
  opacity: 0.6;
  transition: opacity var(--dur-fast);
}
.btn-open-url:hover { opacity: 1; color: var(--accent); }

/* ── Detail grid ──────────────────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.detail-item label {
  display: block;
  font-size: calc(var(--fs-base) - 3px);
  color: var(--text-dim);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.detail-item span { font-size: var(--fs-lg); font-weight: 500; }

/* ── Result tabs ──────────────────────────────────────────────────── */
.result-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
  gap: 0;
}
.result-tab {
  padding: 10px 18px;
  font-size: var(--fs-sm);
  font-weight: 600;
  font-family: var(--font);
  color: var(--text-dim);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--dur-fast);
}
.result-tab:hover { color: var(--text); }
.result-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; padding: 16px 0; }

/* ── Audit grid ───────────────────────────────────────────────────── */
.audit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.audit-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--dur-mid) var(--ease), border-color var(--dur-mid);
}
.audit-card:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--border-hover);
}
.audit-card-value {
  font-size: calc(var(--fs-base) + 8px);
  font-weight: 700;
  font-family: var(--mono);
  margin-bottom: 4px;
}
.audit-card-label {
  font-size: calc(var(--fs-base) - 3px);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.audit-ok   { color: var(--green); }
.audit-warn { color: var(--yellow); }
.audit-bad  { color: var(--red); }

/* ── Results table ────────────────────────────────────────────────── */
.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.results-table th {
  text-align: left;
  padding: 8px 10px;
  background: var(--bg);
  color: var(--text-dim);
  font-weight: 600;
  font-size: calc(var(--fs-base) - 3px);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: sticky;
  top: 0;
}
.results-table td {
  padding: 8px 10px;
  border-top: 1px solid var(--border);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}
.results-table tr:hover td { background: var(--bg-input); }

.error-text { color: var(--red); }

/* ── Modal ─────────────────────────────────────────────────────────── */
.modal {
  background: rgba(28,28,30,0.95);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  width: 94%;
  max-width: 1100px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5), 0 4px 12px rgba(0,0,0,0.3);
}
.light .modal {
  background: rgba(250, 250, 245, 0.97);
  border-color: transparent;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: var(--fs-lg);
  font-weight: 600;
  word-break: break-all;
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
}

/* ── Tablet (≤1024px) ────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .layout { padding: 16px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metric-card { border-right: none; border-bottom: 1px solid var(--border); }
  .metric-card:nth-child(odd) { border-right: 1px solid var(--border); }
  .metric-card:nth-last-child(-n+2) { border-bottom: none; }
  .chart-tabs { gap: 2px; }
  .chart-tab { padding: 5px 10px; font-size: calc(var(--fs-base) - 3px); }
  .chart-site-select { max-width: 120px; }
}

/* ── Small mobile (≤480px) ───────────────────────────────────────── */
@media (max-width: 480px) {
  .layout { padding: 8px; padding-top: 12px; }
}

/* ── Toast (Apple-style, global) ─────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  left: auto;
  width: max-content;
  max-width: min(420px, calc(100vw - 16px));
  transform: translateY(20px) scale(0.97);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 36px 14px 16px;
  cursor: pointer;
  background: rgba(13, 27, 20, 0.9);
  border: none;
  border-radius: 14px;
  font-size: var(--fs-lg);
  font-weight: 600;
  color: #fff;
  box-shadow: 0 6px 24px rgba(0,0,0,0.3);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1),
              opacity 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.light .toast { background: rgba(250, 250, 245, 0.92); color: var(--text); box-shadow: var(--shadow-md); border: 1px solid rgba(30,35,24,0.06); }
.toast.show {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}
.toast-close {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: inherit; opacity: 0.5;
  font-size: var(--fs-sm); cursor: pointer; padding: 2px 4px; line-height: 1;
}
.toast-close:hover { opacity: 1; }
.toast-icon {
  width: 18px; height: 18px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
/* Variants — icon colored, subtle border hint */
.toast--success .toast-icon { color: var(--green); }
.toast--success { border: 1px solid rgba(103, 232, 249, 0.15); }
.toast--error .toast-icon { color: var(--red); }
.toast--error { border: 1px solid var(--red-bg); }
.toast--warn .toast-icon { color: var(--yellow); }
.toast--warn { border: 1px solid var(--yellow-bg); }
.toast--info .toast-icon { color: var(--blue); }
.toast--info { border: 1px solid var(--accent-glow); }
@media (max-width: 768px) {
  .toast {
    bottom: 16px;
    right: 16px;
    max-width: calc(100vw - 32px);
  }
}

/* ── URL input clear button ───────────────────────────────────────── */
.input-clear-wrap {
  position: relative;
  display: flex;
  flex: 1;
  min-width: 0;
}
.input-clear-wrap > input {
  flex: 1;
  min-width: 0;
  padding-right: 36px;
}
.input-clear-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  line-height: 1;
  border-radius: 50%;
  display: none;
  transition: color var(--dur-fast);
  z-index: 1;
}
.input-clear-btn:hover { color: var(--text); }

/* ── Toggle — design system (iOS-style) ──────────────────────────── */
/* Named .ds-toggle to avoid conflict with settings.css .toggle */
.ds-toggle {
  position: relative;
  width: 44px; height: 26px;
  border-radius: 9999px;
  background: var(--bg-input);
  border: none;
  cursor: pointer;
  transition: background var(--dur-mid) var(--ease);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.15);
  flex-shrink: 0;
}
.ds-toggle::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: linear-gradient(180deg, #fff 0%, #f0f0f0 100%);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2), 0 0 1px rgba(0,0,0,0.1);
  transition: transform var(--dur-mid) var(--ease);
}
.ds-toggle.on {
  background: var(--green);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.1), 0 1px 3px var(--green-bg);
}
.ds-toggle.on::after { transform: translateX(18px); }
.light .ds-toggle { box-shadow: inset 0 1px 3px rgba(0,0,0,0.08); }
.light .ds-toggle.on { background: linear-gradient(180deg, var(--accent) 0%, var(--accent-hover) 100%); }

/* ── Period toggle ─────────────────────────────────────────────────── */
.pricing-period {
  display: inline-flex;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 36px;
}
.period-btn {
  padding: 8px 20px;
  font-family: var(--font);
  font-size: var(--fs-md);
  font-weight: 500;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: all var(--dur-fast);
}
.period-btn.active {
  background: var(--accent);
  color: var(--on-accent);
}
.period-save {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--accent);
  margin-left: 4px;
}
.period-btn.active .period-save {
  color: var(--on-accent);
}
.light .pricing-period {
  background: var(--bg);
}

/* ── Tooltip — design system ──────────────────────────────────────── */
/* Named .ds-tooltip to avoid conflict with dashboard.css .tooltip */
.ds-tooltip {
  position: absolute;
  padding: 6px 12px;
  background: var(--text);
  color: var(--bg);
  font-size: var(--fs-sm);
  font-weight: 500;
  border-radius: var(--radius-xs);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity var(--dur-fast), transform var(--dur-fast);
  z-index: var(--z-tooltip);
}
.ds-tooltip.visible { opacity: 1; transform: translateY(0); }

/* ── Footer ────────────────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 48px 24px;
  margin-top: 100px;
  border-top: 1px solid var(--border);
  font-size: var(--fs-md);
  color: var(--text-muted);
}
.footer-cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  margin-bottom: 20px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  text-align: left;
}
.footer-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.footer-col-title {
  font-size: var(--fs-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.footer-col a {
  font-size: var(--fs-md);
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.2s ease;
}
.footer-col a:hover { color: var(--accent); }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  text-align: center;
}
.footer-copy {
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .footer { padding: 36px 20px; margin-top: 72px; }
  .footer-cols { grid-template-columns: 1fr; gap: 24px; text-align: center; }
}
@media (max-width: 480px) {
  .footer { padding: 32px 16px; margin-top: 56px; }
}
