:root {
  --bg: #e8edf3;
  --paper: #ffffff;
  --ink: #0f172a;
  --muted: #475569;
  --green: #16a34a;
  --green-ink: #052e16;
  --yellow: #eab308;
  --blue: #7dd3fc;
  --blue-ink: #082f49;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  cursor: none;
}
body {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 700 22px/1.25 Manrope, Arial, sans-serif;
}

.plaque {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 64px;
  padding: 10px 28px;
  background: #fff;
  border-bottom: 1px solid #dbe3ec;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.plaque-name {
  margin: 0;
  font: 600 22px/1.2 Manrope, Arial, sans-serif;
  color: #111;
}

.plaque-demo {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: #111;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.clock {
  color: transparent;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.clock-end {
  justify-self: end;
  color: var(--muted);
}

.screen {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
  padding: 10px 20px 14px;
}

.controls {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 12px 16px;
  border-radius: 20px;
  background: var(--paper);
  cursor: auto;
}

.controls-head h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -.03em;
}

.controls-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.gate-map {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.gate-dot {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 72px;
  padding: 8px 10px;
  border: 0;
  border-radius: 14px;
  font: inherit;
  cursor: pointer;
}

.gate-dot b { font-size: 20px; line-height: 1; }
.gate-dot span { font-size: 11px; }
.gate-dot.is-on { background: #dcfce7; color: #14532d; }
.gate-dot.is-off { background: #eef2f6; color: #64748b; }
.gate-dot.is-now { outline: 2px solid #0f172a; }

.interval { min-width: 220px; }

.setting {
  display: grid;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 16px;
  background: var(--paper);
}

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

.stepper {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  gap: 8px;
  align-items: center;
}

.stepper b {
  text-align: center;
  font-size: 22px;
}

.stepper button {
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: #eef2f6;
  color: var(--ink);
  font: 800 22px/1 Manrope, Arial, sans-serif;
  cursor: pointer;
}

.gate-counts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.gate-counts div { display: grid; gap: 2px; }
.gate-counts b { font-size: 22px; line-height: 1; }
.gate-counts span { color: var(--muted); font-size: 12px; }
.gate-counts .on { color: #15803d; }
.gate-counts .off { color: #94a3b8; }

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 200px));
  gap: 12px;
}

.kpi {
  display: grid;
  align-content: center;
  min-height: 58px;
  padding: 8px 16px;
  border-radius: 16px;
  background: var(--paper);
}

.kpi b {
  font-size: 28px;
  line-height: 1;
  letter-spacing: -.04em;
}

.kpi span {
  color: var(--muted);
  font-size: 15px;
}

.board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  min-height: 0;
}

.gate {
  display: grid;
  grid-template-rows: auto repeat(3, minmax(0, 1fr));
  min-height: 0;
  overflow: hidden;
  border-radius: 20px;
  background: var(--paper);
}

.gate.is-idle { background: #f8fafc; }

.gate-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  padding: 10px 16px 4px;
}

.gate-head h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.gate-head small {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.route {
  display: grid;
  grid-template-columns: minmax(170px, 20%) minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
  padding: 6px 16px 8px;
}

.route + .route { border-top: 1px solid #e8eef4; }

.meta { display: grid; align-content: start; gap: 2px; min-width: 0; }

.route-name {
  font-size: 20px;
  letter-spacing: -.03em;
}

.vehicle {
  color: var(--ink) !important;
}

.meta p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.meta strong {
  color: var(--ink);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.bars {
  display: grid;
  gap: 5px;
  align-content: center;
}

.bar-row {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) minmax(190px, 26%);
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.bar-label {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.track {
  position: relative;
  overflow: hidden;
  height: 28px;
  border-radius: 8px;
  background: var(--yellow);
}

.track i {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--p, 0%);
  background: var(--green);
}

.track b {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 10px;
  color: var(--green-ink);
  font-size: 13px;
  mix-blend-mode: multiply;
}

.people {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.person {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 28px;
  padding: 0 8px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--blue);
  color: var(--blue-ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person.vacant {
  justify-content: flex-start;
  width: 100%;
  background: #eef2f6;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.2;
  white-space: normal;
  text-overflow: unset;
}

@media (max-width: 1400px) {
  .route-name { font-size: 24px; }
  .track { height: 42px; }
  .track b, .person, .meta p { font-size: 16px; }
}

@media (max-width: 1100px) {
  html, body { overflow: auto; cursor: auto; }
  .board, .route, .kpis { grid-template-columns: 1fr; }
  .screen { height: auto; }
}
