
/* Ночной офис в изометрии: сцена — главное, HUD сверху, лента событий снизу. Одна тёмная тема намеренно (табло на стену). */
:root {
  --bg: #070B10;
  --panel: #0F1620;
  --line: #1E2A37;
  --text: #EAF1F6;
  --text2: #8B9AAA;
  --text3: #566474;
  --accent: #22D3BE;
  --live: #3BE58A;
  --wait: #FFC53D;
  --done: #8B93FF;
  --msg: #7CC4FF;
  --display: "Space Grotesk", "SF Pro Display", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  color-scheme: dark;
}
html, body { background: var(--bg); color: var(--text); }
body { font-family: var(--body); margin: 0; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: max(14px, env(safe-area-inset-top, 0px)) 28px; }
.wrap { max-width: 1280px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }

/* HUD */
.hud { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.logo { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(140deg, #5EF2DC, #0E8F86); display: grid; place-items: center; font: 700 18px var(--display); color: #04201C; box-shadow: 0 0 24px rgba(34,211,190,.35); }
.brand h1 { font: 700 20px/1 var(--display); margin: 0; letter-spacing: .2px; }
.brand small { display: block; font: 500 11px var(--body); color: var(--text2); margin-top: 3px; letter-spacing: .6px; text-transform: uppercase; }
.stats { display: flex; gap: 8px; flex-wrap: wrap; }
.stat { display: flex; align-items: baseline; gap: 6px; padding: 7px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); font-size: 12px; color: var(--text2); }
.stat b { font: 700 18px var(--display); color: var(--text); font-variant-numeric: tabular-nums; }
.stat i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; align-self: center; }
.clock { font: 500 13px var(--mono); color: var(--text2); font-variant-numeric: tabular-nums; }
button.tv { font: 600 12px var(--body); color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; cursor: pointer; }
button.tv:hover { border-color: var(--accent); }
button.tv:focus-visible, .stage:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Сцена */
.stage { position: relative; border-radius: 22px; overflow: hidden; background: radial-gradient(120% 90% at 50% 0%, #10202B 0%, #070B10 70%); border: 1px solid var(--line); height: min(68vh, 720px); min-height: 380px; touch-action: pan-y; cursor: grab; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
@media (max-width: 600px) { .stage { height: 62vh; min-height: 420px; } .stat { padding: 6px 10px; } .stat b { font-size: 16px; } .clock { display: none; } }
.stage .hint { position: absolute; left: 14px; bottom: 12px; font-size: 11px; color: var(--text3); pointer-events: none; }

/* Карточка сотрудника */
.card { position: absolute; top: 14px; right: 14px; width: 300px; max-width: calc(100% - 28px); background: rgba(15,22,32,.94); backdrop-filter: blur(14px); border: 1px solid var(--line); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 20px 50px rgba(0,0,0,.5); transform-origin: top right; animation: pop .22s ease-out; }
@keyframes pop { from { transform: scale(.94); opacity: 0 } to { transform: none; opacity: 1 } }
.card .top { display: flex; gap: 12px; align-items: center; }
.ava { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font: 700 15px var(--display); color: #fff; flex: none; }
.card h3 { margin: 0; font: 700 18px var(--display); }
.card p { margin: 2px 0 0; font-size: 12px; color: var(--text2); }
.card .x { margin-left: auto; align-self: flex-start; background: none; border: 0; color: var(--text2); font-size: 20px; cursor: pointer; line-height: 1; }
.pill { display: inline-flex; align-items: center; gap: 6px; font: 600 11px var(--body); padding: 4px 9px; border-radius: 99px; }
.now { font: 500 12px/1.45 var(--mono); color: var(--text); background: #0A1118; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.now span { color: var(--text3); display: block; font-family: var(--body); font-size: 10px; text-transform: uppercase; letter-spacing: .8px; margin-bottom: 4px; }
.hist { display: flex; flex-direction: column; gap: 8px; max-height: 180px; overflow: auto; }
.hist div { display: grid; grid-template-columns: 42px 1fr; gap: 8px; font-size: 12px; color: var(--text2); }
.hist time { font: 500 11px var(--mono); color: var(--text3); }

/* Нижний ряд: лента + легенда */
.below { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; }
@media (max-width: 860px) { .below { grid-template-columns: minmax(0, 1fr); } }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; min-width: 0; }
.box h2 { font: 700 14px var(--display); margin: 0 0 10px; letter-spacing: .3px; color: var(--text2); text-transform: uppercase; }
.feed { display: flex; flex-direction: column; gap: 8px; }
.ev { display: grid; grid-template-columns: 44px 22px minmax(0, 1fr); gap: 8px; align-items: center; font-size: 13px; animation: slide .35s ease-out; }
@keyframes slide { from { transform: translateY(-6px); opacity: 0 } to { transform: none; opacity: 1 } }
.ev time { font: 500 11px var(--mono); color: var(--text3); }
.ev .ic { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; font-size: 12px; }
.ev .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text2); }
.ev .t b { color: var(--text); font-weight: 600; }
.legend { display: grid; grid-template-columns: 1fr; gap: 8px; font-size: 12.5px; color: var(--text2); }
.legend div { display: grid; grid-template-columns: 26px 1fr; gap: 8px; align-items: center; }
.legend .g { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: #0A1118; border: 1px solid var(--line); font-size: 13px; }
.legend b { color: var(--text); font-weight: 600; }
.note { font-size: 12px; color: var(--text3); }

/* ТВ-режим: только сцена и HUD, на весь экран */
body.tvmode { padding: 0; }
body.tvmode .wrap { max-width: none; height: 100vh; gap: 0; }
body.tvmode .hud { position: absolute; top: 0; left: 0; right: 0; z-index: 3; padding: 18px 24px; background: linear-gradient(#070B10ee, transparent); }
body.tvmode .stage { height: 100vh; border-radius: 0; border: 0; }
body.tvmode .below, body.tvmode .note { display: none; }
body.tvmode .brand h1 { font-size: 26px; }
body.tvmode .stat b { font-size: 24px; }
@media (prefers-reduced-motion: reduce) { .ev, .card { animation: none; } }

.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.empty { margin: 0; font-size: 13px; color: var(--text3); }
.net { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--text3); }
.net.ok { background: var(--live); box-shadow: 0 0 10px var(--live); }
.net.bad { background: #F87171; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .3 } }
.me { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text2); }
.me button { background: none; border: 0; color: var(--text3); font: inherit; cursor: pointer; text-decoration: underline; }
body.tvmode .me button, body.tvmode #tvBtn { opacity: .25; }
body.tvmode { cursor: none; }
.login { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: radial-gradient(80% 60% at 50% 30%, #0F2A2E, #070B10 70%); padding: 16px; }
.login form { width: min(360px, 100%); display: flex; flex-direction: column; gap: 12px; text-align: center; }
.login .logo { width: 72px; height: 72px; border-radius: 22px; font-size: 36px; margin: 0 auto 6px; }
.login h1 { font: 700 34px var(--display); margin: 0; }
.login p { margin: 0 0 12px; color: var(--text2); font-size: 14px; }
.login input { font: 500 16px var(--body); color: var(--text); background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); border-radius: 14px; padding: 14px 16px; outline: none; }
.login input:focus { border-color: var(--accent); }
.login button { font: 700 16px var(--body); color: #04201C; background: linear-gradient(#5EF2DC, #22D3BE); border: 0; border-radius: 14px; padding: 15px; cursor: pointer; box-shadow: 0 8px 24px rgba(34,211,190,.35); }
.login button:disabled { opacity: .6; }
.login .err { min-height: 18px; color: #F87171; font-size: 13px; }
