:root {
  /* Neutral palette */
  --bg: #f0f2f5;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #ffffff;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border: rgba(148, 163, 184, 0.25);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.07), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
  --radius-sm: 12px;
  --radius: 20px;
  --radius-lg: 28px;
  --radius-xl: 32px;

  /* Per-calculator accent themes */
  --accent-percentage: #4f46e5;
  --accent-percentage-light: #818cf8;
  --accent-percentage-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);
  --accent-bmi: #10b981;
  --accent-bmi-light: #34d399;
  --accent-bmi-gradient: linear-gradient(135deg, #10b981, #059669);
  --accent-mortgage: #f59e0b;
  --accent-mortgage-light: #fbbf24;
  --accent-mortgage-gradient: linear-gradient(135deg, #f59e0b, #f97316);
  --accent-age: #0ea5e9;
  --accent-age-light: #38bdf8;
  --accent-age-gradient: linear-gradient(135deg, #0ea5e9, #3b82f6);
  --accent-tip: #f43f5e;
  --accent-tip-light: #fb7185;
  --accent-tip-gradient: linear-gradient(135deg, #f43f5e, #ec4899);
  --accent-date: #7c3aed;
  --accent-date-light: #a78bfa;
  --accent-date-gradient: linear-gradient(135deg, #7c3aed, #6366f1);
}

/* ========== BASE ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
}

/* ========== HEADER ========== */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(20px) saturate(1.8);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--text);
}

.logo svg { flex-shrink: 0; }

.header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-nav a {
  color: var(--accent-percentage);
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.18);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}

.header-nav a:hover {
  background: rgba(99, 102, 241, 0.16);
  color: #4338ca;
  text-decoration: none;
  transform: translateY(-1px);
}

.premium-btn {
  background: var(--accent-percentage-gradient);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.premium-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transform: translateX(-100%);
  transition: transform 0.5s;
}

.premium-btn:hover::before {
  transform: translateX(100%);
}

.premium-btn:hover {
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
  transform: translateY(-1px);
}

.premium-btn:active {
  transform: scale(0.96);
}

/* ========== MAIN ========== */
main { flex: 1; }

.view {
  display: none;
  padding-bottom: 100px;
  animation: viewEnter 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.view.active { display: block; }

@keyframes viewEnter {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ========== HOME SCREEN ========== */
.hero {
  text-align: center;
  padding: 32px 24px 24px;
}

.hero h1 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
  background: var(--accent-percentage-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 15px;
  color: var(--text-secondary);
  font-weight: 500;
}

.calculator-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 0 18px 24px;
}

.calc-card {
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius);
  padding: 20px 14px 16px;
  text-align: center;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.calc-card::before {
  content: '';
  position: absolute;
  top: 0; left: 50%; right: 50%; bottom: 0;
  border-radius: var(--radius);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 0;
}

.calc-card:hover, .calc-card:active {
  transform: translateY(-4px) scale(1.02);
  box-shadow: var(--shadow-xl);
  border-color: transparent;
}

.calc-card:hover::before, .calc-card:active::before {
  top: -2px; left: -2px; right: -2px; bottom: -2px;
  opacity: 1;
}

/* Card glow colors */
.calc-card:nth-child(1)::before { background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(139,92,246,0.15)); }
.calc-card:nth-child(2)::before { background: linear-gradient(135deg, rgba(16,185,129,0.15), rgba(52,211,153,0.15)); }
.calc-card:nth-child(3)::before { background: linear-gradient(135deg, rgba(245,158,11,0.15), rgba(251,191,36,0.15)); }
.calc-card:nth-child(4)::before { background: linear-gradient(135deg, rgba(14,165,233,0.15), rgba(56,189,248,0.15)); }
.calc-card:nth-child(5)::before { background: linear-gradient(135deg, rgba(244,63,94,0.15), rgba(251,113,133,0.15)); }
.calc-card:nth-child(6)::before { background: linear-gradient(135deg, rgba(124,58,237,0.15), rgba(167,139,250,0.15)); }
.calc-card:nth-child(n+7)::before { background: linear-gradient(135deg, rgba(20,184,166,0.15), rgba(59,130,246,0.15)); }

.calc-card > * { position: relative; z-index: 1; }

.calc-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  font-weight: 800;
  font-size: 20px;
  color: white;
  box-shadow: var(--shadow);
  transition: transform 0.3s;
}

.calc-card:hover .calc-icon {
  transform: scale(1.1) rotate(-4deg);
}

.calc-icon.percentage { background: var(--accent-percentage-gradient); }
.calc-icon.bmi { background: var(--accent-bmi-gradient); }
.calc-icon.mortgage { background: var(--accent-mortgage-gradient); }
.calc-icon.age { background: var(--accent-age-gradient); }
.calc-icon.tip { background: var(--accent-tip-gradient); }
.calc-icon.date { background: var(--accent-date-gradient); }
.calc-icon.compound,
.calc-icon.loan,
.calc-icon.car-loan,
.calc-icon.salary,
.calc-icon.sales-tax { background: linear-gradient(135deg, #14b8a6, #3b82f6); font-size: 15px; }
.calc-icon.crypto { background: linear-gradient(135deg, #f59e0b, #7c3aed); font-size: 14px; }

.calc-card h2 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -0.2px;
}

.calc-card p {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  font-weight: 500;
}

.badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(241, 245, 249, 0.8);
  color: var(--text-secondary);
  letter-spacing: 0.3px;
  border: 1px solid var(--border);
}

.badge.hot {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #92400e;
  border: none;
}

/* ========== CALCULATOR VIEWS - THEMED HEADERS ========== */
.calc-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(20px) saturate(1.8);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.back-btn {
  background: none;
  border: none;
  font-size: 15px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 12px;
  font-weight: 600;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 4px;
}

.back-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
}

.calc-header h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.calc-help {
  margin: 14px 18px 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.62);
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
  font-weight: 550;
}

.publisher-content {
  margin: 18px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.publisher-content h2,
.publisher-content h3 {
  color: var(--text);
  letter-spacing: -0.2px;
  line-height: 1.25;
}

.publisher-content h2 {
  font-size: 21px;
  margin-bottom: 10px;
}

.publisher-content h3 {
  font-size: 16px;
  margin-bottom: 8px;
}

.publisher-content p {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.65;
  margin: 0 0 10px;
}

.publisher-content p:last-child {
  margin-bottom: 0;
}

.calculator-content {
  margin-top: 12px;
}

.home-content {
  margin-top: 0;
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.content-grid > div {
  padding: 14px;
  border-radius: var(--radius-sm);
  background: rgba(241, 245, 249, 0.72);
  border: 1px solid var(--border);
}

@media (max-width: 420px) {
  .content-grid {
    grid-template-columns: 1fr;
  }
}

/* Theme-colored header accents */
#percentage-view .calc-header { border-bottom-color: rgba(99, 102, 241, 0.2); }
#bmi-view .calc-header { border-bottom-color: rgba(16, 185, 129, 0.2); }
#mortgage-view .calc-header { border-bottom-color: rgba(245, 158, 11, 0.2); }
#age-view .calc-header { border-bottom-color: rgba(14, 165, 233, 0.2); }
#tip-view .calc-header { border-bottom-color: rgba(244, 63, 94, 0.2); }
#date-view .calc-header { border-bottom-color: rgba(124, 58, 237, 0.2); }
#compound-view .calc-header,
#loan-view .calc-header,
#car-loan-view .calc-header,
#salary-view .calc-header,
#sales-tax-view .calc-header { border-bottom-color: rgba(20, 184, 166, 0.2); }

/* ========== CALC TABS (Pill Style) ========== */
.calc-tabs {
  display: flex;
  gap: 6px;
  padding: 16px;
  background: transparent;
}

.tab-btn {
  flex: 1;
  padding: 10px 12px;
  border: none;
  background: rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
}

.tab-btn.active {
  background: var(--surface-solid);
  color: var(--text);
  box-shadow: var(--shadow);
  font-weight: 700;
}

/* Active tab indicator line */
.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 3px;
  border-radius: 3px;
  background: var(--accent-percentage);
}

/* Theme-colored tab indicators */
#percentage-view .tab-btn.active::after { background: var(--accent-percentage); }
#bmi-view .tab-btn.active::after { background: var(--accent-bmi); }
#mortgage-view .tab-btn.active::after { background: var(--accent-mortgage); }
#age-view .tab-btn.active::after { background: var(--accent-age); }
#tip-view .tab-btn.active::after { background: var(--accent-tip); }
#date-view .tab-btn.active::after { background: var(--accent-date); }
#compound-view .tab-btn.active::after,
#loan-view .tab-btn.active::after,
#car-loan-view .tab-btn.active::after,
#salary-view .tab-btn.active::after,
#sales-tax-view .tab-btn.active::after { background: #14b8a6; }

.tab-content { display: none; padding: 20px 18px 40px; }
.tab-content.active { display: block; animation: fadeUp 0.3s ease; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== BODY WRAPPER ========== */
.calc-body {
  padding: 20px 18px 40px;
}

/* ========== INPUTS (Modern Floating Style) ========== */
.input-group {
  margin-bottom: 18px;
}

.input-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.input-group input, .input-group select {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-solid);
  outline: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-appearance: none;
}

.input-group input:focus, .input-group select:focus {
  border-color: var(--accent-percentage);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.08);
}

/* Theme-colored input focus */
#bmi-view .input-group input:focus { border-color: var(--accent-bmi); box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.08); }
#mortgage-view .input-group input:focus { border-color: var(--accent-mortgage); box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.08); }
#age-view .input-group input:focus { border-color: var(--accent-age); box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.08); }
#tip-view .input-group input:focus { border-color: var(--accent-tip); box-shadow: 0 0 0 4px rgba(244, 63, 94, 0.08); }
#date-view .input-group input:focus { border-color: var(--accent-date); box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.08); }
#compound-view .input-group input:focus,
#loan-view .input-group input:focus,
#car-loan-view .input-group input:focus,
#salary-view .input-group input:focus,
#sales-tax-view .input-group input:focus { border-color: #14b8a6; box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.08); }

.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Inline Input Rows */
.inline-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  background: var(--surface-solid);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
}

.inline-row .inline-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.inline-row input.inline-input,
.inline-row input.inline-input-wide {
  width: auto;
  flex: 1;
  min-width: 50px;
  max-width: 110px;
  padding: 8px 12px;
  font-size: 16px;
  border: none;
  border-radius: 8px;
  background: rgba(241, 245, 249, 0.6);
}

.inline-row input.inline-input-wide {
  max-width: 140px;
}

.inline-suffix {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

/* ========== RESULT BOXES (Themed Gradients) ========== */
.result-box {
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.2);
}

.result-box::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 50% 0%, rgba(255,255,255,0.2) 0%, transparent 50%);
}

.result-box > * { position: relative; z-index: 1; }

.result-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  opacity: 0.85;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.result-value {
  display: block;
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -1px;
}

.result-category {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-top: 6px;
  opacity: 0.95;
  text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.result-box .result-sub {
  font-size: 13px;
  font-weight: 600;
  opacity: 0.9;
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.9);
}

.result-box.secondary {
  background: var(--surface-solid) !important;
  color: var(--text) !important;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.result-box.secondary .result-label,
.result-box.secondary .result-sub {
  color: var(--text-secondary);
  opacity: 1;
}

/* Per-calculator result box colors */
#percentage-view .result-box { background: var(--accent-percentage-gradient); color: white; }
#bmi-view .result-box { background: var(--accent-bmi-gradient); color: white; }
#mortgage-view .result-box { background: var(--accent-mortgage-gradient); color: white; }
#age-view .result-box { background: var(--accent-age-gradient); color: white; }
#tip-view .result-box { background: var(--accent-tip-gradient); color: white; }
#date-view .result-box { background: var(--accent-date-gradient); color: white; }
.finance-result,
#compound-view .result-box,
#loan-view .result-box,
#car-loan-view .result-box,
#salary-view .result-box,
#sales-tax-view .result-box { background: linear-gradient(135deg, #14b8a6, #3b82f6); color: white; }

/* ========== BMI SCALE ========== */
.bmi-scale {
  padding: 0 0 20px;
}

.scale-bar {
  display: flex;
  height: 52px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  font-size: 9px;
  font-weight: 700;
  text-align: center;
  line-height: 1.3;
  box-shadow: var(--shadow-sm);
}

.scale-segment {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  padding: 4px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.underweight { background: linear-gradient(135deg, #3b82f6, #60a5fa); }
.normal { background: linear-gradient(135deg, #22c55e, #4ade80); }
.overweight { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.obese { background: linear-gradient(135deg, #ef4444, #f87171); }

.scale-indicator {
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 14px solid var(--text);
  margin-top: -1px;
  position: relative;
  transform: translateX(-50%);
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.3));
  transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== TIP CALCULATOR ========== */
.tip-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.tip-presets button {
  padding: 12px;
  border: 2px solid var(--border);
  background: var(--surface-solid);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.tip-presets button.active, .tip-presets button:hover {
  background: var(--accent-tip-gradient);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(244, 63, 94, 0.3);
  transform: translateY(-2px);
}

.tip-slider {
  width: 100%;
  margin: 14px 0;
  -webkit-appearance: none;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent-tip), var(--accent-tip-light));
  outline: none;
}

.tip-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: white;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(244, 63, 94, 0.4);
  border: 3px solid var(--accent-tip);
  transition: transform 0.2s;
}

.tip-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.leverage-slider {
  width: 100%;
  margin: 10px 0 12px;
  -webkit-appearance: none;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, #f59e0b, #7c3aed);
  outline: none;
}

.leverage-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: white;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.35);
  border: 3px solid #7c3aed;
  transition: transform 0.2s;
}

.leverage-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.dca-entries {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.dca-entry {
  display: grid;
  grid-template-columns: 64px 1fr 1fr 1fr;
  gap: 8px;
  align-items: center;
}

.dca-entry span {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 800;
}

.dca-entry input {
  min-width: 0;
  padding: 10px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-solid);
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
}

.tip-value {
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  color: var(--accent-tip);
  margin-bottom: 8px;
}

/* ========== MORTGAGE BREAKDOWN ========== */
.mortgage-breakdown {
  background: var(--surface);
  backdrop-filter: blur(16px);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.breakdown-item {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

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

.breakdown-item span:first-child { color: var(--text-secondary); font-weight: 500; }
.breakdown-item span:last-child { font-weight: 700; font-size: 15px; }

.calc-note {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
  margin: -4px 4px 18px;
}

.related-guides {
  margin-top: 22px;
  padding: 18px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.related-guides h3 {
  color: var(--text);
  font-size: 15px;
  line-height: 1.2;
  margin-bottom: 12px;
}

.related-guides a {
  display: block;
  padding: 10px 0;
  color: var(--accent-percentage);
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
  border-top: 1px solid var(--border);
}

.related-guides a:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.related-guides a:hover {
  color: #4338ca;
  text-decoration: underline;
}

/* ========== AGE CALCULATOR ========== */
.age-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 10px;
}

.age-item {
  text-align: center;
}

.age-num {
  display: block;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -1px;
}

.age-label {
  font-size: 11px;
  font-weight: 700;
  opacity: 0.85;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.age-details {
  background: var(--surface);
  backdrop-filter: blur(16px);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 14px;
  line-height: 2;
}

.age-details strong {
  color: var(--text);
  font-weight: 700;
}

/* ========== UNIT TOGGLE ========== */
.unit-toggle {
  display: flex;
  gap: 6px;
  padding: 16px;
  background: transparent;
}

.unit-btn {
  flex: 1;
  padding: 10px 12px;
  border: none;
  background: rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s;
}

.unit-btn.active {
  background: var(--surface-solid);
  color: var(--text);
  box-shadow: var(--shadow);
  font-weight: 700;
}

.bmi-unit-content { display: none; padding: 0 0 16px; }
.bmi-unit-content.active { display: block; animation: fadeUp 0.3s ease; }

/* ========== DATE CALCULATOR ========== */
.date-diff-result {
  font-size: 20px;
  font-weight: 700;
  margin-top: 8px;
  line-height: 1.5;
}

/* ========== PREMIUM MODAL (Glassmorphism) ========== */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 200;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal.active { display: flex; }

.modal-content {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(30px) saturate(1.8);
  -webkit-backdrop-filter: blur(30px) saturate(1.8);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 32px 24px 28px;
  max-width: 480px;
  width: 100%;
  position: relative;
  animation: modalSlideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15);
  border-top: 1px solid rgba(255,255,255,0.5);
}

@keyframes modalSlideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: rgba(0,0,0,0.05);
  border: none;
  font-size: 22px;
  color: var(--text-secondary);
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-close:hover {
  background: rgba(0,0,0,0.1);
  color: var(--text);
}

/* Modal handle bar */
.modal-content::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
}

.premium-header { text-align: center; margin-bottom: 24px; margin-top: 8px; }
.premium-header h2 {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}
.premium-header p { color: var(--text-secondary); font-size: 14px; font-weight: 500; }

.premium-features { margin-bottom: 24px; }
.feature {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  font-size: 15px;
  font-weight: 500;
}
.check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(34, 197, 94, 0.3);
}

.pricing {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.price-option {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  background: rgba(255,255,255,0.5);
}

.price-option:hover {
  border-color: var(--accent-percentage-light);
  background: rgba(238, 242, 255, 0.6);
  transform: translateY(-2px);
}

.price-option.best {
  border-color: var(--accent-percentage);
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.price-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-percentage-gradient);
  color: white;
  font-size: 9px;
  font-weight: 800;
  padding: 3px 12px;
  border-radius: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.price-name { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
.price-value { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; }
.price-value span { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.price-save { font-size: 12px; color: var(--accent-bmi); font-weight: 700; margin-top: 4px; }

.premium-cta {
  width: 100%;
  padding: 16px;
  background: var(--accent-percentage-gradient);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  letter-spacing: 0.3px;
}

.premium-cta:hover {
  box-shadow: 0 8px 28px rgba(99, 102, 241, 0.45);
  transform: translateY(-2px);
}

.premium-cta:active {
  transform: scale(0.98);
}

.premium-note {
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 14px;
  font-weight: 500;
}

/* ========== AD BANNER (Modern Minimal) ========== */
.ad-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px) saturate(1.8);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 80;
  max-width: 480px;
  margin: 0 auto;
}

.ad-label {
  font-size: 8px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  flex-shrink: 0;
  background: rgba(148, 163, 184, 0.15);
  padding: 2px 6px;
  border-radius: 4px;
}

.ad-content {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: space-between;
}

.ad-content span {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.ad-content button {
  background: var(--accent-percentage-gradient);
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
  transition: all 0.2s;
}

.ad-content button:hover {
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
  transform: translateY(-1px);
}

/* ========== SELECT DROPDOWN ========== */
.input-group select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 14px center;
  background-repeat: no-repeat;
  background-size: 18px;
  padding-right: 44px;
}

/* ========== RESPONSIVE ========== */
@media (min-width: 640px) {
  .calculator-grid {
    grid-template-columns: repeat(3, 1fr);
    padding: 0 24px 28px;
  }
  .hero h1 { font-size: 32px; }
  .hero { padding: 40px 24px 28px; }
}

/* ========== COOKIE BANNER (GDPR) ========== */
.cookie-banner {
  display: none;
  position: fixed;
  bottom: 72px;
  left: 16px;
  right: 16px;
  max-width: 448px;
  margin: 0 auto;
  z-index: 95;
}

.cookie-content {
  background: var(--surface-solid);
  backdrop-filter: blur(20px);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cookie-content span {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.cookie-content a {
  color: var(--accent-percentage);
  font-weight: 600;
  text-decoration: none;
}

.cookie-buttons {
  display: flex;
  gap: 8px;
}

.cookie-accept {
  flex: 1;
  padding: 10px;
  background: var(--accent-percentage-gradient);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.cookie-manage {
  flex: 1;
  padding: 10px;
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* ========== FOOTER LINKS ========== */
.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  padding: 20px 24px 40px;
  font-size: 12px;
  color: var(--text-muted);
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--accent-percentage);
}

.footer-links span {
  font-weight: 600;
}

/* ========== PREMIUM RESTORE BUTTON ========== */
.premium-restore {
  width: 100%;
  padding: 12px;
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 10px;
  transition: all 0.2s;
}

.premium-restore:hover {
  background: rgba(0, 0, 0, 0.03);
  border-color: var(--text-muted);
}

/* ========== APP TRACKING TRANSPARENCY ========== */
.att-content {
  text-align: center;
  padding: 28px 24px !important;
}

.att-content h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
}

.att-content p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.5;
}

.att-buttons {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.att-deny {
  flex: 1;
  padding: 12px;
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.att-allow {
  flex: 1;
  padding: 12px;
  background: var(--accent-percentage-gradient);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* ========== RTL SUPPORT ========== */
[dir="rtl"] .calc-header,
[dir="rtl"] .inline-row,
[dir="rtl"] .breakdown-item,
[dir="rtl"] .feature,
[dir="rtl"] .age-grid,
[dir="rtl"] .cookie-buttons,
[dir="rtl"] .att-buttons {
  direction: rtl;
}

[dir="rtl"] .back-btn {
  transform: scaleX(-1);
}

/* ========== TIP RESULT CARDS ========== */
.tip-result:last-of-type,
.result-box:last-child {
  margin-bottom: 24px;
}

/* ========== BMI RESULT SPECIFIC ========== */
.bmi-result { margin-top: 10px; }

/* ========== DATE ADD TAB ========== */
#date-add .input-row {
  align-items: end;
}

/* ========== SCROLLBAR (WebKit) ========== */
::-webkit-scrollbar {
  width: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}
