/* ==========================================================================
   THE DEBT ERASER: Warm Obsidian & International Orange Architecture
   Design System: Refined Warm Minimalist Fintech (Human-Crafted Editorial)
   ========================================================================== */

:root {
  /* Canvas & Warm Obsidian Surfaces */
  --bg-app: #0c0a09;             /* Warm Stone 950 / Smoked Obsidian */
  --bg-card: #141210;            /* Rich Warm Charcoal */
  --bg-card-hover: #1c1917;      /* Stone 900 */
  --bg-surface: #1f1b18;         /* Warm Surface */
  --bg-surface-raised: #292524;  /* Stone 800 */
  --bg-input: #080706;            /* Deep Well Input */
  --bg-input-focus: #171412;

  /* Border System: Warm Subtle Hairlines */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.11);
  --border-hover: rgba(255, 255, 255, 0.22);
  --border-active: #ff6a00;      /* Signature Flame Orange */

  /* Typography */
  --text-primary: #fafaf9;       /* Stone 50 (Crisp Warm White) */
  --text-secondary: #a8a29e;     /* Stone 400 (Warm Muted) */
  --text-muted: #78716c;         /* Stone 500 */
  --text-subtle: #57534e;        /* Stone 600 */
  --text-inverse: #0c0a09;

  /* Warm Orange & Amber Semantic Palette */
  --accent-primary: #ff6a00;       /* Signature Vibrant Flame Orange */
  --accent-primary-hover: #ea580c; /* Deep International Orange */
  --accent-primary-dim: rgba(255, 106, 0, 0.12);
  --accent-primary-border: rgba(255, 106, 0, 0.35);

  --accent-orange: #f97316;
  --accent-orange-dim: rgba(249, 115, 22, 0.12);
  --accent-orange-border: rgba(249, 115, 22, 0.3);

  --accent-amber: #f59e0b;
  --accent-amber-dim: rgba(245, 158, 11, 0.12);
  --accent-amber-border: rgba(245, 158, 11, 0.3);

  --accent-emerald: #10b981;
  --accent-emerald-dim: rgba(16, 185, 129, 0.12);
  --accent-emerald-border: rgba(16, 185, 129, 0.3);

  --accent-rose: #f43f5e;
  --accent-rose-dim: rgba(244, 63, 94, 0.12);
  --accent-rose-border: rgba(244, 63, 94, 0.3);

  --font-family: 'Inter', 'Prompt', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;

  /* Geometry */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-full: 9999px;

  /* Elevation & Depth */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 2px 5px 0 rgba(0, 0, 0, 0.4);
  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.5), 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-raised: 0 16px 40px -4px rgba(0, 0, 0, 0.65), 0 2px 6px 0 rgba(0, 0, 0, 0.4);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.05);

  --transition-fast: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-family);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

/* Subtle warm architectural grid */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.012) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.012) 1px, transparent 1px);
  background-size: 36px 36px;
  pointer-events: none;
  z-index: -1;
}

/* App Container */
.app-container {
  max-width: 1560px;
  margin: 0 auto;
  padding: 1.5rem 1.75rem 3.5rem;
}

/* Header */
.kiosk-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 1.25rem;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #ff6a00, #ea580c);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 14px rgba(255, 106, 0, 0.3), var(--shadow-inset);
  flex-shrink: 0;
}

.brand-info h1 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-primary);
}

.brand-info h1 .badge {
  font-size: 0.65rem;
  font-weight: 700;
  background: var(--bg-surface);
  color: var(--accent-primary);
  border: 1px solid var(--accent-primary-border);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.brand-subtitle {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 400;
  margin-top: 1px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.lang-switcher {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
  box-shadow: var(--shadow-inset);
}

.btn-lang {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: var(--font-mono);
  line-height: 1;
}

.btn-lang:hover {
  color: var(--text-primary);
}

.btn-lang.active {
  background: var(--bg-surface-raised);
  color: var(--text-primary);
  border-color: var(--border-default);
  box-shadow: var(--shadow-xs);
}

.btn-action {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: var(--transition-fast);
  box-shadow: var(--shadow-inset);
}

.btn-action:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.btn-action.btn-qr {
  background: var(--accent-primary-dim);
  border-color: var(--accent-primary-border);
  color: #fb923c;
}

.btn-action.btn-qr:hover {
  background: rgba(255, 106, 0, 0.22);
  border-color: var(--accent-primary);
  color: #fdba74;
}

/* Preset Scenarios Section */
.presets-container {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.25rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-card), var(--shadow-inset);
}

.presets-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.presets-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.preset-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
}

.preset-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.1rem;
  cursor: pointer;
  text-align: left;
  transition: var(--transition-fast);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-inset);
}

.preset-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.preset-card.active {
  border-color: var(--accent-primary);
  background: rgba(255, 106, 0, 0.08);
}

.preset-card.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--accent-primary);
}

.preset-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.preset-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.preset-card.active .preset-icon {
  color: var(--accent-primary);
  background: rgba(255, 106, 0, 0.16);
}

.preset-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Two-column Main Grid */
.main-grid {
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 1.75rem;
  align-items: start;
}

/* Left Column: Inputs & Controls */
.control-panel {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow-card), var(--shadow-inset);
}

.card-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-primary);
}

.badge-count {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
}

/* Quick Add Chips */
.quick-add-group {
  margin-bottom: 1.15rem;
}

.quick-add-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  box-shadow: var(--shadow-inset);
}

.chip-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-primary-border);
  color: var(--text-primary);
  transform: translateY(-1px);
}

/* Debt List Container */
.debt-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 4px;
}

.debt-list::-webkit-scrollbar {
  width: 5px;
}

.debt-list::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 4px;
}

.empty-debt-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  border: 1px dashed var(--border-default);
  border-radius: var(--radius-md);
}

.debt-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 0.95rem;
  position: relative;
  transition: var(--transition-fast);
  box-shadow: var(--shadow-inset);
}

.debt-item:hover {
  border-color: var(--border-hover);
}

.debt-item.student-loan-item {
  border-left: 3px solid var(--accent-amber);
}

.debt-item.high-rate-item {
  border-left: 3px solid var(--accent-rose);
}

.debt-item.negative-amort-item {
  border-left: 3px solid var(--accent-primary);
}

.debt-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
  gap: 0.5rem;
}

.debt-name-input {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.88rem;
  width: 100%;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

.debt-name-input:focus {
  background: var(--bg-input-focus);
  border-color: var(--border-default);
  outline: none;
}

.debt-delete-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.debt-delete-btn:hover {
  color: var(--accent-rose);
  background: var(--accent-rose-dim);
  border-color: var(--accent-rose-border);
}

.debt-grid-inputs {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 0.55rem;
  margin-bottom: 0.55rem;
}

.input-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.input-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.input-box {
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  transition: var(--transition-fast);
  width: 100%;
}

.input-box:focus {
  border-color: var(--accent-primary);
  background: var(--bg-input-focus);
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 106, 0, 0.2);
}

.min-type-toggle {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.35rem;
  background: var(--bg-input);
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.min-type-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 500;
}

.min-type-select {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.75rem;
  font-family: var(--font-family);
  cursor: pointer;
  outline: none;
  flex: 1;
}

.min-type-select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

.input-fixed-amount {
  width: 85px;
  padding: 2px 6px;
  font-size: 0.75rem;
}

.debt-footer-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--border-subtle);
}

.fixed-options-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.disallow-extra-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.68rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  background: var(--bg-surface);
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  transition: var(--transition-fast);
}

.disallow-extra-toggle:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.disallow-extra-toggle input[type="checkbox"] {
  accent-color: var(--accent-primary);
  cursor: pointer;
}

.debt-item.fixed-loan-item {
  border-left: 3px solid #38bdf8;
}

.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}

.dot-amber { background-color: var(--accent-amber); }
.dot-rose { background-color: var(--accent-rose); }
.dot-orange { background-color: var(--accent-primary); }
.dot-cyan { background-color: #38bdf8; }
.dot-neutral { background-color: var(--text-muted); }

.debt-est-interest {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}

.debt-est-interest strong {
  color: var(--text-primary);
  font-weight: 600;
}

.btn-add-debt {
  width: 100%;
  background: var(--bg-surface);
  border: 1px dashed var(--border-default);
  color: var(--text-secondary);
  padding: 0.65rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  margin-top: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.btn-add-debt:hover {
  background: var(--bg-card-hover);
  color: var(--accent-primary);
  border-color: var(--accent-primary-border);
}

/* Extra Monthly Cash Slider & Fillable Input */
.slider-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.slider-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.extra-cash-input-box {
  display: inline-flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.6rem;
  transition: var(--transition-fast);
  box-shadow: var(--shadow-xs);
}

.extra-cash-input-box:focus-within {
  border-color: var(--accent-primary);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 2px rgba(255, 106, 0, 0.25);
}

.extra-cash-input-box .currency-symbol {
  font-size: 1.15rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent-primary);
  margin-right: 2px;
  user-select: none;
}

.extra-cash-number-input {
  background: transparent;
  border: none;
  outline: none;
  font-size: 1.15rem;
  font-weight: 700;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--accent-primary);
  width: 95px;
  text-align: right;
  padding: 0 4px;
  -moz-appearance: textfield;
  appearance: textfield;
}

.extra-cash-number-input::-webkit-outer-spin-button,
.extra-cash-number-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.extra-cash-input-box .unit-text {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 5px;
  white-space: nowrap;
  user-select: none;
}

.slider-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-raised);
  outline: none;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
}

.slider-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--accent-primary);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  transition: var(--transition-fast);
}

.slider-range::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 0 0 4px rgba(255, 106, 0, 0.25);
}

.slider-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.strategy-section {
  margin-top: 1.35rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

/* Strategy Segmented Control */
.strategy-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
  background: var(--bg-input);
  padding: 0.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
}

.strategy-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 0.65rem 0.4rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.strategy-btn span.tag {
  font-size: 0.65rem;
  font-weight: 400;
  color: var(--text-muted);
}

.strategy-btn:hover {
  color: var(--text-primary);
}

.strategy-btn.active {
  background: var(--bg-surface-raised);
  color: var(--text-primary);
  border-color: var(--border-default);
  box-shadow: var(--shadow-xs);
}

.strategy-btn.active.strat-minimum {
  border-color: var(--accent-rose);
  border-bottom: 2px solid var(--accent-rose);
  background: rgba(244, 63, 94, 0.08);
}
.strategy-btn.active.strat-minimum span.tag {
  color: #fda4af;
  font-weight: 500;
}

.strategy-btn.active.strat-snowball {
  border-color: #38bdf8;
  border-bottom: 2px solid #38bdf8;
  background: rgba(56, 189, 248, 0.08);
}
.strategy-btn.active.strat-snowball span.tag {
  color: #7dd3fc;
  font-weight: 500;
}

.strategy-btn.active.strat-avalanche {
  border-color: var(--accent-primary);
  border-bottom: 2px solid var(--accent-primary);
  background: rgba(255, 106, 0, 0.08);
}
.strategy-btn.active.strat-avalanche span.tag {
  color: #fdba74;
  font-weight: 500;
}

/* Refinancing / Debt Clinic Alert Card */
.clinic-alert-card {
  border-radius: var(--radius-lg);
  padding: 1rem 1.15rem;
  transition: var(--transition);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-card);
}

.clinic-alert-card.alert-triggered {
  background: rgba(192, 132, 252, 0.08);
  border-color: rgba(192, 132, 252, 0.4);
  box-shadow: 0 0 16px rgba(192, 132, 252, 0.1);
}

.clinic-alert-card.alert-triggered .clinic-icon {
  color: #c084fc;
  background: rgba(192, 132, 252, 0.18);
  border: 1px solid rgba(192, 132, 252, 0.3);
}

.clinic-alert-card.alert-savings {
  background: rgba(192, 132, 252, 0.09);
  border-color: rgba(192, 132, 252, 0.45);
  box-shadow: 0 0 18px rgba(192, 132, 252, 0.14);
}

.clinic-alert-card.alert-savings .clinic-icon {
  color: #c084fc;
  background: rgba(192, 132, 252, 0.2);
  border: 1px solid rgba(192, 132, 252, 0.35);
}

.clinic-alert-card.alert-tradeoff {
  background: rgba(192, 132, 252, 0.06);
  border-color: rgba(192, 132, 252, 0.3);
}

.clinic-alert-card.alert-tradeoff .clinic-icon {
  color: #c084fc;
  background: rgba(192, 132, 252, 0.15);
}

.clinic-alert-card.alert-calm {
  background: var(--bg-surface);
  border-color: var(--border-subtle);
}

.clinic-alert-card.alert-calm .clinic-icon {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
}

.clinic-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.clinic-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.clinic-content-text {
  flex: 1;
}

.clinic-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.clinic-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.clinic-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
}

.switch-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
}

.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-switch {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-input);
  border: 1px solid var(--border-default);
  transition: .2s;
  border-radius: 22px;
}

.slider-switch:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: var(--text-muted);
  transition: .2s;
  border-radius: 50%;
}

input:checked + .slider-switch {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
}

#refinance-toggle:checked + .slider-switch {
  background-color: #c084fc;
  border-color: #c084fc;
  box-shadow: 0 0 10px rgba(192, 132, 252, 0.4);
}

input:checked + .slider-switch:before {
  transform: translateX(18px);
  background-color: #ffffff;
}

/* Right Column: Visual Dashboard */
.dashboard-panel {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}

/* KPI Stat Cards */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.25rem;
  position: relative;
  overflow: hidden;
  transition: var(--transition-fast);
  box-shadow: var(--shadow-card), var(--shadow-inset);
}

.kpi-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border-default);
}

.kpi-card.highlight-savings::before {
  background: var(--accent-primary);
}

.kpi-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.kpi-number {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.kpi-card.highlight-savings .kpi-number {
  color: #ff6a00;
}

.kpi-subtext {
  font-size: 0.72rem;
  margin-top: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.kpi-subtext.positive {
  color: #fb923c;
}

.kpi-subtext.negative {
  color: var(--accent-rose);
}

.kpi-subtext.neutral {
  color: var(--text-muted);
}

/* Chart Card */
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow-card), var(--shadow-inset);
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.chart-title-box h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.chart-title-box p {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.chart-view-tabs {
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 2px;
  gap: 2px;
}

.chart-view-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
}

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

.chart-view-tab.active {
  background: var(--bg-surface-raised);
  color: var(--text-primary);
  border-color: var(--border-default);
  box-shadow: var(--shadow-xs);
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.75rem;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.legend-line {
  width: 14px;
  height: 3px;
  border-radius: 2px;
}

.legend-line.baseline {
  background: var(--accent-rose);
  border-top: 1px dashed var(--accent-rose);
}

.legend-line.snowball {
  background: #38bdf8;
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.4);
}

.legend-line.avalanche {
  background: #ff6a00;
  box-shadow: 0 0 6px rgba(255, 106, 0, 0.4);
}

.legend-line.refinanced {
  background: #c084fc;
  box-shadow: 0 0 8px rgba(192, 132, 252, 0.6);
}

.legend-item.active {
  color: var(--text-primary);
  font-weight: 700;
}

.legend-item.inactive {
  opacity: 0.55;
}

.chart-wrapper {
  position: relative;
  height: 310px;
  width: 100%;
}

/* Knockout Milestones Sequence */
.milestones-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow-card), var(--shadow-inset);
}

.milestones-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.milestones-track {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding: 0.5rem 0.15rem 0.65rem;
}

.milestones-track::-webkit-scrollbar {
  height: 5px;
}

.milestones-track::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 4px;
}

.no-milestones-state {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0.5rem 0;
}

.milestone-badge {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.95rem;
  min-width: 170px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  position: relative;
  transition: var(--transition-fast);
  box-shadow: var(--shadow-inset);
}

.milestone-badge:hover {
  transform: translateY(-1px);
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}

.milestone-top {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.milestone-badge-num {
  font-size: 0.65rem;
  font-weight: 700;
  font-family: var(--font-mono);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--accent-primary);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.milestone-month {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.milestone-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.milestone-tag {
  font-size: 0.68rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  align-self: flex-start;
}

.milestone-tag.tag-paid {
  color: #fb923c;
  background: var(--accent-primary-dim);
  border: 1px solid var(--accent-primary-border);
}

.milestone-tag.tag-complete {
  color: #ff6a00;
  background: rgba(255, 106, 0, 0.16);
  border: 1px solid var(--accent-primary);
}

/* Summary Comparison Table */
.matrix-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.35rem;
  overflow-x: auto;
  box-shadow: var(--shadow-card), var(--shadow-inset);
}

.matrix-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.8rem;
}

.matrix-table th {
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border-default);
}

.matrix-table td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.matrix-table tr:last-child td {
  border-bottom: none;
}

.matrix-table td.col-metric {
  font-family: var(--font-family);
  font-weight: 500;
  color: var(--text-secondary);
}

.matrix-table td.col-active {
  background: rgba(255, 106, 0, 0.07);
  font-weight: 600;
}

.matrix-table th.col-active {
  color: var(--accent-primary);
  border-bottom: 2px solid var(--accent-primary);
}

.matrix-table td.highlight-best {
  color: var(--accent-primary);
  font-weight: 700;
}

/* Educational Callout */
.edu-callout {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.25rem;
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  box-shadow: var(--shadow-card), var(--shadow-inset);
}

.edu-callout-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: rgba(255, 106, 0, 0.12);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.edu-callout-content h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.edu-callout-content p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Modal for QR Code & Sharing */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(8, 7, 6, 0.82);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: 2rem 1.75rem;
  width: 90%;
  max-width: 420px;
  text-align: center;
  box-shadow: var(--shadow-raised);
  position: relative;
}

.modal-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

.modal-close-btn:hover {
  color: var(--text-primary);
  background: var(--bg-surface);
}

.modal-header-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  color: var(--accent-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  color: var(--text-primary);
}

.modal-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.qr-box {
  background: #ffffff;
  padding: 1rem;
  border-radius: var(--radius-md);
  display: inline-block;
  margin: 1.25rem auto 1rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.qr-box canvas, .qr-box img {
  display: block;
  margin: 0 auto;
}

.qr-url-box {
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.qr-url-box span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-copy {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition-fast);
}

.btn-copy:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-primary-border);
  color: var(--accent-primary);
}

/* Responsive Breakpoints */
@media (max-width: 1100px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
  .preset-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-container {
    padding: 1rem 1rem 2.5rem;
  }
  .kpi-row {
    grid-template-columns: 1fr;
  }
  .chart-wrapper {
    height: 240px;
  }
}
