/* ============================================================
 * Utilities Bunker — Amortization Calculator (v2.1)
 * File: /assets/css/modules/calculators/financialcalculators/amortization-calculator.v2.1.css
 * Purpose:
 *  - Tool-only layout + schedule table + work formatting
 * Notes:
 *  - DO NOT edit ub-toolkit.v2.1.css
 *  - Mobile-first, 44x44 touch targets, clamp typography
 * ============================================================ */

/* ============================== Local tokens (tool-scoped) ============================== */
:root{
  --am-radius: 16px;
  --am-gap: 14px;
  --am-soft: rgba(0,0,0,.06);
}

/* Header row helper (keeps same style as your other tools) */
.ub-headrow{
  display:flex;
  gap:10px;
  justify-content:space-between;
  align-items:center;
  flex-wrap:wrap;
}

/* Make title feel like v2.1 tools */
.ub-title{
  margin:0;
  font-size:var(--ub-fs-5);
  letter-spacing:-0.02em;
}
.ub-subtitle{
  margin:6px 0 0;
}

/* ============================== Hero layout ============================== */
.ub-hero{
  display:grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: var(--am-gap);
}
@media (max-width: 980px){
  .ub-hero{ grid-template-columns: 1fr; }
}

/* ============================== Summary/Lab panel ============================== */
.ub-lab{
  background: var(--ub-surface-2);
  border: 1px solid var(--ub-border);
  border-radius: var(--am-radius);
  padding: 12px;
}
.ub-lab-top{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap: 10px;
  flex-wrap:wrap;
  margin-bottom: 8px;
}
.ub-lab-title{
  font-size: clamp(13px, 1.2vw, 14px);
  font-weight: 950;
  letter-spacing: .01em;
}
.ub-lab-sub{
  font-size: 12px;
  color: var(--ub-muted);
  margin-top: 2px;
}

/* KPI tiles (same pattern as your Ohm's Law tool) */
.ub-kpis{
  display:flex;
  flex-wrap:wrap;
  gap: 8px;
  justify-content:flex-end;
}
.ub-kpi{
  min-width: 130px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid var(--ub-border);
  background: var(--ub-card-bg);
}
.ub-kpi .k{
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ub-muted);
}
.ub-kpi .v{
  font-family: var(--ub-mono);
  font-weight: 950;
  font-size: 14px;
  margin-top: 2px;
}

/* Risk pill */
.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: 44px;
}
.ub-dot{
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ub-muted);
}

/* Risk dot levels (JS toggles these classes) */
.ub-dot.risk-low{ background: var(--ub-success); }
.ub-dot.risk-mid{ background: var(--ub-warning); }
.ub-dot.risk-high{ background: var(--ub-danger); }

/* ============================== Work output formatting ============================== */
.ub-work{
  font-family: var(--ub-mono);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap:anywhere;
}

/* Details / collapsible usability */
.ub-collapsible summary{
  cursor:pointer;
  font-weight: 950;
  min-height: 44px;
  display:flex;
  align-items:center;
}
.ub-collapsible summary:focus{
  outline:none;
  box-shadow: 0 0 0 4px var(--ub-focus);
  border-radius: 12px;
}

/* ============================== Table styles ============================== */
.ub-table-wrap{
  width: 100%;
  border: 1px solid var(--ub-border);
  border-radius: var(--ub-radius-2);
  background: var(--ub-card-bg);
  overflow: auto;
}

/* Basic UB table skin (tool-scoped; toolkit may not include table component) */
.ub-table{
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 760px; /* allows horizontal scroll on phones */
  font-size: var(--ub-fs-1);
}
.ub-table thead th{
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--ub-surface-2);
  color: var(--ub-text);
  text-align: left;
  font-weight: 950;
  padding: 12px 10px;
  border-bottom: 1px solid var(--ub-border);
  white-space: nowrap;
}
.ub-table tbody td{
  padding: 10px;
  border-bottom: 1px solid var(--ub-border);
  font-family: var(--ub-mono);
  white-space: nowrap;
}
.ub-table tbody tr:last-child td{
  border-bottom: none;
}

/* Zebra + hover */
.ub-table tbody tr:nth-child(2n){
  background: rgba(0,0,0,.02);
}
html.ub-theme-dark .ub-table tbody tr:nth-child(2n){
  background: rgba(255,255,255,.03);
}
.ub-table tbody tr:hover{
  background: rgba(249,58,19,.06);
}

/* Date column (can be hidden) */
.ub-table .col-date{
  font-family: var(--ub-font);
  color: var(--ub-muted);
}
.ub-table.hide-dates .col-date{
  display: none;
}
.ub-table.hide-dates thead th:nth-child(2){
  display: none;
}

/* Slightly tighter numbers on small screens */
@media (max-width: 520px){
  .ub-kpi{ min-width: 112px; }
  .ub-table{ min-width: 680px; }
}

/* Rail block buttons helper (safe if toolkit already has it) */
.ub-btn--block{ width: 100%; }

/* Make checkbox chips feel consistent */
.ub-chip{
  gap: 8px;
}

/* Prevent long cards from feeling cramped on tiny screens */
@media (max-width: 420px){
  .ub-card{ padding: 12px; }
}