:root {
  --bg: #1a120c;
  --wood-a: #2a1c13;
  --wood-b: #24180f;
  --panel-edge: #4a3323;
  --panel-hi: #5e4330;
  --ink: #ecdcc0;
  --ink-dim: #a38b6d;
  --ink-mute: #6f5a45;
  --gold: #e0b04f;
  --green: #9be15d;
  --green-dim: #5e8f36;
  --amber: #f0b44a;
  --red: #e5645c;
  --blue: #6db7e0;
  --screen: #110b07;
  --screen-edge: #3a291c;
  --field: #140e09;
  --pixel: 'Press Start 2P', monospace;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --radius: 4px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 13px/1.5 var(--mono);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
a { color: var(--gold); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 10px 20px;
  background: #140d08;
  border-bottom: 3px solid var(--panel-edge);
  box-shadow: 0 2px 0 #0b0704;
}
.logo { font: 13px var(--pixel); color: var(--gold); letter-spacing: 1px; white-space: nowrap; text-shadow: 2px 2px 0 #000; }
.logo span { color: var(--green); }
.tabs { display: flex; gap: 4px; }
.tabs button {
  background: none; border: 2px solid transparent; padding: 6px 12px; cursor: pointer;
  color: var(--ink-dim); font: 9px var(--pixel); text-transform: uppercase; letter-spacing: 1px;
}
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--ink); border-color: var(--panel-edge); background: var(--wood-a); }
.tabs b { color: var(--gold); font-weight: normal; }
.stats { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px;
  background: var(--field); border: 1px solid var(--screen-edge); border-radius: var(--radius);
  font-size: 11px; color: var(--ink-dim); white-space: nowrap;
}
.chip b { color: var(--ink); font-weight: 600; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-mute); display: inline-block; }
.dot.on { background: var(--green); box-shadow: 0 0 6px var(--green); }
.dot.warn { background: var(--amber); }
.dot.off { background: var(--red); }
.actions { display: flex; gap: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 12px; cursor: pointer; white-space: nowrap;
  background: var(--wood-a); color: var(--ink);
  border: 2px solid var(--panel-edge); border-radius: var(--radius);
  box-shadow: 0 2px 0 #0b0704; font-size: 12px; font-weight: 600;
}
.btn:hover { border-color: var(--panel-hi); background: #33231a; }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--gold); color: #1a120c; border-color: #f3cb78; }
.btn.primary:hover { background: #f0c464; }
.btn.danger { border-color: #7a302b; color: var(--red); }
.btn.danger:hover { background: #3a1714; }
.btn.good { border-color: var(--green-dim); color: var(--green); }
.btn.small { padding: 4px 8px; font-size: 11px; }
.btn.icon { padding: 6px 10px; font-size: 15px; }
.btn.paused { background: #3a1714; border-color: var(--red); color: var(--red); }

.banner { margin: 12px 20px 0; padding: 10px 14px; border: 2px solid var(--amber); background: #2b1f0d; color: var(--amber); border-radius: var(--radius); }
.banner.red { border-color: var(--red); background: #2d1311; color: var(--red); }

main { padding: 16px 20px 60px; }

/* ---------- office ---------- */
.office { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 560px), 1fr)); gap: 16px; align-items: start; }
.room {
  position: relative;
  border: 3px solid var(--panel-edge);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(0,0,0,.25), rgba(0,0,0,0) 40px),
    repeating-linear-gradient(180deg, var(--wood-a) 0 22px, var(--wood-b) 22px 24px, var(--wood-a) 24px 46px, #20150d 46px 48px);
  box-shadow: inset 0 0 0 2px #120c07, 0 3px 0 #0b0704;
  padding: 14px 14px 18px;
  min-height: 240px;
}
.room-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.room-title { font: 10px var(--pixel); letter-spacing: 2px; text-transform: uppercase; color: var(--room, var(--gold)); text-shadow: 2px 2px 0 #000; }
.room-count { font-size: 11px; color: var(--ink-mute); }
.room-tools { margin-left: auto; display: flex; gap: 6px; }
.room-tools .btn { padding: 2px 8px; font-size: 11px; }
.desks { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 18px 14px; }

.desk { position: relative; display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.desk:hover .screen { border-color: var(--panel-hi); }
.desk.off { opacity: .45; }

.screen {
  position: relative; width: 100%; height: 78px; padding: 18px 7px 6px;
  background: var(--screen); border: 2px solid var(--screen-edge); border-radius: 3px;
  box-shadow: inset 0 0 0 1px #000;
  font: 9.5px/1.35 var(--mono); color: var(--ink-mute); overflow: hidden;
  transition: border-color .2s, box-shadow .2s;
}
.screen .lines div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.screen .badge { position: absolute; top: 4px; left: 5px; }
.screen .engine { position: absolute; top: 3px; right: 6px; font-size: 10px; color: var(--ink-mute); }
.desk.working .screen { border-color: var(--green); box-shadow: 0 0 0 1px #2c4a17, 0 0 14px rgba(155,225,93,.35), inset 0 0 18px rgba(155,225,93,.06); color: #b9e991; }
.desk.queued .screen { border-color: #8a6a2a; color: #d9b774; }
.desk.error .screen { border-color: #8a3530; color: #e79a94; }
.desk.limit .screen { border-color: #6b4b85; }
.stand { width: 26px; height: 6px; background: var(--screen-edge); }

.badge {
  display: inline-block; padding: 2px 5px 1px; border-radius: 2px;
  font: 7px/1.2 var(--pixel); letter-spacing: .5px; text-transform: uppercase;
  background: #3b2d22; color: var(--ink-dim);
}
.badge.working { background: var(--green); color: #14200a; }
.badge.queued { background: var(--amber); color: #2a1a04; }
.badge.error { background: var(--red); color: #2a0806; }
.badge.limit { background: #8f68b0; color: #170d20; }
.badge.off { background: #2a211a; color: var(--ink-mute); }

.sprite-wrap { position: relative; margin-top: 6px; height: 44px; }
.sprite { width: 48px; height: 44px; image-rendering: pixelated; background-size: 100% 100%; background-repeat: no-repeat; }
.desk.working .sprite { animation: type .45s steps(1) infinite; }
@keyframes type { 0% { background-image: var(--f1); } 50% { background-image: var(--f2); } }
.desk.idle .zzz { display: block; }
.zzz { display: none; position: absolute; right: -14px; top: -4px; font: 8px var(--pixel); color: var(--ink-mute); animation: zz 2.4s ease-in-out infinite; }
@keyframes zz { 0%,100% { transform: translateY(2px); opacity: .3; } 50% { transform: translateY(-4px); opacity: .9; } }

.plank { width: 86%; height: 7px; background: #6b4a2f; border-bottom: 3px solid #4d331f; box-shadow: 0 2px 0 #0b0704; }
.desk-name { margin-top: 8px; font-size: 12px; font-weight: 700; text-align: center; color: var(--ink); line-height: 1.25; }
.desk-sub { font-size: 10px; color: var(--ink-mute); text-align: center; min-height: 14px; }
.desk-sub.task { color: var(--gold); }

.bubble {
  position: absolute; bottom: calc(100% - 64px); left: 50%; transform: translateX(-50%);
  z-index: 5; width: max-content; max-width: 210px;
  background: #f4e7cf; color: #1a120c; border: 2px solid #000; border-radius: 4px;
  padding: 5px 8px; font-size: 10.5px; line-height: 1.35; box-shadow: 3px 3px 0 #000;
  animation: pop .18s ease-out;
  pointer-events: none;
}
.bubble::after { content: ''; position: absolute; left: 50%; bottom: -8px; margin-left: -5px; border: 5px solid transparent; border-top-color: #000; }
.bubble b { color: #8a3b12; }
@keyframes pop { from { transform: translateX(-50%) scale(.6); opacity: 0; } }

/* ---------- panels, forms ---------- */
.panel { border: 3px solid var(--panel-edge); border-radius: 6px; background: var(--wood-a); box-shadow: inset 0 0 0 2px #120c07; }
.h { font: 9px var(--pixel); letter-spacing: 1.5px; text-transform: uppercase; color: var(--gold); margin: 0 0 12px; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 11px; color: var(--ink-dim); margin-bottom: 4px; }
label.field small { display: block; color: var(--ink-mute); font-size: 10.5px; margin-top: 3px; }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 8px 10px; background: var(--field); border: 2px solid var(--screen-edge); border-radius: var(--radius); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); }
textarea { resize: vertical; min-height: 80px; line-height: 1.45; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.check { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--gold); }
.muted { color: var(--ink-mute); }
.dim { color: var(--ink-dim); }
.pre { white-space: pre-wrap; word-break: break-word; }
.term {
  background: var(--screen); border: 2px solid var(--screen-edge); border-radius: 4px;
  padding: 10px; font: 11px/1.5 var(--mono); color: #b9e991; white-space: pre-wrap; word-break: break-word;
  max-height: 420px; overflow: auto;
}
.term .l-err { color: var(--red); }
.term .l-tool { color: var(--blue); }
.term .l-ok { color: var(--ink-dim); }
.term .l-head { color: var(--gold); }

/* ---------- drawer ---------- */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 40; width: min(560px, 100%);
  background: #1d140d; border-left: 3px solid var(--panel-edge); box-shadow: -8px 0 0 rgba(0,0,0,.35);
  display: flex; flex-direction: column;
}
.drawer-head { display: flex; gap: 14px; align-items: center; padding: 16px 18px 12px; border-bottom: 2px solid var(--panel-edge); }
.drawer-head .sprite { flex: none; }
.drawer-title { font-size: 16px; font-weight: 700; }
.drawer-title small { font-weight: 400; color: var(--ink-dim); font-size: 12px; }
.drawer-role { color: var(--ink-dim); font-size: 12px; }
.drawer-close { margin-left: auto; align-self: flex-start; }
.drawer-tabs { display: flex; gap: 2px; padding: 8px 12px 0; border-bottom: 2px solid var(--panel-edge); overflow-x: auto; }
.drawer-tabs button { background: none; border: 2px solid transparent; border-bottom: none; padding: 7px 11px; cursor: pointer; color: var(--ink-dim); font-size: 12px; font-weight: 600; white-space: nowrap; }
.drawer-tabs button.active { color: var(--ink); background: var(--wood-a); border-color: var(--panel-edge); }
.drawer-body { flex: 1; overflow: auto; padding: 16px 18px 24px; }
.drawer-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }

/* ---------- kanban ---------- */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { background: rgba(0,0,0,.2); border: 2px solid var(--panel-edge); border-radius: 6px; padding: 10px; min-height: 300px; }
.col-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font: 8px var(--pixel); letter-spacing: 1px; text-transform: uppercase; color: var(--ink-dim); }
.col-head b { color: var(--ink); font: 11px var(--mono); }
.card {
  background: var(--wood-a); border: 2px solid var(--panel-edge); border-left: 4px solid var(--ink-mute);
  border-radius: 4px; padding: 8px 10px; margin-bottom: 8px; cursor: pointer; box-shadow: 0 2px 0 #0b0704;
}
.card:hover { border-color: var(--panel-hi); }
.card.p-high { border-left-color: var(--amber); }
.card.p-urgent { border-left-color: var(--red); }
.card.p-low { border-left-color: #4a4035; }
.card-title { font-weight: 600; font-size: 12.5px; line-height: 1.35; }
.card-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; font-size: 10.5px; color: var(--ink-mute); }
.card-meta .who { color: var(--ink-dim); }
.task-toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.task-toolbar input { max-width: 280px; }
.task-toolbar select { width: auto; }

/* ---------- chat ---------- */
.chat { display: grid; grid-template-columns: 220px 1fr; gap: 14px; height: calc(100vh - 150px); min-height: 420px; }
.channels { padding: 10px; overflow: auto; }
.channels button {
  display: flex; width: 100%; align-items: center; gap: 8px; text-align: left; padding: 7px 9px; margin-bottom: 2px;
  background: none; border: 2px solid transparent; border-radius: 4px; cursor: pointer; color: var(--ink-dim);
}
.channels button:hover { color: var(--ink); }
.channels button.active { background: var(--field); border-color: var(--screen-edge); color: var(--ink); }
.channels .sep { font: 7px var(--pixel); letter-spacing: 1px; color: var(--ink-mute); margin: 12px 4px 6px; text-transform: uppercase; }
.chat-main { display: flex; flex-direction: column; min-height: 0; }
.messages { flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.msg { display: flex; gap: 10px; }
.msg .ava { flex: none; width: 30px; height: 28px; image-rendering: pixelated; background-size: 100% 100%; }
.msg .ava.owner { background: var(--gold); border-radius: 4px; height: 30px; display: grid; place-items: center; color: #1a120c; font: 9px var(--pixel); }
.msg .ava.system { background: #3b2d22; border-radius: 4px; height: 30px; display: grid; place-items: center; color: var(--ink-dim); font: 9px var(--pixel); }
.msg-head { font-size: 11px; color: var(--ink-mute); }
.msg-head b { color: var(--ink); font-size: 12px; }
.msg-head .to { color: var(--gold); }
.msg-body { white-space: pre-wrap; word-break: break-word; font-size: 12.5px; margin-top: 1px; }
.mention { color: var(--gold); font-weight: 600; }
.composer { display: flex; gap: 8px; padding: 10px; border-top: 2px solid var(--panel-edge); }
.composer textarea { min-height: 42px; height: 42px; }

/* ---------- journal ---------- */
table.list { width: 100%; border-collapse: collapse; font-size: 12px; }
table.list th { text-align: left; font: 7px var(--pixel); letter-spacing: 1px; text-transform: uppercase; color: var(--ink-mute); padding: 8px; border-bottom: 2px solid var(--panel-edge); }
table.list td { padding: 8px; border-bottom: 1px solid #2f2118; vertical-align: top; }
table.list tr.click { cursor: pointer; }
table.list tr.click:hover td { background: rgba(255,255,255,.02); }
.st { font-size: 11px; font-weight: 700; }
.st.done { color: var(--green); } .st.failed { color: var(--red); } .st.running { color: var(--blue); } .st.queued { color: var(--amber); } .st.cancelled { color: var(--ink-mute); }

/* ---------- modal ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 60; background: rgba(8,5,3,.72); display: grid; place-items: start center; padding: 6vh 16px; overflow: auto; }
.modal { width: min(640px, 100%); background: #1d140d; border: 3px solid var(--panel-edge); border-radius: 6px; box-shadow: 6px 6px 0 #000; padding: 18px 20px; }
.modal.wide { width: min(860px, 100%); }
.modal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.modal-head h2 { margin: 0; font-size: 16px; }
.modal-head .btn { margin-left: auto; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 4px 12px; font-size: 12px; margin-bottom: 12px; }
.kv dt { color: var(--ink-mute); }
.kv dd { margin: 0; }
.section { margin-top: 16px; }
.result { background: var(--field); border: 2px solid var(--screen-edge); border-radius: 4px; padding: 10px 12px; white-space: pre-wrap; word-break: break-word; max-height: 360px; overflow: auto; }
.mini-list > div { padding: 6px 0; border-bottom: 1px solid #2f2118; font-size: 12px; cursor: pointer; }
.mini-list > div:hover { color: var(--gold); }
.token { font-family: var(--mono); background: var(--field); border: 2px dashed var(--screen-edge); padding: 8px 10px; border-radius: 4px; word-break: break-all; }
code { background: var(--field); padding: 1px 5px; border-radius: 3px; font-size: 11.5px; }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: #f4e7cf; color: #1a120c; border: 2px solid #000; box-shadow: 3px 3px 0 #000; border-radius: 4px; padding: 9px 12px; font-size: 12px; animation: pop2 .2s ease-out; cursor: pointer; }
.toast.err { background: #f3c4bf; }
.toast b { display: block; margin-bottom: 2px; }
@keyframes pop2 { from { transform: translateY(8px); opacity: 0; } }

/* ---------- login ---------- */
.login { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(340px, 100%); display: flex; flex-direction: column; gap: 12px; padding: 24px; border: 3px solid var(--panel-edge); background: var(--wood-a); border-radius: 6px; box-shadow: 6px 6px 0 #000; }
.login-card .logo { text-align: center; margin-bottom: 8px; }
.login-err { color: var(--red); font-size: 12px; min-height: 16px; }

.empty { color: var(--ink-mute); text-align: center; padding: 30px 10px; font-size: 12px; }

/* ---------- mobile ---------- */
@media (max-width: 900px) {
  .topbar { padding: 10px 16px; gap: 10px; }
  .stats { order: 5; width: 100%; margin-left: 0; }
  .actions { margin-left: auto; }
  main { padding: 12px 16px 60px; }
  .chat { grid-template-columns: 1fr; height: auto; }
  .channels { display: flex; gap: 4px; overflow-x: auto; }
  .channels button { width: auto; white-space: nowrap; }
  .channels .sep { display: none; }
  .messages { max-height: 60vh; }
  .row, .row3 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .tabs { order: 4; width: 100%; overflow-x: auto; }
  .desks { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 10px; }
  .actions #btn-pause { padding: 7px 9px; }
}
@media (prefers-reduced-motion: reduce) {
  .desk.working .sprite, .zzz, .bubble, .toast { animation: none; }
}

/* ---------- engine / level / hierarchy ---------- */
.legend, .room.gym { grid-column: 1 / -1; }
.legend {
  display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center;
  padding: 10px 14px; border: 2px dashed var(--panel-edge); border-radius: 6px;
  font-size: 11.5px; color: var(--ink-dim); background: rgba(0,0,0,.18);
}
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }
.eng, .lvl {
  display: inline-block; padding: 1px 6px; border-radius: 3px; font-size: 10px; font-weight: 700; line-height: 1.5; white-space: nowrap;
}
.eng.cloud { background: #173247; color: #8fd0f5; border: 1px solid #2c5b7c; }
.eng.mac { background: #3b2a12; color: #f3bf6b; border: 1px solid #7a5520; }
.lvl { background: #2a2140; color: #c9b0f5; border: 1px solid #4d3d78; }
.crown { font-size: 12px; }
.desk.claude-code .stand { background: #6b5022; }
.desk.api .stand { background: #26475e; }
.drawer-org { margin-top: 8px; font-size: 12px; color: var(--ink-dim); }
.drawer-org a { color: var(--gold); text-decoration: none; }
.drawer-org a:hover { text-decoration: underline; }
.xp { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 11px; }
.xp-bar { flex: 1; max-width: 200px; height: 8px; background: var(--field); border: 1px solid var(--screen-edge); border-radius: 2px; overflow: hidden; }
.xp-bar i { display: block; height: 100%; background: linear-gradient(90deg, #8f68b0, #c9b0f5); }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.stat { background: var(--field); border: 2px solid var(--screen-edge); border-radius: 4px; padding: 8px; text-align: center; }
.stat b { display: block; font-size: 16px; }
.stat span { font-size: 10.5px; color: var(--ink-mute); }
.feedback { border-top: 2px dashed var(--panel-edge); padding-top: 14px; }

/* ---------- desk away ---------- */
.desk.away .screen { opacity: .6; }
.chair { width: 30px; height: 30px; margin: 14px auto 0; background: #3a2a1d; border: 3px solid #241910; border-radius: 4px 4px 0 0; box-shadow: 0 -8px 0 -3px #4a3526; }

/* ---------- gym ---------- */
.room.gym {
  --room: #9be15d;
  background:
    linear-gradient(180deg, rgba(0,0,0,.25), rgba(0,0,0,0) 40px),
    conic-gradient(from 90deg at 1px 1px, #1d2320 90deg, #232a26 0) 0 0 / 28px 28px;
  border-color: #3f5a3a;
  min-height: 0;
}
.stations { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px 14px; }
.station { position: relative; display: flex; flex-direction: column; align-items: center; cursor: pointer; padding-top: 6px; }
.station .desk-name { margin-top: 6px; }
.gym-sprite { position: relative; z-index: 2; width: 56px; height: 72px; image-rendering: pixelated; background-size: 100% 100%; animation: gym 0.9s steps(1) infinite; }
@keyframes gym { 0% { background-image: var(--f1); } 50% { background-image: var(--f2); } }
.equip { position: absolute; left: 50%; transform: translateX(-50%); z-index: 1; pointer-events: none; }
/* беговая дорожка */
.act-run .equip { top: 62px; width: 84px; height: 14px; border-radius: 3px; background: repeating-linear-gradient(90deg, #2b2b2b 0 8px, #3a3a3a 8px 16px); border: 2px solid #111; animation: belt .4s linear infinite; }
.act-run .equip i { position: absolute; right: -4px; top: -40px; width: 6px; height: 42px; background: #6b7278; border-radius: 2px; }
.act-run .gym-sprite { animation-duration: .35s; }
@keyframes belt { to { background-position: -16px 0; } }
/* штанга: резиновый коврик */
.act-lift .equip { top: 70px; width: 90px; height: 8px; background: #1a1a1a; border-radius: 3px; }
.act-lift .gym-sprite { animation-duration: 1.2s; }
/* диван с кофе */
.act-sofa .equip { top: 30px; width: 86px; height: 46px; background: #7a3b2e; border: 3px solid #4d231a; border-radius: 10px 10px 4px 4px; box-shadow: inset 0 -14px 0 #8e4a3a; }
.act-sofa .equip i { position: absolute; right: 6px; top: -18px; width: 4px; height: 12px; background: rgba(255,255,255,.45); border-radius: 2px; animation: steam 1.6s ease-in-out infinite; }
.act-sofa .gym-sprite { animation-duration: 2.4s; }
@keyframes steam { 0% { transform: translateY(4px); opacity: 0; } 50% { opacity: .8; } 100% { transform: translateY(-8px); opacity: 0; } }
/* пинг-понг */
.act-pong .equip { top: 44px; left: calc(50% + 34px); width: 46px; height: 10px; background: #1f6b3a; border: 2px solid #0f3b1f; transform: none; }
.act-pong .equip i { position: absolute; top: -18px; left: 4px; width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: ball .9s ease-in-out infinite alternate; }
@keyframes ball { 0% { transform: translate(0, 0); } 50% { transform: translate(18px, -10px); } 100% { transform: translate(34px, 4px); } }

/* ---------- team ---------- */
.team-head { padding: 14px 16px; margin-bottom: 16px; }
.org { display: flex; flex-direction: column; gap: 8px; }
.org-children { margin-left: 26px; padding-left: 16px; border-left: 2px dashed var(--panel-edge); display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.org-card {
  display: flex; gap: 12px; align-items: center; padding: 8px 12px; cursor: pointer;
  background: var(--wood-a); border: 2px solid var(--panel-edge); border-radius: 6px; box-shadow: 0 2px 0 #0b0704; max-width: 720px;
}
.org-card:hover { border-color: var(--panel-hi); }
.org-card.working { border-color: var(--green); }
.org-sprite { flex: none; width: 36px; height: 33px; image-rendering: pixelated; background-size: 100% 100%; }
.org-card.working .org-sprite { animation: type .45s steps(1) infinite; }
.org-info { min-width: 0; }
.org-name { font-weight: 700; font-size: 13px; }
.org-role { font-size: 11.5px; color: var(--ink-dim); }
.org-info .chips { justify-content: flex-start; }
@media (max-width: 560px) {
  .org-children { margin-left: 8px; padding-left: 10px; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .stations { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .gym-sprite, .act-run .equip, .act-sofa .equip i, .act-pong .equip i { animation: none; }
}
.chips .badge { align-self: center; }
.topbar .chip { padding: 3px 7px; }
.eng.gpt { background: #10352c; color: #7fe3c2; border: 1px solid #1f6b55; }
.desk.codex .stand { background: #1f5a48; }
.model-quick { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--ink-dim); }
.model-quick select { width: auto; max-width: 260px; padding: 4px 8px; font-size: 12px; }

/* ---------- плавность ---------- */
.btn, .tabs button, .drawer-tabs button, .channels button, .card, .org-card, .route-card, .split-card, .desk .screen, .badge, .chip, input, select, textarea {
  transition: transform .16s ease, background-color .16s ease, border-color .16s ease, box-shadow .16s ease, color .16s ease, opacity .16s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 3px 0 #0b0704; }
.btn:active:not(:disabled) { transform: translateY(1px); box-shadow: none; }
.card:hover, .org-card:hover, .route-card:hover, .split-card:hover { transform: translateY(-2px); }
.desk { transition: transform .2s ease; }
.desk:hover { transform: translateY(-2px); }
.view:not(.hidden) { animation: viewIn .28s ease both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } }
.modal-wrap:not(.hidden) { animation: fadeIn .18s ease both; }
.modal-wrap:not(.hidden) .modal { animation: modalIn .24s cubic-bezier(.2, .9, .3, 1.2) both; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.drawer:not(.hidden) { animation: drawerIn .28s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes drawerIn { from { transform: translateX(40px); opacity: 0; } }
.drawer-body > * { animation: viewIn .22s ease both; }
.msg-new { animation: viewIn .25s ease both; }
.typing::after { content: '▋'; margin-left: 1px; opacity: .8; animation: caret .7s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.desk.working .screen { animation: glow 2.2s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 1px #2c4a17, 0 0 22px rgba(155,225,93,.5), inset 0 0 18px rgba(155,225,93,.08); } }
.xp-bar i { transition: width .6s cubic-bezier(.2, .8, .2, 1); }

/* ---------- кому дать задачу ---------- */
.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 14px; padding: 8px 10px; background: var(--field); border: 2px dashed var(--screen-edge); border-radius: 4px; font-size: 11.5px; color: var(--ink-dim); }
.flow span { background: var(--wood-a); border: 1px solid var(--panel-edge); padding: 2px 7px; border-radius: 3px; color: var(--ink); }
.flow i { font-style: normal; color: var(--gold); }
.field-label { display: block; font-size: 11px; color: var(--ink-dim); margin-bottom: 6px; }
.route-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.route-card {
  position: relative; display: flex; gap: 10px; align-items: center; text-align: left; cursor: pointer;
  padding: 10px 12px; background: var(--wood-a); border: 2px solid var(--panel-edge); border-radius: 6px; color: var(--ink);
}
.route-card.active { border-color: var(--gold); background: #33251a; box-shadow: 0 0 0 1px var(--gold), 0 0 14px rgba(224,176,79,.25); }
.route-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.route-text b { font-size: 12.5px; }
.route-text span { font-size: 11px; color: var(--ink-dim); line-height: 1.35; }
.route-tag { position: absolute; top: -9px; right: 8px; background: var(--gold); color: #1a120c; font-size: 9.5px; font-weight: 700; padding: 1px 6px; border-radius: 3px; }
.route-more { margin-top: 10px; font-size: 12px; color: var(--ink-dim); }
.route-more summary { cursor: pointer; margin-bottom: 6px; }
#route-hint { display: block; margin-top: 8px; color: var(--gold); font-size: 11.5px; min-height: 16px; }

/* ---------- как задачу разделили ---------- */
.split-tree { display: flex; flex-direction: column; gap: 8px; }
.split-children { margin: 8px 0 0 18px; padding-left: 14px; border-left: 2px dashed var(--panel-edge); display: flex; flex-direction: column; gap: 8px; }
.split-card { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; cursor: pointer; background: var(--field); border: 2px solid var(--screen-edge); border-radius: 5px; }
.split-card.st-done { border-color: #3d5f2a; }
.split-card.st-in_progress { border-color: var(--green); }
.split-card.st-failed { border-color: #7a302b; }
.split-info { flex: 1; min-width: 0; font-size: 12px; }
.split-title { color: var(--ink); margin-top: 2px; }
.split-result { margin-top: 4px; color: var(--ink-dim); font-size: 11.5px; white-space: pre-wrap; }
.split-mark { font-size: 14px; }

/* ---------- живой офис: крупные столы ---------- */
.desks { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 26px 18px; }
.desk .sprite-wrap { height: 55px; }
.desk .sprite { width: 60px; height: 55px; }
.desk .plank {
  position: relative; width: 96%; height: 14px;
  background: linear-gradient(#80583a, #6b4a2f); border-bottom: 4px solid #4d331f; border-radius: 2px;
}
.desk .plank::before, .desk .plank::after { content: ''; position: absolute; top: 14px; width: 6px; height: 12px; background: #3e2918; }
.desk .plank::before { left: 10px; }
.desk .plank::after { right: 10px; }
.desk-name { margin-top: 16px; }
.tray { position: absolute; right: 8px; bottom: 12px; width: 26px; display: flex; flex-direction: column-reverse; align-items: center; }
.tray i { display: block; width: 22px; height: 3px; margin-top: -1px; background: #f2ecdf; border: 1px solid #b8ad97; border-radius: 1px; }
.tray i:nth-child(odd) { transform: translateX(-2px) rotate(-3deg); }
.tray i:nth-child(3n) { background: #f4d98a; }
.tray.bump { animation: bump .5s ease; }
@keyframes bump { 30% { transform: translateY(-5px) scale(1.15); } }
.mug { position: absolute; left: 10px; bottom: 12px; width: 9px; height: 9px; background: #e8e1d4; border-radius: 0 0 2px 2px; box-shadow: 3px 1px 0 -1px #e8e1d4; }
.desk.out .chair { margin-top: 20px; }

/* ---------- ходьба ---------- */
main { position: relative; }
#life { position: absolute; inset: 0; pointer-events: none; z-index: 30; overflow: visible; }
.walker { position: absolute; left: 0; top: 0; width: 56px; height: 72px; transition-property: transform; transition-timing-function: linear; will-change: transform; }
.walk-sprite { width: 56px; height: 72px; image-rendering: pixelated; background-size: 100% 100%; }
.walker.moving .walk-sprite { animation: gym .32s steps(1) infinite; }
.walker.left .walk-sprite { transform: scaleX(-1); }
.walker .bubble { bottom: calc(100% + 6px); }
.walker.courier::after { content: 'курьер'; position: absolute; left: 50%; bottom: -12px; transform: translateX(-50%); font-size: 9px; color: var(--gold); white-space: nowrap; }
.carry { position: absolute; left: 38px; top: 38px; width: 16px; height: 12px; background: #f0c24b; border: 2px solid #8a6414; border-radius: 1px 3px 1px 1px; box-shadow: 1px 1px 0 #000; }
.walker.left .carry { left: 1px; }
.carry::before { content: ''; position: absolute; left: -2px; top: -5px; width: 7px; height: 4px; background: #f0c24b; border: 2px solid #8a6414; border-bottom: none; border-radius: 2px 2px 0 0; }
.carry.done { background: #8fd46a; border-color: #3f6b22; }
.carry.done::before { background: #8fd46a; border-color: #3f6b22; }

/* ---------- холл ---------- */
.room.hall {
  grid-column: 1 / -1; min-height: 0; padding: 12px 16px 14px;
  background:
    linear-gradient(180deg, rgba(0,0,0,.2), rgba(0,0,0,0) 30px),
    conic-gradient(from 90deg at 1px 1px, #2c2118 90deg, #33271c 0) 0 0 / 32px 32px;
}
.hall-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.spot { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 10px; color: var(--ink-mute); }
.spot b { font-weight: 600; }
.door-px { width: 40px; height: 62px; background: #5a3b22; border: 3px solid #2e1d10; border-bottom: none; border-radius: 3px 3px 0 0; position: relative; box-shadow: inset 0 0 0 4px #6b4a2f; }
.door-px::after { content: ''; position: absolute; right: 6px; top: 30px; width: 5px; height: 5px; background: var(--gold); border-radius: 50%; }
.board-px { width: 120px; height: 56px; background: #eef1f0; border: 4px solid #7b818a; border-radius: 2px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #1a120c; }
.board-px span { font: 7px var(--pixel); letter-spacing: 1px; color: #3b5da8; }
.board-px b { font: 16px var(--pixel); color: #c0392b; margin-top: 6px; }
.tray.big { position: static; width: 40px; min-height: 22px; padding: 4px 0; background: #3b2a1d; border: 3px solid #241910; border-top: none; border-radius: 0 0 4px 4px; justify-content: flex-start; }
.tray.big i { width: 30px; height: 4px; background: #8fd46a; border-color: #3f6b22; }
.plant-px { width: 26px; height: 40px; position: relative; }
.plant-px::before { content: ''; position: absolute; left: 3px; bottom: 0; width: 20px; height: 14px; background: #a0522d; border-radius: 0 0 4px 4px; }
.plant-px::after { content: ''; position: absolute; left: 0; bottom: 12px; width: 26px; height: 28px; background: radial-gradient(circle at 30% 60%, #4f9d3a 0 7px, transparent 8px), radial-gradient(circle at 70% 45%, #5cb043 0 8px, transparent 9px), radial-gradient(circle at 50% 20%, #3f8a2d 0 7px, transparent 8px); }
.cooler-px { width: 28px; height: 64px; position: relative; }
.cooler-px::before { content: ''; position: absolute; left: 6px; top: 0; width: 16px; height: 22px; background: linear-gradient(90deg, #7fc4ef, #b9e3fb); border-radius: 6px 6px 2px 2px; opacity: .9; }
.cooler-px::after { content: ''; position: absolute; left: 0; top: 22px; width: 28px; height: 42px; background: #e9ecef; border: 2px solid #9aa3ab; border-radius: 3px; }
.cooler-px i { position: absolute; left: 11px; top: 34px; z-index: 1; width: 6px; height: 4px; background: #d23b3b; border-radius: 1px; }
.coffee-px { width: 32px; height: 46px; position: relative; background: #2b2b2e; border: 2px solid #111; border-radius: 3px; }
.coffee-px::before { content: ''; position: absolute; left: 8px; bottom: 5px; width: 12px; height: 10px; background: #f2ecdf; border-radius: 0 0 3px 3px; }
.coffee-px i { position: absolute; right: 4px; top: 5px; width: 5px; height: 5px; border-radius: 50%; background: #5cd65c; box-shadow: 0 0 5px #5cd65c; animation: caret 1.6s steps(1) infinite; }
@media (max-width: 560px) {
  .desks { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 10px; }
  .board-px { width: 80px; }
  .hall-row .plant:last-child { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  #life { display: none; }
}

/* ---------- файлы, одобрения, доступы ---------- */
.drop { display: block; padding: 14px; text-align: center; font-size: 12px; color: var(--ink-dim); background: var(--field); border: 2px dashed var(--screen-edge); border-radius: 5px; cursor: pointer; }
.drop:hover, .drop.over { border-color: var(--gold); color: var(--ink); }
.file-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.file-chip { display: inline-flex; gap: 6px; align-items: center; padding: 3px 8px; background: var(--wood-a); border: 1px solid var(--panel-edge); border-radius: 4px; font-size: 11.5px; color: var(--ink); text-decoration: none; }
.file-chip b { cursor: pointer; color: var(--red); }
a.file-chip:hover { border-color: var(--gold); }
.approvals-wrap { grid-column: 1 / -1; }
.approvals-wrap:empty { display: none; }
.room.approvals { min-height: 0; border-color: var(--amber); box-shadow: inset 0 0 0 2px #120c07, 0 0 18px rgba(240,180,74,.25); }
.room.approvals .room-title { color: var(--amber); }
.approval { padding: 10px 12px; margin-bottom: 10px; background: rgba(0,0,0,.25); border: 2px solid var(--panel-edge); border-radius: 5px; }
.approval-title { font-weight: 700; margin: 4px 0 8px; }
.approval .result { max-height: 220px; }
.warn-chip { border-color: var(--amber); color: var(--amber); }
.agent-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0 10px; margin: 10px 0; max-height: 180px; overflow: auto; }
.agent-checks .check { margin-bottom: 4px; font-size: 12px; }
.chat-bar { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: 12px; }
.ok-txt { color: var(--green); font-weight: 600; }
.thinking { color: var(--ink-dim); font-size: 12px; padding: 4px 2px; }
.thinking span { animation: caret 1.2s steps(1) infinite; }
.thinking span:nth-child(2) { animation-delay: .2s; }
.thinking span:nth-child(3) { animation-delay: .4s; }

/* ---------- карта офиса ---------- */
.view-toggle { grid-column: 1 / -1; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 11.5px; }
.view-toggle button { padding: 6px 12px; background: var(--wood-a); border: 2px solid var(--panel-edge); border-radius: 4px; color: var(--ink-dim); cursor: pointer; font-weight: 600; font-size: 12px; }
.view-toggle button.active { color: var(--ink); border-color: var(--gold); background: #33251a; }
.view-toggle .muted { margin-left: 6px; }
.map-host { grid-column: 1 / -1; }
.map-wrap { position: relative; border: 3px solid var(--panel-edge); border-radius: 6px; background: #120c08; box-shadow: 0 3px 0 #0b0704; }
.map-scroll { overflow-x: auto; overflow-y: hidden; }
.map-stage { position: relative; min-width: 1000px; }
.map-canvas { display: block; width: 100%; height: auto; image-rendering: pixelated; image-rendering: crisp-edges; }
.map-overlay { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.map-label {
  position: absolute; transform: translateX(-50%); white-space: nowrap;
  font: 600 10px/1.2 var(--mono); color: var(--ink); padding: 1px 5px; border-radius: 3px;
  background: rgba(18, 12, 8, .72); border: 1px solid rgba(74, 51, 35, .8);
}
.map-label i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 4px; background: var(--ink-mute); vertical-align: 1px; }
.map-label .dot-working { background: var(--green); box-shadow: 0 0 5px var(--green); }
.map-label .dot-queued { background: var(--amber); }
.map-label .dot-error { background: var(--red); }
.map-label .dot-limit { background: #8f68b0; }
.map-label .dot-off { background: #2a211a; }
.map-badge { position: absolute; transform: translate(-50%, -100%); font-size: 13px; filter: drop-shadow(0 1px 0 #000); animation: zz 1.8s ease-in-out infinite; }
.map-bubble {
  position: absolute; transform: translate(-50%, calc(-100% - 10px)); z-index: 3; max-width: 200px; width: max-content;
  background: #f4e7cf; color: #1a120c; border: 2px solid #000; border-radius: 4px; padding: 4px 7px;
  font-size: 10.5px; line-height: 1.3; box-shadow: 2px 2px 0 #000; animation: pop .18s ease-out;
}
.map-bubble::after { content: ''; position: absolute; left: 50%; bottom: -8px; margin-left: -5px; border: 5px solid transparent; border-top-color: #000; }
.map-tip {
  position: absolute; z-index: 5; width: 250px; padding: 8px 10px; pointer-events: none;
  background: #1d140d; border: 2px solid var(--panel-edge); border-radius: 5px; box-shadow: 3px 3px 0 #000; font-size: 11.5px; line-height: 1.45;
}
@media (max-width: 560px) {
  .map-stage { min-width: 900px; }
}
/* карта: масштаб подписей вместе с картой, кнопки зума, перетаскивание */
.map-label { font-size: clamp(9px, calc(var(--tile, 22px) * .42), 17px); }
.map-badge { font-size: clamp(11px, calc(var(--tile, 22px) * .6), 22px); }
.map-bubble { font-size: clamp(10px, calc(var(--tile, 22px) * .44), 16px); max-width: calc(var(--tile, 22px) * 10); }
.zoom-btns { display: inline-flex; margin-left: 6px; }
.zoom-btns button { width: 30px; padding: 4px 0; border-radius: 0; margin-left: -2px; font-size: 14px; }
.zoom-btns button:first-child { border-radius: 4px 0 0 4px; }
.zoom-btns button:last-child { border-radius: 0 4px 4px 0; }
.map-wrap.dragging .map-canvas { cursor: grabbing !important; }
.map-wrap.dragging { user-select: none; }
