/* ============================================================
   Cargo PWA — дизайн-система (2026-08-20)
   Светлая fintech-тема. Мобильный приоритет, safe-areas, без zoom.
   ============================================================ */

@import url("/pwa/fonts/inter.css");

:root {
  /* Поверхности */
  --bg: #F4F5F7;
  --surface: #FFFFFF;
  --surface-2: #F8F9FB;
  --line: #E7EAF0;
  --line-strong: #D5DAE3;

  /* Текст */
  --ink: #10182B;
  --text: #212B42;
  --muted: #67728A;
  --faint: #98A1B5;

  /* Бренд */
  --brand: #4F46E5;
  --brand-strong: #4338CA;
  --brand-soft: #EEF0FE;
  --brand-ink: #3730A3;

  /* Семантика статусов */
  --ok: #079455;      --ok-soft: #E5F6EE;      /* оплачено, выдано, успех */
  --blue: #1570EF;    --blue-soft: #EAF2FE;    /* в пути */
  --cyan: #0A7EA4;    --cyan-soft: #E3F4FA;    /* прибыла в КР */
  --violet: #7A3AED;  --violet-soft: #F1EBFE;  /* в офисе, готово к выдаче */
  --amber: #B54708;   --amber-soft: #FEF2E4;   /* ожидание */
  --red: #D92D20;     --red-soft: #FEECEB;     /* долг, ошибка */
  --gray: #5B6478;    --gray-soft: #F0F2F5;    /* неактивное */

  /* Геометрия */
  --r-card: 18px;
  --r-md: 14px;
  --r-sm: 10px;
  --r-sheet: 22px;

  --shadow-card: 0 1px 2px rgba(16,24,40,.04), 0 2px 6px rgba(16,24,40,.05);
  --shadow-pop: 0 8px 28px rgba(16,24,40,.16);
  --shadow-fab: 0 6px 16px rgba(79,70,229,.38);

  --nav-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overscroll-behavior-y: none;
}
h1,h2,h3,h4,p { margin: 0; }
button { font: inherit; border: 0; background: none; padding: 0; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }

.icon { width: 22px; height: 22px; stroke: currentColor; stroke-width: 1.9; fill: none; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-sm { width: 18px; height: 18px; }
.icon-lg { width: 28px; height: 28px; }

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

/* ---------- Каркас страницы ---------- */
#app { min-height: 100dvh; display: flex; flex-direction: column; }

.page {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: calc(12px + var(--safe-t)) 16px calc(24px + var(--nav-h) + var(--safe-b));
  flex: 1;
}
.page--admin { max-width: 640px; }
.page--bare { padding-bottom: 24px; } /* без нижней навигации */

@media (min-width: 768px) {
  body { background: #EDEFF3; }
}

/* ---------- Шапка страницы ---------- */
.topbar {
  display: flex; align-items: center; gap: 10px;
  min-height: 48px; margin-bottom: 10px;
}
.topbar__title { font-size: 21px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; flex: 1; }
.topbar__sub { font-size: 13px; color: var(--muted); margin-top: -2px; }
.topbar__back {
  width: 40px; height: 40px; margin-left: -8px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px; color: var(--ink);
  transition: background .15s;
}
.topbar__back:active { background: var(--gray-soft); }
.topbar__action {
  position: relative;
  width: 42px; height: 42px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--ink); transition: background .15s;
}
.topbar__action:active { background: var(--gray-soft); }
.badge-dot {
  position: absolute; top: 9px; right: 9px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--red); border: 2px solid var(--surface);
}

/* ---------- Карточки ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  padding: 16px;
}
.card + .card, .card + .section, .section + .card { margin-top: 12px; }
.card--tap { cursor: pointer; transition: transform .12s, background .15s; }
.card--tap:active { transform: scale(.988); background: var(--surface-2); }
.card__title { font-size: 15px; font-weight: 600; color: var(--ink); }

.section { margin-top: 18px; }
.section__head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 0 2px 8px;
}
.section__title { font-size: 16px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
.section__link { font-size: 13.5px; font-weight: 600; color: var(--brand); cursor: pointer; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px;
  border-radius: var(--r-md);
  font-size: 15px; font-weight: 600;
  transition: background .15s, transform .12s, opacity .15s;
  user-select: none; -webkit-tap-highlight-color: transparent;
  width: 100%;
}
.btn:active { transform: scale(.98); }
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:active { background: var(--brand-strong); }
.btn--secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); }
.btn--secondary:active { background: var(--gray-soft); }
.btn--soft { background: var(--brand-soft); color: var(--brand-ink); }
.btn--danger { background: var(--red); color: #fff; }
.btn--ghost { background: transparent; color: var(--brand); min-height: 42px; width: auto; }
.btn--sm { min-height: 40px; padding: 0 14px; font-size: 14px; border-radius: 12px; width: auto; }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn--loading { position: relative; color: transparent !important; pointer-events: none; }
.btn--loading::after {
  content: ""; position: absolute; width: 20px; height: 20px;
  border: 2.5px solid rgba(255,255,255,.35); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite;
}
.btn--secondary.btn--loading::after, .btn--soft.btn--loading::after { border-color: rgba(79,70,229,.25); border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }

.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

/* ---------- Чипы статусов ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; line-height: 1.5;
  white-space: nowrap;
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip--ok     { background: var(--ok-soft); color: var(--ok); }
.chip--blue   { background: var(--blue-soft); color: var(--blue); }
.chip--cyan   { background: var(--cyan-soft); color: var(--cyan); }
.chip--violet { background: var(--violet-soft); color: var(--violet); }
.chip--amber  { background: var(--amber-soft); color: var(--amber); }
.chip--red    { background: var(--red-soft); color: var(--red); }
.chip--gray   { background: var(--gray-soft); color: var(--gray); }

/* ---------- Деньги ---------- */
.money { font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.money--lg { font-size: 30px; font-weight: 800; color: var(--ink); line-height: 1.15; }
.money--pos { color: var(--ok); }
.money--neg { color: var(--red); }

/* ---------- Формы ---------- */
.field { margin-bottom: 14px; }
.field__label { display: block; font-size: 13.5px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.input {
  width: 100%; min-height: 50px; padding: 12px 14px;
  border: 1.5px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 16px; /* не даёт iOS зумить */
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  -webkit-appearance: none; appearance: none;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3.5px var(--brand-soft); }
.input--error { border-color: var(--red); }
.input--error:focus { box-shadow: 0 0 0 3.5px var(--red-soft); }
.field__error { font-size: 13px; color: var(--red); margin-top: 5px; }
.field__hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
textarea.input { min-height: 84px; resize: vertical; }

.input-wrap { position: relative; }
.input-wrap .input { padding-left: 44px; }
.input-wrap > .icon {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--faint); pointer-events: none;
}

/* Сегментированный переключатель */
.segment {
  display: flex; background: var(--gray-soft);
  border-radius: var(--r-md); padding: 4px; gap: 4px;
}
.segment__btn {
  flex: 1; min-height: 40px; border-radius: 11px;
  font-size: 14px; font-weight: 600; color: var(--muted);
  transition: background .15s, color .15s;
}
.segment__btn.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-card); }

/* Тумблер */
.switch { position: relative; width: 50px; height: 30px; flex: none; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch__track {
  position: absolute; inset: 0; border-radius: 999px;
  background: var(--line-strong); transition: background .18s;
}
.switch__track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(16,24,40,.25);
  transition: transform .18s;
}
.switch input:checked + .switch__track { background: var(--brand); }
.switch input:checked + .switch__track::after { transform: translateX(20px); }

/* Чекбокс строки выбора */
.checkrow { display: flex; align-items: center; gap: 12px; cursor: pointer; min-height: 44px; }
/* C30: сам квадрат остаётся 24px (вид не меняем), но невидимая псевдо-обёртка
   доводит область нажатия до 44x44 — пальцем в 24px попадают не с первого раза. */
.checkrow .checkbox { position: relative; }
.checkrow .checkbox::before {
  content: ''; position: absolute; top: 50%; left: 50%;
  width: 44px; height: 44px; transform: translate(-50%, -50%);
}
.checkbox {
  width: 24px; height: 24px; border-radius: 8px; flex: none;
  border: 2px solid var(--line-strong); background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  transition: background .12s, border-color .12s;
}
.checkbox .icon { width: 15px; height: 15px; stroke-width: 3; color: #fff; opacity: 0; }
.checkrow.is-checked .checkbox { background: var(--brand); border-color: var(--brand); }
.checkrow.is-checked .checkbox .icon { opacity: 1; }

/* ---------- Списки ---------- */
.list { display: flex; flex-direction: column; }
.list > * + * { border-top: 1px solid var(--line); }
/* Слой подсветки: выходит за края строки, но её геометрию не трогает */
.row::before {
  content: ''; position: absolute; inset: 0 -14px; border-radius: 10px;
  background: transparent; transition: background .12s; pointer-events: none;
}
.row > * { position: relative; }
.row {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  min-height: 54px; padding: 10px 0;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.row__icon {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--gray-soft); color: var(--gray);
}
.row__body { flex: 1; min-width: 0; }
.row__title { font-size: 15px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__end { text-align: right; flex: none; }
.row__chevron { color: var(--faint); flex: none; }

/* ---------- Быстрые действия (сетка) ---------- */
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.quick {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 13px 4px 11px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  cursor: pointer; transition: transform .12s, background .15s;
  -webkit-tap-highlight-color: transparent;
}
.quick:active { transform: scale(.95); background: var(--surface-2); }
.quick__icon {
  width: 42px; height: 42px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand);
}
.quick__label { font-size: 11.5px; font-weight: 600; color: var(--text); text-align: center; line-height: 1.25; }

.quick-grid--admin { grid-template-columns: repeat(3, 1fr); }
.quick-grid--admin .quick { padding: 16px 6px 13px; }
.quick-grid--admin .quick__label { font-size: 12.5px; }

/* ---------- Сводка статусов (главная) ---------- */
.stat-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-card);
  padding: 12px 8px 10px; text-align: center; cursor: pointer;
  transition: transform .12s;
  -webkit-tap-highlight-color: transparent;
}
.stat:active { transform: scale(.96); }
.stat__num { font-size: 22px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat__label { font-size: 11.5px; font-weight: 600; color: var(--muted); margin-top: 1px; }
.stat--accent .stat__num { color: var(--violet); }

/* KPI админа */
.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-card);
  padding: 13px 14px;
}
.kpi__label { font-size: 12px; font-weight: 600; color: var(--muted); }
.kpi__value { font-size: 21px; font-weight: 800; color: var(--ink); margin-top: 2px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi__sub { font-size: 12px; color: var(--faint); margin-top: 1px; }
.kpi--alert .kpi__value { color: var(--red); }
.kpi--ok .kpi__value { color: var(--ok); }

/* ---------- Нижняя навигация ---------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: rgba(255,255,255,.94);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
}
.bottom-nav__inner {
  max-width: 520px; margin: 0 auto;
  display: flex; height: var(--nav-h);
}
.page--admin ~ .bottom-nav .bottom-nav__inner, .bottom-nav--admin .bottom-nav__inner { max-width: 640px; }
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--faint); -webkit-tap-highlight-color: transparent;
  transition: color .15s; cursor: pointer; min-width: 44px;
}
.nav-item__label { font-size: 10.5px; font-weight: 600; }
.nav-item.is-active { color: var(--brand); }
.nav-item--fab { position: relative; }
.nav-item--fab .nav-item__btn {
  width: 52px; height: 52px; border-radius: 17px;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-fab);
  margin-top: -22px;
  transition: transform .12s, background .15s;
}
.nav-item--fab:active .nav-item__btn { transform: scale(.94); background: var(--brand-strong); }
.nav-item--fab .nav-item__label { color: var(--brand); margin-top: 1px; }

/* ---------- Bottom sheet ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(16,24,43,.45);
  opacity: 0; transition: opacity .2s;
}
.sheet-backdrop.is-open { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 61;
  max-width: 560px; margin: 0 auto;
  background: var(--surface);
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  padding: 8px 20px calc(20px + var(--safe-b));
  transform: translateY(102%); transition: transform .26s cubic-bezier(.32,.72,.28,1);
  box-shadow: var(--shadow-pop);
  max-height: 88dvh; overflow-y: auto;
}
.sheet.is-open { transform: translateY(0); }
/* Шапка липкая: крестик должен оставаться доступным и в длинной прокручиваемой
   форме (массовый ввод весов — это десятки полей). */
.sheet__head { position: sticky; top: 0; z-index: 3; min-height: 34px; background: var(--surface); }
.sheet__handle { width: 40px; height: 4px; border-radius: 999px; background: var(--line-strong); margin: 6px auto 14px; }
.sheet__close {
  position: absolute; top: -5px; right: -10px;
  width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.sheet__close:active { background: var(--surface-2); }
.sheet__close:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.sheet__title { font-size: 18px; font-weight: 700; color: var(--ink); margin-bottom: 12px; padding-right: 36px; }

/* C29: элементы с role=button/checkbox фокусируются с клавиатуры — покажем это */
[role="button"]:focus-visible, [role="checkbox"]:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 8px;
}

/* ---------- Toast ---------- */
.toast-wrap {
  position: fixed; left: 16px; right: 16px;
  bottom: calc(var(--nav-h) + var(--safe-b) + 14px);
  z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
.toast {
  background: #1B2337; color: #fff;
  font-size: 14px; font-weight: 500;
  padding: 11px 18px; border-radius: 13px;
  box-shadow: var(--shadow-pop);
  display: flex; align-items: center; gap: 8px;
  max-width: 480px;
  animation: toast-in .22s cubic-bezier(.32,.72,.28,1);
}
.toast--ok .icon { color: #3DD68C; }
.toast--err { background: #B42318; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.97); } }

/* ---------- Таймлайн ---------- */
.timeline { padding: 2px 0 0 2px; }
.tl-item { display: flex; gap: 13px; position: relative; padding-bottom: 20px; }
.tl-item:last-child { padding-bottom: 2px; }
.tl-item::before {
  content: ""; position: absolute; left: 10.5px; top: 24px; bottom: 0;
  width: 2px; background: var(--line);
}
.tl-item:last-child::before { display: none; }
.tl-dot {
  width: 23px; height: 23px; border-radius: 50%; flex: none; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  background: var(--gray-soft); border: 2px solid var(--line-strong);
}
.tl-item.is-done .tl-dot { background: var(--ok); border-color: var(--ok); }
.tl-item.is-done .tl-dot .icon { width: 12px; height: 12px; stroke-width: 3.4; color: #fff; }
.tl-item.is-current .tl-dot { background: var(--brand); border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.tl-item.is-current .tl-dot::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff; }
.tl-title { font-size: 14.5px; font-weight: 600; color: var(--ink); line-height: 1.35; }
.tl-item.is-future .tl-title { color: var(--faint); font-weight: 500; }
.tl-date { font-size: 12.5px; color: var(--muted); margin-top: 1px; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 44px 20px; }
.empty__icon {
  width: 72px; height: 72px; margin: 0 auto 14px;
  border-radius: 22px; background: var(--gray-soft);
  display: flex; align-items: center; justify-content: center;
  color: var(--faint);
}
.empty__icon .icon { width: 32px; height: 32px; }
.empty__title { font-size: 16px; font-weight: 700; color: var(--ink); }
.empty__text { font-size: 13.5px; color: var(--muted); margin-top: 4px; max-width: 280px; margin-inline: auto; }
.empty .btn { margin-top: 16px; width: auto; }

/* ---------- Skeleton ---------- */
.skel {
  border-radius: 10px;
  background: linear-gradient(100deg, #ECEEF3 40%, #F6F7FA 50%, #ECEEF3 60%);
  background-size: 200% 100%;
  animation: skel 1.3s infinite linear;
}
@keyframes skel { to { background-position: -200% 0; } }

/* ---------- Аватар/код ---------- */
.code-pill {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 8px 5px 13px;
  font-size: 13.5px; font-weight: 700; color: var(--ink);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  font-variant-numeric: tabular-nums;
}
.code-pill .icon { width: 16px; height: 16px; color: var(--faint); }
.code-pill:active { background: var(--gray-soft); }

.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  background: var(--brand-soft); color: var(--brand-ink);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700;
}

/* ---------- QR ---------- */
.qr-box {
  background: #fff; border-radius: var(--r-card);
  padding: 22px; display: flex; justify-content: center;
}
.qr-box svg, .qr-box canvas { width: 100%; max-width: 260px; height: auto; image-rendering: pixelated; }

/* ---------- Сканер ---------- */
.scanner {
  position: relative; border-radius: var(--r-card); overflow: hidden;
  background: #0B0F1A; aspect-ratio: 3/4; max-height: 60dvh;
}
.scanner video { width: 100%; height: 100%; object-fit: cover; }
.scanner__frame {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.scanner__frame::before {
  content: ""; width: 64%; aspect-ratio: 1; border-radius: 20px;
  box-shadow: 0 0 0 200vmax rgba(6,10,20,.45);
  outline: 2.5px solid rgba(255,255,255,.9);
}
.scanner__hint {
  position: absolute; bottom: 14px; left: 0; right: 0;
  text-align: center; color: rgba(255,255,255,.85); font-size: 13.5px; font-weight: 500;
}
.scanner.is-hit .scanner__frame::before { outline-color: var(--ok); }

/* ---------- Разное ---------- */
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.hr-strong { height: 1px; background: var(--line-strong); margin: 14px -16px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.micro { font-size: 12px; }
.bold { font-weight: 700; color: var(--ink); }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.tac { text-align: center; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-code { font-variant-numeric: tabular-nums; letter-spacing: .015em; font-weight: 700; color: var(--ink); }

/* строка "ключ-значение" */
.kv { display: flex; justify-content: space-between; gap: 14px; padding: 8px 0; font-size: 14.5px; }
.kv__k { color: var(--muted); }
.kv__v { font-weight: 600; color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }
.kv--total { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 12px; }
.kv--total .kv__k { color: var(--ink); font-weight: 700; }
.kv--total .kv__v { font-size: 17px; font-weight: 800; }

/* Объявления */
.ann { border-left: 4px solid var(--brand); }
.ann--WARNING { border-left-color: var(--amber); }
.ann--IMPORTANT { border-left-color: var(--red); }
.ann--PROMOTION { border-left-color: var(--violet); }
.ann--SYSTEM { border-left-color: var(--gray); }

/* Success screen */
.success-hero { text-align: center; padding: 26px 0 8px; }
.success-hero__icon {
  width: 84px; height: 84px; margin: 0 auto 16px; border-radius: 50%;
  background: var(--ok-soft); color: var(--ok);
  display: flex; align-items: center; justify-content: center;
  animation: pop-in .34s cubic-bezier(.34,1.4,.44,1);
}
.success-hero__icon .icon { width: 40px; height: 40px; stroke-width: 2.4; }
@keyframes pop-in { from { transform: scale(.5); opacity: 0; } }

/* Login */
.login-wrap {
  min-height: 100dvh; display: flex; flex-direction: column;
  justify-content: center; padding: 24px 20px calc(24px + var(--safe-b));
  max-width: 440px; margin: 0 auto; width: 100%;
}
.login-logo {
  width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 14px;
  background: linear-gradient(135deg, var(--brand) 0%, #7C6CFF 100%);
  display: flex; align-items: center; justify-content: center;
  color: #fff; box-shadow: var(--shadow-fab);
}
.login-logo .icon { width: 32px; height: 32px; }

/* Языковой пикер и прочие мелкие меню */
.menu-list .row { padding: 12px 0; }

/* Segmented status tabs (посылки) */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px; margin: 0 -2px 12px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; padding: 8px 15px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: 13.5px; font-weight: 600; color: var(--muted);
  cursor: pointer; transition: background .15s, color .15s;
  display: flex; gap: 6px; align-items: center;
}
.tab__count { font-size: 12px; font-weight: 700; color: var(--faint); }
.tab.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.tab.is-active .tab__count { color: rgba(255,255,255,.7); }

/* Install page */
.install-step { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; }
.install-step__num {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  background: var(--brand-soft); color: var(--brand-ink);
  font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ============================================================
   ПЛАНШЕТ И ДЕСКТОП
   Мобильная вёрстка остаётся эталоном; здесь только расширение.
   ============================================================ */

/* Боковое меню существует всегда, но видно только на десктопе —
   так не нужен JS на ресайз и переключение остаётся мгновенным. */
.sidebar { display: none; }

/* ---------- Планшет: шире колонка, та же нижняя навигация ---------- */
@media (min-width: 768px) and (max-width: 1023.98px) {
  .page { max-width: 660px; }
  .page--admin { max-width: 720px; }
  .bottom-nav__inner { max-width: 660px; }
  .bottom-nav--admin .bottom-nav__inner { max-width: 720px; }
  .kpi-grid { grid-template-columns: repeat(4, 1fr); }
  .quick-grid--admin { grid-template-columns: repeat(6, 1fr); }
}

/* ---------- Десктоп ---------- */
@media (min-width: 1024px) {
  body { background: #EEF0F4; }

  #app {
    display: grid;
    grid-template-columns: 256px minmax(0, 1fr);
    max-width: 1560px;
    margin: 0 auto;
    min-height: 100dvh;
    background: var(--bg);
  }

  .bottom-nav { display: none; }
  .sidebar { display: flex; }

  .page, .page--admin, .page--bare {
    max-width: none;
    padding: 26px 34px 52px;
  }
  /* Вход и установка рендерятся без бокового меню — занимают всю ширину сетки */
  #app > .login-wrap, #app > .page--bare { grid-column: 1 / -1; }
  /* контент не растягиваем на всю ширину монитора — читать невозможно */
  .page > * { max-width: 1080px; }

  /* Шторки на десктопе — обычные модальные окна по центру */
  .sheet {
    left: 50%; right: auto; bottom: auto; top: 50%;
    width: min(560px, 92vw);
    margin: 0;
    border-radius: 20px;
    padding: 22px 24px 24px;
    max-height: 86vh;
    transform: translate(-50%, -46%);
    opacity: 0;
    transition: opacity .18s ease, transform .18s ease;
  }
  .sheet.is-open { transform: translate(-50%, -50%); opacity: 1; }
  .sheet__handle { display: none; }
  .sheet__head { min-height: 26px; }
  .sheet__close { top: -9px; right: -12px; }

  .toast-wrap { left: auto; right: 26px; bottom: 26px; align-items: flex-end; }

  /* Плотность: на широком экране помещается больше */
  .kpi-grid { grid-template-columns: repeat(4, 1fr); }
  .quick-grid { grid-template-columns: repeat(4, 1fr); max-width: 620px; }
  .quick-grid--admin { grid-template-columns: repeat(6, 1fr); max-width: none; }
  .stat-strip { max-width: 620px; }

  /* Две колонки там, где сценарий этого просит (выдача, главная) */
  .cols-2 {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
  }
  .cols-2 > * { min-width: 0; margin-top: 0; }
  .cols-2 .section:first-child { margin-top: 0; }
  /* Панель расчёта не должна уезжать вверх, пока кассир листает список посылок */
  .col-sticky { position: sticky; top: 26px; }

  /* Камера: на мониторе вертикальный кадр во весь экран выглядит дико */
  .scanner { max-width: 480px; aspect-ratio: 4 / 3; margin-inline: auto; max-height: none; }
  /* рамка меньше, иначе подсказка внизу налезает на неё */
  .scanner__frame::before { width: 54%; }
  /* кнопки под сканером не растягиваем во всю ширину монитора.
     display:flex обязателен: у inline-flex поля auto не центрируют */
  .scanner ~ .btn { display: flex; max-width: 480px; margin-inline: auto; }
  .scanner ~ .card { max-width: 480px; margin-inline: auto; }

  /* QR клиента: на десктопе карточка по центру, а не во весь экран */
  .qr-box { max-width: 420px; margin-inline: auto; }
  .qr-card { max-width: 460px; margin-inline: auto; }

  .topbar__title { font-size: 24px; }
  .login-wrap { max-width: 420px; }
}

/* Подписи кнопок, которые на узком экране только мешают */
@media (max-width: 479.98px) { .btn-label { display: none; } }

/* Ниже 1024px .cols-2 — обычный поток, поэтому отступы задаём вручную */
.cols-2 > * + * { margin-top: 12px; }

/* Блоки только для широкого экрана */
.desktop-only { display: none; }
@media (min-width: 1024px) { .desktop-only { display: block; } }

/* ---------- Наведение мышью (на тачах не применяется) ---------- */
@media (hover: hover) and (pointer: fine) {
  .card--tap:hover { background: var(--surface-2); border-color: var(--line-strong); }
  /* Подсветку рисует псевдо-слой, а не отрицательные поля самой строки:
     margin-inline: -16px сдвигал содержимое строки под курсором на 16px,
     и при прокрутке колесом строки «прыгали и увеличивались». */
  .row:hover::before { background: var(--surface-2); }
  .quick:hover { background: var(--surface-2); border-color: var(--line-strong); }
  .stat:hover { border-color: var(--line-strong); }
  .btn--primary:hover { background: var(--brand-strong); }
  .btn--secondary:hover { background: var(--gray-soft); }
  .btn--soft:hover { background: #E4E7FD; }
  .btn--danger:hover { filter: brightness(.94); }
  .tab:hover { color: var(--ink); }
  .tab.is-active:hover { color: #fff; }
  .code-pill:hover { background: var(--gray-soft); }
  .topbar__action:hover { background: var(--gray-soft); }
  .section__link:hover { text-decoration: underline; }
}

/* Клавиатурная навигация — на десктопе ею реально пользуются */
:focus-visible { outline: 2.5px solid var(--brand); outline-offset: 2px; border-radius: 8px; }

/* ---------- Боковое меню ---------- */
.sidebar {
  flex-direction: column;
  position: sticky;
  top: 0;
  align-self: start;
  height: 100dvh;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 18px 12px 16px;
}
/* На невысоком окне пунктов меню больше, чем помещается, и они растягивали
   всю страницу: на экране выдачи из-за этого прокручивался контент, хотя
   расчёт и кнопка обязаны стоять на месте. Меню листается само. */
.sidebar__nav { overflow-y: auto; min-height: 0; scrollbar-width: thin; }
.sidebar__brand {
  display: flex; align-items: center; gap: 11px;
  padding: 4px 10px 20px;
}
.sidebar__logo {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  background: linear-gradient(135deg, var(--brand) 0%, #7C6CFF 100%);
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.sidebar__logo .icon { width: 21px; height: 21px; }
.sidebar__name { font-size: 15.5px; font-weight: 800; color: var(--ink); letter-spacing: -.01em; }
.sidebar__role { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.sidebar__nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.sidebar__group {
  font-size: 11px; font-weight: 700; color: var(--faint);
  text-transform: uppercase; letter-spacing: .04em;
  padding: 16px 12px 6px;
}
.side-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 12px;
  color: var(--muted); font-weight: 600; font-size: 14.5px;
  transition: background .15s, color .15s;
  cursor: pointer;
}
.side-item .icon { width: 20px; height: 20px; }
.side-item.is-active { background: var(--brand-soft); color: var(--brand-ink); }
.side-item__badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--red); color: #fff;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.sidebar__foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.sidebar__user { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.sidebar__user .avatar { width: 34px; height: 34px; font-size: 13px; }

/* ---------- Панель действий: кнопки с подписями, а не голые иконки ---------- */
.actionbar {
  display: flex; gap: 8px;
  overflow-x: auto; scrollbar-width: none;
  padding: 2px; margin: 0 -2px 12px;
  -webkit-overflow-scrolling: touch;
}
.actionbar::-webkit-scrollbar { display: none; }
.actionbar__btn { flex: none; white-space: nowrap; }

@media (min-width: 768px) {
  .actionbar { flex-wrap: wrap; overflow: visible; }
}

/* Активные фильтры */
.filter-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 8px 4px 11px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line-strong);
  font-size: 12.5px; font-weight: 600; color: var(--ink);
  cursor: pointer; transition: background .15s;
  -webkit-tap-highlight-color: transparent;
}
.filter-chip .icon { color: var(--faint); }
.filter-chip:active { background: var(--gray-soft); }
@media (hover: hover) and (pointer: fine) {
  .filter-chip:hover { background: var(--red-soft); border-color: var(--red); color: var(--red); }
  .filter-chip:hover .icon { color: var(--red); }
}

/* Штрих-код на этикетке клиента */
.barcode-box { background: #fff; border-radius: var(--r-md); padding: 12px; text-align: center; }
.barcode-box svg { width: 100%; max-width: 300px; height: auto; margin-inline: auto; }

/* ---------- Замок приложения: ПИН и биометрия ---------- */
.lock {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: calc(24px + var(--safe-t)) 20px calc(24px + var(--safe-b));
  overflow-y: auto;
}
.lock__wrap {
  width: 100%; max-width: 340px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.lock__icon {
  width: 64px; height: 64px; border-radius: 20px; margin-bottom: 16px;
  background: linear-gradient(135deg, var(--brand) 0%, #7C6CFF 100%);
  display: flex; align-items: center; justify-content: center; color: #fff;
  box-shadow: var(--shadow-fab);
}
.lock__icon .icon { width: 30px; height: 30px; }
.lock__title { font-size: 20px; font-weight: 800; color: var(--ink); }
.lock__hint { font-size: 13.5px; color: var(--muted); margin-top: 6px; line-height: 1.45; }
.lock__err { font-size: 13.5px; color: var(--red); font-weight: 600; margin-top: 10px; min-height: 18px; }
.lock__later {
  margin-top: 22px; font-size: 13.5px; font-weight: 600; color: var(--brand);
  padding: 10px 14px; border-radius: 12px;
}

.pindots { display: flex; gap: 14px; justify-content: center; margin-top: 22px; }
.pindot {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--line-strong); background: transparent;
  transition: background .12s, border-color .12s, transform .12s;
}
.pindot.is-on { background: var(--brand); border-color: var(--brand); transform: scale(1.08); }
.pindots.is-error .pindot { border-color: var(--red); animation: pinshake .3s; }
@keyframes pinshake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* Своя клавиатура: системная закрывает пол-экрана, а ПИН вводят помногу раз */
.pinpad {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 12px; margin-top: 28px; width: 100%;
}
.pinkey {
  min-height: 62px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: 24px; font-weight: 700; color: var(--ink);
  box-shadow: var(--shadow-card);
  display: flex; align-items: center; justify-content: center;
  transition: transform .1s, background .12s;
  -webkit-tap-highlight-color: transparent;
}
.pinkey:active { transform: scale(.94); background: var(--gray-soft); }
.pinkey--soft { background: transparent; border-color: transparent; box-shadow: none; color: var(--brand); }
@media (hover: hover) and (pointer: fine) {
  .pinkey:hover { background: var(--gray-soft); }
}

/* Экран разблокировки перекрывает всё, включая окно про уведомления */
.lock--top { z-index: 120; }

/* Выбор варианта одним тапом: причина отката статуса, тариф за килограмм.
   Крупная цель — за прилавком тычут пальцем и в спешке, мелкий чекбокс
   промахивается. Активный вариант виден цветом, а не еле заметной рамкой. */
.pickchips { display: flex; flex-wrap: wrap; gap: 8px; }
.pickchip {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 0 14px; border-radius: var(--r-md);
  border: 1.5px solid var(--line); background: var(--surface);
  color: var(--text); font-size: 15px; font-weight: 700; line-height: 1;
  cursor: pointer; white-space: nowrap; -webkit-tap-highlight-color: transparent;
  transition: background .12s, border-color .12s, color .12s;
}
.pickchip.is-active {
  border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink);
}
.pickchip:active { transform: scale(.97); }
.pickchip--ghost { border-style: dashed; color: var(--muted); font-weight: 600; }

/* Ставка за килограмм прямо в строке посылки. Своя ставка выделена цветом —
   кассир должен видеть исключения, не вчитываясь в цифры. */
.ratepill {
  min-width: 56px; min-height: 40px; padding: 0 10px; border-radius: var(--r-sm);
  border: 1.5px solid var(--line); background: var(--surface-2);
  color: var(--muted); font-size: 15px; font-weight: 700; line-height: 1;
  cursor: pointer; flex: none; -webkit-tap-highlight-color: transparent;
}
.ratepill.is-own { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.ratepill:active { transform: scale(.96); }

/* ---------- Панель массовых действий ----------
   Была чёрной плитой во всю ширину: тяжело выглядит и уезжает вверх при
   прокрутке — кассир выделял заказы, листал список и терял кнопки из виду.
   Теперь светлая, с брендовой каймой, и прилипает к верху рабочей области. */
.selbar {
  position: sticky; top: 0; z-index: 12;
  padding: 11px 14px; margin-bottom: 10px;
  border-radius: var(--r-md);
  background: var(--brand-soft);
  border: 1.5px solid color-mix(in srgb, var(--brand) 35%, transparent);
  box-shadow: 0 6px 18px rgba(16, 24, 43, .07);
}
.selbar__count { font-weight: 700; color: var(--brand-ink); font-size: 14px; }
.selbar__clear {
  font-size: 12.5px; font-weight: 600; flex: none;
  color: var(--brand); background: none; border: 0; cursor: pointer; padding: 2px 4px;
}
.selbar__btn { background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); }
.selbar__btn .icon { color: var(--brand); }
@media (hover: hover) and (pointer: fine) {
  .selbar__btn:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
  .selbar__btn:hover .icon { color: #fff; }
  .selbar__clear:hover { text-decoration: underline; }
}

/* Окно поверх окна: нижнее отодвигаем вглубь и притеняем. Иначе две карточки
   лежат внахлёст и непонятно, в какой из них сейчас нажимать.
   Правило идёт после .sheet.is-open — специфичность та же, побеждает последнее. */
.sheet.is-behind {
  transform: translateY(-10px) scale(.955);
  filter: brightness(.94) saturate(.9);
  pointer-events: none;
  transition: transform .26s cubic-bezier(.32,.72,.28,1), filter .2s;
}
/* На мониторе окно центрируется через translate(-50%, -50%). Если задать
   только scale, центрирование теряется и нижнее окно уезжает вбок — именно
   так две карточки и расползались по экрану. Сдвиг обязан остаться. */
@media (min-width: 1024px) {
  .sheet.is-behind { transform: translate(-50%, -50%) scale(.94); }
}

/* ---------- Экран выдачи на мониторе ----------
   Раньше страница прокручивалась целиком: при 30-60 посылках тариф, оплата,
   расчёт и кнопка «Подтвердить оплату и выдачу» уезжали за экран, и кассир
   листал туда-обратно. Теперь прокручивается только список посылок. */
/* На телефоне вложенная прокрутка неудобна — там страница листается целиком.
   Высоту на мониторе ставит fitList() в admin_pickup.js: она считается от
   реального положения списка, а не от угаданной константы. */
.pickup-list .checkrow.is-hit { background: var(--brand-soft); }
/* Экран выдачи. Телефон — обычный поток, всё листается страницей. */
.pickup-cols > * + * { margin-top: 12px; }

@media (min-width: 1024px) {
  /* Две колонки: слева клиент и посылки, справа тариф, оплата, расчёт и
     кнопка выдачи — всё, что нужно кассиру для денег, в одном столбце.
     Третью колонку пробовали: на экране становится пусто и некрасиво. */
  .page > .pickup-wide { max-width: 1240px; }

  .pickup-cols {
    display: grid; gap: 16px; align-items: start;
    grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr);
    grid-template-areas: "list pay" "list calc";
    grid-template-rows: auto 1fr;
    gap: 12px 16px;
  }
  .pickup-cols > * { margin-top: 0; }
  .pickup-col-list { grid-area: list; }
  .pickup-side { grid-area: pay; display: flex; flex-direction: column; }
  .pickup-side__foot { grid-area: calc; display: flex; flex-direction: column; gap: 10px; }
  .pickup-side__foot > .btn { flex: none; }

  .pickup-list { overflow-y: auto; scrollbar-width: thin; }

  /* Плотнее по вертикали: тариф, оплата и расчёт обязаны поместиться в один
     экран, иначе вводить деньги приходится прокруткой. */
  .pickup-side .section { margin-top: 10px; }
  .pickup-side .section:first-child { margin-top: 0; }
  .pickup-side .card { padding: 11px 14px; }
  .pickup-side .section__head { margin-bottom: 5px; }
  .pickup-side__foot .card { padding: 11px 14px; }
}

/* ---------- График на главной админки ----------
   Своя реализация вместо библиотеки: график здесь один, а любая готовая
   тянет от 60 КБ до мегабайта — на складском интернете это заметно. */
.chart { padding: 14px 16px 12px; }
.chart__row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; }
.chart__tabs { display: flex; gap: 6px; flex-wrap: wrap; }
/* На телефоне восемь кнопок переносом занимают четыре строки и отжимают сам
   график вниз. Листаем их в одну строку, как панель действий в заказах. */
@media (max-width: 767.98px) {
  .chart__tabs {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    -webkit-overflow-scrolling: touch; padding-bottom: 2px;
  }
  .chart__tabs::-webkit-scrollbar { display: none; }
  .chart__tab { flex: none; }
  .chart__row { flex-direction: column; align-items: stretch; gap: 6px; }
}
.chart__tab {
  padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted);
  font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap;
  -webkit-tap-highlight-color: transparent; transition: background .12s, color .12s, border-color .12s;
}
.chart__tab--sm { font-size: 12px; padding: 6px 10px; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.chart__tab--sm .icon { width: 14px; height: 14px; }
.chart__tab.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
@media (hover: hover) and (pointer: fine) {
  .chart__tab:not(.is-active):hover { background: var(--surface-2); color: var(--ink); }
}

.chart__sum { display: flex; align-items: baseline; gap: 10px; margin: 14px 0 2px; flex-wrap: wrap; }
.chart__total { font-size: 30px; font-weight: 800; color: var(--ink); letter-spacing: -.02em; line-height: 1; }
.chart__delta { font-size: 12.5px; font-weight: 700; }
.chart__delta.is-up { color: var(--ok); }
.chart__delta.is-down { color: var(--red); }
.chart__delta.is-flat { color: var(--faint); font-weight: 600; }

.chart__maxline { font-size: 11.5px; color: var(--faint); font-weight: 600; margin-bottom: 2px; }
.chart__plot { position: relative; }
.chart__svgwrap { display: block; }
.chart__svg { display: block; width: 100%; height: 150px; overflow: visible; }
.chart__area { opacity: 0; animation: chartFade .5s .18s ease forwards; }
@keyframes chartFade { to { opacity: 1; } }

.chart__hit { position: absolute; inset: 0; cursor: crosshair; }
.chart__guide {
  position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line-strong);
  pointer-events: none; transform: translateX(-.5px);
}
.chart__dot {
  position: absolute; width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid var(--surface); pointer-events: none;
  transform: translate(-50%, -50%); box-shadow: 0 1px 4px rgba(16,24,43,.28);
}
.chart__tip {
  position: absolute; transform: translateX(-50%); pointer-events: none;
  background: var(--ink); color: #fff; font-size: 12px; font-weight: 700;
  padding: 5px 9px; border-radius: 8px; white-space: nowrap;
}
.chart__axis {
  display: flex; justify-content: space-between;
  font-size: 11.5px; color: var(--faint); font-weight: 600; margin-top: 6px;
}
.chart__skel { height: 178px; border-radius: var(--r-md); background: var(--surface-2); }
.chart__empty {
  height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; color: var(--faint); font-size: 13px; font-weight: 600;
}
.chart__empty .icon { color: var(--line-strong); width: 26px; height: 26px; }

/* Плитки слева узкой колонкой, график занимает освободившееся место справа.
   На телефоне — обычный поток: плитки, под ними график. */
.stats-row { margin-top: 12px; }
.stats-row > * + * { margin-top: 12px; }
@media (min-width: 1024px) {
  .stats-row {
    display: grid; gap: 12px; align-items: start;
    grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  }
  .stats-row > * + * { margin-top: 0; }
  .stats-row .stat-strip { margin-top: 0; }
  .stats-row .stat-strip + .stat-strip { margin-top: 12px; }
  .chart__svg { height: 190px; }
}

/* ---------- Отслеживание груза ----------
   Карточка на главной клиента, сразу после баланса. Компактная, с мягким
   градиентом и анимированным значком — но без мельтешения: человек открывает
   приложение по десять раз в день. */
.trk-card {
  position: relative; overflow: hidden;
  border-radius: var(--r-card); padding: 15px 16px 14px;
  background: linear-gradient(135deg, #F7F8FF 0%, #EEF0FE 55%, #E9ECFD 100%);
  border: 1px solid color-mix(in srgb, var(--brand) 20%, transparent);
  box-shadow: 0 10px 24px -14px rgba(79, 70, 229, .45);
}
.trk-card__glow {
  position: absolute; right: -44px; top: -56px; width: 168px; height: 168px;
  border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(79,70,229,.20), transparent 68%);
}
.trk-card__top { display: flex; align-items: center; gap: 13px; position: relative; }
.trk-card__title { font-size: 16.5px; font-weight: 800; color: var(--ink); letter-spacing: -.01em; }
.trk-card__sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.trk-card__way { display: flex; align-items: center; gap: 5px; margin-top: 7px; flex-wrap: wrap; }
.trk-card__way .icon { width: 14px; height: 14px; color: var(--brand); }
.trk-card__place { font-size: 13px; font-weight: 700; color: var(--brand-ink); }
.trk-card__dest { font-size: 13px; font-weight: 600; color: var(--muted); }
.trk-card__cta {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 7px;
  width: 100%; min-height: 44px; margin-top: 13px; border: 0; cursor: pointer;
  border-radius: var(--r-md); background: var(--brand); color: #fff;
  font-size: 14.5px; font-weight: 700; -webkit-tap-highlight-color: transparent;
  box-shadow: 0 6px 16px -8px rgba(79,70,229,.9);
  transition: background .14s, transform .1s;
}
.trk-card__cta .icon { width: 17px; height: 17px; }
.trk-card__cta:active { transform: scale(.985); }
@media (hover: hover) and (pointer: fine) { .trk-card__cta:hover { background: var(--brand-strong); } }

/* Значок: грузовик едет, точка пульсирует, пунктир дороги ползёт */
.trk-art { flex: none; width: 66px; height: 52px; }
.trk-art svg { width: 100%; height: 100%; overflow: visible; }
.trk-art__road { stroke: color-mix(in srgb, var(--brand) 28%, transparent); stroke-width: 2.5; stroke-linecap: round; fill: none; }
.trk-art__road--dash { stroke: var(--brand); stroke-width: 2.5; stroke-dasharray: 5 9; animation: trkRoad 2.4s linear infinite; opacity: .65; }
@keyframes trkRoad { to { stroke-dashoffset: -28; } }
.trk-art__body { fill: var(--brand); }
.trk-art__cab { fill: var(--brand-strong); }
.trk-art__wheel { fill: #2A2F45; }
.trk-art__truck { animation: trkDrive 3.6s ease-in-out infinite; }
@keyframes trkDrive { 0%,100% { transform: translateX(-3px); } 50% { transform: translateX(4px); } }
.trk-art__dot { fill: var(--brand); }
.trk-art__pulse { fill: var(--brand); opacity: .22; transform-origin: 58px 16px; animation: trkPulse 2.2s ease-out infinite; }
@keyframes trkPulse { 0% { transform: scale(.55); opacity: .35; } 70% { transform: scale(1.25); opacity: 0; } 100% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .trk-art__road--dash, .trk-art__truck, .trk-art__pulse { animation: none; }
}

/* ---------- Экран карты ---------- */
.trk-map {
  position: relative; height: 46vh; min-height: 280px; max-height: 460px;
  margin-top: 12px; border-radius: var(--r-card); overflow: hidden;
  border: 1px solid var(--line); background: var(--surface-2);
}
.trk-map__skel { position: absolute; inset: 0; background: linear-gradient(100deg, var(--surface-2) 30%, #EFF1F5 50%, var(--surface-2) 70%); background-size: 220% 100%; animation: skel 1.3s linear infinite; }
.trk-map__fail { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 600; text-align: center; padding: 16px; }
.trk-map__fail .icon { color: var(--amber); }
.maplibregl-map { font: inherit; }

.trk-pin { width: 30px; height: 30px; position: relative; }
.trk-pin__core { position: absolute; inset: 9px; border-radius: 50%; background: var(--brand); border: 2.5px solid #fff; box-shadow: 0 2px 8px rgba(16,24,43,.35); }
.trk-pin__wave { position: absolute; inset: 0; border-radius: 50%; background: var(--brand); opacity: .25; animation: trkPulse 2.2s ease-out infinite; }
.trk-truck { width: 30px; height: 30px; filter: drop-shadow(0 2px 5px rgba(16,24,43,.4)); transition: opacity .3s; }
.trk-truck svg { width: 100%; height: 100%; fill: var(--brand); stroke: #fff; stroke-width: 1.2; }

.trk-switch { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-top: 12px; }
.trk-switch::-webkit-scrollbar { display: none; }
.trk-switch__btn {
  flex: none; padding: 8px 13px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 13px; font-weight: 700; color: var(--muted);
}
.trk-switch__btn.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }

.trk-status { display: flex; align-items: center; gap: 11px; }
.trk-status__icon {
  flex: none; width: 42px; height: 42px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
}
.trk-status__icon .icon { width: 22px; height: 22px; }
.trk-status__title { font-size: 16px; font-weight: 800; color: var(--ink); }
.trk-status__sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; white-space: normal; }
.trk-last { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.trk-last__name { font-size: 17px; font-weight: 800; color: var(--brand-ink); margin-top: 3px; }
.trk-note {
  display: flex; gap: 8px; align-items: flex-start; margin-top: 12px;
  font-size: 11.5px; color: var(--faint); line-height: 1.45; white-space: normal;
}
.trk-note .icon { flex: none; color: var(--faint); margin-top: 1px; }

.trk-steps { padding: 6px 16px; }
.trk-step { display: flex; gap: 12px; align-items: flex-start; padding: 9px 0; position: relative; }
.trk-step + .trk-step::before {
  content: ''; position: absolute; left: 5px; top: -13px; width: 2px; height: 22px;
  background: var(--line);
}
.trk-step.is-passed + .trk-step::before, .trk-step.is-current + .trk-step::before { background: var(--brand); opacity: .35; }
.trk-step__dot { flex: none; width: 12px; height: 12px; border-radius: 50%; margin-top: 3px; background: var(--surface); border: 2px solid var(--line-strong); }
.trk-step.is-passed .trk-step__dot { background: var(--brand); border-color: var(--brand); }
.trk-step.is-current .trk-step__dot { background: var(--brand); border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 22%, transparent); }
.trk-step__name { font-size: 14.5px; font-weight: 700; color: var(--muted); }
.trk-step.is-passed .trk-step__name { color: var(--ink); }
.trk-step.is-current .trk-step__name { color: var(--brand-ink); font-weight: 800; }
.trk-step__sub { font-size: 11.5px; color: var(--faint); margin-top: 1px; }
.trk-ev { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 7px 0; }
.trk-ev + .trk-ev { border-top: 1px solid var(--line); }
.trk-ev__name { font-size: 14px; font-weight: 700; color: var(--ink); }

/* Блок отслеживания партии в админке */
.ptrack { padding: 14px 16px; }
.ptrack__chain { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.ptrack__node { font-size: 13px; font-weight: 600; color: var(--faint); }
.ptrack__node.is-passed { color: var(--ink); }
.ptrack__node.is-current {
  color: #fff; background: var(--brand); border-radius: 999px;
  padding: 3px 10px; font-weight: 700;
}
.ptrack__arrow { color: var(--line-strong); font-size: 12px; }
.ptrack__cur { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.ptrack__curname { font-size: 18px; font-weight: 800; color: var(--brand-ink); margin-top: 2px; }
.ptrack__form { display: flex; gap: 8px; align-items: flex-end; margin-top: 12px; flex-wrap: wrap; }
.ptrack__hist { margin-top: 12px; }
.ptrack__hist summary { font-size: 12.5px; font-weight: 700; color: var(--brand); cursor: pointer; }
.ptrack__ev { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; font-size: 13px; }
.ptrack__ev + .ptrack__ev { border-top: 1px solid var(--line); }

/* Редактор маршрута */
.rt-list { padding: 4px 14px; }
.rt-row { display: flex; align-items: center; gap: 11px; padding: 10px 0; }
.rt-row + .rt-row { border-top: 1px solid var(--line); }
.rt-num {
  flex: none; width: 26px; height: 26px; border-radius: 9px;
  background: var(--brand-soft); color: var(--brand-ink);
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 800;
}
.rt-name { font-size: 15px; font-weight: 700; color: var(--ink); }
.rt-sub { font-size: 11.5px; color: var(--faint); margin-top: 1px; }
.rt-arrows { display: flex; flex-direction: column; gap: 2px; flex: none; }
.rt-arrow {
  width: 30px; height: 24px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.rt-arrow:disabled { opacity: .35; cursor: default; }
.rt-map { position: relative; height: 220px; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.rt-found { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.rt-found__item {
  text-align: left; padding: 8px 10px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface-2); font-size: 13.5px;
}

/* Настройка уведомлений */
.nrules { padding: 4px 16px; }
.nrule { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.nrule + .nrule { border-top: 1px solid var(--line); }
.nrule.is-off .nrule__name { color: var(--muted); }
.nrule__name { font-size: 15px; font-weight: 700; color: var(--ink); }
.nrule__sub { font-size: 11.5px; color: var(--faint); margin-top: 1px; }
.nrule__chans { font-size: 12px; color: var(--brand); font-weight: 600; margin-top: 3px; }
.nrule.is-off .nrule__chans { color: var(--faint); font-weight: 500; }
.nprev { margin-top: 14px; }
.nprev__card {
  border-radius: var(--r-md); padding: 12px 14px;
  background: var(--surface-2); border: 1px dashed var(--line-strong);
}
.nprev__title { font-size: 14.5px; font-weight: 700; color: var(--ink); white-space: normal; }
.nprev__body { font-size: 13px; color: var(--muted); margin-top: 3px; white-space: normal; }

/* Центр уведомлений */
.ntf { transition: background .15s; }
.ntf.is-new { background: color-mix(in srgb, var(--brand) 5%, transparent); margin-inline: -16px; padding-inline: 16px; border-radius: 10px; }
.ntf__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); flex: none; margin-top: 6px; }
.badge-num {
  position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px;
  padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff;
  font-size: 11px; font-weight: 800; line-height: 18px; text-align: center;
  border: 2px solid var(--bg);
}
.rt-del {
  flex: none; width: 36px; height: 36px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--red);
  display: flex; align-items: center; justify-content: center; padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.rt-del:disabled { opacity: .3; cursor: default; color: var(--faint); }
@media (hover: hover) and (pointer: fine) {
  .rt-del:not(:disabled):hover { background: var(--red-soft); border-color: var(--red); }
}

/* Итог пополнения баланса */
.dep-ok { display: flex; align-items: center; gap: 13px; }
.dep-ok__icon {
  flex: none; width: 46px; height: 46px; border-radius: 15px;
  background: var(--ok-soft); color: var(--ok);
  display: flex; align-items: center; justify-content: center;
}
.dep-ok__icon .icon { width: 26px; height: 26px; stroke-width: 3; }
.dep-ok__title { font-size: 18px; font-weight: 800; color: var(--ink); }
.rt-edit {
  flex: none; width: 36px; height: 36px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--brand);
  display: flex; align-items: center; justify-content: center; padding: 0;
  -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) and (pointer: fine) {
  .rt-edit:hover { background: var(--brand-soft); border-color: var(--brand); }
}

/* Управление статусами */
.st-list { padding: 4px 14px; }
.st-row { display: flex; align-items: center; gap: 10px; padding: 11px 0; }
.st-row + .st-row { border-top: 1px solid var(--line); }
.st-name { font-size: 15px; font-weight: 700; color: var(--ink); }
.st-sub { font-size: 11.5px; color: var(--faint); margin-top: 1px; white-space: normal; }
.st-dot { flex: none; width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.st-dot--gray { background: var(--gray); }
.st-dot--blue { background: var(--blue); }
.st-dot--cyan { background: var(--cyan); }
.st-dot--violet { background: var(--violet); }
.st-dot--amber { background: var(--amber); }
.st-dot--ok { background: var(--ok); }
.st-dot--red { background: var(--red); }

/* Как кнопка рассылки выглядит в Telegram */
.tg-btn {
  display: flex; align-items: center; justify-content: center;
  min-height: 42px; padding: 0 14px; border-radius: 10px;
  background: #E7F0F8; color: #1683C4; font-size: 14.5px; font-weight: 600;
  border: 1px solid #CFE3F2;
}

/* ============================================================
   Супер-админ (2026-08-24)
   ============================================================ */

/* Полоса «вы внутри чужой компании». Липнет к верху: уехав вместе со
   страницей, она перестаёт выполнять свою работу — напоминать, чья это касса. */
.suband {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 9px;
  margin: -4px -16px 12px; padding: 9px 16px;
  background: var(--amber-soft); color: var(--amber);
  border-bottom: 1px solid rgba(181,71,8,.18);
  font-size: 13px; line-height: 1.35;
}
.suband .icon { flex: none; }
.suband b { font-weight: 700; }
.suband__who { opacity: .85; }
.suband__btn {
  flex: none; border: 1px solid rgba(181,71,8,.35); background: transparent;
  color: var(--amber); font: inherit; font-weight: 700;
  padding: 4px 12px; border-radius: 999px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.suband__btn:active { background: rgba(181,71,8,.1); }

/* Пароль показывается один раз — крупно, моноширинно, целиком выделяемый */
.su-pass {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--surface-2); border: 1px dashed var(--line-strong);
  border-radius: var(--r-md); padding: 16px 18px;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 21px; font-weight: 700; color: var(--ink);
  letter-spacing: .04em; word-break: break-all; cursor: pointer;
  -webkit-tap-highlight-color: transparent; user-select: all;
}
.su-pass:active { background: var(--gray-soft); }
.su-pass .icon { flex: none; color: var(--faint); }

/* Предупреждение в списке компаний */
.su-warn {
  display: flex; align-items: flex-start; gap: 10px;
  margin-top: 12px; padding: 13px 15px;
  background: var(--amber-soft); border-color: rgba(181,71,8,.2);
  color: var(--amber); font-size: 13.5px; line-height: 1.4;
}
.su-warn .icon { flex: none; margin-top: 1px; }

/* Переключатель в форме: тянем на всю ширину карточки, без внутреннего отступа
   строки списка — иначе тумблер уезжает от края и ломает ритм полей */
.su-switchrow { cursor: pointer; padding-left: 0; padding-right: 0; }
