/* ============================================================
   CSS Custom Properties
============================================================ */
:root {
  --buying:   #2563eb;
  --renting:  #7c3aed;
  --ev:       #059669;
  --gas:      #d97706;
  --solar:    #ca8a04;
  --grid:     #4b5563;

  --success:  #16a34a;
  --warn:     #d97706;
  --danger:   #dc2626;
  --neutral:  #2563eb;

  --bg:       #f1f5f9;
  --surface:  #ffffff;
  --border:   #e2e8f0;
  --text:     #1e293b;
  --muted:    #64748b;

  --radius:   12px;
  --radius-sm: 8px;
  --shadow:   0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:0 4px 12px rgba(0,0,0,.08);
  --shadow-lg:0 10px 25px rgba(0,0,0,.10);

  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ============================================================
   Reset & Base
============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

h1, h2, h3 { line-height: 1.25; font-weight: 700; }

/* ============================================================
   Layout
============================================================ */
.app-wrapper { max-width: 1280px; margin: 0 auto; padding: 0 1rem 3rem; }

/* Header */
.site-header {
  background:
    linear-gradient(135deg, #0b1628 0%, #112240 55%, #0f1e38 100%);
  margin: 0 -1rem 0;
  padding: 1.75rem 2rem 1.6rem;
  color: #fff;
  border-bottom: 1px solid rgba(45,212,191,.18);
}
.header-inner { max-width: 1280px; margin: 0 auto; }

/* Brand row */
.brand {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}

/* Icon wrapper — subtle glow ring */
.brand-icon {
  flex-shrink: 0;
  border-radius: 16px;
  box-shadow:
    0 0 0 1px rgba(45,212,191,.25),
    0 4px 20px rgba(45,212,191,.15);
  line-height: 0;
}

/* Word-mark */
.brand-words { display: flex; flex-direction: column; gap: .25rem; }

.brand-name {
  font-size: 2.1rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1;
}
.brand-lif    { color: #2dd4bf; }
.brand-ledger { color: #ffffff; }

/* Tagline */
.brand-tagline {
  font-size: .92rem;
  font-weight: 500;
  color: rgba(255,255,255,.55);
  letter-spacing: .02em;
  font-style: italic;
  margin: 0;
}

@media (max-width: 480px) {
  .brand-name   { font-size: 1.55rem; }
  .brand-icon svg { width: 44px; height: 44px; }
  .brand-tagline { font-size: .8rem; }
}

/* Tab navigation */
.tab-nav {
  display: flex;
  gap: .5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: .5rem .75rem 0;
  margin-top: 1.5rem;
  overflow-x: auto;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .65rem 1.1rem;
  border: none;
  border-bottom: 3px solid transparent;
  background: transparent;
  cursor: pointer;
  font-size: .9rem;
  font-weight: 600;
  color: var(--muted);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  white-space: nowrap;
  transition: color .15s, border-color .15s, background .15s;
}
.tab-btn:hover { background: var(--bg); color: var(--text); }
.tab-btn.active { color: var(--buying); border-bottom-color: var(--buying); background: var(--bg); }

.tab-icon { font-size: 1.1rem; }

/* ============================================================
   Tab panels
============================================================ */
.tab-panel {
  display: none;
  background: var(--bg);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 2rem 1.5rem;
}
.tab-panel.active { display: block; }

.panel-header { margin-bottom: 1.75rem; }
.panel-header h2 { font-size: 1.4rem; color: var(--text); }
.panel-header p { margin-top: .35rem; color: var(--muted); font-size: .9rem; }

/* ============================================================
   Input columns
============================================================ */
.inputs-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .inputs-container { grid-template-columns: 1fr; }
}

.input-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

/* Column title stripes */
.col-title {
  font-size: 1rem;
  font-weight: 700;
  padding: .5rem .75rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  color: #fff;
  letter-spacing: .01em;
}

/* Tab 1 – Home */
.col-a .col-title:not(.shared-title) { background: var(--buying); }
.col-b .col-title:not(.shared-title) { background: var(--renting); }

/* Tab 2 – Vehicle */
.ev-title   { background: var(--ev) !important; }
.gas-title  { background: var(--gas) !important; }

/* Tab 3 – Solar */
.solar-title { background: var(--solar) !important; }
.grid-title  { background: var(--grid) !important; }

.shared-title {
  background: #334155 !important;
  margin-top: 1.5rem;
}

/* ============================================================
   Form fields
============================================================ */
.field {
  margin-bottom: 1rem;
}
.field label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: .35rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.input-wrap {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.input-wrap:focus-within {
  border-color: var(--buying);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.input-wrap span {
  background: var(--bg);
  padding: .5rem .6rem;
  font-size: .88rem;
  color: var(--muted);
  white-space: nowrap;
  border-right: 1px solid var(--border);
  font-weight: 600;
}
.input-wrap.suffix span {
  border-right: none;
  border-left: 1px solid var(--border);
}

.input-wrap input[type="number"] {
  flex: 1;
  border: none;
  outline: none;
  padding: .5rem .65rem;
  font-size: .93rem;
  color: var(--text);
  background: transparent;
  min-width: 0;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { opacity: 1; }

select {
  width: 100%;
  padding: .52rem .65rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: .93rem;
  color: var(--text);
  outline: none;
  cursor: pointer;
  transition: border-color .15s;
}
select:focus { border-color: var(--buying); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }

.hint {
  display: block;
  font-size: .78rem;
  color: var(--muted);
  margin-top: .25rem;
}

.checkbox-field label {
  display: flex;
  align-items: center;
  gap: .5rem;
  text-transform: none;
  letter-spacing: 0;
  font-size: .88rem;
  color: var(--text);
  cursor: pointer;
}
.checkbox-field input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--buying);
}

/* ============================================================
   Calculate button
============================================================ */
.calc-bar {
  display: flex;
  justify-content: center;
  margin: 1.75rem 0 0;
}

.calc-btn {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: .8rem 3rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: .03em;
  box-shadow: var(--shadow-md);
  transition: transform .15s, box-shadow .15s, filter .15s;
}
.calc-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); filter: brightness(1.07); }
.calc-btn:active { transform: translateY(0); filter: brightness(.95); }

/* ============================================================
   Results section
============================================================ */
.results { margin-top: 2.5rem; }
.results.hidden { display: none; }

/* Verdict banner */
.verdict {
  border-radius: var(--radius);
  padding: 1.1rem 1.5rem;
  margin-bottom: 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: flex-start;
  gap: .75rem;
}
.verdict.green  { background: #dcfce7; border: 1px solid #86efac; color: #14532d; }
.verdict.blue   { background: #dbeafe; border: 1px solid #93c5fd; color: #1e3a8a; }
.verdict.yellow { background: #fef9c3; border: 1px solid #fde047; color: #713f12; }
.verdict .v-icon { font-size: 1.4rem; flex-shrink: 0; line-height: 1; }
.verdict .v-body { display: flex; flex-direction: column; gap: .2rem; }
.verdict .v-title { font-size: 1.05rem; }
.verdict .v-sub { font-weight: 400; font-size: .88rem; opacity: .85; }

/* Metrics grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow);
}
.metric-card .m-label {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: .4rem;
}
.metric-card .m-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
}
.metric-card .m-sub {
  font-size: .78rem;
  color: var(--muted);
  margin-top: .3rem;
}
.metric-card.highlight { border-color: var(--buying); }
.metric-card.highlight .m-value { color: var(--buying); }
.metric-card.success { border-color: var(--success); }
.metric-card.success .m-value { color: var(--success); }
.metric-card.warn { border-color: var(--warn); }
.metric-card.warn .m-value { color: var(--warn); }

/* Chart */
.chart-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  position: relative;
  height: 380px;
}
.chart-wrap canvas { max-height: 100%; }

/* Breakdown table */
.breakdown {
  margin-top: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.breakdown table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}
.breakdown thead tr { background: #334155; color: #fff; }
.breakdown th, .breakdown td {
  text-align: right;
  padding: .6rem .9rem;
  border-bottom: 1px solid var(--border);
}
.breakdown th:first-child, .breakdown td:first-child { text-align: left; }
.breakdown tbody tr:nth-child(even) { background: var(--bg); }
.breakdown tbody tr:hover { background: #dbeafe; }
.breakdown td.pos { color: var(--success); font-weight: 600; }
.breakdown td.neg { color: var(--danger); font-weight: 600; }

/* ============================================================
   Input range sliders (tabs 1-3 key parameters)
============================================================ */
.input-slider {
  width: 100%;
  margin-top: .45rem;
  -webkit-appearance: none;
  appearance: none;
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--buying) var(--pct, 30%), var(--border) var(--pct, 30%));
  cursor: pointer;
  outline: none;
  display: block;
}
.input-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--buying);
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(37,99,235,.35);
  transition: box-shadow .15s, transform .15s;
}
.input-slider:hover::-webkit-slider-thumb {
  box-shadow: 0 0 0 5px rgba(37,99,235,.18);
  transform: scale(1.12);
}
.input-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--buying);
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(37,99,235,.35);
}

/* Breakdown collapsible */
.breakdown-section { margin-top: 1.5rem; }

.breakdown-toggle-btn {
  display: flex;
  align-items: center;
  gap: .4rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .45rem 1rem;
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: .75rem;
  transition: background .15s, color .15s, border-color .15s;
}
.breakdown-toggle-btn:hover {
  background: var(--bg);
  color: var(--text);
  border-color: #94a3b8;
}

/* Hidden utility */
.hidden { display: none !important; }

/* ============================================================
   Footer
============================================================ */
footer {
  text-align: center;
  color: var(--muted);
  font-size: .8rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

/* ============================================================
   Tab 4 – Lifestyle Affordability Meter
============================================================ */

/* Section title shared */
.ls-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  padding-bottom: .55rem;
  margin-bottom: 1.1rem;
  border-bottom: 2px solid var(--border);
}

/* Financial profile card */
.lifestyle-profile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.ls-inputs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1rem;
}

/* Health Dashboard */
.ls-dashboard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.ls-health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* Bottom row: chart + stress panel */
.ls-bottom-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 768px) {
  .ls-bottom-row { grid-template-columns: 1fr; }
}

.ls-chart-wrap {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  height: 260px;
  position: relative;
}

.ls-chart-wrap canvas { max-height: 100%; }

/* Stress panel */
.ls-stress-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  min-height: 260px;
  height: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: .6rem;
}

.ls-stress-label {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

.ls-stress-score-big {
  font-size: 2.8rem;
  font-weight: 900;
  line-height: 1;
  transition: color .3s;
}

.ls-stress-bar-wrap {
  background: #e2e8f0;
  border-radius: 999px;
  height: 10px;
  overflow: visible;
  position: relative;
  margin-top: .2rem;
}

.ls-stress-bar {
  height: 100%;
  border-radius: 999px;
  transition: width .4s ease, background .4s ease;
  min-width: 4px;
}

.ls-stress-ticks {
  display: flex;
  justify-content: space-between;
  margin-top: .35rem;
  font-size: .68rem;
  color: var(--muted);
  font-weight: 600;
  padding-bottom: .1rem;
}

.ls-stress-verdict {
  font-size: .88rem;
  font-weight: 700;
  transition: color .3s;
  margin-top: .55rem;
  padding-top: .45rem;
  border-top: 1px solid var(--border);
}

.ls-stress-tips {
  font-size: .78rem;
  color: var(--muted);
  font-style: italic;
}

/* Scenarios section */
.ls-scenarios {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.ls-scenarios-sub {
  font-size: .85rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
  margin-top: -.5rem;
}

.ls-scenario-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1.25rem;
}

/* Scenario cards */
.ls-scenario-card {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: border-color .3s, box-shadow .3s;
}

.ls-scenario-card.sc-green  { border-color: #86efac; box-shadow: 0 0 0 3px rgba(22,163,74,.08); }
.ls-scenario-card.sc-yellow { border-color: #fde047; box-shadow: 0 0 0 3px rgba(202,138,4,.08); }
.ls-scenario-card.sc-red    { border-color: #fca5a5; box-shadow: 0 0 0 3px rgba(220,38,38,.08); }

.ls-sc-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: .85rem;
}

.ls-sc-icon { font-size: 1.7rem; line-height: 1; flex-shrink: 0; }

.ls-sc-info { flex: 1; min-width: 0; }

.ls-sc-title    { font-weight: 700; font-size: .93rem; }
.ls-sc-subtitle { font-size: .73rem; color: var(--muted); margin-top: .1rem; }

/* Affordability badge */
.ls-afford-badge {
  padding: .28rem .65rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-green  { background: #dcfce7; color: #15803d; }
.badge-yellow { background: #fef9c3; color: #a16207; }
.badge-red    { background: #fee2e2; color: #dc2626; }

/* Amount display */
.ls-sc-amount {
  text-align: center;
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -.02em;
  margin-bottom: .6rem;
}

/* Slider row */
.ls-slider-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .85rem;
}

.ls-slider-min,
.ls-slider-max {
  font-size: .7rem;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.ls-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 5px;
  border-radius: 999px;
  background: var(--border);
  cursor: pointer;
  accent-color: var(--buying);
  outline: none;
}

.ls-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--buying);
  cursor: pointer;
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
  transition: box-shadow .15s;
}

.ls-slider:hover::-webkit-slider-thumb {
  box-shadow: 0 0 0 5px rgba(37,99,235,.2);
}

/* Scenario metrics */
.ls-sc-metrics {
  border-top: 1px solid var(--border);
  padding-top: .75rem;
  display: flex;
  flex-direction: column;
  gap: .45rem;
}

.ls-sc-metric {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: .82rem;
}

.ls-sc-mkey { color: var(--muted); font-weight: 600; }
.ls-sc-mval { font-weight: 800; color: var(--text); }

.ls-sc-explanation {
  font-size: .77rem;
  color: var(--muted);
  font-style: italic;
  border-top: 1px dashed var(--border);
  padding-top: .4rem;
  margin-top: .1rem;
  line-height: 1.4;
}

/* ============================================================
   Tab 5 – Life Planning Simulator
============================================================ */

/* Profile grid */
.life-profile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.life-profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

/* Event Palette */
.life-palette-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.life-palette {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}

.life-event-chip {
  display: flex;
  align-items: center;
  gap: .6rem;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: .6rem .9rem;
  cursor: grab;
  user-select: none;
  transition: border-color .15s, box-shadow .15s, transform .15s;
  min-width: 160px;
}
.life-event-chip:hover {
  border-color: var(--buying);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.life-event-chip.dragging {
  opacity: .45;
  cursor: grabbing;
  transform: scale(.96);
}

.life-chip-icon { font-size: 1.55rem; line-height: 1; flex-shrink: 0; }

.life-chip-body { display: flex; flex-direction: column; gap: .18rem; }

.life-chip-label {
  font-size: .8rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.life-chip-cost-wrap {
  display: flex;
  align-items: center;
  gap: .3rem;
}

.life-chip-cost {
  width: 88px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .18rem .35rem;
  font-size: .78rem;
  font-weight: 700;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color .15s;
}
.life-chip-cost:focus { border-color: var(--buying); }

.life-chip-unit {
  font-size: .68rem;
  color: var(--muted);
  white-space: nowrap;
}

/* Timeline wrapper */
.life-timeline-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.life-timeline-scroll {
  overflow-x: auto;
  overflow-y: visible;
  padding-bottom: .25rem;
  /* Custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
.life-timeline-scroll::-webkit-scrollbar { height: 5px; }
.life-timeline-scroll::-webkit-scrollbar-track { background: transparent; }
.life-timeline-scroll::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; }

/* The timeline row – has a gradient rail via ::after */
.life-timeline {
  display: flex;
  align-items: flex-end;
  position: relative;
  min-height: 170px;
  padding-bottom: 38px; /* room for age labels */
}

.life-timeline::after {
  content: '';
  position: absolute;
  bottom: 38px;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #2563eb 0%, #7c3aed 100%);
  border-radius: 999px;
  z-index: 0;
  pointer-events: none;
}

/* Individual age slot */
.life-age-slot {
  flex: 0 0 58px;
  width: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 1;
  transition: background .15s;
}

/* Events stacked above rail */
.life-slot-events {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-height: 90px;
  justify-content: flex-end;
  padding-bottom: 8px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: background .15s, outline .15s;
}

.life-age-slot.drag-over .life-slot-events {
  background: rgba(37, 99, 235, .07);
  outline: 2px dashed #2563eb;
  outline-offset: -2px;
}

/* Placed event circle */
.life-placed-event {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid var(--buying);
  box-shadow: 0 2px 8px rgba(37, 99, 235, .22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: default;
  transition: transform .15s, box-shadow .15s;
  flex-shrink: 0;
}
.life-placed-event:hover {
  transform: scale(1.12);
  box-shadow: 0 4px 14px rgba(37, 99, 235, .3);
}

/* Remove button – visible on hover */
.life-placed-remove {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  border: 1.5px solid #fff;
  font-size: .72rem;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .15s;
  padding: 0;
}
.life-placed-event:hover .life-placed-remove { opacity: 1; }

/* Age marker (tick + label) */
.life-age-marker {
  position: absolute;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  pointer-events: none;
}

.life-age-tick {
  width: 2px;
  height: 10px;
  background: #94a3b8;
  margin-top: 4px; /* sits just below the rail */
}

/* Every 5th year: taller tick, bolder label */
.life-age-slot[data-major] .life-age-tick {
  height: 16px;
  background: #475569;
  width: 2.5px;
}

.life-age-label {
  font-size: .62rem;
  color: #94a3b8;
  font-weight: 600;
  margin-top: 2px;
  white-space: nowrap;
}
.life-age-slot[data-major] .life-age-label {
  font-size: .73rem;
  color: var(--text);
  font-weight: 700;
}

.life-timeline-hint {
  margin-top: .85rem;
  font-size: .8rem;
  color: var(--muted);
  text-align: center;
}

/* Event list below chart */
.life-event-list {
  margin-top: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.life-event-list-title {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #fff;
  background: #334155;
  padding: .6rem 1rem;
}

.life-event-row {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .6rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: .86rem;
}
.life-event-row:last-child { border-bottom: none; }
.life-event-row:nth-child(even) { background: var(--bg); }

.life-event-row-icon { font-size: 1.25rem; }
.life-event-row-age  { font-weight: 800; color: var(--buying); min-width: 52px; }
.life-event-row-label { flex: 1; font-weight: 600; }
.life-event-row-cost  { font-weight: 800; color: var(--danger); }
.life-event-row-note  { font-size: .75rem; color: var(--muted); }

/* ============================================================
   Brand link (header logo on sub-pages links to landing)
============================================================ */
.brand-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  text-decoration: none;
  color: inherit;
}
.brand-link:hover .brand-name { opacity: .85; }

/* ============================================================
   Page navigation (sub-pages)
============================================================ */
.page-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .375rem;
  padding: .75rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.page-nav-link {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .45rem .9rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.page-nav-link:hover {
  background: var(--bg);
  color: var(--text);
}
.page-nav-link.active {
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 600;
}

/* ============================================================
   Landing page
============================================================ */
.landing-hero {
  text-align: center;
  padding: 3rem 1.5rem 1.5rem;
}
.landing-title {
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 800;
  color: var(--text);
  margin: 0 0 .6rem;
}
.landing-sub {
  font-size: 1rem;
  color: var(--muted);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.6;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  padding: 1.5rem 1.5rem 3rem;
  max-width: 1100px;
  margin: 0 auto;
}

.tool-card {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: box-shadow .18s, border-color .18s, transform .18s;
}
.tool-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #93c5fd;
  transform: translateY(-2px);
}

.tool-card-icon {
  font-size: 2rem;
  line-height: 1;
}
.tool-card-body { flex: 1; }
.tool-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: .35rem;
}
.tool-card-desc {
  font-size: .875rem;
  color: var(--muted);
  line-height: 1.55;
}
.tool-card-cta {
  font-size: .8rem;
  font-weight: 600;
  color: #2563eb;
  align-self: flex-start;
}

/* ============================================================
   Responsive tweaks
============================================================ */
@media (max-width: 640px) {
  .site-header { padding: 1.5rem 1rem; }
  .site-header h1 { font-size: 1.4rem; }
  .tab-panel { padding: 1.25rem 1rem; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .metric-card .m-value { font-size: 1.1rem; }
  .chart-wrap { height: 280px; }
}
