/* ═══════════════════════════════════
   CALCULATOR PAGE
   ═══════════════════════════════════ */

/* Subheader */
.calc-subheader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--pool-deep);
  background-image:
    linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px);
  background-size: 18px 18px;
  color: var(--white);
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.calc-subheader-title {
  font-family: 'Fraunces', serif;
  font-size: 17px;
  font-weight: 400;
  font-style: italic;
  letter-spacing: -.3px;
}

.calc-subheader-sub {
  font-size: 11px;
  color: #fff;
  opacity: 0.8;
  margin-top: 2px;
}

/* App layout */
.calc-app {
  display: flex;
  min-height: calc(100vh - 108px);
}

/* Sidebar */
.calc-sidebar {
  width: 360px;
  min-width: 360px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.calc-sidebar::-webkit-scrollbar { width: 4px; }
.calc-sidebar::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 4px; }

.calc-sidebar-body {
  padding: 20px;
  padding-bottom: 8px;
}

/* Market rates panel */
.calc-rates-panel {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  margin-bottom: 16px;
  overflow: hidden;
}
.calc-rates-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 8px 10px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  color: var(--text-secondary);
  text-align: left;
}
.calc-rates-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 11px;
}
.calc-rates-asof {
  flex: 1;
  text-align: right;
  font-size: 10px;
  color: var(--text-secondary);
  opacity: .7;
}
.calc-rates-chevron {
  transition: transform .2s;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.calc-rates-panel.open .calc-rates-chevron {
  transform: rotate(180deg);
}
.calc-rates-body {
  display: none;
  padding: 0 10px 8px;
}
.calc-rates-panel.open .calc-rates-body {
  display: block;
}
.calc-rates-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-secondary);
  padding: 2px 0;
  font-family: 'DM Sans', sans-serif;
}
.calc-rates-row span:last-child {
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.calc-rate-use {
  font-family: 'DM Sans', sans-serif;
  font-size: 10px;
  font-weight: 600;
  color: var(--pool);
  background: none;
  border: 1px solid var(--pool);
  border-radius: 3px;
  padding: 1px 5px;
  cursor: pointer;
  line-height: 1.4;
  opacity: 0;
  transition: opacity .15s, background .15s, color .15s;
}
.calc-rates-row:hover .calc-rate-use {
  opacity: 1;
}
.calc-rate-use:hover {
  background: var(--pool);
  color: var(--white);
}
.calc-rate-use.applied {
  opacity: 1;
  background: var(--pool);
  color: var(--white);
}

/* Step card layout */
.calc-step-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.calc-step-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}
.calc-step-title {
  font-family: 'Fraunces', serif;
  font-size: 15px;
  font-weight: 400;
  color: var(--text);
}
.calc-step-badge {
  font-size: 10px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  background: var(--pool-light);
  color: var(--pool-deep);
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.calc-step-body {
  padding: 16px;
}
.calc-step-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 2px 0 8px;
}
.calc-step-line {
  width: 1.5px;
  height: 12px;
  background: var(--teal-border);
}

/* Summary line */
.calc-summary-line {
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text-2);
  padding: 9px 12px;
  background: var(--surface-2);
  border-radius: 6px;
  border: 1px solid var(--border);
  line-height: 1.5;
  margin-bottom: 12px;
}
.calc-summary-line:empty {
  display: none;
}

/* Rate helper text */
.calc-rate-helper {
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.4;
  margin-top: 4px;
  font-style: italic;
}

/* Two-column segmented control */
.calc-segmented-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}
.calc-segmented-2col .calc-seg-btn {
  border: none;
  border-radius: 0;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 4px;
  cursor: pointer;
  transition: background .15s, color .15s;
  font-family: 'DM Sans', sans-serif;
}
.calc-segmented-2col .calc-seg-btn + .calc-seg-btn {
  border-left: 1px solid var(--border);
}
.calc-segmented-2col .calc-seg-btn:hover:not(.active) {
  background: var(--surface);
  color: var(--text-2);
}

/* Three-column segmented control (rate modes) */
.calc-segmented-3col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}
.calc-segmented-3col .calc-seg-btn {
  border: none;
  border-radius: 0;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  padding: 8px 4px;
  cursor: pointer;
  transition: background .15s, color .15s;
  font-family: 'DM Sans', sans-serif;
}
.calc-segmented-3col .calc-seg-btn + .calc-seg-btn {
  border-left: 1px solid var(--border);
}
.calc-segmented-3col .calc-seg-btn:hover:not(.active) {
  background: var(--surface);
  color: var(--text-2);
}

/* Intro toggle row */
.calc-intro-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 14px;
  cursor: pointer;
  margin-bottom: 0;
}
.calc-intro-toggle-title {
  font-size: 13px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  margin-bottom: 2px;
}
.calc-intro-toggle-sub {
  font-size: 11px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text-3);
}
.calc-pill-switch {
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: var(--border);
  position: relative;
  flex-shrink: 0;
  transition: background .2s;
}
.calc-pill-switch.on {
  background: var(--pool);
}
.calc-pill-knob {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: left .2s;
}
.calc-pill-switch.on .calc-pill-knob {
  left: 21px;
}

/* Intro fields panel */
.calc-intro-panel {
  border: 1.5px solid var(--teal-border);
  border-top: 3px solid var(--pool);
  border-radius: 0 0 var(--r) var(--r);
  background: var(--pool-light);
  padding: 14px;
  margin-top: -1px;
}
.calc-intro-panel-label {
  font-size: 10px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  color: var(--pool-deep);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

/* Intro warning banner */
.calc-intro-warning {
  background: var(--sun-light);
  border: 1px solid #e8d5a0;
  border-left: 3px solid var(--sun);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: 9px 11px;
  font-size: 11px;
  font-family: 'DM Sans', sans-serif;
  color: var(--sun-deep);
  line-height: 1.5;
}

/* Section divider label */
.calc-section-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.calc-section-divider::before,
.calc-section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.calc-section-divider span {
  font-size: 10px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

/* Historical preset cards */
.calc-preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-bottom: 10px;
}
.calc-preset-card {
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  padding: 10px 12px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.calc-preset-card:hover {
  border-color: var(--teal-border);
  background: var(--pool-light);
}
.calc-preset-card.selected {
  border-color: var(--pool);
  background: var(--pool-light);
}
.calc-preset-name {
  font-size: 12px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  margin-bottom: 2px;
}
.calc-preset-range {
  font-size: 10px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text-3);
  margin-bottom: 5px;
}
.calc-preset-pills {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.calc-rate-pill {
  font-size: 10px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  padding: 2px 7px;
  border-radius: 999px;
}
.calc-rate-pill.start {
  background: var(--pool-light);
  color: var(--pool-deep);
  border: 1px solid var(--teal-border);
}
.calc-rate-pill.peak {
  background: #FDECEA;
  color: #9B1C1C;
  border: 1px solid #f5c0c0;
}
.calc-rate-pill.trough {
  background: var(--pool-light);
  color: var(--pool-deep);
  border: 1px solid var(--teal-border);
}

/* Mini bar chart preview */
.calc-mini-chart {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  margin-bottom: 10px;
}
.calc-mini-chart-label {
  font-size: 10px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.calc-mini-chart-bars {
  height: 36px;
  display: flex;
  align-items: flex-end;
  gap: 2px;
}
.calc-mini-bar {
  flex: 1;
  border-radius: 2px 2px 0 0;
  min-height: 3px;
  background: var(--pool-mid);
}
.calc-mini-bar.peak-bar {
  background: #9B1C1C;
}

/* Derived rate display (index + margin) */
.calc-derived-rate {
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text-2);
  margin-bottom: 12px;
  padding: 8px 0;
}
.calc-derived-value {
  font-size: 18px;
  font-family: 'Fraunces', serif;
  font-weight: 400;
  color: var(--pool-deep);
}

/* Simple trajectory shape buttons */
.calc-shape-btns {
  display: flex;
  gap: 6px;
}
.calc-shape-btn {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 7px 4px;
  font-size: 10px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  color: var(--text-3);
  background: var(--surface);
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, background .15s, color .15s;
}
.calc-shape-btn:hover:not(.active) {
  border-color: var(--border-2);
  color: var(--text-2);
}
.calc-shape-btn.active {
  border-color: var(--pool);
  background: var(--pool-light);
  color: var(--pool-deep);
}

/* Simple trajectory SVG preview */
.calc-trajectory-preview {
  margin-bottom: 10px;
}
.calc-trajectory-preview svg {
  width: 100%;
  height: 52px;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: block;
}
.calc-trajectory-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
}
.calc-trajectory-labels span {
  font-size: 10px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text-3);
}

/* Select dropdown */
.calc-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238A8278' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  cursor: pointer;
}

/* Sub-collapsible for manual schedule */
.calc-sub-collapse {
  margin-top: 8px;
  margin-bottom: 10px;
}
.calc-sub-header {
  font-size: 11px;
  padding: 8px 12px;
}

/* Tooltip system */
.info-btn {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1px solid var(--border-2);
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 300;
  font-size: 11px;
  color: var(--text-3);
  line-height: 1;
  transition: border-color .15s, background .15s, color .15s;
  margin-left: 5px;
  vertical-align: middle;
  flex-shrink: 0;
}
.info-btn:hover {
  border-color: var(--pool);
  color: var(--pool);
}
.info-btn.active {
  border-color: var(--pool);
  background: var(--pool);
  color: #fff;
}
.calc-tooltip-wrap {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  margin-bottom: 0;
  transition: max-height 220ms ease, opacity 180ms ease, margin-bottom 180ms ease;
}
.calc-tooltip-wrap.open {
  max-height: 200px;
  opacity: 1;
  margin-bottom: 10px;
}
.calc-tooltip-panel {
  background: var(--pool-deep);
  border-radius: var(--r);
  padding: 11px 13px;
  position: relative;
  margin-top: 6px;
}
.calc-tooltip-arrow {
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid var(--pool-deep);
  position: absolute;
  top: -6px;
  left: 14px;
}
.calc-tooltip-arrow.right {
  left: auto;
  right: 10px;
}
.calc-tooltip-panel p {
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  color: rgba(255,255,255,0.9);
  line-height: 1.55;
  margin: 0;
}
.calc-tooltip-panel strong {
  color: #fff;
  font-weight: 600;
}

.calc-sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Results panel */
.calc-results {
  flex: 1;
  padding: 24px 28px;
  overflow-y: auto;
}

.calc-results::-webkit-scrollbar { width: 4px; }
.calc-results::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 4px; }

/* Section label */
.calc-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 12px;
  margin-top: 8px;
}

/* Input group */
.calc-input-group {
  margin-bottom: 16px;
}

.calc-input-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 5px;
  display: block;
  font-family: 'DM Sans', sans-serif;
}

.calc-input-field {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s;
  box-sizing: border-box;
}

.calc-input-field:focus {
  outline: none;
  border-color: var(--teal-border);
  box-shadow: 0 0 0 3px rgba(11,123,138,.08);
}

/* Prefix/suffix wrappers */
.calc-input-prefix {
  display: flex;
  align-items: stretch;
}

.calc-input-prefix .calc-pfx {
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: var(--r-sm) 0 0 var(--r-sm);
  font-size: 13px;
  color: var(--text-3);
  font-weight: 500;
  display: flex;
  align-items: center;
  font-family: 'DM Sans', sans-serif;
}

.calc-input-prefix .calc-input-field {
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}

.calc-input-suffix {
  display: flex;
  align-items: stretch;
}

.calc-input-suffix .calc-sfx {
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: 13px;
  color: var(--text-3);
  font-weight: 500;
  display: flex;
  align-items: center;
  font-family: 'DM Sans', sans-serif;
}

.calc-input-suffix .calc-input-field {
  border-radius: var(--r-sm) 0 0 var(--r-sm);
}

/* Segmented control */
.calc-segmented {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  overflow: hidden;
}

.calc-seg-btn {
  flex: 1;
  padding: 7px 4px;
  font-size: 11.5px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  border: none;
  background: var(--surface);
  color: var(--text-3);
  text-align: center;
  border-right: 1px solid var(--border);
  transition: all .15s;
  line-height: 1.3;
}

.calc-seg-btn:last-child {
  border-right: none;
}

.calc-seg-btn.active {
  background: var(--pool);
  color: var(--white);
}

/* Override active state for 2-col loan type selector */
.calc-segmented-2col .calc-seg-btn.active {
  background: var(--pool-light);
  color: var(--pool-deep);
  border-top: 3px solid var(--sun);
}

/* Override active state for 3-col mode tabs */
.calc-segmented-3col .calc-seg-btn.active {
  background: var(--pool-light);
  color: var(--pool-deep);
  font-weight: 600;
}

.calc-seg-btn:hover:not(.active) {
  background: var(--surface-2);
}

/* Toggle */
.calc-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Payment toggle row */
.calc-payment-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.calc-payment-toggle-left {
  max-width: 75%;
  min-width: 0;
}
.calc-payment-toggle-title-row {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.calc-payment-toggle-title {
  font-size: 13px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
}
.calc-payment-toggle-sub {
  font-size: 11px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text-3);
  margin-top: 2px;
}

.calc-toggle-track {
  width: 36px;
  height: 20px;
  border-radius: 10px;
  background: var(--border);
  position: relative;
  cursor: pointer;
  transition: background .2s;
  flex-shrink: 0;
}

.calc-toggle-track.on {
  background: var(--pool);
}

.calc-toggle-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--white);
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform .2s;
  box-shadow: 0 1px 2px rgba(0,0,0,.12);
}

.calc-toggle-track.on .calc-toggle-thumb {
  transform: translateX(16px);
}

/* Helper text */
.calc-helper-text {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 4px;
  line-height: 1.5;
  font-family: 'DM Sans', sans-serif;
}

/* Calculate button */
.btn-calculate {
  width: 100%;
  padding: 10px;
  background: var(--sun);
  color: var(--white);
  border: none;
  border-radius: var(--r-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}

.btn-calculate:hover {
  background: var(--sun-hover);
}

.btn-secondary-row {
  display: flex;
  gap: 8px;
}

.btn-sm-calc {
  flex: 1;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  cursor: pointer;
  transition: all .15s;
}

.btn-sm-calc:hover {
  border-color: var(--border-2);
  color: var(--text-2);
}

/* Share button */
.btn-share {
  border-color: var(--sun);
  color: var(--sun-deep);
}

.btn-share:hover {
  background: var(--sun-light);
  border-color: var(--sun);
  color: var(--sun-deep);
}

.btn-share.share-copied {
  background: var(--sun);
  border-color: var(--sun);
  color: var(--white);
}

/* ═══════════════════════════════════
   RESULT CARDS
   ═══════════════════════════════════ */

.result-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 20px;
}

.result-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
}

.result-card.error {
  border-color: var(--urgent-border);
}

.result-card-status {
  display: flex;
  align-items: center;
  padding: 14px 16px;
}

.result-card-status-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}

.result-card-status .result-card-label {
  margin-bottom: 0;
  letter-spacing: .08em;
}

.result-card-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 7px;
  font-family: 'DM Sans', sans-serif;
}

.result-card-value {
  font-family: 'Fraunces', serif;
  font-size: 20px;
  font-weight: 400;
  color: var(--stone);
  letter-spacing: -.2px;
  line-height: 1.1;
  margin-bottom: 3px;
}

.result-card.error .result-card-value {
  color: var(--urgent-text);
}

.result-card-sub {
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.3;
  font-family: 'DM Sans', sans-serif;
}

/* Status badge */
.calc-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  white-space: nowrap;
}

.calc-badge.teal {
  background: var(--added-bg);
  color: var(--added-text);
}

.calc-badge.red {
  background: var(--urgent-bg);
  color: var(--urgent-text);
}

.calc-badge.amber {
  background: var(--priority-bg);
  color: var(--priority-text);
}

.calc-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

/* ═══════════════════════════════════
   PHASE TIMELINE
   ═══════════════════════════════════ */

.phase-timeline {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  margin-bottom: 20px;
}

.phase-timeline-title {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 12px;
  font-family: 'DM Sans', sans-serif;
}

.phase-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
}

.phase-segment {
  height: 100%;
}

.phase-labels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.phase-label {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.5;
  font-family: 'DM Sans', sans-serif;
}

.phase-label strong {
  font-weight: 600;
  color: var(--stone);
  font-size: 12px;
}

/* ═══════════════════════════════════
   CHARTS
   ═══════════════════════════════════ */

.chart-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  margin-bottom: 20px;
}

.chart-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.chart-tab {
  padding: 8px 14px;
  font-size: 11.5px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  color: var(--text-3);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.chart-tab:hover {
  color: var(--text-2);
}

.chart-tab.active {
  color: var(--pool-deep);
  border-bottom-color: var(--pool);
  font-weight: 600;
}

.chart-canvas-wrap {
  position: relative;
  height: 320px;
  min-width: 0;
}

@media (max-width: 639px) {
  .chart-tab {
    padding: 6px 10px;
    font-size: 11px;
  }
}

/* ═══════════════════════════════════
   COLLAPSIBLE SECTIONS
   ═══════════════════════════════════ */

.calc-collapsible {
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.calc-collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 0;
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-3);
  transition: color .15s;
}

.calc-collapsible-header:hover {
  color: var(--text-2);
}

.calc-chevron {
  transition: transform .2s;
  flex-shrink: 0;
}

.calc-collapsible.open > .calc-collapsible-header > .calc-chevron {
  transform: rotate(180deg);
}

.calc-collapsible-body {
  display: none;
  padding-bottom: 8px;
}

.calc-collapsible.open > .calc-collapsible-body {
  display: block;
}

/* ═══════════════════════════════════
   RATE SCHEDULE TABLE
   ═══════════════════════════════════ */

.rate-schedule-wrap {
  margin-top: 4px;
}

.rate-schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
}

.rate-schedule-table th {
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  padding: 4px 3px 6px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.rate-schedule-table th:last-child {
  width: 28px;
}

.rate-schedule-table td {
  padding: 2px 3px;
}

.rate-schedule-table input {
  width: 100%;
  padding: 5px 6px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 500;
  background: var(--surface);
  color: var(--text);
  box-sizing: border-box;
  transition: border-color .15s;
}

.rate-schedule-table input:focus {
  outline: none;
  border-color: var(--teal-border);
  box-shadow: 0 0 0 3px rgba(11,123,138,.08);
}

.btn-remove-row {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-3);
  font-size: 16px;
  padding: 2px 4px;
  line-height: 1;
  border-radius: var(--r-sm);
  transition: color .15s;
}

.btn-remove-row:hover {
  color: var(--urgent-text);
}

.btn-add-segment {
  display: block;
  width: 100%;
  padding: 6px;
  margin-top: 6px;
  border: 1px dashed var(--border);
  border-radius: var(--r-sm);
  background: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  cursor: pointer;
  transition: all .15s;
}

.btn-add-segment:hover {
  border-color: var(--pool);
  color: var(--pool);
}

.calc-schedule-error {
  font-size: 11px;
  color: var(--urgent-text);
  margin-top: 4px;
  line-height: 1.5;
  font-family: 'DM Sans', sans-serif;
}

/* ═══════════════════════════════════
   AMORTIZATION TABLE
   ═══════════════════════════════════ */

.amort-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 20px;
  overflow: hidden;
}

.amort-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.amort-title {
  font-family: 'Fraunces', serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--stone);
}

.amort-actions {
  display: flex;
  gap: 8px;
}

.btn-amort-csv,
.btn-amort-toggle {
  padding: 5px 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text-3);
  cursor: pointer;
  transition: all .15s;
}

.btn-amort-csv:hover,
.btn-amort-toggle:hover {
  border-color: var(--pool);
  color: var(--pool);
}

.amort-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.amort-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
}

.amort-table thead th {
  position: sticky;
  top: 0;
  background: var(--limestone);
  padding: 8px 10px;
  text-align: right;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-3);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  z-index: 2;
}

.amort-table thead th:first-child,
.amort-table thead th:nth-child(2),
.amort-table thead th:nth-child(3) {
  text-align: left;
}

.amort-table td {
  padding: 6px 10px;
  text-align: right;
  color: var(--text-2);
  border-bottom: 1px solid rgba(0,0,0,.04);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.amort-table td:first-child {
  text-align: left;
  font-weight: 600;
  color: var(--text);
}

.amort-table td:nth-child(2),
.amort-table td:nth-child(3) {
  text-align: left;
}

/* Sticky month column */
.amort-sticky-col {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
}

.amort-table thead .amort-sticky-col {
  z-index: 3;
  background: var(--limestone);
}

/* Phase divider rows */
.amort-divider td {
  background: rgba(11, 123, 138, .08);
  color: var(--pool-deep);
  font-weight: 600;
  font-size: 11px;
  text-align: left;
  padding: 5px 10px;
  letter-spacing: .02em;
  border-bottom: 1px solid rgba(11, 123, 138, .15);
}

/* Payoff row */
.amort-payoff td {
  background: rgba(6, 95, 70, .06);
  color: var(--stone);
  font-weight: 600;
}

.amort-payoff .amort-sticky-col {
  background: rgba(6, 95, 70, .06);
}

/* Negative amortization indicator */
.amort-negam td {
  color: var(--urgent-text);
}

.amort-negam-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--urgent-text);
  margin-right: 4px;
  vertical-align: middle;
}

/* Show more button */
.btn-show-more {
  display: block;
  width: 100%;
  padding: 10px;
  border: none;
  border-top: 1px solid var(--border);
  background: var(--limestone);
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--pool);
  cursor: pointer;
  transition: background .15s;
}

.btn-show-more:hover {
  background: rgba(11, 123, 138, .06);
}

.amort-phase-cell {
  font-size: 11px;
  color: var(--text-3);
}

/* ── View toggle (By year / By month) ── */
.amort-view-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 2px;
  background: var(--limestone, var(--surface-2));
}

.amort-view-btn {
  padding: 4px 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  background: transparent;
  border: none;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: background .15s, color .15s;
}

.amort-view-btn:hover {
  color: var(--pool);
}

.amort-view-btn.active {
  background: var(--surface);
  color: var(--pool-deep);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}

/* ── Context note above table ── */
.amort-context-note {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  color: var(--text-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-style: italic;
}

.amort-context-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pool);
  flex-shrink: 0;
}

/* ── Yearly view: year row ── */
.amort-year-row {
  cursor: pointer;
  transition: background .15s;
}

.amort-year-row:hover {
  background: rgba(11, 123, 138, .04);
}

.amort-year-row.open {
  background: rgba(11, 123, 138, .06);
}

.amort-year-arrow {
  width: 30px;
  text-align: center !important;
  color: var(--text-3);
  padding-left: 10px !important;
}

.amort-year-row.open .amort-year-arrow {
  color: var(--pool);
}

.amort-period-cell {
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
}

.amort-interest-val {
  color: var(--phase-2);
  font-variant-numeric: tabular-nums;
}

.amort-principal-val {
  color: var(--phase-3);
  font-variant-numeric: tabular-nums;
}

.amort-table thead .amort-col-interest {
  color: var(--phase-2);
}

.amort-table thead .amort-col-principal {
  color: var(--phase-3);
}

/* ── Phase pill (year view) ── */
.amort-phase-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  border-radius: var(--r-pill);
  background: rgba(11, 123, 138, .10);
  color: var(--pool-deep);
  text-transform: none;
  letter-spacing: .02em;
  white-space: nowrap;
}

.amort-phase-badge.amort-phase-transition {
  background: var(--priority-bg);
  color: var(--priority-text);
}

/* ── Expanded monthly child rows under a year ── */
.amort-month-row td {
  background: rgba(245, 240, 230, .35);
  font-size: 11px;
  color: var(--text-3);
  border-bottom: 1px dashed rgba(0,0,0,.04);
}

.amort-month-row td:nth-child(2) {
  padding-left: 28px !important;
  color: var(--text-2);
  font-weight: 500;
}

.amort-month-row.amort-negam td {
  color: var(--urgent-text);
}

.amort-month-row.amort-payoff td {
  background: rgba(6, 95, 70, .06);
  color: var(--stone);
  font-weight: 600;
}

/* ── Summary bar below table ── */
.amort-summary-bar {
  display: flex;
  gap: 0;
  padding: 0;
  background: var(--limestone, var(--surface-2));
  border-top: 1px solid var(--border);
}

.amort-summary-cell {
  flex: 1;
  padding: 12px 16px;
  border-right: 1px solid var(--border);
  font-family: 'DM Sans', sans-serif;
}

.amort-summary-cell:last-child {
  border-right: none;
}

.amort-summary-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-3);
  margin-bottom: 2px;
}

.amort-summary-value {
  font-family: 'Fraunces', serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--stone);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 640px) {
  .amort-summary-bar {
    flex-direction: column;
  }
  .amort-summary-cell {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .amort-summary-cell:last-child {
    border-bottom: none;
  }
  .amort-summary-value {
    font-size: 16px;
  }
  .amort-view-btn {
    padding: 4px 10px;
    font-size: 10px;
  }
}

/* ═══════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════ */

.calc-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 360px;
  text-align: center;
  color: var(--text-3);
}

.calc-empty-icon {
  margin-bottom: 16px;
  opacity: .4;
}

.calc-empty-title {
  font-family: 'Fraunces', serif;
  font-size: 20px;
  font-weight: 400;
  font-style: italic;
  color: var(--stone);
  margin-bottom: 8px;
}

.calc-empty-sub {
  font-size: 13px;
  line-height: 1.6;
  max-width: 320px;
  font-family: 'DM Sans', sans-serif;
}

/* Warning */
.calc-warning-banner {
  font-size: 12px;
  color: var(--sun-deep);
  background: var(--sun-light);
  border: 1px solid #E8D4A8;
  border-radius: var(--r-sm);
  padding: 10px 14px;
  margin-bottom: 16px;
  line-height: 1.6;
  font-family: 'DM Sans', sans-serif;
}

.calc-warning-banner strong {
  font-weight: 600;
}

.calc-warning-negam {
  color: var(--urgent-text);
  background: var(--urgent-bg);
  border-color: #FECACA;
}

/* Inline payment warning */
.calc-inline-warning {
  font-size: 11px;
  color: var(--urgent-text);
  background: var(--urgent-bg);
  border: 1px solid #FECACA;
  border-radius: var(--r-sm);
  padding: 6px 10px;
  margin-top: 6px;
  line-height: 1.5;
  font-family: 'DM Sans', sans-serif;
}

/* Rate assumption note */
.calc-rate-assumption {
  font-size: 11px;
  color: var(--text-3);
  font-style: italic;
  margin-bottom: 16px;
  line-height: 1.5;
  font-family: 'DM Sans', sans-serif;
  padding: 0 2px;
}

/* Disclaimer */
.calc-disclaimer {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 20px;
  line-height: 1.7;
  max-width: 640px;
  font-family: 'DM Sans', sans-serif;
}

/* ═══════════════════════════════════
   COMPARISON MODE
   ═══════════════════════════════════ */

.btn-compare {
  padding: 6px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}

.btn-compare:hover {
  background: rgba(255,255,255,.15);
}

.calc-subheader {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.compare-view {
  margin-top: 20px;
}

.compare-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.btn-back-single {
  padding: 7px 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all .15s;
}

.btn-back-single:hover {
  border-color: var(--pool);
  color: var(--pool);
}

.btn-add-scenario {
  padding: 7px 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--white);
  background: var(--pool);
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background .15s;
}

.btn-add-scenario:hover {
  background: var(--pool-deep);
}

.compare-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.compare-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.compare-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.compare-name {
  font-family: 'Fraunces', serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--stone);
  border: none;
  background: none;
  padding: 2px 4px;
  border-radius: var(--r-sm);
  width: 100%;
  min-width: 0;
}

.compare-name:focus {
  outline: none;
  background: var(--limestone);
}

.compare-card-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.btn-sc-edit,
.btn-sc-dup,
.btn-sc-remove {
  padding: 3px 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text-3);
  cursor: pointer;
  transition: all .15s;
}

.btn-sc-edit:hover { border-color: var(--pool); color: var(--pool); }
.btn-sc-dup:hover { border-color: var(--pool); color: var(--pool); }
.btn-sc-remove { border-color: transparent; }
.btn-sc-remove:hover { color: var(--urgent-text); }

.compare-summary {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 8px;
}

.compare-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 10px 0;
}

.compare-metric-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-3);
  display: block;
}

.compare-metric-value {
  font-family: 'Fraunces', serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--stone);
  display: block;
  line-height: 1.3;
}

.compare-metric-sub {
  font-family: 'DM Sans', sans-serif;
  font-size: 10px;
  color: var(--text-3);
  display: block;
}

.compare-timeline {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.compare-mobile-selector {
  display: none;
  margin-bottom: 12px;
}

.compare-mobile-selector select {
  width: 100%;
  padding: 8px 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
}

/* ═══════════════════════════════════
   SLIDE-OVER PANEL
   ═══════════════════════════════════ */

.slideover {
  position: fixed;
  inset: 0;
  z-index: 100;
}

.slideover-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.35);
}

.slideover-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 380px;
  max-width: 100%;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 24px rgba(0,0,0,.1);
  animation: slideIn .2s ease;
}

@keyframes slideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.slideover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

.slideover-title {
  font-family: 'Fraunces', serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--stone);
  margin: 0;
}

.slideover-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-3);
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
}

.slideover-close:hover {
  color: var(--text);
}

.slideover-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.so-group {
  margin-bottom: 14px;
}

.so-label {
  display: block;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-3);
  margin-bottom: 5px;
}

.slideover-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
}

.btn-so-save {
  flex: 1;
  padding: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--white);
  background: var(--pool);
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background .15s;
}

.btn-so-save:hover { background: var(--pool-deep); }

.btn-so-cancel {
  padding: 10px 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
}

.btn-so-cancel:hover { border-color: var(--text-3); }

/* Sidebar collapse toggle (tablet/mobile) */
.calc-sidebar-collapse-btn {
  display: none;
  width: 100%;
  padding: 10px 20px;
  background: var(--surface-2);
  border: none;
  border-bottom: 1px solid var(--border);
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  text-align: left;
  align-items: center;
  justify-content: space-between;
}

.calc-sidebar-collapse-btn:hover {
  color: var(--pool);
}

.calc-sidebar.collapsed .calc-chevron {
  transform: rotate(180deg);
}

/* ═══════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════ */

/* Tablet + Mobile: sidebar stacks on top */
@media (max-width: 1023px) {
  .calc-app {
    flex-direction: column;
  }

  .calc-sidebar {
    width: 100%;
    min-width: 0;
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .calc-sidebar-collapse-btn {
    display: flex;
  }

  .compare-mobile-selector {
    display: block;
  }
  .compare-card {
    display: none;
  }
  .compare-card.mobile-active {
    display: flex;
  }
}

/* Mobile: single column */
@media (max-width: 767px) {
  .calc-subheader {
    padding: 10px 16px;
  }

  .calc-subheader-title {
    font-size: 15px;
  }

  .calc-sidebar-body {
    padding: 16px;
  }

  .calc-results {
    padding: 16px;
  }

  .result-card {
    padding: 12px 14px;
  }

  .result-card-value {
    font-size: 18px;
  }

  .phase-labels {
    grid-template-columns: 1fr;
  }

  .chart-canvas-wrap {
    height: 240px;
    min-height: 200px;
  }

  .chart-tab {
    padding: 6px 8px;
    font-size: 10px;
  }

  .compare-header {
    flex-direction: column;
    align-items: stretch;
  }

  .compare-columns {
    grid-template-columns: 1fr;
  }

  .compare-view {
    margin-top: 12px;
    padding: 0 16px;
  }

  .amort-table {
    font-size: 11px;
  }

  .amort-table td {
    padding: 5px 8px;
  }

  .amort-header {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }

  .slideover-panel {
    width: 100%;
  }

  .calc-disclaimer {
    font-size: 10px;
  }
}

/* Tiny: narrow screens */
@media (max-width: 480px) {
  .chart-canvas-wrap {
    height: 200px;
  }

  .result-card-value {
    font-size: 16px;
  }

  .calc-sidebar-body {
    padding: 12px;
  }

  .calc-results {
    padding: 12px;
  }
}
