/* Embedded dashboard styles. */
: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;
}

.fuel-map-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  color: var(--green);
  font-size: 14px;
  font-weight: 700;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.fuel-map-link:hover { text-decoration-thickness: 2px; }
.fuel-map-link:focus-visible { outline: 3px solid rgba(22, 134, 79, 0.22); outline-offset: 4px; border-radius: 2px; }

.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;
}

.city-trends-section {
  margin-top: 42px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
}

.section-heading h2 { margin: 0; font-size: 28px; letter-spacing: -0.035em; }
.section-heading > p { max-width: 420px; margin: 0; color: var(--muted); font-size: 13px; text-align: right; }

.city-trends {
  display: grid;
  gap: 18px;
}

.city-trend {
  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);
}

.city-trend__header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 24px 15px;
}

.city-trend__header h3 { margin: 0; font-size: 22px; letter-spacing: -0.025em; }
.city-trend__metrics { flex: none; text-align: right; }
.city-trend__value-line {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 5px;
}
.city-trend__value { margin: 0; font-size: 28px; font-weight: 760; letter-spacing: -0.03em; }
.city-trend__period { margin: -1px 0 8px; color: var(--muted); font-size: 11px; }

.city-trend__help { position: relative; }

.city-trend__help-button {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel-high);
  color: var(--muted);
  cursor: help;
  font-size: 13px;
  font-weight: 800;
  list-style: none;
}

.city-trend__help-button::-webkit-details-marker { display: none; }
.city-trend__help-button::marker { content: ""; }

.city-trend__help-button:hover,
.city-trend__help-button:focus-visible,
.city-trend__help[open] .city-trend__help-button {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
  outline: none;
}

.city-trend__help-popover {
  position: absolute;
  z-index: 5;
  top: calc(100% + 7px);
  right: 0;
  display: none;
  width: min(360px, calc(100vw - 48px));
  padding: 14px 15px;
  border: 1px solid #c9d6ce;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.99);
  box-shadow: 0 16px 38px rgba(26, 54, 39, 0.18);
  color: var(--text);
  font-size: 12px;
  line-height: 1.5;
  text-align: left;
}

.city-trend__help-popover::before {
  position: absolute;
  right: 0;
  bottom: 100%;
  left: 0;
  height: 8px;
  content: "";
}

.city-trend__help-popover strong { display: block; margin-bottom: 8px; font-size: 13px; }
.city-trend__help-popover p { margin: 0; }
.city-trend__help-popover p + p { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }

.city-trend__help:hover .city-trend__help-popover,
.city-trend__help[open] .city-trend__help-popover { display: block; }

.city-trend__direction {
  display: inline-block;
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--panel-high);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.city-trend__direction--improving { background: var(--green-soft); color: var(--green); }
.city-trend__direction--worsening { background: var(--red-soft); color: var(--red); }
.city-trend__direction--unknown { background: rgba(168, 112, 18, 0.11); color: var(--yellow); }
.city-trend__coverage { margin: 8px 0 0; color: var(--muted); font-size: 12px; }

.city-trend__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 12px 24px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--panel-high);
  color: var(--muted);
  font-size: 12px;
}

.trend-swatch {
  display: inline-block;
  width: 18px;
  height: 3px;
  margin: 0 6px 3px 0;
  border-radius: 999px;
  background: var(--text);
  vertical-align: middle;
}

.trend-swatch--100 { background: #7657a8; }
.trend-swatch--g95 { background: #16864f; }
.trend-swatch--95 { background: #bf721d; }
.trend-swatch--direction { height: 2px; background: repeating-linear-gradient(90deg, #287aa0 0 8px, transparent 8px 13px); }
.trend-swatch--partial { background: repeating-linear-gradient(90deg, var(--muted) 0 5px, transparent 5px 8px); }

.city-chart-wrap { padding-top: 18px; }
.city-chart-wrap canvas { min-height: 260px; }

.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); }

.station__notice {
  margin: 0 24px 18px;
  padding: 13px 16px;
  border: 1px solid rgba(197, 65, 58, 0.35);
  border-radius: 10px;
  background: var(--red-soft);
  color: #982e29;
  font-size: 13px;
  line-height: 1.45;
}

.station__notice strong { display: block; margin-bottom: 4px; }
.station__notice p { margin: 0; }
.station__notice p.station__notice-action { margin-top: 6px; font-weight: 700; }

.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-stats__empty { padding: 18px; background: var(--panel-high); color: var(--muted); font-size: 13px; }
.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; }
.fuel-stat__timing {
  margin: 7px 0 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.4;
}
.fuel-stat__previous {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 550;
}
.fuel-stat__delivery {
  margin: 8px 0 0;
  color: #9a6108;
  font-size: 12px;
  font-weight: 750;
}
.fuel-stat__delivery-label,
.fuel-stat__delivery-source { display: block; }
.fuel-stat__delivery-source {
  margin-top: 2px;
  font-size: 11px;
  font-weight: 600;
}
.fuel-stat__delivery--soon { color: #744800; }
.fuel-stat__supply {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}
.fuel-stat__unloading {
  margin: 8px 0 0;
  color: #7b46a1;
  font-size: 12px;
  font-weight: 750;
}
.fuel-stat__observed {
  margin: 7px 0 0;
  color: #0d693b;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.4;
}
.fuel-stat__observed-detail {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}
.is-yes { color: var(--green); }
.is-no { color: var(--red); }
.is-unknown { color: var(--muted); }
.is-observed { color: #0d693b; }
.is-unload { color: #7b46a1; }

.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--observed {
  background: repeating-linear-gradient(135deg, #8fd3ae 0 3px, #0d693b 3px 4px);
}
.legend--no { background: #d95d55; }
.legend--delivery { width: 17px; height: 4px; margin-bottom: 3px; background: #d98b13; }
.legend--unload { width: 17px; background: #7b46a1; }
.legend--gap { background: #dce5df; }
.tooltip .is-unload { font-weight: 800; }

@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 { flex-wrap: wrap; padding: 19px 18px 14px; }
  .station__notice { margin: 0 18px 16px; }
  .chart-wrap { padding-left: 8px; padding-right: 8px; }
  .section-heading { align-items: start; flex-direction: column; gap: 7px; }
  .section-heading > p { text-align: left; }
  .city-trend__header { align-items: start; flex-direction: column; padding: 19px 18px 14px; }
  .city-trend__metrics { text-align: left; }
  .city-trend__value-line { justify-content: flex-start; }
  .city-trend__help-popover { right: auto; left: 0; }
  .city-trend__legend { padding-left: 18px; padding-right: 18px; }
}

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