/* ============================================================
   MaxPoints.ai Redesign — Design Tokens & Styles
   ============================================================ */

:root {
  /* Brand */
  --brand-50: #eef2ff;
  --brand-100: #e0e7ff;
  --brand-200: #c7d2fe;
  --brand-300: #a5b4fc;
  --brand-400: #818cf8;
  --brand-500: #6366f1;
  --brand-600: #4f46e5;
  --brand-700: #4338ca;
  --brand-800: #3730a3;
  --brand-900: #312e81;

  /* Accent (highlight / value) */
  --accent-400: #fbbf24;
  --accent-500: #f59e0b;
  --accent-600: #d97706;

  /* Success / info / warn chips */
  --success-50: #ecfdf5;
  --success-600: #059669;
  --success-700: #047857;
  --info-50: #eff6ff;
  --info-600: #2563eb;
  --warn-50: #fef2f2;
  --warn-600: #dc2626;
  --warn-700: #b91c1c;

  /* Neutrals */
  --ink-950: #0f172a;
  --ink-900: #1e293b;
  --ink-700: #334155;
  --ink-500: #64748b;
  --ink-400: #94a3b8;
  --ink-300: #cbd5e1;
  --ink-200: #e2e8f0;
  --ink-100: #f1f5f9;
  --ink-50: #f8fafc;
  --white: #ffffff;

  /* Surfaces */
  --bg-page: #f4f6fb;
  --bg-elevated: #ffffff;
  --bg-hero: linear-gradient(145deg, #3730a3 0%, #4f46e5 48%, #6366f1 100%);
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  /* Typography */
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.25rem;
  --fs-2xl: 1.5rem;
  --fs-3xl: 1.875rem;
  --fs-4xl: 2.25rem;
  --fs-5xl: clamp(2.25rem, 5vw, 3.5rem);

  /* Radii & shadows */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 16px 40px rgba(79, 70, 229, 0.15);

  /* Layout */
  --max: 1120px;
  --header-h: 64px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

.mp-container {
  width: min(100% - 2rem, var(--max));
  margin-inline: auto;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  gap: 1.5rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink-950);
  letter-spacing: -0.02em;
}

.logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-800));
  display: grid;
  place-items: center;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.35);
  flex-shrink: 0;
}

.logo-mark svg { width: 18px; height: 18px; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.nav-links a {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--ink-700);
  transition: color 0.15s var(--ease);
}

.nav-links a:hover,
.nav-links a.active { color: var(--brand-700); }

.nav-links a.active { font-weight: 600; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: var(--fs-sm);
  border-radius: var(--radius);
  padding: 0.625rem 1.125rem;
  transition: all 0.18s var(--ease);
  white-space: nowrap;
}

.btn-primary {
  background: var(--brand-600);
  color: var(--white);
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.3), 0 4px 12px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover {
  background: var(--brand-700);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.3), 0 8px 20px rgba(79, 70, 229, 0.3);
}

.btn-primary:active { transform: translateY(0); }

.btn-hero {
  padding: 0.875rem 1.75rem;
  font-size: var(--fs-base);
  border-radius: var(--radius-lg);
  background: var(--white);
  color: var(--brand-700);
  box-shadow: var(--shadow-md);
}

.btn-hero:hover {
  background: var(--ink-50);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-ghost {
  color: var(--ink-700);
  border: 1px solid var(--border-strong);
  background: var(--white);
}

.btn-ghost:hover { background: var(--ink-50); border-color: var(--ink-400); }

.btn-text {
  color: var(--brand-600);
  font-weight: 600;
  font-size: var(--fs-sm);
  padding: 0.375rem 0.5rem;
}

.btn-text:hover { color: var(--brand-800); }

.header-cta { flex-shrink: 0; }

.menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: var(--radius);
  color: var(--ink-700);
}

/* ---------- Hero ---------- */
.hero {
  background: var(--bg-hero);
  color: var(--white);
  padding: 3.5rem 0 4rem;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 85% 20%, rgba(255,255,255,0.12), transparent),
    radial-gradient(ellipse 40% 40% at 10% 80%, rgba(251,191,36,0.12), transparent);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  text-align: center;
  max-width: 720px;
  margin-inline: auto;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(15, 23, 42, 0.25);
  border: 1px solid rgba(255,255,255,0.15);
  padding: 0.375rem 0.875rem;
  border-radius: var(--radius-full);
  font-size: var(--fs-sm);
  font-weight: 500;
  margin-bottom: 1.5rem;
  backdrop-filter: blur(4px);
}

.hero-badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.3);
}

.hero h1 {
  font-size: var(--fs-5xl);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 1.25rem;
}

.hero h1 .hl {
  color: var(--accent-400);
}

.hero-sub {
  font-size: var(--fs-lg);
  line-height: 1.6;
  opacity: 0.92;
  margin-bottom: 1.75rem;
  max-width: 560px;
  margin-inline: auto;
}

.hero-sub a {
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 500;
}

.hero-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 2rem;
}

.btn-hero-secondary {
  padding: 0.875rem 1.5rem;
  font-size: var(--fs-base);
  border-radius: var(--radius-lg);
  color: var(--white);
  border: 1.5px solid rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.08);
  font-weight: 600;
}

.btn-hero-secondary:hover {
  background: rgba(255,255,255,0.16);
  border-color: rgba(255,255,255,0.6);
}

.hero-perks {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.25rem 2rem;
  font-size: var(--fs-sm);
  font-weight: 500;
  opacity: 0.95;
}

.hero-perks li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.perk-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.perk-check svg { width: 10px; height: 10px; }

/* ---------- Calculator section ---------- */
.calc-section {
  padding: 2.5rem 0 2rem;
  margin-top: -1.5rem;
  position: relative;
  z-index: 1;
}

.calc-shell {
  background: var(--bg-elevated);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  overflow: hidden;
}

.calc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--ink-50);
}

.calc-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.calc-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--brand-50);
  color: var(--brand-600);
  display: grid;
  place-items: center;
}

.calc-icon svg { width: 22px; height: 22px; }

.calc-header h2 {
  font-size: var(--fs-lg);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink-950);
}

.calc-header p {
  font-size: var(--fs-sm);
  color: var(--ink-500);
  margin-top: 0.125rem;
}

.monthly-total {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
}

.monthly-total label {
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-500);
}

.monthly-total .amount {
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--brand-700);
  font-variant-numeric: tabular-nums;
}

.calc-body {
  display: grid;
  grid-template-columns: minmax(300px, 380px) 1fr;
  min-height: 520px;
}

/* Inputs column */
.inputs-col {
  padding: 1.25rem 1.35rem;
  border-right: 1px solid var(--border);
  background: var(--white);
  overflow-y: auto;
  max-height: 780px;
}

.section-label {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-500);
  margin-bottom: 0.625rem;
}

.input-block {
  margin-bottom: 1.35rem;
}

.input-block.collapsed .collapsible-body { display: none; }

.collapse-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.5rem 0;
  color: var(--ink-700);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.collapse-toggle .chevron {
  transition: transform 0.2s var(--ease);
  color: var(--ink-400);
}

.input-block:not(.collapsed) .collapse-toggle .chevron {
  transform: rotate(180deg);
}

.autocomplete-wrap { position: relative; }

.field-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--ink-900);
  font-size: var(--fs-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field-input:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.field-input::placeholder { color: var(--ink-400); }

.field-hint {
  font-size: var(--fs-xs);
  color: var(--ink-400);
  margin-top: 0.375rem;
}

.dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 50;
  max-height: 220px;
  overflow-y: auto;
  display: none;
}

.dropdown.open { display: block; }

.dropdown-item {
  display: flex;
  flex-direction: column;
  padding: 0.625rem 0.875rem;
  cursor: pointer;
  transition: background 0.1s;
}

.dropdown-item:hover,
.dropdown-item.active { background: var(--brand-50); }

.dropdown-item .name {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink-900);
}

.dropdown-item .issuer {
  font-size: var(--fs-xs);
  color: var(--ink-500);
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: 0.625rem;
  min-height: 1.5rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.5rem 0.25rem 0.625rem;
  background: var(--brand-50);
  color: var(--brand-800);
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: 600;
}

.chip button {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--brand-600);
  opacity: 0.7;
}

.chip button:hover { opacity: 1; background: var(--brand-100); }

.chip.empty-hint {
  background: transparent;
  color: var(--ink-400);
  font-weight: 500;
  padding-left: 0;
}

/* Presets */
.presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.preset-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.75rem 0.5rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  transition: all 0.15s var(--ease);
  text-align: center;
}

.preset-btn:hover {
  border-color: var(--brand-300);
  background: var(--brand-50);
}

.preset-btn.active {
  border-color: var(--brand-600);
  background: var(--brand-50);
  box-shadow: 0 0 0 1px var(--brand-600);
}

.preset-btn .preset-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.preset-btn .preset-name {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--ink-900);
}

.preset-btn .preset-desc {
  font-size: 0.65rem;
  color: var(--ink-500);
  line-height: 1.3;
}

/* Categories */
.category-row {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--ink-100);
}

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

.category-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.category-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink-800, var(--ink-900));
}

.cat-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--ink-100);
  display: grid;
  place-items: center;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.dollar-input-wrap {
  display: flex;
  align-items: center;
  background: var(--ink-50);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.dollar-input-wrap:focus-within {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
  background: var(--white);
}

.dollar-input-wrap .prefix {
  padding-left: 0.5rem;
  color: var(--ink-500);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.dollar-input {
  width: 72px;
  padding: 0.375rem 0.5rem 0.375rem 0.125rem;
  border: none;
  background: transparent;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--brand-700);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.dollar-input:focus { outline: none; }

.slider-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

input[type="range"].cat-slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--ink-200);
  outline: none;
}

input[type="range"].cat-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--brand-600);
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 1px 4px rgba(79, 70, 229, 0.4);
  transition: transform 0.1s, background 0.15s;
}

input[type="range"].cat-slider::-webkit-slider-thumb:hover {
  background: var(--brand-700);
  transform: scale(1.1);
}

input[type="range"].cat-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--brand-600);
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 1px 4px rgba(79, 70, 229, 0.4);
}

.extra-categories { display: none; }
.extra-categories.visible { display: block; }

.show-more-wrap {
  padding-top: 0.75rem;
  text-align: center;
}

.show-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--brand-600);
  font-size: var(--fs-sm);
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
}

.show-more-btn:hover { background: var(--brand-50); }

.show-more-btn .chevron { transition: transform 0.2s; }
.show-more-btn.expanded .chevron { transform: rotate(180deg); }

/* Results column */
.results-col {
  padding: 1.25rem 1.35rem;
  background: var(--ink-50);
  position: relative;
  overflow-y: auto;
  max-height: 780px;
}

.portfolio-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  background: linear-gradient(135deg, var(--brand-700), var(--brand-600));
  color: var(--white);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.25);
}

.stat {
  text-align: center;
}

.stat .stat-value {
  font-size: var(--fs-xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat .stat-label {
  font-size: var(--fs-xs);
  opacity: 0.8;
  margin-top: 0.125rem;
  font-weight: 500;
}

.results-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.875rem;
}

.results-heading h3 {
  font-size: var(--fs-base);
  font-weight: 700;
  color: var(--ink-950);
}

.loading-pill {
  display: none;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--brand-700);
  background: var(--brand-50);
  border: 1px solid var(--brand-200);
  padding: 0.3125rem 0.75rem;
  border-radius: var(--radius-full);
}

.loading-pill.visible { display: inline-flex; }

.spinner {
  width: 12px;
  height: 12px;
  border: 2px solid var(--brand-200);
  border-top-color: var(--brand-600);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* Recommendation cards */
.rec-list {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.rec-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.125rem 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, border-color 0.2s;
  animation: fadeIn 0.35s var(--ease);
}

.rec-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--brand-200);
}

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

.rec-top {
  display: flex;
  gap: 0.875rem;
  align-items: flex-start;
}

.rank-badge {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--brand-600);
  color: var(--white);
  font-weight: 800;
  font-size: var(--fs-sm);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.3);
}

.rank-badge.rank-2 { background: var(--brand-500); }
.rank-badge.rank-3 { background: var(--brand-400); }

.rec-main { flex: 1; min-width: 0; }

.rec-why {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink-900);
  line-height: 1.4;
  margin-bottom: 0.625rem;
}

.rec-name-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.rec-name {
  font-size: var(--fs-base);
  font-weight: 700;
  color: var(--ink-950);
  letter-spacing: -0.01em;
}

.rec-tag {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  background: var(--success-50);
  color: var(--success-700);
}

.rec-value {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.rec-value .net {
  font-size: var(--fs-2xl);
  font-weight: 800;
  color: var(--brand-700);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.rec-value .net-label {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--ink-500);
  margin-left: 0.25rem;
}

.rec-value .monthly {
  font-size: var(--fs-sm);
  color: var(--ink-500);
  font-weight: 500;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-bottom: 0.75rem;
}

.badge {
  font-size: var(--fs-xs);
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
}

.badge-fee { background: var(--warn-50); color: var(--warn-700); }
.badge-fee.free { background: var(--success-50); color: var(--success-700); }
.badge-transfer { background: var(--success-50); color: var(--success-700); }
.badge-cpp { background: var(--info-50); color: var(--info-600); }

.cat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-bottom: 0.625rem;
}

.cat-chip {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--ink-500);
  background: var(--ink-100);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
}

.cat-chip strong {
  color: var(--ink-700);
  font-weight: 700;
}

.breakdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--ink-500);
  padding: 0.375rem 0;
}

.breakdown-toggle:hover { color: var(--brand-600); }

.breakdown-toggle .chevron {
  transition: transform 0.2s;
}

.rec-card.expanded .breakdown-toggle .chevron {
  transform: rotate(180deg);
}

.breakdown {
  display: none;
  margin-top: 0.625rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--ink-100);
  font-size: var(--fs-sm);
  color: var(--ink-700);
  line-height: 1.55;
}

.rec-card.expanded .breakdown { display: block; }

.breakdown-table {
  width: 100%;
  margin-top: 0.5rem;
  font-size: var(--fs-xs);
  border-collapse: collapse;
}

.breakdown-table th,
.breakdown-table td {
  text-align: left;
  padding: 0.375rem 0.5rem;
  border-bottom: 1px solid var(--ink-100);
}

.breakdown-table th {
  color: var(--ink-500);
  font-weight: 600;
}

.breakdown-table td:last-child,
.breakdown-table th:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--brand-700);
}

/* ---------- Tips & Notice ---------- */
.lower-section {
  padding: 2rem 0 1.5rem;
}

.tips-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.tip-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.125rem 1.25rem;
  box-shadow: var(--shadow-sm);
}

.tips-heading {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--ink-950);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tip-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: var(--fs-xs);
  font-weight: 800;
  color: var(--white);
  margin-bottom: 0.625rem;
}

.tip-num.n1 { background: var(--info-600); }
.tip-num.n2 { background: var(--success-600); }
.tip-num.n3 { background: var(--brand-600); }

.tip-card p {
  font-size: var(--fs-sm);
  color: var(--ink-700);
  line-height: 1.5;
}

.notice {
  background: var(--ink-50);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  font-size: var(--fs-xs);
  color: var(--ink-500);
  line-height: 1.55;
}

.notice strong {
  color: var(--ink-700);
  font-weight: 600;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--white);
  padding: 1.5rem 0;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.footer-links a {
  font-size: var(--fs-sm);
  color: var(--ink-500);
  font-weight: 500;
}

.footer-links a:hover { color: var(--brand-600); }

.footer-categories {
  margin-top: 0.875rem;
  padding-top: 0.875rem;
  border-top: 1px solid var(--border);
  align-items: center;
}

.footer-label {
  font-size: var(--fs-sm);
  color: var(--ink-400);
  font-weight: 500;
}

.copyright {
  font-size: var(--fs-xs);
  color: var(--ink-400);
}

.category-guides-lead {
  font-size: var(--fs-sm);
  color: var(--ink-700);
  line-height: 1.6;
  margin: 0 0 1rem;
  max-width: 42rem;
}

.category-guides-lead a {
  color: var(--brand-700);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.category-guides {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.category-guides a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.875rem 1rem;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink-950);
  box-shadow: var(--shadow-sm);
}

.category-guides a:hover {
  border-color: var(--brand-300);
  color: var(--brand-700);
}

.category-row.is-focused {
  outline: 2px solid var(--brand-500);
  outline-offset: 4px;
  border-radius: var(--radius);
  background: var(--brand-50);
}

/* ---------- Articles page ---------- */
.page-hero {
  background: var(--bg-hero);
  color: var(--white);
  padding: 2.5rem 0 2rem;
}

.page-hero h1 {
  font-size: var(--fs-3xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.page-hero p {
  opacity: 0.9;
  max-width: 480px;
}

.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
  padding: 2rem 0 3rem;
}

.article-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, transform 0.2s;
}

.article-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.article-thumb {
  height: 140px;
  background: linear-gradient(135deg, var(--brand-100), var(--brand-200));
  display: grid;
  place-items: center;
  font-size: 2.5rem;
}

.article-body { padding: 1.125rem 1.25rem 1.25rem; }

.article-card .article-meta {
  font-size: var(--fs-xs);
  color: var(--ink-400);
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.article-body h2 {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--ink-950);
  letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.article-body p {
  font-size: var(--fs-sm);
  color: var(--ink-500);
  line-height: 1.5;
  margin-bottom: 0.875rem;
}

.article-body .read-more {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--brand-600);
}

.article-body .read-more:hover { color: var(--brand-800); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .calc-body {
    grid-template-columns: 1fr;
  }

  .inputs-col {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: none;
  }

  .results-col { max-height: none; }

  .portfolio-bar {
    grid-template-columns: repeat(2, 1fr);
  }

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

@media (max-width: 640px) {
  .nav-links { display: none; }

  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 1rem;
    gap: 0.75rem;
    box-shadow: var(--shadow);
  }

  .menu-toggle { display: grid; }

  .hero { padding: 2.5rem 0 3rem; }

  .hero-cta-row { flex-direction: column; align-items: stretch; }

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

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }

  .footer-links { justify-content: center; }

  .rec-value .net { font-size: var(--fs-xl); }
}

/* Demo accents */
.demo-note {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  background: var(--ink-900);
  color: var(--white);
  font-size: var(--fs-xs);
  padding: 0.5rem 0.875rem;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-md);
  z-index: 200;
  opacity: 0.85;
  pointer-events: none;
}

/* ============================================================
   Articles listing & detail (extended)
   ============================================================ */

.articles-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin: 1.5rem 0 1.25rem;
}

.articles-search-wrap {
  flex: 1 1 220px;
  position: relative;
  min-width: 180px;
}

.articles-search-wrap svg {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-400);
  pointer-events: none;
}

.articles-search-wrap input {
  width: 100%;
  padding: 0.625rem 0.875rem 0.625rem 2.25rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--white);
  font-size: var(--fs-sm);
}

.articles-search-wrap input:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.articles-sort {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--fs-sm);
  color: var(--ink-500);
}

.articles-sort select {
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink-900);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  background: var(--white);
  cursor: pointer;
}

.article-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.filter-chip {
  padding: 0.375rem 0.875rem;
  border-radius: var(--radius-full);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink-700);
  background: var(--white);
  border: 1.5px solid var(--border);
  transition: all 0.15s var(--ease);
}

.filter-chip:hover {
  border-color: var(--brand-300);
  background: var(--brand-50);
}

.filter-chip.active {
  background: var(--brand-600);
  border-color: var(--brand-600);
  color: var(--white);
}

.articles-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  font-size: var(--fs-sm);
  color: var(--ink-500);
}

#articles-grid.articles-grid {
  padding-top: 0;
}

.article-card h2 {
  font-size: 1.2rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.625rem;
}

.article-card .article-body p {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 3.9em;
}

.article-card.featured {
  border-color: var(--brand-300);
  box-shadow: 0 0 0 1px var(--brand-200), var(--shadow-sm);
}

.article-card.featured .article-thumb {
  background: linear-gradient(135deg, var(--brand-400), var(--brand-700));
}

.featured-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--accent-400);
  color: var(--ink-950);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
}

.cat-label {
  color: var(--brand-600);
  font-weight: 600;
}

.article-card .article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  font-size: var(--fs-xs);
  color: var(--ink-400);
  font-weight: 500;
  margin-bottom: 0.625rem;
}

.empty-articles {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--ink-500);
}

/* Article detail */
.reading-progress-track {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  z-index: 99;
}

.reading-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--brand-500), var(--accent-400));
  transition: width 0.1s linear;
}

.article-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 2.5rem;
  padding: 2rem 0 3rem;
  align-items: start;
}

.toc-sidebar {
  position: sticky;
  top: calc(var(--header-h) + 1.25rem);
}

.toc-label {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-500);
  margin-bottom: 0.75rem;
}

.toc a {
  display: block;
  font-size: var(--fs-sm);
  color: var(--ink-500);
  padding: 0.375rem 0.625rem;
  border-left: 2px solid var(--ink-200);
  margin-bottom: 0.125rem;
  transition: color 0.15s, border-color 0.15s;
  line-height: 1.4;
}

.toc a:hover { color: var(--brand-700); }

.toc a.active {
  color: var(--brand-700);
  border-left-color: var(--brand-600);
  font-weight: 600;
  background: var(--brand-50);
}

#toc-toggle {
  display: none;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--ink-900);
  margin-bottom: 0.5rem;
}

.article-header-block {
  margin-bottom: 2rem;
}

.article-header-block .detail-emoji {
  font-size: 2.75rem;
  margin-bottom: 0.75rem;
}

.article-header-block h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--ink-950);
  margin-bottom: 0.75rem;
}

.article-header-block .detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--fs-sm);
  color: var(--ink-500);
}

#article-content {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 2.25rem;
  box-shadow: var(--shadow-sm);
}

#article-content .lede {
  font-size: var(--fs-lg);
  color: var(--ink-700);
  line-height: 1.6;
  margin-bottom: 1.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--ink-100);
}

#article-content h2 {
  font-size: var(--fs-xl);
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--ink-950);
  margin: 2rem 0 0.75rem;
  scroll-margin-top: calc(var(--header-h) + 1.5rem);
}

#article-content p {
  margin-bottom: 1rem;
  color: var(--ink-700);
  line-height: 1.7;
}

#article-content ul {
  margin: 0 0 1.25rem 1.25rem;
  list-style: disc;
  color: var(--ink-700);
}

#article-content li {
  margin-bottom: 0.4rem;
  line-height: 1.6;
}

#article-content strong { color: var(--ink-900); }

.related-section {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.related-section h3 {
  font-size: var(--fs-lg);
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--ink-950);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.875rem;
}

.related-card {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 1rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.related-card:hover {
  border-color: var(--brand-300);
  box-shadow: var(--shadow-sm);
}

.related-emoji { font-size: 1.5rem; flex-shrink: 0; }

.related-cat {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--brand-600);
  margin-bottom: 0.25rem;
}

.related-card strong {
  font-size: var(--fs-sm);
  font-weight: 650;
  color: var(--ink-900);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--brand-600);
  margin-bottom: 1.25rem;
}

.back-link:hover { color: var(--brand-800); }

@media (max-width: 900px) {
  .articles-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .article-layout {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .toc-sidebar {
    position: static;
  }

  #toc-toggle { display: flex; }

  .toc-nav {
    display: none;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem;
    margin-bottom: 1rem;
  }

  .toc-nav.open { display: block; }

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

  #article-content {
    padding: 1.5rem 1.25rem;
  }
}

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

  .articles-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .articles-search-wrap {
    flex: 1 1 auto;
    width: 100%;
  }
}

/* Production adaptations */
html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--ink-900);
  -webkit-font-smoothing: antialiased;
}

#calculator { scroll-margin-top: calc(var(--header-h) + 12px); }

.show-more-btn,
.collapse-toggle,
.menu-toggle,
.breakdown-toggle,
.chip button,
#toc-toggle {
  font: inherit;
  cursor: pointer;
  background: none;
  border: none;
  color: inherit;
}

.preset-btn,
.filter-chip,
.articles-sort select { font: inherit; cursor: pointer; }

.preset-btn { min-height: 72px; }
.dollar-input-wrap { min-height: 44px; }
.show-more-btn, .collapse-toggle, .filter-chip { min-height: 44px; }

input[type="range"].cat-slider::-webkit-slider-thumb {
  width: 28px;
  height: 28px;
}
input[type="range"].cat-slider::-moz-range-thumb {
  width: 28px;
  height: 28px;
}

.inputs-col,
.results-col {
  overflow: visible;
  max-height: none;
}

.calc-shell { overflow: visible; }
.site-header { position: sticky; }
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.site-header .nav-links a {
  color: var(--ink-700) !important;
  text-decoration: none !important;
}
.site-header .nav-links a:hover,
.site-header .nav-links a.active {
  color: var(--brand-700) !important;
}
.site-header .btn-primary,
.site-header .logo {
  text-decoration: none !important;
}
.site-header .btn-primary { color: #fff !important; }

.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(220px, 0.85fr);
  gap: 2rem;
  align-items: center;
}
.hero-copy { position: relative; text-align: left; }
.hero-copy .hero-sub { margin-inline: 0; }
.hero-copy .hero-cta-row,
.hero-copy .hero-perks { justify-content: flex-start; }
.hero-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-height: 180px;
}
.hero-visual img {
  width: 132px;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.28);
  background: rgba(255,255,255,0.08);
}
.hero-visual img:nth-child(1) { transform: rotate(-8deg) translateY(10px); }
.hero-visual img:nth-child(2) { transform: translateY(-14px); width: 148px; }
.hero-visual img:nth-child(3) { transform: rotate(8deg) translateY(12px); }

.rec-face {
  width: 76px;
  height: 48px;
  object-fit: contain;
  border-radius: 6px;
  background: var(--ink-100);
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.rec-face-fallback {
  width: 76px;
  height: 48px;
  border-radius: 6px;
  background: var(--ink-100);
  flex-shrink: 0;
}
.rec-issuer {
  font-size: var(--fs-xs);
  color: var(--ink-500);
  margin-top: -0.25rem;
  margin-bottom: 0.5rem;
}
.incremental-note {
  font-size: var(--fs-xs);
  color: var(--ink-500);
  font-weight: 600;
}

.split-note {
  background: var(--brand-50);
  border: 1px solid var(--brand-100);
  color: var(--brand-800);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: var(--fs-sm);
  margin-bottom: 0.875rem;
}
.split-note strong { font-weight: 700; }

.exclude-block { margin-bottom: 1.1rem; }
.exclude-block > summary { list-style: none; }
.exclude-block > summary::-webkit-details-marker { display: none; }
.exclude-block[open] .chevron { transform: rotate(180deg); }
.collapsible-body { padding-bottom: 0.25rem; }

.rec-details { margin-top: 0.25rem; }
.rec-details > summary { list-style: none; }
.rec-details > summary::-webkit-details-marker { display: none; }
.rec-details .chevron { transition: transform 0.2s var(--ease); }
.rec-details[open] .chevron { transform: rotate(180deg); }
.breakdown-panel {
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--ink-100);
  overflow-x: auto;
}
.rec-notes {
  font-size: var(--fs-sm);
  color: var(--ink-700);
  margin-bottom: 0.75rem;
}

.empty-recs {
  background: var(--white);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 2rem 1rem;
  text-align: center;
  color: var(--ink-500);
}

.article-thumb img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}
.article-card h2 { font-size: 1.2rem; }

.article-detail-page { padding-top: 1.25rem; padding-bottom: 2rem; }
.article-detail-page .article-container {
  max-width: none;
  margin: 0;
  padding: 0;
}
.article-content h2,
.article-content h3 {
  scroll-margin-top: calc(var(--header-h) + 16px);
}
.toc a.h3 {
  padding-left: 1.1rem;
  font-size: var(--fs-xs);
}
.article-detail-page .article-category {
  background: var(--brand-50);
  color: var(--brand-700);
}
.article-detail-page .article-excerpt {
  border-left-color: var(--brand-600);
}

.related-section { margin-top: 2rem; }
.related-card img {
  width: 72px;
  height: 52px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.calc-cta {
  background: var(--brand-600);
}
.calc-cta h2, .calc-cta p { color: #fff; }
.calc-cta p { opacity: 0.92; }

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-copy { text-align: center; }
  .hero-copy .hero-sub { margin-inline: auto; }
  .hero-copy .hero-cta-row,
  .hero-copy .hero-perks { justify-content: center; }
  .hero-visual { margin-top: 0.5rem; }
  .hero-visual img { width: 96px; }
  .hero-visual img:nth-child(2) { width: 108px; }
  .articles-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .presets { grid-template-columns: repeat(3, 1fr); }
  .preset-desc { display: none; }
  .hero-cta-row .btn { width: 100%; }
  .articles-grid { grid-template-columns: 1fr; }
  .monthly-total { width: 100%; justify-content: space-between; }
  .rec-top { flex-wrap: wrap; }
}

/* ---------- Money left on the table ---------- */
.money-left {
  position: relative;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.9rem 1rem 1rem;
  margin-bottom: 0.875rem;
  box-shadow: var(--shadow-sm);
}

.money-left-eyebrow {
  margin: 0 0 0.35rem;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--brand-700);
}

.money-left-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink-950);
  letter-spacing: -0.02em;
  line-height: 1.35;
  margin: 0 0 0.35rem;
}

[data-net-figure][aria-busy="true"] {
  opacity: 0.55;
}

.money-left-amount {
  color: var(--brand-600);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.money-left-title .money-left-amount {
  font-size: 1.45rem;
}

.money-left-support {
  margin: 0 0 0.75rem;
  color: var(--ink-700);
  font-size: var(--fs-sm);
  line-height: 1.45;
}

.money-left-actions,
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.money-left-btn {
  min-height: 44px;
  min-width: 44px;
}

.money-left-btn .spinner { display: none; }
.money-left-btn[aria-busy="true"] .spinner { display: inline-block; }

.money-left-error {
  margin: 0.5rem 0 0;
  color: var(--warn-600);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.money-left-live {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.result-page {
  padding: 1.5rem 0 3rem;
}

.result-wrap { max-width: 760px; }

.result-hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--ink-950);
  margin: 0 0 0.75rem;
}

.result-hero h1 .money-left-amount {
  font-size: 1.12em;
}

.result-deck,
.result-baseline {
  font-size: 1.05rem;
  color: var(--ink-700);
  line-height: 1.5;
  margin: 0 0 0.75rem;
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.85rem;
  align-items: center;
  color: var(--ink-500);
  font-size: var(--fs-sm);
  margin: 0 0 0.85rem;
}

.result-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-full);
  background: var(--brand-50);
  color: var(--brand-700);
  font-weight: 700;
  font-size: var(--fs-xs);
}

.result-disclaimer {
  margin: 0 0 0.65rem;
  color: var(--ink-500);
  font-size: var(--fs-sm);
  line-height: 1.5;
  max-width: none;
}

.result-stack,
.result-spend { margin-top: 1.5rem; }

.result-stack h2,
.result-spend h2 {
  font-size: var(--fs-lg);
  font-weight: 700;
  margin: 0 0 0.75rem;
  color: var(--ink-950);
}

.result-cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.result-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.05rem;
  box-shadow: var(--shadow-sm);
}

.result-card-top {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.result-face {
  width: 64px;
  height: auto;
  border-radius: 6px;
  flex-shrink: 0;
}

.result-card-main { min-width: 0; }

.result-why {
  margin: 0 0 0.35rem;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink-900);
  line-height: 1.4;
}

.result-card-name {
  margin: 0;
  font-size: var(--fs-base);
  font-weight: 700;
  color: var(--ink-950);
}

.result-issuer,
.result-fee {
  margin: 0.15rem 0 0;
  color: var(--ink-500);
  font-size: var(--fs-sm);
}

.result-net {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  align-items: baseline;
  margin: 0.4rem 0 0;
  color: var(--ink-700);
  font-size: var(--fs-sm);
}

.result-net .money-left-amount { font-size: 1.35rem; }

.result-cats {
  margin-top: 0.65rem;
}

.result-cats summary {
  cursor: pointer;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--brand-700);
  min-height: 44px;
  display: flex;
  align-items: center;
}

.result-cats ul {
  margin: 0.25rem 0 0;
  padding-left: 1.1rem;
  color: var(--ink-700);
  font-size: var(--fs-sm);
}

.spend-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.spend-chips li {
  background: var(--ink-50);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 0.35rem 0.7rem;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink-800, var(--ink-900));
  font-variant-numeric: tabular-nums;
}

.result-actions {
  position: relative;
  margin-top: 1.5rem;
}

.result-recalc { min-height: 44px; }

.result-sticky { display: none; }

@media (max-width: 899px) {
  .money-left-actions { flex-direction: column; align-items: stretch; }
  .money-left-actions .money-left-btn { width: 100%; }
  .result-page { padding-bottom: 5.5rem; }
  .result-sticky {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    justify-content: center;
    padding: 0.65rem max(1rem, env(safe-area-inset-right, 0px)) calc(0.65rem + env(safe-area-inset-bottom, 0px)) max(1rem, env(safe-area-inset-left, 0px));
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--border);
  }
  .result-sticky a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: min(100%, 420px);
    min-height: 44px;
    padding: 0.7rem 1.1rem;
    border-radius: var(--radius-full);
    background: var(--brand-600);
    color: #fff;
    font-weight: 700;
    font-size: var(--fs-sm);
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.35);
  }
}

/* ---------- Year horizon and credits you’ll use ---------- */
.time-horizon {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1rem 0.95rem;
  margin-bottom: 0.875rem;
  box-shadow: var(--shadow-sm);
}

.horizon-options {
  display: flex;
  width: 100%;
  gap: 0.35rem;
  padding: 0.2rem;
  border-radius: var(--radius-md, 12px);
  background: var(--ink-50);
  border: 1px solid var(--border);
}

.horizon-seg {
  position: relative;
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.4rem 0.6rem;
  border-radius: 10px;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--ink-700);
  text-align: center;
  cursor: pointer;
}

.horizon-seg input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.horizon-seg:has(input:checked) {
  background: var(--brand-600);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.horizon-seg:focus-within {
  outline: 2px solid var(--brand-400);
  outline-offset: 2px;
}

.horizon-help,
.honesty-summary,
.credits-off-helper,
.result-year-secondary,
.year-secondary {
  margin: 0.45rem 0 0;
  color: var(--ink-500);
  font-size: var(--fs-sm);
  line-height: 1.4;
}

.honesty-summary {
  color: var(--ink-800, var(--ink-900));
}

.sub-toggle {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  margin-top: 0.55rem;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink-900);
  cursor: pointer;
}

.sub-toggle input {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--brand-600);
}

.credits-block {
  margin-top: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--ink-50);
}

.credits-block summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--ink-900);
  cursor: pointer;
}

.credits-body {
  padding: 0 0.75rem 0.75rem;
}

.credits-heading {
  margin: 0;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--ink-950);
}

.credits-total {
  margin: 0.2rem 0 0;
  font-size: var(--fs-sm);
  color: var(--ink-800, var(--ink-900));
}

.credits-total strong,
.year-secondary strong,
.result-year-secondary strong,
.honesty-summary strong {
  font-variant-numeric: tabular-nums;
}

.credit-row,
.credit-readonly li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 44px;
  padding: 0.35rem 0;
  border-top: 1px solid var(--border);
}

.credit-readonly {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
}

.credit-copy,
.credit-readonly li {
  min-width: 0;
}

.credit-name {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink-950);
}

.credit-amount,
.credit-detail,
.credit-state {
  display: block;
  font-size: var(--fs-xs);
  color: var(--ink-500);
}

.credit-readonly .credit-state {
  font-weight: 700;
  color: var(--ink-700);
}

.credit-switch {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  min-width: 44px;
  flex-shrink: 0;
  cursor: pointer;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--ink-700);
}

.credit-switch input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.switch-track {
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: var(--ink-300);
  position: relative;
  flex-shrink: 0;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s ease;
}

.credit-switch input:checked ~ .switch-track {
  background: var(--brand-600);
}

.credit-switch input:checked ~ .switch-track::after {
  transform: translateX(18px);
}

.credit-switch input:focus-visible ~ .switch-track {
  outline: 2px solid var(--brand-400);
  outline-offset: 2px;
}

.credit-switch .switch-on { display: none; }
.credit-switch .switch-off { display: inline; }
.credit-switch input:checked ~ .switch-on { display: inline; }
.credit-switch input:checked ~ .switch-off { display: none; }

.year-secondary {
  display: block;
}
