:root {
  --navy: #071422;
  --navy-2: #0c2238;
  --navy-3: #14314c;
  --ink: #eef4fb;
  --muted: #8aa0b6;
  --sky: #3ba3e0;
  --sky-2: #1b6ca8;
  --red: #e11d2e;
  --red-2: #9f1239;
  --gold: #f0c36a;
  --ok: #22c55e;
  --warn: #f59e0b;
  --card: rgba(12, 34, 56, 0.86);
  --line: rgba(255, 255, 255, 0.1);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --radius: 22px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: "Sarabun", "Sukhumvit Set", "Thonburi", system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: rgba(59, 163, 224, 0.35); }
button, a, .role, .zone-btn, .chip-btn { touch-action: manipulation; }
html, body { margin: 0; min-height: 100%; }
html { background: var(--navy); }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(59, 163, 224, 0.16), transparent 50%),
    radial-gradient(900px 500px at -10% 110%, rgba(225, 29, 46, 0.16), transparent 46%),
    var(--navy);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
button, input { font-family: inherit; }
button { cursor: default; border: 0; }
@media (hover: hover) and (pointer: fine) {
  button, a, .role { cursor: pointer; }
}
img { display: block; }

.app {
  min-height: 100dvh;
  max-width: 640px;
  margin: 0 auto;
  position: relative;
  background: linear-gradient(180deg, #071422 0%, #0a1b2c 100%);
  box-shadow: var(--shadow);
}

.screen { display: none; }
.screen.on { display: block; }

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + var(--safe-t)) 16px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 20, 34, 0.92);
  backdrop-filter: blur(12px);
  z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.brand img { width: 36px; height: 36px; border-radius: 10px; }
.brand b { display: block; font-size: 15px; letter-spacing: 0.04em; }
.brand span { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 5px 8px;
  border-radius: 999px;
  background: #3a2a08;
  color: var(--gold);
  border: 1px solid rgba(240, 195, 106, 0.35);
  white-space: nowrap;
}
.live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.18);
}
.live-dot.off { background: #64748b; box-shadow: none; }
.live-dot.warn { background: var(--warn); box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.2); }
.live-dot.hot { background: var(--red); box-shadow: 0 0 0 4px rgba(225, 29, 46, 0.25); animation: pulse 1.1s infinite; }

.scroll {
  overflow: visible;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px calc(24px + var(--safe-b));
}

h1 { font-size: 28px; line-height: 1.2; margin: 0 0 8px; letter-spacing: -0.03em; }
h2 { font-size: 18px; margin: 0 0 8px; }
p { margin: 0; color: var(--muted); line-height: 1.45; }

.hero {
  text-align: center;
  padding: 18px 8px 8px;
}
.hero img { width: 88px; height: 88px; margin: 0 auto 14px; border-radius: 24px; box-shadow: 0 12px 40px rgba(0,0,0,.4); }
.kicker { color: var(--sky); font-weight: 800; font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.12);
  color: #86efac;
  font-weight: 700;
  font-size: 13px;
  margin-top: 12px;
}
.status-pill.hot {
  background: rgba(225, 29, 46, 0.16);
  color: #fecaca;
}
.status-pill.wait {
  background: rgba(245, 158, 11, 0.14);
  color: #fde68a;
}

.hold-wrap {
  display: grid;
  place-items: center;
  margin: 28px 0 10px;
}
.hold {
  --p: 0;
  width: 196px;
  height: 196px;
  border: 0;
  border-radius: 50%;
  position: relative;
  color: #fff;
  background:
    radial-gradient(circle at 50% 42%, #ff4b58 0%, var(--red) 46%, var(--red-2) 100%);
  box-shadow:
    0 0 0 10px rgba(225, 29, 46, 0.16),
    0 22px 50px rgba(225, 29, 46, 0.28);
  display: grid;
  place-items: center;
  user-select: none;
  touch-action: none;
}
.hold::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: conic-gradient(#f0c36a calc(var(--p) * 1%), transparent 0);
  mask: radial-gradient(farthest-side, transparent calc(100% - 8px), #000 calc(100% - 7px));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 8px), #000 calc(100% - 7px));
  opacity: 0.95;
}
.hold b { font-size: 28px; letter-spacing: 0.02em; }
.hold small { display: block; font-size: 12px; opacity: 0.85; font-weight: 600; margin-top: 4px; }
.hold:active { transform: scale(0.98); }
.hold.sky {
  background: radial-gradient(circle at 50% 42%, #5ec2f0 0%, var(--sky-2) 60%, #0c3a5c 100%);
  box-shadow: 0 0 0 10px rgba(59,163,224,.16), 0 22px 50px rgba(27,108,168,.3);
}
.hold.ok {
  background: radial-gradient(circle at 50% 42%, #4ade80 0%, #15803d 70%);
  box-shadow: 0 0 0 10px rgba(34,197,94,.16), 0 22px 50px rgba(21,128,61,.3);
}

.hint { text-align: center; font-size: 13px; color: var(--muted); }

.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--navy-3);
  color: var(--ink);
  border-radius: 16px;
  padding: 14px 14px;
  font-size: 15px;
  font-weight: 700;
  min-height: 52px;
}
.btn:disabled { opacity: 0.45; }
.btn.ghost { background: transparent; }
.btn.red { background: var(--red); border-color: transparent; color: #fff; }
.btn.sky { background: var(--sky-2); border-color: transparent; color: #fff; }
.btn.gold { background: #3a2a08; color: var(--gold); border-color: rgba(240,195,106,.3); }
.btn.ok { background: #14532d; color: #bbf7d0; border-color: transparent; }
.btn.full { width: 100%; }
.btn.big { min-height: 64px; font-size: 17px; border-radius: 18px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-top: 12px;
}
.card h3 { margin: 0 0 8px; font-size: 14px; color: var(--muted); font-weight: 700; letter-spacing: 0.04em; }

.role-grid { display: grid; gap: 8px; margin-top: 12px; }
a.role, button.role { text-decoration: none; color: inherit; display: flex; width: 100%; text-align: left; font: inherit; -webkit-appearance: none; appearance: none; }
.role {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  width: 100%;
  border: 1px solid var(--line);
  background: var(--navy-2);
  color: var(--ink);
  border-radius: 18px;
  padding: 14px;
  min-height: 72px;
  -webkit-user-select: none;
  user-select: none;
}
.role .n {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--navy-3); color: var(--sky); font-weight: 800;
}
.role b { display: block; font-size: 15px; }
.role span { display: block; font-size: 12px; color: var(--muted); }
.role.student .n { background: #122c22; color: #86efac; }

.map-shell {
  position: relative;
  border-radius: 22px;
  overflow: auto;
  background: #c9d9b6;
  border: 1px solid var(--line);
  height: 42vh;
  min-height: 260px;
  -webkit-overflow-scrolling: touch;
}
.map-shell.tall { height: 52vh; }
.map-shell svg { width: 100%; height: auto; display: block; }
.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
}
.map-legend i {
  display: inline-block;
  width: 10px; height: 10px; border-radius: 3px; margin-right: 4px;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn {
  border: 1px solid var(--line);
  background: var(--navy-2);
  color: var(--ink);
  border-radius: 999px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 700;
}
.chip-btn.on { background: #3a1020; border-color: rgba(225,29,46,.45); color: #fecaca; }
.chip-btn.floor.on { background: #102a3d; border-color: rgba(59,163,224,.45); color: #bae6fd; }

.zone-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.zone-btn {
  border: 1px solid var(--line);
  background: var(--navy-2);
  color: var(--ink);
  border-radius: 16px;
  padding: 12px 10px;
  text-align: left;
  min-height: 58px;
}
.zone-btn small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.zone-btn.on { outline: 2px solid var(--gold); background: #2a2410; }
.zone-btn.red { background: #3a1020; border-color: rgba(225,29,46,.4); }

.dock {
  position: sticky;
  bottom: 0;
  padding: 10px 16px calc(12px + var(--safe-b));
  border-top: 1px solid var(--line);
  background: rgba(7, 20, 34, 0.96);
}

.queue {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin: 12px 0;
}
.q {
  flex: 1;
  text-align: center;
  padding: 10px 4px;
  border-radius: 16px;
  background: var(--navy-2);
  border: 1px solid var(--line);
  position: relative;
}
.q .num {
  width: 36px; height: 36px; margin: 0 auto 6px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 800;
  background: var(--navy-3);
}
.q small { display: block; font-size: 10px; color: var(--muted); line-height: 1.2; }
.q.active {
  border-color: var(--gold);
  background: #2c230c;
}
.q.active .num {
  background: conic-gradient(#f0c36a calc(var(--p) * 1%), #3a2a08 0);
  color: #071422;
}
.q.done { opacity: 0.55; }
.q.done .num { background: #14532d; color: #bbf7d0; }
.q.me { box-shadow: 0 0 0 2px rgba(59,163,224,.45); }

.timer {
  font-variant-numeric: tabular-nums;
  font-size: 56px;
  font-weight: 800;
  letter-spacing: -0.04em;
  text-align: center;
  line-height: 1;
  margin: 8px 0 4px;
}
.timer.hot { color: #fecaca; }

.banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border-radius: 16px;
  background: rgba(225, 29, 46, 0.16);
  border: 1px solid rgba(225, 29, 46, 0.35);
  color: #fecaca;
  font-weight: 700;
  line-height: 1.35;
}
.banner.sky { background: rgba(59,163,224,.12); border-color: rgba(59,163,224,.3); color: #bae6fd; }
.banner.ok { background: rgba(34,197,94,.12); border-color: rgba(34,197,94,.3); color: #bbf7d0; }

.pa-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  background: #102a3d;
  border: 1px solid rgba(59,163,224,.35);
  margin-top: 10px;
}
.pa-bar .eq { display: flex; gap: 3px; height: 18px; align-items: flex-end; }
.pa-bar .eq span {
  width: 3px; background: var(--sky); border-radius: 2px;
  animation: eq 0.7s infinite ease-in-out;
}
.pa-bar .eq span:nth-child(2) { animation-delay: .1s; }
.pa-bar .eq span:nth-child(3) { animation-delay: .2s; }
.pa-bar .eq span:nth-child(4) { animation-delay: .05s; }
.pa-bar .eq span:nth-child(5) { animation-delay: .18s; }

.advice {
  border-radius: 20px;
  padding: 14px;
  margin-top: 10px;
}
.advice.hide { background: #3a1020; color: #fecaca; }
.advice.run { background: #3a2a08; color: #fde68a; }
.advice.lock, .advice.wait { background: #102a3d; color: #bae6fd; }
.advice b { display: block; font-size: 16px; margin-bottom: 4px; }
.advice span { font-size: 13px; line-height: 1.4; opacity: 0.92; }

.silent body, body.silent .app { filter: saturate(0.7) brightness(0.55); }
body.silent .hold { box-shadow: none; }

.toast {
  position: absolute;
  left: 16px; right: 16px; top: calc(64px + var(--safe-t));
  background: #14314c;
  border: 1px solid var(--line);
  padding: 12px 14px;
  border-radius: 14px;
  z-index: 20;
  display: none;
  font-weight: 700;
}
.toast.on { display: block; }

.inapp {
  background: #3a2a08;
  color: #fde68a;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  padding: calc(10px + var(--safe-t)) 14px 10px;
  z-index: 30;
}
.inapp[hidden] { display: none !important; }

.install {
  margin-top: 16px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.event {
  font-size: 13px;
  color: var(--sky);
  margin-top: 8px;
}

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.stat { background: var(--navy-2); border-radius: 16px; padding: 12px 8px; text-align: center; border: 1px solid var(--line); }
.stat b { display: block; font-size: 22px; }
.stat span { font-size: 11px; color: var(--muted); }

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.6; }
}
@keyframes eq {
  0%, 100% { height: 5px; }
  50% { height: 18px; }
}

@media (min-width: 900px) {
  body { overflow: auto; }
  .app { min-height: 100dvh; height: auto; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}

/* ================= v2 additions (Arena style) ================= */
body { font-size: 17px; }
.modebar {
  position: sticky; top: 0; z-index: 40;
  padding: calc(6px + var(--safe-t)) 14px 6px;
  background: #3a2a08; color: var(--gold); text-align: center;
  font-size: 14px; font-weight: 700; border-bottom: 1px solid rgba(240,195,106,.35);
}
.modebar b { font-weight: 800; letter-spacing: .04em; }
.modebar.real { background: var(--red); color: #fff; border-color: #ff8a93; animation: realflash 1.6s infinite; }
@keyframes realflash { 50% { background: #9f1239; } }
.topbar { padding-top: 10px; position: sticky; top: 31px; }
.logo { width: 34px; height: 34px; border-radius: 10px; }
.iconbtn { width: 44px; height: 44px; border-radius: 14px; background: var(--navy-3); color: var(--ink); font-size: 30px; line-height: 1; font-weight: 700; }
.brand b { font-size: 17px; }
.brand span { font-size: 12px; }
.conn { width: 9px; height: 9px; border-radius: 50%; background: #64748b; flex: none; }
.conn.on { background: var(--ok); box-shadow: 0 0 0 4px rgba(34,197,94,.18); }
.rolechip { font: inherit; font-size: 13px; font-weight: 800; padding: 8px 10px; border-radius: 999px; background: var(--navy-3); color: var(--sky); border: 1px solid rgba(59,163,224,.35); white-space: nowrap; }
.toast { position: fixed; top: calc(90px + var(--safe-t)); left: 50%; transform: translateX(-50%); width: min(608px, calc(100% - 32px)); font-size: 16px; }
.center { text-align: center; }
.big-q { font-size: 32px; margin-top: 18px; }
.lead { font-size: 18px; color: var(--ink); margin: 12px 0; }
.lbl { display: block; margin: 18px 0 8px; font-size: 15px; color: var(--muted); font-weight: 700; }
.note { font-size: 14px; color: var(--muted); line-height: 1.5; margin-top: 6px; }
.row.gap { gap: 10px; margin-top: 14px; }
.pad-dock { padding-bottom: 120px; }
.dock { position: fixed; left: 0; right: 0; bottom: 0; max-width: 640px; margin: 0 auto; z-index: 30; }

.strip { padding: 12px 14px; border-radius: 16px; background: var(--navy-2); border: 1px solid var(--line); font-weight: 800; font-size: 17px; text-align: center; color: #bae6fd; }
.strip.hot { background: rgba(225,29,46,.18); border-color: rgba(225,29,46,.45); color: #fecaca; }
.strip.ok { background: rgba(34,197,94,.14); border-color: rgba(34,197,94,.4); color: #bbf7d0; margin-top: 10px; }
.strip.big { font-size: 20px; padding: 16px; }

.hold { width: 230px; height: 230px; }
.hold b { font-size: 36px; }
.hold small { font-size: 15px; }
.hold.mid { width: 170px; height: 170px; }
.hold.mid b { font-size: 26px; }
.hold.holding { transform: scale(.97); }

.btn { font-size: 17px; min-height: 56px; }
.btn.big { min-height: 72px; font-size: 21px; font-weight: 800; }
.btn.plan { background: linear-gradient(180deg, #ff4b58, var(--red)); color: #fff; border: 0; font-size: 23px; min-height: 84px; box-shadow: 0 12px 30px rgba(225,29,46,.35); margin-top: 12px; }
.btn.police { background: #1d4ed8; color: #fff; border: 0; margin-top: 12px; }
.btn.ok { background: #15803d; color: #fff; }
a.btn { display: flex; flex-direction: column; align-items: center; justify-content: center; text-decoration: none; text-align: center; }
.callrow { display: flex; gap: 10px; margin-top: 14px; }
.callrow > * { flex: 1; }
.call191 { background: var(--red) !important; color: #fff !important; border: 0 !important; font-size: 24px !important; font-weight: 800; min-height: 78px !important; }
.call1669 { background: #0f766e !important; color: #fff !important; border: 0 !important; font-size: 22px !important; font-weight: 800; min-height: 78px !important; }
.callrow small { font-size: 12px; font-weight: 600; opacity: .9; }
.callrow .src { color: #fff; opacity: .8; }

.hero img { width: 84px; height: 84px; }
.rolebtn { display: block; width: 100%; text-align: left; font: inherit; color: var(--ink); background: var(--navy-2); border: 1px solid var(--line); border-radius: 20px; padding: 18px; margin-top: 12px; min-height: 84px; }
.rolebtn b { display: block; font-size: 22px; }
.rolebtn span { display: block; font-size: 14px; color: var(--muted); margin-top: 2px; }
.rolebtn.student { border-color: rgba(34,197,94,.45); background: #0f2a1d; }
.rolebtn.cmd { border-color: rgba(59,163,224,.4); }
.rolebtn.on { outline: 3px solid var(--gold); }

.zone-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.zbtn { font: inherit; font-size: 18px; font-weight: 800; color: #fff; border-radius: 16px; min-height: 70px; padding: 8px 4px; border: 2px solid transparent; }
.zbtn small { display: block; font-size: 11px; font-weight: 600; opacity: .85; }
.zbtn.wide { grid-column: span 3; min-height: 56px; }
.zbtn.g-academic { background: #2E6FA8; }
.zbtn.g-admin { background: #173552; border-color: rgba(255,255,255,.2); }
.zbtn.g-common { background: #9a5a26; }
.zbtn.g-sport { background: #3f6f2e; }
.zbtn.on { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold); background: #b8860b; }
.chip-btn { font-size: 15px; padding: 11px 14px; min-height: 46px; }
.chips.center { justify-content: center; margin: 12px 0; }

.where { display: flex; width: 100%; align-items: center; gap: 8px; font: inherit; font-size: 17px; color: var(--ink); background: var(--navy-2); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; margin-top: 12px; text-align: left; }
.where b { flex: 1; }
.where span { color: var(--sky); font-size: 14px; font-weight: 700; }
.rel { font-size: 20px; font-weight: 800; margin: 14px 0 0; color: var(--ink); }
.rel.in { color: #fecaca; }
.rel.near { color: #fde68a; }

.gcard { border-radius: 20px; padding: 16px; margin-top: 12px; background: var(--card); border: 1px solid var(--line); }
.gcard h2 { font-size: 22px; margin: 0 0 8px; font-weight: 800; }
.gcard.big h2 { font-size: 30px; }
.gcard.gold { background: #2c230c; border-color: rgba(240,195,106,.45); }
.gcard.gold h2 { color: var(--gold); }
.gcard.red { background: #2e0f1a; border-color: rgba(225,29,46,.45); }
.gcard.red h2 { color: #fda4af; }
.gcard.blue { background: #0d2740; border-color: rgba(59,163,224,.45); }
.gcard.blue h2 { color: #7dd3fc; }
.gcard.dim { background: rgba(12,34,56,.6); }
.gcard.dim h2 { color: #fda4af; }
.gcard.small h2 { font-size: 17px; }
.gcard.small .gl li { font-size: 15px; }
.gl { margin: 0; padding: 0 0 0 20px; }
.gl li { font-size: 18px; line-height: 1.45; margin: 6px 0; color: var(--ink); }
.gcard.big .gl li { font-size: 21px; font-weight: 600; }
.gl.plain li { font-size: 15px; }
.srcs { white-space: nowrap; }
.src { font: inherit; font-size: 12px; font-weight: 700; color: var(--sky); background: none; padding: 0 1px; min-height: 0; vertical-align: super; }
.intl { font-style: normal; font-size: 12px; font-weight: 800; color: #fbbf24; border: 1px solid rgba(251,191,36,.5); border-radius: 6px; padding: 0 4px; white-space: nowrap; }
details summary { cursor: pointer; font-weight: 700; color: var(--sky); padding: 8px 0; font-size: 16px; min-height: 40px; }
.gdetails { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 8px 14px; margin-top: 12px; }
.gdetails summary { font-size: 18px; color: var(--ink); }

.police-alert { margin-top: 12px; padding: 14px; border-radius: 16px; background: #1d4ed8; color: #fff; font-weight: 800; font-size: 19px; text-align: center; }
.pa-bar b { font-size: 15px; }
.pa-bar div div { font-size: 15px; }

.status-grid { display: grid; gap: 10px; }
.sbtn { font: inherit; color: #fff; border-radius: 20px; min-height: 86px; padding: 12px 16px; text-align: left; display: flex; align-items: baseline; gap: 12px; border: 0; }
.sbtn b { font-size: 25px; }
.sbtn span { font-size: 15px; opacity: .9; }
.sbtn.ok { background: #15803d; }
.sbtn.red { background: var(--red); }
.sbtn.warn { background: #b45309; }
.sent { margin-top: 10px; padding: 12px; border-radius: 14px; background: rgba(34,197,94,.12); color: #bbf7d0; font-size: 16px; }

.bigin { width: 100%; font: inherit; font-size: 40px; font-weight: 800; text-align: center; padding: 16px; border-radius: 18px; border: 2px solid rgba(59,163,224,.5); background: var(--navy-2); color: #fff; }
.bigin.small { font-size: 26px; padding: 10px; }
.stepper { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 18px 0 6px; }
.stp { width: 84px; height: 84px; border-radius: 50%; font-size: 44px; font-weight: 800; background: var(--navy-3); color: #fff; }
.stepper output { font-size: 72px; font-weight: 800; min-width: 110px; text-align: center; font-variant-numeric: tabular-nums; }

.queue .q { position: relative; }
.q i.on { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.q.to { opacity: .6; }
.q.to .num { background: #3a1020; color: #fecaca; }
.timer { font-size: 72px; }

.stat-grid { grid-template-columns: repeat(4, 1fr); }
.stat b { font-size: 26px; }
.stat span { font-size: 11px; }
.stat.ok b { color: #86efac; }
.stat.red b { color: #fca5a5; }
.stat.warn b { color: #fcd34d; }
.rtable { width: 100%; border-collapse: collapse; font-size: 15px; }
.rtable th { text-align: left; color: var(--muted); font-size: 12px; font-weight: 700; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.rtable td { padding: 9px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.rtable tr.red td:nth-child(2) { color: #fca5a5; font-weight: 800; }
.rtable tr.warn td:nth-child(2) { color: #fcd34d; font-weight: 800; }
.rtable tr.ok td:nth-child(2) { color: #86efac; font-weight: 700; }
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.tl time { color: var(--sky); font-variant-numeric: tabular-nums; font-size: 13px; min-width: 64px; padding-top: 2px; }
.tl small { display: block; color: var(--muted); font-size: 12px; }
.tl li.t-report div, .tl li.t-handover div { color: #fecaca; }
.endcard { border-color: rgba(34,197,94,.35); }
.modecard { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 12px 14px; border-radius: 16px; background: var(--navy-2); border: 1px solid var(--line); margin-top: 12px; }
.modecard .btn { min-height: 44px; font-size: 14px; }

.seg { display: flex; gap: 6px; background: var(--navy-2); padding: 5px; border-radius: 16px; }
.seg button { flex: 1; font: inherit; font-size: 15px; font-weight: 700; color: var(--muted); background: none; border-radius: 12px; min-height: 50px; padding: 6px; }
.seg button.on { background: var(--sky-2); color: #fff; }
.seg button.on.real { background: var(--red); }
.linkrow { display: flex; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.linkrow > div { flex: 1; min-width: 0; }
.linkrow b { font-size: 14px; display: block; }
.linkrow code { display: block; font-size: 11px; color: var(--muted); word-break: break-all; }
.linkrow .btn { flex: none; min-height: 44px; font-size: 14px; }

.sources { list-style: none; margin: 0; padding: 0; }
.sources li { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); scroll-margin-top: 120px; }
.sources li.flash { background: rgba(240,195,106,.14); border-radius: 12px; }
.sources .sn { color: var(--gold); font-weight: 800; min-width: 38px; }
.sources b { display: block; font-size: 15px; }
.sources small { display: block; color: var(--muted); font-size: 12px; }
.sources a { color: var(--sky); font-size: 12px; word-break: break-all; }
a.tel { color: #fff; font-weight: 700; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 60; display: grid; place-items: end center; padding: 16px; }
.modal[hidden] { display: none; }
.modal .sheet { width: min(608px, 100%); background: var(--navy-2); border: 1px solid var(--line); border-radius: 22px; padding: 18px; margin-bottom: calc(10px + var(--safe-b)); }
.modal .sheet p { color: var(--ink); font-size: 19px; font-weight: 700; margin-bottom: 14px; }
.topbar .brand { flex-direction: column; align-items: flex-start; justify-content: center; gap: 0; }
.topbar .brand b, .topbar .brand span { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* PIN */
.pinpage h1 { margin-top: 18px; font-size: 30px; }
.pindots { display: flex; justify-content: center; gap: 16px; margin: 22px 0 10px; }
.pindots i { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--sky); }
.pindots i.on { background: var(--sky); }
.pindots.err i { border-color: var(--red); animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.pinmsg { text-align: center; font-size: 17px; min-height: 26px; color: var(--muted); }
.pinmsg.err { color: #fca5a5; font-weight: 800; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 18px auto 0; max-width: 340px; }
.key { font: inherit; font-size: 36px; font-weight: 800; height: 78px; border-radius: 22px; background: var(--navy-3); color: #fff; border: 1px solid var(--line); }
.key:active { background: var(--sky-2); }
.key.del { font-size: 30px; background: transparent; }
.key:disabled { opacity: .35; }
.pinrole { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 8px; }
.pinrole h3 { font-size: 15px; margin: 4px 0; color: var(--ink); }
.pinval { font-size: 20px; color: var(--gold); letter-spacing: .12em; font-variant-numeric: tabular-nums; }
