:root {
  /* Layout idea: a payslip. Inputs beside one filled result slip, then the working shown line by line. */
  --bg: #eef2f0;
  --surface: #ffffff;
  --ink: #15231f;
  --muted: #5b6b66;
  --line: #d5ddd9;
  --accent: #0a6b55;
  --accent-ink: #ffffff;
  --accent-soft: #dff0ea;
  --warn: #b26a12;
  --font-display: "Alexandria", "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --font-body: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1513;
    --surface: #17211d;
    --ink: #e7eeea;
    --muted: #9fb0aa;
    --line: #2b3a35;
    --accent: #44c3a0;
    --accent-ink: #06231b;
    --accent-soft: #16332b;
    --warn: #e0a44a;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.75; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
[hidden] { display: none !important; }
mark { background: color-mix(in srgb, var(--warn) 25%, transparent); color: inherit; padding: 0 4px; border-radius: 4px; }

/* Site bar */
.sitebar { border-bottom: 1px solid var(--line); background: var(--surface); }
.sitebar .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; padding-block: 12px; }
.brand { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 26px; height: 26px; border-radius: 6px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 15px; }
.sitenav { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 14px; }
.sitenav a { color: var(--muted); text-decoration: none; padding: 2px 0; }
.sitenav a:hover { color: var(--accent); }
.sitenav a[aria-current="page"] { color: var(--ink); font-weight: 600; box-shadow: 0 2px 0 var(--accent); }

/* Headings */
.crumbs { font-size: 13px; color: var(--muted); padding-top: 22px; }
.crumbs a { color: var(--muted); }
h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(26px, 4.4vw, 38px); line-height: 1.35; margin: 6px 0 8px; text-wrap: balance; }
main > h1:first-child { margin-top: 28px; }
.lede { color: var(--muted); max-width: 62ch; margin: 0 0 22px; }
.lede b { color: var(--ink); }
.chip { display: inline-block; font-size: 13px; font-weight: 600; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 2px 12px; white-space: nowrap; }

/* Calculator */
.calc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 20px; align-items: start; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px; }
.card h2 { font-family: var(--font-display); font-size: 17px; font-weight: 700; margin: 0 0 16px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.field label, .field .label { font-weight: 600; font-size: 15px; }
.hint { font-size: 13px; color: var(--muted); line-height: 1.6; margin: 0; }
.money { display: flex; align-items: stretch; border: 1.5px solid var(--line); border-radius: 10px; background: var(--bg); overflow: hidden; }
.money:focus-within { border-color: var(--accent); }
.money input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font: 600 22px var(--font-body); padding: 10px 14px; direction: ltr; text-align: right; font-variant-numeric: tabular-nums; }
.money input:focus { outline: none; }
.money span { display: grid; place-items: center; padding: 0 14px; color: var(--muted); font-size: 14px; border-inline-start: 1px solid var(--line); white-space: nowrap; }
select { border: 1.5px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); font: 500 16px var(--font-body); padding: 10px 12px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 15px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.seg { display: flex; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { flex: 1; border: 0; background: transparent; color: var(--muted); font: 500 14px var(--font-body); padding: 9px 10px; cursor: pointer; }
.seg button + button { border-inline-start: 1.5px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.error { color: var(--warn); font-size: 14px; font-weight: 600; min-height: 1.4em; margin: 0; }

/* Result slip */
.slip { background: var(--accent); color: var(--accent-ink); border-radius: 14px; padding: 22px; }
.slip-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.slip-top h2 { font-family: var(--font-display); font-size: 16px; font-weight: 500; margin: 0; }
.slip .seg { border-color: color-mix(in srgb, var(--accent-ink) 40%, transparent); }
.slip .seg button { color: var(--accent-ink); padding: 5px 14px; font-size: 13px; opacity: .8; }
.slip .seg button + button { border-color: color-mix(in srgb, var(--accent-ink) 40%, transparent); }
.slip .seg button[aria-pressed="true"] { background: var(--accent-ink); color: var(--accent); opacity: 1; }
.slip :focus-visible { outline-color: var(--accent-ink); }
.net { font-family: var(--font-display); font-weight: 700; font-size: clamp(38px, 7vw, 56px); line-height: 1.2; margin: 14px 0 2px; overflow-wrap: anywhere; }
.net small { font-size: 16px; font-weight: 500; margin-inline-start: 8px; }
.slip-sub { font-size: 14px; opacity: .9; margin: 0 0 18px; }
.out { font-family: var(--font-display); font-weight: 500; font-size: clamp(20px, 3.2vw, 26px); line-height: 1.8; margin: 16px 0 6px; overflow-wrap: anywhere; }
.bar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: color-mix(in srgb, var(--accent-ink) 25%, transparent); gap: 2px; margin-top: 16px; }
.slip-sub + .bar { margin-top: 0; }
.bar i { display: block; min-width: 2px; transition: width .25s ease; }
.bar .b1, .dot.d1 { background: var(--accent-ink); }
.bar .b2, .dot.d2 { background: color-mix(in srgb, var(--accent-ink) 62%, var(--accent)); }
.bar .b3, .dot.d3 { background: color-mix(in srgb, var(--accent-ink) 36%, var(--accent)); }
.lines { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.lines li { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; font-size: 15px; }
.lines .k { display: flex; align-items: center; gap: 8px; }
.lines .dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.lines .v { font-weight: 600; white-space: nowrap; display: inline-flex; align-items: baseline; gap: 8px; }
.lines .pct { opacity: .8; font-weight: 400; font-size: 13px; }
.lines .total { border-top: 1px solid color-mix(in srgb, var(--accent-ink) 35%, transparent); padding-top: 8px; }
.slip-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 18px; font-size: 13px; }
.copy { border: 1.5px solid var(--accent-ink); background: transparent; color: var(--accent-ink); font: 600 14px var(--font-body); border-radius: 8px; padding: 6px 16px; cursor: pointer; }
.copy:hover { background: var(--accent-ink); color: var(--accent); }

/* Sections */
section { margin-top: 36px; }
section > h2 { font-family: var(--font-display); font-size: 22px; font-weight: 700; margin: 0 0 6px; text-wrap: balance; }
section > p { max-width: 68ch; margin: 0 0 14px; color: var(--muted); }
.scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { padding: 10px 14px; text-align: start; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 13px; color: var(--muted); font-weight: 600; background: color-mix(in srgb, var(--bg) 60%, var(--surface)); }
tbody tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: end; font-variant-numeric: tabular-nums; }
td.wrapcell { white-space: normal; min-width: 220px; font-size: 14px; }
tr:not(.sum) td.wrapcell { color: var(--muted); }
tr.off td { color: var(--muted); opacity: .65; }
tr.sum td { font-weight: 700; background: var(--accent-soft); }
.stepno { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 13px; margin-inline-end: 8px; }
.note { border-inline-start: 4px solid var(--warn); background: var(--surface); border-radius: 8px; padding: 10px 14px; font-size: 14px; margin-top: 12px; max-width: 72ch; color: var(--ink); }
.links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.links a { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px 14px; font-size: 14px; text-decoration: none; }
.links a:hover { border-color: var(--accent); }
.faq { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-top: 10px; }
.faq div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.faq h3 { font-size: 16px; margin: 0 0 6px; line-height: 1.6; }
.faq p { margin: 0; font-size: 15px; color: var(--muted); }
.sources { font-size: 14px; padding-inline-start: 20px; margin: 0; color: var(--muted); }
.sources li { margin-bottom: 4px; }
.reviewed { font-size: 13px; }
.toolgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-top: 12px; }
.toolcard { display: flex; flex-direction: column; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; text-decoration: none; color: var(--ink); }
.toolcard:hover { border-color: var(--accent); }
.toolcard b { font-family: var(--font-display); font-size: 16px; font-weight: 700; color: var(--accent); line-height: 1.6; }
.toolcard span { font-size: 14px; color: var(--muted); }
.ad { margin-top: 28px; min-height: 100px; }
.adslot { border: 1.5px dashed var(--line); border-radius: 12px; color: var(--muted); font-size: 13px; text-align: center; padding: 26px 12px; margin-top: 28px; }

/* Text pages */
.prose { max-width: 68ch; padding-top: 6px; }
.prose h2 { font-family: var(--font-display); font-size: 20px; margin: 28px 0 6px; }
.prose p { margin: 0 0 12px; }

/* Footer */
.sitefoot { margin-top: 48px; border-top: 1px solid var(--line); padding: 20px 0 36px; font-size: 13px; color: var(--muted); }
.sitefoot nav { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-bottom: 8px; }
.sitefoot p { margin: 0; max-width: 78ch; }

@media (max-width: 820px) {
  .calc { grid-template-columns: minmax(0, 1fr); }
  .card, .slip { padding: 18px; }
}
@media (prefers-reduced-motion: reduce) { .bar i { transition: none; } }
