:root {
  color-scheme: light;
  --ink: #18212b;
  --muted: #617083;
  --line: #d9e1ea;
  --panel: #ffffff;
  --page: #f3f6f8;
  --brand: #005f73;
  --brand-strong: #004c5d;
  --accent: #d1495b;
  --warn: #d88700;
  --good: #1f7a4d;
  --soft-good: #e6f3eb;
  --soft-warn: #fff5df;
  --soft-bad: #fdebef;
  --shadow: 0 16px 40px rgba(24, 33, 43, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
  line-height: 1.45;
}

button,
select {
  font: inherit;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(18px, 4vw, 56px) 20px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 0.77rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 5px;
  font-size: clamp(1.75rem, 3vw, 2.7rem);
  line-height: 1.06;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1rem;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 4px;
  font-size: 0.96rem;
}

.meta-line,
.small-note {
  color: var(--muted);
  font-size: 0.93rem;
}

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

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--brand-strong);
  cursor: pointer;
}

.icon-button:hover,
.tab:hover {
  border-color: var(--brand);
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 8px;
  padding: 12px clamp(18px, 4vw, 56px);
  background: rgba(243, 246, 248, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  overflow-x: auto;
}

.tab {
  min-width: 108px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}

.tab.is-active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
  font-weight: 700;
}

main {
  padding: 22px clamp(18px, 4vw, 56px) 44px;
}

.view {
  display: none;
}

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

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

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

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

.metric-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.metric-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
}

.metric-value {
  margin: 8px 0 2px;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
}

.metric-detail {
  color: var(--muted);
  font-size: 0.9rem;
}

.status-dot {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--muted);
}

.status-dot.good {
  background: var(--good);
}

.status-dot.warn {
  background: var(--warn);
}

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

.content-grid {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
}

.two-column {
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr);
}

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

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 34px;
  margin-bottom: 14px;
}

.badge,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.badge {
  background: #e8f2f5;
  color: var(--brand-strong);
}

.pill.good {
  background: var(--soft-good);
  color: var(--good);
}

.pill.warn {
  background: var(--soft-warn);
  color: #8a5600;
}

.pill.bad {
  background: var(--soft-bad);
  color: var(--accent);
}

.chart {
  min-height: 330px;
  width: 100%;
}

.chart.tall {
  min-height: 390px;
}

svg {
  display: block;
  width: 100%;
  height: 100%;
}

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

.watch-list,
.action-list,
.source-notes,
.capacity-list,
.data-quality {
  display: grid;
  gap: 11px;
}

.watch-item,
.action-item,
.note-item,
.capacity-item,
.quality-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.watch-item p,
.action-item p,
.note-item p,
.capacity-item p,
.quality-item p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.91rem;
}

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

.financial-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.financial-item strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1.45rem;
}

.progress {
  height: 10px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf2;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
  background: #fff;
}

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

th {
  background: #f7f9fb;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

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

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

select {
  min-height: 36px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}

@media (max-width: 1060px) {
  .metric-grid,
  .two-column,
  .financial-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .app-header {
    flex-direction: column;
  }

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

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

@media print {
  .tabs,
  .header-actions,
  select {
    display: none;
  }

  .view {
    display: block;
    break-after: page;
  }

  body {
    background: #fff;
  }

  .panel,
  .metric-card {
    box-shadow: none;
  }
}
