/* ===========================================================
   PaycheckLab — shared stylesheet
   Plain CSS, no build step. Optimised for LCP + AdSense review.
   =========================================================== */

:root {
  --bg: #0b1020;
  --card: #ffffff;
  --ink: #101828;
  --ink-soft: #475467;
  --ink-mute: #667085;
  --line: #e4e7ec;
  --brand: #1f5eff;
  --brand-dark: #1444c4;
  --brand-soft: #eef3ff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px -12px rgba(16, 24, 40, .18);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: #f7f8fb;
  line-height: 1.65;
  font-size: 16px;
}

img { max-width: 100%; height: auto; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 18px; }
.narrow { max-width: 760px; }

/* ---------- header ---------- */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 40;
}
.header-inner {
  display: flex; align-items: center; gap: 14px;
  min-height: 60px; flex-wrap: wrap;
}
.logo {
  font-weight: 800; font-size: 19px; color: var(--ink);
  letter-spacing: -.02em; display: flex; align-items: center; gap: 8px;
  text-decoration: none;
}
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), #7aa2ff);
  display: grid; place-items: center; color: #fff; font-size: 15px; font-weight: 800;
}
.nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.nav a {
  color: var(--ink-soft); font-size: 14px; font-weight: 550;
  padding: 7px 11px; border-radius: 8px;
}
.nav a:hover { background: var(--brand-soft); color: var(--brand-dark); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--brand-dark); background: var(--brand-soft); }

/* ---------- hero ---------- */
.hero {
  background: radial-gradient(1100px 420px at 50% -260px, #1d3a8f 0%, var(--bg) 62%);
  color: #fff; padding: 52px 0 44px;
}
.hero h1 {
  font-size: clamp(28px, 5vw, 42px); line-height: 1.15;
  letter-spacing: -.025em; margin: 0 0 14px; font-weight: 800;
}
.hero p.lede {
  font-size: clamp(15px, 2.2vw, 18px); color: #c3cee6;
  max-width: 680px; margin: 0 0 8px;
}
.hero .badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 22px; }
.badge {
  font-size: 12.5px; font-weight: 600; padding: 5px 11px; border-radius: 999px;
  background: rgba(255,255,255,.1); color: #dbe4f7; border: 1px solid rgba(255,255,255,.16);
}

/* ---------- tool card grid ---------- */
.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  margin: 30px 0 10px;
}
.tool-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); color: inherit; display: block;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.tool-card:hover {
  transform: translateY(-3px); text-decoration: none;
  border-color: #c7d4f5;
  box-shadow: 0 2px 4px rgba(16,24,40,.06), 0 18px 36px -16px rgba(31,94,255,.36);
}
.tool-card .ico {
  width: 38px; height: 38px; border-radius: 10px; background: var(--brand-soft);
  display: grid; place-items: center; font-size: 19px; margin-bottom: 12px;
}
.tool-card h3 { margin: 0 0 6px; font-size: 16.5px; letter-spacing: -.01em; color: var(--ink); }
.tool-card p { margin: 0; font-size: 13.5px; color: var(--ink-mute); line-height: 1.5; }

/* ---------- calculator shell ---------- */
main { padding: 30px 0 60px; }
.calc {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px; margin: 22px 0;
}
.calc h2 { margin: 0 0 4px; font-size: 18px; }
.calc .hint { margin: 0 0 18px; font-size: 13px; color: var(--ink-mute); }

.field-row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 650; color: var(--ink-soft); }
.field .sub { font-weight: 400; color: var(--ink-mute); font-size: 12px; }
.field input, .field select {
  font: inherit; font-size: 15px; padding: 10px 12px;
  border: 1px solid #d0d5dd; border-radius: 10px; background: #fff; color: var(--ink);
  width: 100%; min-height: 44px;
  transition: border-color .14s, box-shadow .14s;
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(31,94,255,.16);
}
.field input[type="number"] { font-variant-numeric: tabular-nums; }

/* results */
.results { margin-top: 20px; padding-top: 18px; border-top: 1px dashed var(--line); }
.result-main {
  background: linear-gradient(180deg, #f3f7ff, #eef3ff);
  border: 1px solid #d5e1ff; border-radius: 12px; padding: 18px;
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.result-main .label {
  font-size: 13px; font-weight: 650; color: var(--brand-dark);
  text-transform: uppercase; letter-spacing: .04em;
}
.result-main .value {
  font-size: clamp(26px, 5vw, 34px); font-weight: 800; letter-spacing: -.03em;
  color: #0b2a6b; font-variant-numeric: tabular-nums;
}

.kv { display: grid; gap: 0; margin-top: 14px; }
.kv-row {
  display: flex; justify-content: space-between; gap: 14px;
  padding: 9px 2px; border-bottom: 1px solid #f2f4f7; font-size: 14.5px;
}
.kv-row:last-child { border-bottom: 0; }
.kv-row .k { color: var(--ink-soft); }
.kv-row .v { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kv-row.total .k, .kv-row.total .v { font-weight: 800; color: var(--ink); }

.note { font-size: 12.5px; color: var(--ink-mute); margin-top: 14px; line-height: 1.55; }
.err { color: #b42318; font-size: 13px; margin-top: 8px; font-weight: 600; }

/* table */
.table-scroll { overflow-x: auto; margin-top: 14px; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
th {
  font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-mute); font-weight: 700; background: #fafbfc;
}
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: #fbfcfe; }

/* dynamic rows */
.dyn-row {
  display: grid; gap: 8px; align-items: end; margin-bottom: 10px;
  grid-template-columns: 1.4fr .8fr .8fr auto;
}
.dyn-row input {
  min-height: 42px; padding: 8px 10px; font-size: 14px;
  border: 1px solid #d0d5dd; border-radius: 9px; font: inherit; width: 100%;
}
.dyn-row input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31,94,255,.16); }
.dyn-head {
  font-size: 11.5px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--ink-mute); margin-bottom: 6px;
}
.dyn-head span { padding-left: 2px; }

.btn {
  font: inherit; font-size: 14px; font-weight: 650; cursor: pointer;
  padding: 10px 16px; border-radius: 10px; border: 1px solid #d0d5dd;
  background: #fff; color: var(--ink-soft); min-height: 42px;
}
.btn:hover { background: #f9fafb; border-color: #b9c0cc; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-mute); padding: 8px 10px; }
.btn-ghost:hover { background: #f2f4f7; color: #b42318; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }

/* ---------- content / prose ---------- */
.prose { max-width: 780px; }
.prose h2 { font-size: 22px; letter-spacing: -.015em; margin: 34px 0 10px; }
.prose h3 { font-size: 17px; margin: 24px 0 8px; }
.prose p, .prose li { color: #344054; font-size: 15.5px; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin-bottom: 7px; }
.prose code {
  background: #f2f4f7; padding: 1px 6px; border-radius: 5px;
  font-size: .9em; font-family: var(--mono); color: #1d2939;
}
.formula {
  background: #f8fafc; border: 1px solid var(--line); border-left: 3px solid var(--brand);
  border-radius: 8px; padding: 12px 15px; margin: 14px 0;
  font-family: var(--mono); font-size: 13.5px; overflow-x: auto; color: #1d2939;
}

details.faq {
  border: 1px solid var(--line); border-radius: 10px; padding: 0; margin-bottom: 10px;
  background: #fff;
}
details.faq summary {
  cursor: pointer; padding: 13px 16px; font-weight: 650; font-size: 15px;
  list-style: none; display: flex; justify-content: space-between; gap: 12px; align-items: center;
}
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: "+"; font-size: 19px; color: var(--ink-mute); font-weight: 400; flex: 0 0 auto; }
details.faq[open] summary::after { content: "\2013"; }
details.faq .faq-body { padding: 0 16px 14px; font-size: 14.5px; color: #344054; }
details.faq .faq-body p { margin: 0 0 8px; }
details.faq .faq-body p:last-child { margin-bottom: 0; }

/* ---------- ad slot ---------- */
.ad-slot {
  margin: 26px 0; padding: 14px; min-height: 100px;
  border: 1px dashed #cfd6e4; border-radius: 10px; background: #fbfcfe;
  display: grid; place-items: center; color: #98a2b3; font-size: 12px;
  text-align: center; letter-spacing: .03em;
}
.ad-slot.filled { border: 0; padding: 0; min-height: 0; background: transparent; }

/* ---------- footer ---------- */
.site-footer {
  background: #0b1020; color: #98a5c0; padding: 40px 0 30px; font-size: 13.5px;
}
.site-footer a { color: #c3cee6; }
.site-footer .cols { display: grid; gap: 26px; grid-template-columns: repeat(auto-fit, minmax(190px,1fr)); }
.site-footer h4 { color: #fff; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; margin: 0 0 10px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 6px; }
.site-footer .legal {
  border-top: 1px solid #1d2942; margin-top: 26px; padding-top: 18px;
  font-size: 12.5px; color: #7d8aa8; line-height: 1.6;
}

/* ---------- misc ---------- */
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; background: #fff; padding: 10px 14px; border-radius: 8px; z-index: 99; }
.crumbs { font-size: 13px; color: var(--ink-mute); margin-bottom: 6px; }
.crumbs a { color: var(--ink-mute); }
.page-title { font-size: clamp(24px, 4vw, 33px); letter-spacing: -.025em; margin: 0 0 10px; font-weight: 800; }
.page-lede { font-size: 16px; color: var(--ink-soft); margin: 0 0 6px; max-width: 720px; }
.updated { font-size: 12.5px; color: var(--ink-mute); margin-top: 2px; }
.related { margin-top: 34px; }
.related h2 { font-size: 18px; margin-bottom: 12px; }
.related ul {
  list-style: none; padding: 0; display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(230px,1fr));
}
.related li a {
  display: block; padding: 11px 14px; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--ink);
}
.related li a:hover { border-color: #c7d4f5; background: var(--brand-soft); text-decoration: none; }

@media (max-width: 620px) {
  .hero { padding: 38px 0 32px; }
  .calc { padding: 17px; }
  .dyn-row { grid-template-columns: 1fr 1fr; }
  .dyn-row .btn-ghost { grid-column: 1 / -1; }
}

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

@media print {
  .site-header, .site-footer, .nav, .ad-slot, .btn-row, .related { display: none !important; }
  body { background: #fff; }
  .calc { box-shadow: none; border: 1px solid #ccc; }
}
