/* Дашборд аналитики. Цвета — токены по ролям; тёмная тема — свои ступени тех же шкал. */
:root {
  color-scheme: light;
  --page: #f2f4f7;
  --surface: #ffffff;
  --surface-2: #eceff3;
  --text: #111827;
  --text-2: #4b5563;
  --muted: #8a919d;
  --grid: #e5e8ed;
  --axis: #c7ccd4;
  --border: rgba(17, 24, 39, 0.09);
  --wash: rgba(17, 24, 39, 0.045);
  --accent: #2a78d6;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #6250d6; --series-8: #e34948;
  --moving: #1baf7a;
  --idle: #eda100;
  --good: #0ca30c;
  --serious: #ec835a;
  --good-text: #006300;
  --shadow: 0 1px 2px rgba(17, 24, 39, 0.05), 0 2px 6px rgba(17, 24, 39, 0.04);
  --st-moving: #0ca30c; --st-idle: #f0a800; --st-parked: #8a919d; --st-offline: #d03b3b;
  --critical: #d03b3b;
  /* разделы меню по важности (main.js, MENU.tone); текст — не ниже 4,5:1 к фону страницы */
  --tone-alarm: #c42b2b; --tone-risk: #c2410c; --tone-money: #946008; --tone-people: #6d3fd1;
  --tone-work: #1f66c2; --tone-tech: #0b7a63; --tone-service: #5f6672;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --st-moving: #0ca30c; --st-idle: #fab219; --st-parked: #6f6e69; --st-offline: #d03b3b;
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --surface-2: #232322;
    --text: #f0efec; --text-2: #c3c2b7; --muted: #898781;
    --grid: #2c2c2a; --axis: #383835;
    --border: rgba(255, 255, 255, 0.10); --wash: rgba(255, 255, 255, 0.05);
    --accent: #3987e5;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
    --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
    --moving: #199e70; --idle: #c98500;
    --good-text: #0ca30c;
    --shadow: none;
    --tone-alarm: #f26d6d; --tone-risk: #f5924a; --tone-money: #e9b949; --tone-people: #a993f5;
    --tone-work: #5c9ded; --tone-tech: #3cbf98; --tone-service: #9a9891;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --surface-2: #232322;
  --text: #f0efec; --text-2: #c3c2b7; --muted: #898781;
  --grid: #2c2c2a; --axis: #383835;
  --border: rgba(255, 255, 255, 0.10); --wash: rgba(255, 255, 255, 0.05);
  --accent: #3987e5;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
  --moving: #199e70; --idle: #c98500;
  --good-text: #0ca30c;
  --shadow: none;
  --tone-alarm: #f26d6d; --tone-risk: #f5924a; --tone-money: #e9b949; --tone-people: #a993f5;
  --tone-work: #5c9ded; --tone-tech: #3cbf98; --tone-service: #9a9891;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2 { margin: 0; font-weight: 600; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
.sub { margin: 2px 0 0; color: var(--text-2); font-size: 13px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- шапка */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 1000;
}
.brand { font-weight: 600; font-size: 16px; }
.brand-sub { color: var(--muted); font-weight: 400; margin-left: 4px; }
.top-nav { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: flex-end; }
.user { color: var(--text-2); }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* ---------- раскладка: меню слева, страница справа */
.menu-btn {
  display: none; font: inherit; font-size: 18px; line-height: 1; color: var(--text);
  background: none; border: 1px solid var(--border); border-radius: 8px; padding: 5px 9px; cursor: pointer;
}
.layout { display: grid; grid-template-columns: 236px minmax(0, 1fr); align-items: start; }
.no-menu .layout { grid-template-columns: minmax(0, 1fr); }
.no-menu .side, .no-menu .menu-btn { display: none !important; }
.side {
  position: sticky; top: 53px; max-height: calc(100vh - 53px); overflow: auto;
  padding: 16px 10px 24px 12px; display: flex; flex-direction: column; gap: 14px;
}
.side-group { display: flex; flex-direction: column; gap: 1px; }
.side-title { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 0 10px 4px; }
.side a { color: var(--text-2); padding: 6px 10px; border-radius: 7px; }
.side a:hover { background: var(--wash); color: var(--text); text-decoration: none; }
.side a.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 0 0 1px var(--border); }
/* цвет по важности (data-tone): разделы меню и разделы внутри виджетов (.tsec) — точка и название этого цвета,
   содержимое на линии того же цвета */
[data-tone="alarm"] { --tone: var(--tone-alarm); }
[data-tone="risk"] { --tone: var(--tone-risk); }
[data-tone="money"] { --tone: var(--tone-money); }
[data-tone="people"] { --tone: var(--tone-people); }
[data-tone="work"] { --tone: var(--tone-work); }
[data-tone="tech"] { --tone: var(--tone-tech); }
[data-tone="service"] { --tone: var(--tone-service); }
.side .side-title {
  display: flex; align-items: flex-start; gap: 7px; padding: 0 6px 5px;
  color: var(--tone, var(--muted)); font-size: 13px; font-weight: 700; text-transform: none; letter-spacing: 0;
}
/* точка — по первой строке, если длинное название всё же перенесётся */
.side .side-title::before { content: ''; flex: none; width: 8px; height: 8px; margin-top: 5.5px; border-radius: 50%; background: currentColor; }
.side-links {
  display: flex; flex-direction: column; gap: 1px; margin-left: 9px; padding-left: 4px;
  border-left: 2px solid color-mix(in srgb, var(--tone, var(--muted)) 30%, transparent);
}
.side-links a { position: relative; padding-left: 8px; }
.side-links a.active::before {
  content: ''; position: absolute; left: -6px; top: 3px; bottom: 3px; width: 2px; border-radius: 2px; background: var(--tone);
}
main { max-width: 1400px; width: 100%; margin: 0 auto; padding: 20px 24px 8px; min-width: 0; }

/* раздел виджета (1.75.0, core.tsec): как раздел меню — точка и название цвета важности, содержимое на линии;
   первый ребёнок — заголовок h3 */
.tsec { position: relative; padding-left: 18px; margin-top: 22px; min-width: 0; }
.tsec:first-child { margin-top: 6px; }
.tsec::before {
  content: ''; position: absolute; left: 3px; top: 29px; bottom: 2px; width: 2px; border-radius: 2px;
  background: color-mix(in srgb, var(--tone, var(--muted)) 32%, transparent);
}
.tsec > h3:first-child, .card .tsec > h3.nf-group-title:first-child, .lv-sec.tsec > h3:first-child {
  display: flex; align-items: center; gap: 8px; margin: 0 0 8px -18px; color: var(--tone, var(--text));
  font-size: 14.5px; font-weight: 700; line-height: 20px; letter-spacing: 0; text-transform: none;
}
.tsec > h3:first-child::before { content: ''; flex: none; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.tsec > h3:first-child a { color: inherit; }
.lv-secs > .tsec { margin-top: 0; }   /* в сетке — отступы задаёт сетка */
.lb-grid > .tsec { margin-top: 6px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; margin-bottom: 16px; }
.page-head .filters { margin-bottom: 0; }
.page-title-wrap { display: flex; align-items: center; gap: 12px; min-width: 0; }
.nf-scope { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--grid); }
.nf-scope .nf-actions { align-items: center; flex-wrap: wrap; }
/* индикатор загрузки страницы — кольцо рядом с заголовком */
.page-busy { width: 20px; height: 20px; flex: none; border-radius: 50%; border: 2.5px solid var(--border); border-top-color: var(--accent);
  animation: page-busy-spin .8s linear infinite; }
.page-busy[hidden] { display: none; }
@keyframes page-busy-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .page-busy { animation-duration: 2.4s; } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
#page { transition: opacity .15s; }
#page.loading .card, #page.loading .kpis { opacity: .55; }
.banner {
  padding: 10px 14px; margin-bottom: 16px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--serious); color: var(--text);
}

/* ---------- карточки */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.csv { white-space: nowrap; font-size: 13px; padding-top: 2px; }
.card-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.card-actions select { font: inherit; font-size: 13px; color: var(--text); background: var(--surface); border: 1px solid var(--axis); border-radius: 8px; padding: 4px 8px; }
.muted { color: var(--muted); }
.weekend { color: var(--muted); }
.stat-line { display: flex; flex-wrap: wrap; gap: 6px 22px; color: var(--text-2); margin: 0 0 12px; }
.stat-line b { color: var(--text); font-weight: 600; }
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13px; cursor: pointer; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; cursor: pointer; }
.btn { font: inherit; font-size: 13px; color: var(--text); background: var(--surface); border: 1px solid var(--axis); border-radius: 8px; padding: 5px 10px; cursor: pointer; }
.btn:hover { background: var(--wash); }
.more .link-btn { font-size: 12px; }

/* ---------- вход (1.72.0): живая карта (js/login_scene.js) и форма */
.login {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); gap: 28px; align-items: center;
  max-width: 1180px; margin: 8px auto 16px;
}
.login-scene {
  position: relative; height: clamp(440px, calc(100vh - 150px), 640px); border-radius: 22px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); isolation: isolate;
  box-shadow: 0 30px 70px -40px color-mix(in srgb, var(--accent) 55%, transparent);
  animation: lg-in .7s ease-out both;
}
.login-scene canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.login-card {
  position: relative; padding: 30px 28px 26px; border-radius: 22px; background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(17, 24, 39, 0.04);
  animation: lg-in .7s .08s ease-out both;
}
/* рамка — цвета значка: синий → оранжевый */
.login-card::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(150deg, color-mix(in srgb, var(--accent) 75%, transparent), transparent 38%,
    transparent 62%, color-mix(in srgb, var(--series-2) 70%, transparent));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.login-card h1 { font-size: 26px; letter-spacing: -0.01em; }
.login-card .sub { margin-top: 4px; font-size: 13.5px; }
.login-mark { display: flex; align-items: flex-end; gap: 4px; height: 30px; margin-bottom: 18px; }
.login-mark i {
  display: block; width: 8px; border-radius: 2.5px; background: var(--accent); transform-origin: bottom;
  animation: lg-bar 2.4s ease-in-out infinite;
}
.login-mark i:nth-child(1) { height: 14px; }
.login-mark i:nth-child(2) { height: 22px; animation-delay: .25s; }
.login-mark i:nth-child(3) { height: 30px; background: var(--series-2); animation-delay: .5s; }
.login form { display: grid; gap: 14px; margin-top: 22px; }
.lf { display: grid; gap: 6px; color: var(--text-2); font-size: 13px; }
.lf-box { position: relative; display: flex; align-items: center; }
.lf-box > svg, .lf-eye svg {
  width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.lf-box > svg { position: absolute; left: 13px; color: var(--muted); pointer-events: none; transition: color .2s; }
.lf-box:focus-within > svg { color: var(--accent); }
.lf-box input {
  width: 100%; height: 46px; padding: 0 12px 0 41px; font: inherit; font-size: 15px; color: var(--text);
  background: var(--page); border: 1px solid var(--axis); border-radius: 12px; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.lf-box input[type="password"], .lf-box input.shown { padding-right: 46px; }
.lf-box input:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--axis)); }
.lf-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.lf-eye {
  position: absolute; right: 6px; width: 34px; height: 34px; display: grid; place-items: center; padding: 0;
  border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer;
}
.lf-eye:hover { color: var(--text); background: var(--wash); }
.lf-eye.on { color: var(--accent); }
.login-msg { margin: 0; min-height: 1.4em; color: var(--text-2); font-size: 13px; }
.login-msg.err { color: var(--critical); }
button.login-go {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; height: 48px;
  border-radius: 12px; font-size: 15px; overflow: hidden;
  background: linear-gradient(100deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--series-7)));
  box-shadow: 0 12px 26px -14px color-mix(in srgb, var(--accent) 85%, transparent);
  transition: filter .2s, transform .1s, box-shadow .2s;
}
.login-go svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s; }
.login-go:hover { filter: brightness(1.07); box-shadow: 0 14px 30px -12px color-mix(in srgb, var(--accent) 90%, transparent); }
.login-go:hover svg { transform: translateX(4px); }
.login-go:active { transform: translateY(1px); }
.login-go:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.login-go::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-110%); pointer-events: none;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.28) 50%, transparent 70%);
}
.login-go.busy { cursor: progress; }
.login-go.busy::after { animation: lg-shine 1.1s linear infinite; }
.login-card.shake { animation: lg-shake .42s ease-in-out; }
@keyframes lg-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes lg-bar { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(.55); } }
@keyframes lg-shine { to { transform: translateX(110%); } }
@keyframes lg-shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
@media (max-width: 900px) {
  .login { grid-template-columns: minmax(0, 1fr); gap: 14px; margin-top: 0; }
  .login-scene { height: 230px; border-radius: 18px; }
  .login-card { padding: 24px 20px 22px; border-radius: 18px; }
  .login-mark { margin-bottom: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .login-scene, .login-card, .login-mark i, .login-go.busy::after, .login-card.shake { animation: none !important; }
}
button.primary {
  font: inherit; font-weight: 600; color: #fff; background: var(--accent);
  border: 0; border-radius: 8px; padding: 9px 14px; cursor: pointer;
}

/* ---------- фильтры: одна строка над всем, что они задают */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 16px; }
.presets { display: flex; flex-wrap: wrap; gap: 2px; background: var(--surface-2); border-radius: 9px; padding: 2px; }
.presets button {
  font: inherit; color: var(--text-2); background: none; border: 0; border-radius: 7px;
  padding: 5px 11px; cursor: pointer;
}
.presets button:hover { background: var(--wash); color: var(--text); }
.presets button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 0 0 1px var(--border); }
.range { display: flex; align-items: center; gap: 6px; }
.dash { color: var(--muted); }
.filters input, .filters select {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--axis); border-radius: 8px; padding: 5px 8px;
}

/* ---------- машины сейчас */
.cars { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-bottom: 16px; }
.car {
  text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px;
  box-shadow: var(--shadow);
}
.car:hover { border-color: var(--axis); }
.car.active { box-shadow: 0 0 0 2px var(--accent); border-color: transparent; }
.car-head { display: flex; align-items: center; gap: 8px; }
.car-name { font-weight: 600; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-2); white-space: nowrap; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.pill.ok .dot { background: var(--good); }
.car-state { margin: 6px 0 10px; color: var(--text-2); }
.car-facts { display: grid; grid-template-columns: repeat(4, auto); gap: 2px 14px; margin: 0; justify-content: start; }
.car-facts div { display: contents; }
.car-facts dt { grid-row: 1; color: var(--muted); font-size: 12px; }
.car-facts dd { grid-row: 2; margin: 0; font-weight: 600; white-space: nowrap; }

/* ---------- итоги */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 12px; margin-bottom: 16px; transition: opacity .15s; }
.kpi-board { display: grid; grid-template-columns: minmax(260px, 1.15fr) 3fr; gap: 12px; margin-bottom: 16px; }
.kpi-board .kpi-small { margin-bottom: 0; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); }
@media (max-width: 1250px) { .kpi-board .kpi-small { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); } }
.kpi-board .kpi.hero { display: flex; flex-direction: column; }
.kpi-board .kpi.hero .kpi-split { margin-top: auto; padding-top: 10px; }
@media (max-width: 900px) { .kpi-board { grid-template-columns: minmax(0, 1fr); } }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px;
  box-shadow: var(--shadow); min-width: 0;
}
.kpi-label { color: var(--text-2); font-size: 13px; }
.kpi-value { font-size: 28px; font-weight: 600; line-height: 1.2; margin-top: 4px; }
.kpi-value .unit { font-size: 15px; font-weight: 400; color: var(--text-2); margin-left: 4px; white-space: nowrap; }
/* в узких плитках длинное значение («6 326 об/мин», «1 ч 30 мин») — чуть мельче, чтобы не переносилось */
.kpi-small .kpi-value { font-size: clamp(20px, 1.9vw, 28px); }
.kpi.hero .kpi-value { font-size: 48px; line-height: 1.1; }
.kpi-note { color: var(--text-2); font-size: 13px; margin-top: 2px; }
.kpi-split { margin-top: 10px; display: grid; gap: 3px; }
.kpi-row { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.kpi-row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi-row .val { color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- графики */
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 6px; color: var(--text-2); font-size: 13px; }
.legend:empty { display: none; }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.sw.line { height: 3px; width: 14px; border-radius: 2px; }
.chart { width: 100%; }
.chart svg { display: block; overflow: visible; }
.chart .grid { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .axis { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .val { fill: var(--text); font-size: 12px; font-weight: 600; }
.chart .wash { fill: var(--wash); }
.chart .hit { fill: transparent; cursor: default; }
.chart .cross { stroke: var(--axis); stroke-width: 1; }
.chart .empty { fill: var(--muted); font-size: 13px; }
.as-table { margin-top: 8px; }
.as-table summary { cursor: pointer; color: var(--text-2); font-size: 13px; width: max-content; }
.as-table .table-wrap, .as-table table { margin-top: 8px; }

/* ---------- таблицы */
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--grid); white-space: nowrap; }
th { color: var(--text-2); font-weight: 500; position: sticky; top: 0; background: var(--surface); z-index: 1;
     white-space: normal; vertical-align: bottom; line-height: 1.25; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 600; border-bottom: 0; }
tbody tr.pick { cursor: pointer; }
tbody tr.pick:hover td { background: var(--wash); }
tbody tr.selected td { background: var(--wash); box-shadow: inset 0 -1px 0 var(--axis); }
.who { display: inline-flex; align-items: center; gap: 6px; }
.kind { display: inline-flex; align-items: center; gap: 5px; }
.kind .ic { font-weight: 700; }
.kind.refuel .ic { color: var(--good-text); }
.kind.drop .ic { color: var(--serious); }
.more { color: var(--muted); font-size: 12px; padding: 8px 10px 0; }
.nodata { color: var(--muted); padding: 12px 0; }

/* ---------- поездки и карта */
.split { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; }
.trips-list { max-height: 460px; }
.trips-list.tall, .table-wrap.tall { max-height: 640px; }
/* таблица слева, карта справа закреплена и не уезжает при прокрутке длинного списка */
.map-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.map-caption { color: var(--text-2); font-size: 13px; min-height: 1.4em; }
.map { height: clamp(380px, 56vh, 540px); border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); overflow: hidden; }
.map.tall { height: 614px; }
.map-dot { border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .35); cursor: pointer; }
.map-tip .maplibregl-popup-content, .maplibregl-popup-content {
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 10px; font: 12px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; box-shadow: 0 4px 16px rgba(0, 0, 0, .15);
}
.maplibregl-popup-tip { display: none; }
.maplibregl-ctrl-attrib { font-size: 11px; }
.speed-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 12px; color: var(--text-2); }
.map-off { display: grid; place-items: center; color: var(--muted); }

/* ---------- всплывающая подсказка */
.tooltip {
  position: fixed; left: 0; top: 0; z-index: 2000; pointer-events: none;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; font-size: 12px; min-width: 150px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}
.tt-title { font-weight: 600; margin-bottom: 4px; }
.tt-row { display: flex; align-items: center; gap: 6px; }
.tt-row .name { flex: 1; color: var(--text-2); }
.tt-row .v { font-variant-numeric: tabular-nums; font-weight: 600; }
.tt-foot { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--grid); display: flex; justify-content: space-between; gap: 12px; }

.foot { max-width: 1400px; margin: 0 auto; padding: 4px 24px 24px; color: var(--muted); font-size: 12px; }

/* ---------- узкие экраны */
@media (max-width: 900px) {
  .menu-btn { display: inline-block; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side {
    display: none; position: fixed; z-index: 1500; top: 53px; left: 0; bottom: 0; width: 260px; max-height: none;
    background: var(--page); border-right: 1px solid var(--border); box-shadow: 4px 0 16px rgba(0, 0, 0, .15);
  }
  .menu-open .side { display: flex; }
}
@media (max-width: 1100px) {
  .split { grid-template-columns: 1fr; }
  .map.tall { height: 420px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi.hero { grid-column: 1 / -1; }
  .page-head { align-items: flex-start; }
  .trips-list { max-height: 360px; }
}
@media (max-width: 640px) {
  .top { padding: 10px 16px; }
  .brand-sub { display: none; }
  main { padding: 16px 16px 8px; }
  .foot { padding: 4px 16px 20px; }
  .card { padding: 14px; }
  .kpi.hero .kpi-value { font-size: 40px; }
  .kpi-value { font-size: 24px; }
  .car-facts { grid-template-columns: repeat(2, auto); }
  .car-facts div { display: block; }
  .car-facts dt, .car-facts dd { grid-row: auto; }
  .map { height: 320px; }
}

/* карточки машин теперь ссылки */
a.car { display: block; color: inherit; }
a.car:hover { text-decoration: none; }


/* ---------- сетка графиков: две колонки, широкие — на всю ширину */
.charts-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; align-items: start; }
.charts-grid .card.wide { grid-column: 1 / -1; }
.charts-grid .card { margin-bottom: 16px; }
.legend-line { margin: -4px 0 12px; }
@media (max-width: 1000px) { .charts-grid { grid-template-columns: minmax(0, 1fr); } }
.btn-export { white-space: nowrap; }
.map-caption .speed-legend { margin-top: 4px; }

/* ---------- состояние машины */
.state { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.state .dot { width: 8px; height: 8px; border-radius: 50%; }
.map-caption .lg { margin-right: 14px; }

/* ---------- элементы управления */
.select, .lang {
  font: inherit; font-size: 13px; color: var(--text); background: var(--surface);
  border: 1px solid var(--axis); border-radius: 8px; padding: 5px 8px;
}
.lang { padding: 3px 6px; font-size: 12px; }
button.primary.small { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: default; }
/* .na — поле не действует в выбранном режиме: отключённое — бледное, как отключённая галочка (цвет и фон заданы явно —
   браузер их не гасит). Формы «только чтение» (disabled: ro) не бледнеют: там это данные, их читают */
.na:disabled { opacity: .45; cursor: default; }
.track-controls { margin-bottom: 16px; }

/* ---------- выбор машин */
.picker { position: relative; }
.picker-btn { display: inline-flex; align-items: center; gap: 8px; max-width: 280px; }
.picker-btn span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.caret { color: var(--muted); font-size: 11px; }
.picker-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 1200; width: 320px; max-height: 460px;
  display: flex; flex-direction: column; gap: 8px; padding: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
}
.cols-picker .table-cols-btn { display: inline-flex; align-items: center; padding: 6px 9px; }
.cols-pop { width: 280px; gap: 6px; }
.cols-head { font-weight: 600; font-size: 13px; }
.cols-list { display: flex; flex-direction: column; gap: 2px; overflow: auto; max-height: 340px; }
.cols-item { display: flex; align-items: center; gap: 8px; padding: 4px 2px; font-size: 13px; cursor: pointer; }
.cols-item input { margin: 0; }
.cols-reset { align-self: flex-start; }
.picker-pop input[type=search] { font: inherit; color: var(--text); background: var(--page); border: 1px solid var(--axis); border-radius: 8px; padding: 6px 9px; }
.picker-list { overflow: auto; display: flex; flex-direction: column; gap: 2px; min-height: 60px; }
.picker-groups { display: flex; flex-direction: column; gap: 2px; max-height: 140px; overflow: auto; }
.picker-item { padding: 4px 2px; }
.picker-foot { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--grid); padding-top: 8px; }

/* ---------- экспорт */
.export { position: relative; }
.btn-export { font-weight: 600; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 1200; min-width: 200px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
  display: flex; flex-direction: column;
}
.menu-item { display: flex; justify-content: space-between; gap: 16px; padding: 7px 10px; border-radius: 7px; color: var(--text); }
.menu-item:hover { background: var(--wash); text-decoration: none; }
.menu-item b { font-weight: 500; }

/* ---------- таблица со страницами */
.stable { transition: opacity .15s; }
.stable.loading { opacity: .55; }
/* таблица по единому образцу (components.dataTable): счётчик слева, фильтры, поиск, экспорт; страницы по 50 / 100 / 200 */
.table-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 12px; margin: -2px 0 8px; }
.table-facets { display: contents; }
.table-tools select.table-facet.on { border-color: var(--accent); color: var(--accent); }
.table-count { margin-right: auto; color: var(--text-2); font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table-tools select, .pager-size { font: inherit; font-size: 13px; color: var(--text); background: var(--surface); border: 1px solid var(--axis);
  border-radius: 8px; padding: 4px 8px; max-width: 100%; }
.pager-btns { align-items: center; flex-wrap: wrap; }
tfoot tr.total td { border-top: 2px solid var(--border); }
@media (max-width: 640px) {
  .table-tools { justify-content: stretch; }
  .table-count { flex-basis: 100%; }
  .table-tools > select, .table-tools > label, .table-search { flex: 1 1 140px; width: auto; }
}
.table-search { font: inherit; font-size: 13px; color: var(--text); background: var(--page); border: 1px solid var(--axis); border-radius: 8px; padding: 5px 9px; width: 240px; max-width: 100%; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th.sorted { color: var(--text); }
th .arrow { color: var(--accent); }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 10px; font-size: 13px; }
.pager-btns { display: inline-flex; gap: 6px; }
td.nodata { text-align: center; }

/* ---------- рейтинг (горизонтальные полосы) */
.hbars { display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }
.hbar { display: grid; grid-template-columns: minmax(90px, 32%) 1fr auto; align-items: center; gap: 10px; font-size: 13px; }
.hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.hbar-track { height: 12px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 0 4px 4px 0; }
.hbar-val { font-variant-numeric: tabular-nums; color: var(--text); min-width: 54px; text-align: right; }

/* ---------- диапазоны на шкале суток */
.ranges { display: flex; flex-direction: column; gap: 7px; padding: 4px 0; }
.range-axis, .range-row { display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 8px; }
.range-ticks { position: relative; height: 14px; }
.range-ticks span { position: absolute; transform: translateX(-50%); font-size: 11px; color: var(--muted); }
.range-label { font-size: 13px; color: var(--text-2); }
.range-track { position: relative; height: 18px; background: var(--surface-2); border-radius: 4px; }
.range-fill { position: absolute; top: 0; bottom: 0; border-radius: 4px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.range-text { font-size: 11px; color: #fff; white-space: nowrap; padding: 0 4px; }

/* ---------- топливо: метки, табло цен */
.input { font: inherit; font-size: 13px; color: var(--text); background: var(--page); border: 1px solid var(--axis); border-radius: 8px; padding: 5px 8px; }
.input.mini { width: 64px; padding: 3px 6px; }
.small { font-size: 12px; }
.fuel-tag { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.fuel-tag i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.fuel-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.fuel-tile { position: relative; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px 10px 16px; background: var(--page); overflow: hidden; }
.fuel-tile::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--fc); }
.fuel-tile-name { font-weight: 600; color: var(--text-2); font-size: 13px; }
.fuel-tile-price { font-size: 24px; font-weight: 600; line-height: 1.25; margin-top: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fuel-tile-note { display: flex; flex-wrap: wrap; gap: 2px 10px; color: var(--muted); font-size: 12px; margin-top: 2px; min-height: 1.4em; }
.fuel-tile.empty .fuel-tile-price { font-size: 15px; color: var(--muted); font-weight: 500; padding: 6px 0 3px; }
.delta { font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.delta.up { color: var(--critical); }
.delta.down { color: var(--good-text); }
.warn-line { margin: 10px 0 0; color: var(--text-2); font-size: 13px; }
.badge { display: inline-block; font-size: 12px; line-height: 1.3; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-2); white-space: nowrap; }
.badge.set { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 9%, transparent); }
.badge.obd { color: var(--good-text); border-color: color-mix(in srgb, var(--good) 45%, transparent); background: color-mix(in srgb, var(--good) 8%, transparent); }
.badge.none { color: var(--critical); border-color: color-mix(in srgb, var(--critical) 45%, transparent); background: color-mix(in srgb, var(--critical) 8%, transparent); }
.save-msg { color: var(--text-2); font-size: 13px; }

/* ---------- настройки: цены топлива (календарь + выбранный день) */
.prices-layout { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(0, 1.25fr); gap: 16px; align-items: start; }
.prices-layout .card { margin-bottom: 16px; }
@media (max-width: 1000px) { .prices-layout { grid-template-columns: minmax(0, 1fr); } }
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.cal-title { flex: 1; text-align: center; font-weight: 600; font-size: 15px; }
.cal-nav { width: 34px; padding: 4px 0; font-size: 16px; line-height: 1; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-wd { text-align: center; color: var(--muted); font-size: 12px; padding: 2px 0 4px; }
.cal-day { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 4px;
  height: 52px; padding: 6px 2px 4px; border: 1px solid transparent; border-radius: 9px; background: var(--page);
  font: inherit; color: var(--text); cursor: pointer; }
.cal-day:hover { border-color: var(--axis); }
.cal-day.we .cal-num { color: var(--text-2); }
.cal-day.out { background: transparent; }
.cal-day.out .cal-num { color: var(--muted); opacity: .6; }
.cal-day.today { border-color: var(--accent); }
.cal-day.today .cal-num { color: var(--accent); font-weight: 600; }
.cal-day.sel { background: var(--accent); border-color: var(--accent); }
.cal-day.sel .cal-num { color: #fff; font-weight: 600; }
.cal-day.sel .cal-dots i { box-shadow: 0 0 0 1.5px #fff; }
.cal-num { font-size: 13px; font-variant-numeric: tabular-nums; }
.cal-dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; max-width: 100%; }
.cal-dots i { width: 7px; height: 7px; border-radius: 50%; }
.cal-legend { margin: 12px 0 0; }
.price-rows { display: flex; flex-direction: column; }
.price-row { display: grid; grid-template-columns: minmax(130px, 1fr) minmax(130px, auto) minmax(150px, 1.2fr); align-items: center; gap: 12px;
  padding: 7px 8px; border-bottom: 1px solid var(--grid); border-radius: 6px; }
.price-row.here { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.price-cell { display: inline-flex; align-items: center; gap: 6px; }
.price-input { width: 112px; text-align: right; font-variant-numeric: tabular-nums; }
.price-val { font-variant-numeric: tabular-nums; }
.price-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12px; }
.price-note { width: 100%; margin: 12px 0 10px; }
.price-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
/* автообновление цен */
.sync-card { margin-bottom: 16px; }
.sync-status { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.sync-line { display: flex; align-items: flex-start; gap: 8px; margin: 0; font-size: 14px; }
.sync-ic { flex: none; width: 20px; height: 20px; border-radius: 50%; font: 700 12px/20px system-ui, sans-serif; text-align: center; color: #fff; background: var(--muted); margin-top: 1px; }
.sync-line.ok .sync-ic { background: var(--good); }
.sync-line.bad .sync-ic { background: var(--critical); }
.sync-note { margin: 0; font-size: 13px; color: var(--text-2); line-height: 1.5; }
.sync-note.warn { color: var(--text); background: color-mix(in srgb, #f0a800 12%, transparent); border-left: 3px solid #f0a800; border-radius: 6px; padding: 6px 10px; }
.sync-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 13px; }
.sync-chip { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; max-width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 3px 8px; background: var(--page); font-variant-numeric: tabular-nums; }
.sync-form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; padding-top: 12px; border-top: 1px solid var(--border); }
.sync-field { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.hist-wrap { max-height: 440px; }
@media (max-width: 640px) {
  .price-row { grid-template-columns: 1fr auto; }
  .price-meta { grid-column: 1 / -1; }
  .cal-day { height: 44px; }
}

/* ---------- настройки: машины и топливо */
.veh-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 10px; }
.bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 10px; padding: 8px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); background: color-mix(in srgb, var(--accent) 6%, transparent); border-radius: 10px; }
.veh-table td { vertical-align: middle; }
.veh-table th.pick, .veh-table td.pick { width: 28px; padding-right: 0; }
.veh-name { font-weight: 600; }
.fuel-pick { display: inline-flex; border-left: 4px solid var(--fc); border-radius: 8px; }
.fuel-pick .select { border-top-left-radius: 0; border-bottom-left-radius: 0; min-width: 150px; }
.cell-ctl { display: inline-flex; align-items: center; gap: 6px; }
.warn { color: var(--serious); cursor: help; }
tbody tr.row-warn td { background: color-mix(in srgb, var(--critical) 5%, transparent); }
.obd .mono { font-size: 12px; }
.kind.drop .ic { color: var(--critical); }

/* ---------- стиль вождения */
.callout { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; color: var(--text-2); font-size: 13px; line-height: 1.5; }
.callout-ic { flex: none; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); color: #fff; font: 600 12px/18px Georgia, serif; text-align: center; margin-top: 1px; }
.vtype { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.map-legend { display: inline-flex; margin: 0 14px 0 0; }
.score { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
.score b { font-variant-numeric: tabular-nums; min-width: 2ch; text-align: right; }
.score-track { width: 64px; height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.score-fill { display: block; height: 100%; border-radius: 4px; }
.grade { font-size: 12px; white-space: nowrap; }
.grade::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--muted); }
.grade.good::before { background: var(--good); }
.grade.fair::before { background: var(--st-idle); }
.grade.poor::before { background: var(--critical); }
.grade.na { color: var(--muted); }
.grade-val.good { color: var(--good-text); }
.grade-val.poor { color: var(--critical); }

/* ---------- связь и оборудование */
.signal { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; vertical-align: middle; }
.signal i { display: block; width: 4px; border-radius: 1px; background: var(--grid); }
.signal i.on { background: var(--good); }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.flags { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.flag { font-size: 11px; padding: 1px 6px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.flag.on { color: var(--good-text); border-color: var(--good); }

/* ---------- обзор в реальном времени */
:root { --zone-warn: rgba(208, 59, 59, .3); }
.lv-status { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: -4px 0 12px; font-size: 13px; color: var(--text-2); }
.lv-status-note { margin-left: auto; font-size: 12px; }
.lv-pulse { position: relative; width: 9px; height: 9px; border-radius: 50%; background: var(--st-idle); flex: none; }
.lv-pulse.live { background: var(--good); }
.lv-pulse.live::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--good); animation: lv-ping 2s ease-out infinite; }
.lv-pulse.err { background: var(--critical); }
@keyframes lv-ping { from { transform: scale(.5); opacity: .9; } to { transform: scale(1.7); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .lv-pulse.live::after, .lv-ev.new, .lv-mk.sel.st-moving .lv-mk-dot::after { animation: none; } }

/* 7 счётчиков и «Сегодня по парку» (шире: километры и поездки) */
.lv-kpis { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)) minmax(0, 1.45fr); gap: 10px; margin-bottom: 16px; }
@media (max-width: 1300px) { .lv-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 640px) { .lv-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.lv-kpi { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0;
  text-align: left; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 12px 10px 15px; cursor: pointer; box-shadow: var(--shadow); }
.lv-kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--kc); }
.lv-kpi:hover:not(:disabled):not(.today) { border-color: var(--axis); }
.lv-kpi.on { border-color: var(--kc); box-shadow: 0 0 0 2px color-mix(in srgb, var(--kc) 35%, transparent); }
.lv-kpi:disabled, .lv-kpi.today { cursor: default; }
.lv-kpi.today { --kc: var(--accent); }
.lv-kpi-label { display: flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13px; }
.lv-kpi-label i { width: 8px; height: 8px; border-radius: 50%; background: var(--kc); flex: none; }
.lv-kpi-value { font-size: 28px; font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums; }
.lv-kpi-value .unit { font-size: 14px; font-weight: 500; color: var(--text-2); margin-left: 4px; }
.lv-kpi-note { color: var(--muted); font-size: 12px; }

.lv-cars { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-bottom: 16px; }
.lv-car { display: flex; flex-direction: column; gap: 5px; min-width: 0; text-align: left; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-top: 3px solid var(--sc); border-radius: 12px; padding: 9px 12px 10px; cursor: pointer; box-shadow: var(--shadow); }
.lv-car:hover { border-color: var(--axis); border-top-color: var(--sc); }
.lv-car.sel { box-shadow: 0 0 0 2px var(--accent); }
.lv-car-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.lv-car-head b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lv-conn { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.lv-conn.online { background: var(--good); }
.lv-conn.wait { background: var(--st-idle); }
.lv-conn.lost { background: var(--critical); }
.lv-state { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.lv-state i { width: 9px; height: 9px; border-radius: 50%; background: var(--sc); flex: none; }
.lv-car-main { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 30px; font-size: 13px; }
.lv-car-main .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lv-car-speed { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.lv-car-speed small { font-size: 12px; font-weight: 500; color: var(--text-2); }
.lv-alert-dot { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--critical); color: #fff; font-weight: 700; font-size: 12px; flex: none; }
.lv-car-fuel { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); white-space: nowrap; }
.lv-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.lv-bar i { display: block; height: 100%; background: var(--tc, var(--accent)); border-radius: 3px; transition: width .6s; }
.lv-bar.big { flex: none; height: 8px; margin: 8px 0 2px; }

.lv-map { height: clamp(420px, 62vh, 640px); }
.lv-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.lv-legend .sw { border-radius: 50%; }
.lv-legend .sw.lost { background: transparent; box-shadow: inset 0 0 0 2px var(--critical); }
.lv-legend-track { margin-left: auto; }
.lv-map-card .btn[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); border-color: var(--accent); color: var(--accent); }
.lv-follow-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; border: 2px solid currentColor; margin-right: 6px; }
.btn[aria-pressed="true"] .lv-follow-dot { background: currentColor; }
.lv-mk { width: 0; height: 0; cursor: pointer; }
.lv-mk-dot { position: absolute; left: -11px; top: -11px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--sc); border: 2.5px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .45); box-sizing: border-box; }
/* стрелка курса — узкая, с вырезом сзади: нос и хвост не спутать (равносторонний треугольник читался в любую сторону) */
.lv-mk-arrow { display: none; width: 10px; height: 14px; background: #fff; clip-path: polygon(50% 0, 100% 100%, 50% 74%, 0 100%); }
.lv-mk.st-moving .lv-mk-arrow { display: block; }
.lv-mk-label { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); white-space: nowrap; pointer-events: none;
  font: 600 11px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.lv-mk.sel .lv-mk-dot { left: -16px; top: -16px; width: 32px; height: 32px; border-width: 3px; box-shadow: 0 0 0 3px var(--accent), 0 2px 8px rgba(0, 0, 0, .45); }
.lv-mk.sel .lv-mk-arrow { width: 14px; height: 19px; }
.lv-mk.sel .lv-mk-label { top: 20px; border-color: var(--accent); }
.lv-mk.sel.st-moving .lv-mk-dot::after { content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 2px solid var(--sc); animation: lv-ping 1.8s ease-out infinite; }
.lv-mk.conn-lost .lv-mk-dot { box-shadow: 0 0 0 3px var(--critical), 0 1px 4px rgba(0, 0, 0, .45); opacity: .8; }

.lv-row { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.lv-row > * { min-width: 0; }
.lv-row .card { margin-bottom: 16px; }
@media (max-width: 1300px) { .lv-row { grid-template-columns: minmax(0, 1fr); } }
.lv-panel { border-top: 4px solid var(--accent); }
.lv-panel-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 16px; align-items: start; margin-bottom: 14px; }
.lv-panel-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; }
.lv-panel-title h2 { font-size: 22px; }
.lv-panel-links { grid-row: 1; grid-column: 2; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.lv-badges { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.lv-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--page); color: var(--text-2); white-space: nowrap; }
.lv-badge i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.lv-badge.st-moving, .lv-badge.st-idle, .lv-badge.st-parked { color: var(--text); font-weight: 600; }
.lv-badge.st-moving { border-color: color-mix(in srgb, var(--st-moving) 55%, transparent); background: color-mix(in srgb, var(--st-moving) 10%, transparent); }
.lv-badge.st-moving i { background: var(--st-moving); }
.lv-badge.st-idle { border-color: color-mix(in srgb, var(--st-idle) 60%, transparent); background: color-mix(in srgb, var(--st-idle) 12%, transparent); }
.lv-badge.st-idle i { background: var(--st-idle); }
.lv-badge.st-parked i { background: var(--st-parked); }
.lv-badge.conn.online i { background: var(--good); }
.lv-badge.conn.wait i { background: var(--st-idle); }
.lv-badge.conn.lost { color: var(--critical); }
.lv-badge.conn.lost i { background: var(--critical); }
.lv-badge.gf { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.lv-badge.alert { color: var(--critical); font-weight: 600; border-color: color-mix(in srgb, var(--critical) 45%, transparent); background: color-mix(in srgb, var(--critical) 8%, transparent); }
.lv-gauges { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
@media (max-width: 1600px) { .lv-gauges { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 700px) { .lv-gauges { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.lv-gauge, .lv-tile { display: flex; flex-direction: column; min-width: 0; background: var(--page); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px 8px; }
.lv-gauge-label { font-size: 13px; color: var(--text-2); }
.lv-gauge-sub { font-size: 12px; color: var(--muted); min-height: 1.4em; text-align: center; }
.lv-tile .lv-gauge-sub { text-align: left; }
.lv-arc { width: 100%; max-width: 170px; height: auto; align-self: center; margin-top: 2px; }
.lv-arc-track { fill: none; stroke: var(--grid); stroke-width: 10; stroke-linecap: round; }
.lv-arc-zone { fill: none; stroke-width: 10; }
.lv-arc-val { fill: none; stroke-width: 10; stroke-linecap: round; }
.lv-arc-tip { stroke: var(--surface); stroke-width: 2; }
.lv-arc-num { font-size: 30px; font-weight: 650; fill: var(--text); font-variant-numeric: tabular-nums; }
.lv-arc-unit { font-size: 12px; fill: var(--muted); }
.lv-arc-tick { font-size: 10px; fill: var(--muted); }
.lv-tile-value { margin-top: auto; padding-top: 16px; font-size: 30px; font-weight: 650; line-height: 1.2; font-variant-numeric: tabular-nums; }
.lv-tile-value small { font-size: 14px; font-weight: 500; color: var(--text-2); }
.lv-tile.pw-bad .lv-tile-value { color: var(--critical); }
.lv-pw.good { color: var(--good-text); }
.lv-pw.warn { color: var(--serious); }
.lv-pw.bad { color: var(--critical); font-weight: 600; }
.lv-stale { color: var(--muted); }
.lv-secs { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px 28px; }
.lv-sec h3 { margin: 0 0 4px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.lv-sec dl { margin: 0; }
.lv-fact { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 5px 0; border-bottom: 1px dashed var(--grid); font-size: 13px; }
.lv-fact dt { color: var(--text-2); }
.lv-fact dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.lv-bad { color: var(--critical); font-weight: 600; }
.lv-spark-box { margin-top: 10px; }
.lv-spark-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); margin-bottom: 2px; }
.lv-spark { display: block; width: 100%; height: 64px; }
.lv-spark-line { fill: none; stroke: var(--accent); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.lv-spark-fill { fill: color-mix(in srgb, var(--accent) 14%, transparent); }
.lv-volt { cursor: crosshair; }
.lv-volt-ign { fill: color-mix(in srgb, var(--st-moving) 16%, transparent); }
.lv-volt-low { stroke: var(--critical); stroke-width: 1; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; }
.lv-volt-cur { stroke: var(--text-2); stroke-width: 1; vector-effect: non-scaling-stroke; }
.lv-volt-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 11px; color: var(--text-2); margin-top: 3px; }
.lv-volt-legend .ign::before { content: ''; display: inline-block; width: 10px; height: 10px; margin-right: 5px; vertical-align: -1px;
  border-radius: 2px; background: color-mix(in srgb, var(--st-moving) 32%, transparent); }
.lv-volt-legend .low::before { content: ''; display: inline-block; width: 14px; margin-right: 5px; vertical-align: 3px;
  border-top: 1px dashed var(--critical); }

.lv-events-wrap { max-height: 720px; overflow: auto; }
.lv-events { list-style: none; margin: 0; padding: 0; }
.lv-ev { display: grid; grid-template-columns: 10px 42px minmax(0, 1fr) auto; gap: 8px; align-items: start; padding: 7px 4px; border-bottom: 1px solid var(--grid); font-size: 13px; border-radius: 6px; }
.lv-ev > i { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; background: var(--muted); }
.lv-ev.on > i { background: var(--st-moving); }
.lv-ev.off > i { background: var(--st-parked); }
.lv-ev.geo > i { background: var(--accent); }
.lv-ev.geo-out > i { background: transparent; box-shadow: inset 0 0 0 2px var(--accent); }
.lv-ev.warn > i { background: var(--serious); }
.lv-ev.bad > i { background: var(--critical); }
.lv-ev time { color: var(--text-2); font-variant-numeric: tabular-nums; }
.lv-ev .link-btn { font-weight: 600; }
.lv-ev-text { color: var(--text-2); }
.lv-ev.new { animation: lv-flash 3s ease-out; }
@keyframes lv-flash { from { background: color-mix(in srgb, var(--accent) 20%, transparent); } to { background: transparent; } }
.lv-table th.sortable { cursor: pointer; user-select: none; }
.lv-table th.asc::after { content: " ▲"; font-size: 9px; }
.lv-table th.desc::after { content: " ▼"; font-size: 9px; }
.lv-conn-cell { display: inline-flex; align-items: center; gap: 6px; }
.lv-conn-cell i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.lv-conn-cell.online i { background: var(--good); }
.lv-conn-cell.wait i { background: var(--st-idle); }
.lv-conn-cell.lost { color: var(--critical); }
.lv-conn-cell.lost i { background: var(--critical); }
.lv-stale-mark { margin-left: 6px; color: var(--muted); cursor: help; }
@media (max-width: 640px) {
  .lv-map-card .card-head { flex-direction: column; }
  .lv-map-card .card-actions { justify-content: flex-start; }
  .lv-panel-head { grid-template-columns: minmax(0, 1fr); }
  .lv-panel-links { grid-row: auto; grid-column: 1; justify-content: flex-start; }
}
.lv-map-card .btn, .lv-panel-links .btn { white-space: nowrap; }

/* ---------- расходы и обслуживание: журнал, регламент ТО */
.cat-tag { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.cat-tag i { width: 9px; height: 9px; border-radius: 3px; background: var(--cc); flex: none; }
.cat-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: middle; }
.lb-clip { color: var(--muted); font-size: 12px; }
.lb-plan-tag { margin-left: 6px; font-size: 11px; padding: 1px 6px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-2); }
.lb-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: -4px 0 16px; }
.lb-actions .primary { padding: 8px 16px; }
.btn.danger { color: var(--critical); border-color: color-mix(in srgb, var(--critical) 45%, transparent); }
.select.small { font-size: 12px; padding: 3px 6px; }
.odo-cell { display: flex; flex-direction: column; gap: 4px; }

.lb-open .lb-open-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 8px; }
.lb-open-item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 8px 12px;
  border: 1px dashed color-mix(in srgb, var(--st-idle) 70%, transparent); border-radius: 10px; background: color-mix(in srgb, var(--st-idle) 6%, transparent); }
.lb-open-l { font-weight: 600; font-variant-numeric: tabular-nums; }

.lb-dialog { width: min(860px, calc(100vw - 24px)); max-height: calc(100vh - 32px); padding: 0; border: 1px solid var(--border); border-radius: 16px;
  background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.lb-dialog.narrow { width: min(520px, calc(100vw - 24px)); }
.lb-dialog::backdrop { background: rgba(10, 12, 16, .45); }
.lb-form { display: flex; flex-direction: column; gap: 10px; padding: 18px 22px 20px; }
.lb-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 2px; }
.lb-head h2 { font-size: 19px; }
.lb-close { font-size: 18px; color: var(--muted); }
.lb-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.lb-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.lb-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 640px) { .lb-grid, .lb-grid.three, .lb-grid.four { grid-template-columns: minmax(0, 1fr); } .lb-form { padding: 14px; } }
.lb-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-2); min-width: 0; }
.lb-field .input, .lb-field .select, .lb-field textarea { width: 100%; font-size: 14px; padding: 7px 9px; }
.lb-field textarea { resize: vertical; font: inherit; color: var(--text); background: var(--page); border: 1px solid var(--axis); border-radius: 8px; }
.lb-when { display: flex; gap: 6px; }
.lb-when .input { flex: 1; min-width: 0; }
.lb-amount { font-weight: 600; font-size: 16px !important; }
.lb-label { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.lb-cats { display: flex; flex-wrap: wrap; gap: 6px; }
.lb-cat { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 13px; color: var(--text-2); background: var(--page);
  border: 1px solid var(--border); border-radius: 999px; padding: 5px 11px; cursor: pointer; }
.lb-cat i { width: 9px; height: 9px; border-radius: 3px; background: var(--cc); }
.lb-cat.on { color: var(--text); font-weight: 600; border-color: var(--cc); background: color-mix(in srgb, var(--cc) 14%, var(--surface)); }
.lb-cat:disabled { cursor: default; }
.lb-auto { font-size: 12px; margin-top: -4px; }
.lb-items { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--page); }
.lb-items-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.lb-items-total { font-size: 13px; color: var(--text-2); }
.lb-items table td { padding: 4px 4px; border-bottom: 0; }
.lb-items table th { background: var(--page); padding: 4px; }
.lb-items .input, .lb-items .select { width: 100%; padding: 5px 6px; }
.lb-items .input.num { text-align: right; max-width: 110px; }
.lb-items td:nth-child(2) { min-width: 200px; }
.lb-items-add { display: flex; gap: 8px; margin-top: 6px; }
.lb-fuel { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 14px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--page); }
.lb-fuel label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-2); }
.lb-fuel .input, .lb-fuel .select { width: 100%; padding: 7px 9px; }
.lb-sensor { grid-column: 1 / -1; font-size: 13px; }
@media (max-width: 640px) { .lb-fuel { grid-template-columns: minmax(0, 1fr); } }
.lb-files { display: flex; flex-wrap: wrap; gap: 8px; }
.lb-file { position: relative; width: 92px; height: 92px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: var(--page); }
.lb-file img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lb-file.new { outline: 2px dashed var(--accent); outline-offset: -2px; }
.lb-pdf { display: grid; place-items: center; width: 100%; height: 100%; font-weight: 700; color: var(--critical); }
.lb-file-x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .6); color: #fff; cursor: pointer; font-size: 12px; }
.lb-file-add { width: 92px; height: 92px; border-radius: 10px; border: 1px dashed var(--axis); background: transparent; color: var(--text-2); font: inherit; font-size: 12px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.lb-file-add b { font-size: 24px; font-weight: 400; color: var(--accent); }
.lb-plan { font-size: 13px; }
.lb-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--grid); }
.lb-foot .primary { padding: 8px 18px; }

.svc-st { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 13px; }
.svc-st i { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.svc-st.overdue { color: var(--critical); font-weight: 600; }
.svc-st.overdue i { background: var(--critical); }
.svc-st.soon i { background: var(--st-idle); }
.svc-st.ok i { background: var(--good); }
.svc-left.overdue { color: var(--critical); font-weight: 600; }
.svc-left.soon { color: var(--serious); }
.svc-prog { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
.svc-prog-track { width: 80px; height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.svc-prog-track i { display: block; height: 100%; border-radius: 4px; }
.svc-devs { display: flex; flex-wrap: wrap; gap: 6px 16px; max-height: 140px; overflow: auto; }
.svc-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.svc-presets .chip { background: var(--page); font: inherit; font-size: 12px; }
.svc-facts { margin: 0 0 8px; }
.svc-devbars { display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }
.svc-devbar { display: grid; grid-template-columns: minmax(90px, 32%) 1fr; align-items: center; gap: 10px; font-size: 13px; }
.svc-stack { display: flex; height: 18px; border-radius: 4px; overflow: hidden; background: var(--surface-2); }
.svc-stack i { display: grid; place-items: center; color: #fff; font-size: 11px; font-style: normal; min-width: 18px; }

/* ---------- переключатель темы в шапке */
.theme-switch { display: inline-flex; gap: 2px; padding: 2px; border-radius: 9px; background: var(--surface-2); }
.theme-btn { display: inline-grid; place-items: center; width: 30px; height: 26px; border: 0; border-radius: 7px;
  background: transparent; color: var(--muted); cursor: pointer; }
.theme-btn:hover { color: var(--text); }
.theme-btn[aria-pressed="true"] { background: var(--surface); color: var(--accent); box-shadow: 0 0 0 1px var(--border), var(--shadow); }
.theme-btn[data-theme-btn="light"][aria-pressed="true"] { color: #e8a200; }
.theme-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- «Открыть как клиент» (1.76.0): плашка внизу по центру — чья это вкладка */
.view-as-bar {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 1200; display: flex; align-items: center;
  gap: 10px; max-width: calc(100vw - 24px); padding: 8px 8px 8px 14px; border-radius: 999px; font-size: 13.5px;
  color: #fff; background: color-mix(in srgb, var(--tone-risk) 88%, #000); box-shadow: 0 10px 30px -8px rgba(0, 0, 0, .45);
}
.view-as-dot { width: 8px; height: 8px; border-radius: 50%; background: #fff; flex: none; animation: va-pulse 1.6s ease-in-out infinite; }
@keyframes va-pulse { 50% { opacity: .35; } }
.view-as-close {
  border: 0; border-radius: 999px; padding: 5px 12px; font: inherit; font-weight: 600; cursor: pointer;
  color: color-mix(in srgb, var(--tone-risk) 85%, #000); background: #fff;
}
@media (prefers-reduced-motion: reduce) { .view-as-dot { animation: none; } }
.bp-va { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
/* «Права Traccar» иконками (1.77.0): зелёная — можно, красная — нельзя, щит администратора — синий / серый */
.ri-row { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.ri { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; cursor: help; }
.ri svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ri.ok { color: var(--good); background: color-mix(in srgb, var(--good) 12%, transparent); }
.ri.no { color: var(--critical); background: color-mix(in srgb, var(--critical) 14%, transparent); }
.ri.adm { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.ri.off { color: var(--muted); background: var(--wash); }
.ri-row .ri:first-child { margin-right: 3px; }
.bp-expired { color: var(--critical); font-weight: 600; }
body:has(#view-as:not([hidden])) .foot { padding-bottom: 64px; }

/* ---------- шапка на телефоне (1.72.1): одна строка — тема одной кнопкой, остальное — в «⋮» */
.more-wrap { position: relative; display: none; }
.more-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid var(--border);
  border-radius: 50%; background: var(--surface); color: var(--text-2); cursor: pointer;
}
.more-btn svg { fill: currentColor; }
.more-btn:hover, .more-btn[aria-expanded="true"] { background: var(--wash); color: var(--text); }
.more-pop {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 1100; min-width: 210px; max-width: calc(100vw - 24px);
  padding: 6px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.35);
}
.more-pop .mp-user { padding: 8px 10px 6px; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.more-pop .mp-item {
  display: flex; align-items: center; width: 100%; min-height: 40px; padding: 0 10px; border: 0; border-radius: 8px;
  background: none; color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer; text-decoration: none;
}
.more-pop .mp-item:hover { background: var(--wash); text-decoration: none; }
.more-pop .mp-sep { height: 1px; margin: 4px 6px; background: var(--border); }
@media (max-width: 640px) {
  .top { gap: 10px; justify-content: flex-start; }
  .top-nav { flex-wrap: nowrap; gap: 8px; margin-left: auto; }
  .top-wide { display: none !important; }
  .more-wrap { display: inline-flex; }
  /* тема — одна кнопка текущего режима (авто → светлая → тёмная по кругу) */
  .theme-switch { padding: 0; background: none; }
  .theme-btn[aria-pressed="false"] { display: none; }
  .theme-btn[aria-pressed="true"] {
    width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 50%; background: var(--surface); box-shadow: none;
  }
  .brand { white-space: nowrap; }
}

/* ---------- элементы управления карты */
.map-rotate-btn { display: grid; place-items: center; color: #333; }
.map-rotate-btn[aria-pressed="true"] { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, #fff) !important; }
.map-terrain-btn[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 14%, #fff) !important; }
.maplibregl-ctrl-scale { border-color: var(--text-2); color: var(--text); background: color-mix(in srgb, var(--surface) 80%, transparent);
  font-size: 11px; font-variant-numeric: tabular-nums; }
:root[data-theme="dark"] .maplibregl-ctrl-group { background: var(--surface-2); box-shadow: 0 0 0 1px var(--border); }
:root[data-theme="dark"] .maplibregl-ctrl-group button + button { border-top-color: var(--border); }
:root[data-theme="dark"] .maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1) hue-rotate(180deg) brightness(1.3); }
:root[data-theme="dark"] .maplibregl-ctrl-group button:not(:disabled):hover { background-color: var(--wash); }
:root[data-theme="dark"] .map-rotate-btn { color: #e8e8e6; }
:root[data-theme="dark"] .map-rotate-btn[aria-pressed="true"] { color: var(--accent); background: color-mix(in srgb, var(--accent) 22%, var(--surface-2)) !important; }
:root[data-theme="dark"] .map-terrain-btn[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 22%, var(--surface-2)) !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .maplibregl-ctrl-group { background: var(--surface-2); box-shadow: 0 0 0 1px var(--border); }
  :root:not([data-theme="light"]) .maplibregl-ctrl-group button + button { border-top-color: var(--border); }
  :root:not([data-theme="light"]) .maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1) hue-rotate(180deg) brightness(1.3); }
  :root:not([data-theme="light"]) .maplibregl-ctrl-group button:not(:disabled):hover { background-color: var(--wash); }
  :root:not([data-theme="light"]) .map-rotate-btn { color: #e8e8e6; }
  :root:not([data-theme="light"]) .map-terrain-btn[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 22%, var(--surface-2)) !important; }
}

/* ---------- Настройки → Интеграция с Traccar */
.tm-layout { display: grid; grid-template-columns: minmax(280px, 400px) 1fr; gap: 24px; align-items: start; }
.tm-preview { margin: 0; }
.tm-bar { display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface-2); border-radius: 10px;
  box-shadow: 0 0 0 1px var(--border), var(--shadow); padding: 8px 2px 6px; }
.tm-item { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 2px; border-radius: 8px;
  color: var(--text-2); font-size: 11.5px; line-height: 1.2; text-align: center; }
.tm-item svg { width: 24px; height: 24px; fill: currentColor; }
.tm-item.sel { color: var(--accent); }
.tm-item.new { color: var(--text-2); outline: 2px dashed color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: -2px; }
.tm-bar.on .tm-item.new { outline: 2px solid color-mix(in srgb, var(--good) 60%, transparent); background: color-mix(in srgb, var(--good) 8%, transparent); }
.tm-preview figcaption { margin-top: 8px; text-align: center; }
.tm-text p { margin: 0 0 10px; color: var(--text-2); line-height: 1.5; }
.tm-points { margin: 0 0 12px; padding-left: 18px; color: var(--text-2); line-height: 1.55; font-size: 13px; }
.tm-warn { color: var(--text) !important; background: color-mix(in srgb, #f0a800 12%, transparent); border-left: 3px solid #f0a800;
  border-radius: 6px; padding: 8px 10px; font-size: 13px; }
.tm-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.tm-manual { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 12px; }
.tm-manual summary { cursor: pointer; color: var(--text-2); font-size: 13px; }
.tm-manual p { margin: 10px 0 8px; }
.tm-code { margin: 0 0 8px; padding: 10px 12px; background: var(--surface-2); border-radius: 8px; white-space: pre-wrap; font-size: 12.5px; }
.tm-text code, .tm-code code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; word-break: break-all; }
@media (max-width: 760px) { .tm-layout { grid-template-columns: 1fr; } }

/* ---------- Охрана */
.sec-notes { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.sec-now { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 16px; padding: 10px 14px; border-radius: 10px;
  background: color-mix(in srgb, var(--critical) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--critical) 35%, transparent);
  color: var(--text); font-size: 14px; line-height: 1.5; }
.sec-now-ic { flex: none; width: 20px; height: 20px; border-radius: 50%; background: var(--critical); color: #fff;
  font: 700 13px/20px system-ui, sans-serif; text-align: center; margin-top: 1px; }

/* ---------- Колокольчик и всплывающие уведомления */
#bell-box:empty { display: none; }
.bell-wrap { position: relative; display: inline-flex; }
.bell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  border: 1px solid var(--border); border-radius: 50%; background: var(--surface); cursor: pointer; padding: 0; }
.bell:hover { background: var(--wash); }
.bell-ic { font-size: 16px; line-height: 1; filter: grayscale(1); }
.bell-badge { position: absolute; top: -5px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--critical); color: #fff; font: 600 11px/18px system-ui, sans-serif; text-align: center; }
.bell-badge[hidden] { display: none; }
.inbox { position: absolute; right: -8px; top: calc(100% + 8px); z-index: 1300; width: min(460px, calc(100vw - 24px));
  max-height: min(560px, calc(100vh - 80px)); display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 28px rgba(0, 0, 0, .18); overflow: hidden; }
.inbox[hidden] { display: none; }
.inbox-head { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.inbox-head b { flex: 1; }
.inbox-list { overflow: auto; }
.inbox-item { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 4px 10px; width: 100%; text-align: left; font: inherit;
  color: var(--text); background: none; border: 0; border-bottom: 1px solid var(--border); padding: 10px 14px; cursor: pointer; }
.inbox-item:hover { background: var(--wash); }
.inbox-item.unread { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.inbox-item.unread .inbox-title { font-weight: 600; }
.inbox-item.unread.g-security { background: color-mix(in srgb, var(--critical) 7%, transparent); }
.inbox-ic { font-size: 17px; line-height: 1.3; }
.inbox-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.inbox-top { display: flex; align-items: baseline; gap: 10px; }
.inbox-title { font-size: 14px; flex: 1; min-width: 0; }
.inbox-line { font-size: 12.5px; color: var(--text-2); overflow-wrap: anywhere; }
.inbox-time { font-size: 12px; color: var(--muted); white-space: nowrap; }
.inbox-empty { padding: 18px 14px; margin: 0; }
/* снимки камер рядом с событием (видео, этап 4) — кнопка справа от уведомления */
.inbox-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; border-bottom: 1px solid var(--border); }
.inbox-row .inbox-item { border-bottom: 0; }
.inbox-row:has(> .inbox-item.unread) { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.inbox-row:has(> .inbox-item.unread.g-security) { background: color-mix(in srgb, var(--critical) 7%, transparent); }
.inbox-row .inbox-item.unread { background: none; }
.inbox-media { margin-right: 12px; display: inline-flex; align-items: center; gap: 3px; padding: 4px 8px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; font-size: 14px; cursor: pointer; }
.inbox-media small { font-size: 11px; color: var(--muted); }
.inbox-media:hover, .inbox-media:focus-visible { border-color: var(--accent); }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 2500; display: flex; flex-direction: column; gap: 10px;
  width: min(380px, calc(100vw - 32px)); }
.toast { display: grid; grid-template-columns: 26px 1fr 20px; gap: 10px; align-items: start; padding: 12px 12px 12px 14px;
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18); cursor: pointer; animation: toast-in .2s ease-out; }
.toast.g-security { border-left-color: var(--critical); }
.toast.g-tech { border-left-color: var(--series-4); }
.toast-ic { font-size: 20px; line-height: 1.2; }
.toast-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.toast-body .small { color: var(--text-2); overflow-wrap: anywhere; }
.toast-x { background: none; border: 0; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; padding: 0; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

/* ---------- Настройки → Уведомления */
.nf-msg { position: sticky; bottom: 12px; z-index: 50; display: flex; justify-content: center; pointer-events: none; }
.nf-msg[hidden] { display: none; }
.nf-msg .save-msg { pointer-events: auto; background: var(--text); color: var(--surface); border-radius: 8px; padding: 8px 14px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .2); max-width: min(720px, 100%); font-size: 13.5px; }
.nf-ch { display: grid; grid-template-columns: 34px 1fr; gap: 12px; padding: 14px 0; border-top: 1px solid var(--border); }
.nf-ch:first-of-type { border-top: 0; padding-top: 4px; }
.nf-ch-ic { width: 34px; height: 34px; border-radius: 50%; background: var(--surface-2); display: flex; align-items: center;
  justify-content: center; font-size: 16px; }
.nf-ch-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.nf-ch-body { min-width: 0; }
.nf-ch-body p { margin: 4px 0 8px; line-height: 1.5; }
.nf-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 8px; }
.nf-details { margin-top: 8px; }
.nf-details summary { cursor: pointer; color: var(--text-2); font-size: 13px; }
.nf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 16px; margin-top: 10px; }
.nf-field { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--text-2); min-width: 0; }
.nf-in { font: inherit; font-size: 14px; color: var(--text); background: var(--page); border: 1px solid var(--axis);
  border-radius: 8px; padding: 6px 9px; min-width: 0; }
.nf-in:disabled { opacity: .6; }
.nf-short { width: 84px; }
.nf-wide { flex: 1 1 260px; max-width: 420px; }
.nf-steps { margin: 8px 0 4px; padding-left: 20px; color: var(--text-2); font-size: 13px; line-height: 1.6; }
.nf-lang { display: inline-flex; align-items: center; gap: 8px; }
.nf-mine { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 24px; }
.nf-mine > div { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; min-width: 0; }
.nf-chats { list-style: none; margin: 2px 0 0; padding: 0; font-size: 13.5px; display: flex; flex-direction: column; gap: 4px; }
.nf-chats li { display: flex; gap: 10px; align-items: baseline; }
.nf-link p { margin: 6px 0 0; overflow-wrap: anywhere; }
.nf-group { margin-top: 18px; }
.nf-group:first-of-type { margin-top: 6px; }
.nf-group-title { margin: 0; font-size: 15px; }
.nf-group > p { margin: 2px 0 8px; }
.nf-rule { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 6px 14px; align-items: start;
  padding: 10px 0; border-top: 1px solid var(--border); }
.nf-rule:not(.on) .nf-rule-name b { color: var(--text-2); }
.nf-rule-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.nf-rule-main { min-width: 0; }
.nf-rule-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.nf-chips { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.nf-chip { font: inherit; font-size: 12.5px; color: var(--text-2); background: var(--surface); border: 1px solid var(--axis);
  border-radius: 999px; padding: 3px 10px; cursor: pointer; white-space: nowrap; }
.nf-chip.on { color: #fff; background: var(--accent); border-color: var(--accent); }
.nf-chip.locked { color: var(--muted); background: var(--surface-2); border-style: dashed; cursor: not-allowed; }
.nf-chip.warn:not(.on) { opacity: .6; }
.nf-chip.on.warn { background: color-mix(in srgb, var(--accent) 55%, var(--surface)); }
.nf-chip:disabled:not(.locked) { cursor: default; }
.nf-param { font-size: 13px; color: var(--text-2); display: inline-flex; align-items: center; gap: 4px; }
.nf-switch { position: relative; display: inline-block; width: 38px; height: 22px; margin-top: 1px; }
.nf-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.nf-switch input:disabled { cursor: default; }
.nf-slider { position: absolute; inset: 0; border-radius: 11px; background: var(--axis); transition: background .15s; }
.nf-slider::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.nf-switch input:checked + .nf-slider { background: var(--good); }
.nf-switch input:checked + .nf-slider::after { transform: translateX(16px); }
.nf-switch input:focus-visible + .nf-slider { outline: 2px solid var(--accent); outline-offset: 2px; }
.nf-switch input:disabled + .nf-slider { opacity: .55; }
.nf-scope { margin-top: 2px; }
.nf-scope summary { cursor: pointer; list-style-position: inside; }
.nf-scope-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 20px; margin: 8px 0 4px; }
.nf-pick { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; max-height: 220px; overflow: auto; font-size: 13px; }
.nf-pick label { display: inline-flex; align-items: center; gap: 6px; }
.nf-pick-all { font-weight: 600; }
.nf-err { max-width: 320px; overflow-wrap: anywhere; }
@media (max-width: 720px) {
  .nf-rule { grid-template-columns: 44px minmax(0, 1fr); }
  .nf-rule-side { grid-column: 2; align-items: flex-start; }
  .nf-chips { justify-content: flex-start; }
}

/* ---------- Уведомления: расписание, мои уведомления */
.btn.small { font-size: 12px; padding: 3px 9px; }
.nf-sched { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 6px; }
.nf-sched-win { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.nf-sched-win[hidden] { display: none; }
.nf-days { display: inline-flex; gap: 3px; }
.nf-day { font: inherit; font-size: 11.5px; min-width: 28px; padding: 2px 4px; border-radius: 6px; cursor: pointer;
  color: var(--text-2); background: var(--surface); border: 1px solid var(--axis); }
.nf-day.on { color: #fff; background: var(--accent); border-color: var(--accent); }
.nf-day:disabled { cursor: default; opacity: .7; }
.nf-sched-time { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--text-2); }
.nf-time { width: 96px; padding: 3px 6px; font-size: 13px; }
.nf-state { width: 38px; text-align: center; font-size: 18px; line-height: 22px; }
.nf-mand { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); cursor: pointer; }
.nf-rule-side .nf-actions { margin-top: 0; justify-content: flex-end; }
@media (max-width: 720px) { .nf-rule-side .nf-actions { justify-content: flex-start; } }

/* ---------- Прогноз АКБ */
.bf-block { margin-bottom: 16px; }
.bf-title { margin: 0 0 8px; }
.bf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.bf-card { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--good); border-radius: 10px; padding: 12px 14px; }
.bf-card.bf-watch { border-left-color: var(--st-idle); }
.bf-card.bf-risk { border-left-color: var(--critical); }
.bf-card.bf-na { border-left-color: var(--muted); }
.bf-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }
.bf-badge { font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--good-text); }
.bf-badge.watch { color: var(--text); background: color-mix(in srgb, var(--st-idle) 18%, transparent); }
.bf-badge.risk { color: #fff; background: var(--critical); border-color: var(--critical); }
.bf-badge.na { color: var(--muted); }
.bf-main { font-size: 15px; font-weight: 600; margin-bottom: 6px; line-height: 1.4; }
.bf-facts { margin: 0; padding-left: 18px; font-size: 13px; color: var(--text-2); line-height: 1.6; }
.bf-warn { color: var(--critical); font-weight: 500; }
.bf-how { margin: 8px 0 0; line-height: 1.5; }
.lv-bf.warn { color: var(--st-idle); }
.lv-bf.bad { color: var(--critical); font-weight: 600; }

/* ---------- Рассылка отчётов */
.menu-item.menu-sep { margin-top: 4px; border-top: 1px solid var(--border); border-radius: 0 0 7px 7px; padding-top: 9px; }
.ml-chs { display: flex; flex-direction: column; gap: 8px; }
.ml-ch { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 14px; }
.ml-ch .badge { white-space: normal; }
.ml-ch-ic { width: 22px; text-align: center; }
.ml-row .nf-rule-main > div { margin-top: 2px; }
.ml-tags { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.ml-editor { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.ml-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin-top: 14px; }
.ml-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.ml-name { max-width: 420px; }
.ml-reports { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px 18px; }
.ml-group { border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px 8px; margin: 0; min-width: 0; }
.ml-group legend { font-size: 12px; color: var(--muted); padding: 0 4px; }
.ml-group label { display: flex; align-items: center; gap: 6px; font-size: 13.5px; padding: 2px 0; }
.ml-when, .ml-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0 28px; }
.ml-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.ml-chips { justify-content: flex-start; }
.ml-emails { width: 100%; max-width: 420px; resize: vertical; font-size: 13.5px; }
@media (max-width: 720px) { .ml-tags { justify-content: flex-start; } }

/* ---------- Нормы топлива */
.callout.warn { border-left-color: var(--critical); }
.callout.warn .callout-ic { background: var(--critical); }
.nr-car { padding: 12px 0; border-top: 1px solid var(--border); }
.nr-car:first-of-type { border-top: 0; padding-top: 2px; }
.nr-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.nr-car.none .nr-head b { color: var(--text-2); }
.nr-climate { align-self: end; padding-bottom: 6px; }
.nr-hist { list-style: none; margin: 10px 0 0; padding: 0; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.nr-hist li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.nr-formula { font: 600 15px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; margin: 4px 0 12px; overflow-wrap: anywhere; }
.nr-help td:nth-child(2) { white-space: nowrap; font-variant-numeric: tabular-nums; }
.nr-help td { vertical-align: top; }
/* значение хуже / лучше нормы (перерасход, рост к прошлому месяцу) */
.lv-bad { color: var(--critical); }
.lv-good { color: var(--good-text); }
.nr-help td { white-space: normal; min-width: 140px; }
.nr-help td:nth-child(2) { white-space: nowrap; min-width: 0; }
.nr-fuels { display: inline-flex; gap: 4px; flex-wrap: wrap; }
@media (min-width: 720px) { .nf-grid .nr-wide { grid-column: span 2; } }

/* ---------------------------------------------------------------- водители */
.drv-ic { display: inline-block; flex: none; width: 12px; height: 12px; margin-right: 5px; vertical-align: -1px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='4.6' r='3.1'/%3E%3Cpath d='M1.8 15.2c0-3.6 2.8-5.9 6.2-5.9s6.2 2.3 6.2 5.9z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='4.6' r='3.1'/%3E%3Cpath d='M1.8 15.2c0-3.6 2.8-5.9 6.2-5.9s6.2 2.3 6.2 5.9z'/%3E%3C/svg%3E") center / contain no-repeat; }
.lv-car-drv { display: flex; align-items: center; font-size: 12.5px; color: var(--text-2); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.lv-badge.drv { color: var(--text); text-decoration: none; }
.lv-badge.drv:hover { border-color: var(--accent); }
.lv-badge.drv .drv-ic { width: 13px; height: 13px; margin-right: 0; background: var(--accent); border-radius: 0; }
.drv-name { display: inline-flex; align-items: center; font-weight: 600; }
.drv-warn { color: var(--st-idle); font-weight: 600; }
tr.drv-off td { color: var(--muted); }
tr.drv-off .badge { margin-left: 6px; }
.drv-acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; }
.drv-cars td { vertical-align: top; }
@media (max-width: 640px) {
  .drv-cars, .drv-cars tbody { display: block; }
  .drv-cars thead { display: none; }
  .drv-cars tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px 12px; padding: 10px 0; border-bottom: 1px solid var(--grid); }
  .drv-cars td { border: 0; padding: 0; white-space: normal; }
  .drv-cars td:first-child, .drv-cars td:last-child { grid-column: 1 / -1; }
  .drv-cars td[data-label]::before { content: attr(data-label); display: block; font-size: 11.5px; color: var(--text-2); }
  .drv-cars .drv-acts { justify-content: flex-start; }
}
.drv-cars-cell { white-space: normal; max-width: 280px; }
.drv-carlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 4px 14px; padding: 4px 0 2px; }
.drv-keys { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.drv-key { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 6px; align-items: center; width: 100%; }
@media (max-width: 640px) { .drv-key { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.drv-src.manual { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.drv-src.key, .drv-src.schedule { color: var(--good-text); border-color: color-mix(in srgb, var(--good) 45%, transparent); }
.drv-src.none { color: var(--critical); border-color: color-mix(in srgb, var(--critical) 45%, transparent); }
.drv-open { color: var(--good-text); font-weight: 600; }
.drv-dim { opacity: .4; }

/* ---------------------------------------------------------------- категории водителя */
.lic-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.lic-chip { display: inline-block; font-size: 12.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; color: var(--text);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 9%, transparent); }
.lic-chip.g-tr { border-color: color-mix(in srgb, var(--series-4) 55%, transparent); background: color-mix(in srgb, var(--series-4) 10%, transparent); }
.lic-chip.g-adr { border-color: color-mix(in srgb, var(--critical) 45%, transparent); background: color-mix(in srgb, var(--critical) 8%, transparent); }
.lic-chip.g-boat, .lic-chip.g-river { border-color: color-mix(in srgb, var(--series-3) 50%, transparent); background: color-mix(in srgb, var(--series-3) 9%, transparent); }
.lic-chip.g-pro, .lic-chip.g-op { border-color: var(--axis); background: var(--surface-2); }
/* срок каждой категории прав в карточке водителя */
.lic-terms { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.lic-term { display: inline-flex; align-items: center; gap: 6px; }
.lic-term .lic-chip { min-width: 38px; text-align: center; }
.lb-field .lic-term .input { width: 150px; }
.lic-fill { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin-top: 2px; }
.lic-cell-term { white-space: nowrap; }
.lic-dialog { width: min(760px, calc(100vw - 24px)); }
.lic-group { border-top: 1px solid var(--grid); padding: 8px 0; }
.lic-group summary { cursor: pointer; font-size: 14px; }
.lic-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 18px; margin-top: 8px; }
@media (max-width: 640px) { .lic-list { grid-template-columns: minmax(0, 1fr); } }
.lic-item { display: grid; grid-template-columns: auto 64px minmax(0, 1fr); gap: 8px; align-items: baseline; padding: 4px 0; cursor: pointer; font-size: 13px; }
.lic-item input { align-self: center; }
.lic-code { font-weight: 700; font-size: 13px; overflow-wrap: anywhere; }
.lic-code.g-pro, .lic-code.g-adr, .lic-code.g-boat, .lic-code.g-river, .lic-code.g-op { font-weight: 600; font-size: 12px; }
.lic-desc { color: var(--text-2); line-height: 1.35; }
.drv-cats-cell { white-space: normal; max-width: 300px; }

/* ---------------------------------------------------------------- графики смен и табель */
.sch-month { display: inline-flex; align-items: center; gap: 8px; }
.sch-month b { min-width: 130px; text-align: center; text-transform: capitalize; }
.sch-month .btn { padding: 3px 10px; }
.sch-wrap { max-height: 70vh; }
table.sch { border-collapse: separate; border-spacing: 0; font-size: 12px; }
table.sch th, table.sch td { padding: 0; border-bottom: 1px solid var(--grid); border-right: 1px solid var(--grid); text-align: center; }
table.sch .sch-name { position: sticky; left: 0; z-index: 2; background: var(--surface); text-align: left; padding: 6px 10px; min-width: 170px; white-space: nowrap; }
table.sch thead .sch-name { z-index: 3; }
.sch-day { min-width: 40px; padding: 4px 2px !important; line-height: 1.2; }
.sch-day b { display: block; font-size: 13px; color: var(--text); }
.sch-day span { display: block; font-size: 10.5px; color: var(--muted); font-weight: 400; }
.sch-day.we, .sch-cell.we { background: color-mix(in srgb, var(--text) 4%, var(--surface)); }
.sch-day.today { box-shadow: inset 0 -2px 0 var(--accent); }
.sch-cell { height: 36px; min-width: 40px; vertical-align: middle; line-height: 1.15; }
.sch-cell.edit { cursor: pointer; }
.sch-cell.edit:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
.sch-cell.today { box-shadow: inset 2px 0 0 var(--accent), inset -2px 0 0 var(--accent); }
.sch-cell.k-work { background: color-mix(in srgb, var(--c, var(--accent)) 16%, var(--surface)); }
.sch-cell.k-work b { display: block; font-size: 11.5px; }
.sch-cell.k-work span { display: block; font-size: 9.5px; color: var(--text-2); max-width: 44px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0 auto; }
.sch-cell.ts.k-work { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.sch-cell.ts-bad { background: color-mix(in srgb, var(--critical) 14%, var(--surface)) !important; }
.sch-code { color: var(--critical); font-size: 11.5px; }
.sch-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 12px; color: var(--text-2); }
.sch-chip { display: inline-flex; align-items: center; gap: 6px; }
.sch-chip i { width: 12px; height: 12px; border-radius: 3px; background: var(--c, var(--accent)); }
.sch-chip.code b { color: var(--critical); }
.sch-presets { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.sch-presets .chip { background: var(--page); font: inherit; font-size: 12px; }
.sch-preview { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; margin: 4px 0; }
.sch-pv { display: inline-block; width: 22px; text-align: center; font-size: 11px; font-weight: 700; border-radius: 4px; padding: 2px 0;
  background: color-mix(in srgb, var(--accent) 16%, transparent); }
.sch-pv.N { background: color-mix(in srgb, var(--series-4) 30%, transparent); }
.sch-pv.O { background: var(--surface-2); color: var(--muted); }
.sch-color { width: 60px; padding: 2px !important; height: 34px; }
th.ts-tot, td.ts-tot { min-width: 38px; padding: 4px 6px !important; font-weight: 600; background: var(--surface-2); }
/* сетки графика смен и табеля в общей таблице (1.55.0): содержимое дня — div.sch-cell внутри ячейки */
div.sch-cell { display: flex; flex-direction: column; align-items: center; justify-content: center; }
table.sch thead th:first-child { position: sticky; left: 0; z-index: 3; }
table.sch th.num { min-width: 38px; padding: 4px 6px !important; font-weight: 600; background: var(--surface-2); }
.sh-st.ok { color: var(--good-text); border-color: color-mix(in srgb, var(--good) 45%, transparent); }
.sh-st.late, .sh-st.left_early { color: var(--text); border-color: color-mix(in srgb, var(--st-idle) 60%, transparent); background: color-mix(in srgb, var(--st-idle) 12%, transparent); }
.sh-st.absent { color: var(--critical); border-color: color-mix(in srgb, var(--critical) 45%, transparent); }
.sh-st.overtime { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.sh-st.planned, .sh-st.ongoing, .sh-st.no_car { color: var(--text-2); }
.sh-out.day_off { color: var(--critical); border-color: color-mix(in srgb, var(--critical) 45%, transparent); }
.sh-wr.severe { color: var(--critical); border-color: color-mix(in srgb, var(--critical) 45%, transparent); font-weight: 600; }
.drv-code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; background: var(--surface-2); border-radius: 5px; padding: 1px 6px; }
.drv-hw { white-space: pre-line; color: var(--text-2); line-height: 1.55; }

/* ---------------------------------------------------------------- прицепы */
.trl-ic { display: inline-block; flex: none; width: 14px; height: 12px; margin-right: 5px; vertical-align: -1px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 14'%3E%3Crect x='1' y='1' width='15' height='8' rx='1'/%3E%3Crect x='16' y='6' width='3' height='1.6'/%3E%3Ccircle cx='5' cy='11.5' r='2.2'/%3E%3Ccircle cx='10.5' cy='11.5' r='2.2'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 14'%3E%3Crect x='1' y='1' width='15' height='8' rx='1'/%3E%3Crect x='16' y='6' width='3' height='1.6'/%3E%3Ccircle cx='5' cy='11.5' r='2.2'/%3E%3Ccircle cx='10.5' cy='11.5' r='2.2'/%3E%3C/svg%3E") center / contain no-repeat; }
.lv-badge.drv .trl-ic { background: var(--accent); margin-right: 0; }
.trl-svc { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.trl-svc-row { display: grid; grid-template-columns: minmax(0, 2fr) repeat(4, minmax(0, 1fr)) auto; gap: 6px; align-items: center; }
@media (max-width: 640px) { .trl-svc-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.trl-map { height: 360px; border-radius: 10px; overflow: hidden; }
.trl-state.hitched { color: var(--good-text); font-weight: 600; }
.trl-state.parked { color: var(--text-2); }
.trl-un { margin-left: 10px; }
.trl-svc > .link-btn { align-self: flex-start; }


/* ---------- доставка (раздел «Доставка»: день, клиенты и склады, отчёты) */
.dlv-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 14px; }
.dlv-day { display: flex; align-items: center; gap: 6px; }
.dlv-day .input { width: 150px; }
.dlv-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dlv-map { height: clamp(360px, 50vh, 520px); }
.dlv-pick-map { height: 300px; border-radius: 10px; border: 1px solid var(--border); overflow: hidden; background: var(--surface-2); }
.map-dot.dlv-n { display: flex; align-items: center; justify-content: center; }
.map-dot-label { color: #fff; font: 600 11px/1 system-ui, -apple-system, "Segoe UI", sans-serif; pointer-events: none; }
.map-dot.dlv-ok { box-shadow: 0 0 0 3px var(--good), 0 1px 3px rgba(0, 0, 0, .35); }
.map-dot.dlv-late { box-shadow: 0 0 0 3px var(--st-idle), 0 1px 3px rgba(0, 0, 0, .35); }
.map-dot.dlv-miss { box-shadow: 0 0 0 3px var(--critical), 0 1px 3px rgba(0, 0, 0, .35); }
.map-dot.dlv-cancel { opacity: .45; }
.map-dot.dlv-depot { border-radius: 5px; }
.map-dot.dlv-depot .map-dot-label { color: var(--surface); font-size: 12px; }
.dlv-table td { vertical-align: top; }
.dlv-table .select.dlv-st { font-size: 13px; padding: 3px 6px; }
.dlv-st.st-done { color: var(--good-text); font-weight: 600; }
.dlv-st.st-failed { color: var(--critical); font-weight: 600; }
.dlv-st.st-cancelled { color: var(--muted); }
.dlv-seq { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
  color: #fff; font-weight: 600; font-size: 12px; }
.dlv-move { white-space: nowrap; }
.dlv-move .link-btn { padding: 0 4px; font-size: 15px; }
.dlv-move .link-btn:disabled { opacity: .25; cursor: default; text-decoration: none; }
.dlv-fact { font-weight: 600; white-space: nowrap; }
.dlv-fact.ok { color: var(--good-text); }
.dlv-fact.late { color: var(--st-idle); }
.dlv-fact.miss { color: var(--critical); }
.dlv-fact.wait { color: var(--muted); font-weight: 400; }
.dlv-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.dlv-chip { font-size: 13px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--page); white-space: nowrap; }
.dlv-chip.ok { border-color: color-mix(in srgb, var(--good) 55%, transparent); }
.dlv-chip.warn { border-color: color-mix(in srgb, var(--st-idle) 65%, transparent); }
.dlv-chip.bad { border-color: color-mix(in srgb, var(--critical) 55%, transparent); }
.dlv-route-title { display: inline-flex; align-items: center; gap: 8px; }
.dlv-swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }
tr.dlv-cancelled { opacity: .55; }
.dlv-import-table { max-height: 320px; overflow: auto; margin-top: 6px; }
tr.dlv-bad-row td { background: color-mix(in srgb, var(--critical) 7%, transparent); }
.dlv-ok { color: var(--good-text); }
.dlv-import-table td { white-space: normal; }
/* доставка, этап 2: планирование */
.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.seg .btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.dlv-veh-list { display: flex; flex-direction: column; gap: 6px; max-height: 230px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; }
.dlv-veh { display: grid; grid-template-columns: minmax(170px, auto) 1fr auto; gap: 10px; align-items: center; }
@media (max-width: 640px) { .dlv-veh { grid-template-columns: 1fr; gap: 2px; } }
.dlv-hours { display: flex; align-items: center; gap: 6px; }
.dlv-hours .input { flex: 1; min-width: 0; }
.dlv-plan-actions { display: flex; align-items: center; gap: 10px; }
.dlv-plan-result { display: flex; flex-direction: column; gap: 6px; }
.dlv-plan-result p { margin: 4px 0; }
.dlv-plan-route summary { cursor: pointer; }
.dlv-plan-stops { margin: 6px 0 4px 22px; padding: 0; font-size: 13px; }
.dlv-plan-map { height: 380px; }
.dlv-chip.plan { border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
/* настройки → маршруты и адреса; поиск адреса в окнах доставки */
.rt-list { display: grid; grid-template-columns: minmax(150px, max-content) 1fr; gap: 6px 18px; margin: 0 0 8px; }
.rt-list dt { color: var(--text-2); }
.rt-list dd { margin: 0; }
@media (max-width: 640px) { .rt-list { grid-template-columns: 1fr; gap: 2px; } .rt-list dd { margin-bottom: 8px; } }
.rt-sched { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rt-rad { display: flex; flex-direction: column; gap: 6px; }
.rt-rad-f { display: grid; grid-template-columns: minmax(0, 220px) 96px auto; align-items: center; gap: 8px; }
.rt-rad-in { width: 96px; text-align: right; }
.rt-rad-act { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.rt-log pre { max-height: 320px; overflow: auto; font-size: 12px; background: var(--page); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; white-space: pre-wrap; }
.rt-geo-try { display: flex; gap: 8px; margin-top: 8px; max-width: 640px; }
.rt-geo-try .input { flex: 1; min-width: 0; }
.rt-geo-res ol { margin: 8px 0 0 20px; padding: 0; }
.rt-geo-res li { margin: 3px 0; }
.rt-regs { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.rt-reg { padding: 1px 9px; border: 1px solid var(--border); border-radius: 999px; background: var(--page); font-size: 13px; }
.rt-files { display: flex; flex-direction: column; gap: 2px; }
/* окно «Территория карты» */
.lb-dialog.rt-terr-dlg { width: min(1040px, calc(100vw - 24px)); }
.rt-terr { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 760px) { .rt-terr { grid-template-columns: minmax(0, 1fr); } }
.rt-terr-l, .rt-terr-r { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.rt-tree { height: min(52vh, 460px); overflow: auto; border: 1px solid var(--border); border-radius: 10px; padding: 4px; background: var(--page); }
.rt-node { display: flex; align-items: center; gap: 4px; padding: 3px 6px; border-radius: 6px; font-size: 14px; }
.rt-node:hover { background: var(--surface); }
.rt-node.on { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); font-weight: 600; }
.rt-tog { flex: none; width: 20px; height: 20px; padding: 0; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 12px; text-align: center; }
.rt-lab { display: flex; align-items: center; gap: 7px; min-width: 0; flex-wrap: wrap; cursor: pointer; }
.rt-lab input { margin: 0; }
.rt-path { color: var(--muted); font-size: 12px; font-weight: 400; }
.rt-size { margin-left: auto; padding-left: 10px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 400; }
.rt-selbox h3, .rt-est h3 { font-size: 15px; margin: 0 0 6px; }
.rt-sel { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.rt-sel li { display: flex; align-items: center; gap: 8px; padding: 5px 10px; border: 1px solid var(--border); border-radius: 8px; }
.rt-sel li .rt-size { margin-left: auto; }
.rt-url { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.rt-total { margin: 6px 0 0; font-weight: 600; }
.rt-url-add { display: flex; gap: 8px; }
.rt-url-add .input { flex: 1; min-width: 0; }
.rt-est { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--page); }
.rt-est:empty { display: none; }
.rt-est-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rt-est-head h3 { margin: 0; }
.rt-est-list { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.rt-est-list li { display: grid; grid-template-columns: 18px 1fr; gap: 6px; align-items: start; }
.rt-est-ic { font-weight: 700; text-align: center; }
.rt-est-ok .rt-est-ic { color: var(--good); }
.rt-est-tight .rt-est-ic { color: var(--serious); }
.rt-est-no .rt-est-ic, p.rt-est-no { color: var(--critical); }
.rt-est-info .rt-est-ic { color: var(--muted); }
.dlv-addr { display: flex; gap: 6px; }
.dlv-addr .input { flex: 1; min-width: 0; }
.dlv-geo-hits { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--border); border-radius: 10px; padding: 6px; max-height: 220px; overflow: auto; }
.dlv-geo-hit { text-align: left; background: none; border: 0; border-radius: 6px; padding: 5px 8px; font: inherit; color: var(--text); cursor: pointer; }
.dlv-geo-hit:hover { background: var(--wash); }

/* ---------- страницы без входа: водитель на телефоне (driver.html) и отслеживание получателем (track.html) */
body.pub-body { font-size: 15px; -webkit-tap-highlight-color: transparent; }
.pub-app { max-width: 720px; margin: 0 auto; padding: 0 12px calc(32px + env(safe-area-inset-bottom)); }
.pub-loading, .pub-empty { padding: 48px 8px; text-align: center; color: var(--text-2); }
.pub-empty h1 { font-size: 20px; margin: 0 0 8px; color: var(--text); }
.pub-top { position: sticky; top: 0; z-index: 5; margin: 0 -12px 10px; padding: calc(10px + env(safe-area-inset-top)) 12px 8px;
  background: var(--surface); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.pub-top-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pub-title { display: flex; flex-direction: column; min-width: 0; }
.pub-title b { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pub-lang { flex: none; padding: 4px 6px; }
.pub-tabs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; background: var(--surface-2); border-radius: 10px; padding: 2px; }
.pub-tab { font: inherit; font-weight: 600; color: var(--text-2); background: none; border: 0; border-radius: 8px; padding: 8px; cursor: pointer; }
.pub-tab.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.pub-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pub-chip { font: inherit; font-size: 14px; color: var(--text-2); background: var(--page); border: 1px solid var(--border); border-radius: 999px;
  padding: 7px 12px; cursor: pointer; }
.pub-chip.on { color: var(--text); font-weight: 600; border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.pub-banner { margin: 0 0 10px; padding: 8px 12px; border-radius: 10px; font-size: 14px;
  background: color-mix(in srgb, var(--serious) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--serious) 40%, transparent); }
.pub-toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50;
  max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 12px; background: var(--text); color: var(--page); font-size: 14px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .25); }
.pub-map { height: calc(100vh - 190px); min-height: 320px; border-radius: 12px; overflow: hidden; }
.pub-sheet { width: min(640px, 100vw); max-width: 100vw; max-height: 92vh; margin: auto auto 0; padding: 0; border: 0;
  border-radius: 18px 18px 0 0; background: var(--surface); color: var(--text); box-shadow: 0 -10px 40px rgba(0, 0, 0, .3); }
.pub-sheet::backdrop { background: rgba(10, 12, 16, .45); }
@media (min-width: 700px) { .pub-sheet { margin: auto; border-radius: 18px; } }
.pub-sheet-in { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px calc(18px + env(safe-area-inset-bottom)); }
.pub-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pub-sheet-head h2 { font-size: 17px; margin: 0; }
.pub-x { font-size: 20px; color: var(--muted); padding: 4px 8px; }
.pub-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.pub-choices .btn { font-size: 15px; padding: 12px; text-align: center; }
.pub-check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-2); }
.pub-field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--text-2); }
.pub-field .input { font-size: 16px; padding: 10px; width: 100%; box-sizing: border-box; }
.pub-field-row { display: flex; justify-content: space-between; align-items: center; }
.pub-go { font-size: 16px; padding: 14px; width: 100%; }
button.primary.danger { background: var(--critical); }
button.primary:disabled { opacity: .5; cursor: default; }

.drv-prog { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.drv-prog i { display: block; height: 100%; background: var(--good); border-radius: 3px; transition: width .3s; }
.drv-prog-text { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.drv-delay { padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.drv-delay.late { color: var(--critical); background: color-mix(in srgb, var(--critical) 12%, transparent); }
.drv-delay.early { color: var(--good-text, var(--good)); background: color-mix(in srgb, var(--good) 12%, transparent); }
.drv-list { display: flex; flex-direction: column; gap: 8px; }
.drv-stop { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.drv-stop.open { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: var(--shadow); }
.drv-stop.st-done, .drv-stop.st-failed, .drv-stop.st-done_queued, .drv-stop.st-failed_queued { opacity: .72; }
.drv-stop-head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px; font: inherit; color: inherit; text-align: left;
  background: none; border: 0; cursor: pointer; }
.drv-stop-head.static { cursor: default; }
.drv-seq { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; font-weight: 700; font-size: 14px;
  color: #fff; background: var(--muted); }
.drv-seq.st-next, .drv-seq.st-here { background: var(--accent); }
.drv-seq.st-done, .drv-seq.st-done_queued { background: var(--good); }
.drv-seq.st-failed, .drv-seq.st-failed_queued { background: var(--critical); }
.drv-stop.depot .drv-seq { background: var(--text); color: var(--page); }
.drv-stop-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.drv-stop-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.drv-stop-addr { font-size: 13px; color: var(--text-2); }
.drv-stop-when { display: flex; flex-direction: column; align-items: flex-end; text-align: right; flex: none; font-size: 14px; }
.drv-stop-when b.late { color: var(--critical); }
.drv-here { margin: 0 12px 8px; padding: 6px 10px; border-radius: 8px; font-weight: 600; font-size: 14px;
  background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.drv-info { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0 12px 10px; font-size: 14px; }
.drv-info dt { color: var(--text-2); }
.drv-info dd { margin: 0; overflow-wrap: anywhere; }
.drv-acts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 0 12px 10px; }
.drv-acts .btn { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 13px; padding: 9px 4px; text-align: center; }
.drv-acts .btn span { font-size: 20px; line-height: 1; }
.drv-big { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 12px 12px; }
.drv-big.one { grid-template-columns: 1fr; }
.drv-big button { font-size: 16px; padding: 14px 8px; min-height: 52px; }
.drv-photos { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 12px 10px; }
.pub-sheet .drv-photos { padding: 0; }
.drv-thumb { position: relative; width: 76px; height: 76px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: #fff; }
.drv-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.drv-thumb.sig img { object-fit: contain; }
.drv-thumb-x { position: absolute; top: 2px; right: 2px; width: 24px; height: 24px; border-radius: 50%; border: 0; font-size: 12px;
  color: #fff; background: rgba(0, 0, 0, .55); cursor: pointer; }
.drv-add-photo { width: 76px; height: 76px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font: inherit; color: var(--text-2); background: var(--page); border: 1px dashed var(--axis); border-radius: 10px; cursor: pointer; }
.drv-add-photo span:first-child { font-size: 22px; }
.drv-sign { width: 100%; height: 150px; border: 1px solid var(--axis); border-radius: 10px; background: #fff; touch-action: none; }
.drv-foot { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; }
.map-dot.drv-car { font-size: 14px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--series-2) 35%, transparent); }

.trk-card { display: flex; gap: 14px; align-items: flex-start; padding: 16px; margin-bottom: 12px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.trk-card h1 { font-size: 20px; margin: 0 0 4px; }
.trk-card p { margin: 0; color: var(--text-2); }
.trk-card.st-done { border-color: color-mix(in srgb, var(--good) 45%, var(--border)); }
.trk-card.st-failed, .trk-card.st-cancelled { border-color: color-mix(in srgb, var(--critical) 45%, var(--border)); }
.trk-card.st-on_way, .trk-card.st-arrived { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.trk-ic { font-size: 30px; line-height: 1; }
.trk-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; list-style: none; margin: 0 0 12px; padding: 0; font-size: 12px; color: var(--muted); }
.trk-steps li { border-top: 4px solid var(--surface-2); padding-top: 4px; }
.trk-steps li.on { border-color: var(--accent); color: var(--text); }
.trk-map { height: 300px; min-height: 0; margin-bottom: 12px; }
.trk-info { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0 0 12px; padding: 12px 16px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border); }
.trk-info dt { color: var(--text-2); }
.trk-info dd { margin: 0; }
.trk-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.trk-acts .btn { font-size: 15px; padding: 10px 14px; }
.trk-foot { text-align: center; }

/* ---------- доставка: ссылка водителю, подтверждение доставки, сообщения получателям */
.dlv-link-box { display: flex; gap: 8px; align-items: center; }
.dlv-link-box .input { flex: 1; min-width: 0; font-size: 13px; }
.dlv-qr { display: block; width: 180px; height: 180px; margin: 4px 0; background: #fff; padding: 8px; border-radius: 10px; border: 1px solid var(--border); }
.dlv-proof { border-top: 1px solid var(--border); padding-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.dlv-proof h3 { font-size: 14px; margin: 0; }
.dlv-proof-files { display: flex; flex-wrap: wrap; gap: 8px; }
.dlv-proof-files a { display: block; width: 96px; height: 96px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: #fff; }
.dlv-proof-files img { width: 100%; height: 100%; object-fit: cover; }
.dlv-proof-files a.sig img { object-fit: contain; }
.dlv-msgs { list-style: none; margin: 0; padding: 0; font-size: 13px; color: var(--text-2); }
.dlv-chip.link { cursor: pointer; }

.nf-h { font-size: 14px; margin: 14px 0 6px; }
.nf-event { padding: 6px 0; border-bottom: 1px solid var(--border); }
.nf-event:last-of-type { border-bottom: 0; }
.nf-inline { display: inline-flex; align-items: center; gap: 6px; margin-left: 12px; }
.nf-inline .input { width: 72px; }
.nf-sample { margin: 4px 0 0 24px; padding: 6px 10px; border-left: 3px solid var(--border); white-space: pre-wrap; }

/* доставка, этап 4: перестройка на ходу, время в пути по истории */
.dlv-reroute-cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 10px; }
.dlv-reroute-cmp > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--page); }
.dlv-reroute-cmp > div.good { border-color: color-mix(in srgb, var(--good) 50%, var(--border)); background: color-mix(in srgb, var(--good) 8%, var(--surface)); }
@media (max-width: 640px) { .dlv-reroute-cmp { grid-template-columns: 1fr; } }
.dlv-reroute-map { height: 280px; border-radius: 10px; overflow: hidden; }
.dlv-reroute-free { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; max-height: 160px; overflow: auto; }
.dlv-chip.warn.link { font: inherit; font-size: 13px; cursor: pointer; }
.drv-rerouted { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.dlvh-set { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; }
.dlvh-set .nf-inline .select { width: auto; }
.dlvh-table td.dlvh-cell b { font-variant-numeric: tabular-nums; }
.dlvh-table td.warn b { color: var(--serious); }
.dlvh-table td.bad b { color: var(--critical); }
.dlvh-table td.good b { color: var(--good-text, var(--good)); }
.dlvh-table td.weak b { color: var(--muted); font-weight: 400; }
.dlvh-table tr.dlvh-fleet td { border-top: 2px solid var(--border); font-weight: 600; }
.dlvh-table thead th[colspan] { text-align: center; border-bottom: 1px solid var(--border); }

/* тахограф: лента суток (вид занятости — цвет и высота, как на распечатке), загрузка файлов */
:root { --tc-drive: #e34948; --tc-work: #eda100; --tc-avail: #2a78d6; --tc-rest: #1baf7a; --tc-unknown: #c7ccd4; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --tc-drive: #e66767; --tc-work: #c98500; --tc-avail: #3987e5; --tc-rest: #199e70; --tc-unknown: #4a4a47; }
}
:root[data-theme="dark"] { --tc-drive: #e66767; --tc-work: #c98500; --tc-avail: #3987e5; --tc-rest: #199e70; --tc-unknown: #4a4a47; }
.tc-bar {
  position: relative; height: 22px; min-width: 240px; border-radius: 4px; overflow: hidden;
  background: repeating-linear-gradient(90deg, transparent 0, transparent calc(100% / 24 - 1px), var(--grid) calc(100% / 24 - 1px), var(--grid) calc(100% / 24)), var(--surface-2);
}
.tc-seg { position: absolute; bottom: 0; }
.tc-drive { background-color: var(--tc-drive); }
.tc-work { background-color: var(--tc-work); }
.tc-avail { background-color: var(--tc-avail); }
.tc-rest { background-color: var(--tc-rest); }
.tc-unknown { background-color: var(--tc-unknown); }
.tc-seg.tc-drive { height: 100%; }
.tc-seg.tc-work { height: 74%; }
.tc-seg.tc-avail { height: 52%; }
.tc-seg.tc-rest, .tc-seg.tc-unknown { height: 30%; }
.tc-manual { background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, .6) 0 3px, transparent 3px 6px); }
.tc-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 12px; font-size: 13px; color: var(--text-2); }
.tc-legend i { display: inline-block; width: 14px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.tc-drop { display: flex; align-items: center; gap: 14px; padding: 18px; border: 2px dashed var(--axis); border-radius: 12px; cursor: pointer; background: var(--page); }
.tc-drop.over, .tc-drop:hover, .tc-drop:focus-visible { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); outline: none; }
.tc-drop-ic { font-size: 28px; }
.tc-results { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; font-size: 13px; }
.tc-res.ok::before { content: "✓ "; color: var(--good-text); font-weight: 700; }
.tc-res.bad { color: var(--critical); }
.tc-set { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-end; }
.tc-set label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-2); }
.tc-set label.nf-mand { flex-direction: row; align-items: center; gap: 6px; }
.tc-set .input { width: 90px; }
.tc-set-foot { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.tc-pick { max-width: 220px; }

/* тахограф, этап 2: тяжесть нарушений, полосы лимитов */
.tc-sev { font-weight: 600; white-space: nowrap; }
.tc-sev-MI { background: color-mix(in srgb, var(--muted) 18%, var(--surface)); color: var(--text-2); }
.tc-sev-SI { background: color-mix(in srgb, var(--st-idle) 22%, var(--surface)); color: var(--text); }
.tc-sev-VSI { background: color-mix(in srgb, var(--serious) 28%, var(--surface)); color: var(--text); }
.tc-sev-MSI { background: var(--critical); color: #fff; }
.tc-meter-cell { min-width: 150px; }
.tc-meter { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin: 2px 0 4px; }
.tc-meter span { display: block; height: 100%; border-radius: 4px; background: var(--good); }
.tc-meter.warn span { background: var(--st-idle); }
.tc-meter.bad span { background: var(--critical); }
.tc-meter-cell { min-width: 120px; }
.tc-limits td { vertical-align: top; }

/* тахограф онлайн: вид занятости сейчас */
.tc-state { color: #fff; font-weight: 600; }
.tc-state.tc-drive { background: var(--tc-drive); }
.tc-state.tc-work { background: var(--tc-work); }
.tc-state.tc-avail { background: var(--tc-avail); }
.tc-state.tc-rest { background: var(--tc-rest); }
.tc-now { white-space: nowrap; }
tr.tc-second td { border-top: 0; padding-top: 0; }

/* тахограф, этап 4: приём файлов */
.tc-in-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
@media (max-width: 900px) { .tc-in-grid { grid-template-columns: minmax(0, 1fr); } }
.tc-in-block code { overflow-wrap: anywhere; }
.tc-in-block h3 { font-size: 15px; margin: 4px 0 4px; }
.tc-in-block h3 + p { margin-top: 0; }
.tc-in-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); align-items: center; gap: 8px; margin: 6px 0; font-size: 13px; color: var(--text-2); }
.tc-in-ctl { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tc-in-ctl .input { flex: 1 1 140px; min-width: 0; }
.tc-in-ctl .input.tc-short { flex: 0 0 110px; }
.tc-link { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
@media (max-width: 640px) { .tc-in-row { grid-template-columns: minmax(0, 1fr); } }
.good-text { color: var(--good-text); }

/* сельское хозяйство, этап 1: поля, севооборот */
.ag-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 14px; }
.ag-season { display: inline-flex; gap: 8px; align-items: center; font-size: 13px; color: var(--text-2); margin-right: 6px; }
.ag-chip { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.ag-chip > i { width: 12px; height: 12px; border-radius: 3px; flex: 0 0 12px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); }
.ag-chip small { color: var(--text-2); }
.lb-dialog.ag-wide { width: min(1180px, calc(100vw - 24px)); }
.lb-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ag-edit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 18px; }
.ag-edit-map { height: 420px; border-radius: 10px; overflow: hidden; }
.ag-draw-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.ag-area { font-size: 18px; padding-top: 6px; }
.ag-hist-row { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; }
.ag-import-pick { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 10px; }
.ag-import-pick .lb-field { margin: 0; }
.ag-srid { width: 110px; }
.ag-import { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; margin: 10px 0; }
.ag-import-list { max-height: 380px; overflow: auto; }
.ag-import-map { height: 380px; border-radius: 10px; overflow: hidden; }
.ag-crops { display: grid; gap: 6px; max-height: 50vh; overflow: auto; margin-bottom: 10px; }
.ag-crop-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.ag-crop-row input[type=color] { width: 40px; height: 32px; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: none; }
.ag-rot-table th:has(> .now), .ag-rot-table td.now { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.ag-rot-cell { min-width: 110px; }
.ag-rot-cell.pick { cursor: pointer; }
.ag-rot-cell.pick:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.ag-rot { display: inline-flex; flex-direction: column; gap: 1px; padding: 3px 8px 3px 10px; border-left: 4px solid var(--c); border-radius: 4px;
  background: color-mix(in srgb, var(--c) 16%, transparent); font-size: 13px; line-height: 1.25; }
.ag-rot small { color: var(--text-2); font-size: 11.5px; }
@media (max-width: 900px) { .ag-edit, .ag-import { grid-template-columns: minmax(0, 1fr); } .ag-edit-map { height: 320px; } }

/* сельское хозяйство, этап 2: обработки */
.ag-op-cell { display: inline-flex; align-items: center; gap: 6px; }
.ag-op-cell > i { width: 12px; height: 12px; border-radius: 3px; flex: 0 0 12px; }
.ag-op-sel { padding: 3px 6px; font-size: 13px; min-width: 120px; }
.ag-st { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; white-space: nowrap; background: var(--surface-2, rgba(127,127,127,.12)); color: var(--text-2); }
.ag-st-confirmed { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good-text); }
.ag-st-rejected { background: color-mix(in srgb, var(--st-offline) 15%, transparent); color: var(--st-offline); text-decoration: line-through; }
.ag-st-cell { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.ag-st-cell .link-btn { padding: 0 4px; font-size: 15px; opacity: .55; }
.ag-st-cell .link-btn.on, .ag-st-cell .link-btn:hover { opacity: 1; }

/* сельское хозяйство, этап 3: план работ, кампании */
.ag-camps { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.ag-camp-sub { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.ag-cs { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 12px; white-space: nowrap; background: rgba(127,127,127,.14); color: var(--text-2); }
.ag-cs-active { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.ag-cs-done { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good-text); }
.ag-cs-late, .ag-cs-waiting { background: color-mix(in srgb, var(--st-offline) 15%, transparent); color: var(--st-offline); }
.ag-prog { height: 10px; border-radius: 5px; background: rgba(127,127,127,.18); overflow: hidden; margin: 4px 0 10px; }
.ag-prog > i { display: block; height: 100%; background: var(--accent); border-radius: 5px; }
.ag-camp-done .ag-prog > i { background: var(--good); }
.ag-camp-late .ag-prog > i, .ag-camp-waiting .ag-prog > i { background: var(--st-offline); }
.ag-camp-late { border-color: color-mix(in srgb, var(--st-offline) 45%, var(--border)); }
.ag-prog.sm { display: inline-block; width: 60px; height: 6px; margin: 0 6px 0 0; vertical-align: middle; }
.ag-camp-nums { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 14px; margin-bottom: 6px; }
.ag-camp-nums b { font-size: 15px; }
.ag-camp-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 14px; }
.ag-fs { font-size: 12px; }
.ag-fs-done { color: var(--good-text); }
.ag-fs-started { color: var(--st-idle); }
.ag-area-in { width: 100px; }
.ag-pct { white-space: nowrap; }

/* сельское хозяйство, этап 4: уборка, паспорт поля */
.ag-w-in { width: 84px; padding: 3px 6px; }
.ag-store-map { height: 300px; border-radius: 10px; overflow: hidden; }
.ag-pass-head { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 0 0 10px; font-size: 14px; }
.ag-pass-ops { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin: 0 0 14px; }
.ag-pass-op { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px 8px 12px; border-left: 4px solid var(--c); border-radius: 6px;
  background: color-mix(in srgb, var(--c) 12%, transparent); font-size: 13px; }

/* ---------------------------------------------------------------- видеотелематика (video.js, media.js, cameras.js) */
:root { --vid-photo: #2f7fd0; --vid-video: #d0542f; --vid-audio: #7a6fd0; }
.vid-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr)); gap: 12px; }
.vid-fig { margin: 0; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.vid-fig figcaption { font-size: 13px; line-height: 1.35; min-width: 0; }
.vid-cap1 { display: flex; justify-content: space-between; gap: 6px; }
.vid-thumb { position: relative; aspect-ratio: 16 / 10; border-radius: 10px; overflow: hidden; background: var(--surface-2);
  border: 1px solid var(--border); cursor: pointer; display: grid; place-items: center; }
.vid-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vid-thumb:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.vid-thumb:hover img { filter: brightness(1.05); }
.vid-ph { color: var(--muted); display: grid; place-items: center; width: 100%; height: 100%; }
.vid-play { position: absolute; inset: auto 8px 8px auto; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 13px; padding-left: 2px; }
.vid-k-video .vid-ph, .vid-ico-video { color: var(--vid-video); }
.vid-k-photo .vid-ph, .vid-ico-photo { color: var(--vid-photo); }
.vid-k-audio .vid-ph, .vid-ico-audio { color: var(--vid-audio); }
.vid-ico { vertical-align: -3px; flex: none; }
.vid-ev { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 12px; background: color-mix(in srgb, var(--danger, #d64545) 14%, transparent);
  color: color-mix(in srgb, var(--danger, #d64545) 80%, var(--text)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.vid-starred { color: #e0a31e; }
.vid-kind { white-space: nowrap; }
td .vid-thumb { width: 92px; }
.vid-cell { display: inline-flex; align-items: center; gap: 3px; padding: 3px 7px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; font: inherit; }
.vid-cell:hover { border-color: var(--accent); }
.vid-cell small { font-size: 11px; color: var(--muted); }
.vid-viewer { width: min(1100px, calc(100vw - 24px)); }
.vid-body { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.vid-stage { min-height: 240px; display: grid; place-items: center; background: #0e0f11; border-radius: 12px; overflow: hidden; }
.vid-media { max-width: 100%; max-height: calc(100vh - 290px); display: block; }
.vid-audio-box { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 30px; color: #b8b2ff; }
.vid-loading, .vid-err { padding: 40px 20px; color: #c9ccd2; text-align: center; max-width: 520px; }
.vid-nav { min-width: 40px; font-size: 18px; }
.vid-info { display: flex; flex-direction: column; gap: 10px; }
.vid-facts { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: 14px; }
.vid-facts > * { min-width: 0; overflow-wrap: anywhere; }
.vid-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.vid-tools .input { flex: 1 1 220px; min-width: 0; }
.vid-star.on { color: #b77a00; border-color: #e0a31e; }
.vid-last { display: flex; gap: 10px; align-items: center; }
.vid-last .vid-thumb { width: 88px; flex: none; }
.vid-conn-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 12px 20px; }
.vid-conn { min-width: 0; }
.vid-conn p { margin: 4px 0 0; color: var(--text-2); }
.vid-conn code { overflow-wrap: anywhere; }
tr.clickable { cursor: pointer; }
/* объём бака: «по чеку больше, чем влезло» */
.lb-overfill { color: var(--critical); font-weight: 600; }
.lb-tank { grid-column: 1 / -1; margin-top: -4px; color: var(--text-2); }
.lb-tank.lb-tank-bad { color: var(--critical); font-weight: 600; }
.tank-cell { display: flex; flex-direction: column; gap: 2px; }
/* страховка и документы машин */
.vdoc-cell { text-align: left; font: inherit; padding: 0; }
.vdoc-matrix td { vertical-align: top; }
.vdoc-quick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: -4px 0 8px; }
.vdoc-dialog { width: min(720px, calc(100vw - 24px)); }
/* окно «Камера»: снимок по кнопке и живое видео (этап 3) */
.cam-ctl { width: min(960px, calc(100vw - 24px)); }
.cam-body { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.cam-top { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.cam-chs { display: flex; flex-wrap: wrap; gap: 6px; }
.cam-chs .chip { background: var(--surface); font: inherit; font-size: 13px; }
.cam-chs .chip.on { color: var(--text); font-weight: 600; border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.cam-chs .chip:disabled, .cam-chs[aria-disabled="true"] .chip { cursor: default; }
.cam-conn { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); margin-left: auto; }
.cam-conn i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.cam-conn.on i { background: var(--good); }
.cam-conn.off i { background: var(--st-offline); }
.cam-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.cam-actions .btn, .cam-actions button { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; padding: 7px 14px; }
.cam-actions button.primary .vid-ico { color: inherit; }
.cam-clip { display: inline-flex; align-items: center; gap: 6px; }
.cam-clip[hidden] { display: none; }
/* Настройки → Видео */
.vs-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); gap: 10px 16px; margin-bottom: 14px; }
.vs-fact { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
.vs-fact b { font-size: 18px; }
.vs-events { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: 6px 16px; }
.vs-token { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.vs-token .input { flex: 1 1 260px; min-width: 0; max-width: 420px; }
.num-in { width: 72px; }
.cam-hint { margin: 0; }
.cam-stage { min-height: 220px; aspect-ratio: 16 / 9; max-height: calc(100vh - 330px); }
.cam-stage .vid-media { width: 100%; height: 100%; object-fit: contain; max-height: none; }
.cam-status { font-size: 14px; min-height: 1em; }
.cam-status:empty { display: none; }
.cam-bar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.cam-bar:empty { display: none; }
.cam-onair { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--critical); }
.cam-onair i { width: 9px; height: 9px; border-radius: 50%; background: var(--critical); animation: cam-blink 1.2s ease-in-out infinite; }
@keyframes cam-blink { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .cam-onair i { animation: none; } }
.cam-open { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.req-st { white-space: nowrap; }
.req-timeout, .req-failed, .req-no_video { color: var(--critical); }
.req-sent, .req-queued, .req-live { color: var(--text-2); }
td.nowrap { white-space: nowrap; }
@media (max-width: 640px) {
  .cam-body .cam-stage { aspect-ratio: 4 / 3; max-height: 55vh; order: 0; }   /* не выше кнопок, как у просмотра снимков */
  .cam-conn { margin-left: 0; }
  .vid-body { grid-template-columns: 1fr 1fr; }
  .vid-stage { grid-column: 1 / -1; order: -1; }
  .vid-media { max-height: 60vh; }
}

/* ---------------------------------------------------------------- общественный транспорт (pt_*) */
.pt-badge { display: inline-block; min-width: 34px; padding: 2px 8px; border-radius: 6px; font-weight: 700; font-size: 13px; text-align: center; line-height: 1.5; }
.pt-map { height: clamp(380px, 60vh, 620px); }
.pt-map-wide { height: clamp(360px, 52vh, 560px); }
.pt-edit { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; margin-top: 12px; align-items: start; }
.pt-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pt-stops td, .pt-stops th { padding: 4px 6px; }
.pt-stops .input.mini { width: 64px; }
.pt-ctl { white-space: nowrap; }
.pt-ctl .link-btn { padding: 0 4px; }
.pt-add .input { width: 100%; }
.pt-actions { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.pt-ex { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.pt-ex-row { display: grid; grid-template-columns: 170px minmax(0, 220px) auto; gap: 8px; align-items: center; }
.pt-pick { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.pt-pick .lb-field { min-width: 240px; }
.pt-tt-head { display: flex; align-items: center; gap: 10px; margin: 4px 0 12px; }
.pt-tt table { font-variant-numeric: tabular-nums; }
.pt-tt th.pt-th { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.pt-tt td.pt-dep { font-weight: 700; cursor: pointer; }
.pt-tt td.pt-own { font-style: italic; }
.pt-url-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pt-url { flex: 1 1 420px; min-width: 0; font-family: ui-monospace, monospace; font-size: 13px; }
.pt-steps { margin: 10px 0 0; padding-left: 18px; color: var(--text-2); font-size: 13px; }
.pt-check { margin: 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 900px) {
  .pt-edit { grid-template-columns: minmax(0, 1fr); }
  .pt-ex-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
}
.lb-grid + .pt-actions { margin-top: 10px; }
.pt-days .chip { background: var(--surface); font: inherit; font-size: 13px; }
.pt-days .chip.on { color: var(--text); font-weight: 600; border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.lb-field > .btn { align-self: flex-start; }
.pt-st.ok { color: var(--st-moving, #1baf7a); border-color: currentColor; }
.pt-st.warn { color: var(--serious); border-color: currentColor; }
.pt-st.bad { color: var(--critical); border-color: currentColor; }
.pt-st.run { color: var(--accent); border-color: currentColor; }
.pt-ontime { color: var(--st-moving); }
.pt-veh .map-dot-label { font-size: 11px; font-weight: 700; color: #fff; }
.pt-arr { display: flex; flex-direction: column; gap: 6px; }
.pt-arr-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 10px; align-items: center; }
.pt-arr-head { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt-rt { color: var(--st-moving); font-size: 12px; }
.pt-sub { margin: 16px 0 8px; font-size: 15px; }
.pt-rt-table td { padding: 4px 6px; vertical-align: middle; }
.pt-rt-table .pt-url { width: 100%; min-width: 260px; }

/* ---------- табло на остановке (board.html): экран без входа, тёмное, крупно; ширина — от телефона до телевизора */
body.brd-body { margin: 0; background: #05070a; color: #f4f4f0; font-size: clamp(16px, 2.2vw, 40px); overflow: hidden; }
.brd-app { box-sizing: border-box; min-height: 100vh; display: flex; flex-direction: column; padding: 2.2vh 3vw; gap: 1.6vh; }
.brd-app.stale .brd-list { opacity: .45; }
.brd-loading, .brd-empty { margin: auto; text-align: center; color: #a9a9a2; font-size: 1.3em; }
.brd-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1em; border-bottom: 2px solid #2a2d33; padding-bottom: 1.2vh; }
.brd-stop { min-width: 0; display: flex; align-items: baseline; gap: .6em; flex-wrap: wrap; }
.brd-stop h1 { margin: 0; font-size: 1.6em; font-weight: 700; line-height: 1.15; }
.brd-code { color: #a9a9a2; font-size: .8em; }
.brd-clock { flex: none; font-size: 1.6em; font-weight: 700; font-variant-numeric: tabular-nums; color: #ffd24a; }
.brd-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.brd-row { display: grid; grid-template-columns: 4.2em minmax(0, 1fr) auto; align-items: center; gap: .8em; padding: 1.1vh 0; border-bottom: 1px solid #1c1f24; }
.brd-route { display: block; text-align: center; font-weight: 800; font-size: 1.15em; border-radius: .25em; padding: .1em .2em; }
.brd-dest { min-width: 0; display: flex; flex-direction: column; }
.brd-dest span { font-size: 1.1em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brd-dest small { color: #a9a9a2; font-size: .65em; }
.brd-when { font-size: 1.25em; font-variant-numeric: tabular-nums; text-align: right; min-width: 4.5em; }
.brd-when b { font-weight: 800; }
.brd-when small { font-size: .6em; color: #c9c9c2; }
.brd-when.live::before { content: ""; display: inline-block; width: .38em; height: .38em; margin-right: .35em; border-radius: 50%; background: #2fd38d;
  vertical-align: .2em; }
.brd-plan { color: #c9c9c2; }
.brd-now { color: #2fd38d; font-weight: 800; }
.brd-offline { margin: 0; color: #ff6b6b; font-size: .8em; }
.brd-alerts { margin-top: auto; background: #3a2a05; color: #ffe08a; border-radius: .3em; padding: .6em .8em; font-size: .8em; }
.brd-alerts p { margin: .2em 0; }
@media (orientation: portrait) { body.brd-body { font-size: clamp(16px, 4.2vw, 40px); } }

/* ---------- Табло: протоколы и ссылки */
.pt-proto th { text-align: left; white-space: nowrap; padding: 4px 10px 4px 0; font-weight: 600; vertical-align: middle; }
.pt-proto td { padding: 4px 8px 4px 0; vertical-align: middle; }
.pt-proto .input { width: 100%; min-width: 280px; }
.pt-ua { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- активы в помещениях */
.in-map { height: clamp(380px, 58vh, 620px); }
.in-fp { word-break: break-all; }
.in-map-mid { height: clamp(300px, 46vh, 460px); }
.in-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
.in-bar .input[type="search"] { min-width: 220px; flex: 1 1 220px; max-width: 360px; }
.in-sites { display: flex; flex-direction: column; gap: 12px; }
.in-site-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: baseline; margin-bottom: 6px; }
.in-link { display: flex; gap: 8px; align-items: center; }
.in-link .input { flex: 1; min-width: 0; }
.in-color { width: 64px; padding: 2px; height: 34px; }
.in-hist { margin-top: 8px; }
.in-hist-t td, .in-hist-t th { padding: 4px 8px; }
.lb-grid.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 900px) { .lb-grid.five { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.in-st { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.in-scan-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.in-scan-row .lb-field { min-width: 200px; }
.in-scan { flex: 1 1 240px; font-size: 16px; min-height: 40px; }
.in-cam { width: 100%; max-height: 60vh; background: #000; border-radius: 8px; }
.in-inv-act { white-space: nowrap; }
.in-inv-act .btn { min-width: 34px; }
/* колокольчик: «Принято» и трек в момент события */
.inbox-col { display: flex; flex-direction: column; align-items: stretch; }
.inbox-col > .inbox-row { border-bottom: 0; }
.inbox-col > .inbox-item { padding-bottom: 6px; }
.inbox-extra { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 0 14px 10px 48px; align-items: center; min-width: 0; }
.inbox-ack { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) { .inbox { position: fixed; left: 8px; right: 8px; top: 58px; width: auto; } }
.nf-pick { display: flex; flex-wrap: wrap; gap: 4px 14px; }

/* ---------- чеки со скриншотов (1.54.0) */
.rc-page { min-height: 60vh; }
.rc-page.rc-drop { outline: 2px dashed var(--accent); outline-offset: 6px; border-radius: 12px; }
.rc-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 14px; }
.rc-bar .primary { padding: 8px 16px; }
.rc-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; align-items: start; }
.rc-list { display: flex; flex-direction: column; gap: 6px; max-height: calc(100vh - 220px); overflow: auto; padding: 1px 2px 1px 1px; }
.rc-item { position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px; align-items: center; text-align: left;
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 6px 8px; cursor: pointer; }
.rc-item:hover { border-color: var(--axis); }
.rc-item.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.rc-item img { width: 44px; height: 64px; object-fit: cover; object-position: top; border-radius: 6px; background: var(--page); }
.rc-item-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.rc-item-main > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-item-main .badge { justify-self: start; width: fit-content; max-width: 100%; }
.rc-item-warn { position: absolute; top: 6px; right: 8px; width: 18px; height: 18px; border-radius: 50%; background: var(--critical); color: #fff;
  font: 700 12px/18px system-ui, sans-serif; text-align: center; }
@media (max-width: 1000px) {
  .rc-layout { grid-template-columns: minmax(0, 1fr); }
  .rc-list { flex-direction: row; overflow-x: auto; max-height: none; padding-bottom: 4px; }
  .rc-item { min-width: 220px; }
}
.rc-card { display: grid; grid-template-columns: minmax(240px, 340px) minmax(0, 1fr); gap: 18px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
@media (max-width: 760px) { .rc-card { grid-template-columns: minmax(0, 1fr); padding: 12px; } }
.rc-imgcol { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.rc-imgbox { position: relative; max-height: 72vh; overflow: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--page); }
.rc-imgbox img { display: block; width: 100%; height: auto; cursor: zoom-in; user-select: none; -webkit-user-drag: none; }
.rc-imgbox.zoom img { width: auto; max-width: none; cursor: zoom-out; }
.rc-imgbox.masking img { cursor: crosshair; touch-action: none; }
@media (max-width: 760px) { .rc-imgbox { max-height: 45vh; } }
.rc-sel { position: absolute; background: rgba(60, 60, 60, .55); outline: 2px solid var(--critical); pointer-events: none; }
.rc-imgact { display: flex; flex-wrap: wrap; gap: 8px; }
.rc-imgact .btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.rc-form { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.rc-cands { color: var(--text-2); margin-top: -4px; display: flex; flex-direction: column; gap: 2px; }
.rc-lines { display: flex; flex-direction: column; }
.rc-lhead, .rc-line { display: grid; grid-template-columns: 22px minmax(0, 1.2fr) minmax(0, 1.1fr) repeat(3, minmax(0, .8fr)); gap: 6px; align-items: center; }
.rc-lhead { font-size: 12px; color: var(--text-2); padding-bottom: 4px; }
.rc-lhead span:nth-child(2) { grid-column: 2; }
.rc-lhead .num { text-align: right; }
.rc-line { padding: 8px 0; border-top: 1px solid var(--grid); }
.rc-line > .rc-name { grid-column: 2 / -1; }
.rc-line > .rc-sp.m { display: none; }
.rc-line > .rc-notes { grid-column: 2 / -1; display: flex; flex-direction: column; gap: 2px; }
.rc-line .input, .rc-line .select { width: 100%; font-size: 13px; padding: 5px 7px; min-width: 0; }
.rc-line .input.num { text-align: right; }
.rc-line.rc-off .input, .rc-line.rc-off .select { opacity: .55; }
@media (max-width: 560px) {
  .rc-lhead { display: none; }
  .rc-line { grid-template-columns: 22px repeat(3, minmax(0, 1fr)); }
  .rc-line > .rc-sp.m { display: block; }
}
.rc-note { font-size: 12.5px; color: var(--text-2); }
.rc-note.check { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.rc-note.bad { color: var(--critical); font-weight: 600; }
.rc-warn { font-size: 13px; padding: 6px 10px; border-radius: 8px; border: 1px solid color-mix(in srgb, var(--st-idle) 55%, transparent);
  background: color-mix(in srgb, var(--st-idle) 10%, transparent); }
.rc-warn.bad { border-color: color-mix(in srgb, var(--critical) 50%, transparent); background: color-mix(in srgb, var(--critical) 8%, transparent); color: var(--critical); }
.rc-total { font-size: 14px; }
.rc-empty { padding: 30px 0; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.rc-icon { font-size: 14px; padding: 0 2px; }
.lb-dialog.rc-view { width: min(980px, calc(100vw - 24px)); }
.rc-view-body { display: grid; grid-template-columns: minmax(240px, 360px) minmax(0, 1fr); gap: 18px; }
@media (max-width: 760px) { .rc-view-body { grid-template-columns: minmax(0, 1fr); } }
.rc-view-info { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.rc-view-info table { width: 100%; font-size: 13px; }
.rc-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; margin: 0; font-size: 13px; }
.rc-facts dt { color: var(--text-2); }
.rc-facts dd { margin: 0; overflow-wrap: anywhere; }
.lb-receipt { display: flex; gap: 12px; align-items: flex-start; }
.lb-receipt .lb-file { padding: 0; cursor: pointer; }
.lb-history summary { cursor: pointer; color: var(--text-2); margin-top: 4px; }
.lb-open-act { display: inline-flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.drv-rc-img img { width: 44px; height: 60px; object-fit: cover; object-position: top; border-radius: 6px; border: 1px solid var(--border); display: block; }
.drv-rc-lines { display: flex; flex-direction: column; gap: 6px; padding: 4px 12px 10px; }
.drv-rc-line { display: grid; grid-template-columns: auto minmax(0, 1fr) 76px 92px; gap: 8px; align-items: center; font-size: 14px; }
.drv-rc-name { overflow: hidden; text-overflow: ellipsis; }
.drv-rc-line .input { width: 100%; padding: 6px 8px; font-size: 15px; text-align: right; }
.drv-stop-addr.good { color: var(--good-text); }
/* расписание в общей таблице (1.55.0): заголовок остановки — span.pt-th, своя выдача — класс строки */
.pt-tt th .pt-th { display: inline-block; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; vertical-align: bottom; }
.pt-tt tr.pt-own td.num { font-style: italic; }

/* Биллинг: тарифы и тариф аккаунта (billing_plans.js, billing_accounts.js) */
.bp-pair { display: flex; gap: 6px; }
.bp-pair .select { flex: none; width: auto; }
.bp-pair .input { min-width: 0; }
.bp-packs td, .bp-packs th { padding: 4px 8px; vertical-align: middle; }
.bp-packs .bp-price { width: 110px; }
.bp-cat { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.bp-plan { margin: 12px 0 14px; }
.bp-plan .bp-hist { margin-top: 12px; }
/* подпись поля с флажком в той же строке — поля ввода на одной линии с соседними */
.bp-label-row { display: flex; align-items: center; gap: 10px; }
.bp-label-row .nf-mand { font-size: 12px; }
.bp-label-row input[type="checkbox"] { margin: 0; }
/* значение без поля ввода — той же высоты, что поле */
.bp-static { padding: 7px 0; border: 1px solid transparent; font-size: 14px; line-height: normal; color: var(--text); }
.bp-acc-packs { display: flex; flex-direction: column; gap: 6px; }
.bp-pack { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.bp-pack.inc { color: var(--text-2); }
.bp-note { color: var(--accent); }
.bp-lines { border-collapse: collapse; min-width: min(100%, 520px); }
.bp-lines td { padding: 4px 10px 4px 0; }
.bp-lines .num { text-align: right; }
.bp-lines .bp-total td { font-weight: 600; border-top: 1px solid var(--border); padding-top: 6px; }
.bp-mstate { display: flex; gap: 28px; flex-wrap: wrap; margin: 4px 0 10px; }
.bp-mstate > div { display: flex; flex-direction: column; gap: 2px; }
.bp-mstate b { font-size: 18px; }
.bp-mstate .badge { align-self: flex-start; }
.bp-plus { color: var(--good-text); }
.bp-minus { color: var(--critical); }
.bp-ms-low { color: var(--accent); }
.bp-ms-credit, .bp-ms-over { color: var(--critical); border-color: color-mix(in srgb, var(--critical) 45%, transparent); }
tr.bp-reversed td { opacity: .55; text-decoration: line-through; }
tr.bp-reversed td:last-child, tr.bp-reversed td:nth-child(2) { text-decoration: none; }
.bp-entry { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin: 8px 0; }
.bp-period { margin-bottom: 14px; }
.bp-period .input { width: auto; }
/* биллинг: раздел не по тарифу */
.side a.locked { opacity: .55; }
.bp-locked p { margin: 4px 0; }
/* биллинг, этап 5: ступени доступа, полоса долга у клиента */
.bp-banner { margin: 0 0 12px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--border); border-left: 3px solid var(--accent); background: var(--surface); font-size: 14px; }
.bp-banner.debt { border-left-color: var(--critical); }
.bp-banner[hidden] { display: none; }
.bp-lvl-low { color: var(--accent); }
.bp-lvl-debt, .bp-lvl-closed, .bp-lvl-login, .bp-lvl-trackers { color: var(--critical); border-color: color-mix(in srgb, var(--critical) 45%, transparent); }
.bp-lvl-paused, .bp-lvl-off { color: var(--text-2); }
.bp-access .lb-grid { margin: 6px 0; }
.bp-danger { color: var(--critical); }
.bp-req { white-space: pre-wrap; font: inherit; margin: 0; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; }
.bp-pages { flex-basis: 100%; padding-left: 26px; }
/* биллинг 1.64.0: ремонт, сообщения владельцам */
.bp-repair { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.bm-to { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 8px; }
.bm-accounts { display: flex; flex-direction: column; gap: 4px; max-height: 240px; overflow: auto; margin: 0 0 10px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; }
.bm-body { white-space: pre-wrap; margin: 4px 0 10px; }
.bm-detail { margin-top: 12px; }
/* биллинг 1.65.0: счета */
.bp-inv-open { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.bp-inv-partial { color: var(--accent); }
.bp-inv-paid { color: var(--good); border-color: color-mix(in srgb, var(--good) 45%, transparent); }
.bp-inv-cancelled { color: var(--text-2); }
.bp-inv .tm-actions { flex-wrap: wrap; align-items: center; }
.bp-inv-act { display: inline-flex; gap: 12px; white-space: nowrap; }
.bp-note-cell { white-space: normal; min-width: 180px; max-width: 360px; }

/* ---------- рисование на карте (draw.js: mapbox-gl-draw под MapLibre — курсоры плагина на классах maplibregl-*) */
.maplibregl-map.mouse-pointer .maplibregl-canvas-container.maplibregl-interactive { cursor: pointer; }
.maplibregl-map.mouse-move .maplibregl-canvas-container.maplibregl-interactive { cursor: move; }
.maplibregl-map.mouse-add .maplibregl-canvas-container.maplibregl-interactive { cursor: crosshair; }
.maplibregl-map.mouse-move.mode-direct_select .maplibregl-canvas-container.maplibregl-interactive { cursor: grab; }
.maplibregl-map.mode-direct_select.feature-vertex.mouse-move .maplibregl-canvas-container.maplibregl-interactive { cursor: move; }
.maplibregl-map.mode-direct_select.feature-midpoint.mouse-pointer .maplibregl-canvas-container.maplibregl-interactive { cursor: cell; }
.maplibregl-map.mode-direct_select.feature-feature.mouse-move .maplibregl-canvas-container.maplibregl-interactive { cursor: move; }
.maplibregl-ctrl-group:empty { display: none; }   /* кнопки плагина не используются — его пустая группа не видна */
/* поиск адреса: кнопка справа сверху, поле и варианты — слева от неё */
.gs-ctrl { position: relative; }
.gs-btn { display: grid !important; place-items: center; color: #333; }
:root[data-theme="dark"] .gs-btn { color: #e8e8e6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .gs-btn { color: #e8e8e6; } }
.gs-btn[aria-expanded="true"] { color: var(--accent); }
.gs-panel { position: absolute; top: 0; right: calc(100% + 8px); width: min(320px, calc(100vw - 90px)); display: flex;
  flex-direction: column; gap: 6px; padding: 6px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  color: var(--text); box-shadow: 0 4px 16px rgba(0, 0, 0, .25); font-size: 13px; }
.gs-panel[hidden], .gs-hits[hidden] { display: none; }
.gs-input { width: 100%; box-sizing: border-box; }
.gs-hits { display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow: auto; }
.gs-hit { text-align: left; background: none; border: 0; border-radius: 6px; padding: 5px 8px; font: inherit; color: var(--text); cursor: pointer; }
.gs-hit:hover, .gs-hit[aria-selected="true"] { background: var(--wash); }
.gs-note { padding: 4px 8px; }
.gs-pin { width: 26px; height: 34px; cursor: pointer; background: var(--pin, #d03b3b);
  clip-path: path('M13 0C5.8 0 0 5.6 0 12.6 0 22 13 34 13 34s13-12 13-21.4C26 5.6 20.2 0 13 0z');
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .5)); }
.gs-pin::after { content: ''; position: absolute; left: 8px; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: #fff; }
.gs-pop .maplibregl-popup-content { padding: 6px 10px; border-radius: 8px; background: var(--surface); color: var(--text); font-size: 13px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .3); }
.gs-pop.maplibregl-popup-anchor-bottom .maplibregl-popup-tip { border-top-color: var(--surface); }
/* измерения: кнопка справа сверху, панель — слева от неё */
.ms-ctrl { position: relative; }
.ms-btn { display: grid !important; place-items: center; color: #333; }
:root[data-theme="dark"] .ms-btn { color: #e8e8e6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ms-btn { color: #e8e8e6; } }
.ms-btn[aria-pressed="true"] { background: #f2c12e !important; color: #1a1a1a; }
.ms-panel { position: absolute; top: 0; right: calc(100% + 8px); width: 220px; display: flex; flex-direction: column; gap: 8px;
  padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .25); font-size: 13px; }
.ms-panel[hidden] { display: none; }
.ms-modes { display: flex; gap: 6px; }
.ms-mode { flex: 1; padding: 5px 6px; border: 1px solid var(--axis); border-radius: 8px; background: var(--page); color: var(--text);
  font: inherit; font-size: 12px; cursor: pointer; }
.ms-mode[aria-pressed="true"] { border-color: #c99a0c; background: rgba(242, 193, 46, .18); font-weight: 600; }
.ms-result { display: flex; flex-direction: column; gap: 2px; }
.ms-value { font-size: 18px; }
.ms-hint { margin: 0; }
.ms-label { padding: 1px 6px; border: 1px solid #f2c12e; border-radius: 6px; background: rgba(20, 22, 26, .85); color: #f2c12e;
  font-size: 12px; font-weight: 600; white-space: nowrap; pointer-events: none; }
/* панель рисования в окнах (draw.js drawToolbar): фигуры, «Вырезать» (нажата — следующая фигура станет дыркой),
   цвет и подпись выбранного объекта (план этажа) */
.dr-bar { display: flex; flex-direction: column; gap: 6px; }
.ag-draw-bar .btn[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--surface)); font-weight: 600; }
.dr-props { display: flex; gap: 6px; align-items: center; }
.dr-props[hidden] { display: none; }
.dr-color { width: 44px; height: 30px; padding: 2px; }
.dr-label { flex: 1; min-width: 0; }

/* Администрирование → Активность пользователей (1.100.0) */
table.ua-grp tr.ua-acc td { background: var(--surface-2); }
table.ua-grp tr.ua-acc.pick { cursor: pointer; }
table.ua-grp tr.ua-acc.pick:hover b { color: var(--accent); }
table.ua-grp td.ua-user { padding-left: 24px; }
table.ua-grp tr.ua-idle td { color: var(--text-2); }
.badge.ua-off { margin-left: 6px; }
.badge.ua-src-web { color: var(--accent); }
.ua-clip { display: inline-block; max-width: 320px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
