:root {
  --background: #f0f9ff;
  --foreground: #0c4a6e;
  --card: #ffffff;
  --primary: #0369a1;
  --primary-strong: #0c4a6e;
  --on-primary: #ffffff;
  --accent: #16a34a;
  --accent-strong: #166534;
  --expensive: #c2410c;
  --muted: #e7eff5;
  --muted-foreground: #475569;
  --border: #bae6fd;
  --warning: #b45309;
  --shadow-card: 0 10px 30px -18px rgb(12 74 110 / 0.45);
  --radius: 18px;
  --sidebar: 248px;
  --nav-h: 72px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Fira Sans", system-ui, sans-serif;
  background:
    radial-gradient(900px 420px at 100% -10%, rgb(14 165 233 / 0.18), transparent 60%),
    var(--background);
  color: var(--foreground);
  line-height: 1.5;
}
button, input, select { font: inherit; }
:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

.app {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 18px;
  background: linear-gradient(180deg, #0c4a6e 0%, #075985 55%, #0369a1 100%);
  color: white;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 0 8px 28px;
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; letter-spacing: -0.02em; }
.brand small { color: rgb(255 255 255 / 0.82); font-size: 13px; }
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: #16a34a;
  color: white;
  font-weight: 700;
}
.side-nav, .bottom-nav { display: flex; }
.side-nav { flex-direction: column; gap: 6px; }
.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: rgb(255 255 255 / 0.88);
  text-align: left;
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease;
}
.nav-btn svg { width: 20px; height: 20px; flex: none; }
.nav-btn:hover { background: rgb(255 255 255 / 0.12); }
.nav-btn.active {
  background: #f0f9ff;
  color: var(--primary-strong);
  font-weight: 600;
}
.workspace { min-width: 0; }
.topbar { padding: 28px 32px 0; }
.eyebrow {
  margin: 0 0 4px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
h1 { margin: 0; font-size: 32px; letter-spacing: -0.03em; color: var(--primary-strong); }
.lead { margin: 6px 0 0; color: var(--muted-foreground); max-width: 62ch; }
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin: 18px 32px 0;
  padding: 16px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.filters label {
  display: grid;
  gap: 6px;
  color: var(--primary-strong);
  font-size: 13px;
  font-weight: 600;
}
.filters input, .filters select {
  height: 44px;
  min-width: 150px;
  border: 1px solid #7dd3fc;
  border-radius: 12px;
  background: #f8fcff;
  color: var(--primary-strong);
  padding: 0 12px;
}
.filters button {
  height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  background: var(--accent-strong);
  color: white;
  font-weight: 700;
  cursor: pointer;
}
.filters button:hover { background: #14532d; }
.filters button:disabled { opacity: 0.7; cursor: wait; }
.content { padding: 18px 32px 48px; }
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.two { grid-template-columns: 1fr 1fr; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 22px;
}
.card h2 { margin: 0 0 4px; font-size: 20px; letter-spacing: -0.02em; color: var(--primary-strong); }
.hint { margin: 0 0 16px; color: var(--muted-foreground); font-size: 14px; }
.answer {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  padding: 22px 24px;
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgb(22 163 74 / 0.12), rgb(3 105 161 / 0.08) 55%, white);
  border: 1px solid #86efac;
}
.answer h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.03em;
  color: var(--primary-strong);
}
.answer h2 em { font-style: normal; color: var(--accent-strong); }
.answer-price {
  margin: 0;
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--accent-strong);
  font-variant-numeric: tabular-nums;
}
.answer-price small {
  margin-left: 6px;
  font-size: 16px;
  font-weight: 600;
  color: var(--muted-foreground);
}
.answer p { margin: 0; }
.kpi {
  position: relative;
  overflow: hidden;
}
.kpi::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
}
.kpi.green::before { background: var(--accent); }
.kpi.blue::before { background: var(--primary); }
.kpi.amber::before { background: #f59e0b; }
.kpi-label { color: var(--muted-foreground); font-size: 13px; font-weight: 600; }
.kpi-value {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--primary-strong);
  font-variant-numeric: tabular-nums;
}
.kpi.green .kpi-value { color: var(--accent-strong); }
.kpi-note { margin: 8px 0 0; color: var(--muted-foreground); font-size: 13px; }
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 0 0 14px;
  color: var(--muted-foreground);
  font-size: 13px;
  font-weight: 600;
}
.swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 99px;
  margin-right: 6px;
  vertical-align: -1px;
}
.price-list { display: grid; gap: 8px; }
.scroll-list { max-height: 680px; overflow: auto; padding-right: 4px; }
.price-row {
  display: grid;
  grid-template-columns: minmax(132px, 190px) minmax(80px, 1fr) 96px minmax(120px, 200px);
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 6px 8px;
  border-radius: 12px;
}
.price-row.is-selected { background: #e0f2fe; }
.price-row.is-best { background: #f0fdf4; }
.price-name, .price-best {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-strong);
}
.price-best { color: var(--accent-strong); }
.price-best.missing { color: var(--muted-foreground); font-weight: 500; }
.price-euro {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  text-align: right;
  color: var(--primary-strong);
}
.track {
  height: 12px;
  border-radius: 99px;
  background: #e0f2fe;
  overflow: hidden;
}
.track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  min-width: 6px;
}
.rank {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-right: 8px;
  border-radius: 99px;
  background: var(--primary);
  color: white;
  font-size: 12px;
  font-weight: 700;
  vertical-align: middle;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 2px 8px;
  border-radius: 99px;
  background: #e0f2fe;
  color: var(--primary-strong);
  font-size: 13px;
  font-weight: 600;
}
.company-block {
  padding: 14px 0;
  border-top: 1px solid var(--border);
}
.company-block:first-child { border-top: 0; padding-top: 0; }
.company-block h3 {
  margin: 0 0 8px;
  font-size: 16px;
  color: var(--primary-strong);
}
.plot { margin: 0; }
.plot svg { width: 100%; height: auto; display: block; }
.axis { fill: #475569; font-size: 12px; font-family: "Fira Sans", system-ui, sans-serif; }
.empty, .empty-plot, .status {
  color: var(--muted-foreground);
}
.empty, .status { padding: 8px 0 16px; }
.empty-plot {
  min-height: 140px;
  display: grid;
  place-items: center;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 16px;
  padding: 16px;
}
.bottom-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--nav-h);
  background: white;
  border-top: 1px solid var(--border);
  justify-content: space-around;
  z-index: 20;
}
.bottom-nav .nav-btn {
  flex-direction: column;
  gap: 2px;
  justify-content: center;
  min-width: 58px;
  font-size: 11px;
  padding: 6px;
  color: var(--muted-foreground);
}
.bottom-nav .nav-btn.active {
  background: transparent;
  color: var(--primary);
}

@media (max-width: 1100px) {
  .kpis, .two { grid-template-columns: 1fr; }
  .price-row { grid-template-columns: minmax(110px, 160px) 1fr 88px; }
  .price-best { grid-column: 1 / -1; }
}
@media (max-width: 800px) {
  .app { display: block; }
  .sidebar { display: none; }
  .bottom-nav { display: flex; }
  .topbar, .content, .filters { margin-left: 16px; margin-right: 16px; }
  .topbar, .content { padding-left: 0; padding-right: 0; }
  .content { padding-bottom: calc(var(--nav-h) + 24px); }
  h1 { font-size: 26px; }
  .answer h2 { font-size: 22px; }
  .answer-price { font-size: 32px; }
  .filters label { width: calc(50% - 6px); }
  .filters input, .filters select, .filters button { width: 100%; min-width: 0; }
  .filters button { width: 100%; }
  .price-row {
    grid-template-columns: 1fr auto;
    grid-template-areas: "name euro" "track track" "best best";
  }
  .price-name { grid-area: name; }
  .price-euro { grid-area: euro; }
  .track { grid-area: track; }
  .price-best { grid-area: best; }
}
