:root {
  --bg: #f3efe4;
  --panel: rgba(255, 251, 245, 0.86);
  --line: rgba(58, 48, 34, 0.16);
  --ink: #1f2930;
  --muted: #5d695e;
  --accent: #0e7490;
  --accent-2: #9a3412;
  --accent-3: #3f6212;
  --accent-4: #7c2d12;
  --warn: #b45309;
  --shadow: 0 18px 40px rgba(59, 45, 23, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(14, 116, 144, 0.22), transparent 28%),
    radial-gradient(circle at top right, rgba(154, 52, 18, 0.16), transparent 24%),
    linear-gradient(180deg, #faf7f2 0%, var(--bg) 100%);
}

.page {
  width: min(1280px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.hero,
.controls,
.chart-card,
.summary-grid article {
  background: var(--panel);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero {
  border-radius: 28px;
  padding: 28px;
  display: grid;
  gap: 20px;
  grid-template-columns: 1.7fr 1fr;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
  font-size: 12px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1;
}

.subtitle {
  margin-top: 14px;
  max-width: 56ch;
  color: var(--muted);
  line-height: 1.5;
}

.hero-stats {
  display: grid;
  gap: 14px;
}

.hero-stats article,
.summary-grid article {
  border-radius: 18px;
  padding: 18px;
}

.label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.hero-stats strong,
.summary-grid strong {
  font-size: clamp(1.05rem, 1.8vw, 1.4rem);
  overflow-wrap: anywhere;
}

.controls {
  margin-top: 20px;
  border-radius: 22px;
  padding: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  align-items: end;
}

.controls label {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.controls span {
  font-size: 13px;
  color: var(--muted);
}

select,
input,
button {
  width: 100%;
  min-width: 0;
  border-radius: 14px;
  border: 1px solid rgba(31, 41, 48, 0.14);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  padding: 12px 14px;
  font: inherit;
}

button {
  cursor: pointer;
  font-weight: 600;
  background: linear-gradient(135deg, var(--accent), #155e75);
  color: white;
}

.summary-grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.status-banner {
  margin-top: 18px;
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(255, 251, 245, 0.86);
  border: 1px solid var(--line);
  color: var(--muted);
  box-shadow: var(--shadow);
}

.status-banner.error {
  color: #991b1b;
  border-color: rgba(153, 27, 27, 0.24);
  background: rgba(254, 242, 242, 0.92);
}

.status-banner.hidden {
  display: none;
}

.charts {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.chart-card {
  border-radius: 24px;
  padding: 20px;
  min-height: 320px;
}

.table-card {
  min-height: auto;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 14px;
}

.chart-header p {
  color: var(--muted);
  font-size: 14px;
}

.chart {
  width: 100%;
  min-height: 240px;
}

.chart svg {
  width: 100%;
  height: 260px;
  display: block;
}

.empty-state {
  min-height: 220px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 18px;
}

.legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.legend i {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.mode-chip {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.mode-chip.full_gas {
  background: rgba(63, 98, 18, 0.12);
  color: var(--accent-3);
}

.mode-chip.scd41_only {
  background: rgba(14, 116, 144, 0.12);
  color: var(--accent);
}

.mode-chip.unknown {
  background: rgba(180, 83, 9, 0.14);
  color: var(--warn);
}

@media (max-width: 980px) {
  .hero,
  .charts,
  .controls,
  .summary-grid {
    grid-template-columns: 1fr;
  }
}
