:root {
  --bg: #f3f6f8;
  --panel: #fff;
  --ink: #17202a;
  --muted: #64748b;
  --line: #d9e2ec;
  --nav: #102033;
  --blue: #1f4e78;
  --red: #dc2626;
  --orange: #f97316;
  --yellow: #facc15;
  --green: #16a34a;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}
button, input { font: inherit; }
.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
}
aside {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--nav);
  color: #eaf1f8;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.brand {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: center;
}
.logo {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: var(--orange);
  color: #111827;
  font-weight: 800;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 18px; line-height: 1.15; }
.brand p, small, #subtitle { color: var(--muted); }
.brand p { color: #a9b8c8; margin-top: 3px; font-size: 13px; }
.upload {
  display: grid;
  grid-template-columns: 48px 1fr;
  align-items: center;
  gap: 12px;
  border: 1px dashed #8aa0b8;
  background: rgba(255,255,255,.06);
  padding: 14px;
  cursor: pointer;
}
.upload:hover { background: rgba(255,255,255,.1); }
.upload span {
  display: grid;
  place-items: center;
  height: 38px;
  background: #e5eef7;
  color: var(--nav);
  font-size: 12px;
  font-weight: 800;
}
.upload input { display: none; }
.inline-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(210px, 260px)) repeat(5, minmax(130px, 1fr));
  gap: 16px;
  align-items: stretch;
}
.inline-upload {
  color: #eaf1f8;
  background: #14532d;
}
.inline-upload:hover {
  color: #102033;
}
.compare-upload {
  background: #15803d;
}
.hint {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.45;
}
.select-card {
  background: #fff;
  border: 1px solid var(--line);
  padding: 12px;
  display: grid;
  gap: 8px;
}
.select-card label {
  color: var(--muted);
  font-size: 12px;
}
.select-card strong {
  display: block;
  font-size: 17px;
  line-height: 1.25;
}
.select-card select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 8px;
}
.select-card input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 8px;
}
.control { display: grid; gap: 8px; }
.control label { font-size: 13px; color: #c8d5e2; }
.control div {
  display: grid;
  grid-template-columns: 1fr 48px;
  gap: 10px;
  align-items: center;
}
.upload-date-control {
  gap: 7px;
}
.upload-date-control strong {
  color: #fff;
  font-size: 14px;
  line-height: 1.25;
}
.dual-range {
  position: relative;
  height: 28px;
}
.dual-range input {
  position: absolute;
  inset: 0;
  width: 100%;
  pointer-events: none;
  background: transparent;
}
.dual-range input::-webkit-slider-thumb {
  pointer-events: auto;
}
.dual-range input::-moz-range-thumb {
  pointer-events: auto;
}
.dual-range input:first-child {
  z-index: 2;
}
.dual-range input:last-child {
  z-index: 1;
}
.upload-date-control small {
  color: #a9b8c8;
  font-size: 12px;
  line-height: 1.35;
}
output { text-align: right; font-size: 13px; }
nav { display: grid; gap: 8px; }
nav button {
  border: 1px solid transparent;
  background: transparent;
  color: #c8d5e2;
  text-align: left;
  padding: 10px 12px;
  cursor: pointer;
}
nav button.active, nav button:hover {
  color: #fff;
  background: rgba(255,255,255,.08);
  border-color: #334f6f;
}
main { min-width: 0; padding: 24px; }
header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
  gap: 18px;
}
h2 { font-size: 26px; margin-bottom: 4px; }
#status {
  min-width: 112px;
  text-align: center;
  background: #e8f1f8;
  color: var(--blue);
  border: 1px solid #c7d8e8;
  padding: 8px 11px;
  font-size: 13px;
}
.view { display: none; }
.view.active { display: grid; gap: 16px; }
.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
}
.kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 14px 15px;
}
.kpi label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 7px; }
.kpi strong { font-size: 23px; }
.kpi small { display: block; margin-top: 6px; font-size: 12px; }
.latest-panel {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  align-items: stretch;
  background: #fff7ed;
  border: 2px solid var(--orange);
  padding: 14px 16px;
}
.latest-panel small {
  display: block;
  color: #9a3412;
  font-size: 12px;
  margin-bottom: 7px;
}
.latest-panel strong {
  display: block;
  font-size: 19px;
  line-height: 1.25;
}
.latest-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
}
.latest-metric {
  min-width: 0;
  background: #fff;
  border: 1px solid #fed7aa;
  padding: 10px 12px;
}
.latest-metric label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}
.latest-metric b {
  display: block;
  font-size: 17px;
  line-height: 1.2;
}
.latest-metric .better { color: var(--green); }
.latest-metric .worse { color: var(--red); }
.grid.two {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(330px, .8fr);
  gap: 16px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  min-width: 0;
}
.panel-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}
h3 { font-size: 16px; }
.chart { min-height: 370px; padding: 12px; }
.chart.compact { min-height: 370px; }
.chart.tall { min-height: 565px; }
.chart.benchmark { min-height: 620px; }
.chart.graph-small {
  min-height: 360px;
}
.chart.graph-small svg {
  max-width: 640px;
  margin: 0 auto;
}
.chart.graph-medium svg {
  max-width: 820px;
  margin: 0 auto;
}
.chart.graph-large svg {
  max-width: 100%;
  margin: 0 auto;
}
svg { display: block; width: 100%; height: auto; }
.table-wrap { max-height: 360px; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  position: sticky;
  top: 0;
  background: #eaf0f6;
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}
td {
  padding: 9px 10px;
  border-bottom: 1px solid #edf2f7;
  white-space: nowrap;
}
.pos { color: var(--red); font-weight: 700; }
.neg { color: var(--green); font-weight: 700; }
.empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
}
@media (max-width: 980px) {
  .layout, .grid.two, .kpis, .latest-panel, .latest-metrics, .inline-actions { grid-template-columns: 1fr; }
}
