/* ClearCharge design system — healthcare-fintech: calm blues, teals, greens */

:root,
[data-theme='light'] {
  /* Surfaces — cool off-white, clinical calm */
  --color-bg: #f6f8f8;
  --color-surface: #ffffff;
  --color-surface-2: #fbfcfc;
  --color-surface-offset: #eef3f3;
  --color-surface-offset-2: #e6edec;
  --color-surface-dynamic: #dfe9e8;
  --color-divider: #dee6e5;
  --color-border: #cdd9d8;

  /* Text */
  --color-text: #10262a;
  --color-text-muted: #526366;
  --color-text-faint: #93a3a4;
  --color-text-inverse: #f4f9f9;

  /* Primary accent — deep teal */
  --color-primary: #0a6b6b;
  --color-primary-hover: #08514f;
  --color-primary-active: #063c3a;
  --color-primary-highlight: #d3e6e3;

  /* Secondary accent — deep blue (links, secondary CTAs) */
  --color-blue: #1a5c8a;
  --color-blue-hover: #14486d;
  --color-blue-active: #0f3752;
  --color-blue-highlight: #d6e4ee;

  /* Success — green (OK status) */
  --color-success: #2c7a4b;
  --color-success-hover: #22603b;
  --color-success-active: #184a2c;
  --color-success-highlight: #d7ead9;

  /* Warning — amber (Review status) */
  --color-warning: #a4720d;
  --color-warning-hover: #82590a;
  --color-warning-active: #634308;
  --color-warning-highlight: #f2e2bd;

  /* Error/Flagged — warm red-brown (Flagged status) */
  --color-error: #b3401f;
  --color-error-hover: #8f3118;
  --color-error-active: #6d2512;
  --color-error-highlight: #f2ddd3;

  --radius-sm: 0.375rem;
  --radius-md: 0.625rem;
  --radius-lg: 1rem;
  --radius-xl: 1.375rem;
  --radius-full: 9999px;

  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  --shadow-sm: 0 1px 2px oklch(0.2 0.02 200 / 0.06);
  --shadow-md: 0 6px 16px oklch(0.2 0.02 200 / 0.08);
  --shadow-lg: 0 16px 40px oklch(0.2 0.02 200 / 0.14);

  --content-narrow: 640px;
  --content-default: 980px;
  --content-wide: 1220px;
  --content-full: 100%;

  --font-display: 'General Sans', 'Segoe UI', sans-serif;
  --font-body: 'Satoshi', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
}

[data-theme='dark'] {
  --color-bg: #0c1717;
  --color-surface: #0f1c1c;
  --color-surface-2: #122121;
  --color-surface-offset: #142524;
  --color-surface-offset-2: #182b2a;
  --color-surface-dynamic: #1c3231;
  --color-divider: #1e3332;
  --color-border: #2a4341;
  --color-text: #dceae8;
  --color-text-muted: #8ba6a3;
  --color-text-faint: #5d7573;
  --color-text-inverse: #10262a;

  --color-primary: #4bb3ac;
  --color-primary-hover: #6ec5bf;
  --color-primary-active: #8ad3ce;
  --color-primary-highlight: #1c3937;

  --color-blue: #6ba3cf;
  --color-blue-hover: #8bb9db;
  --color-blue-active: #a8cbe6;
  --color-blue-highlight: #1c3446;

  --color-success: #5fb37e;
  --color-success-hover: #7ec89b;
  --color-success-active: #9adcb4;
  --color-success-highlight: #1b3527;

  --color-warning: #d9a13d;
  --color-warning-hover: #e6b65c;
  --color-warning-active: #efc884;
  --color-warning-highlight: #3a2f16;

  --color-error: #e2795a;
  --color-error-hover: #ea9679;
  --color-error-active: #f0b09a;
  --color-error-highlight: #3d2419;

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.3);
  --shadow-md: 0 6px 16px oklch(0 0 0 / 0.35);
  --shadow-lg: 0 16px 40px oklch(0 0 0 / 0.5);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg: #0c1717;
    --color-surface: #0f1c1c;
    --color-surface-2: #122121;
    --color-surface-offset: #142524;
    --color-surface-offset-2: #182b2a;
    --color-surface-dynamic: #1c3231;
    --color-divider: #1e3332;
    --color-border: #2a4341;
    --color-text: #dceae8;
    --color-text-muted: #8ba6a3;
    --color-text-faint: #5d7573;
    --color-text-inverse: #10262a;
    --color-primary: #4bb3ac;
    --color-primary-hover: #6ec5bf;
    --color-primary-active: #8ad3ce;
    --color-primary-highlight: #1c3937;
    --color-blue: #6ba3cf;
    --color-blue-hover: #8bb9db;
    --color-blue-active: #a8cbe6;
    --color-blue-highlight: #1c3446;
    --color-success: #5fb37e;
    --color-success-hover: #7ec89b;
    --color-success-active: #9adcb4;
    --color-success-highlight: #1b3527;
    --color-warning: #d9a13d;
    --color-warning-hover: #e6b65c;
    --color-warning-active: #efc884;
    --color-warning-highlight: #3a2f16;
    --color-error: #e2795a;
    --color-error-hover: #ea9679;
    --color-error-active: #f0b09a;
    --color-error-highlight: #3d2419;
    --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.3);
    --shadow-md: 0 6px 16px oklch(0 0 0 / 0.35);
    --shadow-lg: 0 16px 40px oklch(0 0 0 / 0.5);
  }
}

/* ---------- Type scale ---------- */
:root {
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --text-2xl: clamp(2rem, 1.2rem + 2.5vw, 3.25rem);
  --text-3xl: clamp(2.25rem, 1rem + 3.5vw, 4.25rem);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;
}

/* ---------- Layout primitives ---------- */
.wrap {
  width: 100%;
  max-width: var(--content-wide);
  margin-inline: auto;
  padding-inline: var(--space-6);
}
.wrap--narrow {
  max-width: var(--content-default);
}
.wrap--prose {
  max-width: var(--content-narrow);
}

section {
  padding-block: clamp(var(--space-16), 8vw, var(--space-32));
}
section.section--tight {
  padding-block: clamp(var(--space-10), 5vw, var(--space-16));
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-primary);
}

.lede {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  max-width: 62ch;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--text-sm);
  padding: 0.9rem 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  white-space: nowrap;
  min-height: 44px;
}
.btn-primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--color-primary-hover);
  box-shadow: var(--shadow-md);
}
.btn-secondary {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
}
.btn-secondary:hover {
  background: var(--color-surface-offset);
  border-color: var(--color-text-faint);
}
.btn-ghost {
  background: transparent;
  color: var(--color-primary);
  padding-inline: var(--space-2);
}
.btn-ghost:hover {
  color: var(--color-primary-hover);
}
.btn-block {
  width: 100%;
}
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in oklab, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-divider);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  padding-block: var(--space-4);
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--color-text);
}
.nav-brand svg {
  flex-shrink: 0;
}
.nav-brand-name {
  font-family: var(--font-display);
  font-weight: 650;
  font-size: var(--text-lg);
  letter-spacing: -0.01em;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  list-style: none;
}
.nav-links a {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  padding-block: var(--space-2);
  border-bottom: 2px solid transparent;
}
.nav-links a:hover,
.nav-links a[aria-current='page'] {
  color: var(--color-text);
  border-color: var(--color-primary);
}
.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.nav-toggle {
  display: none;
}
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
}
.theme-toggle:hover {
  background: var(--color-surface-offset);
  color: var(--color-text);
}

@media (max-width: 860px) {
  .nav-links {
    position: fixed;
    inset: 64px var(--space-4) auto var(--space-4);
    flex-direction: column;
    align-items: stretch;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    box-shadow: var(--shadow-lg);
    gap: 0;
    display: none;
  }
  .nav-links.open {
    display: flex;
  }
  .nav-links a {
    padding: var(--space-3);
    border-bottom: none;
    border-radius: var(--radius-sm);
  }
  .nav-links a:hover {
    background: var(--color-surface-offset);
  }
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    color: var(--color-text);
  }
  .nav-cta-desktop {
    display: none;
  }
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--color-divider);
  background: var(--color-surface-offset);
  padding-block: var(--space-16) var(--space-10);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: var(--space-10);
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.footer-col h4 {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
  font-family: var(--font-body);
  font-weight: 600;
}
.footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.footer-col a {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: var(--text-sm);
}
.footer-col a:hover {
  color: var(--color-primary);
}
.footer-legal {
  margin-top: var(--space-12);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-divider);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  line-height: 1.7;
}
.footer-legal a {
  color: var(--color-text-muted);
}
.footer-bottom {
  margin-top: var(--space-6);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

@media (max-width: 760px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ---------- Cards ---------- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  box-shadow: var(--shadow-sm);
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-full);
  white-space: nowrap;
}
.badge-ok {
  background: var(--color-success-highlight);
  color: var(--color-success);
}
.badge-review {
  background: var(--color-warning-highlight);
  color: var(--color-warning);
}
.badge-flagged {
  background: var(--color-error-highlight);
  color: var(--color-error);
}

/* ---------- Forms ---------- */
label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: var(--space-2);
  color: var(--color-text);
}
.field-hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}
input[type='text'],
textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-text);
}
textarea {
  font-family: var(--font-mono);
  line-height: 1.6;
  resize: vertical;
}
input[type='text']:focus,
textarea:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
  border-color: var(--color-primary);
}
.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) 0;
}
.checkbox-row input[type='checkbox'] {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 0.15rem;
  accent-color: var(--color-primary);
}
.checkbox-row label {
  margin-bottom: 0;
  font-weight: 500;
  font-size: var(--text-sm);
}

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}
table.results-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}
table.results-table th {
  text-align: left;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  font-weight: 600;
  padding: var(--space-4);
  background: var(--color-surface-offset);
  border-bottom: 1px solid var(--color-border);
}
table.results-table td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-divider);
  font-size: var(--text-sm);
  vertical-align: top;
}
table.results-table tr:last-child td {
  border-bottom: none;
}
table.results-table td.num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.reason-text {
  color: var(--color-text-muted);
  max-width: 34ch;
}

/* ---------- Provenance / data-source badges ---------- */
/* Subtle, non-intrusive tags shown next to flagged/review line items to
   indicate where the benchmark amount came from. */
.source-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  margin-left: 0.5em;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-full);
  white-space: nowrap;
  vertical-align: middle;
  cursor: default;
}
.source-badge--live {
  background: var(--color-primary-highlight);
  color: var(--color-primary);
}
.source-badge--static {
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

/* comparison table */
table.compare-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
}
table.compare-table th,
table.compare-table td {
  padding: var(--space-4) var(--space-5);
  text-align: left;
  border-bottom: 1px solid var(--color-divider);
  font-size: var(--text-sm);
}
table.compare-table th {
  font-family: var(--font-display);
  font-weight: 600;
}
table.compare-table thead th {
  background: var(--color-surface-offset);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}
table.compare-table td.highlight,
table.compare-table th.highlight {
  background: var(--color-primary-highlight);
}

/* ---------- Ad placeholder units (mockup only — no real ad network) ---------- */
.ad-slot {
  position: relative;
  margin-top: var(--space-10);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-2);
  padding: var(--space-5) var(--space-6) var(--space-6);
}
.ad-label {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  background: var(--color-surface-offset);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.5rem;
  margin-bottom: var(--space-4);
}
.ad-slot-body {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  flex-wrap: wrap;
}
.ad-slot-icon {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--color-surface-offset);
  color: var(--color-text-faint);
}
.ad-slot-copy {
  flex: 1 1 260px;
  min-width: 0;
}
.ad-slot-copy strong {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-base);
  color: var(--color-text);
  margin-bottom: var(--space-1);
}
.ad-slot-copy p {
  font-size: var(--text-xs);
  margin: 0;
}
.ad-slot-cta {
  flex-shrink: 0;
  pointer-events: none;
  opacity: 0.85;
}
.ad-slot--banner {
  padding: var(--space-4) var(--space-5);
}
.ad-slot--banner .ad-slot-body {
  gap: var(--space-4);
}
.ad-slot--banner .ad-slot-icon {
  width: 40px;
  height: 40px;
}

@media (max-width: 560px) {
  .ad-slot-body {
    flex-direction: column;
    align-items: flex-start;
  }
  .ad-slot-cta {
    width: 100%;
    text-align: center;
  }
}

/* ---------- Utility ---------- */
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: center;
}
.text-muted {
  color: var(--color-text-muted);
}
.text-center {
  text-align: center;
}
.divider {
  height: 1px;
  background: var(--color-divider);
  border: none;
}
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--color-primary);
  color: var(--color-text-inverse);
  padding: var(--space-3) var(--space-5);
  z-index: 100;
  border-radius: var(--radius-md);
}
.skip-link:focus {
  left: var(--space-4);
  top: var(--space-4);
}
