:root {
  --bg: #eefdf4;
  --surface: #fffefa;
  --surface-2: #f3f7ee;
  --ink: #0f241b;
  --muted: #60746b;
  --line: #d9e6dc;
  --green: #149566;
  --green-dark: #0b6246;
  --green-soft: #dff7ea;
  --red: #c24132;
  --red-soft: #fde4df;
  --amber: #b97913;
  --amber-soft: #fff1cb;
  --blue: #246b9d;
  --blue-soft: #dff0fb;
  --shadow: 0 20px 60px rgba(19, 68, 48, 0.12);
  --glass-bg: rgba(255, 254, 250, 0.84);
  color-scheme: light;
  font-family:
    "Aptos", "Segoe UI", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(20, 149, 102, 0.22), transparent 30rem),
    radial-gradient(circle at 88% 0%, rgba(36, 107, 157, 0.14), transparent 28rem),
    linear-gradient(180deg, #f7fff9 0%, var(--bg) 42rem);
  background-attachment: fixed;
}

a {
  color: var(--blue);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.topbar {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 22px 16px;
  background: linear-gradient(180deg, rgba(247, 255, 249, 0.94), rgba(247, 255, 249, 0.78));
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  margin: 0 0 10px;
  padding: 5px 10px;
  border: 1px solid rgba(20, 149, 102, 0.18);
  border-radius: 999px;
  background: rgba(223, 247, 234, 0.76);
  color: var(--green-dark);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 860px;
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 4.4rem);
  line-height: 0.96;
  letter-spacing: -0.06em;
}

.app-shell {
  display: block;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 22px 52px;
}

.controls-panel,
.dashboard {
  border: 1px solid rgba(217, 230, 220, 0.9);
  border-radius: 28px;
  background: rgba(255, 254, 250, 0.86);
  box-shadow: var(--shadow);
}

.controls-panel {
  overflow: clip;
}

.wizard-steps {
  position: sticky;
  top: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: var(--glass-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.wizard-step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 10px;
  align-items: center;
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.wizard-step:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(20, 149, 102, 0.38);
}

.wizard-step span {
  grid-row: span 2;
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 900;
}

.wizard-step strong {
  color: var(--ink);
  font-size: 0.92rem;
}

.wizard-step small {
  color: var(--muted);
  font-size: 0.76rem;
}

.wizard-step.current {
  border-color: rgba(20, 149, 102, 0.52);
  background: var(--green-soft);
}

.wizard-step.current span,
.wizard-step.completed span {
  background: var(--green);
  color: white;
}

.wizard-step:disabled {
  cursor: not-allowed;
  opacity: 0.52;
  transform: none;
}

.wizard-page[hidden] {
  display: none !important;
}

.wizard-page.active {
  display: block;
}

.dashboard.wizard-page.active {
  display: flex;
}

.panel-section {
  padding: clamp(20px, 3vw, 34px);
  border-bottom: 1px solid var(--line);
}

.panel-section:last-of-type {
  border-bottom: 0;
}

.hero-section {
  background:
    linear-gradient(135deg, rgba(223, 247, 234, 0.86), rgba(255, 254, 250, 0.92) 48%),
    var(--surface);
}

.section-heading,
.control-label,
.viz-heading,
.verdict-strip {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.section-heading {
  margin-bottom: 12px;
}

.section-heading h2,
.viz-heading h2,
.assumptions h2 {
  margin: 0;
  font-size: 1.06rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.section-heading span {
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.section-copy {
  max-width: 720px;
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.55;
}

.fixed-terms {
  display: grid;
  gap: 8px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.86rem;
}

.fixed-terms strong {
  color: var(--ink);
}

.control {
  display: block;
  margin-top: 20px;
}

.control:first-of-type {
  margin-top: 0;
}

.control-label {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.control-label strong {
  color: var(--ink);
  font-size: 0.92rem;
  text-align: right;
  white-space: nowrap;
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 40px;
  margin: 6px 0;
  background: transparent;
  cursor: pointer;
  touch-action: pan-y;
}

input[type="range"]:focus {
  outline: none;
}

input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: 9px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(20, 149, 102, 0.28), rgba(36, 107, 157, 0.22));
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 29px;
  height: 29px;
  margin-top: -10px;
  border: 2px solid var(--green);
  border-radius: 50%;
  background: white;
  box-shadow: 0 5px 14px rgba(20, 149, 102, 0.24);
  transition:
    transform 120ms ease,
    background 120ms ease;
}

input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(1.12);
  background: var(--green-soft);
}

.option-buttons {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.scenario-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.option-button,
.scenario-button,
.copy-button,
.primary-button,
.ghost-button {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    transform 140ms ease,
    box-shadow 140ms ease;
}

.option-button:hover:not(:disabled),
.scenario-button:hover:not(:disabled),
.copy-button:hover:not(:disabled),
.primary-button:hover:not(:disabled),
.ghost-button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(20, 149, 102, 0.5);
  box-shadow: 0 8px 18px rgba(20, 149, 102, 0.12);
}

.option-button.active {
  border-color: rgba(20, 149, 102, 0.46);
  background: var(--green-soft);
  color: var(--green-dark);
}

.scenario-button {
  display: grid;
  min-height: 116px;
  align-content: start;
  gap: 8px;
  padding: 16px;
  text-align: left;
}

.scenario-button strong {
  font-size: 0.98rem;
}

.scenario-button span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 650;
  line-height: 1.35;
}

.scenario-button.active {
  border-color: rgba(20, 149, 102, 0.55);
  background: var(--green-soft);
  color: var(--green-dark);
}

.scenario-button.active span {
  color: var(--green-dark);
}

.primary-button {
  border-color: var(--green);
  background: var(--green);
  color: white;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.58);
  color: var(--muted);
}

.copy-button {
  flex: 0 0 auto;
  background: var(--ink);
  color: white;
}

.copy-button.copied {
  background: var(--green);
}

.option-button:disabled,
.copy-button:disabled,
.primary-button:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  filter: grayscale(1);
  transform: none;
  box-shadow: none;
}

.step-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 18px clamp(20px, 3vw, 34px) clamp(20px, 3vw, 34px);
}

.step-actions .primary-button,
.step-actions .ghost-button {
  min-width: min(260px, 50%);
}

.progress-widget {
  position: sticky;
  top: 91px;
  z-index: 50;
  margin: 0;
  padding: 18px clamp(18px, 3vw, 28px);
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(255, 254, 250, 0.96), rgba(223, 247, 234, 0.92)),
    var(--surface);
  transition:
    background 160ms ease,
    color 160ms ease;
}

.progress-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 13px;
}

.progress-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.progress-value {
  font-size: clamp(1.5rem, 3vw, 2.4rem);
  letter-spacing: -0.06em;
}

.progress-track {
  position: relative;
  width: 100%;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(15, 36, 27, 0.08);
}

.progress-track::after {
  position: absolute;
  top: -6px;
  right: 0;
  bottom: -6px;
  width: 2px;
  background: rgba(15, 36, 27, 0.32);
  content: "";
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--blue);
  transition:
    width 260ms cubic-bezier(0.4, 0, 0.2, 1),
    background 160ms ease;
}

.progress-widget.under .progress-fill {
  background: var(--blue);
}

.progress-widget.balanced {
  background: linear-gradient(135deg, rgba(223, 247, 234, 0.98), rgba(246, 255, 249, 0.96));
}

.progress-widget.balanced .progress-fill {
  background: var(--green);
}

.progress-widget.balanced .progress-label,
.progress-widget.balanced .progress-value {
  color: var(--green-dark);
}

.progress-widget.over-no-private,
.progress-widget.over-private {
  background: linear-gradient(135deg, rgba(255, 241, 203, 0.98), rgba(255, 254, 250, 0.94));
}

.progress-widget.over-no-private .progress-fill,
.progress-widget.over-private .progress-fill {
  background: var(--amber);
}

.progress-widget.over-no-private .progress-label,
.progress-widget.over-no-private .progress-value,
.progress-widget.over-private .progress-label,
.progress-widget.over-private .progress-value {
  color: #7c4d10;
}

.progress-widget.attention {
  animation: attentionPulse 420ms ease;
}

@keyframes attentionPulse {
  0% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  50% {
    transform: translateX(5px);
  }
  75% {
    transform: translateX(-3px);
  }
  100% {
    transform: translateX(0);
  }
}

.dashboard {
  display: none;
  min-width: 0;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.bottom-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
  align-items: center;
}

.verdict-content {
  display: grid;
  max-width: 100%;
  gap: 10px;
}

.verdict-strip,
.metric,
.viz-card,
.assumptions {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 254, 250, 0.9);
  box-shadow: var(--shadow);
}

.verdict-strip {
  padding: clamp(20px, 3vw, 28px);
  background:
    linear-gradient(135deg, rgba(255, 254, 250, 0.96) 0%, rgba(223, 247, 234, 0.9) 100%),
    var(--surface);
}

.verdict-strip h2 {
  margin: 0;
  font-size: clamp(1.45rem, 2.8vw, 2.35rem);
  letter-spacing: -0.04em;
}

.verdict-summary {
  display: grid;
  max-width: 100%;
  gap: 12px;
}

.verdict-lead {
  max-width: 940px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.synthesis-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 13px;
}

.synthesis-table {
  table-layout: fixed;
  width: 100%;
  min-width: 0;
  box-shadow: none;
}

.synthesis-table th:first-child,
.synthesis-table td:first-child {
  width: 44px;
  max-width: 44px;
  padding-right: 3px;
  padding-left: 8px;
  white-space: nowrap;
}

.synthesis-table th,
.synthesis-table td {
  padding: 10px 6px;
  font-size: 0.74rem;
  line-height: 1.15;
  text-align: right;
}

.synthesis-table td:first-child,
.synthesis-table th:first-child {
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  text-align: left;
}

.synthesis-table th {
  background: var(--surface-2);
  overflow-wrap: normal;
}

.synthesis-table .table-unit {
  display: block;
  margin-top: 2px;
  font-size: 0.7em;
  letter-spacing: 0;
  text-transform: none;
}

.synthesis-table td:not(:first-child) {
  white-space: nowrap;
}

.synthesis-table td {
  background: white;
}

.synthesis-table tr.danger td.net-cell {
  background: var(--red-soft);
  color: #84251d;
  font-weight: 850;
}

.synthesis-table tr.watch td.net-cell {
  background: var(--amber-soft);
  color: #7c4d10;
  font-weight: 850;
}

.synthesis-table tr.ok td.net-cell {
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 850;
}

.debt-intelaka {
  color: var(--blue);
  font-weight: 800;
}

.debt-private {
  color: var(--amber);
  font-weight: 800;
}

.debt-posef {
  color: #6d597a;
  font-weight: 800;
}

.badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.badge.red {
  background: var(--red-soft);
  color: #84251d;
}

.badge.amber {
  background: var(--amber-soft);
  color: #7c4d10;
}

.badge.green {
  background: var(--green-soft);
  color: var(--green-dark);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  padding: 18px;
}

.metric span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.84rem;
}

.metric strong {
  display: block;
  font-size: clamp(1.35rem, 2.2vw, 2rem);
  letter-spacing: -0.04em;
}

.metric small {
  display: block;
  min-height: 18px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.viz-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.viz-card {
  min-width: 0;
  padding: 18px;
}

.viz-heading {
  margin-bottom: 12px;
}

.viz-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.viz-heading span {
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
}

svg {
  display: block;
  width: 100%;
  min-height: 290px;
}

.chart-axis {
  stroke: #adc2b5;
  stroke-width: 1;
}

.grid-line {
  stroke: #e2eadf;
  stroke-width: 1;
}

.axis-label {
  fill: var(--muted);
  font-size: 12px;
}

.bar-label {
  fill: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.heatmap {
  display: grid;
  grid-template-columns: 64px repeat(var(--period-count, 3), minmax(76px, 1fr));
  gap: 6px;
  overflow-x: auto;
}

.heatmap-cell {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 6px;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 850;
  text-align: center;
}

.heatmap-cell.header {
  min-height: 28px;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
}

.heatmap-cell.danger {
  border-color: rgba(194, 65, 50, 0.22);
  background: var(--red-soft);
}

.heatmap-cell.watch {
  border-color: rgba(185, 121, 19, 0.24);
  background: var(--amber-soft);
}

.heatmap-cell.ok {
  border-color: rgba(20, 149, 102, 0.23);
  background: var(--green-soft);
}

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

th,
td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  vertical-align: middle;
}

th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

td:first-child,
th:first-child,
td:last-child,
th:last-child {
  text-align: left;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.assumptions {
  padding: 18px;
}

.assumption-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.assumption-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-top: 16px;
  font-size: 0.9rem;
}

@media (max-width: 820px) {
  .topbar {
    padding: 18px 14px 12px;
  }

  h1 {
    font-size: clamp(1.8rem, 10vw, 3.1rem);
  }

  .app-shell {
    padding: 0 12px 32px;
  }

  .controls-panel,
  .verdict-strip,
  .metric,
  .viz-card,
  .assumptions {
    border-radius: 20px;
  }

  .wizard-steps {
    top: 0;
    grid-template-columns: 1fr;
    gap: 7px;
    padding: 10px;
  }

  .wizard-step {
    min-height: 50px;
  }

  .wizard-step small {
    display: none;
  }

  .progress-widget {
    top: 181px;
  }

  .section-heading,
  .control-label,
  .viz-heading,
  .verdict-strip {
    flex-direction: column;
    gap: 8px;
  }

  .option-buttons,
  .scenario-buttons,
  .metrics-grid,
  .assumption-grid {
    grid-template-columns: 1fr;
  }

  .step-actions {
    position: sticky;
    bottom: 0;
    z-index: 40;
    padding: 12px;
    background: rgba(255, 254, 250, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  .step-actions .primary-button,
  .step-actions .ghost-button {
    min-width: 0;
    flex: 1;
  }

  .bottom-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .heatmap {
    grid-template-columns: 48px repeat(var(--period-count, 3), minmax(58px, 1fr));
    gap: 3px;
  }

  .heatmap-cell {
    min-height: 44px;
    padding: 3px;
    font-size: 0.62rem;
    line-height: 1.15;
  }

  svg {
    min-height: 240px;
  }

  table {
    min-width: 760px;
  }

  .synthesis-table {
    min-width: 0;
  }
}

@media (max-width: 520px) {
  .panel-section,
  .progress-widget {
    padding: 18px;
  }

  .progress-header {
    display: grid;
  }

  th,
  td {
    padding: 8px 7px;
    font-size: 0.72rem;
  }

  th {
    font-size: 0.62rem;
    letter-spacing: 0;
  }

  .synthesis-table th,
  .synthesis-table td {
    padding: 8px 4px;
    font-size: 0.64rem;
  }

  .synthesis-table th:first-child,
  .synthesis-table td:first-child {
    width: 38px;
    max-width: 38px;
    padding-right: 2px;
    padding-left: 6px;
    font-size: 0.61rem;
  }
}

@media (max-width: 420px) {
  .synthesis-table th,
  .synthesis-table td {
    padding: 7px 3px;
    font-size: 0.6rem;
  }

  .synthesis-table th:first-child,
  .synthesis-table td:first-child {
    width: 36px;
    max-width: 36px;
    padding-right: 2px;
    padding-left: 5px;
    font-size: 0.58rem;
  }

  .synthesis-table .table-unit {
    font-size: 0.68em;
  }
}
