:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #111827;
  --muted: #4b5563;
  --border: #d1d5db;
  --primary: #0f766e;        /* teal: primary action */
  --primary-hover: #115e59;
  --primary-ink: #ffffff;
  --accent: #fbbf24;
  --focus: #2563eb;
  --danger: #b91c1c;
  --ad-bg: #f3f4f6;
  --ad-border: #9ca3af;
  --radius: 14px;
  --tap: 48px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --surface: #111a2b;
    --text: #f3f4f6;
    --muted: #b6bfcc;
    --border: #334155;
    --primary: #2dd4bf;
    --primary-hover: #5eead4;
    --primary-ink: #04201d;
    --focus: #93c5fd;
    --danger: #fca5a5;
    --ad-bg: #0e1626;
    --ad-border: #475569;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 16px; }

.skip-link { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip-link:focus { left: 8px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

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

/* Header: minimal, no nav chrome */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; min-height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-size: 1.2rem; letter-spacing: -0.01em; }
.brand strong { color: var(--primary); }

h1 { font-size: clamp(1.8rem, 5vw, 2.4rem); line-height: 1.15; margin: 20px 0 6px; letter-spacing: -0.02em; }
.lede { margin: 0 0 18px; color: var(--muted); }

/* Ad placeholders: deliberately muted, dashed, labeled, and spatially separate from controls */
.ad-slot {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  margin: 16px auto;
  background: var(--ad-bg);
  border: 1px dashed var(--ad-border);
  border-radius: 6px;
  overflow: hidden;
}
.ad-label {
  position: absolute; top: 4px; left: 8px;
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); opacity: .8; pointer-events: none;
}
.ad-leaderboard { min-height: 100px; width: 100%; max-width: 728px; }
.ad-rectangle { min-height: 280px; width: 100%; max-width: 336px; margin-top: 32px; margin-bottom: 32px; }
@media (min-width: 768px) { .ad-leaderboard { min-height: 110px; } }
.ad-slot ins { display: block; width: 100%; }
.ad-slot.ad-live { background: transparent; border-style: solid; border-color: transparent; }

/* Tool layout */
.tool { display: grid; gap: 16px; }
@media (min-width: 720px) { .tool { grid-template-columns: 1.15fr 1fr; align-items: start; } }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

.field { margin: 0 0 18px; border: 0; padding: 0; min-width: 0; }
label, legend { display: block; font-weight: 600; margin-bottom: 6px; }
fieldset legend { padding: 0; }
.hint { margin: 6px 0 0; font-size: .875rem; color: var(--muted); }

input[type="text"] {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  font: inherit; font-size: 1.15rem;
  color: var(--text);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 10px;
}
input[type="text"]:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 35%, transparent); }
input[aria-invalid="true"] { border-color: var(--danger); }

.input-affix { position: relative; }
.input-affix .affix { position: absolute; top: 50%; transform: translateY(-50%); left: 14px; color: var(--muted); font-size: 1.15rem; pointer-events: none; }
.input-affix input { padding-left: 32px; }
.input-affix.affix-right .affix { left: auto; right: 14px; }
.input-affix.affix-right input { padding-left: 12px; padding-right: 36px; }

/* Tip presets */
.presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.chip { margin: 0; font-weight: 600; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip span {
  display: flex; align-items: center; justify-content: center;
  min-height: var(--tap);
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  user-select: none;
  transition: background .12s, border-color .12s, color .12s;
}
.chip span:hover { border-color: var(--primary); }
.chip input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.chip input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.custom-tip { margin-top: 12px; }
.custom-tip[hidden] { display: none; }

/* Stepper */
.stepper { display: grid; grid-template-columns: var(--tap) 1fr var(--tap); gap: 8px; }
.stepper input { text-align: center; }
.step {
  min-height: var(--tap); font-size: 1.5rem; line-height: 1;
  border: 2px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); cursor: pointer;
}
.step:hover { border-color: var(--primary); }

/* Switch + checkbox */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; min-height: var(--tap); margin: 0; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { width: 46px; height: 28px; border-radius: 999px; background: var(--border); position: relative; transition: background .15s; flex: none; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked + .switch-track { background: var(--primary); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 3px solid var(--focus); outline-offset: 2px; }
.tax-fields { margin-top: 8px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; margin-top: 12px; min-height: 40px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--primary); }

.error { color: var(--danger); font-weight: 600; margin: 0 0 12px; }

/* Buttons: solid teal primary, outlined secondary — never resemble ad units */
.actions { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }
.btn { min-height: 52px; font: inherit; font-weight: 700; font-size: 1.05rem; border-radius: 12px; cursor: pointer; padding: 0 16px; }
.btn-primary { background: var(--primary); color: var(--primary-ink); border: 2px solid var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-secondary { background: transparent; color: var(--text); border: 2px solid var(--text); }
.btn-secondary:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }

/* Results */
.results h2 { margin: 0 0 12px; font-size: 1.15rem; }
.per-person { display: grid; gap: 12px; }
.big-stat { background: color-mix(in srgb, var(--primary) 10%, var(--surface)); border-radius: 12px; padding: 14px 16px; }
.big-stat.secondary { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
.stat-label { display: block; font-size: .9rem; color: var(--muted); font-weight: 600; }
.stat-value { display: block; font-size: clamp(2rem, 8vw, 2.6rem); font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.big-stat.secondary .stat-value { font-size: 1.6rem; }
.breakdown { margin: 16px 0 0; }
.breakdown > div { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); }
.breakdown > div[hidden] { display: none; }
.breakdown dt { color: var(--muted); }
.breakdown dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.breakdown .grand { border-bottom: 0; font-size: 1.1rem; }
.breakdown .grand dt { color: var(--text); font-weight: 700; }

/* SEO content */
.content { margin: 8px 0 40px; }
.content h2 { font-size: 1.5rem; line-height: 1.25; margin: 36px 0 10px; letter-spacing: -0.01em; }
.content h3 { font-size: 1.15rem; margin: 24px 0 6px; }
.content p, .content li { color: var(--text); }
.content ol { padding-left: 1.3rem; }
.content li { margin-bottom: 8px; }

.site-footer { border-top: 1px solid var(--border); padding: 18px 0 28px; color: var(--muted); font-size: .9rem; }
.site-footer p { margin: 0; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* Brand link + site nav in footer */
.brand a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.brand a:hover strong { text-decoration: underline; }
.site-nav {
  display: flex; flex-wrap: wrap; gap: 8px 14px;
  margin: 0 0 12px; padding: 0; list-style: none;
  font-size: .9rem;
}
.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a:hover { color: var(--primary); text-decoration: underline; }
.site-nav a[aria-current="page"] { color: var(--text); font-weight: 600; }
.legal-meta { margin-top: 8px; font-size: .85rem; color: var(--muted); }
.rate-table { width: 100%; border-collapse: collapse; margin: 12px 0 0; font-variant-numeric: tabular-nums; }
.rate-table th, .rate-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); }
.rate-table th { font-size: .85rem; color: var(--muted); font-weight: 600; }
.rate-table .hl { font-weight: 700; background: color-mix(in srgb, var(--primary) 10%, var(--surface)); }
.mode-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.mode-tabs label { margin: 0; }
