:root {
  --bg: #0F1530;
  --panel: #141B3D;
  --line: #0A0F24;
  --edge: #39467F;
  --text: #E8ECFF;
  --muted: #B7C1E8;
  --accent: #6D4AFF;
  --ok: #3BD16F;
  --warn: #FFB547;
  --yellow: #FFD84D;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: 'Pixelify Sans', system-ui, sans-serif; font-size: 16px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.pixel-title { font-family: 'Press Start 2P', monospace; font-size: 18px; letter-spacing: .04em; color: #fff; margin: 0; line-height: 1.4; }
.btn { min-height: 44px; padding: 0 16px; border: 2px solid #000; box-shadow: 2px 2px 0 #000; background: #E8ECFF; color: #141B3D; font: 700 15px 'Pixelify Sans', sans-serif; cursor: pointer; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn:focus-visible, input:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

.center-screen { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 16px; }
.card { background: var(--panel); border: 3px solid var(--line); outline: 3px solid var(--edge); padding: 28px; }
.login-card { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 14px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
input[type=email] { min-height: 44px; padding: 0 12px; background: var(--bg); color: var(--text); border: 2px solid var(--edge); font: 16px 'Pixelify Sans', sans-serif; }
.msg { min-height: 1.4em; margin: 0; color: var(--yellow); }
.or { margin: 4px 0 0; font-size: 14px; }

.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; background: var(--panel); border-bottom: 3px solid var(--line); }
.brand { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.topbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.viewonly { font-size: 13px; font-weight: 700; padding: 4px 8px; border: 2px dashed #6F7BAA; color: #D3DAF5; }
.live { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.live .dot { width: 10px; height: 10px; background: #6F7BAA; border: 2px solid #000; }
.live.on .dot { background: var(--ok); animation: blink 1.6s steps(1) infinite; }
.live.stale .dot { background: var(--warn); }

.layout { display: flex; flex-wrap: wrap; }
.floor-wrap { flex: 999 1 560px; min-width: 0; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.floor { position: relative; width: 100%; aspect-ratio: 320 / 200; border: 4px solid var(--line); outline: 4px solid var(--edge); background: #E7DFCB; }
.floor-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.room-label { position: absolute; font: 8px/1 'Press Start 2P', monospace; padding: 4px 5px; background: #F3E9D2; color: #3B2A1A; border: 2px solid #5A4E3C; pointer-events: none; }
.room-sign { position: absolute; font: 7px/1 'Press Start 2P', monospace; padding: 3px 4px; background: #0F1530; color: #D3DAF5; border: 2px dashed #6F7BAA; pointer-events: none; }

.agent { position: absolute; padding: 0; margin: 0; border: 0; background: transparent; cursor: pointer; }
.agent svg { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.agent.static { cursor: default; }
.agent.selected svg { outline: 2px dashed var(--yellow); outline-offset: 3px; }
.agent:focus-visible { outline: 3px solid var(--yellow); outline-offset: 4px; }
.tag { position: absolute; left: 50%; bottom: calc(100% + 4px); transform: translateX(-50%); white-space: nowrap; font: 700 12px/1 'Pixelify Sans', sans-serif; padding: 3px 6px; border: 2px solid #000; box-shadow: 2px 2px 0 #000; background: var(--bg); color: #fff; }
.agent.selected .tag, .agent.you .tag { background: var(--yellow); color: #1B1B1B; }
.bubble { position: absolute; left: calc(100% + 3px); top: -6px; border: 2px solid #000; font: 700 12px/1 'Pixelify Sans', sans-serif; padding: 2px 5px; background: #fff; color: #111; white-space: nowrap; }
.bubble.attention { background: var(--warn); color: #3A1A00; animation: blink 1.2s steps(1) infinite; }
.bubble.scheduled { background: #CDEFE7; color: #0B4F45; }
.bubble.idle { background: #E3E6F0; color: #3F4450; }
.bubble.training { background: #E3D9FF; color: #3E2A86; }
.bubble.delivered { background: var(--yellow); color: #1B1B1B; animation: blink .5s steps(1) 6; }
.agent.working svg { animation: typing .45s steps(1) infinite; }
@keyframes typing { 0%, 49% { transform: translateY(0); } 50%, 100% { transform: translateY(-9%); } }
.agent.away { visibility: hidden; }
.screen { position: absolute; pointer-events: none; }
.screen.on { background: #6FE3FF; box-shadow: 0 0 10px 3px rgba(111, 227, 255, .75); animation: glow 1.1s steps(2) infinite; }
@keyframes glow { 0% { background: #6FE3FF; } 100% { background: #B8F2FF; } }
.walker { position: absolute; pointer-events: none; z-index: 3; }
.walker svg { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.walker .f2 { display: none; }
.walker.step .f1 { display: none; }
.walker.step .f2 { display: block; }
.walker.pause .f1 { display: block; }
.walker.pause .f2 { display: none; }
.walker .tag { background: var(--yellow); color: #1B1B1B; }
.walker.pause .tag { display: none; }
.paper { position: absolute; left: 75%; top: 48%; width: 55%; aspect-ratio: 3 / 4; background: repeating-linear-gradient(#fff 0 22%, #9AA3B5 22% 30%); border: 2px solid #000; }
.paper[hidden] { display: none; }
.bubble .d1 { animation: blink 1.2s steps(1) infinite; }
.bubble .d2 { animation: blink 1.2s steps(1) .4s infinite; }
.bubble .d3 { animation: blink 1.2s steps(1) .8s infinite; }

.statusbar { display: flex; flex-wrap: wrap; gap: 16px 32px; padding: 14px 18px; background: var(--panel); border: 3px solid var(--line); }
.stat { display: flex; flex-direction: column; gap: 6px; min-width: 120px; }
.stat-label { font-size: 14px; color: var(--muted); }
.stat-value { font: 13px/1.3 'Press Start 2P', monospace; color: #fff; }
.stat-value.warn { color: var(--warn); }
.stat-value.ok { color: var(--ok); }

.panel { flex: 1 1 340px; min-width: 0; background: var(--panel); border-left: 3px solid var(--line); padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.agent-head { display: flex; align-items: center; gap: 12px; }
.sel-sprite { width: 48px; flex-shrink: 0; background: var(--bg); border: 2px solid var(--edge); padding: 5px; }
.sel-sprite svg { display: block; width: 100%; height: auto; }
.agent-id { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.agent-id h2 { margin: 0; font-size: 19px; color: #fff; }
.pill { font-size: 12px; font-weight: 700; padding: 4px 8px; border: 2px solid #000; white-space: nowrap; }
.pill:empty { display: none; }
.facts { margin: 0; display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; background: var(--bg); border: 2px solid var(--edge); }
.facts div { display: flex; gap: 10px; }
.facts dt { width: 72px; flex-shrink: 0; color: var(--muted); font-size: 14px; }
.facts dd { margin: 0; font-size: 14px; line-height: 1.4; }
.panel-h { margin: 6px 0 0; font: 10px/1 'Press Start 2P', monospace; color: var(--muted); }
.report { white-space: pre-wrap; font-size: 14px; line-height: 1.5; background: var(--bg); border: 2px solid var(--edge); padding: 12px; max-height: 340px; overflow-y: auto; }
.activity { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow-y: auto; }
.activity li { display: flex; gap: 10px; font-size: 14px; line-height: 1.4; }
.activity time { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--muted); flex-shrink: 0; width: 96px; }
.activity .bad { color: var(--warn); }

@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: .15; } }
.blink { animation: blink 1.2s steps(1) infinite; }
@media (prefers-reduced-motion: reduce) { .blink, .bubble .d1, .bubble .d2, .bubble .d3, .bubble.attention, .bubble.delivered, .live.on .dot, .agent.working svg, .screen.on { animation: none; } }
@media (max-width: 700px) {
  .panel { border-left: 0; border-top: 3px solid var(--line); }
  .room-label, .room-sign { font-size: 6px; padding: 2px 3px; }
  .tag { font-size: 10px; }
  .bubble { font-size: 10px; }
}
