/* ОКРУГ ЦККБ — дизайн-система. Перенесена из эталона ОКРУГа (design/ds2.css, разделы
 * 1 шрифты · 2 токены · 4 основа · 5 оболочка · 6 компоненты · 8 окна · 10 телефон ·
 * 11 движение), без слоёв чужого бандла. Описание — docs/DESIGN-SYSTEM.md.
 *
 * Правила: цвет только токенами и только по смыслу (красный — критично, янтарь —
 * внимание, зелёный — норма, синий — только фокус); `transition: all` запрещён;
 * анимируются transform / opacity / цвет / тень / clip-path; бесконечное движение —
 * только у индикатора занятости и у точки «стоит» (тест test_design).
 */

/* ── 1. шрифты (OFL — static/fonts/LICENSE-*.txt) ─────────────────────── */
@font-face { font-family: "Geist"; src: url("/static/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("/static/fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Unbounded"; src: url("/static/fonts/Unbounded-cyr.woff2") format("woff2");
  font-weight: 200 900; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Unbounded"; src: url("/static/fonts/Unbounded-lat.woff2") format("woff2");
  font-weight: 200 900; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ── 2. токены ──────────────────────────────────────────────────────────── */
:root {
  --font: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --display: "Unbounded", "Geist", -apple-system, "Segoe UI", Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 72px;
  /* радиусы по роли: панель 20 · лист 14 · сегмент и рабочая кнопка 8 · таблетка — только главное действие */
  --r-seg: 8px; --r-btn: 8px; --r-sheet: 14px; --r-panel: 20px; --r-pill: 999px;
  --dur-1: 140ms; --dur-2: 220ms; --dur-3: 380ms; --dur-4: 620ms;
  --ease-out: cubic-bezier(.2, .8, .2, 1); --ease-in: cubic-bezier(.4, 0, 1, 1);
  --ease-enter: cubic-bezier(.05, .7, .1, 1); --ease-exit: cubic-bezier(.3, 0, .8, .15);
  --spring-snap: cubic-bezier(.25, 1.08, .45, 1); --spring-glide: cubic-bezier(.16, 1, .3, 1);
  --spring-nav: cubic-bezier(.3, 1.24, .4, 1);
  --top-h: 60px; --tab-h: 64px; --gutter: clamp(16px, 2.2vw, 36px);
  --ring: 0 0 0 2px var(--canvas), 0 0 0 4px var(--focus);
}
:root, :root[data-ui=light] {
  color-scheme: light;
  --canvas: #f2f2f0; --surface: #ffffff; --surface-2: #e9e9e6; --hover: #e4e4e1; --field: #ffffff; --raised: #ffffff;
  --ink: #0d0d0e; --on-ink: #ffffff; --body: #3b3b3d; --mute: #626267; --faint: #66666a;
  --line: #e3e3e0; --line-strong: #cfcfcb; --line-control: #848488;
  --focus: #0a5fd6;
  --crit: #c21f13; --crit-x: #d92d20; --on-crit: #ffffff; --crit-bg: #fde4e2;
  --warn: #8f4a00; --warn-x: #b25e00; --warn-bg: #fff1dc;
  --ok: #13774a; --ok-x: #1f8a4c; --ok-bg: #e2f3e9;
  --inv-bg: #0d0d0e; --inv-fg: #f4f4f4; --inv-mute: #9a9a9e; --inv-line: #2a2a2d;
  --pop-bg: #ffffff; --scrim: rgb(10 10 10 / .42);
  --nav-bg: rgb(0 0 0 / .05); --nav-on: #ffffff; --nav-on-sh: 0 1px 2px rgb(0 0 0 / .10), 0 0 0 .5px rgb(0 0 0 / .06);
  --sh-1: 0 1px 0 rgb(0 0 0 / .03), 0 1px 2px rgb(0 0 0 / .06), 0 0 0 1px rgb(0 0 0 / .05);
  --sh-2: 0 1px 0 rgb(255 255 255 / .7) inset, 0 1px 2px rgb(0 0 0 / .06), 0 8px 24px -12px rgb(0 0 0 / .18), 0 0 0 1px rgb(0 0 0 / .05);
  --sh-3: 0 0 0 1px rgb(0 0 0 / .06), 0 12px 32px -8px rgb(0 0 0 / .18), 0 32px 64px -24px rgb(0 0 0 / .22);
  /* знак ЦККБ: номера других районов — фон штрихкода */
  --other: #d6d6d2;
}
:root[data-ui=dark] {
  color-scheme: dark;
  --canvas: #0a0a0b; --surface: #141416; --surface-2: #1d1d20; --hover: #222226; --field: #0f0f11; --raised: #19191c;
  --ink: #f3f3f4; --on-ink: #0b0b0c; --body: #c3c3c8; --mute: #8e8e93; --faint: #858589;
  --line: #232326; --line-strong: #333338; --line-control: #6e6e73;
  --focus: #5aa2ff;
  --crit: #ff5d50; --crit-x: #ff5d50; --on-crit: #0b0b0c; --crit-bg: #3a1512;
  --warn: #ffb224; --warn-x: #ffb224; --warn-bg: #33240a;
  --ok: #3dd68c; --ok-x: #3dd68c; --ok-bg: rgb(61 214 140 / .13);
  --inv-bg: #f3f3f4; --inv-fg: #0b0b0c; --inv-mute: #555558; --inv-line: #d4d4d8;
  --pop-bg: #19191c; --scrim: rgb(0 0 0 / .62);
  --nav-bg: rgb(255 255 255 / .05); --nav-on: rgb(255 255 255 / .11); --nav-on-sh: inset 0 1px 0 rgb(255 255 255 / .08);
  --sh-1: inset 0 0 0 1px rgb(255 255 255 / .07), inset 0 1px 0 rgb(255 255 255 / .05);
  --sh-2: inset 0 0 0 1px rgb(255 255 255 / .08), inset 0 1px 0 rgb(255 255 255 / .09), 0 24px 48px -32px rgb(0 0 0 / .9);
  --sh-3: 0 0 0 1px rgb(255 255 255 / .09), 0 24px 56px -16px rgb(0 0 0 / .8);
  --other: #2c2c30;
}

/* ── 4. основа ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 20px; color: var(--body);
  background: var(--canvas); -webkit-font-smoothing: antialiased; min-height: 100vh; }
h1, h2, h3, h4, b, strong { color: var(--ink); }
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--ink); }
img { max-width: 100%; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.mono, code, kbd { font-family: var(--mono); }
::selection { background: color-mix(in srgb, var(--focus) 25%, transparent); }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* фокус — один на всё */
:is(button, a, [role=button], [role=switch], [role=tab], input, select, textarea, summary, [tabindex]):focus-visible {
  outline: none; box-shadow: var(--ring); }
:is(button, a, [role=button]):focus:not(:focus-visible) { outline: none; }

/* ── 5. оболочка: шапка, разделы, пульс (shell.js) ─────────────────────── */
.skip { position: fixed; left: 8px; top: 8px; transform: translateY(-80px); z-index: 1000; padding: 8px 12px;
  border-radius: var(--r-btn); background: var(--ink); color: var(--on-ink); font-weight: 500; text-decoration: none;
  transition: transform var(--dur-2) var(--ease-out); }
.skip:focus { transform: none; }
.top { position: fixed; inset: 0 0 auto 0; z-index: 50; padding: 0 var(--gutter);
  background: color-mix(in srgb, var(--canvas) 86%, transparent); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2); box-shadow: 0 1px 0 var(--line); }
.top-row { display: flex; align-items: center; gap: 10px; height: var(--top-h); }
.flex1 { flex: 1 1 auto; min-width: 0; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; flex: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--ink); flex: none; display: grid; place-items: center; }
.brand-mark svg { width: 18px; height: 18px; }
.brand-t { font-family: var(--display); font-size: 15px; font-weight: 500; letter-spacing: -.02em; white-space: nowrap; }
.district { all: unset; box-sizing: border-box; display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px;
  border-radius: var(--r-btn); box-shadow: inset 0 0 0 1px var(--line-strong); font-size: 12.5px; font-weight: 520; color: var(--body);
  white-space: nowrap; flex: none; }
button.district { cursor: pointer; transition: background-color var(--dur-1) var(--ease-out); }
button.district:hover { background: var(--hover); }
button.district:focus-visible { box-shadow: var(--ring); }
.nav { position: relative; display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 11px; background: var(--nav-bg); margin-left: 4px; }
.nav a { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px;
  border-radius: var(--r-seg); white-space: nowrap; font-size: 13.5px; font-weight: 520; color: var(--mute); text-decoration: none;
  transition: color var(--dur-1) var(--ease-out); }
.nav a:hover, .nav a[aria-current=page] { color: var(--ink); }
.nav-n { font-size: 12px; font-weight: 600; padding: 1px 6px; border-radius: 6px; background: color-mix(in srgb, var(--ink) 9%, transparent);
  color: var(--body); font-variant-numeric: tabular-nums; }
.nav-n.crit { background: var(--crit-bg); color: var(--crit); }
.nav-n:empty { display: none; }
.nav-gap { width: 1px; height: 16px; margin: 0 4px; background: color-mix(in srgb, var(--ink) 14%, transparent); }
.nav-ind { position: absolute; z-index: 0; top: 3px; left: 0; height: 30px; border-radius: var(--r-seg); background: var(--nav-on);
  box-shadow: var(--nav-on-sh); opacity: 0; pointer-events: none;
  transition: transform var(--dur-3) var(--spring-nav), width var(--dur-3) var(--spring-glide), opacity var(--dur-1) var(--ease-out); }
.nav-ind.on { opacity: 1; }
.find { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 10px; height: 36px; width: clamp(160px, 18vw, 260px);
  flex: 0 1 auto; min-width: 120px; padding: 0 6px 0 12px; border-radius: 10px; background: var(--surface); box-shadow: var(--sh-1);
  color: var(--mute); cursor: text; font-size: 13.5px;
  transition: box-shadow var(--dur-2) var(--ease-out), transform var(--dur-2) var(--spring-snap); }
.find:hover { color: var(--body); box-shadow: var(--sh-1), 0 0 0 4px color-mix(in srgb, var(--ink) 5%, transparent); }
.find:active { transform: scale(.99); }
.find:focus-visible { box-shadow: var(--ring); }
.find-t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kbd { font-family: var(--font); font-size: 12px; font-weight: 600; color: var(--mute); background: var(--canvas); border-radius: 5px;
  padding: 2px 6px; box-shadow: inset 0 -1px 0 var(--line-strong), inset 0 0 0 1px var(--line); }
.ic-btn { all: unset; box-sizing: border-box; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px;
  color: var(--ink); cursor: pointer; flex: none;
  transition: background-color var(--dur-1) var(--ease-out), transform var(--dur-2) var(--spring-snap); }
.ic-btn:hover { background: var(--hover); }
.ic-btn:active { transform: scale(.92); }
.ic-btn:focus-visible { box-shadow: var(--ring); }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ava { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 650;
  background: var(--ink); color: var(--on-ink); box-shadow: 0 0 0 2px var(--canvas), 0 0 0 3px var(--line-strong); }
.wrap-rel { position: relative; display: inline-flex; }

/* пульс системы: ЦККБ · MAX · Рассылка · Расписание */
.pulse { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 9px; height: 36px; padding: 0 12px 0 11px;
  border-radius: 10px; cursor: pointer; flex: none;
  transition: background-color var(--dur-1) var(--ease-out), transform var(--dur-2) var(--spring-snap); }
.pulse:hover { background: var(--hover); }
.pulse:active { transform: scale(.97); }
.pulse:focus-visible { box-shadow: var(--ring); }
.pulse-seg { display: flex; gap: 3px; align-items: center; height: 20px; }
.pulse-seg i { width: 5px; height: 16px; border-radius: 2px; background: var(--line-control);
  transition: transform var(--dur-3) var(--spring-snap), background-color var(--dur-3) var(--ease-out); }
.pulse-seg i.ok { background: var(--ok-x); }
.pulse-seg i.warn { background: var(--warn-x); }
.pulse-seg i.stop { background: var(--crit-x); transform: scaleY(1.25); box-shadow: 0 0 0 3px color-mix(in srgb, var(--crit-x) 18%, transparent); }
.pulse-t { font-size: 12.5px; font-weight: 560; color: var(--ink); white-space: nowrap; }
.pulse.stop .pulse-t { color: var(--crit); }
.pulse.warn .pulse-t { color: var(--warn); }

/* всплывающие: меню, окно пульса */
.pop { position: fixed; z-index: 70; width: min(440px, calc(100vw - 16px)); padding: 6px; border-radius: 18px; background: var(--pop-bg);
  box-shadow: var(--sh-3); color: var(--body); transform-origin: 80% 0; }
.pop.in { animation: grow var(--dur-3) var(--ease-enter); }
.pop-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 12px 14px 8px; }
.pop-h b { font-size: 15px; font-weight: 600; letter-spacing: -.015em; }
.pop-at { font-family: var(--mono); font-size: 12px; color: var(--mute); }
.menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 60; margin: 0; padding: 6px; min-width: 220px; list-style: none;
  background: var(--pop-bg); border-radius: 14px; box-shadow: var(--sh-3); display: grid; gap: 2px; transform-origin: 80% 0; }
.menu.left { left: 0; right: auto; transform-origin: 20% 0; }
.menu.in { animation: grow var(--dur-2) var(--ease-enter); }
.menu :is(a, button) { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px;
  border-radius: 8px; color: var(--ink); font-weight: 500; font-size: 13.5px; cursor: pointer; white-space: nowrap; }
.menu :is(a, button):hover, .menu :is(a, button):focus-visible { background: var(--hover); box-shadow: none; }
.menu [aria-current=true] { background: var(--surface-2); }
.menu-h { display: grid; gap: 2px; padding: 8px 12px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-h span { font-size: 12px; color: var(--mute); }
.menu form { display: contents; }

/* строки состояния (окно пульса, лист «Ещё», Настройки) */
.sr-list { display: grid; }
.sr-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 6px 10px; align-items: center; padding: 10px; }
.sr-row + .sr-row { box-shadow: inset 0 1px 0 var(--line); }
.sr-row b { font-size: 13.5px; font-weight: 560; white-space: nowrap; }
.sr-v { font-size: 12.5px; color: var(--mute); text-align: right; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; }
.sr-row.stop .sr-v { color: var(--crit); font-weight: 560; }
.sr-row.warn .sr-v { color: var(--warn); font-weight: 520; }
.sr-d { grid-column: 2 / -1; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--body); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-control); display: inline-block; flex: none; position: relative; }
.dot.ok { background: var(--ok-x); } .dot.warn { background: var(--warn-x); } .dot.stop { background: var(--crit-x); }
/* кольцо-«пинг» — только у состояния «стоит» (эталон §3) */
.dot.stop::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1.5px solid var(--crit-x);
  animation: stop-ping 2.2s var(--ease-out) infinite; }
@keyframes stop-ping { 0% { transform: scale(.6); opacity: .9; } 100% { transform: scale(1.9); opacity: 0; } }

/* телефон: нижняя панель и лист «Ещё» */
.tabbar { display: none; }
.sheet { border: 0; padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px)); margin: auto 0 0; width: 100%; max-width: 100%;
  max-height: 88vh; overflow: auto; border-radius: 22px 22px 0 0; background: var(--pop-bg); color: var(--body); box-shadow: var(--sh-3); }
.sheet[open] { animation: sheet-in var(--dur-3) var(--ease-enter); }
.sheet::backdrop { background: var(--scrim); }
@keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sheet-h b { font-family: var(--display); font-weight: 500; font-size: 17px; letter-spacing: -.02em; }
.sheet-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 18px; }
.sheet-a { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 48px; padding: 0 14px; border-radius: 12px;
  background: var(--surface); color: var(--ink); font-weight: 560; text-decoration: none; box-shadow: var(--sh-1); }
.sheet-a[aria-current=page] { background: var(--ink); color: var(--on-ink); }
.sheet-k { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); margin: 0 4px 4px; }
.sheet-f { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin-top: 16px; flex-wrap: wrap; }
.sheet-f form { display: contents; }

/* ── 6. компоненты ─────────────────────────────────────────────────────── */
.page { padding: calc(var(--top-h) + 4px) var(--gutter) var(--s7); max-width: 1680px; margin: 0 auto; view-transition-name: main; }
.head { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; margin: clamp(22px, 3.2vw, 40px) 0 var(--s5); min-height: 40px; }
.title { font-family: var(--display); font-size: clamp(26px, 2.4vw, 34px); line-height: 1.1; font-weight: 500; letter-spacing: -.035em;
  white-space: nowrap; view-transition-name: title; }
.head-sub { font-size: 13.5px; color: var(--mute); }
.head-act { margin-left: auto; display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.h-block { font-size: 15px; font-weight: 600; letter-spacing: -.015em; line-height: 22px; }
.k { font-size: 12px; line-height: 16px; color: var(--mute); }
.def { font-size: 13px; color: var(--mute); }

/* поверхности: панель 20, лист 14 */
.panel { background: var(--surface); border-radius: var(--r-panel); box-shadow: var(--sh-1); padding: var(--s5); min-width: 0; }
.panel-h { display: flex; align-items: baseline; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s4); }
.panel-h .k { margin-left: auto; }

/* кнопки: одна высота 40, радиус 8 у рабочих; таблетка — только у главного действия экрана */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border: 0;
  border-radius: var(--r-btn); font-size: 14px; font-weight: 550; line-height: 1; letter-spacing: -.005em; white-space: nowrap;
  text-decoration: none; cursor: pointer; position: relative; background: var(--surface-2); color: var(--ink);
  transition: background-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out), transform var(--dur-2) var(--spring-snap),
    opacity var(--dur-1) var(--ease-out); }
.btn:hover:not(:disabled) { background: color-mix(in srgb, var(--ink) 12%, var(--surface-2)); }
.panel .btn:not(.pri):not(.dng):not(.ghost) { background: var(--canvas); }
.panel .btn:not(.pri):not(.dng):not(.ghost):hover:not(:disabled) { background: var(--hover); }
.btn.pri { background: var(--ink); color: var(--on-ink); }
.btn.pri:hover:not(:disabled) { background: color-mix(in srgb, var(--ink) 82%, var(--canvas)); }
.btn.main { border-radius: var(--r-pill); }
.btn.dng { background: var(--crit); color: var(--on-crit); }
.btn.ghost { background: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--hover); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn .ic { width: 16px; height: 16px; }
.btn:active:not(:disabled) { transform: scale(.965); }
.btn[aria-busy=true] { color: transparent; pointer-events: none; }
.btn[aria-busy=true] > * { opacity: 0; }
.btn[aria-busy=true]::after { content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--mute); border-top-color: transparent; animation: spin .7s linear infinite; }
.btn.pri[aria-busy=true]::after { border-color: var(--on-ink); border-top-color: transparent; }
@keyframes spin { to { transform: rotate(1turn); } }
.btn.is-done { background: var(--ok); color: #fff; }
.btn.is-err { background: var(--crit); color: var(--on-crit); }
:is(button, .btn):disabled, [aria-disabled=true] { cursor: not-allowed; opacity: .42; }
.btn-n { font-variant-numeric: tabular-nums; font-weight: 650; }
.link { all: unset; display: inline-flex; align-items: center; gap: 4px; color: var(--ink); font-size: 13.5px; font-weight: 500; cursor: pointer;
  text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px;
  transition: text-decoration-color var(--dur-1) var(--ease-out); }
.link:hover { text-decoration-color: currentColor; }
.link:focus-visible { box-shadow: var(--ring); border-radius: 4px; }

/* сегменты: дорожка, выбранный — плашка */
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 11px; background: var(--surface-2); position: relative; flex: none; max-width: 100%;
  overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { all: unset; box-sizing: border-box; position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 6px; height: 30px;
  padding: 0 12px; border-radius: var(--r-seg); font-size: 13px; font-weight: 520; color: var(--mute); white-space: nowrap; cursor: pointer;
  transition: color var(--dur-1) var(--ease-out), background-color var(--dur-2) var(--ease-out), transform var(--dur-2) var(--spring-snap); }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed=true] { color: var(--ink); background: var(--surface); box-shadow: 0 1px 2px rgb(0 0 0 / .08), 0 0 0 1px rgb(0 0 0 / .03); }
:root[data-ui=dark] .seg button[aria-pressed=true] { background: var(--hover); box-shadow: inset 0 1px 0 rgb(255 255 255 / .06); }
.seg button:active { transform: scale(.965); }
.seg button:focus-visible { box-shadow: var(--ring); }
.seg .c { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--mute); }
.seg button[aria-pressed=true] .c { color: var(--ink); }
.seg .c.crit { color: var(--crit); }

/* чипы-фильтры: 32, контур */
.chip { all: unset; box-sizing: border-box; display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: var(--r-btn);
  box-shadow: inset 0 0 0 1px var(--line-strong); font-size: 13px; font-weight: 520; color: var(--body); cursor: pointer; white-space: nowrap;
  transition: background-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out), transform var(--dur-2) var(--spring-snap); }
.chip:hover { background: var(--hover); color: var(--ink); }
.chip[aria-pressed=true] { background: var(--ink); color: var(--on-ink); box-shadow: none; }
.chip:active { transform: scale(.965); }
.chip:focus-visible { box-shadow: var(--ring); }
.chip .c { font-variant-numeric: tabular-nums; font-weight: 600; opacity: .8; }
.chip .dot { width: 7px; height: 7px; }

/* поля */
.field { display: grid; gap: 6px; min-width: 0; }
.field > span, .field > label { font-size: 13px; font-weight: 550; color: var(--ink); }
.field small { font-size: 12px; color: var(--mute); }
.inp, .sel { height: 40px; padding: 0 12px; border-radius: var(--r-btn); border: 1px solid transparent; background: var(--field); color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line-control); width: 100%; min-width: 0; font-size: 14px;
  transition: box-shadow var(--dur-1) var(--ease-out), background-color var(--dur-1) var(--ease-out); }
.panel .inp, .panel .sel { background: var(--canvas); }
.inp:hover, .sel:hover { background: var(--hover); }
.inp:focus, .sel:focus { outline: none; background: var(--field); box-shadow: inset 0 0 0 1px var(--ink), var(--ring); }
.inp[aria-invalid=true] { box-shadow: inset 0 0 0 1.5px var(--crit); }
.inp.mono { font-family: var(--mono); font-size: 13.5px; }
textarea.inp { height: auto; min-height: 88px; padding: 10px 12px; line-height: 20px; resize: vertical; }
.sel { appearance: none; padding-right: 34px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--mute) 50%), linear-gradient(135deg, var(--mute) 50%, transparent 50%);
  background-position: calc(100% - 17px) 18px, calc(100% - 12px) 18px; background-size: 5px 5px; background-repeat: no-repeat; }
.search { position: relative; flex: 1 1 260px; min-width: 200px; max-width: 420px; }
.search .ic { position: absolute; left: 12px; top: 11px; color: var(--mute); pointer-events: none; }
.search .inp { padding-left: 38px; }

/* переключатель */
.sw { all: unset; box-sizing: border-box; width: 40px; height: 24px; border-radius: 999px; background: var(--line-strong); position: relative;
  cursor: pointer; flex: none; transition: background-color var(--dur-2) var(--ease-out); }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface);
  box-shadow: 0 1px 3px rgb(0 0 0 / .3); transition: transform var(--dur-3) var(--spring-snap); }
.sw[aria-checked=true] { background: var(--ink); }
.sw[aria-checked=true]::after { transform: translateX(16px); background: var(--on-ink); }
.sw:focus-visible { box-shadow: var(--ring); }
.sw-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); min-height: 40px; }
.sw-row > span { display: grid; gap: 2px; }
.sw-row > span b { font-size: 14px; font-weight: 550; }

/* метки: маленькие, одного размера */
.tag { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 600;
  line-height: 1; white-space: nowrap; background: var(--surface-2); color: var(--ink); }
.tag.crit { background: var(--crit-bg); color: var(--crit); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.line { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--body); }
.st { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; font-size: 13px; font-weight: 520; color: var(--body); }
.st::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--line-control); flex: none; }
.st.crit { color: var(--crit); } .st.crit::before { background: var(--crit-x); }
.st.warn { color: var(--warn); } .st.warn::before { background: var(--warn-x); }
.st.ok::before { background: var(--ok-x); }

/* плашки сообщений */
.note { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; background: var(--surface); border-radius: var(--r-sheet);
  padding: 12px 16px; font-size: 13.5px; line-height: 20px; color: var(--body); box-shadow: var(--sh-1); }
.note::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--line-control); flex: none; }
.note.warn { background: var(--warn-bg); box-shadow: none; color: var(--ink); } .note.warn::before { background: var(--warn); }
.note.crit { background: var(--crit-bg); box-shadow: none; color: var(--ink); } .note.crit::before { background: var(--crit); }
.note .btn { margin-left: auto; }
/* текст сжимается рядом с точкой, а не переносится под неё; кнопки при нехватке места — строкой ниже */
.note > span:first-child { flex: 1 1 180px; min-width: 0; }
@media (max-width: 600px) { .note::before { align-self: flex-start; margin-top: 6px; } }
.notes { display: grid; gap: var(--s2); }
.notes:empty { display: none; }

/* таблицы */
.tbl-wrap { overflow-x: auto; border-radius: var(--r-sheet); }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.tbl th { position: sticky; top: 0; z-index: 1; background: var(--surface); text-align: left; font-size: 12px; font-weight: 600; color: var(--mute);
  padding: 10px 12px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.tbl td { padding: 0 12px; height: 48px; border-bottom: 1px solid var(--line); color: var(--body); vertical-align: middle; }
.tbl td.n, .tbl th.n { text-align: right; font-variant-numeric: tabular-nums; }
.tbl td.id { font-family: var(--mono); font-size: 13px; color: var(--ink); white-space: nowrap; }
.tbl td b { font-weight: 560; }
.tbl tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--ink) 2.5%, transparent); }
.tbl tbody tr:hover td { background: var(--hover); }
.tbl tr.total td { font-weight: 650; color: var(--ink); background: var(--surface-2) !important; border-bottom: 0; }
.tbl .ell { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* окна — растут из кнопки (motion.js), Escape возвращает фокус */
.dlg { border: 0; padding: 0; border-radius: var(--r-panel); background: var(--canvas); color: var(--body); box-shadow: var(--sh-3);
  width: min(560px, calc(100vw - 24px)); max-height: min(88vh, 920px); }
.dlg.wide { width: min(880px, calc(100vw - 24px)); }
.dlg[open] { display: flex; flex-direction: column; overflow: hidden; animation: pop-in var(--dur-3) var(--ease-enter); }
.dlg[open].morph { animation: none; }
.dlg::backdrop { background: var(--scrim); animation: fade-in var(--dur-3) var(--ease-out); }
.dlg > header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s4); padding: 24px 28px 8px; flex: none; }
.dlg > header h2 { font-family: var(--display); font-size: 21px; font-weight: 500; letter-spacing: -.035em; line-height: 1.2; }
.dlg > header p { margin-top: 6px; font-size: 13.5px; color: var(--mute); }
.dlg .dlg-b { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 8px 28px 8px; }
.dlg > footer { display: flex; gap: var(--s2); justify-content: flex-end; flex-wrap: wrap; padding: 16px 28px 24px; flex: none; }
@keyframes pop-in { from { opacity: 0; transform: translateY(14px) scale(.97); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes grow { from { opacity: 0; transform: scale(.86); filter: blur(8px); } to { opacity: 1; transform: none; filter: none; } }

/* тосты — внизу по центру, 5 с */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; justify-items: center;
  width: min(560px, calc(100vw - 24px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 14px; background: var(--inv-bg);
  color: var(--inv-fg); box-shadow: var(--sh-3); font-size: 14px; line-height: 20px; font-weight: 500; animation: rise var(--dur-3) var(--spring-snap); }
.toast.err { background: var(--crit); color: var(--on-crit); }
.toast button { all: unset; cursor: pointer; font-weight: 650; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.toast button:focus-visible { box-shadow: var(--ring); border-radius: 4px; }
.toast.out { animation: sink var(--dur-2) var(--ease-exit) both; }
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes sink { to { opacity: 0; transform: translateY(8px); } }

/* скелетон — форма будущего содержимого */
.skel { display: grid; gap: 14px; padding: 8px 0; }
.skel-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) 80px; gap: 16px; align-items: center; }
.skel i, .skel-row i { display: block; height: 12px; border-radius: 6px;
  background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 40%, var(--surface) 80%) 0 0 / 300% 100%;
  animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -50% 0; } }
.empty { display: grid; justify-items: start; gap: 6px; padding: var(--s6) var(--s5); border-radius: var(--r-panel); background: var(--surface);
  box-shadow: var(--sh-1); }
.empty b { font-size: 15px; font-weight: 600; }
.empty span { color: var(--mute); font-size: 13.5px; }

/* командная палитра ⌘K */
.cmdk { width: min(640px, calc(100vw - 24px)); max-height: min(70vh, 640px); margin: 12vh auto auto; padding: 0; border: 0; border-radius: var(--r-panel);
  background: var(--pop-bg); color: var(--body); box-shadow: var(--sh-3); overflow: hidden; }
.cmdk[open] { display: flex; flex-direction: column; animation: pop-in var(--dur-3) var(--spring-glide); }
.cmdk.morph[open] { animation: none; }
.cmdk::backdrop { background: var(--scrim); }
.cmdk-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.cmdk-in { all: unset; flex: 1; font-size: 18px; color: var(--ink); }
.cmdk-in::placeholder { color: var(--mute); }
.cmdk-in:focus-visible { box-shadow: none; }
.cmdk-list { list-style: none; margin: 0; padding: 8px; overflow: auto; flex: 1; min-height: 0; }
.cmdk-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.cmdk-row[aria-selected=true] { background: var(--hover); }
.cmdk-t { display: grid; min-width: 0; flex: 1; }
.cmdk-t b { font-weight: 600; font-variant-numeric: tabular-nums; }
.cmdk-t small { font-size: 13px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-k { font-size: 12px; color: var(--mute); flex: none; }
.cmdk-empty { padding: 20px 12px; color: var(--mute); }

/* ── 10. телефон и планшет ─────────────────────────────────────────────── */
@media (max-width: 1359px) { .pulse-t { display: none; } }
@media (min-width: 901px) and (max-width: 1279px) {
  .top-row { gap: 8px; }
  .nav a { padding: 0 9px; font-size: 13px; }
  .district, .find-t, .find .kbd { display: none; }
  .find { width: auto; min-width: 0; padding: 0 10px; }
}
@media (max-width: 900px) {
  :root { --top-h: 56px; --gutter: 14px; }
  body { font-size: 15px; line-height: 22px; }
  .top { padding: 0 12px; }
  .top-row { gap: 8px; }
  .nav, .user-wrap, .brand-t { display: none; }
  .district { max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }
  .find { width: 44px; min-width: 44px; height: 44px; padding: 0; justify-content: center; flex: none; }
  .find-t, .find .kbd { display: none; }
  .ic-btn { width: 44px; height: 44px; }
  .pulse { height: 44px; padding: 0 10px; }
  .pop { left: 8px !important; right: 8px; width: auto; }
  .page { padding-bottom: calc(var(--tab-h) + 24px + env(safe-area-inset-bottom, 0px)); }
  .head { margin: var(--s4) 0 var(--s4); }
  .title { font-size: 24px; }
  .panel { padding: var(--s4); border-radius: var(--r-sheet); }
  .btn { min-height: 44px; }
  .btn.sm { min-height: 40px; }
  .chip { height: 40px; }
  .seg button { height: 40px; }
  :is(.inp, .sel) { font-size: 16px; height: 44px; }
  .toasts { bottom: calc(var(--tab-h) + 12px + env(safe-area-inset-bottom, 0px)); }
  .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px;
    height: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px)); padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    background: color-mix(in srgb, var(--canvas) 90%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    box-shadow: 0 -1px 0 var(--line); }
  .tabbar :is(a, button) { all: unset; box-sizing: border-box; position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 3px; min-height: 52px; border-radius: 12px; color: var(--mute); font-size: 12px; font-weight: 560; cursor: pointer;
    transition: color var(--dur-2) var(--ease-out), transform var(--dur-2) var(--spring-snap); }
  .tabbar :is(a, button):active { transform: scale(.92); }
  .tabbar [aria-current=page] { color: var(--ink); }
  .tabbar :is(a, button):focus-visible { box-shadow: var(--ring); }
  .tabbar .ic { width: 20px; height: 20px; }
  .tab-n { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--crit);
    color: var(--on-crit); font-size: 12px; font-weight: 700; line-height: 16px; text-align: center; font-variant-numeric: tabular-nums; }
  .tab-n:empty { display: none; }
  .tab-ind { position: absolute; z-index: 0; left: 0; top: 6px; height: 52px; border-radius: 12px; background: var(--nav-on); box-shadow: var(--nav-on-sh);
    pointer-events: none; opacity: 0;
    transition: transform var(--dur-4) var(--spring-nav), width var(--dur-3) var(--spring-glide), opacity var(--dur-1) var(--ease-out); }
  .tab-ind.on { opacity: 1; }
  :root[data-ui=light] .tab-ind { background: var(--surface); }
}

/* ── 11. движение ──────────────────────────────────────────────────────── */
::view-transition-old(root), ::view-transition-new(root) { animation: none; }
::view-transition-old(main) { animation: vt-out 160ms var(--ease-exit) both; }
::view-transition-new(main) { animation: vt-in 520ms var(--ease-enter) both; }
::view-transition-old(title) { animation: fade-out 180ms var(--ease-in) both; }
::view-transition-new(title) { animation: title-in 520ms var(--spring-glide) both; }
@keyframes vt-out { to { opacity: 0; filter: blur(6px); transform: translateY(-8px); } }
@keyframes vt-in { from { opacity: 0; clip-path: inset(0 0 100% 0); transform: translateY(24px); filter: blur(4px); }
  to { opacity: 1; clip-path: inset(0); transform: none; filter: none; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes title-in { from { opacity: 0; clip-path: inset(0 100% 0 0); } to { opacity: 1; clip-path: inset(0); } }
.reveal { animation: reveal var(--dur-4) var(--spring-glide) both; }
@keyframes reveal { from { opacity: 0; transform: translateY(10px); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  .skel i, .skel-row i { animation: none !important; background: var(--surface-2); }
}
