:root {
  color-scheme: light;
  --bg: #f2f0e7;
  --ink: #18211d;
  --muted: #65736d;
  --line: #d8d2c3;
  --panel: #fffdf5;
  --panel-2: #ece6d8;
  --green: #1ba768;
  --orange: #d97706;
  --yellow: #ca8a04;
  --red: #dc2626;
  --blue: #1d4ed8;
  --shadow: 0 18px 50px rgba(61, 52, 29, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(24, 33, 29, 0.045) 1px, transparent 1px),
    linear-gradient(rgba(24, 33, 29, 0.045) 1px, transparent 1px),
    radial-gradient(circle at 10% 10%, rgba(27, 167, 104, 0.13), transparent 28rem),
    var(--bg);
  background-size: 38px 38px, 38px 38px, auto, auto;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 8px 0 20px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  max-width: 720px;
  font-size: clamp(34px, 6vw, 74px);
  line-height: 0.93;
  font-weight: 700;
}

h2 {
  font-size: 24px;
  line-height: 1.1;
}

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

select,
button,
input {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  min-height: 42px;
}

select,
input {
  padding: 0 12px;
}

button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  cursor: pointer;
  box-shadow: 0 8px 0 #d5cfbf;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

button:hover {
  transform: translateY(2px);
  box-shadow: 0 6px 0 #d5cfbf;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.button-icon {
  font-size: 20px;
  line-height: 1;
}

.notice {
  border: 1px solid #ccb867;
  border-left: 8px solid #d1a51f;
  background: #fff8d7;
  padding: 14px 16px;
  border-radius: 6px;
  color: #544512;
}

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

.metric {
  min-height: 150px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.metric::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 7px;
  background: var(--accent, var(--line));
}

.metric span,
.metric small {
  color: var(--muted);
}

.metric strong {
  font-size: 58px;
  line-height: 0.95;
}

.metric-total {
  --accent: var(--blue);
}

.metric-yes {
  --accent: var(--green);
}

.metric-warn {
  --accent: var(--orange);
}

.metric-no {
  --accent: var(--red);
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(300px, 0.8fr);
  gap: 14px;
  margin-top: 14px;
}

.panel {
  border: 1px solid var(--line);
  background: rgba(255, 253, 245, 0.92);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-head p,
.panel-head span {
  color: var(--muted);
  margin-top: 4px;
}

.chart-panel canvas {
  display: block;
  width: 100%;
  height: min(360px, 45vh);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f9f5ea;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 12px;
  color: var(--muted);
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
}

.dot.yes {
  background: var(--green);
}

.dot.queue {
  background: var(--orange);
}

.dot.low {
  background: var(--yellow);
}

.dot.no {
  background: var(--red);
}

.breakdown {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  gap: 7px;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.bar-track {
  height: 14px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 99px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: var(--width);
  background: var(--color);
}

.station-panel {
  margin-top: 14px;
}

.station-panel input {
  width: min(360px, 100%);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

table {
  width: 100%;
  min-width: 840px;
  border-collapse: collapse;
  background: #fffaf0;
  font-family: "Trebuchet MS", Verdana, sans-serif;
}

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

th {
  position: sticky;
  top: 0;
  background: #ebe2cf;
  color: #4f5b55;
  font-weight: 700;
}

tbody tr:hover {
  background: #f6ecd9;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-width: 108px;
  justify-content: center;
  border-radius: 999px;
  color: #fff;
  background: var(--color);
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 700;
}

.station-name {
  font-weight: 700;
  color: var(--ink);
}

.muted {
  color: var(--muted);
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 28px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100% - 36px));
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 14px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 900px) {
  .topbar,
  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

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

  .status-grid,
  .dashboard {
    grid-template-columns: 1fr;
  }

  .metric {
    min-height: 128px;
  }

  .metric strong {
    font-size: 48px;
  }
}
