:root {
  color-scheme: light;
  --bg: #f4f7f5;
  --panel: #ffffff;
  --panel-high: #f8faf9;
  --line: #d8e2dc;
  --text: #14231b;
  --muted: #64766c;
  --green: #16864f;
  --green-soft: rgba(22, 134, 79, 0.12);
  --red: #c5413a;
  --red-soft: rgba(197, 65, 58, 0.1);
  --yellow: #a87012;
  --radius: 18px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 80% -10%, rgba(45, 161, 101, 0.13), transparent 32rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.hero {
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
}

.hero__inner,
main,
footer {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.hero__inner {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  padding: 44px 0 34px;
}

.eyebrow,
.overview__label {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(22, 134, 79, 0.1);
}

h1 {
  margin: 0;
  font-size: clamp(36px, 6vw, 72px);
  font-weight: 720;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.subtitle {
  max-width: 620px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px 9px;
  min-width: 280px;
}

.controls label {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

select,
button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--text);
  font: inherit;
}

select {
  padding: 0 40px 0 13px;
  background: var(--panel-high);
}

button {
  padding: 0 17px;
  background: var(--green);
  color: #ffffff;
  font-weight: 750;
  cursor: pointer;
}

button:hover { filter: brightness(1.06); }
button:disabled { cursor: wait; opacity: 0.6; }
button:focus-visible, select:focus-visible { outline: 3px solid rgba(22, 134, 79, 0.22); outline-offset: 2px; }

main { padding: 28px 0 52px; }

.overview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
}

.overview__label { margin-bottom: 4px; color: var(--muted); }
.overview__value { margin: 0; font-size: 18px; font-weight: 680; }
.updated { margin: 0; color: var(--muted); font-size: 13px; text-align: right; }

.stations {
  display: grid;
  gap: 18px;
}

.station {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 16px 42px rgba(26, 54, 39, 0.08);
}

.station__header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px 16px;
}

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

.station h2 { margin: 0; font-size: 20px; letter-spacing: -0.02em; }

.station__status {
  flex: none;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 750;
}

.station__status--error { background: var(--red-soft); color: var(--red); }

.fuel-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--line);
}

.fuel-stat { padding: 14px 18px; background: var(--panel-high); }
.fuel-stat__name { margin: 0 0 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.fuel-stat__value { margin: 0; font-size: 18px; font-weight: 720; }
.fuel-stat__current { margin-left: 6px; font-size: 12px; font-weight: 650; }
.is-yes { color: var(--green); }
.is-no { color: var(--red); }

.chart-wrap {
  position: relative;
  padding: 14px 16px 10px;
}

.chart-wrap canvas {
  display: block;
  width: 100%;
  min-height: 190px;
  touch-action: pan-y;
}

.tooltip {
  position: absolute;
  z-index: 2;
  min-width: 150px;
  padding: 9px 11px;
  border: 1px solid #c9d6ce;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.97);
  color: var(--text);
  font-size: 12px;
  line-height: 1.5;
  pointer-events: none;
  transform: translate(-50%, -110%);
}

.tooltip strong { display: block; margin-bottom: 3px; }
.error { margin-bottom: 18px; padding: 14px 16px; border: 1px solid rgba(197, 65, 58, 0.35); border-radius: 12px; background: var(--red-soft); color: #982e29; }
.empty { padding: 56px 20px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); text-align: center; }

footer {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding: 0 0 36px;
  color: var(--muted);
  font-size: 12px;
}

.legend { display: inline-block; width: 10px; height: 10px; margin-right: 5px; border-radius: 3px; }
.legend--yes { background: #29a566; }
.legend--no { background: #d95d55; }
.legend--gap { background: #dce5df; }

@media (max-width: 720px) {
  .hero__inner { align-items: stretch; flex-direction: column; padding-top: 32px; }
  .controls { min-width: 0; }
  .overview { align-items: start; flex-direction: column; }
  .updated { text-align: left; }
  .station__header { padding: 19px 18px 14px; }
  .chart-wrap { padding-left: 8px; padding-right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
