/* Дизайн-система панели «Курьеры»: строгий графит, один акцент (кобальт), шрифт Onest.
   Токены в :root; тёмная тема по системной настройке (или data-theme на <html>).
   Каркас: слева боковое меню, на телефоне (<900 px) верхняя полоса и нижние вкладки. */

/* ---------- шрифт Onest (SIL OFL 1.1, пакет @fontsource/onest 5.2.11) ---------- */
@font-face { font-family: "Onest"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/static/fonts/onest-cyrillic-400-normal.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 500; font-display: swap;
  src: url(/static/fonts/onest-cyrillic-500-normal.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 600; font-display: swap;
  src: url(/static/fonts/onest-cyrillic-600-normal.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 700; font-display: swap;
  src: url(/static/fonts/onest-cyrillic-700-normal.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/static/fonts/onest-latin-400-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 500; font-display: swap;
  src: url(/static/fonts/onest-latin-500-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 600; font-display: swap;
  src: url(/static/fonts/onest-latin-600-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 700; font-display: swap;
  src: url(/static/fonts/onest-latin-700-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ---------- токены ---------- */
:root {
  color-scheme: light;
  --bg: #F7F7F8;
  --surface: #FFFFFF;
  --surface-2: #F4F4F5;          /* заливки: hover, поля таблиц */
  --text: #18181B;
  --text-2: #52525B;             /* вторичный, 7.7:1 на белом */
  --muted: #71717A;              /* третичный, 4.8:1 на белом */
  --line: #E4E4E7;
  --line-strong: #D4D4D8;
  --ink: #18181B;                /* основные кнопки */
  --ink-hover: #3F3F46;
  --on-ink: #FFFFFF;
  --accent: #2F5BEA;
  --accent-hover: #2449C7;
  --accent-soft: #EEF2FE;
  --accent-text: #2449C7;
  --ok: #15803D;   --ok-bg: #EDF9F1;   --ok-line: #BFE6CC;
  --warn: #A15C07; --warn-bg: #FEF6E6; --warn-line: #F6D9A8;
  --err: #B42318;  --err-bg: #FEF1F0;  --err-line: #F7C9C4;
  --shadow-sm: 0 1px 2px rgba(24, 24, 27, .05);
  --shadow-md: 0 1px 2px rgba(24, 24, 27, .04), 0 4px 16px -4px rgba(24, 24, 27, .08);
  --shadow-lg: 0 12px 40px -8px rgba(24, 24, 27, .22);
  --r-card: 12px;
  --r-ctl: 8px;
  --sidebar-w: 248px;
  --ease: cubic-bezier(.2, .6, .2, 1);
  --t: 160ms;
  --font: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* старые имена, на которых держатся стили разделов */
  --card: var(--surface);
  --info: var(--accent-text);
  --info-bg: var(--accent-soft);
  --radius: var(--r-card);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0E0E10; --surface: #17171A; --surface-2: #1F1F23;
    --text: #F4F4F5; --text-2: #B4B4BB; --muted: #8E8E97;
    --line: #27272A; --line-strong: #3F3F46;
    --ink: #F4F4F5; --ink-hover: #D4D4D8; --on-ink: #18181B;
    --accent: #7B9BFF; --accent-hover: #9DB4FF; --accent-soft: rgba(123, 155, 255, .13); --accent-text: #9DB4FF;
    --ok: #6EDB98;   --ok-bg: rgba(74, 222, 128, .10);  --ok-line: rgba(74, 222, 128, .28);
    --warn: #F3C062; --warn-bg: rgba(245, 180, 60, .11); --warn-line: rgba(245, 180, 60, .30);
    --err: #FF9A8F;  --err-bg: rgba(248, 113, 113, .11); --err-line: rgba(248, 113, 113, .30);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 1px 2px rgba(0, 0, 0, .35), 0 6px 20px -6px rgba(0, 0, 0, .5);
    --shadow-lg: 0 16px 48px -8px rgba(0, 0, 0, .7);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0E0E10; --surface: #17171A; --surface-2: #1F1F23;
  --text: #F4F4F5; --text-2: #B4B4BB; --muted: #8E8E97;
  --line: #27272A; --line-strong: #3F3F46;
  --ink: #F4F4F5; --ink-hover: #D4D4D8; --on-ink: #18181B;
  --accent: #7B9BFF; --accent-hover: #9DB4FF; --accent-soft: rgba(123, 155, 255, .13); --accent-text: #9DB4FF;
  --ok: #6EDB98;   --ok-bg: rgba(74, 222, 128, .10);  --ok-line: rgba(74, 222, 128, .28);
  --warn: #F3C062; --warn-bg: rgba(245, 180, 60, .11); --warn-line: rgba(245, 180, 60, .30);
  --err: #FF9A8F;  --err-bg: rgba(248, 113, 113, .11); --err-line: rgba(248, 113, 113, .30);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, .35), 0 6px 20px -6px rgba(0, 0, 0, .5);
  --shadow-lg: 0 16px 48px -8px rgba(0, 0, 0, .7);
}

/* ---------- основа ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: anywhere;
}
img, svg, video, canvas, iframe { max-width: 100%; }
[hidden] { display: none !important; }
a { color: var(--accent-text); text-decoration: none; transition: color var(--t) var(--ease); }
a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
h1 { font-size: 1.625rem; line-height: 1.25; font-weight: 600; letter-spacing: -.015em; margin: 0 0 16px; }
h2 { font-size: 1.0625rem; line-height: 1.35; font-weight: 600; letter-spacing: -.005em; margin: 0 0 12px; }
h3 { font-size: .9375rem; font-weight: 600; margin: 16px 0 8px; }
p { margin: 0 0 12px; }
b, strong { font-weight: 600; }
small { font-size: .8125rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--accent-soft); }

.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; vertical-align: -4px; }

/* цифры ровными столбцами */
.nav-count, .tab-count, .badge, .diag b { font-variant-numeric: tabular-nums; }

/* ---------- каркас ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 1100;
  width: var(--sidebar-w);
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 20px 12px 12px;
  overflow-y: auto;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 10px 20px; color: var(--text);
  font-size: 1.0625rem; font-weight: 700; letter-spacing: -.01em;
}
.brand:hover { color: var(--text); text-decoration: none; }
.brand-mark {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
  background: var(--ink); color: var(--on-ink);
}
.brand-mark .icon { width: 18px; height: 18px; vertical-align: 0; }
/* фирменный знак: лого компании или первая буква названия в акцентном цвете */
.brand-mark.is-mono, .mobile-bar .brand-mark.is-mono:hover { background: var(--accent); color: #fff; font-weight: 700; font-size: 1rem; line-height: 1; }
.brand-mark.has-logo { background: transparent; overflow: hidden; }
.brand-mark img { display: block; width: 100%; height: 100%; object-fit: contain; }
.brand { min-width: 0; }
.brand-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-link { display: inline-flex; flex: none; }
.brand-link:hover { text-decoration: none; }
.side-nav { display: flex; flex-direction: column; gap: 20px; flex: 1; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group-bottom { margin-top: auto; }
.nav-heading {
  margin: 0 0 4px; padding: 0 10px;
  font-size: .75rem; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
}
.nav-link {
  display: flex; align-items: center; gap: 10px;
  min-height: 38px; padding: 7px 10px; border-radius: var(--r-ctl);
  color: var(--text-2); font-weight: 500;
  transition: background-color var(--t) var(--ease), color var(--t) var(--ease);
}
.nav-link .icon { color: var(--muted); transition: color var(--t) var(--ease); }
.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link:hover .icon { color: var(--text); }
.nav-link.active { background: var(--accent-soft); color: var(--accent-text); }
.nav-link.active .icon { color: var(--accent); }
.nav-label { flex: 1; min-width: 0; }
.nav-count {
  min-width: 22px; padding: 1px 7px; border-radius: 999px; text-align: center;
  background: var(--accent); color: #fff; font-size: .75rem; font-weight: 600; line-height: 18px;
}
.nav-count.is-zero, .tab-count.is-zero { display: none; }

.side-profile {
  display: flex; align-items: center; gap: 4px;
  margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line);
}
.profile-link {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px;
  padding: 6px 8px; border-radius: var(--r-ctl); color: var(--text);
}
.profile-link:hover, .profile-link.active { background: var(--surface-2); color: var(--text); text-decoration: none; }
.profile-name { display: flex; flex-direction: column; min-width: 0; font-weight: 500; line-height: 1.3; }
.profile-name small { color: var(--muted); font-weight: 400; font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar {
  flex: none; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2);
  font-weight: 600; font-size: .8125rem;
}
.logout-form { margin: 0; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-ctl);
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  transition: background-color var(--t) var(--ease), color var(--t) var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .icon { vertical-align: 0; }

.shell-main { min-width: 0; }
.with-shell .shell-main { margin-left: var(--sidebar-w); }
.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 28px 40px 56px; }
.no-shell .container { max-width: 480px; padding-top: 10vh; }

.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-bottom: 8px; font-size: .8125rem; color: var(--muted); }
.crumbs .icon { width: 14px; height: 14px; vertical-align: 0; }
.crumbs a { color: var(--text-2); }

.page-title { margin-bottom: 24px; }
.page-title h1 { margin-bottom: 4px; }
.page-hint { color: var(--text-2); margin: -10px 0 20px; max-width: 90ch; }
.page-title .page-hint { margin: 0; }

.mobile-bar, .tabbar, .scrim { display: none; }

@media (max-width: 899px) {
  .with-shell .shell-main { margin-left: 0; }
  .container { padding: 20px 16px calc(96px + env(safe-area-inset-bottom)); }
  .no-shell .container { padding-top: 6vh; }
  .sidebar {
    width: min(300px, 86vw); transform: translateX(-102%); visibility: hidden;
    box-shadow: var(--shadow-lg);
    transition: transform 200ms var(--ease), visibility 0s linear 200ms;
  }
  .nav-open .sidebar { transform: none; visibility: visible; transition: transform 200ms var(--ease); }
  .nav-open .scrim:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 1050; background: rgba(9, 9, 11, .45); }
  .nav-link { min-height: 44px; }

  .mobile-bar {
    position: sticky; top: 0; z-index: 1000;
    display: flex; align-items: center; gap: 12px;
    height: 56px; padding: 0 16px;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
    border-bottom: 1px solid var(--line);
  }
  .mobile-bar .brand-mark { width: 30px; height: 30px; }
  .mobile-bar .brand-mark:hover { color: var(--on-ink); }
  .mobile-title { font-weight: 600; font-size: 1.0625rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .tabbar {
    position: fixed; inset: auto 0 0 0; z-index: 1000;
    display: grid; grid-template-columns: repeat(5, 1fr);
    padding: 4px 4px env(safe-area-inset-bottom);
    background: var(--surface); border-top: 1px solid var(--line);
  }
  .tab {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: 56px; padding: 6px 2px; border: 0; background: none; border-radius: var(--r-ctl);
    color: var(--muted); font: 500 .6875rem/1.2 var(--font); cursor: pointer;
  }
  .tab .icon { width: 22px; height: 22px; vertical-align: 0; }
  .tab:hover { color: var(--text); text-decoration: none; }
  .tab.active, .nav-open .tab[data-nav-toggle] { color: var(--accent-text); }
  .tab-count {
    position: absolute; top: 4px; left: calc(50% + 6px);
    min-width: 18px; padding: 0 5px; border-radius: 999px;
    background: var(--accent); color: #fff; font-size: .6875rem; line-height: 18px; text-align: center;
    box-shadow: 0 0 0 2px var(--surface);
  }
  h1 { font-size: 1.375rem; }
  .crumbs { display: none; }
}

/* ---------- карточки и раскладка ---------- */
.card, .panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
  padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow-sm);
}
.card > h2:first-child, .panel > h2:first-child { margin-top: 0; }
.card.narrow { max-width: 440px; margin: 24px auto; padding: 28px; box-shadow: var(--shadow-md); }
.muted { color: var(--muted); }
p.card.muted { color: var(--text-2); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.grid > .card { margin-bottom: 0; }
.top-gap { margin-top: 16px; }

/* ---------- flash ---------- */
.flash {
  border-radius: var(--r-ctl); padding: 11px 14px; margin-bottom: 16px;
  border: 1px solid transparent; font-weight: 500;
}
.flash-ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.flash-error { background: var(--err-bg); color: var(--err); border-color: var(--err-line); }
.flash-info { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }

/* ---------- формы ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: .875rem; color: var(--text-2); }
input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea {
  width: 100%; max-width: 100%; min-height: 40px;
  font: inherit; font-size: .9375rem; color: var(--text);
  padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-ctl);
  background: var(--surface);
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
input[type=file] { padding: 6px 8px; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6l6 -6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
::placeholder { color: var(--muted); opacity: 1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 8px 14px;
  font: 500 .9375rem/1.2 var(--font); cursor: pointer; text-align: center; text-decoration: none;
  border-radius: var(--r-ctl); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: background-color var(--t) var(--ease), border-color var(--t) var(--ease), color var(--t) var(--ease);
}
.btn .icon { width: 18px; height: 18px; vertical-align: 0; }
.btn:hover { background: var(--surface-2); border-color: var(--line-strong); color: var(--text); text-decoration: none; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.btn.primary:hover { background: var(--ink-hover); border-color: var(--ink-hover); color: var(--on-ink); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: var(--err); border-color: var(--line-strong); }
.btn.danger:hover { background: var(--err-bg); border-color: var(--err-line); color: var(--err); }
.btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- таблицы: на телефоне — карточки ---------- */
.table-wrap { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.card .table-wrap { border: 0; border-radius: 0; box-shadow: none; margin: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: .75rem; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background-color var(--t) var(--ease); }
tbody tr:hover { background: var(--surface-2); }
td { overflow-wrap: anywhere; }
@media (max-width: 700px) {
  .table-wrap { background: transparent; border: 0; box-shadow: none; overflow: visible; }
  table.cards thead { display: none; }
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; }
  table.cards tr { border: 1px solid var(--line); border-radius: var(--r-card); margin-bottom: 10px; background: var(--surface); padding: 8px 0; box-shadow: var(--shadow-sm); }
  table.cards tr:hover { background: var(--surface); }
  table.cards td { border: 0; padding: 4px 14px; }
  table.cards td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); }
}

/* ---------- общие блоки разделов ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 16px; }
.page-head h1, .page-head h2 { margin: 0; }

.badge, .pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .75rem; font-weight: 500; line-height: 1.5;
  padding: 1px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line);
}
.badge { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.pill-ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }

.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 20px; margin: 0 0 16px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

.field-error { color: var(--err); font-weight: 400; font-size: .875rem; }
[aria-invalid="true"] { border-color: var(--err) !important; }

.inline-form { display: inline; margin: 0; }
.inline-edit { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.inline-edit label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: .875rem; color: var(--text-2); flex: 1 1 200px; }

/* одноразовая ссылка с кнопкой «Скопировать» */
.link-box { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.copy-row { display: flex; flex-wrap: wrap; gap: 8px; }
.copy-row input { flex: 1 1 220px; min-width: 0; width: auto; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .875rem; }

.plain { list-style: none; margin: 0 0 12px; padding: 0; }
.plain li { padding: 6px 0; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.plain-list li:last-child { border-bottom: 0; }

/* прогресс смены */
.shift { padding: 12px 0; border-bottom: 1px solid var(--line); }
.shift:last-child { border-bottom: 0; }
.card.shift { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.shift-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 12px; }
.bar { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 10px 0 8px; box-shadow: inset 0 0 0 1px var(--line); }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

/* раскрывающиеся опасные действия */
details > summary.btn, .danger-zone summary { display: inline-flex; list-style: none; cursor: pointer; }
details > summary.btn::-webkit-details-marker, .danger-zone summary::-webkit-details-marker { display: none; }

/* вкладки (Входящие, диагностика) */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 16px; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; width: fit-content; max-width: 100%; }
.tabs .btn { box-shadow: none; border-color: transparent; background: transparent; color: var(--text-2); min-height: 36px; padding: 6px 12px; }
.tabs .btn:hover { color: var(--text); background: transparent; }
.tabs .btn.active { background: var(--surface); color: var(--text); border-color: var(--line); box-shadow: var(--shadow-sm); }

@media (max-width: 700px) {
  .page-head .btn { width: 100%; }
  .facts { grid-template-columns: 1fr; gap: 2px; }
  .facts dt { margin-top: 8px; }
  .inline-edit .btn { width: 100%; }
  .card, .panel { padding: 16px; }
  .tabs { width: 100%; }
  .tabs .btn { flex: 1 1 auto; }
}
@media (max-width: 899px) {
  .btn, input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select { min-height: 44px; }
}

/* Чекбокс с подписью: вся строка кликабельна, галочка крупнее. */
label.check { flex-direction: row; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; flex: none; accent-color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; }
}

/* ---------- пустые значения и каналы (макросы из _ui.html) ---------- */
.none { color: var(--muted); }
.channels { display: inline-flex; flex-wrap: wrap; gap: 6px; vertical-align: middle; }
.ch {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px 2px 7px; border-radius: 999px; border: 1px solid var(--line);
  font-size: .8125rem; font-weight: 500; line-height: 1.4; color: var(--text-2); background: var(--surface);
  white-space: nowrap;
}
.ch .icon { width: 15px; height: 15px; vertical-align: 0; }
.ch-tg .icon, .ch-max .icon { color: var(--accent); }
.ch-none { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }

/* ---------- кнопка, которая ждёт ответа сервера ---------- */
.btn.is-busy { position: relative; color: transparent !important; pointer-events: none; opacity: 1; }
.btn.is-busy > * { visibility: hidden; }
.btn.is-busy::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--muted) transparent var(--muted) var(--muted);
  animation: spin 700ms linear infinite;
}
.btn.primary.is-busy::after { border-color: var(--on-ink) transparent var(--on-ink) var(--on-ink); }
@keyframes spin { 100% { transform: rotate(360deg); } }

/* ---------- быстрый поиск (Ctrl+K) ---------- */
.search-trigger {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 38px; margin: 0 0 18px; padding: 6px 8px 6px 10px;
  border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--surface-2);
  color: var(--muted); font: 400 .875rem/1.2 var(--font); cursor: pointer; text-align: left;
  transition: border-color var(--t) var(--ease), color var(--t) var(--ease);
}
.search-trigger:hover { border-color: var(--line-strong); color: var(--text-2); }
.search-trigger span { flex: 1; }
kbd {
  font: 500 .6875rem/1 var(--font); color: var(--muted);
  padding: 3px 5px; border-radius: 5px; border: 1px solid var(--line-strong); background: var(--surface);
}
.mobile-search { margin-left: auto; margin-right: -8px; }
.search-dialog {
  width: min(640px, calc(100vw - 32px)); max-height: min(560px, calc(100vh - 120px));
  margin: 12vh auto auto; padding: 0; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
  overflow: hidden; flex-direction: column;
}
.search-dialog[open] { display: flex; }
.search-dialog::backdrop { background: rgba(9, 9, 11, .45); }
.search-box { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--line); }
.search-box > .icon { color: var(--muted); }
.search-box input[type=search] { border: 0 !important; box-shadow: none !important; padding: 8px 0 !important; min-height: 44px; font-size: 1rem !important; background: transparent !important; }
.search-box input[type=search]::-webkit-search-cancel-button { display: none; }
.search-results { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
.search-results:empty { display: none; }
.search-group { padding: 10px 10px 4px; font-size: .75rem; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.search-results a { display: flex; flex-direction: column; padding: 8px 10px; border-radius: var(--r-ctl); color: var(--text); line-height: 1.35; }
.search-results a small { color: var(--muted); }
.search-results a .search-status { color: var(--accent-text); font-size: .8125rem; }
.search-results a:hover, .search-results a.is-active { background: var(--accent-soft); text-decoration: none; color: var(--text); }
.search-hint { margin: 0; padding: 14px 16px; color: var(--muted); font-size: .875rem; }
@media (max-width: 899px) {
  .search-trigger { display: none; }
  .search-dialog { margin-top: 8px; max-height: calc(100vh - 16px); }
}

/* ---------- общие мелочи разделов ---------- */
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }
.panel-hint { color: var(--text-2); font-size: .9375rem; margin: -4px 0 14px; max-width: 70ch; }
.field-hint { color: var(--muted); font-weight: 400; font-size: .8125rem; }
.small-note { font-size: .8125rem; margin: 8px 0 0; }
.optional { color: var(--muted); font-weight: 400; }
.form-row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.form.compact { gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack form { margin: 0; }
.btn.wide { width: 100%; }
.av-lg { width: 40px; height: 40px; font-size: .9375rem; }
.av-xl { width: 52px; height: 52px; font-size: 1.125rem; }
.pill-accent { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }

/* индикатор состояния: цветная точка и слово */
.ind { display: inline-flex; align-items: center; gap: 6px; font-size: .8125rem; font-weight: 500; color: var(--text-2); white-space: nowrap; }
.ind i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.ind-ok { color: var(--ok); } .ind-ok i { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.ind-err { color: var(--err); } .ind-err i { background: var(--err); box-shadow: 0 0 0 3px var(--err-bg); }
.ind-warn { color: var(--warn); } .ind-warn i { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.ind-off i { background: var(--line-strong); }

/* пояснение с иконкой */
.callout {
  display: flex; gap: 10px; align-items: flex-start; margin: 0;
  padding: 12px 14px; border-radius: var(--r-ctl);
  background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--text); font-size: .9375rem;
}
.callout .icon { color: var(--warn); margin-top: 2px; vertical-align: 0; }

/* список строк: значок, текст с подписью, действие справа */
.row-list { list-style: none; margin: 0; padding: 0; }
.row-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.row-list li:first-child { border-top: 0; }
.row-list form { margin: 0; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.4; }
.row-main small { color: var(--muted); font-size: .8125rem; }
.row-icon {
  flex: none; display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  background: var(--surface-2); color: var(--text-2);
}
.row-icon .icon { vertical-align: 0; }

/* раскрывающаяся форма за кнопкой */
.fold > summary { list-style: none; }
.fold > summary::-webkit-details-marker { display: none; }
.fold[open] > summary { background: var(--surface-2); }
.fold-form {
  display: flex; flex-direction: column; gap: 10px; margin-top: 10px; padding: 14px;
  border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--surface-2);
}
.fold-form p { margin: 0; }
.fold-form label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: .875rem; color: var(--text-2); }
.fold-form .btn { align-self: flex-start; }
.fold-danger .fold-form { border-color: var(--err-line); background: var(--err-bg); }
.danger-text { color: var(--err) !important; }

/* тёмная подложка карт: тайлы OSM инвертируются, метки остаются цветными */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.88) saturate(.6); }
  :root:not([data-theme="light"]) .leaflet-container { background: #1b1b1e; }
}
:root[data-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.88) saturate(.6); }
:root[data-theme="dark"] .leaflet-container { background: #1b1b1e; }
.leaflet-container .leaflet-control-container .leaflet-control-attribution { background: color-mix(in srgb, var(--surface) 85%, transparent); color: var(--muted); }
.leaflet-container .leaflet-control-container .leaflet-control-attribution a { color: var(--text-2); }
.leaflet-container .leaflet-bar a, .leaflet-container .leaflet-bar a:hover { background-color: var(--surface); color: var(--text); border-color: var(--line); }
.leaflet-container .leaflet-bar { border-color: var(--line); }

/* ---------- подсказка «Установите панель на главный экран» (js/pwa.js) ---------- */
.pwa-hint {
  position: fixed; left: 12px; right: 12px; z-index: 1001;
  bottom: calc(72px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 10px;
  padding: 12px 8px 12px 14px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow-lg);
  animation: pwa-hint-in 220ms var(--ease);
}
.pwa-hint p { margin: 0; flex: 1; font-size: .875rem; line-height: 1.45; color: var(--text-2); }
.pwa-hint p b { color: var(--text); font-weight: 600; }
.pwa-hint .btn { flex: none; }
.pwa-hint-close { flex: none; }
@keyframes pwa-hint-in { 0% { opacity: 0; transform: translateY(8px); } 100% { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .pwa-hint { animation: none; } }
