/* ============================================================
   LifeOS — Pay Down (desktop, ≥901px)
   ----------------------------------------------------------------
   Activated by app.html <link media="(min-width: 901px)">. No
   @media queries inside; the link tag is the gate. Tokens read
   from css/app.css :root only — do not hardcode hex/px values.
   ============================================================ */

/* KPI strip — desktop: 4 columns, equal width */
.pd-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}
.pd-kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-4);
}
.pd-kpi .v {
  font-size: var(--fs-2xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.pd-kpi .l {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: var(--sp-1);
}

/* Overview chart card */
.pd-overview-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  margin-bottom: var(--sp-5);
}
.pd-overview-card .pd-overview-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}
.pd-overview-card h3 {
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--text);
}
.pd-overview-tabs {
  display: flex;
  gap: var(--sp-1);
  margin-left: auto;
}
.pd-overview-tabs button {
  background: transparent;
  border: 1px solid var(--border-2);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  cursor: pointer;
}
.pd-overview-tabs button.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent);
}

/* P&I twin donuts — desktop side-by-side */
.pd-pi-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-7);
  padding: var(--sp-5) var(--sp-3);
}
.pd-pi-block {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--sp-5);
  align-items: center;
}
.pd-pi-block h4 {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--sp-3);
}
.pd-pi-block .pd-legend-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
  font-size: var(--fs-sm);
}
.pd-pi-block .pd-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}
.pd-pi-donut {
  width: 200px;
  height: 200px;
}
.pd-pi-unpayable-note {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  padding: var(--sp-3);
  border: 1px dashed var(--border-2);
  border-radius: var(--radius-xs);
  background: var(--surface);
}

/* Timeline line chart */
.pd-overview-card .pd-line-chart {
  width: 100%;
  height: auto;
  max-height: 320px;
  display: block;
}
.pd-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: var(--sp-3);
}
.pd-chart-legend-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.pd-chart-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

/* Unpayable banner — sits above the active chart panel inside data-pd-chart */
.pd-unpayable-banner {
  font-size: var(--fs-sm);
  color: var(--danger);
  background: var(--danger-dim);
  border: 1px solid rgba(240, 63, 63, 0.3);
  border-radius: var(--radius-xs);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-3);
}

/* Bottom grid — account-list + savings-calculator side-by-side */
.pd-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 460px;
  gap: var(--sp-5);
}
.pd-acct-section h4 {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--sp-2);
}

/* Per-account row — bottom-edge border per ac-8. Use --border. */
.pd-acct-row {
  background: var(--card);
  border: 1px solid transparent;
  border-bottom: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  display: grid;
  grid-template-columns: 36px 1fr auto auto;
  gap: var(--sp-3);
  align-items: center;
  margin-bottom: var(--sp-3);
}
.pd-acct-row .pd-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-xs);
  background: var(--accent-dim);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-weight: 700;
}
.pd-acct-row .pd-name { font-weight: 600; color: var(--text); }
.pd-acct-row .pd-meta {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: 2px;
}
.pd-acct-row .pd-out {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--text);
}
.pd-acct-row .pd-out-meta {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  text-align: right;
  margin-top: 2px;
}

/* "Set up Pay Down" CTA on per-account row — accent color per ac-6 */
.pd-acct-row .pd-setup-cta {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: var(--fs-xs);
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  cursor: pointer;
}
.pd-acct-row .pd-setup-cta:hover {
  background: var(--accent-dim);
  color: var(--accent-hover);
}

/* Excluded toggle — text-muted per ac-9 */
.pd-excluded-toggle {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  padding: var(--sp-2) 0;
  cursor: pointer;
  text-decoration: underline;
}

/* Savings calculator */
.pd-savings-calc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-4);
}
.pd-savings-calc h3 {
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--sp-3);
}
.pd-calc-option {
  padding: var(--sp-4) 0;
  border-top: 1px solid var(--border);
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  cursor: pointer;
}
.pd-calc-option:first-of-type { border-top: 0; }
.pd-radio {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1.5px solid var(--border-2);
  flex-shrink: 0;
  margin-top: 2px;
  position: relative;
}
.pd-calc-option.selected .pd-radio { border-color: var(--accent); }
.pd-calc-option.selected .pd-radio::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 999px;
  background: var(--accent);
}
.pd-calc-option .pd-copy { flex: 1; }
.pd-calc-option .pd-opt-title {
  font-weight: 600;
  font-size: var(--fs-md);
  color: var(--text);
  margin-bottom: var(--sp-1);
}
.pd-calc-option .pd-opt-desc {
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.pd-calc-extra { display: none; margin-top: var(--sp-3); }
.pd-calc-option.selected .pd-calc-extra { display: block; }
.pd-stepper-label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
  margin: var(--sp-3) 0 var(--sp-1);
}
.pd-stepper {
  display: flex;
  align-items: center;
  background: var(--card-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  padding: var(--sp-1);
}
.pd-stepper .pd-num {
  flex: 1;
  padding: var(--sp-2) var(--sp-3);
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  outline: 0;
}
.pd-stepper button {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border-2);
  color: var(--text);
  cursor: pointer;
  font-size: var(--fs-lg);
  line-height: 1;
  padding: 0;
}

/* Empty / loading / error states */
.pd-state-banner {
  margin-bottom: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--r-md);
  border: 1px dashed var(--border-2);
  color: var(--text-muted);
  font-size: var(--fs-md);
  background: var(--surface);
  text-align: center;
}
.pd-state-banner .pd-retry-btn {
  margin-top: var(--sp-3);
  background: var(--accent);
  color: var(--bg);
  border: 0;
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-xs);
  font-size: var(--fs-sm);
  cursor: pointer;
}

/* ─── Cross-feature "Save up | Pay down" tab bar ───────────────────────────
   Rendered at the top of the Pay Down surface (and reusable on the Save Up
   surface if needed). Tokens read from css/app.css :root — no hardcoded
   brand values. */
.pd-saveup-tabs {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) 0;
  margin-top: var(--sp-2);
}
.pd-saveup-tabs .pd-tab {
  background: transparent;
  border: 0;
  font-size: var(--fs-md);
  font-weight: 500;
  color: var(--text-muted);
  padding: 6px 14px;
  cursor: pointer;
  border-radius: 999px;
  user-select: none;
  transition: color 0.15s ease, background 0.15s ease;
}
.pd-saveup-tabs .pd-tab:hover {
  color: var(--text);
  background: var(--card-2);
}
.pd-saveup-tabs .pd-tab.active {
  color: var(--accent);
  background: var(--accent-dim);
  font-weight: 600;
}
