/* pages — стили раздела «Аналитика и страницы»: аналитика, список мест, отчёты, компании, пользователи, импорт.
   Только токены из app.css (var(--…)) + собственные токены с префиксом --pg-, чтобы работала тёмная тема. */

:root {
  --pg-excel: #2e7d4f;
  --pg-excel-2: #1f5c39;
  --pg-excel-soft: color-mix(in srgb, #2e7d4f 12%, transparent);
  --pg-hero-line: rgba(255, 255, 255, .06);
  --pg-hero-glow: rgba(212, 33, 61, .42);
  --pg-zebra: rgba(42, 16, 18, .022);
  --pg-col-soft: color-mix(in srgb, var(--brand) 42%, var(--card));
  --pg-col-soft-2: color-mix(in srgb, var(--brand) 26%, var(--card));
  --pg-tip-bg: #2a1012;
  --pg-tip-ink: #ffffff;
  --pg-tip-muted: #d9c4c3;
  --pg-silver: #8b7b7c;
  --pg-bronze: #b0713f;
}
:root[data-theme=dark] {
  --pg-excel: #3a9663;
  --pg-excel-2: #2a774c;
  --pg-excel-soft: color-mix(in srgb, #3a9663 18%, transparent);
  --pg-hero-glow: rgba(212, 33, 61, .30);
  --pg-zebra: rgba(255, 255, 255, .018);
  --pg-col-soft: color-mix(in srgb, var(--brand) 55%, var(--card));
  --pg-col-soft-2: color-mix(in srgb, var(--brand) 32%, var(--card));
  --pg-tip-bg: #3a2224;
  --pg-tip-ink: #ffffff;
  --pg-tip-muted: #d8c4c3;
  --pg-silver: #a8979a;
  --pg-bronze: #c98a57;
}

/* ============================================================
   Общие элементы раздела
   ============================================================ */
.pg-head { align-items: flex-end; }
.pg-head h1 { margin-top: 6px; }
.pg-lead { margin: 6px 0 0; color: var(--muted); font-size: 14px; max-width: 640px; }
.pg-head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Мягкий бейдж статуса: точка + подпись */
.pg-st {
  --c: var(--muted);
  display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 10px 0 9px;
  border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; color: var(--ink);
  background: color-mix(in srgb, var(--c) 13%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 26%, transparent);
}
.pg-st i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 20%, transparent); }
.pg-st-free { --c: var(--st-free); }
.pg-st-occupied { --c: var(--st-occupied); }
.pg-st-reserved { --c: var(--st-reserved); }
.pg-st-active { --c: var(--st-active); }
.pg-st-ending { --c: var(--st-ending); }
.pg-st-ok { --c: var(--st-active); }
.pg-st-warn { --c: var(--st-reserved); }
.pg-st-bad { --c: var(--st-ending); }
.pg-st-muted { --c: var(--st-occupied); }

/* Иконка в «чипе» с тонированным фоном */
.pg-chip-ico {
  --c: var(--brand-ink);
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none;
  color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 18%, transparent);
}
.pg-chip-ico svg { width: 20px; height: 20px; }

/* Аватар с инициалами — 4 вариации бренда */
.pg-avatar {
  width: 40px; height: 40px; border-radius: 12px; flex: none; display: grid; place-items: center;
  font: 700 14px/1 var(--font-head); letter-spacing: .02em; color: var(--on-brand);
  background: var(--grad-brand); box-shadow: 0 4px 12px color-mix(in srgb, var(--brand) 22%, transparent);
}
.pg-avatar.round { border-radius: 50%; }
.pg-avatar.sm { width: 34px; height: 34px; font-size: 12px; border-radius: 10px; }
.pg-avatar.sm.round { border-radius: 50%; }
.pg-avatar[data-tone='1'] { background: var(--grad-ink); box-shadow: 0 4px 12px rgba(42, 16, 18, .18); }
.pg-avatar[data-tone='2'] { background: linear-gradient(135deg, #c0573a, #8a2a1c); }
.pg-avatar[data-tone='3'] { background: linear-gradient(135deg, #8f5a5d, #5a2f33); }

/* Пустое состояние */
.pg-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 40px 20px; text-align: center; color: var(--muted); }
.pg-empty b { color: var(--ink-2); font-size: 15px; font-weight: 600; }
.pg-empty span:not(.pg-empty-icon) { font-size: 13px; max-width: 360px; }
.pg-empty-icon {
  width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; margin-bottom: 6px;
  color: var(--brand-ink); background: var(--brand-50);
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--brand-50) 50%, transparent);
}
.pg-empty-icon svg { width: 26px; height: 26px; }

/* Строка фильтров (аналитика) */
.pg-filterbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 10px; margin-bottom: 18px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.pg-filterbar-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); }
.pg-filterbar-ico svg { width: 16px; height: 16px; }
.pg-select {
  position: relative; display: inline-flex; align-items: center; gap: 0; height: 36px;
  border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface-2);
  transition: border-color .15s, box-shadow .15s;
}
.pg-select:hover { border-color: var(--muted); }
.pg-select:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--focus); }
.pg-select > span { padding: 0 4px 0 12px; font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.pg-select select {
  appearance: none; -webkit-appearance: none; border: 0; outline: none; background: transparent; cursor: pointer;
  height: 34px; padding: 0 30px 0 4px; font-weight: 600; font-size: 13px; color: var(--ink); max-width: 220px;
}
.pg-select::after {
  content: ''; position: absolute; right: 12px; top: 50%; width: 7px; height: 7px; margin-top: -5px; pointer-events: none;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg);
}
.pg-select select option { background: var(--card); color: var(--ink); }
.pg-reset {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 9px;
  border: 0; background: var(--brand-50); color: var(--ink); font-size: 12px; font-weight: 600; cursor: pointer;
}
.pg-reset:hover { background: var(--brand-100); }
.pg-reset:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }
.pg-reset svg { width: 14px; height: 14px; }
.pg-filterbar-note { margin-left: auto; padding: 0 8px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.pg-filterbar-note b { color: var(--ink); }

/* ============================================================
   Аналитика
   ============================================================ */
.an-hero {
  position: relative; overflow: hidden; isolation: isolate;
  display: grid; grid-template-columns: minmax(260px, 1fr) minmax(0, 2fr); gap: 28px;
  padding: 28px 30px; margin-bottom: 18px; border-radius: calc(var(--radius) + 4px);
  background: var(--grad-ink); color: var(--on-brand);
  box-shadow: 0 1px 2px rgba(42, 16, 18, .1), 0 18px 40px -12px rgba(42, 16, 18, .45);
}
.an-hero::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background-image:
    linear-gradient(var(--pg-hero-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--pg-hero-line) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(ellipse 70% 120% at 85% 0%, #000 0%, transparent 70%);
  mask-image: radial-gradient(ellipse 70% 120% at 85% 0%, #000 0%, transparent 70%);
}
.an-hero::after {
  content: ''; position: absolute; z-index: -1; right: -120px; top: -160px; width: 460px; height: 460px; border-radius: 50%;
  background: radial-gradient(circle, var(--pg-hero-glow), transparent 65%);
}
.an-hero-label { font: 700 11px/1 var(--font-head); letter-spacing: .14em; text-transform: uppercase; color: rgba(255, 255, 255, .72); }
.an-hero-num { font: 700 64px/1 var(--font-head); letter-spacing: -.03em; margin: 12px 0 14px; }
.an-hero-meter { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .14); overflow: hidden; max-width: 320px; }
.an-hero-meter i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #ff6b7f, #d4213d); box-shadow: 0 0 16px rgba(255, 90, 110, .55); }
.an-hero-sub { margin-top: 12px; font-size: 13px; color: rgba(255, 255, 255, .78); }
.an-hero-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-self: center; }
.an-hero-stat {
  display: flex; gap: 12px; align-items: flex-start; padding: 16px; border-radius: 14px;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .09);
  backdrop-filter: blur(6px); transition: background .2s, transform .2s;
}
.an-hero-stat:hover { background: rgba(255, 255, 255, .09); transform: translateY(-2px); }
.an-hero-ico { width: 36px; height: 36px; border-radius: 10px; flex: none; display: grid; place-items: center; background: rgba(255, 255, 255, .1); color: #ffb3bd; }
.an-hero-ico svg { width: 18px; height: 18px; }
.an-hero-stat > div { min-width: 0; }
.an-hero-stat b { display: block; font: 700 24px/1.1 var(--font-head); letter-spacing: -.02em; white-space: nowrap; }
.an-hero-stat > div > span { display: block; margin-top: 6px; font-size: 12.5px; color: rgba(255, 255, 255, .82); line-height: 1.3; }
.an-hero-stat small { display: block; margin-top: 2px; font-size: 12px; color: rgba(255, 255, 255, .6); }

.an-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 18px; }
.an-span-5 { grid-column: span 5; }
.an-span-6 { grid-column: span 6; }
.an-span-7 { grid-column: span 7; }
.an-span-12 { grid-column: 1 / -1; }
.an-card { padding: 22px; min-width: 0; transition: box-shadow .2s, border-color .2s; }
.an-card:hover { box-shadow: var(--shadow-hover); border-color: var(--line-2); }
.an-card-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.an-card-head h2 { font-size: 16px; }
.an-card-head p { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }

/* Donut */
.an-donut-wrap { display: grid; grid-template-columns: 1fr; gap: 22px; justify-items: center; align-items: center; }
.an-donut-wrap .an-legend { width: 100%; }
.an-donut { position: relative; width: 200px; height: 200px; }
.an-donut svg { width: 100%; height: 100%; display: block; overflow: visible; }
.an-donut-track { fill: none; stroke: var(--track); stroke-width: 18; }
.an-seg {
  fill: none; stroke: var(--c); stroke-width: 18; stroke-linecap: butt; cursor: pointer; outline: none;
  transition: stroke-width .2s, opacity .2s;
}
.an-donut-wrap.has-hover .an-seg { opacity: .35; }
.an-donut-wrap.has-hover .an-seg.is-hover { opacity: 1; stroke-width: 24; }
.an-seg:focus-visible { stroke-width: 24; }
.an-donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.an-donut-center b { font: 700 40px/1 var(--font-head); letter-spacing: -.03em; }
.an-donut-center span { margin-top: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.an-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.an-legend li {
  display: grid; grid-template-columns: 12px minmax(0, 1fr) auto 44px; gap: 10px; align-items: center;
  padding: 8px 10px; border-radius: 10px; cursor: default; outline: none; transition: background .15s, opacity .2s;
}
.an-legend li:hover, .an-legend li.is-hover, .an-legend li:focus-visible { background: var(--hover); }
.an-legend li:focus-visible { box-shadow: 0 0 0 3px var(--focus); }
.an-donut-wrap.has-hover .an-legend li:not(.is-hover) { opacity: .55; }
.an-legend i { width: 12px; height: 12px; border-radius: 4px; background: var(--c); }
.an-legend-label { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-legend b { font: 700 15px/1 var(--font-head); font-variant-numeric: tabular-nums; text-align: right; }
.an-legend-pct { font-size: 12px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

/* Месяцы */
.an-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: -4px 0 18px; }
.an-summary > div { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); min-width: 0; }
.an-summary > div.is-accent { background: var(--brand-50); border-color: var(--brand-100); }
.an-summary span { display: block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.an-summary b { display: block; font: 700 18px/1.25 var(--font-head); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.an-summary small { font-size: 12px; color: var(--ink-2); }
.an-cols { position: relative; height: 240px; padding-left: 64px; }
.an-cols-grid { position: absolute; inset: 0 0 38px 64px; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.an-cols-grid div { border-top: 1px solid var(--line); position: relative; height: 0; }
.an-cols-grid div:last-child { border-top-color: var(--line-2); }
.an-cols-grid span { position: absolute; right: calc(100% + 10px); top: -8px; font-size: 11px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.an-cols-bars { position: absolute; inset: 0 0 0 64px; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 2px; }
.an-col { display: flex; flex-direction: column; min-width: 0; outline: none; cursor: pointer; }
.an-col-hit { position: relative; flex: 1; display: flex; align-items: flex-end; justify-content: center; border-radius: 8px 8px 0 0; transition: background .15s; }
.an-col:hover .an-col-hit, .an-col:focus-visible .an-col-hit { background: color-mix(in srgb, var(--brand) 7%, transparent); }
.an-col:focus-visible .an-col-hit { box-shadow: inset 0 0 0 2px var(--focus); }
.an-col-fill {
  width: 62%; max-width: 24px; min-width: 6px; border-radius: 4px 4px 0 0; transform-origin: bottom;
  background: linear-gradient(180deg, var(--pg-col-soft), var(--pg-col-soft-2)); transition: filter .15s, background .15s;
}
.an-col.is-next .an-col-fill { background: linear-gradient(180deg, #e0405a, var(--brand) 45%, var(--brand-700)); box-shadow: 0 6px 16px -4px color-mix(in srgb, var(--brand) 55%, transparent); }
.an-col:hover .an-col-fill { background: linear-gradient(180deg, #e0405a, var(--brand) 45%, var(--brand-700)); }
.an-col-val {
  position: absolute; left: 50%; transform: translateX(-50%); white-space: nowrap; pointer-events: none;
  font-size: 11px; font-weight: 700; color: var(--ink); background: var(--card); padding: 1px 6px; border-radius: 6px;
  box-shadow: 0 0 0 1px var(--line);
}
.an-col-label { height: 38px; text-align: center; font-size: 11px; color: var(--muted); padding-top: 6px; line-height: 1.25; }
.an-col-label b { display: block; color: var(--ink-2); font-size: 11px; font-weight: 700; }
.an-col.is-now .an-col-label { color: var(--ink); font-weight: 700; }
.an-col.is-next .an-col-label b { color: var(--ink); }
.an-table-view { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.an-table-view summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--muted); width: max-content; border-radius: 6px; }
.an-table-view summary:hover { color: var(--ink); }
.an-table-view summary:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }
.an-table-view .table { margin-top: 8px; font-size: 13px; }
.an-table-view .table th, .an-table-view .table td { padding: 7px 10px; position: static; }

/* Горизонтальные полосы */
.an-hbars { display: flex; flex-direction: column; gap: 2px; }
.an-hbar {
  display: grid; grid-template-columns: minmax(70px, 28%) minmax(0, 1fr) 76px; gap: 14px; align-items: center;
  padding: 7px 8px; border-radius: 10px; outline: none; transition: background .15s;
}
.an-hbar:hover, .an-hbar:focus-visible { background: var(--hover); }
.an-hbar:focus-visible { box-shadow: 0 0 0 3px var(--focus); }
.an-hbar-label { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-hbar-track { height: 10px; border-radius: 0 4px 4px 0; background: var(--track); overflow: hidden; }
.an-hbar-fill { height: 100%; border-radius: 0 4px 4px 0; background: linear-gradient(90deg, var(--brand-700), var(--brand) 70%, #d4213d); transform-origin: left; }
.an-hbar:hover .an-hbar-fill { filter: brightness(1.12); }
.an-hbar-value { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.an-hbar-value b { display: block; font-size: 13.5px; font-weight: 700; }
.an-hbar-value span { display: block; font-size: 11.5px; color: var(--muted); }

/* Рейтинг клиентов */
.an-rank { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.an-rank-row { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; align-items: center; padding: 8px; border-radius: 12px; outline: none; transition: background .15s; }
.an-rank-row:hover, .an-rank-row:focus-visible { background: var(--hover); }
.an-rank-row:focus-visible { box-shadow: 0 0 0 3px var(--focus); }
.an-rank-pos {
  width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center;
  font: 700 13px/1 var(--font-head); color: var(--muted); background: var(--surface-2); border: 1px solid var(--line);
}
.is-top-1 .an-rank-pos { background: var(--grad-brand); color: var(--on-brand); border-color: transparent; box-shadow: 0 4px 12px color-mix(in srgb, var(--brand) 35%, transparent); }
.is-top-2 .an-rank-pos { background: linear-gradient(135deg, var(--pg-silver), color-mix(in srgb, var(--pg-silver) 70%, #000)); color: var(--on-brand); border-color: transparent; }
.is-top-3 .an-rank-pos { background: linear-gradient(135deg, var(--pg-bronze), color-mix(in srgb, var(--pg-bronze) 70%, #000)); color: var(--on-brand); border-color: transparent; }
.an-rank-main { min-width: 0; }
.an-rank-name { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.an-rank-name span { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-rank-name b { font-size: 13.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.an-rank-bar { height: 6px; margin: 7px 0 5px; border-radius: 0 3px 3px 0; background: var(--track); overflow: hidden; }
.an-rank-bar i { display: block; height: 100%; border-radius: 0 3px 3px 0; background: linear-gradient(90deg, var(--brand-700), var(--brand)); transform-origin: left; }
.an-rank-row:not(.is-top) .an-rank-bar i { background: var(--pg-col-soft); }
.an-rank-sub { font-size: 11.5px; color: var(--muted); }

/* Типы конструкций */
.an-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.an-type {
  padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); outline: none;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.an-type:hover, .an-type:focus-visible { transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: var(--line-2); }
.an-type:focus-visible { box-shadow: 0 0 0 3px var(--focus); }
.an-type-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.an-type-top span { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-type-top b { font: 700 22px/1 var(--font-head); }
.an-meter { height: 5px; border-radius: 3px; background: var(--track); overflow: hidden; margin: 12px 0 6px; }
.an-meter i { display: block; height: 100%; border-radius: 0 3px 3px 0; background: var(--brand); transform-origin: left; }
.an-type-sub { font-size: 11.5px; color: var(--muted); }

/* Подсказка */
.an-tip {
  position: fixed; left: 0; top: 0; z-index: 5000; pointer-events: none; min-width: 140px; max-width: 280px;
  display: flex; flex-direction: column; gap: 1px; padding: 9px 12px; border-radius: 10px;
  background: var(--pg-tip-bg); color: var(--pg-tip-ink); box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, .08);
}
.an-tip b { font: 700 15px/1.25 var(--font-head); }
.an-tip span { font-size: 12px; font-weight: 600; color: var(--pg-tip-ink); opacity: .9; }
.an-tip small { font-size: 11.5px; color: var(--pg-tip-muted); }
.an-tip small:empty { display: none; }

/* Появление (только первая отрисовка) */
@keyframes pgUp { from { opacity: 0; transform: translateY(10px); } }
@keyframes pgGrowY { from { transform: scaleY(0); } }
@keyframes pgGrowX { from { transform: scaleX(0); } }
@keyframes pgDraw { from { stroke-dasharray: 0 999; } }
@keyframes pgFade { from { opacity: 0; } }
.an-animate .an-hero, .an-animate .an-card { animation: pgUp .5s cubic-bezier(.2, .7, .2, 1) both; }
.an-animate .an-card:nth-child(1) { animation-delay: .06s; }
.an-animate .an-card:nth-child(2) { animation-delay: .12s; }
.an-animate .an-card:nth-child(3) { animation-delay: .18s; }
.an-animate .an-card:nth-child(4) { animation-delay: .24s; }
.an-animate .an-card:nth-child(5) { animation-delay: .3s; }
.an-animate .an-col-fill { animation: pgGrowY .7s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(.25s + var(--i) * 40ms); }
.an-animate .an-col-val { animation: pgFade .4s both; animation-delay: .9s; }
.an-animate .an-hbar-fill, .an-animate .an-rank-bar i, .an-animate .an-meter i { animation: pgGrowX .7s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(.3s + var(--i) * 45ms); }
.an-animate .an-hero-meter i { animation: pgGrowX .9s cubic-bezier(.2, .7, .2, 1) both .15s; transform-origin: left; }
.an-animate .an-seg { animation: pgDraw .8s cubic-bezier(.3, .7, .2, 1) both; animation-delay: calc(.2s + var(--i) * 90ms); }

/* ============================================================
   Список мест
   ============================================================ */
.ls-card { overflow: visible; }
.ls-filters { padding: 16px 18px 14px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.ls-filters .search-input .input { height: 42px; background: var(--surface-2); border-radius: 12px; }
.ls-filters .chip { background: var(--surface-2); }
.ls-filters .chip.on, .ls-filters .chip.on-free, .ls-filters .chip.on-ending { background: var(--inv-bg); border-color: var(--inv-bg); color: var(--inv-fg); }
.ls-filters .chip.on-free { background: var(--st-free); border-color: var(--st-free); color: var(--on-brand); }
.ls-filters .chip.on-ending { background: var(--st-ending); border-color: var(--st-ending); color: var(--on-brand); }
.ls-filters .chip .dot { box-shadow: none; }
.ls-filters .filters-grid select { background: var(--surface-2); height: 38px; }
.ls-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 18px; border-bottom: 1px solid var(--line); background: var(--surface-2);
}
.ls-count { font-size: 13px; color: var(--muted); }
.ls-count b { color: var(--ink); font: 700 15px var(--font-head); }
.ls-export { display: flex; align-items: center; gap: 8px; }
.ls-export > span { font-size: 12px; color: var(--muted); font-weight: 600; margin-right: 2px; }
.pg-btn-excel { color: var(--ink); }
.pg-btn-excel svg { color: var(--pg-excel); }
.pg-btn-pdf svg { color: var(--brand-ink); }
.pg-btn-excel:hover { border-color: var(--pg-excel); background: var(--pg-excel-soft); }
.pg-btn-pdf:hover { border-color: var(--brand-100); background: var(--brand-50); }

.ls-wrap { overflow: visible; }
.ls-table { border-collapse: separate; border-spacing: 0; }
.ls-table thead th {
  position: sticky; top: var(--pg-sticky, 0px); z-index: 5; background: var(--card);
  font-size: 11.5px; letter-spacing: .05em; padding: 11px 14px; border-bottom: 1px solid var(--line-2);
  box-shadow: 0 1px 0 var(--line);
}
.ls-table thead th:first-child { border-top-left-radius: 0; }
.ls-table th.sortable { transition: color .15s, background .15s; }
.ls-table th.sortable:hover { color: var(--ink); background: var(--hover); }
.ls-table th.sortable:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--focus); color: var(--ink); }
.ls-th { display: inline-flex; align-items: center; gap: 6px; }
.ls-table th.num .ls-th { flex-direction: row-reverse; }
.ls-sort { display: inline-flex; flex-direction: column; gap: 1px; opacity: .45; transition: opacity .15s; }
.ls-sort svg { width: 9px; height: 6px; display: block; }
.ls-table th.sortable:hover .ls-sort { opacity: .8; }
.ls-table th.is-sorted { color: var(--ink); }
.ls-table th.is-sorted .ls-sort { opacity: 1; }
.ls-table th.is-sorted .ls-sort svg { opacity: .3; }
.ls-table th.is-asc .ls-sort svg:first-child, .ls-table th.is-desc .ls-sort svg:last-child { opacity: 1; color: var(--brand-ink); }
.ls-table tbody td { padding: 10px 12px; transition: background .12s; }
.ls-table thead th { padding-left: 12px; padding-right: 12px; }
.ls-table tbody tr:nth-child(even) td { background: var(--pg-zebra); }
.ls-table tbody tr.clickable:hover td { background: var(--hover); }
.ls-table tbody tr.clickable:hover { background: transparent; }
.ls-table tbody tr.clickable:hover td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
.ls-table tbody tr:focus-visible { outline: none; }
.ls-table tbody tr:focus-visible td { background: var(--hover); }
.ls-table tbody tr:focus-visible td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
.ls-table tbody tr:last-child td { border-bottom: 0; }
.ls-thumb { width: 64px; height: 46px; border-radius: 10px; object-fit: cover; display: block; box-shadow: 0 0 0 1px var(--line), 0 2px 6px rgba(42, 16, 18, .08); }
.ls-thumb.thumb-empty { display: grid; place-items: center; color: var(--muted); background: repeating-linear-gradient(135deg, var(--ph-1) 0 6px, var(--ph-2) 6px 12px); }
.ls-thumb.thumb-empty svg { width: 18px; height: 18px; opacity: .6; }
.ls-num { display: inline-flex; align-items: center; height: 26px; padding: 0 9px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); font: 700 13px/1 var(--font-head); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ls-addr { font-weight: 600; }
.ls-table td.ls-addr-cell { min-width: 200px; }
.ls-table td.ls-company { min-width: 150px; }
.ls-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.ls-days { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.ls-days.warn { color: var(--ink-2); font-weight: 600; }
.ls-days.warn::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--st-ending); }
.ls-money { font-weight: 600; }
.ls-table .ls-mob { display: none; }

@media (max-width: 1320px) {
  .ls-wrap { overflow-x: auto; }
  .ls-table thead th { top: 0; }
}

/* ============================================================
   Отчёты
   ============================================================ */
.rp-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.rp-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.rp-card {
  position: relative; overflow: hidden; padding: 20px; display: flex; flex-direction: column; gap: 14px;
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.rp-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--line-2); }
.rp-card::after {
  content: ''; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, color-mix(in srgb, var(--c, var(--brand)) 10%, transparent), transparent 70%);
}
.rp-top { display: flex; gap: 14px; align-items: flex-start; }
.rp-illu {
  --c: var(--brand);
  width: 52px; height: 52px; border-radius: 14px; flex: none; display: grid; place-items: center; color: var(--c);
  background: linear-gradient(145deg, color-mix(in srgb, var(--c) 16%, transparent), color-mix(in srgb, var(--c) 6%, transparent));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 22%, transparent);
}
.rp-illu svg { width: 30px; height: 30px; }
.rp-card h3 { font-size: 15.5px; }
.rp-desc { font-size: 13px; color: var(--muted); margin-top: 4px; }
.rp-count { display: flex; align-items: baseline; gap: 8px; }
.rp-count b { font: 700 34px/1 var(--font-head); letter-spacing: -.02em; }
.rp-count span { font-size: 13px; color: var(--muted); font-weight: 500; }
.rp-card .pg-select { width: 100%; }
.rp-card .pg-select select { max-width: none; width: 100%; }
.rp-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: auto; }
.rp-acts .btn { width: 100%; }
.rp-aside { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 88px; }
.rp-format {
  position: relative; overflow: hidden; isolation: isolate; padding: 22px; border-radius: var(--radius); color: var(--on-brand);
  box-shadow: 0 12px 30px -10px rgba(42, 16, 18, .4);
}
.rp-format::before {
  content: ''; position: absolute; inset: 0; z-index: -1; opacity: .5;
  background-image: linear-gradient(rgba(255, 255, 255, .07) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .07) 1px, transparent 1px);
  background-size: 18px 18px;
  -webkit-mask-image: linear-gradient(200deg, #000, transparent 60%); mask-image: linear-gradient(200deg, #000, transparent 60%);
}
.rp-format.excel { background: linear-gradient(140deg, #3b9a64, var(--pg-excel) 50%, var(--pg-excel-2)); }
.rp-format.pdf { background: var(--grad-brand); }
.rp-format-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.rp-format-badge {
  width: 46px; height: 54px; border-radius: 8px 14px 8px 8px; display: grid; place-items: end center; padding-bottom: 8px;
  background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .25); font: 800 11px/1 var(--font-head); letter-spacing: .06em;
}
.rp-format b { display: block; font: 700 26px/1 var(--font-head); }
.rp-format small { font-size: 12px; opacity: .85; }
.rp-format ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; font-size: 13px; }
.rp-format li { display: flex; gap: 8px; align-items: flex-start; }
.rp-format li svg { width: 16px; height: 16px; flex: none; margin-top: 2px; opacity: .9; }
.rp-tip { padding: 16px 18px; display: flex; gap: 12px; align-items: flex-start; font-size: 13px; color: var(--ink-2); }
.rp-tip b { color: var(--ink); display: block; margin-bottom: 2px; }

/* Печатная версия: всегда светлая (локально переопределяем токены светлыми значениями) */
.pg-print {
  --ink: #2a1012; --ink-2: #4b3335; --muted: #6f5c5d; --line: #e6dcd9; --card: #ffffff; --bg: #ffffff;
  --brand: #b31329; --brand-50: #fbeeee; --pg-print-zebra: #faf6f5; --pg-print-head: #2a1012;
  background: var(--card); color: var(--ink); min-height: 100vh; padding: 28px 32px; color-scheme: light;
}
.pg-print .print-bar { position: sticky; top: 0; z-index: 2; padding: 10px 0; margin: -10px 0 18px; background: var(--card); }
.pg-print .print-bar .btn:not(.btn-primary) { background: var(--card); color: var(--ink); border-color: var(--line); }
.pg-print .print-head { border-bottom: 0; padding-bottom: 0; margin-bottom: 14px; align-items: stretch; gap: 24px; }
.pg-print .print-head h1 { font-size: 22px; margin-top: 4px; color: var(--ink); }
.pg-print-meta { font-size: 11.5px; color: var(--muted); text-align: right; line-height: 1.6; }
.pg-print-meta b { color: var(--ink); font-weight: 600; }
.pg-print-rule { height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--brand), #7d0c1c 60%, #2a1012); margin-bottom: 14px; }
.pg-print-sum { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.pg-print-sum div { padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--pg-print-zebra); }
.pg-print-sum span { display: block; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.pg-print-sum b { font: 700 16px/1.3 var(--font-head); color: var(--ink); }
.pg-print .print-table th { background: var(--pg-print-head); color: #ffffff; font-size: 10.5px; letter-spacing: .03em; text-transform: uppercase; padding: 7px 8px; }
.pg-print .print-table th:first-child { border-radius: 6px 0 0 0; }
.pg-print .print-table th:last-child { border-radius: 0 6px 0 0; }
.pg-print .print-table td { border-bottom: 1px solid var(--line); color: var(--ink); }
.pg-print .print-table tr:nth-child(even) td { background: var(--pg-print-zebra); }
.pg-print .print-table tr { break-inside: avoid; }
.pg-print .print-table thead { display: table-header-group; }
.pg-print-st { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; font-weight: 600; }
.pg-print-st i { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.pg-print-foot { margin-top: 14px; display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 8px; }
@media print {
  .pg-print { padding: 0; min-height: 0; }
  .pg-print .print-bar { display: none; }
  .pg-print-rule, .pg-print-st i, .pg-print-sum div, .pg-print .print-table th, .pg-print .print-table tr:nth-child(even) td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ============================================================
   Компании
   ============================================================ */
.co-bar {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 10px; margin-bottom: 16px;
  border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.co-bar .search-input { flex: 1 1 280px; }
.co-bar .search-input .input { background: var(--surface-2); border-radius: 10px; height: 40px; }
.co-stats { display: flex; gap: 18px; padding: 0 8px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.co-stats b { color: var(--ink); font: 700 15px var(--font-head); margin-right: 3px; }
.co-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.co-card {
  position: relative; padding: 18px; display: flex; flex-direction: column; gap: 14px; min-width: 0;
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.co-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--line-2); }
.co-top { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.co-name { min-width: 0; flex: 1; }
.co-name h3 { font-size: 15px; overflow-wrap: anywhere; }
.co-name p { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.co-ops { display: flex; gap: 2px; margin: -6px -6px 0 0; opacity: .65; transition: opacity .15s; }
.co-card:hover .co-ops, .co-card:focus-within .co-ops { opacity: 1; }
.co-contacts { display: flex; flex-direction: column; gap: 7px; font-size: 13px; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.co-contacts div { display: flex; gap: 9px; align-items: center; min-width: 0; color: var(--ink-2); }
.co-contacts div span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.co-contacts svg { width: 15px; height: 15px; color: var(--muted); flex: none; }
.co-contacts a { color: var(--ink); font-weight: 600; }
.co-contacts .muted-row { color: var(--muted); }
.co-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.co-places { display: flex; align-items: baseline; gap: 6px; }
.co-places b { font: 700 24px/1 var(--font-head); }
.co-places span { font-size: 12.5px; color: var(--muted); }
.co-link {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 9px; font-size: 12.5px; font-weight: 600;
  color: var(--ink); background: var(--surface-2); border: 1px solid var(--line-2); text-decoration: none !important; transition: border-color .15s, background .15s;
}
.co-link:hover { border-color: var(--brand); background: var(--brand-50); }
.co-link:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }
.co-link svg { width: 14px; height: 14px; transform: rotate(180deg); }
.co-link.is-zero { color: var(--muted); }
.co-grid .pg-empty { grid-column: 1 / -1; }
.co-card { animation: pgUp .4s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(var(--i, 0) * 35ms); }

/* ============================================================
   Пользователи
   ============================================================ */
.us-roles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.us-role { position: relative; overflow: hidden; padding: 20px; display: flex; flex-direction: column; gap: 12px; transition: transform .2s, box-shadow .2s; }
.us-role:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.us-role.is-admin { background: var(--grad-brand); border-color: transparent; color: var(--on-brand); box-shadow: 0 14px 30px -12px color-mix(in srgb, var(--brand) 60%, transparent); }
.us-role.is-admin::after {
  content: ''; position: absolute; right: -50px; bottom: -70px; width: 200px; height: 200px; border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, .22); box-shadow: 0 0 0 26px rgba(255, 255, 255, .04);
}
.us-role-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.us-role .pg-chip-ico { width: 42px; height: 42px; }
.us-role.is-admin .pg-chip-ico { color: var(--on-brand); background: rgba(255, 255, 255, .16); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2); }
.us-role-count { font: 700 34px/1 var(--font-head); letter-spacing: -.02em; }
.us-role h3 { font-size: 15.5px; }
.us-role p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.45; }
.us-role.is-admin p { color: rgba(255, 255, 255, .86); }
.us-role-perms { display: flex; flex-wrap: wrap; gap: 5px; margin-top: auto; }
.us-role-perms span { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.us-role.is-admin .us-role-perms span { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .2); color: var(--on-brand); }

.us-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.us-card-head h2 { font-size: 16px; display: flex; align-items: center; gap: 12px; }
.us-card-head h2 .pg-chip-ico { width: 36px; height: 36px; border-radius: 10px; }
.us-card-head h2 .pg-chip-ico svg { width: 18px; height: 18px; }
.us-card-head small { display: block; font: 500 12.5px var(--font); color: var(--muted); margin-top: 2px; letter-spacing: 0; }
.us-table tbody tr td { transition: background .12s; }
.us-table tbody tr:hover td { background: var(--hover); }
.us-table tbody tr:last-child td { border-bottom: 0; }
.us-person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.us-person b { display: block; }
.us-person small { display: block; font-size: 12px; color: var(--muted); }
.us-login { font: 600 12.5px/1 ui-monospace, 'Cascadia Mono', Consolas, monospace; padding: 5px 8px; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.us-you { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; margin-left: 6px; border-radius: 6px; font-size: 11px; font-weight: 700; background: var(--brand-50); color: var(--ink); box-shadow: inset 0 0 0 1px var(--brand-100); vertical-align: 1px; }
.us-role-pill { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; }
.us-role-pill svg { width: 16px; height: 16px; color: var(--muted); }
.us-role-pill.is-admin svg { color: var(--brand-ink); }

.us-sections { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 18px; margin-top: 18px; align-items: start; }
.us-backup-info { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 12px; font-size: 13px; color: var(--ink-2); }
.us-backup-info b { display: block; color: var(--ink); font-size: 13.5px; }
.us-backups { display: flex; flex-direction: column; max-height: 420px; overflow: auto; margin: 0 -8px; padding: 0 8px; }
.us-backup { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 8px; border-radius: 10px; transition: background .12s; }
.us-backup:hover { background: var(--hover); }
.us-backup + .us-backup { border-top: 1px solid var(--line); }
.us-backup-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.us-backup-ico svg { width: 17px; height: 17px; }
.us-backup:first-child .us-backup-ico { color: var(--st-active); background: color-mix(in srgb, var(--st-active) 12%, transparent); border-color: color-mix(in srgb, var(--st-active) 25%, transparent); }
.us-backup-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.us-backup-meta { font-size: 12px; color: var(--muted); }
.us-hint code, .us-tg code { background: var(--surface-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; font-size: 12px; color: var(--ink); }
.us-hint { margin: 12px 0 0; font-size: 12.5px; color: var(--muted); }

.us-steps { list-style: none; margin: 0 0 18px; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.us-steps li {
  position: relative; padding: 14px 14px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line);
  font-size: 12.5px; color: var(--ink-2); line-height: 1.45;
}
.us-step-n {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px; margin-bottom: 8px; border-radius: 999px;
  background: var(--grad-brand); color: var(--on-brand); font: 700 11px/1 var(--font-head); letter-spacing: .02em;
}
.us-steps li { display: block; }
.us-steps .us-step-n { display: flex; width: max-content; }
.us-steps li.done { border-color: color-mix(in srgb, var(--st-active) 30%, transparent); }
.us-steps li.done .us-step-n { background: var(--st-active); }
.us-steps li.done .us-step-n::before { content: '✓'; margin-right: 5px; }
.us-dl-text { margin-left: 2px; }
.us-steps a { font-weight: 600; }
.us-tg .grid-2 .field input { background: var(--surface-2); }
.us-tg .chips .chip { background: var(--surface-2); }
.us-tg .chips .chip.on { background: var(--inv-bg); color: var(--inv-fg); border-color: var(--inv-bg); }
.us-tg .chips .chip.on .muted { color: inherit; opacity: .7; }
.us-schedule { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; margin: 14px 0; border-radius: 12px; background: var(--brand-50); border: 1px solid var(--brand-100); font-size: 13px; color: var(--ink-2); }
.us-schedule svg { width: 18px; height: 18px; color: var(--brand-ink); flex: none; margin-top: 1px; }
.us-schedule b { color: var(--ink); }
.us-tg-acts { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============================================================
   Импорт
   ============================================================ */
.im-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: stretch; margin-bottom: 18px; }
.im-zone-card { padding: 10px; }
.im-zone {
  position: relative; overflow: hidden; isolation: isolate; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  min-height: 360px; justify-content: center; padding: 36px 24px; border-radius: 12px; cursor: pointer;
  border: 2px dashed var(--line-2); color: var(--muted); background: var(--surface-2);
  transition: border-color .2s, background .2s, transform .2s;
}
.im-zone::before {
  content: ''; position: absolute; inset: 0; z-index: -1; opacity: .7;
  background-image: radial-gradient(color-mix(in srgb, var(--brand) 14%, transparent) 1px, transparent 1.5px);
  background-size: 18px 18px;
  -webkit-mask-image: radial-gradient(ellipse 60% 60% at 50% 45%, #000, transparent 75%); mask-image: radial-gradient(ellipse 60% 60% at 50% 45%, #000, transparent 75%);
}
.im-zone:hover { border-color: var(--brand); }
.im-zone:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--focus); }
.im-zone.over { border-color: var(--brand); border-style: solid; background: var(--brand-50); transform: scale(1.01); }
.im-zone.busy { pointer-events: none; }
.im-zone h2 { font-size: 20px; color: var(--ink); margin-top: 6px; }
.im-zone p { margin: 0; font-size: 14px; color: var(--ink-2); }
.im-zone p b { color: var(--brand-ink); }
.im-zone small { font-size: 12.5px; }
.im-zone .im-illu { width: 150px; height: 118px; margin: 0 0 4px; color: var(--ink); }
.im-zone .im-pick svg { width: 18px; height: 18px; margin: 0; }
.im-illu .sheet { transition: transform .35s cubic-bezier(.2, .7, .2, 1); transform-box: fill-box; transform-origin: center; }
.im-illu .arrow { transition: transform .35s cubic-bezier(.2, .7, .2, 1); }
.im-zone:hover .im-illu .sheet-a, .im-zone.over .im-illu .sheet-a { transform: translate(-8px, -4px) rotate(-8deg); }
.im-zone:hover .im-illu .sheet-c, .im-zone.over .im-illu .sheet-c { transform: translate(8px, -4px) rotate(8deg); }
.im-zone.over .im-illu .arrow { animation: imBounce .8s ease-in-out infinite; }
.im-zone.busy .im-illu .arrow { animation: imBounce .8s ease-in-out infinite; }
@keyframes imBounce { 50% { transform: translateY(6px); } }
.im-formats { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
.im-formats span { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); font-size: 12px; font-weight: 700; color: var(--ink-2); }
.im-formats i { width: 8px; height: 8px; border-radius: 2px; background: var(--c); }
.im-pick { margin-top: 12px; pointer-events: none; }
.im-zone-busy { display: none; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); }
.im-zone.busy .im-zone-busy { display: flex; }
.im-zone.busy .im-pick { display: none; }
.im-spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--brand-100); border-top-color: var(--brand); animation: spin .8s linear infinite; }

.im-help { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.im-help h3 { font-size: 16px; }
.im-help-step { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; align-items: start; font-size: 13px; color: var(--ink-2); }
.im-help-step b { display: block; color: var(--ink); font-size: 13.5px; margin-bottom: 2px; }
.im-help-note { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px; color: var(--muted); margin-top: auto; }
.im-help-note svg { width: 16px; height: 16px; flex: none; margin-top: 1px; color: var(--muted); }

.im-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.im-stat { padding: 16px; display: flex; gap: 12px; align-items: center; }
.im-stat .pg-chip-ico { width: 38px; height: 38px; border-radius: 11px; }
.im-stat .pg-chip-ico svg { width: 18px; height: 18px; }
.im-stat > div > b { display: block; font: 700 24px/1.1 var(--font-head); }
.im-stat > div > span { font-size: 12px; color: var(--muted); font-weight: 600; line-height: 1.25; display: block; }
.im-setup { padding: 18px 20px; display: flex; flex-direction: column; gap: 16px; margin-bottom: 18px; }
.im-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.im-cols { display: flex; flex-wrap: wrap; gap: 6px; }
.im-col { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 8px; font-size: 12px; font-weight: 600; background: color-mix(in srgb, var(--st-active) 11%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--st-active) 25%, transparent); color: var(--ink); }
.im-col svg { width: 13px; height: 13px; color: var(--st-active); }
.im-col em { font-style: normal; color: var(--muted); font-weight: 500; }
.im-col.skip { background: transparent; box-shadow: inset 0 0 0 1px var(--line-2); color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 50%, transparent); }
.im-col.skip svg { color: var(--muted); }
.im-geo { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 12px; background: var(--brand-50); border: 1px solid var(--brand-100); }
.im-geo .pg-chip-ico { background: var(--card); }
.im-geo b { color: var(--ink); }
.im-geo-sub { font-size: 13px; color: var(--ink-2); }
.im-progress { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.im-progress[hidden] { display: none; }
.im-progress .progress { flex: 1; height: 8px; border-radius: 4px; margin: 0; background: var(--card); box-shadow: inset 0 0 0 1px var(--brand-100); }
.im-progress .progress i { border-radius: 4px; background: linear-gradient(90deg, var(--brand-700), var(--brand), #e0405a); background-size: 200% 100%; animation: imFlow 1.4s linear infinite; }
@keyframes imFlow { to { background-position: -200% 0; } }
.im-progress-txt { font-size: 12px; font-weight: 700; color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; min-width: 72px; text-align: right; }
.im-alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--st-ending) 9%, transparent); border: 1px solid color-mix(in srgb, var(--st-ending) 28%, transparent); font-size: 13px; color: var(--ink-2); }
.im-alert svg { width: 18px; height: 18px; color: var(--st-ending); flex: none; margin-top: 1px; }
.im-alert b { color: var(--ink); }
.im-mode { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: 13.5px; }
.im-mode .seg { background: var(--track); }
.im-mode .seg button { color: var(--ink-2); }
.im-mode .seg button.on { background: var(--card); color: var(--ink); }
.im-mode .seg button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }

.im-table-card { overflow: hidden; display: flex; flex-direction: column; }
.im-table-wrap { max-height: 560px; overflow: auto; }
.im-table th { position: sticky; top: 0; z-index: 2; }
.im-table td { padding: 10px 12px; font-size: 13px; }
.im-table th { padding: 10px 12px; }
.im-table tbody tr:hover td { background: var(--hover); }
.im-table tr.is-bad td { background: color-mix(in srgb, var(--st-ending) 6%, transparent); }
.im-table tr.is-bad td:first-child { box-shadow: inset 3px 0 0 var(--st-ending); }
.im-table tr.is-warn td:first-child { box-shadow: inset 3px 0 0 var(--st-reserved); }
.im-table td.im-addr { min-width: 220px; }
.im-table .im-problems { font-size: 12px; color: var(--muted); margin-top: 4px; max-width: 240px; }
.im-coords { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.im-coords.none { color: var(--ink-2); }
.im-map-card { overflow: hidden; min-height: 380px; position: relative; }
.im-map-card #import-map { position: absolute; inset: 0; }
.im-map-legend {
  position: absolute; right: 12px; top: 12px; z-index: 500; display: flex; gap: 12px; padding: 7px 12px; border-radius: 10px;
  background: var(--glass); backdrop-filter: blur(10px); box-shadow: var(--shadow); font-size: 12px; font-weight: 600;
}
.im-map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.im-map-legend i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--card); box-shadow: 0 0 0 1px var(--line-2); }

.im-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 14px 16px 14px 20px; position: sticky; bottom: 12px; z-index: 1001;
  background: var(--glass); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: var(--shadow-lg); border: 1px solid var(--line);
}
.im-foot-main { display: flex; gap: 14px; align-items: center; min-width: 0; }
.im-foot-num { font: 700 30px/1 var(--font-head); letter-spacing: -.02em; }
.im-foot b { display: block; }
.im-foot .btn-primary { height: 44px; padding: 0 20px; box-shadow: 0 8px 20px -6px color-mix(in srgb, var(--brand) 70%, transparent); }

.im-done { max-width: 720px; margin: 28px auto; padding: 36px 32px 28px; text-align: center; position: relative; overflow: hidden; isolation: isolate; }
.im-done::before {
  content: ''; position: absolute; inset: 0 0 auto; height: 220px; z-index: -1;
  background: radial-gradient(ellipse 60% 100% at 50% 0%, color-mix(in srgb, var(--st-active) 14%, transparent), transparent 70%);
}
.im-done-ico {
  width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 18px; color: var(--on-brand);
  background: linear-gradient(140deg, #3aa56a, var(--st-active)); box-shadow: 0 0 0 10px color-mix(in srgb, var(--st-active) 14%, transparent), 0 12px 28px -8px color-mix(in srgb, var(--st-active) 70%, transparent);
  animation: imPop .5s cubic-bezier(.2, 1.4, .4, 1) both;
}
.im-done-ico svg { width: 36px; height: 36px; stroke-width: 2.6; }
@keyframes imPop { from { transform: scale(.4); opacity: 0; } }
.im-done h1 { font-size: 26px; }
.im-done > p { color: var(--muted); margin: 8px 0 0; }
.im-done-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 24px 0 18px; }
.im-done-stats div { padding: 14px 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.im-done-stats b { display: block; font: 700 26px/1.1 var(--font-head); }
.im-done-stats span { font-size: 12px; color: var(--muted); font-weight: 600; }
.im-done-stats .is-main { background: color-mix(in srgb, var(--st-active) 10%, transparent); border-color: color-mix(in srgb, var(--st-active) 30%, transparent); }
.im-done-acts { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.im-done .form-error { text-align: left; max-height: 160px; overflow: auto; }

/* ============================================================
   Адаптивность
   ============================================================ */
@media (max-width: 1280px) {
  .an-hero { grid-template-columns: 1fr; gap: 20px; }
  .im-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .an-span-5, .an-span-6, .an-span-7 { grid-column: 1 / -1; }
  .an-donut-wrap { grid-template-columns: 200px minmax(0, 1fr); gap: 28px; justify-items: stretch; }
  .rp-layout, .im-grid, .us-sections { grid-template-columns: 1fr; }
  .rp-aside { position: static; display: grid; grid-template-columns: 1fr 1fr; }
  .rp-aside .rp-tip { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .pg-lead { font-size: 13px; }
  .pg-head-actions { width: 100%; }
  .pg-head-actions .btn { flex: 1; }
  .pg-filterbar { gap: 8px; }
  .pg-filterbar-ico { display: none; }
  .pg-select { flex: 1 1 140px; min-width: 0; }
  .pg-select select { width: 100%; max-width: none; min-width: 0; }
  .pg-filterbar-note { margin-left: 0; width: 100%; padding: 2px 4px 0; }

  /* Список мест → карточки */
  .ls-filters { padding: 14px; }
  .ls-filters .filters-grid.bar { grid-template-columns: 1fr 1fr; }
  .ls-bar { padding: 10px 14px; }
  .ls-export > span { display: none; }
  .ls-wrap { overflow: visible; }
  .ls-table thead { display: none; }
  .ls-table, .ls-table tbody { display: block; }
  .ls-table tbody tr.clickable {
    display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 4px 12px; align-items: start;
    padding: 14px; border-bottom: 1px solid var(--line);
  }
  .ls-table tbody tr:nth-child(even) td, .ls-table tbody tr.clickable:hover td { background: transparent; }
  .ls-table tbody tr.clickable:hover td:first-child { box-shadow: none; }
  .ls-table tbody tr.clickable:active { background: var(--hover); }
  .ls-table tbody tr:last-child { border-bottom: 0; }
  .ls-table tbody td { padding: 0; border: 0; }
  .ls-table td[data-m='hide'] { display: none; }
  .ls-table td[data-m='thumb'] { grid-row: 1 / span 4; }
  .ls-table td[data-m='thumb'] .ls-thumb { width: 72px; height: 72px; border-radius: 12px; }
  .ls-table td[data-m='full'], .ls-table td[data-m='num'] { grid-column: 2; }
  .ls-table td[data-m='num'] { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
  .ls-table .ls-mob { display: inline-flex; }
  .ls-table td[data-m='status'] { display: none; }
  .ls-table td[data-m='full'].ls-company { font-size: 12.5px; color: var(--muted); }
  .ls-table tbody td[colspan] { grid-column: 1 / -1; display: block; }
  .ls-table tbody tr:not(.clickable) { display: block; }

  .rp-list { grid-template-columns: 1fr; }
  .rp-aside { grid-template-columns: 1fr; }
  .co-bar .co-stats { width: 100%; padding: 2px 6px 0; }
  .us-roles { grid-template-columns: 1fr; gap: 10px; }
  .us-role { flex-direction: row; flex-wrap: wrap; align-items: center; padding: 16px; }
  .us-role-top { order: 0; }
  .us-steps { grid-template-columns: 1fr; }
  .us-table thead { display: none; }
  .us-table, .us-table tbody { display: block; }
  .us-table tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); align-items: start; }
  .us-table tbody tr:last-child { border-bottom: 0; }
  .us-table tbody td { padding: 0; border: 0; }
  .us-table td.us-cell-login, .us-table td.us-cell-role, .us-table td.us-cell-status { display: none; }
  .us-person { align-items: flex-start; }
  .us-mob-meta { display: flex !important; gap: 6px 8px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
  .us-dl-text { display: none; }

  .im-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .im-zone { min-height: 300px; }
  .im-geo { grid-template-columns: 1fr; }
  .im-geo .pg-chip-ico { display: none; }
  .im-foot { bottom: 76px; }
  .im-done { padding: 28px 18px; margin: 10px auto; }
  .im-done-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 901px) {
  .us-mob-meta { display: none !important; }
}
@media (max-width: 560px) {
  .an-hero { padding: 22px 18px; border-radius: var(--radius); }
  .an-hero-num { font-size: 52px; }
  .an-hero-stats { grid-template-columns: 1fr; gap: 8px; }
  .an-hero-stat { padding: 12px 14px; align-items: center; }
  .an-hero-stat b { font-size: 20px; }
  .an-hero-stat > div > span { margin-top: 2px; }
  .an-hero-stat small { display: none; }
  .an-card { padding: 18px 16px; }
  .an-donut-wrap { grid-template-columns: 1fr; justify-items: center; }
  .an-donut { width: 180px; height: 180px; }
  .an-legend { width: 100%; }
  .an-summary b { font-size: 15px; }
  .an-cols { padding-left: 46px; height: 220px; }
  .an-cols-grid, .an-cols-bars { left: 46px; }
  .an-cols-grid span { font-size: 10px; right: calc(100% + 6px); }
  .an-col-label { font-size: 9.5px; letter-spacing: -.02em; }
  .an-col-fill { width: 70%; min-width: 4px; }
  .an-col-val { font-size: 10px; padding: 1px 4px; }
  .an-hbar { grid-template-columns: minmax(0, 1fr) 64px; row-gap: 6px; }
  .an-hbar-label { grid-column: 1 / -1; }
  .an-hbar-track { grid-column: 1; }
  .an-hbar-value { grid-column: 2; grid-row: 2; }
  .an-types { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .an-type { padding: 12px; }
  .rp-card { padding: 16px; }
  .rp-count b { font-size: 28px; }
  .co-grid { grid-template-columns: 1fr; gap: 12px; }
  .im-stat { padding: 12px; gap: 10px; }
  .im-stat .pg-chip-ico { display: none; }
  .im-foot-num { font-size: 24px; }
  .im-foot .btn-primary { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .an-animate *, .an-animate .an-hero, .an-animate .an-card, .co-card, .im-done-ico,
  .im-zone.over .im-illu .arrow, .im-zone.busy .im-illu .arrow, .im-progress .progress i { animation: none !important; }
  .rp-card:hover, .co-card:hover, .an-type:hover, .an-hero-stat:hover, .us-role:hover, .im-zone.over { transform: none; }
}
.im-grid-preview { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); }
@media (max-width: 1100px) { .im-grid-preview { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .us-role-perms { display: none; }
  .us-role { gap: 8px; }
  .im-stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
}
:root[data-theme=dark] .pg-avatar[data-tone='1'] { background: linear-gradient(135deg, #6a3d40, #3d2224); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }
