/* ============================================================
   TankhWiz design system
   Same dark instrument-panel aesthetic as UpahWiz (Archivo +
   IBM Plex Sans/Mono, dark-only, card-based mobile layout) —
   new signature palette: warm gold (primary) / teal (secondary)
   / rust (tertiary, warnings) instead of Indonesia's jade/ochre/blue.
   Neutrals (bg/surface/ink) are unchanged from UpahWiz on purpose;
   the palette swap is the brand differentiator, not the structure.
   ============================================================ */

:root {
  --bg: #0A0D14;
  --surface: #12161F;
  --surface-2: #181D28;
  --ink: #EEF1F7;
  --ink-soft: #8F97AC;
  --hairline: rgba(238, 241, 247, 0.08);
  --hairline-hi: rgba(238, 241, 247, 0.14);

  /* Signature palette — TankhWiz */
  --gold: #E5A730;        /* primary accent — was --jade in UpahWiz */
  --gold-tint: rgba(229, 167, 48, 0.12);
  --teal: #2DD4BF;        /* secondary accent — was --bpjs blue */
  --teal-tint: rgba(45, 212, 191, 0.12);
  --rust: #D2691E;        /* tertiary / warning accent — was --ochre */
  --rust-tint: rgba(210, 105, 30, 0.14);

  --font-display: 'Archivo', sans-serif;
  --font-body: 'IBM Plex Sans', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,0.4), 0 1px 1px rgba(0,0,0,0.3);
  --shadow-lift: 0 8px 24px rgba(0,0,0,0.45), 0 2px 6px rgba(0,0,0,0.3);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  background-image: radial-gradient(circle at 15% 0%, rgba(229,167,48,0.06), transparent 45%),
                     radial-gradient(circle at 85% 0%, rgba(210,105,30,0.05), transparent 45%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 18px 40px;
}

/* Topbar — wordmark + language toggle slot */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 26px 0 8px;
}
.wordmark-link { text-decoration: none; }
.wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  color: var(--ink);
}
.wordmark .tankh { color: var(--ink); }
.wordmark .wiz { color: var(--gold); }

/* Hero */
.hero { padding: 18px 0 20px; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 8px;
}
.headline {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 26px;
  line-height: 1.25;
  margin: 0;
  color: var(--ink);
}

/* Core card */
.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 14px;
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

/* Money input */
.money-input-row {
  display: flex;
  align-items: center;
  background: var(--surface-2);
  border: 1.5px solid var(--hairline-hi);
  border-radius: var(--radius-sm);
  padding: 2px 4px;
  transition: border-color 0.15s ease;
}
.money-input-row:focus-within { border-color: var(--gold); }
.money-input-row.primary {
  background: var(--surface-2);
  border-width: 2px;
}
.currency-prefix {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--ink-soft);
  padding: 16px 4px 16px 14px;
  font-size: 18px;
}
.money-input-row.primary .currency-prefix { font-size: 20px; }
.money-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--ink);
  width: 100%;
  min-width: 0;
  padding: 16px 14px;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  caret-color: var(--gold);
}
.money-input-row.primary .money-input { font-size: 26px; padding: 18px 14px; }
@media (max-width: 420px) {
  .money-input-row.primary .money-input { font-size: 22px; }
}

/* Dashboard card — the answer */
.dashboard-card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--hairline-hi);
}
.dash-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.dash-label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.dash-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 40px;
  letter-spacing: -0.01em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
@media (max-width: 360px) {
  .dash-value { font-size: 32px; }
}
.dash-insight {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin-top: 10px;
}
.dash-insight b { color: var(--gold); font-weight: 600; }

/* View switch (employee/employer style toggles) */
.view-switch {
  display: flex;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.view-switch button {
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.view-switch button.active { background: var(--gold); color: #241804; }

/* Pills */
.pill-group { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  padding: 9px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--hairline-hi);
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.pill.active { background: var(--gold-tint); border-color: var(--gold); color: var(--gold); }

.mini-pill-group { display: flex; gap: 6px; }
.mini-pill {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--hairline-hi);
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.mini-pill.active { background: var(--gold-tint); border-color: var(--gold); color: var(--gold); }

.for-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 14px;
}

/* Steppers — 44px touch targets from day one this time */
.mini-stepper { display: flex; align-items: center; gap: 8px; }
.dep-stepper { display: flex; align-items: center; }
.mini-step-btn {
  width: 44px; height: 44px; border-radius: 12px;
  border: 1.5px solid var(--hairline-hi); background: var(--surface-2);
  color: var(--ink); font-size: 18px; font-family: var(--font-mono);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.12s ease;
}
.mini-step-btn:active { background: var(--gold-tint); border-color: var(--gold); }
.mini-dep-count {
  font-family: var(--font-mono); font-weight: 600; color: var(--ink);
  font-size: 14px; min-width: 14px; text-align: center;
}
.tax-status-caption {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 10px;
}

/* Advanced toggle */
.advanced-toggle {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  background: none; border: none;
  color: var(--ink-soft); font-family: var(--font-body); font-size: 13px; font-weight: 600;
  padding: 10px 4px; cursor: pointer;
}
.advanced-toggle svg { width: 16px; height: 16px; transition: transform 0.2s ease; }
.advanced-toggle.open svg { transform: rotate(180deg); }
.advanced-body { display: none; }
.advanced-body.open { display: block; }
.hint-text { font-size: 12px; color: var(--ink-soft); margin-top: 8px; line-height: 1.55; }
.optional-tag { color: var(--ink-soft); font-weight: 400; }

/* Ledger */
.ledger-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 4px;
}
.ledger-title {
  font-size: 13px; font-weight: 600; color: var(--ink-soft);
  padding: 16px 20px 10px;
}
.ledger-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 20px;
  font-size: 14px;
  animation: fadeIn 0.25s ease both;
}
.ledger-row .label { color: var(--ink-soft); }
.ledger-row .value { font-family: var(--font-mono); font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.ledger-row.deduction .value { color: var(--rust); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }
.ledger-divider { height: 1px; background: var(--hairline); margin: 4px 20px; }
.ledger-footer { padding: 12px 22px 18px; font-size: 12.5px; color: var(--ink-soft); line-height: 1.55; }

/* Bookmark bar */
.bookmark-bar {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--gold-tint);
  border: 1px solid var(--gold);
  border-left-width: 3px;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
}
.bookmark-bar svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; color: var(--gold); }
.bookmark-bar .msg { flex: 1; font-size: 12.5px; line-height: 1.5; color: var(--ink); }
.bookmark-bar .msg b { display: block; font-size: 13px; margin-bottom: 2px; }
.bookmark-dismiss {
  background: none; border: none; color: var(--ink-soft); cursor: pointer;
  font-size: 20px; line-height: 1; padding: 10px; flex-shrink: 0;
  width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  transition: color 0.12s ease;
}

/* Explainer */
.explain-section { margin-top: 24px; }
.explain-heading {
  font-family: var(--font-display); font-weight: 700; font-size: 17px;
  margin: 0 0 12px;
}
details {
  border-bottom: 1px solid var(--hairline);
  padding: 14px 0;
}
summary {
  font-size: 14.5px; font-weight: 600; color: var(--ink);
  cursor: pointer; list-style: none;
}
summary::-webkit-details-marker { display: none; }
.details-body { font-size: 13.5px; color: var(--ink-soft); line-height: 1.6; margin-top: 10px; }
.details-body b { color: var(--ink); }
.details-body code {
  font-family: var(--font-mono); font-size: 12.5px;
  background: var(--surface-2); padding: 1px 5px; border-radius: 4px; color: var(--gold);
}

/* Site nav */
.site-nav { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--hairline); }
.site-nav-title { font-size: 12px; font-weight: 600; color: var(--ink-soft); margin-bottom: 10px; }
.site-nav-links { display: flex; flex-wrap: wrap; gap: 8px; }
.site-nav-links a {
  font-size: 12.5px; color: var(--ink-soft); text-decoration: none;
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--hairline-hi);
  transition: all 0.15s ease;
}
.site-nav-links a:hover { border-color: var(--gold); color: var(--gold); }
.site-nav-links a.current { background: var(--gold-tint); border-color: var(--gold); color: var(--gold); }

footer {
  font-size: 11.5px; color: var(--ink-soft); opacity: 0.75;
  line-height: 1.6; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--hairline);
}

.data-vintage {
  display: block; font-size: 11.5px; color: var(--ink-soft); opacity: 0.85;
  line-height: 1.5; margin: 10px 2px 20px; font-style: normal;
}

/* Select input */
.select-input {
  width: 100%;
  padding: 15px 16px;
  border-radius: 10px;
  border: 1.5px solid var(--hairline-hi);
  background: var(--surface-2);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238F97AC' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 18px;
}

/* ============================================================
   RTL support for Urdu
   IBM Plex Sans has zero Arabic-script glyph coverage, so Urdu
   text needs a real Urdu-compatible typeface — Noto Nastaliq Urdu,
   the standard used by BBC Urdu and most Pakistani news sites.
   Flexbox row layouts (money-input-row, pill-group, dash-top, nav
   links, ledger rows) reverse automatically once dir="rtl" is set
   on <html> — no extra work needed there. What does NOT flip
   automatically: absolute positioning, border-left accents, and
   background-image positions, all handled explicitly below.
   Financial figures stay in IBM Plex Mono with Western numerals
   even in Urdu — standard practice in Urdu banking/fintech UIs,
   since Nastaliq digit glyphs hurt tabular legibility.
   ============================================================ */

html[lang="ur"] body {
  font-family: 'Noto Nastaliq Urdu', var(--font-body);
}
html[lang="ur"] .headline,
html[lang="ur"] .eyebrow,
html[lang="ur"] .dash-label,
html[lang="ur"] .field-label,
html[lang="ur"] .hint-text,
html[lang="ur"] .details-body,
html[lang="ur"] summary,
html[lang="ur"] .explain-heading,
html[lang="ur"] .ledger-row .label,
html[lang="ur"] .site-nav-title,
html[lang="ur"] .bookmark-bar .msg,
html[lang="ur"] footer,
html[lang="ur"] .pill,
html[lang="ur"] .mini-pill,
html[lang="ur"] .view-switch button,
html[lang="ur"] .slider-label {
  font-family: 'Noto Nastaliq Urdu', var(--font-body);
  line-height: 2.1; /* Nastaliq needs more vertical breathing room than Latin scripts */
}
/* Numbers, currency, and anything tabular stay in the mono font regardless of language */
html[lang="ur"] .dash-value,
html[lang="ur"] .money-input,
html[lang="ur"] .currency-prefix,
html[lang="ur"] .ledger-row .value,
html[lang="ur"] .mini-dep-count,
html[lang="ur"] .tax-status-caption,
html[lang="ur"] .data-vintage,
html[lang="ur"] .slider-value,
html[lang="ur"] code {
  font-family: var(--font-mono);
  direction: ltr;
  unicode-bidi: isolate;
}

/* Absolute-positioned elements that don't auto-flip with dir=rtl */
html[dir="rtl"] .lang-track-label.lang-en { right: 0; left: auto; }
html[dir="rtl"] .lang-track-label.lang-ur { left: 0; right: auto; }
html[dir="rtl"] .lang-toggle[aria-pressed="true"] .lang-thumb { transform: translateX(0); }
html[dir="rtl"] .lang-toggle[aria-pressed="false"] .lang-thumb { transform: translateX(-32px); }

/* Bookmark bar / callout accent stripe (border-left-width) */
html[dir="rtl"] .bookmark-bar { border-left-width: 1px; border-right-width: 3px; }

/* Select dropdown chevron background-image position */
html[dir="rtl"] .select-input {
  background-position: left 14px center;
  padding-left: 40px;
  padding-right: 16px;
}

/* Employer-teaser arrow and any directional glyphs should mirror */
html[dir="rtl"] .employer-teaser .arrow,
html[dir="rtl"] .category-link-arrow {
  transform: scaleX(-1);
  display: inline-block;
}

.lang-toggle {
  position: relative;
  width: 68px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--hairline-hi);
  padding: 0;
  cursor: pointer;
  background: var(--surface-2);
  box-shadow: var(--shadow);
  flex-shrink: 0;
}
.lang-track-label {
  position: absolute; top: 0; width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: 0.02em;
  color: var(--ink-soft); transition: color 0.3s ease; pointer-events: none; z-index: 2;
}
.lang-track-label.lang-en { left: 0; }
.lang-track-label.lang-ur { right: 0; }
.lang-toggle[aria-pressed="false"] .lang-en { color: #241804; }
.lang-toggle[aria-pressed="true"] .lang-ur { color: #241804; }
.lang-thumb {
  position: absolute; top: 3px; left: 3px; width: 30px; height: 26px;
  border-radius: 999px; background: var(--gold);
  transition: transform 0.3s cubic-bezier(0.65,0.05,0.36,1);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3); z-index: 1;
}
.lang-toggle[aria-pressed="true"] .lang-thumb { transform: translateX(32px); }

/* ============================================================
   Homepage: featured cards + collapsible category list
   ============================================================ */

.featured-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 28px;
}
.featured-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-top: 3px solid var(--gold);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  text-decoration: none;
  color: var(--ink);
  transition: all 0.15s ease;
  position: relative;
}
.featured-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.featured-card-rank {
  position: absolute; top: 18px; right: 20px;
  font-family: var(--font-mono); font-weight: 800; font-size: 26px;
  color: var(--gold); opacity: 0.85;
}
html[dir="rtl"] .featured-card-rank { right: auto; left: 20px; }
.featured-card-title {
  font-family: var(--font-display); font-weight: 800; font-size: 21px;
  margin-bottom: 8px; padding-right: 50px;
}
html[dir="rtl"] .featured-card-title { padding-right: 0; padding-left: 50px; }
.featured-card-desc { font-size: 14px; color: var(--ink-soft); line-height: 1.5; }

.category-list { display: flex; flex-direction: column; gap: 2px; margin-bottom: 20px; }
.category-item { border-bottom: 1px solid var(--hairline); }
.category-header {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  background: none; border: none; padding: 16px 4px; cursor: pointer; text-align: left;
}
html[dir="rtl"] .category-header { text-align: right; }
.category-header-left { display: flex; flex-direction: column; gap: 4px; }
.category-name { font-family: var(--font-display); font-weight: 700; font-size: 16px; color: var(--ink); }
.category-preview { font-size: 12.5px; color: var(--ink-soft); line-height: 1.4; }
.category-header-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.category-count {
  font-family: var(--font-mono); font-size: 13px; font-weight: 600; color: var(--ink-soft);
  background: var(--surface-2); width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.category-chevron { width: 18px; height: 18px; color: var(--ink-soft); transition: transform 0.2s ease; flex-shrink: 0; }
.category-item.open .category-chevron { transform: rotate(180deg); }
.category-body { max-height: 0; overflow: hidden; transition: max-height 0.25s ease; }
.category-item.open .category-body { max-height: 600px; }
.category-links { display: flex; flex-direction: column; padding: 4px 4px 16px; }
.category-link {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 12px; border-radius: 8px; text-decoration: none;
  color: var(--ink); font-size: 14.5px; transition: background 0.12s ease;
}
.category-link:hover { background: var(--surface-2); }
.category-link-arrow { color: var(--gold); font-size: 15px; }
html[dir="rtl"] .category-link-arrow { transform: scaleX(-1); display: inline-block; }

/* Homepage-specific wordmark link wrapper (other pages wrap wordmark in <a>, homepage doesn't need to link to itself) */
.wordmark-link { text-decoration: none; }
