:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --panel: #ffffff;
  --ink: #18211f;
  --muted: #68736f;
  --line: #dbe2dd;
  --accent: #23635a;
  --accent-strong: #174840;
  --warn: #a35622;
  --danger: #9b2d25;
  --ok: #2e6c42;
  --soft: #edf4f1;
  --shadow: 0 12px 28px rgba(24, 33, 31, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(18px, 5vw, 56px);
  border-bottom: 1px solid var(--line);
  background: #fbfcfa;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 2.5vw, 2.4rem);
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.4rem, 2vw, 2rem);
}

h3 {
  margin-bottom: 8px;
  font-size: 1.05rem;
}

main {
  padding: 28px clamp(18px, 5vw, 56px) 56px;
}

.nav-actions,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.nav-link,
.secondary-button,
.primary-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 16px;
  cursor: pointer;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
}

.nav-link.is-active,
.primary-button {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.secondary-button:hover,
.nav-link:hover {
  border-color: var(--accent);
}

.view {
  display: none;
}

.view.is-visible {
  display: block;
}

.section-heading,
.panel-heading,
.step-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.status-banner {
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 14px 16px;
  background: #fff;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric,
.panel,
.debt-card,
.update-card,
.planned-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric {
  min-height: 112px;
  padding: 16px;
}

.metric span,
.muted {
  color: var(--muted);
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 1.45rem;
}

.panel {
  margin-bottom: 18px;
  padding: 20px;
}

.narrow-panel {
  max-width: 560px;
}

.debt-grid,
.planned-list,
.updates-list,
.attention-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 14px;
}

.debt-card,
.update-card,
.planned-item,
.attention-item {
  padding: 16px;
  box-shadow: none;
}

.debt-card dl,
.planned-item dl,
.attention-item dl {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 14px;
  margin: 0;
}

.debt-card dt,
.planned-item dt,
.attention-item dt {
  color: var(--muted);
}

.debt-card dd,
.planned-item dd,
.attention-item dd {
  margin: 0;
  font-weight: 700;
  text-align: right;
}

.attention-item {
  border-left: 4px solid var(--accent);
}

.attention-item.is-urgent {
  border-left-color: var(--danger);
}

.attention-item.is-soon {
  border-left-color: var(--warn);
}

.checkline {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.checkline input {
  width: 18px;
  height: 18px;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 18px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 700px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.status-pill {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border-radius: 999px;
  padding: 3px 10px;
  background: var(--soft);
  color: var(--accent-strong);
  font-size: 0.84rem;
  font-weight: 700;
}

.status-pill.overdue,
.status-pill.delayed {
  background: #f8e9e6;
  color: var(--danger);
}

.status-pill.paid,
.status-pill.received {
  background: #e7f2e9;
  color: var(--ok);
}

.status-pill.due-this-week,
.status-pill.tentative {
  background: #f8eee4;
  color: var(--warn);
}

.repayment-copy {
  max-width: 900px;
  color: var(--ink);
  line-height: 1.55;
}

.form-stack,
.guided-form {
  display: grid;
  gap: 16px;
}

.guided-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
}

.compact-label {
  min-width: 220px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
}

textarea {
  min-height: 108px;
  resize: vertical;
}

.full-span {
  grid-column: 1 / -1;
}

.step-dots {
  display: flex;
  gap: 7px;
  padding-top: 7px;
}

.step-dots span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--line);
}

.step-dots span.is-active {
  background: var(--accent);
}

.summary-output {
  margin: 0;
  white-space: pre-wrap;
  color: var(--ink);
  line-height: 1.5;
}

.records-list {
  display: grid;
  gap: 10px;
}

.record-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.record-row p {
  margin: 4px 0 0;
  color: var(--muted);
}

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

.danger-button {
  min-height: 38px;
  border: 1px solid #e0b7b2;
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--danger);
  cursor: pointer;
  font-weight: 700;
}

.edit-form {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.empty-state {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 1080px) {
  .overview-grid {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .two-column {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .topbar,
  .section-heading,
  .panel-heading,
  .step-header {
    align-items: stretch;
    flex-direction: column;
  }

  .overview-grid,
  .debt-grid,
  .planned-list,
  .updates-list,
  .attention-list,
  .guided-form {
    grid-template-columns: 1fr;
  }

  .nav-actions {
    width: 100%;
  }

  .nav-link {
    flex: 1 1 auto;
  }
}
