/* ============================================================
   Utilities Bunker — Budget Calculator (v2.1)
   File: /assets/css/modules/calculators/financialcalculators/budget-calculator.v2.1.css
   Purpose:
   - Tool-only styling for Budget Calculator
   - Mobile-first, fast, minimal, a11y-friendly
   - NO changes to ub-toolkit.v2.1.css
   ============================================================ */

/* Tool-scoped tokens */
:root{
  --bud-radius: 16px;
  --bud-gap: 14px;
}

/* Header row tweaks (keep consistent with other tools) */
.ub-headrow{
  display:flex;
  gap:10px;
  justify-content:space-between;
  align-items:center;
  flex-wrap:wrap;
}
.ub-h1fix{ margin:0; font-size:var(--ub-fs-5); }
.ub-subfix{ margin:6px 0 0; }

/* How-to steps */
.ub-steps{
  margin:0;
  padding-left:18px;
}
.ub-steps li{ margin: 6px 0; }

/* Divider */
.ub-hr{
  border:none;
  border-top:1px solid var(--ub-border);
  margin:14px 0;
}

/* Hero layout: inputs + results */
.ub-hero-budget{
  display:grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: var(--bud-gap);
}
@media (max-width: 980px){
  .ub-hero-budget{
    grid-template-columns: 1fr;
  }
}

/* Sections inside the form */
.ub-block{
  border:1px solid var(--ub-border);
  background: var(--ub-surface-2);
  border-radius: var(--bud-radius);
  padding: 12px;
}
.ub-block-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}
.ub-block-title{
  margin:0;
  font-size: var(--ub-fs-3);
  font-weight: 950;
  letter-spacing: -0.01em;
}
.ub-block-sub{
  margin-top: 6px;
  color: var(--ub-muted);
  font-size: var(--ub-fs-0);
}

/* Lines list */
.ub-lines{
  margin-top: 10px;
  display:flex;
  flex-direction:column;
  gap: 10px;
}
.ub-lines-empty{
  color: var(--ub-muted);
  font-size: var(--ub-fs-1);
  padding: 8px 2px;
}

/* A single line row */
.ub-line{
  display:grid;
  grid-template-columns: 1.35fr 0.70fr 0.60fr 0.55fr 0.18fr 0.20fr;
  gap: 10px;
  align-items:center;
  padding: 10px;
  border-radius: 14px;
  border:1px solid var(--ub-border);
  background: var(--ub-card-bg);
}

/* On smaller screens: stack into two columns */
@media (max-width: 980px){
  .ub-line{
    grid-template-columns: 1fr 1fr;
  }
}

/* On very small screens: stack fully */
@media (max-width: 520px){
  .ub-line{
    grid-template-columns: 1fr;
  }
}

/* Columns inside line */
.ub-line-col{ min-width: 0; }
.ub-line-col--tight{ display:flex; justify-content:flex-end; }

/* Label input */
.ub-line-label{
  width:100%;
  min-height: var(--ub-hit);
  padding:10px 12px;
  border-radius: var(--ub-radius-1);
  border:1px solid var(--ub-border);
  background: var(--ub-surface-1);
  color: var(--ub-text);
  font-size: var(--ub-fs-2);
}

/* Amount input */
.ub-line-amount{
  width:100%;
  min-height: var(--ub-hit);
  padding:10px 12px;
  border-radius: var(--ub-radius-1);
  border:1px solid var(--ub-border);
  background: var(--ub-surface-1);
  color: var(--ub-text);
  font-size: var(--ub-fs-2);
  font-family: var(--ub-mono);
  font-weight: 900;
}

/* Frequency + Tag selects (always full hit target) */
.ub-line-freq,
.ub-line-tag{
  width:100%;
  min-height: var(--ub-hit);
  padding:10px 12px;
  border-radius: var(--ub-radius-1);
  border:1px solid var(--ub-border);
  background: var(--ub-surface-1);
  color: var(--ub-text);
  font-size: var(--ub-fs-2);
}

/* Enabled toggle chip */
.ub-line-enable{
  display:inline-flex;
  align-items:center;
  gap:8px;
  min-height: var(--ub-hit);
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--ub-border);
  background: var(--ub-chip-bg);
  color: var(--ub-chip-text);
  font-weight: 900;
  user-select:none;
}
.ub-line-enable input[type="checkbox"]{
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--ub-btn-grad-b);
}
.ub-line-enable:focus-within{
  outline:none;
  box-shadow: 0 0 0 4px var(--ub-focus);
}

/* Remove button tightness */
.ub-line-del{
  min-height: var(--ub-hit);
  padding: 10px 12px;
  width: 100%;
}
@media (min-width: 981px){
  /* in wide view, keep remove button compact */
  .ub-line-del{ width: auto; }
}

/* KPI grid (right side results) */
.ub-kpi-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 10px;
}
@media (max-width: 520px){
  .ub-kpi-grid{ grid-template-columns: 1fr; }
}

.ub-kpi-tile{
  border-radius: 14px;
  border: 1px solid var(--ub-border);
  background: var(--ub-card-bg);
  padding: 10px 12px;
}
.ub-kpi-tile .k{
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ub-muted);
}
.ub-kpi-tile .v{
  margin-top: 4px;
  font-family: var(--ub-mono);
  font-weight: 950;
  font-size: var(--ub-fs-3);
}

/* Net pill (reuses ub-risk pattern from other tools, but scoped) */
.ub-net{ margin-top: 12px; }
.ub-risk{
  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: var(--ub-hit);
}
.ub-dot{
  width:10px;
  height:10px;
  border-radius:50%;
  background: var(--ub-muted);
}

/* Mini breakdown rows */
.ub-mini{ margin-top: 4px; }
.ub-mini-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  padding: 10px 2px;
  border-bottom: 1px dashed var(--ub-border);
}
.ub-mini-row:last-child{ border-bottom: none; }
.ub-mini-row .k{
  color: var(--ub-muted);
  font-size: var(--ub-fs-1);
  font-weight: 900;
}
.ub-mini-row .v{
  font-family: var(--ub-mono);
  font-weight: 950;
  font-size: var(--ub-fs-2);
}

/* Work box formatting */
.ub-work{
  font-family: var(--ub-mono);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Reference list */
.ub-ref{
  margin:0;
  padding-left:18px;
}
.ub-ref li{ margin: 6px 0; }

/* Right rail: ensure full-width buttons */
.ub-btn--block{ width:100%; }

/* Hide frequency column visually when mode is simple (JS also sets display) */
.ub-line-col .ub-line-freq[hidden]{ display:none !important; }

/* Touch target + focus visibility for custom inputs */
.ub-line input:focus-visible,
.ub-line select:focus-visible,
.ub-line button:focus-visible{
  outline: 3px solid var(--ub-focus);
  outline-offset: 2px;
  border-radius: 12px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce){
  *{ transition-duration:0.01ms!important; }
}