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

:root {
  --navy: #1a1f36;
  --navy-mid: #252b45;
  --green: #00c896;
  --green-light: #e6faf5;
  --red: #e74c3c;
  --yellow: #f59e0b;
  --blue: #3b82f6;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-400: #94a3b8;
  --gray-600: #475569;
  --gray-800: #1e293b;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--gray-100);
  color: var(--gray-800);
  min-height: 100vh;
  font-size: 14px;
}

/* HEADER */
header {
  background: var(--navy);
  color: white;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--green);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.header-tagline {
  font-size: 13px;
  color: #8892b0;
  font-weight: 400;
}

/* MAIN LAYOUT */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px;
  display: grid;
  grid-template-columns: 340px 1fr;
  grid-template-rows: auto;
  gap: 20px;
}

/* SIDEBAR */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* CARDS */
.card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-400);
  margin-bottom: 14px;
}

/* DEBT LIST */
.debt-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.debt-list-header .card-title { margin-bottom: 0; }

#debt-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
}

.debt-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--gray-50);
  border-radius: 8px;
  border: 1px solid var(--gray-200);
  transition: background 0.15s;
}

.debt-item:hover { background: var(--gray-100); }

.debt-color {
  width: 10px;
  height: 32px;
  border-radius: 4px;
  flex-shrink: 0;
}

.debt-info {
  flex: 1;
  min-width: 0;
}

.debt-name {
  display: block;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--gray-800);
}

.debt-type-tag {
  font-size: 11px;
  color: var(--gray-400);
}

.debt-numbers {
  text-align: right;
  flex-shrink: 0;
}

.debt-balance {
  display: block;
  font-weight: 700;
  font-size: 13px;
  color: var(--gray-800);
}

.debt-apr {
  font-size: 11px;
  color: var(--red);
  font-weight: 600;
}

.remove-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  font-size: 12px;
  padding: 4px;
  border-radius: 4px;
  flex-shrink: 0;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}

.remove-btn:hover { color: var(--red); background: #fef2f2; }

/* ADD DEBT BUTTON */
.add-btn {
  width: 100%;
  padding: 10px;
  background: var(--green-light);
  border: 1.5px dashed var(--green);
  border-radius: 8px;
  color: #00a07a;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  margin-top: 10px;
  transition: background 0.15s;
}

.add-btn:hover { background: #ccf5ea; }

/* EXTRA PAYMENT */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-600);
}

.input-wrapper {
  position: relative;
}

.input-prefix {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-weight: 600;
}

.input-wrapper input {
  width: 100%;
  padding: 10px 12px 10px 24px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  outline: none;
  transition: border-color 0.15s;
}

.input-wrapper input:focus { border-color: var(--green); }

.input-hint {
  font-size: 11px;
  color: var(--gray-400);
}

/* STRATEGY SELECTOR */
.strategy-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.strategy-btn {
  padding: 10px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  background: white;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
  font-family: inherit;
}

.strategy-btn.active {
  border-color: var(--green);
  background: var(--green-light);
  color: #00876b;
}

.strategy-btn strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 2px;
}

.strategy-btn span {
  font-size: 11px;
  color: var(--gray-400);
  line-height: 1.3;
  display: block;
}

.strategy-btn.active span { color: #00a07a; }

/* STRATEGY INSIGHT */
.strategy-insight {
  font-size: 12px;
  color: var(--gray-600);
  line-height: 1.5;
  padding: 10px;
  background: #fffbeb;
  border-radius: 8px;
  border-left: 3px solid var(--yellow);
  margin-top: 4px;
}

/* RIGHT PANEL */
.right-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* SUMMARY CARDS */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.summary-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

.summary-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-400);
  margin-bottom: 6px;
}

.summary-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1;
  letter-spacing: -0.5px;
}

.summary-value.green { color: var(--green); }
.summary-value.red { color: var(--red); }

.summary-sub {
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 4px;
}

/* CHART */
.chart-wrap {
  height: 280px;
  position: relative;
}

/* SCHEDULE TABLE */
.schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.schedule-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-400);
  border-bottom: 1px solid var(--gray-200);
}

.schedule-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

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

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
  flex-shrink: 0;
}

.payoff-date {
  font-weight: 600;
  color: var(--navy);
}

/* MODAL */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal-overlay.visible { display: flex; }

.modal {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 28px;
  width: 400px;
  max-width: 95vw;
}

.modal h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--navy);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-field.full { grid-column: 1 / -1; }

.form-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
}

.form-field input, .form-field select {
  padding: 9px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.form-field input:focus, .form-field select:focus { border-color: var(--green); }

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  justify-content: flex-end;
}

.btn-primary {
  padding: 10px 20px;
  background: var(--navy);
  color: white;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary:hover { background: #252b45; }

.btn-secondary {
  padding: 10px 20px;
  background: var(--gray-100);
  color: var(--gray-600);
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-secondary:hover { background: var(--gray-200); }

/* RESPONSIVE */
@media (max-width: 900px) {
  main {
    grid-template-columns: 1fr;
    padding: 16px;
  }
  .summary-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  header { padding: 0 16px; }
  .header-tagline { display: none; }
  .summary-grid { grid-template-columns: 1fr; }
  .summary-value { font-size: 22px; }
}
