/* BAYTUR — админка и рабочее место. Токены: tokens.css (генерируется из static/design/tokens.json). */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font-family: var(--font); font-size: var(--fs-body); font-weight: var(--fw-body); line-height: 1.45;
  -webkit-font-smoothing: antialiased; font-feature-settings: "ss01";
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
.num, .tabular, td.n, th.n, .kpi-value, .money { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-caption); font-weight: var(--fw-caption); }
.pos { color: var(--positive); }
.neg { color: var(--negative); }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------------------------------------------------------- каркас */
.shell { display: grid; grid-template-columns: var(--size-sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: var(--sp-m); display: flex; flex-direction: column; gap: var(--sp-s);
}
.glass {
  background: rgba(var(--surface-rgb), .66);
  backdrop-filter: blur(24px) saturate(1.5); -webkit-backdrop-filter: blur(24px) saturate(1.5);
  box-shadow: 0 1px 0 rgba(255,255,255,.35) inset, 0 12px 32px rgba(0,0,0,.05);
}
.sidebar-inner { flex: 1; border-radius: var(--r-sheet); padding: var(--sp-l) var(--sp-m); display: flex; flex-direction: column; min-height: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 var(--sp-s) var(--sp-l); font-weight: 800; letter-spacing: -.4px; font-size: 18px; }
.brand-mark { width: 34px; height: 34px; border-radius: 11px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 800; }
.brand small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.nav { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; scrollbar-width: thin; }
.nav-group { margin-top: var(--sp-m); }
.nav-group-title { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); padding: 0 var(--sp-m) 6px; }
.nav a {
  display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 var(--sp-m); border-radius: var(--r-pill);
  font-weight: 600; color: rgba(var(--ink-rgb), .82);
  transition: background var(--motion-fast) var(--motion-easing), color var(--motion-fast);
}
.nav a:hover { background: var(--fill); color: var(--ink); }
.nav a.active { background: var(--accent); color: var(--on-accent); }
.nav a .count { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--ink); color: var(--page); font-size: 12px; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.nav a.active .count { background: var(--on-accent); color: var(--accent); }
.me { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: var(--sp-m) var(--sp-s) 0; border-top: 1px solid var(--separator); margin-top: var(--sp-s); }
.me-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); display: grid; place-items: center; font-weight: 700; flex: none; }
.me-name { font-weight: 700; font-size: 13px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-role { font-size: 12px; color: var(--muted); }
.me > div { flex: 1 1 120px; }
.me .me-tools { display: flex; gap: 2px; width: 100%; padding-left: 42px; }

.main { min-width: 0; padding: var(--sp-xl) var(--sp-xl) 64px; }
.container { max-width: var(--size-content); margin: 0 auto; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-l); margin-bottom: var(--sp-xl); flex-wrap: wrap; }
.page-title { font-size: var(--fs-page-title); font-weight: var(--fw-page-title); letter-spacing: var(--ls-page-title); line-height: 1.1; }
.crumbs { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.crumbs a:hover { color: var(--ink); }
.actions { display: flex; gap: var(--sp-s); flex-wrap: wrap; align-items: center; }
.h2 { font-size: var(--fs-block-title); font-weight: var(--fw-block-title); letter-spacing: var(--ls-block-title); }
.h3 { font-size: var(--fs-section-title); font-weight: var(--fw-section-title); letter-spacing: var(--ls-section-title); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-m); margin-bottom: var(--sp-m); }
.card-head .h3 { display: flex; align-items: center; gap: 10px; }

/* ---------------------------------------------------------------- сетки */
.grid { display: grid; gap: var(--sp-l); }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: var(--sp-xl); align-items: start; }
.split-wide { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: var(--sp-l); align-items: start; }
.stack { display: flex; flex-direction: column; gap: var(--sp-l); }
.stack-s { display: flex; flex-direction: column; gap: var(--sp-s); }
.row { display: flex; align-items: center; gap: var(--sp-s); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-s); }
.wrap { flex-wrap: wrap; }
.sticky { position: sticky; top: var(--sp-xl); }

/* ---------------------------------------------------------------- карточки */
.card { background: var(--surface); border-radius: var(--r-card); padding: var(--sp-l); }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .card-head { padding: var(--sp-l) var(--sp-l) 0; }
.card-soft { background: var(--fill); border-radius: var(--r-card); padding: var(--sp-l); }
.appear { animation: appear var(--motion-slow) var(--motion-easing) both; }
.appear:nth-child(2) { animation-delay: 40ms; } .appear:nth-child(3) { animation-delay: 80ms; }
.appear:nth-child(4) { animation-delay: 120ms; } .appear:nth-child(5) { animation-delay: 160ms; }
@keyframes appear { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.hero { background: var(--card); color: var(--on-card); border-radius: var(--r-card); padding: var(--sp-xl); position: relative; overflow: hidden; }
.hero .label { color: rgba(var(--on-card-rgb), .6); font-size: 13px; font-weight: 500; }
.hero .big { font-size: var(--fs-hero); font-weight: var(--fw-hero); letter-spacing: var(--ls-hero); line-height: 1.1; font-variant-numeric: tabular-nums; margin-top: 6px; }
.hero .sub { color: rgba(var(--on-card-rgb), .6); font-size: 13px; margin-top: 4px; }
.hero .glow { position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(var(--accent-rgb), .35), transparent 70%); pointer-events: none; }
.hero-grid { display: grid; gap: var(--sp-m); grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-top: var(--sp-l); }
.hero-grid .cell { background: rgba(var(--on-card-rgb), .06); border-radius: 14px; padding: 12px 14px; }
.hero-grid .cell b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; margin-top: 2px; }

.kpi { background: var(--surface); border-radius: var(--r-card); padding: var(--sp-l); display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.kpi-label { color: var(--muted); font-size: 13px; }
.kpi-value { font-size: 26px; font-weight: 700; letter-spacing: -.6px; line-height: 1.15; }
.kpi.hero-kpi { background: var(--card); color: var(--on-card); }
.kpi.hero-kpi .kpi-label { color: rgba(var(--on-card-rgb), .6); }
.kpi.hero-kpi .kpi-value { font-size: var(--fs-hero); font-weight: var(--fw-hero); letter-spacing: var(--ls-hero); }
.delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: var(--r-pill); width: fit-content; font-variant-numeric: tabular-nums; }
.delta.up { background: rgba(var(--positive-rgb), .12); color: var(--positive); }
.delta.down { background: rgba(var(--negative-rgb), .12); color: var(--negative); }
.delta.flat { background: var(--fill); color: var(--muted); }
.hero-kpi .delta.up { background: rgba(var(--accent-rgb), .18); color: var(--accent); }
.hero-kpi .delta.down { background: rgba(255,107,107,.18); color: #FF8A8A; }
.hero-kpi .delta.flat { background: rgba(255,255,255,.08); color: rgba(var(--on-card-rgb), .6); }

/* ---------------------------------------------------------------- иконки */
.ic { flex: none; }
.ic-bubble { width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--ink); display: inline-grid; place-items: center; flex: none; }
.ic-bubble.s { width: 32px; height: 32px; }
.ic-bubble.neg { background: rgba(var(--negative-rgb), .12); color: var(--negative); }
.ic-bubble.pos { background: rgba(var(--positive-rgb), .12); color: var(--positive); }
.ic-bubble.dark { background: rgba(var(--on-card-rgb), .1); color: var(--accent); }

/* ---------------------------------------------------------------- таблицы */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: var(--fs-caption); font-weight: 500; color: var(--muted); padding: 10px var(--sp-l); white-space: nowrap; }
.table td { padding: 12px var(--sp-l); border-top: 1px solid var(--separator); vertical-align: middle; }
.table tr.link { cursor: pointer; transition: background var(--motion-fast); }
.table tr.link:hover td { background: var(--fill); }
.table tr.hl td { background: var(--accent-soft); }
.table tr.overdue td { background: rgba(var(--negative-rgb), .06); }
.table tr.overdue td:first-child { box-shadow: inset 3px 0 0 var(--negative); }
.table .n, .table th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .title-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.table .title-cell b { display: block; font-weight: 600; }
.table .thumb { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; background: var(--fill); flex: none; }
.empty { padding: 40px var(--sp-l); text-align: center; color: var(--muted); }
.empty .ic-bubble { margin: 0 auto 10px; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 12px 0; border-top: 1px solid var(--separator); }
.list > li:first-child { border-top: 0; }
.kv { display: grid; grid-template-columns: minmax(120px, 40%) 1fr; gap: 8px 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- пилюли статусов */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 11px; border-radius: var(--r-pill); font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill-live { background: var(--accent-soft); color: var(--ink); }
.pill-accent { background: var(--accent); color: var(--on-accent); }
.pill-positive { background: rgba(var(--positive-rgb), .13); color: var(--positive); }
.pill-negative { background: rgba(var(--negative-rgb), .12); color: var(--negative); }
.pill-warning { background: rgba(var(--warning-rgb), .14); color: var(--warning); }
.pill-muted { background: var(--fill); color: var(--muted); }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--positive); position: relative; }
.pill-accent .dot { background: var(--on-accent); }
.pill .dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: inherit; animation: pulse 1.6s ease-out infinite; }
@keyframes pulse { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(2.8); opacity: 0; } }
.tag { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: var(--r-chip); background: var(--fill); font-size: 12px; font-weight: 600; }
.tag.accent { background: var(--accent); color: var(--on-accent); }

/* уровни */
.tier-badge { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px 0 4px; border-radius: var(--r-pill); color: #fff; font-size: 12px; font-weight: 700; text-shadow: 0 1px 1px rgba(0,0,0,.25); }
.tier-card { border-radius: var(--r-card); padding: var(--sp-l); color: #fff; position: relative; overflow: hidden; min-height: 132px; display: flex; flex-direction: column; justify-content: space-between; }
.tier-card .medal { filter: drop-shadow(0 4px 10px rgba(0,0,0,.25)); }
.tier-card .shine { position: absolute; inset: 0; background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.18) 45%, transparent 60%); pointer-events: none; }
.progress { height: 8px; border-radius: 4px; background: rgba(255,255,255,.18); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 4px; background: var(--accent); transition: width var(--motion-slow) var(--motion-easing); }

/* шкала этапов (StatusTimeline) */
.timeline { list-style: none; margin: 0; padding: 0; display: flex; gap: 0; }
.timeline li { flex: 1; position: relative; padding-top: 22px; min-width: 0; }
.timeline li::before { content: ""; position: absolute; top: 7px; left: 0; right: 0; height: 2px; background: var(--separator); }
.timeline li:first-child::before { left: 50%; } .timeline li:last-child::before { right: 50%; }
.timeline li.done::before { background: var(--ink); }
.timeline li i { position: absolute; top: 0; left: 50%; margin-left: -8px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); border: 2px solid var(--separator); }
.timeline li.done i { background: var(--ink); border-color: var(--ink); }
.timeline li.current i { background: var(--accent); border-color: var(--ink); box-shadow: 0 0 0 4px var(--accent-soft); }
.timeline li.negative.done i { background: var(--negative); border-color: var(--negative); box-shadow: 0 0 0 4px rgba(var(--negative-rgb), .15); }
.timeline li.next i { border-color: var(--ink); animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { border-color: var(--separator); } }
.timeline b { display: block; text-align: center; font-size: 12px; font-weight: 600; padding: 0 4px; }
.timeline small { display: block; text-align: center; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- кнопки и формы */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--size-button-m); padding: 0 18px; border-radius: var(--r-pill); border: 0; cursor: pointer; font-weight: 600; background: var(--fill); color: var(--ink); white-space: nowrap; transition: transform var(--motion-fast) var(--motion-easing), background var(--motion-fast), opacity var(--motion-fast); -webkit-tap-highlight-color: transparent; }
.btn:hover { background: rgba(var(--ink-rgb), .1); }
.btn:active { transform: scale(.97); }
.btn[disabled], .btn.disabled { opacity: .45; pointer-events: none; }
.btn-accent { background: var(--accent); color: var(--on-accent); }
.btn-accent:hover { background: var(--accent); filter: brightness(.97); }
.btn-dark { background: var(--ink); color: var(--page); }
.btn-dark:hover { background: var(--ink); opacity: .9; }
.btn-danger { background: rgba(var(--negative-rgb), .12); color: var(--negative); }
.btn-danger:hover { background: rgba(var(--negative-rgb), .18); }
.btn-ghost { background: transparent; }
.btn-l { height: var(--size-button-l); padding: 0 24px; font-size: 16px; }
.btn-s { height: 34px; padding: 0 13px; font-size: 13px; }
.btn-icon { width: var(--size-button-m); padding: 0; }
.btn-icon.btn-s { width: 34px; }
.btn-block { width: 100%; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 13px; font-weight: 600; color: rgba(var(--ink-rgb), .8); }
.field .help { font-size: 12px; color: var(--muted); }
.field .err, .errorlist { color: var(--negative); font-size: 12px; margin: 0; padding: 0; list-style: none; }
.input, .field input[type=text], .field input[type=email], .field input[type=password], .field input[type=number],
.field input[type=url], .field input[type=date], .field input[type=datetime-local], .field input[type=time],
.field input[type=tel], .field input[type=search], .field select, .field textarea, .input-plain {
  width: 100%; min-height: 44px; padding: 10px 14px; border-radius: var(--r-chip); border: 0; background: var(--fill); outline: none;
  color: var(--ink); font-family: inherit; font-size: inherit; -webkit-appearance: none; appearance: none;
  transition: box-shadow var(--motion-fast), background var(--motion-fast); font-weight: 500;
}
.field textarea { resize: vertical; line-height: 1.5; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { background: var(--surface); box-shadow: 0 0 0 2px var(--accent), 0 0 0 5px rgba(var(--accent-rgb), .25); }
.field [disabled], .field [data-locked] { opacity: .6; cursor: not-allowed; }
.field.has-error input, .field.has-error textarea, .field.has-error select { box-shadow: 0 0 0 2px rgba(var(--negative-rgb), .5); }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.check input { width: 22px; height: 22px; accent-color: var(--ink); }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label, .choice { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: var(--r-chip); background: var(--fill); cursor: pointer; font-weight: 600; font-size: 13px; }
.checks input, .choice input { accent-color: var(--ink); }
.checks label:has(input:checked), .choice:has(input:checked) { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--ink); }
.checks ul, .checks > div { display: contents; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-m) var(--sp-l); }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: var(--sp-s); justify-content: flex-end; flex-wrap: wrap; margin-top: var(--sp-l); }
.lock-note { display: flex; gap: 10px; align-items: center; background: var(--fill); border-radius: var(--r-chip); padding: 10px 14px; font-size: 13px; color: var(--muted); }

/* локализуемое поле: три вкладки */
.l10n { display: flex; flex-direction: column; gap: 6px; }
.l10n-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.l10n-tabs { align-self: flex-start; display: inline-flex; background: var(--fill); border-radius: var(--r-pill); padding: 3px; gap: 2px; }
.l10n-tabs button { border: 0; background: transparent; height: 26px; padding: 0 10px; border-radius: var(--r-pill); font-size: 12px; font-weight: 700; cursor: pointer; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.l10n-tabs button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.l10n-tabs button .miss { width: 6px; height: 6px; border-radius: 50%; background: var(--negative); display: none; }
.l10n-tabs button.empty .miss { display: block; }
.l10n-pane { display: none; }
.l10n-pane.on { display: block; }

/* сегментированные вкладки и фильтры */
.seg { display: inline-flex; background: var(--fill); border-radius: var(--r-pill); padding: 4px; gap: 2px; flex-wrap: wrap; }
.seg a, .seg button { height: 34px; padding: 0 14px; border-radius: var(--r-pill); display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; color: var(--muted); border: 0; background: transparent; cursor: pointer; white-space: nowrap; }
.seg a.on, .seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.seg .count { font-variant-numeric: tabular-nums; opacity: .7; }
.filters { display: flex; flex-wrap: wrap; gap: var(--sp-s); align-items: flex-end; margin-bottom: var(--sp-l); }
.filters .field { min-width: 140px; flex: 0 1 180px; }
.filters .field.grow { flex: 1 1 220px; }
.filters .field > label { font-size: 12px; font-weight: 500; color: var(--muted); }
.search { position: relative; }
/* иконка — по центру самого поля (оно всегда внизу блока), а не всего блока вместе с подписью */
.search .ic { position: absolute; left: 14px; bottom: 13px; color: var(--muted); pointer-events: none; }
.search input { padding-left: 42px !important; }
.search input::-webkit-search-decoration { -webkit-appearance: none; }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.search input::placeholder, .field input::placeholder, .field textarea::placeholder { color: var(--muted); opacity: 1; }

/* сетка иконок */
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 8px; }
.icon-grid label { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px 8px; border-radius: 14px; background: var(--fill); cursor: pointer; font-size: 10px; color: var(--muted); text-align: center; transition: background var(--motion-fast), transform var(--motion-fast); }
.icon-grid label:hover { transform: translateY(-1px); }
.icon-grid label .ic-bubble { width: 36px; height: 36px; background: var(--surface); }
.icon-grid input { position: absolute; opacity: 0; pointer-events: none; }
.icon-grid label:has(input:checked), .icon-grid button.on { background: var(--accent-soft); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.icon-grid button { border: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px 8px; border-radius: 14px; background: var(--fill); cursor: pointer; font-size: 10px; color: var(--muted); }
.icon-grid button .ic-bubble { width: 36px; height: 36px; background: var(--surface); }

/* галерея с перетаскиванием */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.gallery .g-item { position: relative; aspect-ratio: 4 / 3; border-radius: var(--r-photo); overflow: hidden; background: var(--fill); cursor: grab; transition: transform var(--motion-fast), opacity var(--motion-fast); touch-action: none; }
.gallery .g-item img { width: 100%; height: 100%; object-fit: cover; }
.gallery .g-item.dragging { opacity: .4; transform: scale(.96); }
.gallery .g-item .g-rm { position: absolute; top: 6px; right: 6px; }
.gallery .g-item .g-main { position: absolute; left: 8px; bottom: 8px; }
.gallery .g-add { aspect-ratio: 4 / 3; border-radius: var(--r-photo); border: 2px dashed var(--separator); display: grid; place-items: center; color: var(--muted); cursor: pointer; background: transparent; }
.photo-field { display: flex; gap: var(--sp-m); align-items: center; }
.photo-field .ph { width: 120px; aspect-ratio: 4/3; border-radius: var(--r-photo); background: var(--fill) center / cover no-repeat; flex: none; display: grid; place-items: center; color: var(--muted); }
.photo-field .ph.has { color: transparent; }
.dropzone.over { box-shadow: 0 0 0 2px var(--accent); }

/* редактор списков (что входит, слайды) */
.rows-editor .re-row { display: grid; grid-template-columns: 28px 52px minmax(0, 1fr) 34px; gap: 10px; align-items: start; padding: 12px; border-radius: 16px; background: var(--fill); margin-bottom: 8px; }
.rows-editor .re-row.dragging { opacity: .5; }
.rows-editor .re-handle { cursor: grab; color: var(--muted); padding-top: 12px; touch-action: none; }
.rows-editor .re-icon { width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--accent-soft); display: grid; place-items: center; cursor: pointer; }
.rows-editor .re-langs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.rows-editor .re-langs input, .rows-editor .re-langs textarea, .rows-editor select { width: 100%; min-height: 40px; border: 0; border-radius: 10px; background: var(--surface); padding: 8px 10px; outline: none; }
.rows-editor .re-langs input:focus { box-shadow: 0 0 0 2px var(--accent); }
.rows-editor .re-langs .miss { box-shadow: inset 0 0 0 1.5px rgba(var(--negative-rgb), .5); }
.rows-editor .re-row.re-plain { grid-template-columns: 28px minmax(0, 1fr) 34px; }
.rows-editor .re-fields { display: grid; gap: 8px; }
.rows-editor .re-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.rows-editor .re-cap { font-size: 12px; color: var(--muted); }
.rows-editor .re-langs textarea { min-height: 96px; resize: vertical; font: inherit; }
.rows-editor .re-pair input, .rows-editor .re-pair select { width: 100%; min-height: 40px; border: 0; border-radius: 10px; background: var(--surface); padding: 8px 10px; outline: none; }
.rows-editor .re-check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.rows-editor [data-pick-image] { width: 100%; height: 120px; border-radius: 14px; border: 0; background: var(--surface) center/cover; display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.rows-editor [data-pick-image].has-image > * { display: none; }
.popover { position: absolute; z-index: 60; background: var(--surface); border-radius: 20px; padding: 14px; width: min(420px, 92vw); box-shadow: 0 24px 60px rgba(0,0,0,.18); animation: appear var(--motion-base) var(--motion-easing); }

/* ---------------------------------------------------------------- боковая панель / нижний лист */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.28); z-index: 80; opacity: 0; transition: opacity var(--motion-base); }
.sheet-backdrop.open { opacity: 1; }
.sheet { position: fixed; z-index: 90; top: 12px; right: 12px; bottom: 12px; width: min(560px, calc(100vw - 24px)); background: var(--page); border-radius: var(--r-sheet); overflow-y: auto; padding: var(--sp-xl); transform: translateX(110%); transition: transform var(--motion-slow) var(--motion-easing); box-shadow: 0 30px 80px rgba(0,0,0,.2); }
.sheet.open { transform: none; }
.sheet-close { position: sticky; top: 0; float: right; z-index: 2; }
.sheet .grabber { display: none; }

/* ---------------------------------------------------------------- сообщения */
.toasts { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(560px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-radius: 18px; background: var(--card); color: var(--on-card); box-shadow: 0 16px 40px rgba(0,0,0,.2); animation: toast-in var(--motion-slow) var(--motion-easing); font-weight: 600; }
.toast .ic-bubble { width: 32px; height: 32px; }
.toast.success .ic-bubble { background: var(--accent); color: var(--on-accent); }
.toast.error .ic-bubble { background: var(--negative); color: #fff; }
.toast.warning .ic-bubble { background: var(--warning); color: #fff; }
.toast.hide { opacity: 0; transform: translateY(-8px); transition: all var(--motion-base); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-12px) scale(.98); } to { opacity: 1; transform: none; } }
.banner { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: var(--r-card); background: var(--accent-soft); font-weight: 600; }
.banner.neg { background: rgba(var(--negative-rgb), .1); color: var(--negative); }
.banner.warn { background: rgba(var(--warning-rgb), .12); }

/* ---------------------------------------------------------------- графики */
.chart-wrap { position: relative; }
.chart { width: 100%; height: 220px; display: block; overflow: visible; }
.chart .grid { stroke: var(--separator); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 900ms var(--motion-easing) forwards; }
.chart .area { fill: rgba(var(--accent-rgb), .35); animation: appear var(--motion-slow) both; }
.chart .bar { transition: opacity var(--motion-fast); }
.chart .bar:hover { opacity: .8; }
.chart .cross { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0; vector-effect: non-scaling-stroke; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.chart-tip { position: absolute; top: 0; pointer-events: none; background: var(--card); color: var(--on-card); border-radius: 12px; padding: 8px 10px; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; transform: translateX(-50%); box-shadow: 0 8px 24px rgba(0,0,0,.18); z-index: 3; }
.chart-tip b { display: block; margin-bottom: 2px; }
.chart-tip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.chart-empty { height: 160px; display: grid; place-items: center; color: var(--muted); background: var(--fill); border-radius: 14px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------------------------------------------------------------- очередь сотрудника */
.queue { display: flex; flex-direction: column; gap: 10px; }
.q-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; background: var(--surface); border-radius: var(--r-card); padding: 14px 16px; transition: transform var(--motion-fast), box-shadow var(--motion-fast); }
.q-item:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(0,0,0,.05); }
.q-item.new { animation: q-new 1.2s var(--motion-easing); }
@keyframes q-new { 0% { box-shadow: 0 0 0 0 rgba(var(--accent-rgb), .9); transform: translateY(-6px); } 100% { box-shadow: 0 0 0 14px rgba(var(--accent-rgb), 0); transform: none; } }
.q-item .q-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-item .q-meta { color: var(--muted); font-size: 13px; display: flex; gap: 10px; flex-wrap: wrap; }
.q-item .q-sum { text-align: right; }
.q-item .q-sum b { font-size: 18px; font-variant-numeric: tabular-nums; display: block; }
.live-dot { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
.live-dot i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.live-dot.on i { background: var(--positive); box-shadow: 0 0 0 4px rgba(var(--positive-rgb), .15); }
.split-amounts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.split-amounts .cell { background: var(--fill); border-radius: 14px; padding: 12px 14px; }
.split-amounts .cell b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.split-amounts .cell.accent { background: var(--accent-soft); }
.cash-box { display: flex; gap: 14px; align-items: center; background: var(--card); color: var(--on-card); border-radius: var(--r-card); padding: 16px 18px; }
.cash-box b { font-size: 24px; font-variant-numeric: tabular-nums; }
.cash-box .check { color: var(--on-card); font-size: 16px; }
.cash-box .check input { width: 28px; height: 28px; accent-color: var(--accent); }
.paid-box { display: flex; gap: 12px; align-items: center; background: rgba(var(--positive-rgb), .1); color: var(--positive); border-radius: var(--r-card); padding: 14px 16px; font-weight: 700; }
.big-actions { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 10px; }
.big-actions .btn { height: 56px; font-size: 16px; }
.reasons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.reasons label { height: 52px; }
.preview-split { display: none; }
.preview-split.on { display: block; animation: appear var(--motion-base) both; }
.scanner { position: relative; border-radius: var(--r-photo); overflow: hidden; background: #000; aspect-ratio: 4 / 3; }
.scanner video { width: 100%; height: 100%; object-fit: cover; }
.scanner .frame { position: absolute; inset: 18%; border: 3px solid var(--accent); border-radius: 24px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }

/* ---------------------------------------------------------------- переписка (обращения) */
.thread { display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 78%; padding: 12px 14px; border-radius: 18px; background: var(--fill); }
.msg.resort { align-self: flex-end; background: var(--accent-soft); border-bottom-right-radius: 6px; }
.msg.client { border-bottom-left-radius: 6px; }
.msg .meta { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.msg .photos { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.msg .photos img { width: 96px; height: 96px; object-fit: cover; border-radius: 14px; }
.note { background: rgba(var(--warning-rgb), .1); border-radius: 14px; padding: 10px 12px; }
.note .meta { font-size: 11px; color: var(--muted); }

/* ---------------------------------------------------------------- рамка телефона «как в приложении» */
.preview-panel { position: sticky; top: var(--sp-xl); }
.preview-controls { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.phone { width: 340px; max-width: 100%; margin: 0 auto; border-radius: 48px; padding: 10px; background: #0b0c0a; box-shadow: 0 30px 60px rgba(0,0,0,.18), inset 0 0 0 2px #2a2c28; }
.phone-screen { border-radius: 38px; overflow: hidden; background: var(--page); color: var(--ink); height: 660px; overflow-y: auto; position: relative; scrollbar-width: none; font-family: var(--font); }
.phone-screen::-webkit-scrollbar { display: none; }
.phone-notch { position: sticky; top: 0; height: 34px; display: flex; justify-content: space-between; align-items: center; padding: 0 26px; font-size: 12px; font-weight: 700; z-index: 3; background: var(--page); }
.phone-notch::after { content: ""; position: absolute; left: 50%; top: 8px; width: 90px; height: 24px; margin-left: -45px; border-radius: 14px; background: #0b0c0a; }
.p-miss { outline: 1.5px dashed var(--negative); outline-offset: 2px; border-radius: 4px; }
.p-miss-badge { display: none; }
.p-has-miss .p-miss-badge { display: inline-flex; }
.p-pad { padding: 14px 16px; }
.p-photo { width: 100%; aspect-ratio: 4 / 3; border-radius: 20px; background: var(--fill) center / cover no-repeat; position: relative; }
.p-photo.tall { aspect-ratio: 3 / 4; }
.p-title { font-size: 22px; font-weight: 800; letter-spacing: -.5px; line-height: 1.15; }
.p-sub { color: var(--muted); font-size: 13px; }
.p-card { background: var(--surface); border-radius: 18px; padding: 14px; }
.p-chip { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 12px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; }
.p-feat { display: flex; gap: 10px; align-items: center; font-size: 13px; font-weight: 600; }
.p-feat .ic-bubble { width: 34px; height: 34px; }
.p-btn { height: 48px; border-radius: 999px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 700; }
.p-price { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.p-cash { display: inline-flex; align-items: center; gap: 6px; background: var(--accent-soft); border-radius: 12px; padding: 4px 10px; font-size: 12px; font-weight: 700; }
.p-banner { border-radius: 24px; background: var(--card); color: var(--on-card); padding: 18px; min-height: 180px; position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; gap: 8px; }
.p-banner .cut { position: absolute; right: -10px; top: -10px; width: 58%; height: 80%; background: center / contain no-repeat; }
.p-story { height: 100%; min-height: 626px; padding-bottom: 64px !important; background: #000 center / cover no-repeat; color: #fff; position: relative; display: flex; flex-direction: column; justify-content: flex-end; padding: 20px 18px 28px; gap: 8px; }
.p-story::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.25), transparent 30%, rgba(0,0,0,.7)); }
.p-story > * { position: relative; }
.p-story .bars { position: absolute; top: 44px; left: 12px; right: 12px; display: flex; gap: 4px; }
.p-story .bars i { flex: 1; height: 3px; border-radius: 2px; background: rgba(255,255,255,.35); }
.p-story .bars i.on { background: #fff; }
.p-story-nav { display: flex; justify-content: center; gap: 8px; margin-top: 10px; }
.p-quote { border-left: 3px solid var(--accent); padding-left: 12px; font-weight: 600; font-style: italic; }

/* ---------------------------------------------------------------- вход */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 600px at 20% -10%, rgba(var(--accent-rgb), .35), transparent 60%), var(--page); }
.auth-card { width: min(420px, 100%); background: var(--surface); border-radius: var(--r-sheet); padding: 32px; animation: appear var(--motion-slow) var(--motion-easing); }
.auth-card .brand { padding: 0 0 24px; }
.qr { background: #fff; border-radius: 20px; padding: 14px; width: 220px; margin: 0 auto; }
.qr svg { width: 100%; height: auto; display: block; }
.code-input { font-size: 28px !important; letter-spacing: 10px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 700 !important; }

/* ---------------------------------------------------------------- пагинация */
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px var(--sp-l); border-top: 1px solid var(--separator); font-size: 13px; color: var(--muted); }

/* ---------------------------------------------------------------- нижние вкладки (планшет / телефон) */
.tabbar { display: none; }
.mobile-top { display: none; }
@media (max-width: 1180px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .preview-panel { position: static; }
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .btn-action { height: var(--size-button-l); font-size: 16px; }
}
@media (max-width: 1024px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .main { padding: var(--sp-l) var(--sp-l) 120px; }
  .mobile-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-m); }
  .tabbar {
    display: flex; position: fixed; z-index: 70; left: 50%; transform: translateX(-50%); bottom: max(12px, env(safe-area-inset-bottom));
    border-radius: var(--r-pill); padding: 6px; gap: 2px; width: min(640px, calc(100vw - 24px));
  }
  .tabbar a, .tabbar button { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: 58px; border-radius: var(--r-pill); font-size: 11px; font-weight: 600; color: rgba(var(--ink-rgb), .7); border: 0; background: transparent; position: relative; }
  .tabbar a.active { background: var(--accent); color: var(--on-accent); }
  .tabbar .count { position: absolute; top: 6px; right: calc(50% - 22px); min-width: 18px; height: 18px; border-radius: 9px; background: var(--negative); color: #fff; font-size: 10px; display: grid; place-items: center; padding: 0 5px; font-variant-numeric: tabular-nums; }
  .split-wide { grid-template-columns: minmax(0, 1fr); }
  .sheet { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 92vh; border-radius: var(--r-sheet) var(--r-sheet) 0 0; transform: translateY(105%); padding: var(--sp-l); }
  .sheet .grabber { display: block; width: 44px; height: 5px; border-radius: 3px; background: var(--separator); margin: -6px auto 12px; }
  .btn-action, .big-actions .btn { height: max(var(--size-button-l), 56px); }
}
@media (max-width: 720px) {
  .cols-2, .cols-3, .cols-4, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .page-title { font-size: 26px; }
  .card { padding: var(--sp-m); }
  .table th, .table td { padding: 10px 12px; }
  .table .hide-s { display: none; }
  .big-actions { grid-template-columns: 1fr 1fr; }
  .big-actions .btn:first-child { grid-column: 1 / -1; }
  .reasons { grid-template-columns: 1fr; }
  .split-amounts { grid-template-columns: 1fr 1fr; }
  .rows-editor .re-langs, .rows-editor .re-pair { grid-template-columns: 1fr; }
  .rows-editor .re-row { grid-template-columns: 24px 44px minmax(0, 1fr) 34px; }
  .phone { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0ms !important; animation-delay: 0ms !important; transition-duration: 0ms !important; }
  .pill .dot::after { display: none; }
  .chart .line { stroke-dashoffset: 0; }
}

/* перетаскивание строк и карточек: поднятая строка + плавная перестановка (FLIP в panel.js) */
[data-handle], .re-handle { cursor: grab; touch-action: none; }
.is-sorting, .is-sorting * { cursor: grabbing !important; user-select: none; }
tr.dragging > td { background: var(--accent-soft); }
tr.dragging > td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
tr.dragging { position: relative; z-index: 2; }
.re-row.dragging, .g-item.dragging { box-shadow: 0 10px 28px rgba(0, 0, 0, .18); }
.avatar-s { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: none; }
.avatar-l { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex: none; }
/* галерея: файл по ссылке не найден — плитка вместо битой картинки */
.gallery .g-item.missing img { visibility: hidden; }
.gallery .g-item.missing::before { content: 'Файл не найден'; position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 12px; font-weight: 600; color: var(--muted); background: var(--fill); text-align: center; padding: 8px; }
/* выбор цвета градиента уровня */
.color-pick { display: inline-flex; align-items: center; gap: 10px; background: var(--fill); border-radius: var(--r-chip); padding: 6px 12px 6px 6px; cursor: pointer; }
.color-input { width: 40px; height: 32px; padding: 0; border: 0; border-radius: 10px; background: none; cursor: pointer; }
.color-input::-webkit-color-swatch-wrapper { padding: 0; }
.color-input::-webkit-color-swatch { border: 0; border-radius: 10px; }
.tier-card .tier-edit { background: rgba(255,255,255,.18); color: #fff; }
/* оплата баллами по QR */
.pay-box { background: var(--accent-soft); border-radius: var(--r-card); padding: var(--sp-l); }
.pay-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--sp-m); }
@media (max-width: 700px) { .pay-grid { grid-template-columns: minmax(0, 1fr); } }
.pay-result { background: var(--surface); border-radius: var(--r-chip); padding: 14px 16px; display: grid; gap: 6px; }
.pay-sum { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pay-status { font-weight: 800; font-size: 18px; }
.pay-status.ok { color: var(--positive); }
.pay-status.bad { color: var(--negative); }
.pay-result.bad { box-shadow: inset 0 0 0 2px rgba(var(--negative-rgb), .45); }
.btn-xl { min-height: 56px; font-size: 17px; padding: 0 26px; }
.paid { max-width: 520px; margin: 40px auto; text-align: center; display: grid; gap: 14px; justify-items: center; }
.paid-check { width: 88px; height: 88px; border-radius: 50%; background: var(--accent); color: var(--on-accent, #12140F); display: grid; place-items: center; }
.paid-sum { font-size: 36px; font-weight: 700; }
.paid-card { width: 100%; text-align: left; }
.pay-box .btn-accent:disabled { background: var(--fill); color: var(--muted); opacity: 1; cursor: not-allowed; }

/* переключатель режима экосистемы (ТЗ §7.1) */
.mode-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 18px; }
.mode-bar .mode-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dot); display: inline-block; }
.mode-bar .seg a.on { box-shadow: inset 0 -3px 0 var(--dot), 0 1px 3px rgba(0,0,0,.06); }
