/* ============================================================
   Utilities Bunker — RMD Calculator v2.1
   File: /assets/css/modules/calculators/financialcalculators/rmd-calculator.v2.1.css
   Purpose:
   - Tool-only layout + RMD summary visuals + work formatting
   - No changes to ub-toolkit.v2.1.css
   - Mobile-first, touch-friendly, UB-CERT aligned
   ============================================================ */

/* Local tokens */
:root{
  --rmd-radius: 16px;
  --rmd-gap: 14px;
  --rmd-soft: rgba(0,0,0,.06);
  --rmd-accent: rgba(249,58,19,.12);
  --rmd-accent-strong: rgba(249,58,19,.18);
}

/* Header */
.rmd-head{
  display:flex;
  gap:10px;
  justify-content:space-between;
  align-items:flex-start;
  flex-wrap:wrap;
}
.rmd-page-title{
  margin:0;
  font-size:var(--ub-fs-5);
}
.rmd-page-subtitle{
  margin:6px 0 0;
  max-width:78ch;
}

/* How-to */
.rmd-howto{
  margin:0;
  padding-left:18px;
}
.rmd-howto li + li{
  margin-top:6px;
}

/* Main hero layout */
.rmd-hero{
  display:grid;
  grid-template-columns:1.08fr 0.92fr;
  gap:var(--rmd-gap);
  align-items:start;
}

@media (max-width: 980px){
  .rmd-hero{
    grid-template-columns:1fr;
  }
}

/* Panels */
.rmd-panel{
  background:var(--ub-surface-2);
  border:1px solid var(--ub-border);
  border-radius:var(--rmd-radius);
  padding:12px;
}

.rmd-panel--hero{
  min-width:0;
}

.rmd-panel--form{
  min-width:0;
}

/* Hero text */
.rmd-hero-top{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  flex-wrap:wrap;
  margin-bottom:10px;
}

.rmd-eyebrow{
  font-size:12px;
  line-height:1.2;
  font-weight:950;
  letter-spacing:.08em;
  text-transform:uppercase;
  color:var(--ub-muted);
  margin-bottom:6px;
}

.rmd-hero-title{
  margin:0;
  font-size:clamp(18px, 1.2rem + .55vw, 26px);
  line-height:1.15;
  font-weight:950;
  letter-spacing:-.02em;
}

.rmd-hero-copy{
  margin:8px 0 0;
  color:var(--ub-muted);
  max-width:64ch;
}

/* KPI tiles */
.rmd-kpis{
  display:grid;
  grid-template-columns:repeat(2, minmax(132px, 1fr));
  gap:8px;
  width:min(100%, 360px);
}

.rmd-kpi{
  min-height:72px;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--ub-border);
  background:var(--ub-card-bg);
}

.rmd-kpi .k{
  font-size:11px;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:.04em;
  color:var(--ub-muted);
}

.rmd-kpi .v{
  margin-top:4px;
  font-family:var(--ub-mono);
  font-size:15px;
  font-weight:950;
  line-height:1.25;
  overflow-wrap:anywhere;
}

@media (max-width: 560px){
  .rmd-kpis{
    grid-template-columns:1fr 1fr;
    width:100%;
  }
}

/* Status row */
.rmd-status-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  margin-top:6px;
}

.rmd-status{
  display:inline-flex;
  align-items:center;
  gap:8px;
  min-height:44px;
  padding:8px 10px;
  border-radius:999px;
  border:1px solid var(--ub-border);
  background:var(--ub-card-bg);
  font-size:12px;
  font-weight:950;
}

.rmd-dot{
  width:10px;
  height:10px;
  border-radius:50%;
  background:var(--ub-muted);
}

.rmd-modechips{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}

.rmd-modechips .ub-chip{
  min-height:44px;
}

/* Formula card */
.rmd-visual-card{
  margin-top:12px;
  padding:14px;
  border-radius:14px;
  border:1px solid var(--ub-border);
  background:
    linear-gradient(180deg, var(--ub-card-bg), var(--ub-surface-2));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.03);
}

.rmd-formula-label{
  margin:0 0 8px;
  font-size:12px;
  line-height:1.2;
  font-weight:950;
  letter-spacing:.08em;
  text-transform:uppercase;
  color:var(--ub-muted);
}

.rmd-formula{
  padding:12px 14px;
  border-radius:12px;
  border:1px solid var(--ub-border);
  background:var(--ub-surface-1);
  font-family:var(--ub-mono);
  font-weight:950;
  font-size:14px;
  line-height:1.5;
  overflow-wrap:anywhere;
}

.rmd-formula-note{
  margin:10px 0 0;
  color:var(--ub-muted);
  font-size:12px;
  line-height:1.5;
}

/* Presets */
.rmd-preset-row{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-top:12px;
}

.rmd-preset-row .ub-chip{
  min-height:44px;
  padding:10px 12px;
}

/* Separators */
.rmd-sep{
  border:none;
  border-top:1px solid var(--ub-border);
  margin:14px 0;
}

/* Subsections */
.rmd-subsection{
  min-width:0;
}

.rmd-subtitle{
  margin:0 0 10px;
  font-size:var(--ub-fs-2);
  line-height:1.2;
  font-weight:950;
  letter-spacing:-.01em;
}

/* Checkbox row label */
.rmd-checkline{
  display:flex;
  align-items:center;
  gap:10px;
  min-height:44px;
  font-weight:900;
}

.rmd-checkline input[type="checkbox"]{
  width:18px;
  height:18px;
  margin:0;
  accent-color:var(--ub-btn-grad-b);
  flex:0 0 auto;
}

/* Toggle chips row */
.rmd-toggle-row{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:center;
}

.rmd-toggle-row .ub-chip{
  min-height:44px;
}

.rmd-toggle-row .ub-chip input[type="checkbox"]{
  width:18px;
  height:18px;
  margin:0 8px 0 0;
  accent-color:var(--ub-btn-grad-b);
}

/* Actions */
.rmd-actions{
  margin-top:12px;
}

/* Work box */
.rmd-work{
  font-family:var(--ub-mono);
  font-size:13px;
  line-height:1.6;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
}

.rmd-work-note{
  margin-top:10px;
  color:var(--ub-muted);
  font-size:12px;
  line-height:1.5;
}

/* Content helpers */
.rmd-card-gap{
  margin-top:12px;
}

.rmd-list{
  margin:0;
  padding-left:18px;
}

.rmd-list li + li{
  margin-top:6px;
}

.rmd-faq-q{
  margin:12px 0 6px;
  font-size:var(--ub-fs-2);
  line-height:1.25;
  font-weight:900;
}

.rmd-faq-a{
  margin:0 0 10px;
}

/* Input polish */
.ub-field .ub-inputrow{
  display:block !important;
}

.ub-field .ub-inputrow > input,
.ub-field .ub-inputrow > select{
  display:block !important;
  width:100% !important;
}

.ub-field .ub-inputrow > select{
  margin-top:6px;
}

/* Output visual emphasis */
#liveOut .ub-v{
  overflow-wrap:anywhere;
}

#liveOut .ub-k{
  letter-spacing:.05em;
}

/* Details polish */
.ub-collapsible summary{
  min-height:44px;
}

.ub-collapsible summary:focus{
  outline:none;
  box-shadow:0 0 0 4px var(--ub-focus);
  border-radius:12px;
}

/* Rail helpers */
.ub-btn--block{
  width:100%;
}

/* Dark theme enhancements */
html.ub-theme-dark .rmd-visual-card{
  background:
    linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.02));
}

html.ub-theme-dark .rmd-formula{
  box-shadow:inset 0 1px 0 rgba(255,255,255,.03);
}

html.ub-theme-dark .rmd-kpi,
html.ub-theme-dark .rmd-status{
  background:rgba(255,255,255,.03);
}

/* Small-screen adjustments */
@media (max-width: 640px){
  .rmd-head{
    align-items:stretch;
  }

  .rmd-head .ub-btn{
    width:100%;
  }

  .rmd-hero-top{
    flex-direction:column;
    align-items:stretch;
  }

  .rmd-kpis{
    width:100%;
  }

  .rmd-status-row{
    align-items:stretch;
  }

  .rmd-status{
    width:100%;
    justify-content:flex-start;
  }

  .rmd-modechips{
    width:100%;
  }

  .rmd-modechips .ub-chip{
    flex:1 1 220px;
  }

  .rmd-toggle-row{
    align-items:stretch;
  }

  .rmd-toggle-row .ub-chip{
    width:100%;
    justify-content:flex-start;
  }

  .rmd-preset-row .ub-chip{
    flex:1 1 220px;
  }
}

/* Ultra-small screens */
@media (max-width: 420px){
  .rmd-kpis{
    grid-template-columns:1fr;
  }

  .rmd-kpi{
    min-height:64px;
  }

  .rmd-formula{
    font-size:13px;
    padding:10px 12px;
  }

  .rmd-work{
    font-size:12px;
  }
}