:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --ink: #18202a;
  --muted: #657180;
  --line: #d9ded7;
  --panel: #ffffff;
  --navy: #20324a;
  --teal: #0c8f8b;
  --amber: #d7932a;
  --rose: #c45a5a;
  --green: #4a8a45;
  --shadow: 0 10px 30px rgba(28, 37, 48, 0.08);
}

* {
  box-sizing: border-box;
}

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

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 32px 22px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}

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

h1, h2, p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
}

p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
}

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

select, button {
  height: 38px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 6px;
  padding: 0 12px;
  font: inherit;
}

button {
  background: var(--navy);
  color: #fff;
  cursor: pointer;
}

main {
  padding: 24px 32px 40px;
  display: grid;
  gap: 22px;
}

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

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

.metric {
  padding: 18px;
  display: grid;
  gap: 8px;
}

.metric span, .metric small {
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  font-size: 26px;
  line-height: 1;
}

.chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.8fr);
  gap: 16px;
}

.wide {
  grid-row: span 2;
}

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

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

canvas {
  display: block;
  width: 100%;
}

.level-bars {
  display: grid;
  gap: 12px;
}

.level-row {
  display: grid;
  gap: 6px;
}

.level-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.bar-track {
  height: 10px;
  background: #eef0ec;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--amber));
}

.table-section {
  display: grid;
  gap: 10px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

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

th, td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  background: var(--navy);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

th:first-child, td:first-child,
th:nth-child(5), td:nth-child(5) {
  text-align: left;
}

tbody tr:hover {
  background: #f8faf7;
}

@media (max-width: 920px) {
  .topbar {
    position: static;
    align-items: stretch;
    flex-direction: column;
    padding: 22px 18px;
  }

  main {
    padding: 18px;
  }

  .toolbar,
  .kpis,
  .chart-grid {
    grid-template-columns: 1fr;
  }

  .toolbar {
    display: grid;
  }

  .kpis {
    display: grid;
  }

  .chart-grid {
    display: grid;
  }
}
