:root {
  color-scheme: light;
  --ink: #17201d;
  --muted: #60716b;
  --line: #d8dfdc;
  --surface: #f5f7f6;
  --panel: #ffffff;
  --accent: #0a7a6d;
  --accent-2: #b85c38;
  --soft: #e8f2ef;
  --warning: #a36613;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--surface);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select {
  font: inherit;
}

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

h1 {
  font-size: 28px;
}

h2 {
  font-size: 18px;
}

h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 32px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

button {
  min-height: 40px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
}

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

button.primary-action {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
}

button.small {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 13px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(560px, 1.08fr) minmax(420px, 0.92fr);
  gap: 20px;
  padding: 20px;
}

.input-panel,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.input-panel,
.results .panel {
  padding: 20px;
}

.results {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-title.compact {
  margin-top: 24px;
}

.badge-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.badge {
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--accent);
  background: var(--soft);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.stale,
.badge.saving {
  color: var(--warning);
  background: #fff5e5;
}

.badge.muted {
  color: var(--muted);
  background: #eef2f0;
}

.badge.saved {
  color: var(--accent);
  background: var(--soft);
}

.badge.error {
  color: #9f2f2f;
  background: #ffecec;
}

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

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

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--ink);
  background: #ffffff;
}

.table-list {
  display: grid;
  gap: 8px;
}

.row {
  display: grid;
  grid-template-columns: 1.15fr repeat(5, minmax(78px, 0.78fr)) 42px;
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.organizer-row {
  grid-template-columns: 1.4fr minmax(130px, 0.8fr) minmax(100px, 0.7fr) 42px;
}

.icon-button {
  width: 40px;
  height: 38px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.hero-metric {
  min-height: 210px;
  padding: 24px;
  color: #ffffff;
  background:
    linear-gradient(120deg, rgba(10, 122, 109, 0.94), rgba(28, 37, 34, 0.88)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='960' height='520' viewBox='0 0 960 520'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.22' stroke-width='3'%3E%3Cpath d='M80 360c120-100 250-112 390-36 114 62 245 38 410-74'/%3E%3Cpath d='M90 110h180v180H90zM350 86h230v260H350zM660 130h210v160H660zM120 396h720'/%3E%3Cpath d='M390 300l52-68 58 42 54-96M710 250l38-48 42 28 50-70'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.hero-metric span {
  font-size: 14px;
  font-weight: 700;
  opacity: 0.9;
}

.hero-metric strong {
  margin: 6px 0;
  font-size: 48px;
  line-height: 1;
}

.hero-metric p {
  max-width: 640px;
  line-height: 1.45;
  opacity: 0.9;
}

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

.metric-grid article {
  padding: 16px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric-grid span,
.breakdown span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

.breakdown {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.breakdown div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.breakdown div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.breakdown strong {
  font-size: 20px;
  text-align: right;
}

.bar-stack {
  display: flex;
  width: 100%;
  height: 20px;
  margin: 16px 0 12px;
  overflow: hidden;
  background: #e7ecea;
  border-radius: 999px;
}

.bar {
  min-width: 0;
}

.bar.net {
  background: var(--accent);
}

.bar.follow {
  background: var(--accent-2);
}

.legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend i {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 999px;
}

.net-dot {
  background: var(--accent);
}

.follow-dot {
  background: var(--accent-2);
}

.report-text {
  line-height: 1.65;
}

.calc-stack {
  display: grid;
  gap: 18px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

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

th {
  background: #edf3f1;
}

td.number,
th.number {
  text-align: right;
  white-space: nowrap;
}

tfoot td {
  font-weight: 700;
  background: #fbfcfb;
}

@media (max-width: 1050px) {
  .topbar,
  .workspace,
  .field-grid,
  .field-grid.three {
    grid-template-columns: 1fr;
  }

  .topbar,
  .workspace {
    padding: 16px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .icon-button {
    width: 100%;
    grid-column: 1 / -1;
  }
}

@media print {
  .top-actions,
  .icon-button,
  .small {
    display: none;
  }

  .workspace {
    display: block;
  }

  .input-panel {
    margin-bottom: 18px;
  }
}
