/* ============================================================
   FinWise Calculators — Design System
   Dark Green × Yellow × Black × White palette
   ============================================================ */

/* 1. Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Space+Grotesk:wght@500;600;700&display=swap');

/* 2. CSS Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; }
a { text-decoration: none; }
ul, ol { list-style: none; }

/* 3. CSS Custom Properties */
:root {
  /* Backgrounds */
  --bg-base:      #080C0A;
  --bg-surface:   #0F1A12;
  --bg-elevated:  #162019;
  --bg-input:     #0D1610;
  --bg-hover:     #1E2E22;

  /* Green palette */
  --green-700:    #15803D;
  --green-600:    #16A34A;
  --green-500:    #22C55E;
  --green-400:    #4ADE80;
  --green-300:    #86EFAC;
  --green-glow:   rgba(34,197,94,0.15);
  --green-glow-sm:rgba(34,197,94,0.08);

  /* Yellow / Gold palette */
  --yellow-600:   #CA8A04;
  --yellow-500:   #EAB308;
  --yellow-400:   #FACC15;
  --yellow-300:   #FDE047;
  --yellow-glow:  rgba(250,204,21,0.15);

  /* Text */
  --text-primary:   #F0FDF4;
  --text-secondary: #A1C4A8;
  --text-muted:     #4B6B50;
  --text-inverse:   #080C0A;

  /* Borders */
  --border:         #2A3D2E;
  --border-medium:  #3D6B47;
  --border-focus:   #22C55E;

  /* Semantic */
  --color-danger:   #EF4444;
  --color-warning:  #F59E0B;
  --color-success:  #22C55E;
  --color-info:     #38BDF8;

  /* Typography */
  --font-body:    'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Space Grotesk', system-ui, sans-serif;
  --font-mono:    'Fira Code', 'Cascadia Code', monospace;

  /* Spacing (8px base) */
  --s1: 0.25rem;  --s2: 0.5rem;   --s3: 0.75rem;
  --s4: 1rem;     --s5: 1.25rem;  --s6: 1.5rem;
  --s8: 2rem;     --s10: 2.5rem;  --s12: 3rem;
  --s16: 4rem;    --s20: 5rem;    --s24: 6rem;

  /* Radius */
  --r-sm:   6px;
  --r-md:   10px;
  --r-lg:   16px;
  --r-xl:   24px;
  --r-full: 9999px;

  /* Shadows */
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.5);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.6);
  --shadow-lg:   0 12px 40px rgba(0,0,0,0.7);
  --shadow-glow: 0 0 24px rgba(34,197,94,0.25);
  --shadow-yellow-glow: 0 0 20px rgba(250,204,21,0.2);

  /* Transitions */
  --t-fast: 120ms ease;
  --t-base: 200ms ease;
  --t-slow: 350ms ease;

  /* Layout */
  --max-width: 1280px;
  --nav-height: 64px;
}

/* 4. Base Typography */
body {
  font-family: var(--font-body);
  background-color: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 1rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  line-height: 1.2;
  color: var(--text-primary);
  font-weight: 700;
}

h1 { font-size: clamp(1.75rem, 4vw, 2.75rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: clamp(1.1rem, 2vw, 1.4rem); }
h4 { font-size: 1.1rem; }

p { color: var(--text-secondary); line-height: 1.75; }

a { color: var(--green-400); transition: color var(--t-fast); }
a:hover { color: var(--green-300); }

strong { color: var(--text-primary); font-weight: 600; }

code {
  font-family: var(--font-mono);
  background: var(--bg-elevated);
  padding: 0.1em 0.4em;
  border-radius: var(--r-sm);
  font-size: 0.875em;
  color: var(--yellow-400);
}

/* 5. Layout Primitives */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--s6);
}

.container--narrow { max-width: 860px; }
.container--wide   { max-width: 1440px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s6); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s6); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s5); }

.flex     { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4  { gap: var(--s4); }
.gap-6  { gap: var(--s6); }

.stack > * + * { margin-top: var(--s4); }

main { flex: 1; }

/* 6. Navigation */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(8,12,10,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: var(--nav-height);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.nav__logo {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.nav__logo-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--green-600), var(--green-400));
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
}

.nav__logo span.accent { color: var(--yellow-400); }

.nav__links {
  display: flex;
  align-items: center;
  gap: var(--s1);
}

.nav__link {
  padding: var(--s2) var(--s3);
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color var(--t-fast), background var(--t-fast);
}

.nav__link:hover, .nav__link.is-active {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.nav__dropdown {
  position: relative;
}

.nav__dropdown-toggle {
  display: flex; align-items: center; gap: var(--s1);
  padding: var(--s2) var(--s3);
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--t-fast), background var(--t-fast);
  background: none; border: none;
}

.nav__dropdown-toggle:hover { color: var(--text-primary); background: var(--bg-elevated); }

.nav__dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s2);
  padding-top: 10px;
  min-width: 200px;
  box-shadow: var(--shadow-lg);
}

.nav__dropdown:hover .nav__dropdown-menu { display: block; }

.nav__dropdown-item {
  display: block;
  padding: var(--s2) var(--s3);
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  transition: color var(--t-fast), background var(--t-fast);
}

.nav__dropdown-item:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* Mobile hamburger */
.nav__hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--s2);
  color: var(--text-primary);
}

.nav__mobile-menu {
  display: none;
  position: fixed;
  inset: var(--nav-height) 0 0;
  background: var(--bg-base);
  padding: var(--s6);
  z-index: 99;
  overflow-y: auto;
}

.nav__mobile-menu.is-open { display: block; }

.nav__mobile-link {
  display: block;
  padding: var(--s3) var(--s4);
  color: var(--text-secondary);
  font-size: 1rem;
  border-bottom: 1px solid var(--border);
  transition: color var(--t-fast);
}

.nav__mobile-link:hover { color: var(--text-primary); }

/* 7. Hero Section */
.hero {
  background: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(22,163,74,0.12) 0%, transparent 60%),
              linear-gradient(180deg, var(--bg-base) 0%, var(--bg-surface) 100%);
  padding: var(--s20) 0 var(--s16);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 50%, rgba(34,197,94,0.04) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(250,204,21,0.04) 0%, transparent 50%);
  pointer-events: none;
}

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  background: var(--green-glow-sm);
  border: 1px solid rgba(34,197,94,0.3);
  padding: var(--s1) var(--s3);
  border-radius: var(--r-full);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--green-400);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: var(--s4);
}

.hero__title {
  font-size: clamp(2.25rem, 6vw, 4rem);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: var(--s5);
  max-width: 800px;
  margin-inline: auto;
}

.hero__title .highlight {
  background: linear-gradient(135deg, var(--green-400), var(--yellow-400));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero__subtitle {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto var(--s8);
}

.hero__actions {
  display: flex;
  gap: var(--s3);
  justify-content: center;
  flex-wrap: wrap;
}

.hero__stats {
  display: flex;
  gap: var(--s8);
  justify-content: center;
  margin-top: var(--s12);
  flex-wrap: wrap;
}

.hero__stat-value {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--green-400);
}

.hero__stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: var(--s1);
}

/* 8. Category Section */
.category-section {
  padding: var(--s16) 0;
}

.category-section + .category-section {
  border-top: 1px solid var(--border);
}

.section-header {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin-bottom: var(--s8);
}

.section-icon {
  width: 40px; height: 40px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.section-icon--green  { background: var(--green-glow); border: 1px solid rgba(34,197,94,0.3); }
.section-icon--yellow { background: var(--yellow-glow); border: 1px solid rgba(250,204,21,0.3); }

.section-title { font-size: 1.4rem; }
.section-subtitle { color: var(--text-muted); font-size: 0.9rem; margin-top: 2px; }

/* 9. Calculator Cards (Homepage) */
.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--s4);
}

.calc-card {
  display: block;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s5);
  transition: border-color var(--t-base), transform var(--t-base), box-shadow var(--t-base);
  position: relative;
  overflow: hidden;
}

.calc-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--green-600), var(--green-400));
  opacity: 0;
  transition: opacity var(--t-base);
}

.calc-card:hover {
  border-color: var(--border-medium);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md), var(--green-glow);
}

.calc-card:hover::before { opacity: 1; }

.calc-card__icon {
  width: 44px; height: 44px;
  border-radius: var(--r-md);
  background: var(--green-glow);
  border: 1px solid rgba(34,197,94,0.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  margin-bottom: var(--s3);
}

.calc-card__tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--green-400);
  background: var(--green-glow-sm);
  padding: 2px var(--s2);
  border-radius: var(--r-full);
  margin-bottom: var(--s2);
}

.calc-card__title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--s2);
  line-height: 1.3;
}

.calc-card__desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.calc-card__arrow {
  position: absolute;
  bottom: var(--s4);
  right: var(--s4);
  color: var(--text-muted);
  font-size: 1.1rem;
  transition: color var(--t-fast), transform var(--t-fast);
}

.calc-card:hover .calc-card__arrow {
  color: var(--green-400);
  transform: translate(2px, -2px);
}

/* 10. Calculator Page Layout */
.page-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: var(--s8) 0 var(--s6);
}

.page-header__inner {
  display: flex;
  align-items: flex-start;
  gap: var(--s4);
}

.page-header__icon {
  width: 52px; height: 52px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--green-600), var(--green-500));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
  box-shadow: var(--shadow-glow);
}

.page-header__category {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--green-400);
  margin-bottom: var(--s1);
}

.page-header h1 { font-size: clamp(1.5rem, 3vw, 2.25rem); margin-bottom: var(--s2); }

.page-header__desc { font-size: 0.95rem; max-width: 640px; }

.calc-page { padding: var(--s10) 0 var(--s16); }

.calc-layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: var(--s8);
  align-items: start;
}

/* 11. Form Components */
.calc-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s6);
  position: sticky;
  top: calc(var(--nav-height) + var(--s4));
}

.panel-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--s5);
  padding-bottom: var(--s4);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--s2);
}

.panel-title svg { color: var(--green-400); }

.form-group { margin-bottom: var(--s4); }
.form-group:last-of-type { margin-bottom: 0; }

.form-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--s2);
}

.form-label-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-prefix, .input-suffix {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.875rem;
  color: var(--text-muted);
  pointer-events: none;
  font-weight: 500;
}

.input-prefix { left: var(--s3); }
.input-suffix { right: var(--s3); }

.form-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-primary);
  padding: var(--s3) var(--s4);
  font-size: 0.9rem;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  -moz-appearance: textfield;
}

.form-input::-webkit-outer-spin-button,
.form-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.form-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--green-glow);
}

.form-input.has-prefix  { padding-left: var(--s8); }
.form-input.has-suffix  { padding-right: var(--s8); }

.form-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-primary);
  padding: var(--s3) var(--s4);
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234B6B50' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--s3) center;
  padding-right: var(--s8);
}

.form-select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--green-glow);
}

.form-select option { background: var(--bg-elevated); }

.form-range {
  width: 100%;
  -webkit-appearance: none;
  height: 4px;
  border-radius: var(--r-full);
  background: var(--border);
  outline: none;
  margin-top: var(--s2);
}

.form-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: var(--r-full);
  background: var(--green-500);
  cursor: pointer;
  box-shadow: 0 0 0 3px var(--green-glow);
  transition: background var(--t-fast);
}

.form-range::-webkit-slider-thumb:hover { background: var(--green-400); }

.form-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: var(--s1);
}

.form-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--s5) 0;
}

/* Tab switcher in forms */
.tab-group {
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 3px;
  gap: 3px;
  margin-bottom: var(--s4);
}

.tab-group .tab {
  flex: 1;
  text-align: center;
  padding: var(--s2) var(--s3);
  border-radius: calc(var(--r-sm) - 2px);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--t-fast);
  border: none;
  background: none;
}

.tab-group .tab.is-active {
  background: var(--green-600);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

/* 12. Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  padding: var(--s3) var(--s6);
  border-radius: var(--r-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--t-fast);
  white-space: nowrap;
}

.btn--primary {
  background: var(--green-600);
  color: #fff;
  width: 100%;
  padding: var(--s4);
  margin-top: var(--s5);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.btn--primary:hover:not(:disabled) {
  background: var(--green-700);
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

.btn--primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn--secondary {
  background: transparent;
  border: 1px solid var(--border-medium);
  color: var(--text-secondary);
}

.btn--secondary:hover { border-color: var(--green-400); color: var(--green-400); }

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: var(--s2) var(--s4);
}

.btn--ghost:hover { color: var(--text-primary); background: var(--bg-elevated); }

.btn--yellow {
  background: var(--yellow-500);
  color: var(--text-inverse);
}

.btn--yellow:hover { background: var(--yellow-400); box-shadow: var(--shadow-yellow-glow); }

.btn--sm { padding: var(--s2) var(--s4); font-size: 0.8rem; }
.btn--lg { padding: var(--s4) var(--s8); font-size: 1rem; }

/* 13. Results Panel */
.results-panel {
  display: flex;
  flex-direction: column;
  gap: var(--s5);
}

.result-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s5) var(--s6);
}

.result-card--highlight {
  background: linear-gradient(135deg, rgba(22,163,74,0.1), rgba(34,197,94,0.05));
  border-color: rgba(34,197,94,0.3);
}

.result-card--yellow {
  background: linear-gradient(135deg, rgba(234,179,8,0.1), rgba(250,204,21,0.05));
  border-color: rgba(250,204,21,0.3);
}

.result-card__label {
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: var(--s2);
}

.result-card__value {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--green-400);
  line-height: 1;
}

.result-card--yellow .result-card__value { color: var(--yellow-400); }

.result-card__sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: var(--s2);
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s3);
}

.result-stat {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s4);
}

.result-stat__label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: var(--s1);
}

.result-stat__value {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
}

.result-stat__value.green  { color: var(--green-400); }
.result-stat__value.yellow { color: var(--yellow-400); }
.result-stat__value.red    { color: var(--color-danger); }

.breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--s2) 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.breakdown-row:last-child { border-bottom: none; }

.breakdown-row__label { color: var(--text-secondary); }
.breakdown-row__value { font-weight: 600; color: var(--text-primary); }
.breakdown-row__value.green  { color: var(--green-400); }
.breakdown-row__value.yellow { color: var(--yellow-400); }
.breakdown-row__value.red    { color: var(--color-danger); }

/* 14. Charts */
.chart-wrap {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s5) var(--s6);
}

.chart-wrap__title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--s4);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chart-container { position: relative; }

/* 15. Data Table */
.table-wrap {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.table-title {
  padding: var(--s4) var(--s5);
  font-size: 0.875rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.data-table thead th {
  background: var(--bg-surface);
  padding: var(--s3) var(--s4);
  text-align: right;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.7rem;
}

.data-table thead th:first-child { text-align: left; }

.data-table tbody td {
  padding: var(--s3) var(--s4);
  text-align: right;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.data-table tbody td:first-child { text-align: left; color: var(--text-primary); font-weight: 500; }

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--bg-hover); }

/* Scrollable table wrapper */
.table-scroll {
  max-height: 360px;
  overflow-y: auto;
}

.table-scroll::-webkit-scrollbar { width: 6px; }
.table-scroll::-webkit-scrollbar-track { background: var(--bg-surface); }
.table-scroll::-webkit-scrollbar-thumb { background: var(--border-medium); border-radius: 3px; }

/* 16. Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px var(--s2);
  border-radius: var(--r-full);
  font-size: 0.72rem;
  font-weight: 600;
}

.badge--green  { background: var(--green-glow); color: var(--green-400); border: 1px solid rgba(34,197,94,0.3); }
.badge--yellow { background: var(--yellow-glow); color: var(--yellow-400); border: 1px solid rgba(250,204,21,0.3); }
.badge--red    { background: rgba(239,68,68,0.1); color: #EF4444; border: 1px solid rgba(239,68,68,0.3); }
.badge--muted  { background: var(--bg-surface); color: var(--text-muted); border: 1px solid var(--border); }

/* 17. Alert / Info Boxes */
.alert {
  padding: var(--s3) var(--s4);
  border-radius: var(--r-sm);
  font-size: 0.875rem;
  border-left: 3px solid;
  margin-bottom: var(--s4);
}

.alert--info    { background: rgba(56,189,248,0.08); border-color: var(--color-info); color: #7DD3FC; }
.alert--warning { background: rgba(245,158,11,0.08); border-color: var(--color-warning); color: #FCD34D; }
.alert--success { background: var(--green-glow-sm); border-color: var(--green-500); color: var(--green-300); }
.alert--danger  { background: rgba(239,68,68,0.08); border-color: var(--color-danger); color: #FCA5A5; }

/* 18. Breadcrumb */
.breadcrumb {
  padding: var(--s3) 0;
}

.breadcrumb ol {
  display: flex;
  align-items: center;
  gap: var(--s2);
  flex-wrap: wrap;
}

.breadcrumb li {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.breadcrumb li a { color: var(--text-muted); }
.breadcrumb li a:hover { color: var(--green-400); }
.breadcrumb li[aria-current="page"] { color: var(--text-secondary); }

.breadcrumb li:not(:last-child)::after {
  content: '/';
  color: var(--border-medium);
}

/* 19. Intro copy section */
.calc-intro {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s5) var(--s6);
  margin-bottom: var(--s6);
}

.calc-intro p { font-size: 0.9rem; line-height: 1.8; color: var(--text-secondary); margin: 0; }

/* 20. How it Works section */
.how-it-works {
  margin-top: var(--s12);
}

.how-it-works h2 { margin-bottom: var(--s6); }

.formula-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s4) var(--s5);
  margin: var(--s4) 0;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--yellow-300);
  overflow-x: auto;
}

/* 21. FAQ Section */
.faq-section { margin-top: var(--s12); }
.faq-section h2 { margin-bottom: var(--s6); }

.faq-item {
  border-bottom: 1px solid var(--border);
  padding: var(--s4) 0;
}

.faq-question {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s4);
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  padding: 0;
}

.faq-question:hover { color: var(--green-400); }

.faq-answer {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.75;
  margin-top: var(--s3);
  padding-right: var(--s8);
  display: none;
}

.faq-answer.is-open { display: block; }

.faq-icon { transition: transform var(--t-fast); flex-shrink: 0; }
.faq-question.is-open .faq-icon { transform: rotate(45deg); }

/* 22. Related Calculators */
.related-section {
  margin-top: var(--s12);
  padding-top: var(--s8);
  border-top: 1px solid var(--border);
}

.related-section h2 { margin-bottom: var(--s5); }

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--s3);
}

.related-card {
  display: flex;
  align-items: center;
  gap: var(--s3);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s3) var(--s4);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--t-fast);
}

.related-card:hover {
  border-color: var(--border-medium);
  color: var(--text-primary);
  background: var(--bg-hover);
}

.related-card__icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* 23. Empty state (before calculation) */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--s16) var(--s8);
  text-align: center;
  color: var(--text-muted);
}

.empty-state__icon {
  font-size: 2.5rem;
  margin-bottom: var(--s4);
  opacity: 0.5;
}

.empty-state p { font-size: 0.875rem; max-width: 280px; }

/* 24. Loading spinner */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--green-400);
  border-radius: var(--r-full);
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* 25. Footer */
.footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: var(--s12) 0 var(--s8);
  margin-top: auto;
}

.footer__grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(4, 1fr);
  gap: var(--s8);
  margin-bottom: var(--s10);
}

.footer__brand p {
  font-size: 0.85rem;
  margin-top: var(--s3);
  max-width: 260px;
}

.footer__col-title {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: var(--s3);
}

.footer__link {
  display: block;
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 3px 0;
  transition: color var(--t-fast);
}

.footer__link:hover { color: var(--green-400); }

.footer__bottom {
  border-top: 1px solid var(--border);
  padding-top: var(--s5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.footer__disclaimer {
  max-width: 640px;
  line-height: 1.5;
}

/* 26. Utility classes */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.text-green   { color: var(--green-400) !important; }
.text-yellow  { color: var(--yellow-400) !important; }
.text-muted   { color: var(--text-muted) !important; }
.text-red     { color: var(--color-danger) !important; }
.text-sm      { font-size: 0.875rem; }
.text-xs      { font-size: 0.75rem; }
.fw-bold      { font-weight: 700; }
.fw-semibold  { font-weight: 600; }
.text-center  { text-align: center; }
.mt-4  { margin-top: var(--s4); }
.mt-6  { margin-top: var(--s6); }
.mt-8  { margin-top: var(--s8); }
.mb-4  { margin-bottom: var(--s4); }
.mb-6  { margin-bottom: var(--s6); }
.hidden { display: none !important; }

/* Recommendation badge */
.recommendation {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s2) var(--s4);
  border-radius: var(--r-full);
  font-size: 0.875rem;
  font-weight: 600;
}

.recommendation--buy    { background: var(--green-glow); color: var(--green-400); border: 1px solid rgba(34,197,94,0.4); }
.recommendation--rent   { background: var(--yellow-glow); color: var(--yellow-400); border: 1px solid rgba(250,204,21,0.4); }
.recommendation--refin  { background: var(--green-glow); color: var(--green-400); border: 1px solid rgba(34,197,94,0.4); }
.recommendation--stay   { background: rgba(239,68,68,0.08); color: #EF4444; border: 1px solid rgba(239,68,68,0.3); }

/* 404/500 pages */
.error-page {
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--s8);
}

.error-page__code {
  font-family: var(--font-heading);
  font-size: 8rem;
  font-weight: 700;
  color: var(--border-medium);
  line-height: 1;
  margin-bottom: var(--s4);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1024px) {
  .calc-layout {
    grid-template-columns: 380px 1fr;
  }
  .footer__grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 900px) {
  .calc-layout {
    grid-template-columns: 1fr;
  }
  .calc-panel {
    position: static;
  }
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .nav__links { display: none; }
  .nav__hamburger { display: flex; }

  .hero { padding: var(--s16) 0 var(--s12); }
  .hero__stats { gap: var(--s6); }

  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
  }

  .result-grid {
    grid-template-columns: 1fr;
  }

  .footer__grid {
    grid-template-columns: 1fr;
    gap: var(--s6);
  }

  .footer__bottom {
    flex-direction: column;
    gap: var(--s3);
    text-align: center;
  }

  .container { padding-inline: var(--s4); }
}

@media (max-width: 480px) {
  :root { --nav-height: 56px; }

  h1 { font-size: 1.75rem; }
  .result-card__value { font-size: 1.9rem; }
  .calc-grid {
    grid-template-columns: 1fr;
  }
  .hero__actions { flex-direction: column; align-items: center; }
  .btn--lg { width: 100%; }
}
