:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --border: #e2e5ea;
  --text: #1c1f24;
  --muted: #6b7280;
  --accent: #2563eb;
  --down: #15803d;
  --up: #b91c1c;
  --cheap-bg: #fef9c3;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --panel: #1c1f24;
    --border: #2c3138;
    --text: #e8eaed;
    --muted: #9aa1ab;
    --accent: #60a5fa;
    --down: #4ade80;
    --up: #f87171;
    --cheap-bg: #3f3a16;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 1.5rem 1rem 3rem;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

main { max-width: 1100px; margin: 0 auto; }

h1 { font-size: 1.5rem; margin: 0 0 1.25rem; }

/* --- form --- */

form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
}

.field { display: flex; flex-direction: column; gap: 0.3rem; }
.field.grow { flex: 1 1 16rem; }
.field.narrow { width: 8rem; }

label { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

input, select, button {
  font: inherit;
  padding: 0.5rem 0.65rem;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

button {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  padding-inline: 1.25rem;
}

button:hover { filter: brightness(1.08); }

.actions { display: flex; gap: 0.5rem; }

.btn.secondary {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg);
  color: var(--muted);
  text-decoration: none;
}

.btn.secondary:hover { color: var(--text); border-color: var(--muted); }

/* --- banners --- */

.banner {
  margin: 1rem 0 0;
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
}

.banner.error { border-color: var(--up); color: var(--up); }
.banner.notice { color: var(--muted); }

.meta, .legend { color: var(--muted); font-size: 0.85rem; }
.meta { margin: 1.25rem 0 0.5rem; }
.legend { margin-top: 0.75rem; }

/* --- table --- */

.table-wrap {
  overflow-x: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
}

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

th, td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  white-space: nowrap;
}

thead th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(127, 127, 127, 0.06); }

.num { text-align: right; }
.center { text-align: center; }

.name { display: block; font-weight: 600; }
.brand, .address { color: var(--muted); font-size: 0.85rem; }
.brand { display: block; }

.price .value { display: block; font-variant-numeric: tabular-nums; }
.price .value.cheap {
  background: var(--cheap-bg);
  border-radius: 5px;
  padding: 0 0.3rem;
  font-weight: 600;
}

.change, .change-date { display: block; font-size: 0.75rem; }
.change-date { color: var(--muted); }
.down, .change.down { color: var(--down); }
.up, .change.up { color: var(--up); }

.open { color: var(--down); }
.shut { color: var(--up); }
tr.closed { opacity: 0.6; }

@media (max-width: 640px) {
  /* Drop the address column; the station name still identifies the row. */
  th:nth-child(2), td:nth-child(2) { display: none; }
}
