:root {
  --ink: #183444;
  --muted: #66808d;
  --canvas: #eee9df;
  --panel: #fffdf8;
  --line: #d9d2c7;
  --navy: #123b67;
  --cyan: #29a8cf;
  --running: #2d7ff9;
  --done: #22a06b;
  --waiting: #e6a117;
  --error: #d64545;
  --interrupted: #7e7298;
}

* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; background: var(--canvas); }
body {
  color: var(--ink);
  font-family: "Avenir Next", "PingFang SC", sans-serif;
  overflow: hidden;
}
button { color: inherit; font: inherit; }

.shell {
  height: 100dvh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: radial-gradient(circle at 85% 5%, #fff 0, transparent 34%), var(--canvas);
}

.topbar, .footerbar {
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 253, 248, .97);
}
.topbar {
  min-height: 66px;
  padding: max(11px, env(safe-area-inset-top)) 18px 10px;
  border-bottom: 1px solid var(--line);
}
.brand-lockup { display: flex; align-items: center; gap: 11px; }
.brand-lockup p { margin: 0 0 2px; color: var(--muted); font-size: 10px; }
.brand-lockup h1 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -.02em; }
.signal { width: 10px; height: 10px; border-radius: 50%; background: var(--waiting); box-shadow: 0 0 0 4px #e6a1171f; }
.signal.online { background: var(--done); box-shadow: 0 0 0 4px #22a06b1f; }
.signal.offline { background: var(--error); box-shadow: 0 0 0 4px #d645451f; }
.shift-clock { text-align: right; }
.shift-clock span { display: block; color: var(--muted); font-size: 8px; letter-spacing: .12em; }
.shift-clock strong { color: var(--navy); font-size: 17px; }

.workspace { min-height: 0; display: grid; grid-template-columns: 82px 1fr; }
.floor-rail {
  z-index: 7;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 12px 9px;
  border-right: 1px solid var(--line);
  background: #f8f4ec;
}
.hq-mark { padding: 4px 0 8px; color: var(--navy); font-size: 11px; font-weight: 800; text-align: center; letter-spacing: .16em; }
.floor-rail button {
  position: relative;
  min-height: 58px;
  padding: 8px 4px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
}
.floor-rail button b, .floor-rail button small { display: block; }
.floor-rail button b { color: var(--navy); font-size: 16px; }
.floor-rail button small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.floor-rail button i { position: absolute; top: 8px; right: 7px; width: 7px; height: 7px; border-radius: 50%; }
.floor-rail button.has-running i { background: var(--running); }
.floor-rail button.has-waiting i { background: var(--waiting); }
.floor-rail button.has-error i { background: var(--error); }
.floor-rail button.active { background: var(--navy); box-shadow: 0 5px 8px #123b6720; }
.floor-rail button.active b, .floor-rail button.active small { color: white; }

.office-wrap { position: relative; min-width: 0; min-height: 0; overflow: hidden; touch-action: none; }
#office { position: absolute; inset: 0; display: block; width: 100%; height: 100%; image-rendering: pixelated; cursor: grab; }
#office:active { cursor: grabbing; }
.floor-title {
  position: absolute;
  top: 12px;
  left: 14px;
  padding: 8px 11px;
  border-radius: 10px;
  color: var(--ink);
  background: rgba(249, 252, 253, .92);
  box-shadow: 0 3px 8px #123b6714;
}
.floor-title b, .floor-title span { display: block; }
.floor-title b { font-size: 12px; }
.floor-title span { margin-top: 2px; color: var(--muted); font-size: 9px; }
.status-strip {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  padding: 8px 11px;
  border-radius: 10px;
  background: rgba(249, 252, 253, .92);
  box-shadow: 0 3px 8px #123b6714;
  font-size: 9px;
  white-space: nowrap;
}
.status-strip span { color: var(--muted); }
.status-strip b { color: var(--ink); }
.status-strip .running b { color: var(--running); }
.status-strip .waiting b { color: var(--waiting); }
.status-strip .done b { color: var(--done); }
.status-strip .error b { color: var(--error); }
.zoom-tools { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 6px; }
.zoom-tools button, .sheet-close {
  min-width: 42px;
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  background: rgba(249, 252, 253, .94);
  box-shadow: 0 3px 8px #123b671c;
}
.agent-sheet {
  position: absolute;
  left: 14px;
  bottom: 14px;
  width: min(320px, calc(100% - 80px));
  padding: 15px 46px 15px 15px;
  border-radius: 14px;
  background: rgba(249, 252, 253, .97);
  box-shadow: 0 6px 16px #123b6726;
}
.agent-sheet h2 { margin: 4px 0; font-size: 16px; }
.agent-sheet p, .sheet-state { margin: 0; color: var(--muted); font-size: 10px; }
.sheet-close { position: absolute; top: 8px; right: 8px; min-width: 32px; min-height: 32px; }
.footerbar {
  min-height: 34px;
  padding: 7px 14px max(7px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 9px;
}

@media (max-width: 640px) {
  .topbar { min-height: 58px; padding-inline: 11px; }
  .brand-lockup h1 { font-size: 15px; }
  .workspace { grid-template-columns: 56px 1fr; }
  .floor-rail { gap: 5px; padding: 8px 5px; }
  .hq-mark { font-size: 9px; }
  .floor-rail button { min-height: 54px; border-radius: 8px; }
  .floor-rail button small { display: none; }
  .floor-title { top: 8px; left: 8px; }
  .status-strip { top: auto; bottom: 9px; left: 8px; max-width: calc(100% - 118px); transform: none; gap: 7px; overflow: hidden; }
  .status-strip .idle { display: none; }
  .zoom-tools { right: 8px; bottom: 8px; }
  .zoom-tools button { min-width: 38px; min-height: 38px; }
  .agent-sheet { left: 8px; bottom: 58px; width: calc(100% - 16px); }
  .footerbar { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
