:root {
  --bg: #f6efe4;
  --bg-2: #efe5d6;
  --surface: #fffdf9;
  --surface-2: #f6f0e7;
  --ink: #2f2a25;
  --muted: #7a6e62;
  --line: #e7dccc;
  --accent: #e07a3f;
  --accent-2: #c9632b;
  --accent-ink: #ffffff;
  --green: #4f9d69;
  --blue: #4a7bd0;
  --purple: #8a63c9;
  --red: #d64545;
  --amber: #c98a1b;
  --grey: #8b8f96;
  --shadow: 0 18px 50px rgba(73, 50, 25, 0.16), 0 2px 8px rgba(73, 50, 25, 0.08);
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1d1915; --bg-2: #171310; --surface: #28221d; --surface-2: #312a24; --ink: #f4ece2; --muted: #b5a797;
    --line: #3d342c; --shadow: 0 18px 50px rgba(0, 0, 0, 0.45); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1d1915; --bg-2: #171310; --surface: #28221d; --surface-2: #312a24; --ink: #f4ece2; --muted: #b5a797;
  --line: #3d342c; --shadow: 0 18px 50px rgba(0, 0, 0, 0.45); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
  margin: 0; font: 15px/1.45 var(--font); color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-2); }
code { font: 0.92em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
h1 { font-size: 26px; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 20px; margin: 4px 0 8px; letter-spacing: -0.01em; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 22px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--red); min-height: 1em; }
.ok-text { color: var(--green); }

.app { display: grid; grid-template-rows: auto 1fr; height: 100dvh; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 10px 16px; z-index: 5;
  background: color-mix(in srgb, var(--surface) 88%, transparent); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 30px; height: 30px; flex: none; background: linear-gradient(135deg, #f19a5f, var(--accent) 55%, #b8562a); clip-path: polygon(50% 0, 100% 25%, 100% 72%, 50% 100%, 0 72%, 0 25%); }
.brand-mark.big { width: 56px; height: 56px; margin: 0 auto 10px; display: block; }
.brand-name { font-weight: 700; letter-spacing: -0.01em; }
.brand-sub { font-size: 12px; color: var(--muted); white-space: nowrap; }
.tabs { display: flex; gap: 2px; background: var(--surface-2); padding: 3px; border-radius: 12px; }
.tabs button { border: 0; background: none; padding: 6px 12px; border-radius: 9px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 14px; }
.tabs button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }
.pill-count { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.counters { display: flex; gap: 6px; margin-left: auto; overflow-x: auto; scrollbar-width: none; min-width: 0; flex: 0 1 auto; }
.topbar > .brand, .topbar > .tabs, .topbar > .new-task { flex: none; }
.counter { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 4px 10px; cursor: pointer; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.counter b { color: var(--ink); font-size: 15px; margin-right: 5px; }
.counter.c-waiting_owner b { color: var(--red); }

.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 11px; padding: 8px 14px; cursor: pointer; font-weight: 600; font-size: 14px; transition: background 0.15s, transform 0.1s; }
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { background: var(--accent-2); }
.btn.small { padding: 4px 10px; font-size: 12.5px; border-radius: 9px; }
.new-task { white-space: nowrap; }
.link { border: 0; background: none; padding: 0; text-align: left; color: var(--accent-2); cursor: pointer; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.icon-btn { width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); font-size: 18px; cursor: pointer; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06); }

.views { position: relative; overflow: hidden; }
.view { position: absolute; inset: 0; display: none; }
.view.active { display: block; }
.page { overflow: auto; padding: 22px max(16px, calc((100% - 1040px) / 2)) 120px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 0; max-width: 680px; }
.section-title { margin-top: 28px; }

/* ---------- карта ---------- */
.view-office { background: radial-gradient(120% 90% at 30% 20%, color-mix(in srgb, var(--surface) 70%, var(--bg)) 0%, var(--bg) 55%, var(--bg-2) 100%); }
.map { position: absolute; inset: 0; }
.office-svg { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; outline: none; }
.office-svg.panning { cursor: grabbing; }
.layer-shadows { fill: #5c3c1e; opacity: 0.2; }
.hero { cursor: pointer; outline: none; }
.hero-shadow { fill: rgba(70, 45, 20, 0.3); }
.hero-ring { fill: none; stroke: var(--accent); stroke-width: 3; opacity: 0; }
.hero.selected .hero-ring, .hero:focus-visible .hero-ring { opacity: 1; }
.hero-body { transition: transform 0.18s ease; }
.hero:hover .hero-body { transform: translateY(-4px); }
.hero.walking .hero-body { animation: bob 0.32s ease-in-out infinite alternate; }
.hero-badge circle { stroke: #fff; stroke-width: 2; }
.hero-badge text { fill: #fff; font: 800 12px var(--font); }
.hero.waiting .hero-badge { animation: pulse 1.1s ease-in-out infinite; }
@keyframes bob { from { transform: translateY(0); } to { transform: translateY(-3px); } }
@keyframes pulse { 50% { opacity: 0.45; } }
.tag { cursor: pointer; }
.tag-bg { fill: rgba(255, 253, 249, 0.95); stroke: rgba(80, 60, 40, 0.18); }
.tag-name { font: 650 11.5px var(--font); fill: #2f2a25; }
.tag-role { font: 500 10.5px var(--font); fill: #6b6157; }
.tag.sel .tag-bg { stroke: var(--accent); stroke-width: 1.5; }
.far .tag:not(.sel) { display: none; }
.zone-sign rect { fill: rgba(47, 42, 37, 0.8); }
.zone-sign text { fill: #fff; font: 650 12.5px var(--font); letter-spacing: 0.01em; }
.zone-sign.zone-owner rect { fill: rgba(224, 122, 63, 0.95); }
.zone-sign.zone-studio rect { fill: rgba(91, 138, 114, 0.92); }
.zone-sign.zone-kitchen, .zone-sign.zone-entrance { opacity: 0.75; }
.very-far .zone-sign.zone-kitchen, .very-far .zone-sign.zone-entrance { display: none; }
.floor-label { font: 800 15px var(--font); fill: rgba(122, 86, 50, 0.3); letter-spacing: 3px; }
.plate { font: 800 6.5px var(--font); fill: #5a3b22; letter-spacing: 1px; }
.board-title { font: 800 8.5px var(--font); fill: #5a463c; letter-spacing: 1px; }
.board-count { font: 700 7.5px var(--font); fill: #7a6e62; }
.check { font: 800 15px var(--font); fill: #4f9d69; }
.clickable { cursor: pointer; }
.clickable:hover { filter: brightness(1.06); }
.sunlight { opacity: 0.9; pointer-events: none; }
.glow { pointer-events: none; }

.map-tools { position: absolute; right: 16px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; }
.map-note {
  position: absolute; left: 16px; top: 14px; max-width: 360px; padding: 12px 14px; border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 14px;
}
.note-line { margin-top: 6px; font-size: 13px; color: var(--muted); }
.map-note .note-line:first-child { margin-top: 0; }
.map-note [data-hide-note] { font-size: 12px; margin-top: 4px; }
.ok-dot, .warn-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-right: 6px; vertical-align: 1px; }
.warn-dot { background: var(--amber); }
.legend { position: absolute; left: 16px; bottom: 18px; display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); background: color-mix(in srgb, var(--surface) 85%, transparent); border: 1px solid var(--line); padding: 6px 10px; border-radius: 10px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }

/* ---------- списки ---------- */
.seg { display: flex; background: var(--surface-2); padding: 3px; border-radius: 11px; }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.agent-card { min-width: 0; width: 100%; display: flex; gap: 12px; align-items: center; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 10px 12px; cursor: pointer; transition: border-color 0.15s, transform 0.12s; }
.agent-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.agent-card img { width: 56px; height: 56px; object-fit: contain; flex: none; background: var(--surface-2); border-radius: 12px; }
.ac-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ac-role { font-size: 13px; color: var(--muted); }
.ac-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-text.stx-free { color: var(--green); font-weight: 600; }
.st-text:not(.stx-free) { color: var(--accent-2); font-weight: 600; }

.report { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; }
.tile b { font-size: 26px; line-height: 1.1; }
.tile span { color: var(--muted); font-size: 13px; }
.tile.warn b { color: var(--red); }
.filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 12px; }
.filters label { display: flex; flex-direction: column; font-size: 12.5px; color: var(--muted); gap: 3px; }
select, input, textarea { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 8px 10px; min-width: 0; }
textarea { resize: vertical; min-height: 70px; }
select:focus, input:focus, textarea:focus, .btn:focus-visible, .link:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.task-list { display: flex; flex-direction: column; gap: 6px; }
.task-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 10px 12px; cursor: pointer; margin-bottom: 6px; }
.task-row:hover { border-color: var(--accent); }
.tr-code { font: 600 12.5px ui-monospace, Menlo, monospace; color: var(--muted); flex: none; }
.tr-title { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.tr-title b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-title .muted { font-size: 12.5px; }
.tr-side { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 650; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.chip.ghost { background: transparent; border: 1px solid var(--line); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.st-free { background: #e3f2e7; color: #2f7a48; }
.st-new { background: #fff1d6; color: #8a5b00; }
.st-assigned { background: #e2ebfa; color: #2f5fae; }
.st-in_progress { background: #fde6d6; color: #a64f1c; }
.st-review { background: #ece3f8; color: #6a46a8; }
.st-waiting_owner { background: #fbe0e0; color: #b02f2f; }
.st-paused { background: #ebecee; color: #5d6168; }
.st-done { background: #e3f2e7; color: #2f7a48; }
.prio { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.p-high { background: #fff1d6; color: #8a5b00; }
.p-urgent { background: #fbe0e0; color: #b02f2f; }
.p-low { background: var(--surface-2); color: var(--muted); }

.timeline { display: flex; flex-direction: column; border-left: 2px solid var(--line); margin-left: 4px; }
.ev { display: flex; gap: 12px; padding: 6px 0 6px 12px; position: relative; font-size: 13.5px; }
.ev::before { content: ""; position: absolute; left: -6px; top: 12px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.ev-time { color: var(--muted); font-size: 12.5px; white-space: nowrap; flex: none; min-width: 112px; }
.ev-note { display: block; color: var(--muted); }
.empty { text-align: center; padding: 34px 18px; border: 1px dashed var(--line); border-radius: var(--radius); background: color-mix(in srgb, var(--surface) 60%, transparent); }
.empty b { display: block; font-size: 16px; margin-bottom: 4px; }
.empty p { margin: 0 auto 12px; color: var(--muted); max-width: 440px; }
.empty-ico { width: 46px; height: 46px; margin: 0 auto 10px; background: linear-gradient(135deg, #f3d9b1, #e9c08c); clip-path: polygon(50% 0, 100% 25%, 100% 72%, 50% 100%, 0 72%, 0 25%); opacity: 0.8; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; }
.card h2 { font-size: 17px; margin-top: 0; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; align-items: center; }
.kv:last-child { border-bottom: 0; }
.kv { flex-wrap: wrap; }
.kv > span:last-child { text-align: right; margin-left: auto; }
.steps { margin-top: 10px; background: var(--surface-2); border-radius: 12px; padding: 10px 14px; }
.steps summary { cursor: pointer; font-weight: 650; }
.steps ol { margin: 8px 0 2px; padding-left: 20px; }
.steps li { margin-bottom: 6px; }
.toggles { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 6px 0 12px; }
.toggle { display: flex; gap: 6px; align-items: center; cursor: pointer; }
.svc-list, .tool-list { display: flex; flex-direction: column; gap: 8px; }
.svc, .tool { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.svc-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 2px; }
.tool { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.tool-side { display: flex; gap: 8px; align-items: center; flex: none; }
.badge { display: inline-block; font-size: 12px; font-weight: 650; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.b-ok { background: #e3f2e7; color: #2f7a48; }
.b-warn { background: #fff1d6; color: #8a5b00; }
.b-bad { background: #fbe0e0; color: #b02f2f; }
.b-off { background: var(--surface-2); color: var(--muted); }

/* ---------- панель карточек ---------- */
.scrim { position: fixed; inset: 0; background: rgba(30, 20, 10, 0.32); z-index: 20; }
.panel {
  position: fixed; right: 14px; top: 72px; bottom: 14px; width: min(460px, calc(100vw - 28px)); z-index: 21;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; animation: slidein 0.18s ease-out;
}
@keyframes slidein { from { transform: translateX(16px); opacity: 0; } }
.panel-body { overflow: auto; padding: 20px 20px 28px; flex: 1; overscroll-behavior: contain; }
.panel-close { position: absolute; right: 12px; top: 10px; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font-size: 22px; line-height: 1; cursor: pointer; z-index: 2; }
.panel-grip { display: none; }
.agent-head { display: flex; gap: 14px; align-items: center; padding-right: 30px; }
.agent-photo { width: 116px; height: 116px; object-fit: contain; flex: none; background: radial-gradient(circle at 50% 60%, #fbefe0, transparent 70%); border-radius: 20px; }
.agent-head h2 { font-size: 19px; margin: 2px 0 8px; }
.ready { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.dl { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; margin: 12px 0; font-size: 14px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }
.brief { white-space: pre-wrap; background: var(--surface-2); border-radius: 12px; padding: 10px 12px; margin: 0; }
.skill pre { white-space: pre-wrap; font: 12.5px/1.5 ui-monospace, Menlo, monospace; background: var(--surface-2); padding: 12px; border-radius: 12px; max-height: 360px; overflow: auto; }
.skill summary, .manual summary { cursor: pointer; font-weight: 650; }
.manual { margin-top: 16px; background: var(--surface-2); border-radius: 14px; padding: 10px 12px; }
.result { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.result p { margin: 6px 0; white-space: pre-wrap; }
.result.old { opacity: 0.7; }
.links { margin: 4px 0; padding-left: 18px; }
.actions { display: flex; flex-direction: column; gap: 8px; }
.actions > .btn { align-self: flex-start; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.inline-form > input, .inline-form > select { flex: 1 1 180px; }
.stack { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.stack label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check-line { flex-direction: row !important; align-items: center; gap: 8px !important; color: var(--ink) !important; }
.panel-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.run { margin-top: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.alert { background: #fbe0e0; color: #8e2525; border-radius: 12px; padding: 8px 12px; margin: 10px 0; }
.question { border: 1px solid color-mix(in srgb, var(--red) 35%, var(--line)); background: color-mix(in srgb, var(--red) 8%, var(--surface)); border-radius: 14px; padding: 12px; margin: 10px 0; }
.q-head { display: flex; gap: 10px; align-items: center; }
.q-head img { width: 40px; height: 40px; object-fit: contain; }
.q-text { white-space: pre-wrap; margin: 10px 0; }
.q-options { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.q-form { display: flex; gap: 8px; }
.q-form input { flex: 1; }

.login { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 30% 20%, #fbf4ea, var(--bg)); z-index: 40; }
.login-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 28px 24px; box-shadow: var(--shadow); text-align: center; }
.login-block { text-align: left; margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.login-block label { font-weight: 600; font-size: 14px; }
.hint { font-size: 12.5px; color: var(--muted); margin: 0; }
.boot { position: fixed; inset: 0; display: grid; place-items: center; color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; background: #2f2a25; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 60; transition: opacity 0.2s, transform 0.2s; pointer-events: none; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #a13030; }
.toast.warn { background: #8a5b00; }
.tabbar { display: none; }

/* ---------- телефон ---------- */
@media (max-width: 1100px) {
  .counters .counter { padding: 4px 8px; }
  .tabs button { padding: 6px 9px; }
}
@media (max-width: 1080px) {
  .counters { display: none; }
}
@media (max-width: 760px) {
  .topbar { padding: 8px 12px; gap: 8px; }
  .tabs { display: none; }
  .counters { display: flex; margin-left: auto; }
  .counter { font-size: 11px; padding: 3px 7px; }
  .counter b { font-size: 13px; margin-right: 3px; }
  .counter.c-review, .counter.c-in_progress { display: none; }
  .new-task { display: none; }
  .brand-sub { display: none; }
  .views { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
  .view { bottom: calc(60px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; height: calc(60px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--line);
  }
  .tabbar button { flex: 1; border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-size: 11px; color: var(--muted); font-weight: 600; position: relative; cursor: pointer; }
  .tabbar .ti { font-size: 18px; line-height: 1.1; }
  .tabbar button.active { color: var(--accent-2); }
  .tabbar .dot { position: absolute; top: 8px; right: calc(50% - 18px); width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
  .page { padding: 16px 16px 40px; }
  h1 { font-size: 22px; }
  .report { grid-template-columns: repeat(2, 1fr); }
  .team-grid { grid-template-columns: 1fr; }
  .map-note { left: 12px; right: 12px; top: 10px; max-width: none; font-size: 13px; }
  .legend { display: none; }
  .map-tools { right: 12px; bottom: 14px; }
  .panel {
    left: 0; right: 0; top: auto; bottom: 0; width: 100%; max-height: 88dvh; border-radius: 20px 20px 0 0;
    padding-bottom: env(safe-area-inset-bottom); animation: sheet 0.2s ease-out;
  }
  @keyframes sheet { from { transform: translateY(30px); opacity: 0; } }
  .panel-grip { display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 8px auto 0; }
  .panel-body { padding: 12px 16px 24px; }
  .dl { grid-template-columns: 1fr; gap: 2px; }
  .dl dd { margin-bottom: 8px; }
  .row2 { grid-template-columns: 1fr; }
  .agent-photo { width: 88px; height: 88px; }
  .ev { flex-direction: column; gap: 0; }
  .task-row { flex-wrap: wrap; }
  .tr-side { width: 100%; justify-content: flex-start; }
  .tool { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.setup-box { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--amber) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--amber) 35%, var(--line)); font-size: 14px; }
.setup-id { margin: 6px 0 2px; font-size: 15px; }
.setup-id code { font-size: 16px; font-weight: 700; }
.file-row { display: flex; justify-content: space-between; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; margin-bottom: 6px; }
.file-row .badge { margin-top: 4px; white-space: normal; }

/* новая карта */
.view-switch { position: absolute; right: 16px; top: 14px; z-index: 2; box-shadow: var(--shadow); }
.mon-icon { font-family: "Apple Color Emoji", "Segoe UI Emoji", sans-serif; pointer-events: none; }
.map-tip rect { fill: rgba(255, 253, 249, 0.97); stroke: rgba(80, 60, 40, 0.25); }
.map-tip .tip-main { font: 700 11.5px var(--font); fill: #2f2a25; }
.map-tip .tip-sub { font: 500 10.5px var(--font); fill: #6b6157; }
.hero.working .hero-body { animation: type 0.9s ease-in-out infinite alternate; }
@keyframes type { from { transform: translateY(0); } to { transform: translateY(-1.5px); } }
@media (max-width: 760px) { .view-switch { right: 12px; top: auto; bottom: 150px; } }

/* какая модель выполнила этап */
.prov { font-size: 12px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2, rgba(127,127,127,.15)); color: var(--muted, #888); white-space: nowrap; }

/* ======================================================================
   Тёмный хай-тек (22.11.2026): графит, белые тонкие линии, стекло.
   Офис всегда тёмный — как утверждённый облик (materials/05-Office/final/).
   ====================================================================== */
:root, :root[data-theme="light"], :root[data-theme="dark"] {
  --bg: #0a0c0f; --bg-2: #0d1014; --surface: #13161b; --surface-2: #1a1e24; --surface-3: #22272e;
  --ink: #eef1f4; --muted: #8a939d; --line: rgba(255, 255, 255, 0.08); --line-strong: rgba(255, 255, 255, 0.16);
  --accent: #f2f4f7; --accent-2: #c9d2dc; --accent-ink: #0a0c0f; --glow: rgba(255, 255, 255, 0.55);
  --green: #3ecf8e; --blue: #5b9dff; --purple: #a78bfa; --red: #ff5d5d; --amber: #f5b544; --grey: #6b7280;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --radius: 14px; color-scheme: dark;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: light) { :root:not([data-theme]) { color-scheme: dark; } }
body { background: var(--bg); letter-spacing: -0.005em; }
::selection { background: rgba(255, 255, 255, 0.2); }
* { scrollbar-color: var(--surface-3) transparent; scrollbar-width: thin; }
a { color: var(--accent-2); }
code { background: var(--surface-2); color: var(--accent-2); }
h3 { color: var(--muted); letter-spacing: 0.12em; font-weight: 600; }

/* шапка — стеклянная полоса с тонкой светлой линией */
.topbar { background: rgba(13, 16, 20, 0.72); border-bottom: 1px solid var(--line); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03); }
.brand-mark { background: none; clip-path: none; width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--line-strong);
  background: linear-gradient(160deg, #2a3038, #0f1216); position: relative; }
.brand-mark::after { content: ""; position: absolute; inset: 8px; border-top: 2px solid var(--accent); border-right: 2px solid var(--accent); border-radius: 2px; opacity: 0.9; }
.brand-name { font-weight: 650; letter-spacing: 0.01em; }
.tabs { background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); }
.tabs button { color: var(--muted); font-weight: 550; display: inline-flex; align-items: center; gap: 7px; }
.tabs button:hover { color: var(--ink); }
.tabs button.active { background: rgba(255, 255, 255, 0.09); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
.ico { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.counter { background: rgba(255, 255, 255, 0.03); border-color: var(--line); }
.counter:hover { border-color: var(--line-strong); }

/* кнопки: главная — белая, остальные — стекло */
.btn { background: rgba(255, 255, 255, 0.04); border-color: var(--line); color: var(--ink); font-weight: 550; }
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.08); border-color: var(--line-strong); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 24px rgba(255, 255, 255, 0.12); }
.btn.primary:hover:not(:disabled) { background: #ffffff; }
.icon-btn { background: rgba(19, 22, 27, 0.8); border-color: var(--line); color: var(--ink); box-shadow: var(--shadow); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.icon-btn:hover { border-color: var(--line-strong); }
.seg { background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); }
.seg button.on { background: rgba(255, 255, 255, 0.1); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
.pill-count { background: var(--red); }
select, input, textarea { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
select:focus, input:focus, textarea:focus, .btn:focus-visible, .link:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }

/* офис (карта) */
.view-office { background: radial-gradient(120% 90% at 50% 0%, #161a20 0%, var(--bg) 60%, #07080a 100%); }
.map-note, .legend { background: rgba(19, 22, 27, 0.78); border-color: var(--line); color: var(--muted);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: var(--shadow); }
.map-note { color: var(--ink); }
.layer-shadows { fill: #000; opacity: 0.35; }
.hero-shadow { fill: rgba(0, 0, 0, 0.45); }
.hero-ring { stroke: var(--accent); }
.hero-badge circle { stroke: #0a0c0f; }
.tag-bg { fill: rgba(13, 16, 20, 0.88); stroke: var(--line-strong); }
.tag-name { fill: #eef1f4; }
.tag-role { fill: #8a939d; }
.zone-sign rect { fill: rgba(242, 244, 247, 0.92); }
.zone-sign text { fill: #0a0c0f; }
.zone-sign.zone-owner rect, .zone-sign.zone-studio rect { fill: rgba(242, 244, 247, 0.92); }
.floor-label { fill: rgba(255, 255, 255, 0.12); }
.plate, .board-title { fill: #c9d2dc; }
.board-count { fill: #8a939d; }

/* списки, карточки, плитки */
.agent-card, .task-row, .tile, .panel, .card { background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.015)); border-color: var(--line); }
.agent-card:hover, .task-row:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.agent-card img { background: radial-gradient(circle at 50% 35%, #232830, #12151a); border: 1px solid var(--line); }
.tile b { font-weight: 650; letter-spacing: -0.02em; }
.st-text:not(.stx-free) { color: var(--accent-2); }
.chip { background: rgba(255, 255, 255, 0.06); color: var(--muted); font-weight: 600; }
.st-free, .st-done { background: rgba(62, 207, 142, 0.12); color: var(--green); }
.st-new { background: rgba(245, 181, 68, 0.12); color: var(--amber); }
.st-assigned { background: rgba(91, 157, 255, 0.12); color: var(--blue); }
.st-in_progress { background: rgba(255, 255, 255, 0.1); color: #ffffff; }
.st-review { background: rgba(167, 139, 250, 0.14); color: var(--purple); }
.st-waiting_owner { background: rgba(255, 93, 93, 0.13); color: var(--red); }
.st-paused { background: rgba(255, 255, 255, 0.05); color: var(--muted); }
.p-high { background: rgba(245, 181, 68, 0.12); color: var(--amber); }
.p-urgent { background: rgba(255, 93, 93, 0.13); color: var(--red); }
.ev::before { background: var(--bg); border-color: var(--accent); }
.empty { background: rgba(255, 255, 255, 0.02); border-color: var(--line-strong); }
.prov { background: rgba(255, 255, 255, 0.07); color: var(--accent-2); border: 1px solid var(--line); }
.b-ok { background: rgba(62, 207, 142, 0.12); color: var(--green); }
.b-warn { background: rgba(245, 181, 68, 0.12); color: var(--amber); }
.b-bad, .alert { background: rgba(255, 93, 93, 0.12); color: #ff9a9a; }
.toast { background: rgba(242, 244, 247, 0.96); color: #0a0c0f; box-shadow: var(--shadow); }
.toast.error { background: #ff5d5d; color: #fff; }
.toast.warn { background: #f5b544; color: #0a0c0f; }
.map-tip rect { fill: rgba(13, 16, 20, 0.95); stroke: var(--line-strong); }
.map-tip .tip-main { fill: #eef1f4; }
.map-tip .tip-sub { fill: #8a939d; }
/* карточка агента: «что делает сейчас и как» */
.now-card { margin: 14px 0 4px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015)); }
.now-row { display: flex; gap: 12px; padding: 4px 0; align-items: baseline; }
.now-k { flex: none; width: 104px; color: var(--muted); font-size: 12.5px; letter-spacing: 0.04em; text-transform: uppercase; }
.now-v { min-width: 0; }
.now-steps { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.now-step { font-size: 12.5px; color: var(--muted); }
.now-step span { display: inline-block; min-width: 96px; }
.now-step b { color: var(--ink); font-weight: 550; }
.panel { background: rgba(14, 17, 21, 0.97); border-color: var(--line-strong); box-shadow: var(--shadow);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.panel-close { background: rgba(255, 255, 255, 0.06); color: var(--ink); border: 1px solid var(--line); }
.scrim { background: rgba(0, 0, 0, 0.5); }
.agent-photo { background: radial-gradient(circle at 50% 40%, #242a32, #101317); border-radius: 18px; border: 1px solid var(--line); }
.login-card, .boot { background: var(--bg); color: var(--ink); }
.login-card { background: var(--surface); border: 1px solid var(--line); }
@media (max-width: 760px) { .filters label, .filters select { max-width: 100%; width: 100%; } }
/* 3D-офис */
.map-2d, .map-3d { position: absolute; inset: 0; }
.office-3d { width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
.map3d-tip { position: absolute; pointer-events: none; padding: 6px 10px; border-radius: 10px; font-size: 12.5px;
  background: rgba(13, 16, 20, 0.92); border: 1px solid var(--line-strong); color: var(--ink); display: flex; flex-direction: column;
  box-shadow: var(--shadow); white-space: nowrap; z-index: 3; }
.map3d-tip span { color: var(--muted); font-size: 11.5px; }
