:root {
  --blue-700: #1d4ed8;
  --blue-600: #2563eb;
  --blue-500: #3b82f6;
  --blue-100: #dbeafe;
  --blue-50: #eff6ff;
  --green-600: #16a34a;
  --green-50: #f0fdf4;
  --red-600: #dc2626;
  --red-50: #fef2f2;
  --gray-900: #111827;
  --gray-700: #374151;
  --gray-600: #4b5563;
  --gray-400: #9ca3af;
  --gray-200: #e5e7eb;
  --gray-100: #f3f4f6;
  --gray-50: #f9fafb;
  --white: #ffffff;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 4px 16px rgba(0,0,0,.10);
  --font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  color: var(--gray-900);
  background: var(--gray-50);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue-600); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Header */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--gray-900);
}
.logo:hover, .logo:focus-visible { text-decoration: none; }
.logo-accent { color: var(--blue-600); }
.nav { display: flex; gap: 20px; }
.nav a { font-size: .9rem; font-weight: 500; color: var(--gray-700); }
.nav a:hover, .nav a:focus-visible { color: var(--blue-600); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 600;
  border: 2px solid transparent;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  font-family: var(--font);
  line-height: 1.4;
}
.btn:focus-visible { outline: 3px solid var(--blue-500); outline-offset: 2px; }
.btn-primary { background: var(--blue-600); color: var(--white); border-color: var(--blue-600); }
.btn-primary:hover { background: var(--blue-700); border-color: var(--blue-700); text-decoration: none; color: var(--white); }
.btn-ghost { background: transparent; color: var(--blue-600); border-color: var(--blue-600); }
.btn-ghost:hover { background: var(--blue-50); text-decoration: none; }
.btn-outline { background: var(--white); color: var(--gray-700); border-color: var(--gray-200); }
.btn-outline:hover { background: var(--gray-100); border-color: var(--gray-400); text-decoration: none; }
.btn-danger-outline { background: var(--white); color: var(--red-600); border-color: var(--gray-200); }
.btn-danger-outline:hover { background: var(--red-50); border-color: var(--red-600); text-decoration: none; }
.btn-sm { padding: 6px 14px; font-size: .82rem; }

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--blue-600), #7c3aed);
  color: var(--white);
  padding: 64px 0 72px;
}
.hero h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 800; line-height: 1.25; max-width: 600px; }
.hero-sub { margin-top: 16px; font-size: 1.05rem; opacity: .9; max-width: 520px; }
.hero-actions { margin-top: 28px; display: flex; gap: 12px; flex-wrap: wrap; }
.hero .btn-primary { background: var(--white); color: var(--blue-600); border-color: var(--white); }
.hero .btn-primary:hover { background: var(--blue-50); }
.hero .btn-ghost { color: var(--white); border-color: rgba(255,255,255,.5); }
.hero .btn-ghost:hover { background: rgba(255,255,255,.1); border-color: var(--white); }

/* Sections */
section { padding: 56px 0; }
section:nth-child(even) { background: var(--white); }
.section-intro { color: var(--gray-600); margin-bottom: 20px; max-width: 600px; }
h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 8px; }

/* Workspace */
.workspace .workspace-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 32px;
  align-items: start;
}
.workspace-main { min-width: 0; }
.workspace-side { min-width: 0; }

/* Presets */
.presets-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.presets-label { font-size: .82rem; color: var(--gray-600); font-weight: 500; }

/* Form */
#debt-form { margin-bottom: 20px; }
.debt-form-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr auto;
  gap: 10px;
  align-items: end;
  border: none;
  padding: 0;
}
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: .82rem; font-weight: 600; color: var(--gray-700); }
.field input {
  padding: 8px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: .9rem;
  font-family: var(--font);
  background: var(--white);
  transition: border-color .15s;
}
.field input:focus { outline: none; border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.field-actions .btn { white-space: nowrap; }

/* Debt table */
.debt-list-wrap { margin-bottom: 24px; }
.debt-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.debt-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--gray-600);
  border-bottom: 2px solid var(--gray-200);
  background: var(--gray-50);
}
.debt-table th.num { text-align: right; }
.debt-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
.debt-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.debt-table td.col-actions { text-align: right; }
.debt-table tr:hover td { background: var(--blue-50); }
.debt-table .btn-delete {
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
}
.debt-table .btn-delete:hover { color: var(--red-600); background: var(--red-50); }
.debt-table .drag-handle {
  cursor: grab;
  color: var(--gray-400);
  padding: 4px 6px;
  font-size: 1rem;
  user-select: none;
}
.empty-state {
  padding: 32px;
  text-align: center;
  color: var(--gray-400);
  font-size: .9rem;
  border: 2px dashed var(--gray-200);
  border-radius: var(--radius);
  background: var(--gray-50);
}

/* Extra payment */
.extra-payment-row {
  background: var(--blue-50);
  border: 1.5px solid var(--blue-100);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.extra-payment-row h3 { font-size: 1rem; margin-bottom: 10px; }
.field-inline {
  display: flex;
  align-items: center;
  gap: 6px;
}
.field-inline label { font-weight: 700; font-size: 1.1rem; color: var(--gray-700); }
.field-inline input {
  width: 120px;
  padding: 8px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: var(--font);
  font-weight: 600;
}
.field-inline input:focus { outline: none; border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.hint { font-size: .82rem; color: var(--gray-600); margin-top: 8px; }

/* Actions row */
.actions-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }

/* Summary card */
.summary-card {
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.summary-card h3 { font-size: 1rem; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--gray-200); }
.summary-card dl { display: grid; grid-template-columns: 1fr auto; gap: 10px 16px; font-size: .9rem; }
.summary-card dt { color: var(--gray-600); }
.summary-card dd { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.save-status { margin-top: 12px; font-size: .82rem; color: var(--green-600); min-height: 1.2em; }
.sticky { position: sticky; top: 72px; }

/* Timeline */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--gray-200);
  cursor: pointer;
  border-radius: var(--radius);
  transition: background .15s;
}
.timeline-item:hover { background: var(--blue-50); }
.timeline-item:last-child { border-bottom: none; }
.timeline-marker {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: .8rem;
}
.timeline-marker.debt-free { background: var(--green-600); color: var(--white); }
.timeline-marker.halfway { background: var(--blue-600); color: var(--white); }
.timeline-marker.first { background: #7c3aed; color: var(--white); }
.timeline-marker.extra { background: var(--gray-400); color: var(--white); }
.timeline-content h4 { font-size: .95rem; margin-bottom: 2px; }
.timeline-content p { font-size: .82rem; color: var(--gray-600); }
.timeline-content .timeline-date { font-weight: 600; color: var(--blue-600); }

/* Example */
.example-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 20px; }
.example-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.example-table caption { text-align: left; font-weight: 700; margin-bottom: 8px; font-size: .95rem; }
.example-table th { text-align: left; padding: 8px 12px; font-size: .82rem; color: var(--gray-600); border-bottom: 2px solid var(--gray-200); background: var(--gray-50); }
.example-table td { padding: 8px 12px; border-bottom: 1px solid var(--gray-100); }
.example-result { background: var(--blue-50); border: 1.5px solid var(--blue-100); border-radius: var(--radius); padding: 20px; }
.example-result h3 { font-size: 1rem; margin-bottom: 12px; }
.example-result ol { padding-left: 20px; }
.example-result li { margin-bottom: 8px; font-size: .9rem; }
.example-result p { margin-top: 12px; font-size: .85rem; color: var(--gray-600); }

/* Notes */
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; margin-top: 24px; }
.note-card {
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.note-card h3 { font-size: .95rem; margin-bottom: 8px; }
.note-card p, .note-card li { font-size: .85rem; color: var(--gray-600); }
.note-card ul { padding-left: 18px; margin-top: 6px; }
.note-card li { margin-bottom: 4px; }

/* FAQ */
.faq-section details {
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
  background: var(--white);
}
.faq-section summary {
  padding: 14px 20px;
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.faq-section summary::-webkit-details-marker { display: none; }
.faq-section summary::after { content: '+'; font-size: 1.2rem; color: var(--gray-400); }
.faq-section details[open] summary::after { content: '−'; }
.faq-section details p { padding: 0 20px 16px; font-size: .85rem; color: var(--gray-600); }

/* Footer */
.site-footer {
  background: var(--gray-900);
  color: var(--gray-400);
  padding: 40px 0 24px;
  font-size: .85rem;
}
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; margin-bottom: 32px; }
.footer-brand { font-weight: 700; color: var(--white); font-size: 1rem; margin-bottom: 6px; }
.footer-desc { max-width: 300px; }
.footer-heading { font-weight: 600; color: var(--white); margin-bottom: 10px; font-size: .85rem; }
.footer-links { list-style: none; }
.footer-links li { margin-bottom: 6px; }
.footer-links a { color: var(--gray-400); }
.footer-links a:hover { color: var(--white); }
.footer-copy { text-align: center; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.1); font-size: .8rem; }

/* Print */
@media print {
  .site-header, .site-footer, .hero-actions, .presets-bar, #debt-form, .actions-row, .workspace-side, .faq-section { display: none !important; }
  body { background: #fff; color: #000; }
  .hero { background: none; color: #000; padding: 20px 0; }
  .hero h1 { color: #000; }
  section { padding: 16px 0; }
  .timeline-item { break-inside: avoid; }
}

/* Responsive */
@media (max-width: 860px) {
  .workspace .workspace-grid { grid-template-columns: 1fr; }
  .sticky { position: static; }
  .debt-form-grid { grid-template-columns: 1fr 1fr; }
  .field-actions { grid-column: 1 / -1; }
  .example-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .nav { gap: 12px; }
  .nav a { font-size: .82rem; }
  .hero { padding: 40px 0 48px; }
  .debt-form-grid { grid-template-columns: 1fr; }
  .debt-table { font-size: .82rem; }
  .debt-table th, .debt-table td { padding: 8px 6px; }
  .footer-grid { grid-template-columns: 1fr; }
  .actions-row { flex-direction: column; }
  .actions-row .btn { width: 100%; }
}



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
