/* Railway Quota Insight — public site.
   Provenance is carried by colour and label together, never colour alone. */

:root {
  --ink: #16202c;
  --ink-soft: #5b6b7a;
  --line: #dbe2ea;
  --bg: #f6f8fa;
  --card: #ffffff;
  --accent: #1f5f9e;
  --observed: #0d6b3f;
  --observed-bg: #e4f4ec;
  --inferred: #7a4a00;
  --inferred-bg: #fdf0dc;
  --estimated: #5a3d8a;
  --estimated-bg: #efe8fa;
  --presumed: #6b6b6b;
  --presumed-bg: #ececec;
  --warn: #8a2c1b;
  --warn-bg: #fdecea;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

a { color: var(--accent); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.9rem 1.5rem;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 0.7rem; text-decoration: none; color: inherit; }
.brand-mark {
  display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 9px;
  background: var(--accent); color: #fff; font-weight: 700; letter-spacing: 0.5px;
}
.brand-copy { display: flex; flex-direction: column; line-height: 1.25; }
.brand-copy small { color: var(--ink-soft); font-size: 0.78rem; }

.topbar nav { display: flex; gap: 1.2rem; }
.topbar nav a { text-decoration: none; font-weight: 500; }

.shell { max-width: 1100px; margin: 0 auto; padding: 1.5rem; }

.hero { padding: 1.5rem 0 0.5rem; }
.hero.compact h1 { font-size: 1.6rem; }
.hero h1 { font-size: 2rem; margin: 0 0 0.5rem; line-height: 1.25; }
.lede { color: var(--ink-soft); max-width: 62ch; margin: 0 0 1rem; }
.tag-line { font-size: 0.85rem; color: var(--ink-soft); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.25rem 1.4rem;
  margin: 1.2rem 0;
}
.card h2 { margin-top: 0; font-size: 1.15rem; }
.card.warn { background: var(--warn-bg); border-color: #f0c4bd; }
.card.warn h2 { color: var(--warn); }

.search { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: flex-end; }
.search label { display: block; width: 100%; font-size: 0.85rem; color: var(--ink-soft); }
.search input, .filters input, .filters select {
  padding: 0.6rem 0.7rem; border: 1px solid var(--line); border-radius: 8px;
  font-size: 1rem; min-width: 240px; background: #fff; color: var(--ink);
}
.search button, .filters button, .button {
  padding: 0.62rem 1.1rem; border: 0; border-radius: 8px;
  background: var(--accent); color: #fff; font-size: 1rem; cursor: pointer;
  text-decoration: none; display: inline-block;
}

.filters { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.filters label { font-size: 0.85rem; color: var(--ink-soft); }

.stats { display: flex; flex-wrap: wrap; gap: 0.8rem; margin: 0.8rem 0; }
.stat {
  flex: 1 1 150px; padding: 0.8rem; border: 1px solid var(--line);
  border-radius: 10px; background: var(--bg);
}
.stat strong { display: block; font-size: 1.5rem; }
.stat span { font-size: 0.8rem; color: var(--ink-soft); }

.tag {
  display: inline-block; padding: 0.12rem 0.5rem; border-radius: 999px;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em; vertical-align: middle;
}
.tag-observed  { background: var(--observed-bg);  color: var(--observed); }
.tag-inferred  { background: var(--inferred-bg);  color: var(--inferred); }
.tag-estimated { background: var(--estimated-bg); color: var(--estimated); }
.tag-presumed  { background: var(--presumed-bg);  color: var(--presumed); }

.chip {
  display: inline-block; margin: 0 0.2rem 0.2rem 0; padding: 0.1rem 0.45rem;
  border-radius: 6px; font-size: 0.72rem; background: var(--bg); border: 1px solid var(--line);
}
.chip-presumed { background: var(--presumed-bg); color: var(--presumed); font-style: italic; }

table.grid { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.grid th, table.grid td {
  text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.grid th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--ink-soft); }
.card > table.grid, .quota-group > table.grid { display: block; overflow-x: auto; }

.quota-group {
  border: 1px solid var(--line); border-left: 4px solid var(--inferred);
  border-radius: 10px; padding: 1rem; margin: 1rem 0; background: var(--bg);
}
.quota-group.conf-low, .quota-group.conf-very_low { border-left-color: var(--warn); }
.quota-group header { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: baseline; }
.quota-group h3 { margin: 0 0 0.5rem; font-size: 1rem; }
.conf { font-size: 0.85rem; color: var(--ink-soft); }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1rem; margin: 0.8rem 0 0; font-size: 0.9rem; }
.facts dt { color: var(--ink-soft); }
.facts dd { margin: 0; }

.labels { display: grid; grid-template-columns: max-content 1fr; gap: 0.5rem 1rem; }
.labels dd { margin: 0; }

.note { font-size: 0.85rem; color: var(--ink-soft); }
.muted { color: var(--ink-soft); }
.small { font-size: 0.8rem; }
.warn-inline { color: var(--warn); font-weight: 600; font-size: 0.9rem; }

.steps, .caveats { padding-left: 1.2rem; }
.steps li, .caveats li { margin-bottom: 0.6rem; }

.train-list { list-style: none; padding: 0; margin: 0; }
.train-list li {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: 0.55rem 0; border-bottom: 1px solid var(--line);
}
.train-list a { text-decoration: none; }
.train-list a span { color: var(--ink-soft); margin-left: 0.5rem; }
.train-list em { color: var(--ink-soft); font-size: 0.85rem; font-style: normal; }

.crumbs { font-size: 0.85rem; color: var(--ink-soft); margin-bottom: 0.5rem; }

pre.code {
  background: var(--ink); color: #e7eef5; padding: 0.9rem 1rem;
  border-radius: 8px; overflow-x: auto; font-size: 0.82rem;
}
code { background: var(--bg); padding: 0.08rem 0.3rem; border-radius: 4px; font-size: 0.88em; }

.footer {
  max-width: 1100px; margin: 2rem auto 3rem; padding: 0 1.5rem;
  color: var(--ink-soft); font-size: 0.9rem;
}
.disclaimer {
  background: var(--card); border: 1px solid var(--line);
  border-left: 4px solid var(--warn); border-radius: 10px; padding: 1rem 1.2rem;
}
.disclaimer h2 { margin-top: 0; font-size: 1rem; color: var(--warn); }
.disclaimer p { margin: 0.5rem 0; }

@media (max-width: 620px) {
  .hero h1 { font-size: 1.5rem; }
  .topbar { padding: 0.8rem 1rem; }
  .shell { padding: 1rem; }
  .facts, .labels { grid-template-columns: 1fr; }
}
