:root {
  --bg: #f5f6f2;
  --ink: #18221f;
  --muted: #68736f;
  --line: #dfe5de;
  --panel: #ffffff;
  --green: #1f685b;
  --green-dark: #123d36;
  --copper: #c8753e;
  --blue: #315f91;
  --rose: #ad5554;
  --gold: #b28a2e;
  --shadow: 0 16px 44px rgba(22, 32, 28, .08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

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

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
}

.app {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 42px;
}

.topbar,
.filters,
.panel,
.kpis article,
.intro {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 68px;
  padding: 12px 16px;
  border-radius: 8px;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  background: var(--green-dark);
  color: #fff;
  font-weight: 900;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.actions button {
  color: #fff;
  border-color: var(--green);
  background: var(--green);
}

.intro {
  display: grid;
  grid-template-columns: minmax(320px, 44%) minmax(0, 1fr);
  align-items: stretch;
  overflow: hidden;
  min-height: 250px;
  margin-top: 16px;
  border-radius: 8px;
}

.intro > div {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 30px;
}

.intro p {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.intro h1 {
  max-width: 620px;
  margin: 0;
  font-size: clamp(34px, 4vw, 58px);
  line-height: 1;
  letter-spacing: 0;
}

.intro img {
  width: 100%;
  height: 100%;
  min-height: 250px;
  object-fit: cover;
}

.filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr)) minmax(230px, 1.5fr);
  gap: 12px;
  margin: 16px 0;
  padding: 14px;
  border-radius: 8px;
}

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

select,
input {
  width: 100%;
  padding: 8px 10px;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.kpis article {
  min-height: 112px;
  padding: 16px;
  border-radius: 8px;
}

.kpis span,
.kpis em {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.kpis strong {
  display: block;
  margin: 10px 0 6px;
  font-size: clamp(22px, 2vw, 30px);
  line-height: 1;
}

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

.primary-grid {
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, .65fr);
}

.panel {
  min-width: 0;
  padding: 16px;
  border-radius: 8px;
}

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

h2,
p {
  margin: 0;
}

h2 {
  font-size: 18px;
  letter-spacing: 0;
}

.panel-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.segmented {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f7f8f5;
}

.segmented button {
  min-height: 30px;
  padding: 5px 10px;
  border: 0;
  background: transparent;
  font-size: 13px;
}

.segmented button.active {
  color: #fff;
  background: var(--green);
}

.chart {
  min-height: 330px;
}

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

.axis,
.gridline {
  stroke: #d9e1da;
}

.line {
  fill: none;
  stroke: var(--green);
  stroke-width: 3;
}

.area {
  fill: rgba(31, 104, 91, .12);
}

.dot {
  fill: var(--green);
}

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

.bar-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(140px, 2fr) 110px;
  gap: 10px;
  align-items: center;
  min-height: 34px;
  font-size: 13px;
}

.bar-label {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

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

.bar {
  height: 100%;
  border-radius: inherit;
}

.bar-row strong {
  text-align: right;
  font-size: 13px;
}

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

.table-wrap.detail {
  max-height: 560px;
}

.table-wrap.compact {
  max-height: 250px;
  margin-top: 12px;
}

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

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8faf7;
  color: var(--muted);
  font-weight: 800;
}

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

td.num,
th.num {
  text-align: right;
}

tbody tr:hover {
  background: #fbfcfa;
}

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

.quality div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.quality strong,
.quality span {
  display: block;
}

.quality strong {
  font-size: 28px;
}

.quality span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
}

.empty {
  display: grid;
  place-items: center;
  min-height: 220px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

@media (max-width: 1100px) {
  .filters,
  .kpis,
  .grid,
  .primary-grid,
  .intro {
    grid-template-columns: 1fr;
  }

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

  .intro img {
    max-height: 260px;
  }
}

@media (max-width: 640px) {
  .app {
    width: min(100% - 20px, 1480px);
    padding-top: 10px;
  }

  .topbar {
    position: static;
    align-items: stretch;
    flex-direction: column;
  }

  .actions button {
    width: 100%;
  }

  .intro > div {
    padding: 22px;
  }

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

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

  .bar-row strong {
    text-align: left;
  }
}
