@font-face { font-family: "Jost"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("/static/fonts/jost-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Jost"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("/static/fonts/jost-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
:root {
  --bg: #f6f0ea; --panel: #fffdfa; --panel-2: #faf3ed; --text: #2c211c; --muted: #7e6c62; --line: #e8dbd0;
  --accent: #a8432c; --accent-text: #ffffff; --accent-soft: #f5e1d8; --focus: #a8432c;
  --ok: #2c7a4b; --ok-bg: #e3f1e4; --warn: #8f5a08; --warn-bg: #fbecc9; --alarm: #c8202c; --alarm-bg: #fde2e2;
  --info: #4a5e78; --info-bg: #e8edf3; --muted-bg: #efe5db; --chart-a: #a8432c; --chart-b: #d9a441; --chart-ghost: #bba89c;
  --radius: 18px; --shadow: 0 1px 2px rgba(80, 40, 20, .05), 0 8px 22px rgba(80, 40, 20, .06);
  --font: "Jost", "Futura", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not(.light) {
    --bg: #1d1613; --panel: #28201c; --panel-2: #2f2621; --text: #f4ebe4; --muted: #aa9a8f; --line: #3d332c;
    --accent: #e07a5a; --accent-text: #1e0d07; --accent-soft: #3e231a; --focus: #f09a80;
    --ok: #6cc48a; --ok-bg: #1f3527; --warn: #efb85a; --warn-bg: #3a2d12; --alarm: #ff8a82; --alarm-bg: #45201f;
    --info: #9db6d6; --info-bg: #28303a; --muted-bg: #332a24; --chart-a: #e07a5a; --chart-b: #e8b64f; --chart-ghost: #6f6054;
    --shadow: none;
  }
}
.theme-dark {
  --bg: #1d1613; --panel: #28201c; --panel-2: #2f2621; --text: #f4ebe4; --muted: #aa9a8f; --line: #3d332c;
  --accent: #e07a5a; --accent-text: #1e0d07; --accent-soft: #3e231a; --focus: #f09a80;
  --ok: #6cc48a; --ok-bg: #1f3527; --warn: #efb85a; --warn-bg: #3a2d12; --alarm: #ff8a82; --alarm-bg: #45201f;
  --info: #9db6d6; --info-bg: #28303a; --muted-bg: #332a24; --chart-a: #e07a5a; --chart-b: #e8b64f; --chart-ghost: #6f6054;
  --shadow: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h2 { font-size: 15px; letter-spacing: .01em; }
h3 { font-size: 14px; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: .92em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* кнопки и поля */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); cursor: pointer; line-height: 1.2; }
.btn:hover { background: var(--muted-bg); }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--alarm); border-color: var(--alarm); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea { width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
input[type=checkbox], input[type=radio] { width: auto; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row > .field { flex: 1 1 160px; margin-bottom: 0; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; margin: 0; }

/* значки */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 500;
  background: var(--muted-bg); color: var(--muted); white-space: nowrap; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.alarm { background: var(--alarm-bg); color: var(--alarm); }
.chip.info { background: var(--info-bg); color: var(--info); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }

/* панели и таблицы */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel > header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.panel > header .spacer, .spacer { flex: 1; }
.panel .body { padding: 14px 16px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; font-size: 12.5px; color: var(--muted); padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:hover { background: var(--panel-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.toolbar .field { margin: 0; min-width: 150px; }

/* вход */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.login { width: min(380px, 100%); padding: 28px; }
.login h1 { font-size: 20px; margin-bottom: 4px; }
.err { color: var(--alarm); font-size: 14px; min-height: 20px; margin: 4px 0 10px; }

/* уведомления и окна */
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { padding: 10px 14px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 4px 14px rgba(0,0,0,.2); max-width: 360px; }
.toast.ok { border-color: var(--ok); } .toast.err { border-color: var(--alarm); color: var(--alarm); }
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: grid; place-items: center; z-index: 40; padding: 16px; }
.modal { width: min(640px, 100%); max-height: 90vh; overflow: auto; }
.modal.wide { width: min(900px, 100%); }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }

/* графики */
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.bar-a { fill: var(--chart-a); } .bar-b { fill: var(--chart-b); } .bar-ghost { fill: none; stroke: var(--chart-ghost); stroke-width: 1.5; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

.lead { margin: 0 0 18px; }
.block { width: 100%; justify-content: center; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.right { margin-left: auto; }
.nowrap { white-space: nowrap; }
.gap { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* проходная */
.guard .topbar { display: flex; align-items: center; gap: 12px; padding: 10px 18px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.guard .topbar h1 { font-size: 18px; }
.guard .topbar time { font-variant-numeric: tabular-nums; font-size: 18px; font-weight: 600; }
.banner { padding: 8px 14px; border-radius: 8px; font-weight: 700; }
.banner.alarm { background: var(--alarm); color: #fff; animation: blink 1.2s steps(2, jump-none) infinite; }
@keyframes blink { 50% { opacity: .65; } }
@media (prefers-reduced-motion: reduce) { .banner.alarm { animation: none; } }
.guard-grid { display: grid; grid-template-columns: minmax(300px, 1.1fr) minmax(360px, 1.3fr) minmax(320px, 1fr); gap: 14px; padding: 14px 18px; align-items: start; }
@media (max-width: 1100px) { .guard-grid { grid-template-columns: 1fr; } }
.guard .panel .scroll { max-height: calc(100vh - 150px); overflow: auto; }

.feed-list { list-style: none; margin: 0; padding: 0; }
.ev { display: grid; grid-template-columns: 64px 1fr; gap: 2px 10px; padding: 9px 14px; border-bottom: 1px solid var(--line); border-left: 4px solid transparent; font-size: 14px; }
.ev.sev-ok { border-left-color: var(--ok); } .ev.sev-warn { border-left-color: var(--warn); background: var(--warn-bg); }
.ev.sev-alarm { border-left-color: var(--alarm); background: var(--alarm-bg); } .ev.sev-info { border-left-color: var(--info); }
.ev .t { color: var(--muted); font-variant-numeric: tabular-nums; grid-row: span 2; }
.ev .l1 { font-weight: 600; } .ev .l2 { color: var(--muted); }
.ev.new { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: var(--info-bg); } }
@media (prefers-reduced-motion: reduce) { .ev.new { animation: none; } }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-size: 14px; }
.tab[aria-selected=true] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.doors-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; padding: 14px; }
.door { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--panel-2); display: flex; flex-direction: column; gap: 6px; }
.door.st-open { border-color: var(--ok); background: var(--ok-bg); }
.door.st-alarm, .door.st-offline { border-color: var(--alarm); background: var(--alarm-bg); }
.door.st-unlocked { border-color: var(--warn); background: var(--warn-bg); }
.door .code { font-size: 12px; color: var(--muted); }
.door .name { font-weight: 600; line-height: 1.25; }
.door .tags { display: flex; gap: 4px; flex-wrap: wrap; min-height: 22px; }

.sidecard { margin-bottom: 14px; }
.guest-result { display: grid; grid-template-columns: 150px 1fr; gap: 12px; align-items: center; }
.guest-result img { width: 150px; height: 150px; background: #fff; border-radius: 8px; padding: 4px; }
.list-compact { list-style: none; margin: 0; padding: 0; }
.list-compact li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.big { font-size: 34px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.section-title { margin: 18px 0 6px; padding-top: 14px; border-top: 1px solid var(--line); }
.tabs-row { padding: 12px 14px 0; }

/* руководство */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100%; }
@media (max-width: 860px) { .shell { grid-template-columns: 1fr; } }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
@media (max-width: 860px) { .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); } }
.side .brand { font-weight: 700; font-size: 17px; padding: 4px 10px 14px; }
.nav a { display: block; padding: 8px 12px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: 14.5px; }
.nav a:hover { background: var(--muted-bg); }
.nav a[aria-current=page] { background: var(--accent); color: var(--accent-text); font-weight: 600; }
.side .me { margin-top: auto; padding: 10px; font-size: 13px; color: var(--muted); }
#view { padding: 22px 28px 40px; max-width: 1280px; width: 100%; outline: none; }
@media (max-width: 860px) { #view { padding: 16px; } }
.page-title { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-title h1 { font-size: 22px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { padding: 14px 16px; }
.kpi .lab { font-size: 13px; color: var(--muted); }
.kpi .val { font-size: 32px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12.5px; color: var(--muted); min-height: 18px; }
.kpi.warn .val { color: var(--warn); } .kpi.alarm .val { color: var(--alarm); } .kpi.ok .val { color: var(--ok); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
@media (max-width: 1000px) { .grid2 { grid-template-columns: 1fr; } }
.split { display: grid; grid-template-columns: 300px 1fr; gap: 14px; align-items: start; }
@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } }
.pick { list-style: none; margin: 0; padding: 6px; }
.pick li button { width: 100%; text-align: left; background: none; border: 0; padding: 9px 10px; border-radius: 8px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.pick li button:hover { background: var(--muted-bg); }
.pick li button[aria-current=true] { background: var(--info-bg); }
.doorpick { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; }
.doorpick > header { padding: 8px 12px; background: var(--panel-2); border-radius: 8px 8px 0 0; display: flex; align-items: center; gap: 8px; }
.doorpick .items { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 14px; padding: 10px 12px; }
.tablewrap { overflow-x: auto; }
.pager { display: flex; gap: 10px; padding: 12px 16px; align-items: center; }
.sev-warn-text { color: var(--warn); } .sev-alarm-text { color: var(--alarm); }
.day-grid { display: grid; grid-template-columns: 60px 1fr; gap: 8px 10px; align-items: center; }
.day-grid label { margin: 0; }
.legend i.bar-a { background: var(--chart-a); } .legend i.bar-b { background: var(--chart-b); }
.legend i.ghost-sw { background: none; border: 1.5px solid var(--chart-ghost); }
.mono { white-space: nowrap; }

/* план этажа */
.plan { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.plan-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.plan-zoom { font-variant-numeric: tabular-nums; min-width: 42px; text-align: right; }
.plan-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); align-items: center; }
.plan-legend span { display: inline-flex; align-items: center; gap: 6px; }
.pin-sw { width: 12px; height: 12px; border-radius: 50%; display: inline-block; border: 1.5px solid #fff; box-shadow: 0 0 0 1px #1f3a5f; }
.plan-stage { position: relative; }
.plan-scroll { overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; max-height: calc(100vh - 230px); min-height: 260px; touch-action: pan-x pan-y; }
.plan-scroll.zoomed { cursor: grab; }
.plan-scroll.panning { cursor: grabbing; user-select: none; }
.plan-canvas { position: relative; min-width: 100%; }
.plan-img { display: block; width: 100%; height: auto; user-select: none; -webkit-user-drag: none; }
.plan-pins { position: absolute; inset: 0; }
.plan.placing .plan-canvas { cursor: crosshair; }
.plan-empty { border: 1px dashed var(--line); border-radius: 10px; }
.tab.alert::after { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--alarm); margin-left: 7px; }
.tab.alert[aria-selected=true]::after { background: #fff; }

.pin, .pin-sw { --pin: #3b6fb6; background: var(--pin); }
.pin { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; padding: 0; border-radius: 50%; border: 2px solid #fff;
  box-shadow: 0 0 0 1.5px #1f3a5f, 0 1px 4px rgba(0, 0, 0, .45); cursor: pointer; }
.pin.k-qr_button { border-radius: 3px; transform: rotate(45deg); }
.pin.k-two_sided { border-radius: 3px; }
.pin.st-closed, .pin-sw.st-closed { --pin: #3b6fb6; }
.pin.st-open, .pin-sw.st-open { --pin: #1e9e55; }
.pin.st-alarm, .pin-sw.st-alarm { --pin: #d6281e; }
.pin.st-unlocked, .pin-sw.st-unlocked { --pin: #e0a100; }
.pin.st-offline, .pin-sw.st-offline { --pin: #6b7280; }
.pin.st-unknown, .pin-sw.st-unknown { --pin: #9aa5b1; }
.pin.st-alarm { animation: pinpulse 1.1s ease-in-out infinite; z-index: 3; }
.pin.st-open, .pin.st-unlocked { z-index: 2; }
.pin.st-offline::before { content: "×"; position: absolute; inset: 0; color: #fff; font-weight: 700; line-height: 18px; text-align: center; font-size: 15px; }
.pin.k-qr_button.st-offline::before { transform: rotate(-45deg); }
.pin.fire { box-shadow: 0 0 0 1.5px #1f3a5f, 0 0 0 4px rgba(214, 40, 30, .35), 0 1px 4px rgba(0, 0, 0, .45); }
.pin.sel { outline: 3px solid #ff7a00; outline-offset: 2px; }
.pin.flash { animation: pinflash 1.4s ease-out 1; }
@keyframes pinpulse { 50% { box-shadow: 0 0 0 1.5px #1f3a5f, 0 0 0 9px rgba(214, 40, 30, .4), 0 1px 4px rgba(0, 0, 0, .45); } }
@keyframes pinflash { 0% { box-shadow: 0 0 0 1.5px #1f3a5f, 0 0 0 16px rgba(255, 122, 0, .7); } 100% { box-shadow: 0 0 0 1.5px #1f3a5f, 0 0 0 0 rgba(255, 122, 0, 0); } }
@media (prefers-reduced-motion: reduce) { .pin.st-alarm, .pin.flash { animation: none; } }
.pin-label { position: absolute; left: 20px; top: -9px; padding: 0 4px; border-radius: 3px; background: rgba(255, 255, 255, .94); color: #111;
  font-size: 11px; line-height: 16px; white-space: nowrap; pointer-events: none; display: none; border: 1px solid rgba(0, 0, 0, .25); }
.pin.k-qr_button .pin-label { transform: rotate(-45deg); transform-origin: left center; left: 24px; top: 4px; }
.plan.labels .pin-label, .pin:hover .pin-label, .pin:focus-visible .pin-label, .pin.sel .pin-label { display: block; }
.plan.editing .pin { cursor: move; touch-action: none; }

.plan-pop { position: absolute; z-index: 6; width: min(300px, calc(100% - 12px)); max-height: 80%; overflow: auto; padding: 12px 14px;
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .3); }
.pop-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 4px; }
.pop-head strong { line-height: 1.3; }
.plan-pop .tags { display: flex; gap: 4px; flex-wrap: wrap; margin: 8px 0; }
.pop-actions { margin: 8px 0 2px; }
.plan-pop .section-title { margin: 12px 0 4px; padding-top: 10px; }
.plan-events li { gap: 6px 8px; padding: 5px 0; font-size: 13px; }

/* проходная: план вместо карточек */
.view-switch { display: flex; gap: 4px; }
.guard-grid.plan-mode { grid-template-columns: minmax(250px, .7fr) minmax(560px, 2.7fr) minmax(280px, .85fr); }
@media (max-width: 1100px) { .guard-grid.plan-mode { grid-template-columns: 1fr; } }
.plan-box { padding: 12px 14px 14px; }

/* руководство: план и список дверей этажа */
.plan-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 14px; align-items: start; }
@media (max-width: 1000px) { .plan-layout { grid-template-columns: 1fr; } }
.plan-doors { max-height: calc(100vh - 250px); overflow: auto; }
.plan-doors ul { list-style: none; margin: 0; padding: 4px; }
.plan-doors li button { width: 100%; text-align: left; background: none; border: 0; border-radius: 8px; padding: 7px 10px; cursor: pointer; display: grid; grid-template-columns: 14px 1fr auto; gap: 2px 8px; align-items: center; }
.plan-doors li button:hover { background: var(--muted-bg); }
.plan-doors li button[aria-current=true] { background: var(--info-bg); }
.plan-doors .nm { font-weight: 600; font-size: 14px; line-height: 1.25; }
.plan-doors .cd { grid-column: 2 / 4; font-size: 12px; color: var(--muted); }
.plan-doors .dot.st-closed { color: #4a7f8c; } .plan-doors .dot.st-open { color: #1e9e55; } .plan-doors .dot.st-alarm { color: #d6281e; }
.plan-doors .dot.st-unlocked { color: #e0a100; } .plan-doors .dot.st-offline { color: #6b7280; } .plan-doors .dot.st-unknown { color: #9aa5b1; }
.plan-doors h3 { padding: 10px 12px 2px; font-size: 13px; color: var(--muted); }
.edit-hint { padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13px; background: var(--info-bg); color: var(--info); }

/* ---------- оформление: теплее и спокойнее ---------- */
body { font-size: 16.5px; line-height: 1.5; font-feature-settings: "tnum" 0; }
h1 { font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 17px; font-weight: 700; letter-spacing: -.005em; }
h3 { font-size: 15px; font-weight: 700; }
.mono { font-family: var(--mono); font-size: .9em; }
label { font-size: 13.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field { margin-bottom: 14px; }

.btn { padding: 9px 18px; border-radius: 12px; font-weight: 600; transition: background .15s, transform .05s, border-color .15s; }
.btn:active { transform: translateY(1px); }
.btn.primary { box-shadow: 0 1px 0 rgba(0, 0, 0, .12); }
.btn.primary:hover { filter: none; background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn.danger { background: transparent; }
.btn.danger:hover { background: var(--alarm-bg); }
.btn.small { padding: 5px 12px; border-radius: 10px; font-size: 13.5px; }
input, select, textarea { padding: 10px 13px; border-radius: 12px; background: var(--panel); transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 17px; height: 17px; }

.chip { padding: 3px 11px; font-weight: 600; font-size: 12.5px; }
.panel { border-color: var(--line); }
.panel > header { padding: 16px 20px 12px; border-bottom: 0; }
.panel .body { padding: 8px 20px 18px; }
th { font-size: 13px; font-weight: 600; color: var(--muted); padding: 10px 14px; background: transparent; }
td { padding: 11px 14px; }
tbody tr:hover { background: var(--panel-2); }
.empty { padding: 36px 20px; }
.toast { border-radius: 14px; padding: 12px 16px; }
.overlay { background: rgba(40, 28, 16, .45); backdrop-filter: blur(2px); }
.modal footer { border-top: 0; padding: 12px 20px 18px; }

/* вход */
.login-wrap { background: radial-gradient(ellipse at 20% 10%, var(--accent-soft), transparent 55%), var(--bg); }
.login { width: min(420px, 100%); padding: 36px 34px 30px; }
.login .logo { margin-bottom: 18px; }
.login h1 { font-size: 28px; }
.login .lead { margin-top: 6px; }
.logo { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--accent); color: var(--accent-text); }
.logo svg { width: 24px; height: 24px; }

/* меню руководства */
.side { padding: 22px 14px; gap: 2px; background: var(--panel); }
.side .brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 18px; padding: 0 10px 22px; }
.side .brand .logo { width: 38px; height: 38px; border-radius: 12px; }
.side .brand small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); line-height: 1.2; }
.nav a { padding: 10px 14px; border-radius: 12px; font-weight: 600; font-size: 15px; color: var(--muted); }
.nav a:hover { background: var(--muted-bg); color: var(--text); }
.nav a[aria-current=page] { background: var(--accent-soft); color: var(--accent); }
.side .me { font-size: 13.5px; }
#view { padding: 30px 36px 56px; }
.page-title { margin-bottom: 22px; }
.page-title h1 { font-size: 28px; }
.kpis { gap: 14px; margin-bottom: 22px; }
.kpi { padding: 18px 20px; }
.kpi .lab { font-size: 14px; font-weight: 600; }
.kpi .val { font-size: 38px; font-weight: 800; letter-spacing: -.02em; margin: 2px 0; }
.kpi .sub { font-size: 13px; }
.grid2 { gap: 16px; margin-bottom: 16px; }
.pick li button { border-radius: 12px; padding: 10px 12px; }
.pick li button[aria-current=true] { background: var(--accent-soft); }
.doorpick { border-radius: 14px; }
.doorpick > header { border-radius: 14px 14px 0 0; }
.hint { font-size: 13px; line-height: 1.45; }

/* проходная */
.guard .topbar { padding: 12px 22px; border-bottom: 0; box-shadow: 0 1px 0 var(--line); }
.guard .topbar h1 { font-size: 20px; }
.banner { border-radius: 12px; }
.guard-grid { gap: 16px; padding: 18px 22px; }
.tab { padding: 7px 15px; border-radius: 999px; font-weight: 600; font-size: 14px; background: transparent; border-color: var(--line); color: var(--muted); }
.tab:hover { background: var(--muted-bg); color: var(--text); }
.tab[aria-selected=true] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.doors-grid { gap: 12px; padding: 16px; }
.door { border-radius: 16px; padding: 14px 15px; gap: 7px; }
.door .name { font-weight: 700; }
.ev { border-left: 0; padding: 12px 18px; grid-template-columns: 62px 1fr; border-bottom: 1px solid var(--line); }
.ev .t::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; background: var(--muted); vertical-align: 1px; }
.ev.sev-ok .t::before { background: var(--ok); } .ev.sev-warn .t::before { background: var(--warn); }
.ev.sev-alarm .t::before { background: var(--alarm); } .ev.sev-info .t::before { background: var(--info); }
.ev .l1 { font-weight: 700; }
.guest-result img { border-radius: 14px; }
.big { font-weight: 800; letter-spacing: -.02em; }
.sidecard { margin-bottom: 16px; }

/* план */
.plan-scroll { border-radius: 14px; }
.plan-pop { border-radius: 16px; }
.pin.st-closed, .pin-sw.st-closed { --pin: #4a7f8c; }
.edit-hint { border-radius: 12px 12px 0 0; }

.logo.small { width: 34px; height: 34px; border-radius: 11px; }
.logo.small svg { width: 20px; height: 20px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.kpi .val { font-size: clamp(28px, 2.5vw, 36px); white-space: nowrap; }

/* сообщения, заявки, заказы (руководство) */
.nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.nav-badge { font-style: normal; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--alarm); color: #fff; font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }
.chatsplit { grid-template-columns: 320px 1fr; }
@media (max-width: 1000px) { .chatsplit { grid-template-columns: 1fr; } }
.thread-list { display: flex; flex-direction: column; padding: 6px; max-height: calc(100vh - 170px); overflow: auto; }
.thread { text-align: left; background: none; border: 0; border-radius: 14px; padding: 11px 12px; cursor: pointer; color: inherit; font: inherit; display: block; width: 100%; }
.thread:hover { background: var(--muted-bg); } .thread[aria-current=true] { background: var(--accent-soft); }
.th-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; } .th-last { font-size: 14px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chatpane header { padding: 14px 18px 8px; } .chatpane .pad { padding: 0 18px 12px; }
.mbox { height: calc(100vh - 330px); min-height: 260px; overflow: auto; padding: 8px 18px; display: flex; flex-direction: column; gap: 6px; }
.mmsg { max-width: 76%; padding: 9px 13px 6px; border-radius: 18px; font-size: 15px; overflow-wrap: anywhere; }
.mmsg.ten { align-self: flex-start; background: var(--muted-bg); border-bottom-left-radius: 5px; }
.mmsg.staff { align-self: flex-end; background: var(--accent); color: var(--accent-text); border-bottom-right-radius: 5px; }
.mtxt { white-space: pre-wrap; } .mwhen { font-size: 11.5px; opacity: .7; margin-top: 2px; text-align: right; }
.mday { align-self: center; font-size: 12px; color: var(--muted); background: var(--muted-bg); padding: 2px 12px; border-radius: 999px; margin: 8px 0 2px; }
.mreply { display: flex; gap: 10px; padding: 10px 18px; align-items: flex-end; } .mreply textarea { flex: 1; resize: none; }

/* админка сервиса: сводка, меню с картинками, настройки */
.ic3d { display: block; object-fit: contain; user-select: none; -webkit-user-drag: none; filter: drop-shadow(0 6px 7px rgba(80, 30, 10, .22)); }
.skpi { display: flex; align-items: center; gap: 14px; padding: 14px 18px; } .skpi img { flex: none; }
.skpi .lab { font-size: 13px; color: var(--muted); } .skpi .val { white-space: nowrap; font-size: 28px; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.skpi .sub { font-size: 12.5px; color: var(--muted); }
.catlist { display: grid; gap: 4px; padding: 8px 14px 14px; }
.catrow { display: flex; align-items: center; gap: 12px; padding: 6px 0; }
.catmid { flex: 1; min-width: 0; } .catname { display: flex; justify-content: space-between; gap: 10px; font-weight: 600; } .catname b { color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }
.catbar { height: 8px; border-radius: 999px; background: var(--muted-bg); margin-top: 5px; overflow: hidden; } .catbar i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.catchips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.cc { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px; border: 0; background: var(--muted-bg); color: var(--text); font: inherit; font-weight: 700; cursor: pointer; }
.cc i { font-style: normal; font-size: 12.5px; opacity: .6; } .cc.on { background: var(--accent); color: var(--accent-text); }
.mgrid-a { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.mcard { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px 14px; border-radius: 24px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); }
.mcard.off { opacity: .6; }
.mc-img { position: relative; display: grid; place-items: center; height: 130px; border-radius: 18px; background: radial-gradient(70% 70% at 50% 45%, var(--panel-2) 0%, var(--muted-bg) 100%); margin-bottom: 6px; }
.mc-img .chip { position: absolute; top: 8px; left: 8px; }
.mc-price { font-size: 20px; font-weight: 800; color: var(--accent); letter-spacing: -.02em; } .mc-price small { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.mc-name { font-weight: 700; } .mc-act { margin-top: 8px; }
.iconpick { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin: 6px 0 14px; }
.ip { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 16px; border: 2px solid transparent; background: var(--muted-bg); color: var(--text); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.ip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.lbl-s { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
.switch { display: flex; align-items: flex-start; gap: 12px; margin: 10px 0; cursor: pointer; color: var(--text); font-size: 14.5px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .sw { flex: none; width: 44px; height: 26px; border-radius: 999px; background: var(--chart-ghost); position: relative; transition: background .2s; margin-top: 1px; }
.switch .sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .2s; }
.switch input:checked + .sw { background: var(--accent); } .switch input:checked + .sw::after { transform: translateX(18px); }
.switch input:focus-visible + .sw { outline: 2px solid var(--focus); outline-offset: 2px; } .switch input:disabled + .sw { opacity: .5; }
.sw-t small { display: block; color: var(--muted); font-size: 12.5px; }
.setsec > header { gap: 12px; } .setsec > .body { padding: 14px 16px 16px; }
.stack { display: grid; gap: 14px; align-content: start; }
.dayrow { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.dayb { min-width: 44px; padding: 8px 10px; border-radius: 12px; border: 0; background: var(--muted-bg); color: var(--text); font: inherit; font-weight: 700; cursor: pointer; }
.dayb.on { background: var(--accent); color: var(--accent-text); } .dayb:disabled { opacity: .6; cursor: default; }
.cattiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin: 6px 0; }
.ct { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 16px; border: 2px solid transparent; background: var(--muted-bg); color: var(--muted); font: inherit; font-size: 13px; font-weight: 700; text-align: left; cursor: pointer; opacity: .65; }
.ct.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); opacity: 1; } .ct:disabled { cursor: default; }
.setsec .row > .field { flex: 1 1 110px; }
.logo-img { display: block; object-fit: cover; background: #fff; border-radius: 50%; box-shadow: 0 0 0 1px rgba(60, 30, 15, .12); flex: none; }

/* руководство на телефоне и планшете */
.mtop, .scrim { display: none; }
@media (max-width: 900px) {
  .shell { display: block; }
  .mtop { display: flex; position: sticky; top: 0; z-index: 20; align-items: center; gap: 12px; padding: 10px 14px; background: color-mix(in srgb, var(--bg) 90%, transparent);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 1px 0 var(--line); }
  .mbtn { width: 42px; height: 42px; border-radius: 14px; border: 0; background: var(--muted-bg); color: var(--text); display: inline-grid; place-items: center; cursor: pointer; }
  .mtitle { font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
  .side { position: fixed; z-index: 50; top: 0; left: 0; bottom: 0; width: min(300px, 86vw); height: 100%; flex-direction: column; flex-wrap: nowrap; overflow-y: auto; padding: 20px 12px calc(20px + env(safe-area-inset-bottom));
    border-right: 0; border-bottom: 0; transform: translateX(-104%); transition: transform .25s cubic-bezier(.2, .8, .2, 1); }
  body.nav-open .side { transform: none; box-shadow: 0 0 40px rgba(30, 20, 10, .3); }
  .scrim { position: fixed; inset: 0; z-index: 45; background: rgba(30, 20, 10, .45); }
  body.nav-open .scrim { display: block; }
  body.nav-open { overflow: hidden; }
  #view { padding: 16px 14px 48px; }
  .page-title { margin-bottom: 14px; gap: 8px 10px; } .page-title h1 { font-size: 22px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; } .kpi { padding: 12px 14px; } .kpi .val { font-size: 28px; }
  .skpi { padding: 12px 14px; gap: 10px; } .skpi img { width: 44px; height: 44px; } .skpi .val { font-size: 22px; }
  .toolbar { gap: 8px; } .toolbar .field { flex: 1 1 140px; min-width: 0; }
  .grid2 { gap: 12px; } .split { gap: 12px; }
  th, td { padding: 8px 10px; } td { font-size: 14px; }
  .modal { max-height: 94vh; } .overlay { padding: 8px; align-items: end; }
  .modal footer { flex-wrap: wrap; } .modal footer .btn { flex: 1 1 auto; justify-content: center; }
  .row > .field { flex: 1 1 100%; }
  .mgrid-a { grid-template-columns: repeat(2, 1fr); gap: 10px; } .mc-img { height: 100px; } .mc-act .btn { flex: 1 1 auto; justify-content: center; }
  .iconpick { grid-template-columns: repeat(3, 1fr); } .cattiles { grid-template-columns: 1fr 1fr; }
  .mbox { height: 46vh; min-height: 220px; padding: 8px 12px; } .mmsg { max-width: 90%; } .thread-list { max-height: 34vh; } .mreply { padding: 10px 12px; flex-wrap: wrap; } .mreply .btn { width: 100%; justify-content: center; }
  .plan-scroll { max-height: 60vh; } .plan-doors { max-height: 40vh; }
  .chart { min-width: 0; }
}
@media (max-width: 480px) {
  .mgrid-a { grid-template-columns: 1fr 1fr; } .mc-price { font-size: 17px; }
  .kpi .val { font-size: 24px; } .kpi .lab { font-size: 12.5px; }
  .skpi .val { font-size: 20px; }
  .btn { padding: 9px 14px; } .btn.small { padding: 7px 12px; }
  input, select, textarea { font-size: 16px; }
}
@media (max-width: 600px) { .kpis.one { grid-template-columns: 1fr; } }
