/* ============================================================
   Utilities Bunker — Rent vs Buy Calculator (v2.1)
   File: /assets/css/modules/calculators/financialcalculators/rent-vs-buy-calculator.v2.1.css
   Purpose:
   - Tool-only layout + comparison dashboard + tables + work area
   - No changes to ub-toolkit.v2.1.css
   - Mobile-first, responsive, accessible, UB-CERT aligned
   ============================================================ */

:root{
  --rvb-radius: 16px;
  --rvb-gap: 14px;
  --rvb-soft: rgba(0,0,0,.06);
  --rvb-soft-strong: rgba(0,0,0,.10);
  --rvb-accent: rgba(249,58,19,.14);
  --rvb-good: rgba(34,197,94,.16);
  --rvb-bad: rgba(239,68,68,.14);
}

/* Header */
.rvb-head{
  display:flex;
  gap:10px;
  justify-content:space-between;
  align-items:flex-start;
  flex-wrap:wrap;
}
.rvb-title{
  margin:0;
  font-size:var(--ub-fs-5);
}
.rvb-subtitle{
  margin:6px 0 0;
  max-width:78ch;
}

/* How-to */
.rvb-howto-list{
  margin:0;
  padding-left:18px;
}
.rvb-howto-list li + li{
  margin-top:6px;
}

/* Hero layout */
.rvb-hero{
  display:grid;
  grid-template-columns:1.08fr 0.92fr;
  gap:var(--rvb-gap);
  align-items:start;
}
@media (max-width: 1040px){
  .rvb-hero{
    grid-template-columns:1fr;
  }
}

/* Summary panel */
.rvb-panel{
  background:var(--ub-surface-2);
  border:1px solid var(--ub-border);
  border-radius:var(--rvb-radius);
  padding:12px;
}
.rvb-panel-top{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:10px;
  flex-wrap:wrap;
  margin-bottom:10px;
}
.rvb-panel-title{
  font-size:clamp(13px, 1.2vw, 14px);
  font-weight:950;
  letter-spacing:.01em;
}
.rvb-panel-sub{
  font-size:12px;
  color:var(--ub-muted);
  margin-top:2px;
}

/* View chips */
.rvb-chipset{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.rvb-chipset .ub-chip{
  min-height:44px;
  padding:10px 12px;
}
.rvb-chipset .ub-chip[aria-pressed="true"]{
  border-color:rgba(249,58,19,.55);
  box-shadow:0 0 0 4px rgba(249,58,19,.12);
}

/* KPI grid */
.rvb-kpis{
  display:grid;
  grid-template-columns:repeat(2, minmax(0,1fr));
  gap:10px;
}
@media (max-width: 560px){
  .rvb-kpis{
    grid-template-columns:1fr;
  }
}
.rvb-kpi{
  min-width:0;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--ub-border);
  background:var(--ub-card-bg);
}
.rvb-kpi .k{
  font-size:11px;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:.04em;
  color:var(--ub-muted);
}
.rvb-kpi .v{
  font-family:var(--ub-mono);
  font-weight:950;
  font-size:15px;
  line-height:1.2;
  margin-top:4px;
  overflow-wrap:anywhere;
}

/* Meter */
.rvb-meter-wrap{
  margin-top:12px;
}
.rvb-meter-labelrow{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  margin-bottom:8px;
  font-size:12px;
  font-weight:900;
  color:var(--ub-muted);
}
.rvb-meter-labelrow #rvbMeterLabel{
  color:var(--ub-text);
  font-weight:950;
}
.rvb-meter{
  position:relative;
  width:100%;
  min-height:18px;
  border-radius:999px;
  overflow:hidden;
  border:1px solid var(--ub-border);
  background:
    linear-gradient(90deg,
      rgba(239,68,68,.16) 0%,
      rgba(239,68,68,.10) 48%,
      rgba(34,197,94,.10) 52%,
      rgba(34,197,94,.16) 100%);
}
.rvb-meter::after{
  content:"";
  position:absolute;
  left:50%;
  top:0;
  bottom:0;
  width:1px;
  background:var(--ub-border);
  z-index:2;
}
.rvb-meter-bar{
  position:absolute;
  top:0;
  bottom:0;
  left:0;
  width:50%;
  border-radius:999px;
  background:linear-gradient(92deg,var(--ub-btn-grad-a),var(--ub-btn-grad-b));
  box-shadow:0 0 0 1px rgba(255,255,255,.08) inset;
  transition:width 180ms ease;
}
@media (prefers-reduced-motion: reduce){
  .rvb-meter-bar{
    transition:none;
  }
}

/* Mini cards */
.rvb-mini-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0,1fr));
  gap:10px;
  margin-top:12px;
}
@media (max-width: 560px){
  .rvb-mini-grid{
    grid-template-columns:1fr;
  }
}
.rvb-mini-card{
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--ub-border);
  background:var(--ub-card-bg);
}
.rvb-mini-card .label{
  display:block;
  font-size:11px;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:.04em;
  color:var(--ub-muted);
  margin-bottom:4px;
}
.rvb-mini-card strong{
  display:block;
  font-family:var(--ub-mono);
  font-size:14px;
  line-height:1.25;
  overflow-wrap:anywhere;
}

/* Presets */
.rvb-preset-row{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-top:12px;
}
.rvb-preset-row .ub-chip{
  min-height:44px;
  padding:10px 12px;
}

/* Form spacing */
.rvb-form{
  margin-bottom:0;
}
.rvb-section-label{
  font-size:12px;
  font-weight:950;
  letter-spacing:.08em;
  text-transform:uppercase;
  color:var(--ub-muted);
  margin:4px 0 10px;
}
.rvb-divider{
  border:none;
  border-top:1px solid var(--ub-border);
  margin:14px 0;
}
.rvb-toggle-row{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-top:2px;
}
.rvb-toggle-row .ub-chip{
  justify-content:flex-start;
  text-align:left;
  white-space:normal;
  min-height:44px;
  max-width:100%;
}
.rvb-actions{
  margin-top:12px;
}

/* Outputs */
.rvb-out-grid .ub-v{
  overflow-wrap:anywhere;
}

/* Detailed result cards */
.rvb-results-grid{
  display:grid;
  grid-template-columns:repeat(3, minmax(0,1fr));
  gap:var(--rvb-gap);
  margin-top:14px;
}
@media (max-width: 1100px){
  .rvb-results-grid{
    grid-template-columns:1fr;
  }
}
.rvb-result-card{
  margin-bottom:0;
}
.rvb-stat-list{
  display:grid;
  gap:10px;
}
.rvb-stat-list > div{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--ub-border);
  background:var(--ub-surface-2);
}
.rvb-stat-list span{
  color:var(--ub-muted);
  font-size:13px;
  line-height:1.35;
}
.rvb-stat-list strong{
  text-align:right;
  font-family:var(--ub-mono);
  font-size:13px;
  line-height:1.35;
  overflow-wrap:anywhere;
}

/* Annual table */
.rvb-table-wrap{
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
}
.rvb-table-wrap .ub-table{
  min-width:720px;
}
.rvb-table-wrap .ub-table td,
.rvb-table-wrap .ub-table th{
  vertical-align:top;
}
.rvb-table-wrap .ub-table tbody tr:nth-child(even) td{
  background:rgba(0,0,0,.015);
}
html.ub-theme-dark .rvb-table-wrap .ub-table tbody tr:nth-child(even) td{
  background:rgba(255,255,255,.02);
}

/* Work area */
.rvb-work{
  font-family:var(--ub-mono);
  font-size:13px;
  line-height:1.58;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
}
.rvb-work-note{
  margin-top:10px;
  color:var(--ub-muted);
  font-size:12px;
}

/* Formula / assumptions section */
.rvb-formula-list{
  margin:0;
  padding-left:18px;
}
.rvb-formula-list li + li{
  margin-top:6px;
}
.rvb-assumption-note{
  margin-top:10px;
  color:var(--ub-muted);
  font-size:12px;
}

/* FAQ */
.rvb-faq-q{
  margin:12px 0 6px;
}
.rvb-faq-a{
  margin:0 0 10px;
}
.rvb-faq-a:last-child{
  margin-bottom:0;
}

/* Button helper */
.ub-btn--block{
  width:100%;
}

/* Better focus styling for tool controls */
.rvb-chipset .ub-chip:focus,
.rvb-preset-row .ub-chip:focus,
.rvb-toggle-row .ub-chip:focus{
  outline:none;
  box-shadow:0 0 0 4px var(--ub-focus);
}

/* Stronger density control on very small screens */
@media (max-width: 520px){
  .rvb-panel,
  .rvb-form{
    padding:10px;
  }

  .rvb-stat-list > div{
    flex-direction:column;
    align-items:flex-start;
  }

  .rvb-stat-list strong{
    text-align:left;
  }

  .rvb-meter-labelrow{
    align-items:flex-start;
  }
}

/* Print-friendly cleanup */
@media print{
  .ub-rail,
  .ub-rail-togglebar,
  .ub-rail-backdrop,
  #btnCopy,
  #btnShare,
  #resetBtn,
  #ubThemeToggle{
    display:none !important;
  }

  .rvb-hero,
  .rvb-results-grid,
  .rvb-mini-grid,
  .rvb-kpis{
    grid-template-columns:1fr !important;
  }

  .ub-card,
  .rvb-panel,
  .rvb-stat-list > div{
    box-shadow:none !important;
    break-inside:avoid;
  }

  .rvb-table-wrap{
    overflow:visible;
  }

  .rvb-table-wrap .ub-table{
    min-width:0;
  }
}