/* ============================================================
   Utilities Bunker — Retirement Calculator v2.1
   File: /assets/css/modules/calculators/financialcalculators/retirement-calculator.v2.1.css
   Purpose:
   - Tool-only layout and retirement dashboard styling
   - Mobile-first, accessible, UB-CERT aligned
   - No edits to ub-toolkit.v2.1.css
   ============================================================ */

:root{
  --ret-gap: 14px;
  --ret-radius: 16px;
  --ret-soft: rgba(0,0,0,.06);
  --ret-grid-line: rgba(0,0,0,.10);
  --ret-bar-grad-a: rgba(255,116,38,.88);
  --ret-bar-grad-b: rgba(249,58,19,.94);
}

html.ub-theme-dark:root{
  --ret-soft: rgba(255,255,255,.06);
  --ret-grid-line: rgba(255,255,255,.10);
  --ret-bar-grad-a: rgba(255,116,38,.90);
  --ret-bar-grad-b: rgba(249,58,19,.96);
}

/* Header */
.ret-hero-head{
  display:flex;
  gap:10px;
  align-items:flex-start;
  justify-content:space-between;
  flex-wrap:wrap;
}

.ret-page-title{
  margin:0;
  font-size:var(--ub-fs-5);
}

.ret-page-subtitle{
  margin:6px 0 0;
}

/* How-to list */
.ret-steps{
  margin:0;
  padding-left:18px;
}

.ret-steps li + li{
  margin-top:6px;
}

/* Main hero layout */
.ret-hero{
  display:grid;
  grid-template-columns: 1.12fr 0.88fr;
  gap:var(--ret-gap);
}

@media (max-width: 980px){
  .ret-hero{
    grid-template-columns:1fr;
  }
}

/* Dashboard */
.ret-dashboard{
  background:var(--ub-surface-2);
  border:1px solid var(--ub-border);
  border-radius:var(--ret-radius);
  padding:12px;
}

.ret-dashboard-top{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:10px;
  flex-wrap:wrap;
  margin-bottom:10px;
}

.ret-dashboard-title{
  font-size:clamp(13px, 1.2vw, 14px);
  font-weight:950;
  letter-spacing:.01em;
}

.ret-dashboard-sub{
  font-size:12px;
  color:var(--ub-muted);
  margin-top:2px;
}

/* KPI cards */
.ret-kpis{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  justify-content:flex-end;
}

.ret-kpi{
  min-width:124px;
  padding:8px 10px;
  border-radius:14px;
  border:1px solid var(--ub-border);
  background:var(--ub-card-bg);
}

.ret-kpi .k{
  font-size:11px;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:.04em;
  color:var(--ub-muted);
}

.ret-kpi .v{
  font-family:var(--ub-mono);
  font-weight:950;
  font-size:14px;
  margin-top:2px;
}

/* Plan status */
.ret-status-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  margin-top:4px;
}

.ret-status{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border-radius:999px;
  border:1px solid var(--ub-border);
  background:var(--ub-card-bg);
  font-size:12px;
  font-weight:950;
  min-height:44px;
}

.ret-status-dot{
  width:10px;
  height:10px;
  border-radius:50%;
  background:var(--ub-muted);
  flex:0 0 auto;
}

.ret-preset-row{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}

.ret-preset-row .ub-chip{
  min-height:44px;
  padding:10px 12px;
}

/* Chart card */
.ret-chart-card{
  margin-top:12px;
  border:1px solid var(--ub-border);
  border-radius:14px;
  background:var(--ub-card-bg);
  padding:12px;
}

.ret-chart-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:10px;
  flex-wrap:wrap;
}

.ret-chart-title{
  font-size:13px;
  font-weight:950;
  letter-spacing:.01em;
}

.ret-chart-sub{
  font-size:12px;
  color:var(--ub-muted);
  margin-top:2px;
}

.ret-chart-toggles{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}

.ret-chart-toggles .ub-chip{
  min-height:44px;
  padding:10px 12px;
}

/* Chart shell */
.ret-chart-shell{
  margin-top:12px;
}

.ret-chart-placeholder{
  position:relative;
  min-height:280px;
  border-radius:14px;
  border:1px solid var(--ub-border);
  background:
    linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,0)),
    var(--ub-surface-2);
  overflow:hidden;
  padding:14px;
}

.ret-chart-grid{
  position:absolute;
  inset:14px;
  display:grid;
  grid-template-rows:repeat(5,1fr);
  pointer-events:none;
}

.ret-chart-grid span{
  border-top:1px dashed var(--ret-grid-line);
}

.ret-chart-grid span:first-child{
  border-top:none;
}

.ret-chart-msg{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  padding:18px;
  color:var(--ub-muted);
  font-size:13px;
  pointer-events: none;
}

/* Mini chart rendered by JS */
.ret-mini-chart{
  position:relative;
  z-index:1;
  height:250px;
  display:flex;
  align-items:flex-end;
  gap:6px;
  padding-top:10px;
}

.ret-mini-bar{
  flex:1 1 0;
  min-width:8px;
  border-radius:10px 10px 4px 4px;
  background:linear-gradient(180deg, var(--ret-bar-grad-a), var(--ret-bar-grad-b));
  box-shadow:0 10px 24px rgba(249,58,19,.18);
  transition:transform .16s ease, filter .16s ease;
}

@media (hover:hover){
  .ret-mini-bar:hover{
    transform:translateY(-2px);
    filter:brightness(1.05);
  }
}

.ret-chart-summary{
  position:relative;
  z-index:1;
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-top:12px;
  padding-top:12px;
  border-top:1px solid var(--ub-border);
  font-size:13px;
  font-weight:800;
}

.ret-chart-summary div{
  padding:8px 10px;
  border-radius:999px;
  border:1px solid var(--ub-border);
  background:var(--ub-surface-2);
}

/* Insights */
.ret-insights{
  display:grid;
  grid-template-columns:repeat(2, minmax(0,1fr));
  gap:10px;
  margin-top:12px;
}

.ret-insight{
  border:1px solid var(--ub-border);
  background:var(--ub-surface-2);
  border-radius:12px;
  padding:10px 12px;
}

.ret-insight .label{
  font-size:11px;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:.04em;
  color:var(--ub-muted);
}

.ret-insight .value{
  margin-top:4px;
  font-family:var(--ub-mono);
  font-size:14px;
  font-weight:950;
}

@media (max-width: 520px){
  .ret-insights{
    grid-template-columns:1fr;
  }
}

/* Inputs area helpers */
.ret-slider-group{
  display:grid;
  gap:10px;
}

.ret-slider-row{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.ret-slider-row label{
  min-width:140px;
  font-weight:900;
}

.ret-slider-row .ub-range{
  flex:1 1 240px;
  min-width:180px;
}

.ret-slider-out{
  min-width:88px;
  text-align:right;
  font-family:var(--ub-mono);
  font-weight:950;
}

.ret-option-row{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-top:12px;
}

.ret-option-row .ub-chip{
  display:flex;
  align-items:center;
  gap:8px;
}

/* Action spacing */
.ret-actions{
  margin-top:12px;
}

/* Show work */
.ret-work{
  font-family:var(--ub-mono);
  font-size:13px;
  line-height:1.55;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
}

.ret-work-note{
  margin-top:10px;
  color:var(--ub-muted);
  font-size:12px;
}

/* Formulas */
.ret-formula-list{
  margin:0;
  padding-left:18px;
}

.ret-formula-list li + li{
  margin-top:6px;
}

.ret-formula-note{
  margin-top:10px;
  color:var(--ub-muted);
  font-size:12px;
}

/* FAQ */
.ret-faq-q{
  margin:12px 0 6px;
}

.ret-faq-a{
  margin:0 0 10px;
}

.ret-faq-a:last-child{
  margin-bottom:0;
}

/* Accessibility / focus */
.ret-preset-row .ub-chip:focus,
.ret-chart-toggles .ub-chip:focus{
  outline:none;
  box-shadow:0 0 0 4px var(--ub-focus);
}

.ret-chart-placeholder:focus-within{
  box-shadow:0 0 0 4px var(--ub-focus);
}

/* Mobile polish */
@media (max-width: 640px){
  .ret-kpi{
    min-width:104px;
  }

  .ret-slider-row{
    align-items:flex-start;
  }

  .ret-slider-row label{
    min-width:100%;
  }

  .ret-slider-out{
    min-width:auto;
    text-align:left;
  }

  .ret-chart-placeholder{
    min-height:240px;
  }

  .ret-mini-chart{
    height:210px;
    gap:4px;
  }
}

/* Dark mode small refinements */
html.ub-theme-dark .ret-chart-card,
html.ub-theme-dark .ret-dashboard{
  box-shadow: inset 0 1px 0 rgba(255,255,255,.02);
}

html.ub-theme-dark .ret-mini-bar{
  box-shadow:0 10px 28px rgba(249,58,19,.16);
}