:root {
  color-scheme: light;
  --ink: #202124;
  --muted: #5e6673;
  --line: #d9dde3;
  --surface: #ffffff;
  --panel: #f6f7f9;
  --accent: #126a66;
  --accent-2: #a44c2f;
  --accent-3: #405f9f;
  --soft: #e9f3f1;
  --warn: #fff4df;
  --shadow: 0 18px 50px rgba(32, 33, 36, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--panel);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  padding: 8px 12px;
}

button:hover {
  border-color: var(--accent);
}

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

.app-header {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.app-header h1,
.report-toolbar h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

.client-picker {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.client-picker select {
  min-width: 170px;
  height: 38px;
  padding: 7px 10px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
}

.intake-panel,
.analysis-panel {
  min-width: 0;
}

.intake-panel {
  position: sticky;
  top: 84px;
  align-self: start;
  max-height: calc(100vh - 102px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border-bottom: 1px solid var(--line);
}

.tab {
  min-width: 0;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  padding: 10px 6px;
  font-size: 13px;
}

.tab:last-child {
  border-right: 0;
}

.form {
  padding: 18px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.tab-panel h2 {
  margin: 0 0 14px;
  font-size: 18px;
}

label {
  display: grid;
  gap: 6px;
  margin-bottom: 13px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

textarea {
  resize: vertical;
}

.field-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.two-col,
.three-col {
  display: grid;
  gap: 10px;
}

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

.three-col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.calculator-panel {
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 14px;
}

.panel-title {
  margin-bottom: 12px;
}

.panel-title h3 {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 16px;
}

.panel-title p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.mini-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 12px;
}

.mini-table th,
.mini-table td {
  border-bottom: 1px solid var(--line);
  padding: 8px 6px;
  text-align: left;
  vertical-align: top;
}

.mini-table th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.calculator-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.school-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.school-card strong {
  display: block;
  margin: 4px 0;
}

.school-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.action-link {
  flex: 0 0 auto;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  padding: 8px 10px;
  text-decoration: none;
  white-space: nowrap;
}

.case-grid {
  display: grid;
  grid-template-columns: minmax(110px, 1.2fr) repeat(4, minmax(82px, 1fr));
  gap: 6px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 10px;
}

.case-grid input {
  min-width: 82px;
  padding: 8px;
  font-size: 12px;
}

.case-header {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.analysis-panel {
  display: grid;
  gap: 14px;
}

.report-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px 18px;
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.segmented button {
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
}

.segmented button:last-child {
  border-right: 0;
}

.report {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.report-cover {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.6fr);
  gap: 24px;
  padding: 34px;
  background:
    linear-gradient(90deg, rgba(18, 106, 102, 0.95), rgba(64, 95, 159, 0.82)),
    url("assets/financial-report-cover.png");
  background-size: cover;
  color: #fff;
}

.report-cover h2 {
  margin: 0 0 10px;
  font-size: 34px;
  line-height: 1.1;
}

.report-cover p {
  max-width: 70ch;
  margin: 0;
  color: rgba(255, 255, 255, 0.88);
}

.cover-metrics {
  display: grid;
  gap: 10px;
}

.metric {
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  padding: 13px;
  background: rgba(255, 255, 255, 0.12);
}

.metric strong {
  display: block;
  font-size: 22px;
}

.metric span {
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.report-section {
  padding: 26px 34px;
  border-top: 1px solid var(--line);
}

.report-section h3 {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 22px;
}

.report-section h4 {
  margin: 20px 0 8px;
  font-size: 16px;
}

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

.summary-card,
.recommendation,
.note-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.summary-card .label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.summary-card .value {
  display: block;
  margin-top: 5px;
  font-size: 22px;
  font-weight: 800;
}

.note-box {
  background: var(--soft);
}

.note-box.warn {
  background: var(--warn);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 18px;
  font-size: 14px;
}

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

.data-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.num {
  text-align: right;
  white-space: nowrap;
}

.bar-row {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) 90px;
  gap: 12px;
  align-items: center;
  margin: 10px 0;
}

.bar-track {
  height: 12px;
  border-radius: 99px;
  background: #e7ebef;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--accent-3);
}

.recommendation h4 {
  margin-top: 0;
  color: var(--accent-2);
}

.report ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.report li {
  margin: 6px 0;
}

.disclaimer {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 980px) {
  .app-header,
  .report-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .intake-panel {
    position: static;
    max-height: none;
  }

  .report-cover,
  .summary-grid,
  .planning-grid,
  .recommendation-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .workspace {
    padding: 10px;
  }

  .app-header,
  .report-section,
  .report-cover {
    padding: 18px;
  }

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

  .two-col,
  .three-col {
    grid-template-columns: 1fr;
  }

  .bar-row {
    grid-template-columns: 1fr;
  }

  .school-card {
    align-items: stretch;
    flex-direction: column;
  }

  .action-link {
    text-align: center;
  }
}

@media print {
  body {
    background: #fff;
  }

  .app-header,
  .intake-panel,
  .report-toolbar {
    display: none;
  }

  .workspace {
    display: block;
    padding: 0;
  }

  .report {
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .report-cover {
    color: #fff;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .report-section {
    break-inside: avoid;
  }
}
