:root {
  color-scheme: light;
  --ink: #132238;
  --muted: #637083;
  --navy: #101b2d;
  --blue: #2f6cf6;
  --blue-dark: #1750d4;
  --blue-pale: #eaf0ff;
  --paper: #ffffff;
  --canvas: #f2f5f9;
  --rule: #dfe5ed;
  --orange: #ef773f;
  --shadow: 0 24px 70px rgba(16, 27, 45, 0.14);
  --radius: 22px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% -10%, rgba(47, 108, 246, 0.2), transparent 32rem),
    var(--navy);
}

button,
select {
  font: inherit;
}

button,
select,
a {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 26px 0 32px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 50px;
  margin-bottom: 24px;
  color: white;
}

.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: inherit;
  font-size: 1.05rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 9px;
  background: var(--blue);
}

.brand-mark svg {
  width: 22px;
  fill: white;
}

.brand-mark-shine {
  fill: none;
  stroke: var(--blue);
  stroke-linecap: round;
  stroke-width: 2.5;
}

.dashboard {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.dashboard-topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  padding: 30px 34px 28px;
  border-bottom: 1px solid var(--rule);
}

.eyebrow,
.section-label,
.stat-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin: 5px 0 0;
  font-size: clamp(1.75rem, 4vw, 2.55rem);
  letter-spacing: -0.045em;
  line-height: 1.1;
}

h2 {
  margin: 4px 0 0;
  font-size: 1.25rem;
  letter-spacing: -0.025em;
}

.region-control {
  display: grid;
  min-width: 220px;
  gap: 7px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.region-control select {
  width: 100%;
  min-height: 46px;
  padding: 0 42px 0 14px;
  border: 1px solid #cfd7e3;
  border-radius: 10px;
  color: var(--ink);
  background: #fff
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='8' viewBox='0 0 14 8'%3E%3Cpath fill='none' stroke='%23132238' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.8' d='m1 1 6 6 6-6'/%3E%3C/svg%3E")
    calc(100% - 15px) center / 14px 8px no-repeat;
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: normal;
  text-transform: none;
  appearance: none;
}

.region-control select:focus-visible,
.range-tabs button:focus-visible,
.chart-hit-area:focus-visible {
  outline: 3px solid rgba(47, 108, 246, 0.3);
  outline-offset: 2px;
}

.loading-state,
.error-state {
  min-height: 520px;
  padding: 80px 34px;
  text-align: center;
}

.loading-state {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.loading-pulse {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--blue);
  animation: pulse 1.2s infinite ease-in-out;
}

@keyframes pulse {
  50% { transform: scale(0.65); opacity: 0.35; }
}

.error-state p {
  margin-bottom: 5px;
}

.dashboard-content {
  animation: reveal 360ms ease-out both;
}

@keyframes reveal {
  from { transform: translateY(6px); opacity: 0; }
}

.snapshot {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(420px, 1.35fr);
  gap: 38px;
  padding: 34px;
  background: linear-gradient(112deg, #fff 0%, #fff 52%, #f8faff 100%);
}

.price-block {
  padding-right: 34px;
  border-right: 1px solid var(--rule);
}

.price-line {
  display: flex;
  align-items: baseline;
  margin-top: 5px;
}

.current-price {
  font-size: clamp(3.8rem, 8vw, 6.6rem);
  font-variant-numeric: tabular-nums;
  font-weight: 720;
  letter-spacing: -0.075em;
  line-height: 0.98;
}

.price-unit {
  margin-left: 12px;
  color: var(--muted);
  font-size: 1.5rem;
  font-weight: 650;
}

.latest-date {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.decision-block {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 26px;
  align-items: center;
}

.status-pill {
  display: flex;
  min-height: 78px;
  padding: 16px 19px;
  flex-direction: column;
  justify-content: center;
  border-radius: 14px;
  color: #fff;
}

#status-label {
  font-size: 1.35rem;
  font-weight: 780;
  letter-spacing: -0.025em;
}

#status-change {
  margin-top: 3px;
  font-size: 0.9rem;
  font-weight: 650;
  opacity: 0.9;
}

.status-very-expensive { background: #c62331; }
.status-expensive { color: #201900; background: #ffbf17; }
.status-typical { color: #10263c; background: #96bfe2; }
.status-cheap { color: #20301b; background: #cfe1c4; }
.status-very-cheap { background: #08a64b; }

.tank-guidance {
  display: flex;
  gap: 13px;
  align-items: center;
}

.tank-icon {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 12px;
  color: var(--blue);
  background: var(--blue-pale);
}

.tank-icon svg {
  width: 31px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.tank-level {
  margin: 2px 0 0;
  font-size: 1.55rem;
  font-weight: 780;
  letter-spacing: -0.035em;
}

.chart-section {
  padding: 30px 34px 20px;
  border-top: 1px solid var(--rule);
}

.chart-header {
  display: flex;
  gap: 24px;
  align-items: end;
  justify-content: space-between;
}

.range-tabs {
  display: inline-flex;
  padding: 4px;
  gap: 3px;
  border-radius: 10px;
  background: var(--canvas);
}

.range-tabs button {
  min-width: 43px;
  min-height: 36px;
  padding: 0 11px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 750;
}

.range-tabs button:hover {
  color: var(--ink);
}

.range-tabs button.active {
  color: white;
  background: var(--ink);
  box-shadow: 0 2px 7px rgba(16, 27, 45, 0.2);
}

.chart-legend {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
  gap: 22px;
  color: var(--muted);
  font-size: 0.82rem;
}

.chart-legend span {
  display: inline-flex;
  gap: 7px;
  align-items: center;
}

.legend-line {
  display: inline-block;
  width: 22px;
  height: 3px;
  border-radius: 3px;
}

.price-legend { background: var(--orange); }
.average-legend { background: var(--blue); }

.chart-wrap {
  position: relative;
  width: 100%;
  margin-top: 4px;
}

#price-chart {
  display: block;
  width: 100%;
  height: auto;
  min-height: 250px;
  overflow: visible;
}

.grid-line {
  stroke: #e4e9f0;
  stroke-width: 1;
}

.axis-label {
  fill: #7b8798;
  font-size: 15px;
  font-weight: 600;
}

.average-area {
  fill: url(#average-fill);
  opacity: 0.14;
}

.price-chart-line,
.average-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.price-chart-line {
  stroke: var(--orange);
  stroke-width: 2;
}

.average-line {
  stroke: var(--blue);
  stroke-width: 2.75;
}

.focus-marker line {
  stroke: #9ba7b7;
  stroke-dasharray: 4 5;
  stroke-width: 1;
}

#focus-price-dot {
  fill: white;
  stroke: var(--orange);
  stroke-width: 3;
}

#focus-average-dot {
  fill: white;
  stroke: var(--blue);
  stroke-width: 3;
}

.chart-hit-area {
  fill: transparent;
  cursor: crosshair;
}

.chart-tooltip {
  position: absolute;
  z-index: 2;
  min-width: 170px;
  padding: 10px 12px;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: white;
  background: rgba(16, 27, 45, 0.94);
  box-shadow: 0 10px 30px rgba(16, 27, 45, 0.2);
  font-size: 0.8rem;
  line-height: 1.5;
  transform: translate(-50%, -110%);
}

.tooltip-date {
  margin-bottom: 4px;
  color: #b9c4d5;
}

.tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.tooltip-row strong { font-variant-numeric: tabular-nums; }
.tooltip-price strong { color: #ffa77e; }
.tooltip-average strong { color: #91b1ff; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  border-top: 1px solid var(--rule);
  background: #f8fafc;
}

.stats-grid article {
  min-width: 0;
  padding: 22px 20px;
  border-right: 1px solid var(--rule);
}

.stats-grid article:last-child {
  border-right: 0;
}

.stat-value {
  margin: 7px 0 0;
  font-size: 1.3rem;
  font-variant-numeric: tabular-nums;
  font-weight: 760;
  letter-spacing: -0.025em;
  white-space: nowrap;
}

.stat-value::after {
  content: " p/l";
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  padding: 18px 6px 0;
  color: #98a7ba;
  font-size: 0.77rem;
  line-height: 1.5;
}

.site-footer p {
  margin: 0;
}

@media (max-width: 900px) {
  .snapshot {
    grid-template-columns: 1fr;
  }

  .price-block {
    padding: 0 0 28px;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .stats-grid article:nth-child(3) {
    border-right: 0;
  }

  .stats-grid article:nth-child(-n + 3) {
    border-bottom: 1px solid var(--rule);
  }
}

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

  .site-header {
    margin-bottom: 14px;
  }

  .dashboard-topbar {
    padding: 24px 20px;
    flex-direction: column;
    align-items: stretch;
  }

  .region-control {
    min-width: 0;
  }

  .snapshot,
  .chart-section {
    padding: 26px 20px;
  }

  .decision-block {
    grid-template-columns: 1fr;
  }

  .chart-header {
    align-items: stretch;
    flex-direction: column;
  }

  .range-tabs {
    width: 100%;
  }

  .range-tabs button {
    min-width: 0;
    flex: 1;
    padding-inline: 5px;
  }

  .chart-legend {
    justify-content: flex-start;
  }

  #price-chart {
    min-height: 215px;
  }

  .axis-label {
    font-size: 32px;
    font-weight: 650;
  }

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

  .stats-grid article:nth-child(3) {
    border-right: 1px solid var(--rule);
  }

  .stats-grid article:nth-child(even) {
    border-right: 0;
  }

  .stats-grid article:nth-child(-n + 4) {
    border-bottom: 1px solid var(--rule);
  }

  .site-footer {
    flex-direction: column;
    gap: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
