/* SalaryTaxHub: single stylesheet. Design tokens first. */
:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #f1f4f9;
  --text: #142033;
  --text-muted: #546178;
  --border: #dde3ec;
  --brand: #0f6b5c;
  --brand-strong: #0a5246;
  --brand-soft: #e3f3ef;
  --accent: #e0902a;
  --danger: #b4372f;
  --c-takehome: #0f6b5c;
  --c-tax: #d0533f;
  --c-pf: #3b6fd1;
  --c-gratuity: #9a6bd6;
  --c-other: #e0a23a;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --max: 1180px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e141c;
    --surface: #151d28;
    --surface-2: #1c2633;
    --text: #e8edf4;
    --text-muted: #9fadc0;
    --border: #2a3646;
    --brand: #3fb79f;
    --brand-strong: #5fd0b8;
    --brand-soft: #16332d;
    --c-takehome: #3fb79f;
    --c-tax: #f07a66;
    --c-pf: #6f9cf0;
    --c-gratuity: #b993ec;
    --c-other: #f0bb5c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { color: var(--brand-strong); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: clamp(1.6rem, 3.5vw, 2.25rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.3rem, 2.5vw, 1.6rem); margin-top: 1.6em; }
h3 { font-size: 1.1rem; margin-top: 1.2em; }
p { margin: 0 0 1em; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--brand); color: #fff; padding: 8px 12px; z-index: 100; }
.skip-link:focus { left: 8px; top: 8px; }
.container { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
.muted { color: var(--text-muted); }
.small { font-size: .875rem; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.site-header .container { display: flex; align-items: center; justify-content: space-between; min-height: 60px; gap: 16px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.15rem; color: var(--text); text-decoration: none; }
.logo-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: .95rem; }
.logo span b { color: var(--brand); }
.nav ul { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; }
.nav a { display: block; padding: 8px 12px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; font-weight: 500; }
.nav a:hover, .nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-strong); }
.nav-toggle { display: none; background: none; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; color: var(--text); font-size: 1rem; cursor: pointer; min-height: 44px; }
@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 60px; background: var(--surface); border-bottom: 1px solid var(--border); }
  .nav.open { display: block; }
  .nav ul { flex-direction: column; padding: 8px 16px 16px; }
  .nav a { padding: 12px; }
}

/* Breadcrumbs */
.breadcrumbs { font-size: .875rem; margin: 16px 0 8px; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.breadcrumbs li + li::before { content: "›"; margin-right: 6px; color: var(--text-muted); }
.breadcrumbs a { color: var(--text-muted); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }

/* Layout */
.page { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; padding-bottom: 32px; }
.page--full { grid-template-columns: minmax(0, 1fr); }
.sidebar { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 980px) {
  .page { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
}
.lead { font-size: 1.075rem; color: var(--text-muted); max-width: 70ch; }
.meta-line { font-size: .85rem; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 18px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.article { max-width: 78ch; }
.article table { width: 100%; border-collapse: collapse; margin: 0 0 1.2em; font-size: .95rem; }
.article th, .article td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.article th { background: var(--surface-2); font-weight: 600; }
.table-wrap { overflow-x: auto; }

/* Calculator */
.calc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 20px; margin: 8px 0 24px; }
@media (max-width: 860px) { .calc { grid-template-columns: minmax(0, 1fr); } }
.calc h2 { margin-top: 0; font-size: 1.15rem; }
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.field .hint { display: block; font-size: .8rem; color: var(--text-muted); margin-top: 4px; }
.input-wrap { position: relative; }
.input-wrap .prefix, .input-wrap .suffix { position: absolute; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; font-size: .95rem; }
.input-wrap .prefix { left: 12px; }
.input-wrap .suffix { right: 12px; }
.input-wrap input.has-prefix { padding-left: 28px; }
.input-wrap input.has-suffix { padding-right: 36px; }
input[type="text"], input[type="number"], select {
  width: 100%; min-height: 44px; padding: 10px 12px; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
input:focus, select:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
input[type="range"] { width: 100%; accent-color: var(--brand); margin-top: 8px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .field-row { grid-template-columns: 1fr; } }
.check { display: flex; align-items: center; gap: 10px; font-size: .92rem; margin: 8px 0; min-height: 32px; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.words { font-size: .8rem; color: var(--brand-strong); margin-top: 4px; min-height: 1.2em; }
details.more { border-top: 1px dashed var(--border); margin-top: 8px; padding-top: 8px; }
details.more summary { cursor: pointer; font-weight: 600; padding: 8px 0; color: var(--brand); min-height: 44px; display: flex; align-items: center; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.seg label { margin: 0; text-align: center; padding: 10px 6px; cursor: pointer; font-weight: 500; font-size: .88rem; border-right: 1px solid var(--border); }
.seg label:last-child { border-right: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg input:checked + span { color: var(--brand-strong); }
.seg label:has(input:checked) { background: var(--brand-soft); }
.seg label:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: -3px; }

/* Results */
.result-hero { background: linear-gradient(135deg, var(--brand), var(--brand-strong)); color: #fff; border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.result-hero .label { font-size: .9rem; opacity: .9; }
.result-hero .big { font-size: clamp(2rem, 5vw, 2.6rem); font-weight: 700; line-height: 1.1; margin: 4px 0; }
.result-hero .sub { font-size: .92rem; opacity: .95; }
.result-hero .badge { display: inline-block; background: rgba(255, 255, 255, .18); border-radius: 999px; padding: 4px 12px; font-size: .85rem; margin-top: 10px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
@media (max-width: 480px) { .stats { grid-template-columns: 1fr 1fr; } }
.stat { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; }
.stat .k { font-size: .78rem; color: var(--text-muted); }
.stat .v { font-weight: 700; font-size: 1.05rem; }
.chart-row { display: grid; grid-template-columns: 160px 1fr; gap: 16px; align-items: center; margin-bottom: 16px; }
@media (max-width: 420px) { .chart-row { grid-template-columns: 1fr; justify-items: center; } }
.legend { list-style: none; margin: 0; padding: 0; font-size: .88rem; width: 100%; }
.legend li { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.legend .dot { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.legend .amt { margin-left: auto; font-weight: 600; }
.breakdown { width: 100%; border-collapse: collapse; font-size: .92rem; margin-bottom: 12px; }
.breakdown td, .breakdown th { padding: 8px 6px; border-bottom: 1px solid var(--border); text-align: right; }
.breakdown td:first-child, .breakdown th:first-child { text-align: left; }
.breakdown th { font-size: .8rem; color: var(--text-muted); font-weight: 600; }
.breakdown tr.total td { font-weight: 700; border-top: 2px solid var(--text); border-bottom: 0; }
.breakdown .neg { color: var(--danger); }
.breakdown .win { color: var(--brand); font-weight: 700; }
.summary-text { background: var(--brand-soft); border-left: 4px solid var(--brand); border-radius: var(--radius-sm); padding: 12px 14px; font-size: .95rem; margin-bottom: 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 10px 16px; border-radius: var(--radius-sm); border: 1px solid var(--brand); background: var(--brand); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--brand-strong); color: #fff; }
.btn--ghost { background: transparent; color: var(--brand); }
.btn--ghost:hover { background: var(--brand-soft); color: var(--brand-strong); }
.toast { font-size: .85rem; color: var(--brand-strong); min-height: 1.3em; margin-top: 8px; }
.note { font-size: .82rem; color: var(--text-muted); margin-top: 12px; }

/* Ad slots: heights are reserved to avoid layout shift. */
.ad-slot { display: none; position: relative; margin: 24px auto; text-align: center; overflow: hidden; }
.ad-slot::before { content: "Advertisement"; display: block; font-size: .7rem; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 4px; }
.ads-on .ad-slot, .ads-preview .ad-slot { display: block; }
.ad-slot--leaderboard { min-height: 110px; max-width: 970px; }
.ad-slot--incontent { min-height: 280px; max-width: 728px; }
.ad-slot--sidebar { min-height: 620px; width: 300px; margin: 0; }
.ad-slot--footer { min-height: 110px; max-width: 970px; }
.ads-preview .ad-slot { background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 10px, var(--surface) 10px, var(--surface) 20px); border: 2px dashed var(--border); border-radius: var(--radius-sm); }
.ads-preview .ad-slot::after { content: attr(data-ad) " ad slot"; position: absolute; inset: 0; display: grid; place-items: center; font-weight: 600; color: var(--text-muted); }
@media (max-width: 980px) { .ad-slot--sidebar { display: none !important; } }

/* Home tool grid */
.hero { padding: 40px 0 24px; }
.hero h1 { font-size: clamp(1.8rem, 4.5vw, 2.8rem); max-width: 20ch; }
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; margin: 16px 0 32px; }
.tool-card { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--text); transition: transform .15s, border-color .15s; }
.tool-card:hover { transform: translateY(-2px); border-color: var(--brand); color: var(--text); }
.tool-card .icon { font-size: 1.6rem; }
.tool-card h3 { margin: 4px 0 0; font-size: 1.05rem; }
.tool-card p { margin: 0; font-size: .9rem; color: var(--text-muted); }
.tag { display: inline-block; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); align-self: flex-start; }
.tag--live { background: var(--brand-soft); color: var(--brand-strong); }
.tool-card--soon { opacity: .7; pointer-events: none; }

/* FAQ */
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 10px; }
.faq summary { cursor: pointer; padding: 14px 16px; font-weight: 600; min-height: 44px; }
.faq details > div { padding: 0 16px 14px; }

.related { list-style: none; padding: 0; display: grid; gap: 8px; }
.related a { display: block; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); text-decoration: none; font-weight: 500; }
.reviewed { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 24px 0; font-size: .92rem; }
.reviewed .logo-mark { flex: none; }

/* Footer */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); margin-top: 32px; padding: 32px 0 20px; font-size: .92rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 24px; }
@media (max-width: 700px) { .footer-grid { grid-template-columns: 1fr; } }
.site-footer h4 { margin: 0 0 8px; font-size: .95rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { padding: 3px 0; }
.site-footer a { color: var(--text-muted); text-decoration: none; }
.site-footer a:hover { color: var(--brand); text-decoration: underline; }
.footer-bottom { border-top: 1px solid var(--border); margin-top: 24px; padding-top: 16px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; color: var(--text-muted); font-size: .85rem; }
.powered a { color: var(--brand); font-weight: 600; }

/* Print: only the results summary. */
@media print {
  .site-header, .site-footer, .ad-slot, .sidebar, .breadcrumbs, .calc-form, .actions, .article, .no-print, .toast { display: none !important; }
  body { background: #fff; color: #000; }
  .page { display: block; }
  .card { box-shadow: none; border: 1px solid #ccc; }
  .result-hero { background: #fff !important; color: #000; border: 2px solid #000; }
  .print-only { display: block !important; }
}
.print-only { display: none; }
