/* =========================================================================
   hosting.belles.kz — ui.css: компоненты админки (P16 H1)
   Источник: _tasks/photo/design-lab/hosting/ui.css; варианты лаборатории сняты под выбор владельца
   (OWNER-CHOICE.md: sidebar=labeled, density=compact, rows=lines, pagination=bar, reorder=drag, accent=brand):
   выбранный вариант записан как :root …, остальные удалены. Порядок: база → каркас → контролы →
   данные (таблица/сетка) → оверлеи → загрузка → прочее → раунд 2.
   ========================================================================= */

/* ---------- База ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scrollbar-gutter: stable; }
body {
  margin: 0; min-height: 100vh; background: var(--canvas); color: var(--text);
  font: var(--fw-regular) var(--fs-md)/var(--lh) var(--font);
  font-feature-settings: var(--font-features);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3 { letter-spacing: var(--tracking-head); line-height: var(--lh-tight); text-wrap: balance; font-weight: var(--fw-semibold); }
a { color: var(--accent-ui); text-decoration-thickness: 1px; text-underline-offset: 3px; }
::selection { background: color-mix(in srgb, var(--brand) 16%, transparent); color: var(--text); }
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--r-sm); }
.tnum, td.num, .num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: var(--r-ctl); text-decoration: none; }
.skip-link:focus { top: 12px; }
[hidden] { display: none !important; }

/* Тонкие скроллбары в цвет темы */
* { scrollbar-width: thin; scrollbar-color: #d4d4d8 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d4d4d8; border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }

/* Иконки: SVG-спрайт, currentColor */
.ic { width: 20px; height: 20px; flex: none; color: currentColor; }
.ic--sm { width: 16px; height: 16px; }
.ic--lg { width: 24px; height: 24px; }
.ic--xl { width: 32px; height: 32px; }
/* наборы рисуют по-разному: заливку Phosphor/Solar не трогаем, у Hugeicons/Lucide — обводка */
.ic use { pointer-events: none; }

/* ---------- Каркас ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

.main { min-width: 0; display: flex; flex-direction: column; }

/* Сайдбар */
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--line); z-index: var(--z-sidebar);
}
.sidebar__head { display: flex; align-items: center; gap: var(--s-2); height: var(--topbar-h); padding: 0 var(--s-4) 0 var(--s-5); flex: none; }
.sidebar__logo { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; min-width: 0; }
.sidebar__logo img { height: 24px; width: auto; }
.sidebar__logo-caption { font-size: var(--fs-sm); color: var(--text-2); padding-left: 10px; border-left: 1px solid var(--line); white-space: nowrap; }
.sidebar__close { margin-left: auto; display: none; }
.sidebar__scroll { flex: 1; overflow-y: auto; padding: var(--s-2) var(--s-3) var(--s-4); }
.sidebar__foot { flex: none; padding: var(--s-3); border-top: 1px solid var(--line); display: grid; gap: var(--s-1); }

.nav__group + .nav__group { margin-top: var(--s-3); }
.nav__group-head {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  height: 32px; padding: 0 var(--s-3); border: 0; background: none; border-radius: var(--r-sm);
  font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--text-3); text-transform: none; letter-spacing: .01em;
}
.nav__group-head:hover { color: var(--text-2); }
.nav__group-head .ic { width: 16px; height: 16px; transition: transform var(--dur-2) var(--ease-out); }
.nav__group[data-collapsed] .nav__group-head .ic { transform: rotate(-90deg); }
.nav__list { display: grid; gap: 2px; overflow: hidden; }
.nav__divider { height: 1px; background: var(--line); margin: var(--s-3) var(--s-3); border: 0; }
.nav__item {
  position: relative; display: flex; align-items: center; gap: var(--s-3);
  min-height: 40px; padding: 0 var(--s-3); border-radius: var(--r-ctl);
  color: var(--text-2); text-decoration: none; font-weight: var(--fw-medium); font-size: var(--fs-md);
  transition: background-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
}
.nav__item .ic { color: var(--text-3); transition: color var(--dur-1) var(--ease-out); }
.nav__item:hover { background: var(--surface-hover); color: var(--text); }
.nav__item:hover .ic { color: var(--text-2); }
.nav__item[aria-current="page"] { background: var(--nav-active-bg); color: var(--nav-active-fg); }
.nav__item[aria-current="page"] .ic { color: var(--nav-active-icon); }

.nav__label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav__counts { display: flex; gap: 4px; }
.nav__count {
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--r-pill); display: inline-grid; place-items: center;
  font-size: var(--fs-xs); font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums;
  background: var(--neutral-bg); color: var(--neutral);
}
.nav__count--wait { background: var(--info-bg); color: var(--info); }
.nav__count--soon { background: var(--warning-bg); color: var(--warning); }
.nav__count--overdue { background: var(--danger-bg); color: var(--danger); }

.sidebar__copy { font-size: var(--fs-xs); color: var(--text-3); padding: var(--s-1) var(--s-3) 0; }

:root .nav__group-head { pointer-events: none; }
:root .nav__group-head .ic { display: none; }

/* Верхняя строка */
.topbar {
  position: sticky; top: 0; z-index: var(--z-sticky); height: var(--topbar-h);
  display: flex; align-items: center; gap: var(--s-3); padding: 0 var(--page-pad);
  background: color-mix(in srgb, var(--canvas) 92%, transparent);
  border-bottom: 1px solid transparent; transition: border-color var(--dur-2) var(--ease-out), background-color var(--dur-2);
}
.topbar.is-scrolled { border-bottom-color: var(--line); background: var(--canvas); }
.topbar__burger, .topbar__logo { display: none; }
.topbar__search { position: relative; flex: 0 1 380px; }
.topbar__search .input { padding-left: 38px; padding-right: 52px; background: var(--surface); }
.topbar__search > .ic { position: absolute; left: 12px; top: 50%; translate: 0 -50%; color: var(--text-3); pointer-events: none; }
.kbd {
  display: inline-grid; place-items: center; min-width: 24px; height: 22px; padding: 0 6px;
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; background: var(--surface-2);
  font: var(--fw-medium) 11px/1 var(--font); color: var(--text-3);
}
.topbar__search .kbd { position: absolute; right: 10px; top: 50%; translate: 0 -50%; }
.topbar__spacer { flex: 1; }
.topbar__actions { display: flex; align-items: center; gap: var(--s-2); }

.bell { position: relative; }
.bell__dot { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 2px var(--canvas); }

/* Аватар */
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none; display: inline-grid; place-items: center;
  background: var(--brand-soft); color: var(--brand); font-weight: var(--fw-semibold); font-size: var(--fs-sm);
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--sm { width: 28px; height: 28px; font-size: 11px; }
.avatar--lg { width: 64px; height: 64px; font-size: var(--fs-lg); }
.avatar--ink { background: var(--neutral-bg); color: var(--neutral); }

/* Страница */
.page { flex: 1; padding: var(--s-2) var(--page-pad) var(--s-12); }
.page__inner { max-width: var(--content-max); margin: 0 auto; display: grid; gap: var(--stack); min-width: 0; }
.page__inner > * { min-width: 0; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; padding-top: var(--s-4); }
.page-head__title { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.page-head h1 { font-size: var(--fs-xl); }
.page-head__sub { color: var(--text-2); font-size: var(--fs-sm); margin-top: 4px; }
.page-head__actions { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); text-decoration: none; font-size: var(--fs-sm); font-weight: var(--fw-medium); min-height: 32px; }
.back-link:hover { color: var(--text); }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--text-3); flex-wrap: wrap; }
.crumbs a { color: var(--text-2); text-decoration: none; }
.crumbs a:hover { color: var(--text); text-decoration: underline; }
.page-foot { max-width: var(--content-max); margin: 0 auto; padding: var(--s-6) 0 0; color: var(--text-3); font-size: var(--fs-xs); display: flex; justify-content: space-between; gap: var(--s-4); }

/* Мобильная оболочка (< 1024): сайдбар — выезжающая панель */
.overlay { position: fixed; inset: 0; background: var(--overlay); z-index: var(--z-overlay); opacity: 0; pointer-events: none; transition: opacity var(--dur-3) var(--ease-out); }
.overlay.is-open { opacity: 1; pointer-events: auto; }
@media (max-width: 1023px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; height: auto; width: min(304px, 86vw); z-index: calc(var(--z-overlay) + 1);
    translate: -100% 0; transition: translate var(--dur-4) var(--ease-emph); box-shadow: var(--shadow-lg);
  }
  .sidebar.is-open { translate: 0 0; }
  .sidebar__close { display: inline-flex; }
  .nav__item { min-height: 48px; }
  .topbar__burger { display: inline-flex; }
  .topbar__logo { display: flex; align-items: center; }
  .topbar__logo img { height: 22px; width: auto; }
}
@media (max-width: 767px) {
  .topbar { gap: var(--s-1); padding: 0 var(--s-2) 0 var(--s-1); background: var(--canvas); }
  .topbar__search { display: none; }
  .topbar__primary .btn__label { display: none; }
  .topbar__primary { width: var(--tap); padding: 0; }
  .page { padding: var(--s-2) var(--page-pad) 96px; }
  .page-head { padding-top: var(--s-2); }
  .page-head__actions { width: 100%; }
  .page-head__actions > .btn { flex: 1; }
  .page-foot { flex-direction: column; gap: var(--s-1); }
}

/* ---------- Кнопки ---------- */
.btn {
  --btn-bg: var(--surface); --btn-fg: var(--text); --btn-line: var(--line); --btn-bg-hover: var(--surface-hover); --btn-bg-press: var(--surface-press);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  height: var(--ctl-h); padding: 0 var(--s-4); border-radius: var(--r-ctl);
  border: 1px solid var(--btn-line); background: var(--btn-bg); color: var(--btn-fg);
  font-weight: var(--fw-medium); font-size: var(--fs-md); line-height: 1; white-space: nowrap; text-decoration: none;
  box-shadow: var(--shadow-xs); user-select: none; -webkit-tap-highlight-color: transparent;
  transition: background-color var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out), color var(--dur-1), transform var(--dur-1) var(--ease-out), box-shadow var(--dur-1);
}
.btn:hover { background: var(--btn-bg-hover); }
.btn:active:not(:disabled):not(.is-loading) { background: var(--btn-bg-press); transform: scale(.98); }
.btn:focus-visible { border-radius: var(--r-ctl); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn .ic { width: 18px; height: 18px; }
.btn--primary { --btn-bg: var(--primary-bg); --btn-fg: var(--primary-fg); --btn-line: transparent; --btn-bg-hover: var(--primary-bg-hover); --btn-bg-press: var(--primary-bg-press); box-shadow: var(--shadow-sm); }
.btn--ink { --btn-bg: var(--ink); --btn-fg: #fff; --btn-line: transparent; --btn-bg-hover: var(--ink-hover); --btn-bg-press: var(--ink-press); }
.btn--danger { --btn-bg: var(--danger-solid); --btn-fg: #fff; --btn-line: transparent; --btn-bg-hover: var(--danger-solid-hover); --btn-bg-press: #8e1b13; }
.btn--danger-soft { --btn-fg: var(--danger); --btn-bg-hover: var(--danger-bg); }
.btn--ghost { --btn-bg: transparent; --btn-line: transparent; --btn-fg: var(--text-2); box-shadow: none; }
.btn--ghost:hover { color: var(--text); }
.btn--sm { height: var(--ctl-h-sm); padding: 0 var(--s-3); font-size: var(--fs-sm); gap: 6px; }
.btn--lg { height: 48px; padding: 0 var(--s-6); font-size: var(--fs-md); }
.btn--block { width: 100%; }
.btn--icon { width: var(--ctl-h); padding: 0; }
.btn--icon.btn--sm { width: var(--ctl-h-sm); }
/* кнопка с загрузкой: спиннер внутри, текст «Сохраняю…», повторное нажатие заблокировано */
.btn.is-loading { pointer-events: none; cursor: progress; }
.btn.is-loading > .ic { opacity: 0; }
.btn__spinner { display: none; }
.btn.is-loading .btn__spinner { display: block; }
.btn-group { display: inline-flex; gap: var(--s-2); flex-wrap: wrap; align-items: center; }
@media (max-width: 767px) { .btn--icon { width: var(--tap); } .btn--sm { min-height: 40px; } }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; opacity: .9; animation: spin .7s linear infinite; flex: none; }
.spinner--lg { width: 28px; height: 28px; border-width: 3px; }

/* Ссылка-кнопка */
.link-btn { border: 0; background: none; padding: 0; color: var(--accent-ui); font-weight: var(--fw-medium); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.link-btn:hover { text-decoration-thickness: 2px; }

/* ---------- Формы ---------- */
.field { display: grid; gap: 6px; min-width: 0; }
.field__label { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text); display: flex; align-items: center; gap: 6px; }
.field__req { color: var(--danger); }
.field__opt { color: var(--text-3); font-weight: var(--fw-regular); }
.field__hint { font-size: var(--fs-sm); color: var(--text-3); }
.field__error { font-size: var(--fs-sm); color: var(--danger); display: flex; gap: 6px; align-items: flex-start; }
.field__error .ic { width: 16px; height: 16px; margin-top: 2px; }
.field__count { font-size: var(--fs-xs); color: var(--text-3); margin-left: auto; font-variant-numeric: tabular-nums; }
.input, .select, .textarea {
  width: 100%; height: var(--ctl-h); padding: 0 var(--s-3); border: 1px solid var(--line-input); border-radius: var(--r-ctl);
  background: var(--surface); color: var(--text); font-size: var(--fs-md);
  transition: border-color var(--dur-1) var(--ease-out), box-shadow var(--dur-1) var(--ease-out);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .select:hover, .textarea:hover { border-color: #6b6b73; }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { border-color: var(--accent-ui); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-ui) 18%, transparent); border-radius: var(--r-ctl); }
.input:disabled, .select:disabled, .textarea:disabled, .input[readonly] { background: var(--surface-2); color: var(--text-2); border-color: var(--line); cursor: not-allowed; }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); }
.textarea { height: auto; min-height: 112px; padding: 10px var(--s-3); line-height: var(--lh); resize: vertical; }
.select { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2352525b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.input-group { position: relative; display: flex; align-items: center; }
.input-group > .ic { position: absolute; left: 12px; color: var(--text-3); pointer-events: none; }
.input-group > .ic + .input { padding-left: 38px; }
.input-group__suffix { position: absolute; right: 12px; color: var(--text-3); font-size: var(--fs-sm); pointer-events: none; }
.input-group__suffix ~ .input, .input-group .input:has(+ .input-group__suffix) { padding-right: 40px; }
.input-group__btn { position: absolute; right: 4px; }
.input--num { font-variant-numeric: tabular-nums; text-align: right; }
.form-grid { display: grid; gap: var(--s-5) var(--s-4); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 767px) { .form-grid { grid-template-columns: minmax(0, 1fr); } .input, .select, .textarea { font-size: 16px; } }

/* Чекбокс/радио/переключатель */
.check { display: inline-flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: var(--fs-md); line-height: 1.4; min-height: 24px; }
.check input { appearance: none; margin: 1px 0 0; flex: none; width: 20px; height: 20px; border: 1.5px solid var(--line-input); border-radius: var(--r-xs); background: var(--surface) center/14px no-repeat; transition: background-color var(--dur-1), border-color var(--dur-1); cursor: pointer; }
.check input[type="radio"] { border-radius: 50%; }
.check input:checked { background-color: var(--accent-ui); border-color: var(--accent-ui); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3.5 8.5 3 3 6-7'/%3E%3C/svg%3E"); }
.check input[type="radio"]:checked { background-image: radial-gradient(circle, #fff 0 3.5px, transparent 4px); }
.check input:indeterminate { background-color: var(--accent-ui); border-color: var(--accent-ui); background-image: linear-gradient(#fff, #fff); background-size: 10px 2px; }
.check input:focus-visible { box-shadow: var(--focus-ring); }
.check__text small { display: block; color: var(--text-3); font-size: var(--fs-sm); margin-top: 2px; }
/* зона нажатия чекбокса в таблице ≥ 40px */
.check--cell { padding: 10px; margin: -10px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; min-height: 32px; }
.switch input { appearance: none; margin: 0; width: 40px; height: 24px; border-radius: 999px; background: #d4d4d8; position: relative; cursor: pointer; transition: background-color var(--dur-2) var(--ease-out); flex: none; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .2); transition: translate var(--dur-3) var(--ease-spring); }
.switch input:checked { background: var(--accent-ui); }
.switch input:checked::after { translate: 16px 0; }
.switch input:focus-visible { box-shadow: var(--focus-ring); }

/* ---------- Карточки и секции ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow-xs); min-width: 0; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-4) var(--card-pad); border-bottom: 1px solid var(--line-soft); min-height: 60px; flex-wrap: wrap; }
.card__head--plain { border-bottom: 0; padding-bottom: 0; }
.card__title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); display: flex; align-items: center; gap: var(--s-2); }
.card__sub { color: var(--text-3); font-size: var(--fs-sm); margin-top: 2px; }
.card__body { padding: var(--card-pad); }
.card__foot { padding: var(--s-3) var(--card-pad); border-top: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; }
/* секция формы как в ref-3: описание слева, поля справа */
.fsec { display: grid; grid-template-columns: minmax(0, 280px) minmax(0, 1fr); gap: var(--s-8); padding: var(--s-6) 0; border-top: 1px solid var(--line); }
.fsec:first-of-type { border-top: 0; padding-top: 0; }
.fsec__title { font-size: var(--fs-md); font-weight: var(--fw-semibold); }
.fsec__desc { color: var(--text-2); font-size: var(--fs-sm); margin-top: 6px; max-width: 32ch; }
@media (max-width: 1023px) { .fsec { grid-template-columns: minmax(0, 1fr); gap: var(--s-3); } }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--stack); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--stack); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--stack); align-items: start; }
@media (max-width: 1199px) { .split { grid-template-columns: minmax(0, 1fr); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 767px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }
.dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--s-3) var(--s-6); font-size: var(--fs-md); margin: 0; }
.dl dt { color: var(--text-2); }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 767px) { .dl { grid-template-columns: minmax(0, 1fr); gap: 2px; } .dl dd { margin-bottom: var(--s-3); } }

/* ---------- Бейджи / статусы / чипы ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: var(--fw-medium); white-space: nowrap; line-height: 1;
  background: var(--neutral-bg); color: var(--neutral); border: 1px solid var(--neutral-line);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge--plain::before { display: none; }
.badge--success { background: var(--success-bg); color: var(--success); border-color: var(--success-line); }
.badge--warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-line); }
.badge--danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.badge--info { background: var(--info-bg); color: var(--info); border-color: var(--info-line); }
.badge--violet { background: var(--violet-bg); color: var(--violet); border-color: var(--violet-line); }
.badge--brand { background: var(--brand-soft); color: var(--brand); border-color: var(--brand-line); }
.badge .ic { width: 14px; height: 14px; }
.badge:has(.ic)::before { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--surface); color: var(--text-2); font-size: var(--fs-sm); font-weight: var(--fw-medium);
  white-space: nowrap; transition: background-color var(--dur-1), border-color var(--dur-1), color var(--dur-1);
}
button.chip:hover { background: var(--surface-hover); color: var(--text); }
.chip[aria-pressed="true"], .chip.is-on { border-color: var(--selected-line); background: var(--selected-bg); color: var(--text); }
.chip--dashed { border-style: dashed; }
.chip__x { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: -6px; border: 0; background: none; border-radius: 50%; color: var(--text-3); padding: 0; }
.chip__x:hover { background: var(--surface-press); color: var(--text); }
.chip__x .ic { width: 14px; height: 14px; }
.chips { display: flex; gap: var(--s-2); flex-wrap: wrap; align-items: center; }
.tag { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: var(--r-sm); background: var(--surface-sunken); color: var(--text-2); font-size: var(--fs-xs); font-weight: var(--fw-medium); }
.delta { display: inline-flex; align-items: center; gap: 2px; font-size: var(--fs-xs); font-weight: var(--fw-semibold); padding: 2px 6px; border-radius: var(--r-sm); font-variant-numeric: tabular-nums; }
.delta--up { color: var(--success); background: var(--success-bg); }
.delta--down { color: var(--danger); background: var(--danger-bg); }
.delta .ic { width: 12px; height: 12px; }

/* ---------- Вкладки и сегмент-контрол ---------- */
.tabs { display: flex; gap: var(--s-1); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 var(--s-3);
  border: 0; background: none; color: var(--text-2); font-weight: var(--fw-medium); white-space: nowrap; text-decoration: none;
}
.tab:hover { color: var(--text); }
.tab::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent-ui); transform: scaleX(0); transition: transform var(--dur-2) var(--ease-out); }
.tab[aria-selected="true"], .tab[aria-current="page"] { color: var(--text); }
.tab[aria-selected="true"]::after, .tab[aria-current="page"]::after { transform: scaleX(1); }
.tab__count { min-width: 22px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); background: var(--surface-sunken); color: var(--text-2); font-size: var(--fs-xs); display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.tab[aria-selected="true"] .tab__count { background: var(--ink); color: #fff; }
:root .tab[aria-selected="true"] .tab__count { background: var(--brand); }
.seg { display: inline-flex; padding: 3px; background: var(--surface-sunken); border-radius: calc(var(--r-ctl) + 2px); gap: 2px; }
.seg__btn {
  display: inline-flex; align-items: center; gap: 6px; height: calc(var(--ctl-h) - 6px); padding: 0 var(--s-3); border: 0; border-radius: var(--r-ctl);
  background: transparent; color: var(--text-2); font-weight: var(--fw-medium); font-size: var(--fs-sm);
  transition: background-color var(--dur-2) var(--ease-out), color var(--dur-2), box-shadow var(--dur-2);
}
.seg__btn:hover { color: var(--text); }
.seg__btn[aria-pressed="true"], .seg__btn[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg__btn .ic { width: 18px; height: 18px; }

/* ---------- Панель инструментов списка ---------- */
.toolbar { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; padding: var(--s-3) var(--card-pad); border-bottom: 1px solid var(--line-soft); }
.toolbar__search { flex: 1 1 260px; max-width: 360px; }
.toolbar__spacer { flex: 1; }
@media (max-width: 767px) { .toolbar__search { max-width: none; flex-basis: 100%; } .toolbar .seg { margin-left: auto; } }
/* панель выделения (заменяет тулбар при ≥1 выбранном) */
.bulkbar {
  display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; padding: var(--s-2) var(--card-pad); min-height: 57px;
  background: var(--selected-bg); border-bottom: 1px solid var(--selected-line);
}
.bulkbar__count { font-weight: var(--fw-semibold); margin-right: var(--s-2); font-variant-numeric: tabular-nums; }
@media (max-width: 767px) {
  .bulkbar { position: fixed; left: 8px; right: 8px; bottom: 8px; z-index: var(--z-sticky); border: 1px solid var(--selected-line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); background: var(--surface); padding: var(--s-2) var(--s-3); }
}

/* ---------- Таблица (как ref-1) ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-md); }
.table th {
  position: sticky; top: 0; z-index: 1; height: 44px; padding: 0 var(--s-3); text-align: left; white-space: nowrap;
  background: var(--surface-2); color: var(--text-2); font-weight: var(--fw-medium); font-size: var(--fs-sm); border-bottom: 1px solid var(--line);
}
.table th:first-child, .table td:first-child { padding-left: var(--card-pad); }
.table th:last-child, .table td:last-child { padding-right: var(--card-pad); }
.table td { height: var(--row-h); padding: 6px var(--s-3); border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color var(--dur-1) var(--ease-out); }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr.is-selected { background: var(--selected-bg); }
.table tbody tr[data-href] { cursor: pointer; }
.table .num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .col-check { width: 44px; }
.table .col-actions { width: 56px; text-align: right; }
.th-sort { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 0; color: inherit; font: inherit; height: 32px; }
.th-sort:hover { color: var(--text); }
.th-sort .ic { width: 14px; height: 14px; opacity: .5; }
.th-sort[aria-sort] .ic { opacity: 1; }
.cell-main { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.cell-main__text { min-width: 0; }
.cell-title { font-weight: var(--fw-medium); color: var(--text); text-decoration: none; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 44ch; }
a.cell-title:hover { text-decoration: underline; }
.cell-sub { font-size: var(--fs-sm); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 48ch; }
.thumb { width: 48px; height: 48px; border-radius: var(--r-sm); object-fit: cover; background: var(--skeleton); flex: none; border: 1px solid var(--line-soft); }
.thumb--sm { width: 36px; height: 36px; }
.thumb--empty { display: grid; place-items: center; color: var(--text-3); }
:root .thumb { width: 36px; height: 36px; }
/* Таблица → карточки на мобильной */
@media (max-width: 767px) {
  .table--stack thead { display: none; }
  .table--stack, .table--stack tbody, .table--stack tr, .table--stack td { display: block; width: 100%; }
  .table--stack tr { position: relative; padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line-soft); }
  .table--stack td { height: auto; padding: 2px 0 !important; border: 0; }
  .table--stack td[data-label]:not(.td-main)::before { content: attr(data-label) " · "; color: var(--text-3); font-size: var(--fs-sm); }
  .table--stack td.num { text-align: left; }
  .table--stack .col-check { position: absolute; left: auto; right: 56px; top: 14px; width: auto; }
  .table--stack .col-actions { position: absolute; right: 8px; top: 8px; width: auto; }
  .table--stack .td-main { padding-right: 88px !important; margin-bottom: 6px; }
  .table--stack .cell-title { white-space: normal; max-width: none; }
  .table--stack .td-inline { display: inline-block; width: auto; margin-right: var(--s-3); }
}

/* ---------- Сетка карточек (как Яндекс Диск / ref-1) ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--s-4); padding: var(--card-pad); }
:root .tiles { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: var(--s-3); }
.tile {
  position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
  overflow: hidden; transition: border-color var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out), translate var(--dur-2) var(--ease-out);
}
.tile:hover { box-shadow: var(--shadow-md); border-color: #d4d4d8; }
.tile.is-selected { border-color: var(--accent-ui); box-shadow: 0 0 0 1px var(--accent-ui); }
.tile__media { position: relative; aspect-ratio: 4 / 3; background: var(--skeleton); overflow: hidden; display: block; }
.tile__media img { width: 100%; height: 100%; object-fit: cover; transition: scale var(--dur-4) var(--ease-out); }
.tile:hover .tile__media img { scale: 1.03; }
.tile__check { position: absolute; top: 8px; left: 8px; z-index: 2; width: 36px; height: 36px; display: grid; place-items: center; border-radius: var(--r-sm); background: rgb(255 255 255 / .92); box-shadow: var(--shadow-xs); }
.tile__check .check input { margin: 0; }
.tile__menu { position: absolute; top: 8px; right: 8px; z-index: 2; }
.tile__menu .btn { background: rgb(255 255 255 / .92); width: 36px; height: 36px; }
.tile__badges { position: absolute; left: 8px; bottom: 8px; display: flex; gap: 4px; flex-wrap: wrap; }
.tile__count { position: absolute; right: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 4px; padding: 0 8px; height: 24px; border-radius: var(--r-pill); background: rgb(24 24 27 / .72); color: #fff; font-size: var(--fs-xs); font-weight: var(--fw-medium); font-variant-numeric: tabular-nums; }
.tile__count .ic { width: 14px; height: 14px; }
.tile__body { padding: var(--s-3) var(--s-3) var(--s-3); display: grid; gap: 4px; }
.tile__title { font-weight: var(--fw-semibold); color: var(--text); text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.35; }
.tile__title::after { content: ""; position: absolute; inset: 0; z-index: 1; } /* вся карточка кликабельна */
.tile__meta { font-size: var(--fs-sm); color: var(--text-3); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tile__foot { margin-top: 4px; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
@media (max-width: 767px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); padding: var(--s-3); } .tile__body { padding: var(--s-2) var(--s-3) var(--s-3); } }

/* ---------- Пагинация (пилюли, как ref-1) ---------- */
.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; padding: var(--s-3) var(--card-pad); border-top: 1px solid var(--line-soft); }
.pager__info { color: var(--text-3); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.pager__pages { display: flex; gap: 6px; align-items: center; }
.pager__btn {
  min-width: 36px; height: 36px; padding: 0 10px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface);
  display: inline-grid; place-items: center; color: var(--text-2); font-size: var(--fs-sm); font-weight: var(--fw-medium); text-decoration: none; font-variant-numeric: tabular-nums;
  transition: background-color var(--dur-1), border-color var(--dur-1);
}
.pager__btn:hover { background: var(--surface-hover); color: var(--text); }
.pager__btn[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.pager__btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.pager__gap { color: var(--text-3); padding: 0 2px; }
@media (max-width: 767px) { .pager { justify-content: center; } .pager__info { width: 100%; text-align: center; } .pager__btn { min-width: 44px; height: 44px; } .pager__btn--far { display: none; } }

/* ---------- Выпадающее меню (popover) ---------- */
.menu {
  position: fixed; z-index: var(--z-popover); min-width: 220px; max-width: 320px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-ctl); box-shadow: var(--shadow-lg);
  display: grid; gap: 1px;
}
.menu[hidden] { display: none; }
.menu__item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 10px; border: 0; border-radius: calc(var(--r-ctl) - 3px);
  background: none; color: var(--text); text-align: left; text-decoration: none; font-size: var(--fs-md);
}
.menu__item .ic { color: var(--text-3); width: 18px; height: 18px; }
.menu__item:hover, .menu__item:focus-visible { background: var(--surface-hover); box-shadow: none; }
.menu__item--danger { color: var(--danger); }
.menu__item--danger .ic { color: var(--danger); }
.menu__item[aria-disabled="true"] { color: var(--text-3); pointer-events: none; }
.menu__sep { height: 1px; background: var(--line-soft); margin: 4px 0; }
.menu__label { padding: 6px 10px 4px; font-size: var(--fs-xs); color: var(--text-3); font-weight: var(--fw-medium); }
@media (max-width: 767px) { .menu__item { min-height: 48px; } }

/* ---------- Модальное окно (<dialog>) ---------- */
.modal {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: 0; border-radius: var(--r-lg);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); overflow: hidden;
}
.modal--sm { width: min(440px, calc(100vw - 32px)); }
.modal--lg { width: min(760px, calc(100vw - 32px)); }
.modal::backdrop { background: var(--overlay); }
.modal__form { display: flex; flex-direction: column; max-height: inherit; }
.modal__head { display: flex; align-items: flex-start; gap: var(--s-3); padding: var(--s-5) var(--s-6) var(--s-2); }
.modal__title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); flex: 1; line-height: 1.35; }
.modal__icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--neutral-bg); color: var(--neutral); }
.modal__icon--danger { background: var(--danger-bg); color: var(--danger); }
.modal__icon--warning { background: var(--warning-bg); color: var(--warning); }
.modal__body { padding: var(--s-2) var(--s-6) var(--s-5); overflow-y: auto; color: var(--text-2); display: grid; gap: var(--s-4); }
.modal__foot { display: flex; justify-content: flex-end; gap: var(--s-2); padding: var(--s-4) var(--s-6); background: var(--surface-2); border-top: 1px solid var(--line-soft); flex-wrap: wrap; }
@media (max-width: 767px) {
  .modal, .modal--sm, .modal--lg { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: var(--r-lg) var(--r-lg) 0 0; max-height: 92dvh; }
  .modal__foot { flex-direction: column-reverse; padding-bottom: max(var(--s-4), env(safe-area-inset-bottom)); }
  .modal__foot .btn { width: 100%; height: 48px; }
  .modal__head, .modal__body { padding-left: var(--s-4); padding-right: var(--s-4); }
}

/* ---------- Тосты ---------- */
.toasts { position: fixed; z-index: var(--z-toast); right: 24px; bottom: 24px; display: grid; gap: var(--s-2); width: min(400px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: var(--s-3); padding: 14px var(--s-4);
  background: var(--ink); color: #fff; border-radius: var(--r-ctl); box-shadow: var(--shadow-lg); font-size: var(--fs-md);
}
.toast .ic { margin-top: 1px; }
.toast--success .ic { color: #6ce9a6; }
.toast--danger .ic { color: #fda29b; }
.toast__text { flex: 1; min-width: 0; line-height: 1.4; }
.toast__action { border: 0; background: none; color: #fff; font-weight: var(--fw-semibold); text-decoration: underline; text-underline-offset: 3px; padding: 0; min-height: 24px; }
.toast__close { border: 0; background: none; color: rgb(255 255 255 / .7); padding: 0; width: 24px; height: 24px; display: grid; place-items: center; margin: -2px -4px 0 0; }
.toast__close:hover { color: #fff; }
@media (max-width: 767px) { .toasts { left: 16px; right: 16px; bottom: 16px; width: auto; } }

/* ---------- Баннеры ---------- */
.banner { display: flex; gap: var(--s-3); align-items: flex-start; padding: 14px var(--s-4); border-radius: var(--r-ctl); border: 1px solid var(--info-line); background: var(--info-bg); color: var(--text); }
.banner > .ic { color: var(--info); margin-top: 1px; }
.banner__title { font-weight: var(--fw-semibold); }
.banner__text { color: var(--text-2); font-size: var(--fs-sm); margin-top: 2px; }
.banner__body { flex: 1; min-width: 0; }
.banner__actions { display: flex; gap: var(--s-2); flex-wrap: wrap; margin-top: var(--s-2); }
.banner--warning { border-color: var(--warning-line); background: var(--warning-bg); } .banner--warning > .ic { color: var(--warning); }
.banner--danger { border-color: var(--danger-line); background: var(--danger-bg); } .banner--danger > .ic { color: var(--danger); }
.banner--success { border-color: var(--success-line); background: var(--success-bg); } .banner--success > .ic { color: var(--success); }
.banner--neutral { border-color: var(--line); background: var(--surface-2); } .banner--neutral > .ic { color: var(--text-2); }
.banner--lock { border-color: var(--line); background: var(--surface); box-shadow: var(--shadow-xs); } .banner--lock > .ic { color: var(--text); }

/* ---------- Пустое состояние / ошибка ---------- */
.empty { display: grid; justify-items: center; text-align: center; gap: var(--s-3); padding: var(--s-12) var(--s-6); }
.empty__art { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-sunken); color: var(--text-2); margin-bottom: var(--s-1); }
.empty__art .ic { width: 28px; height: 28px; }
.empty__title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); }
.empty__text { color: var(--text-2); max-width: 44ch; }
.empty__actions { display: flex; gap: var(--s-2); flex-wrap: wrap; justify-content: center; margin-top: var(--s-2); }
.empty--error .empty__art { background: var(--danger-bg); color: var(--danger); }

/* ---------- Скелетоны ---------- */
.sk { display: block; background: var(--skeleton); border-radius: var(--r-sm); position: relative; overflow: hidden; }
.sk::after { content: ""; position: absolute; inset: 0; translate: -100% 0; background: linear-gradient(90deg, transparent, var(--skeleton-hi), transparent); animation: shimmer 1.4s var(--ease-in-out) infinite; }
.sk--text { height: 12px; border-radius: 6px; }
.sk--title { height: 20px; width: 40%; border-radius: 6px; }
.sk--thumb { width: 48px; height: 48px; }
.sk--media { aspect-ratio: 4 / 3; border-radius: 0; }
.sk--circle { border-radius: 50%; }
.sk--btn { height: var(--ctl-h); width: 140px; border-radius: var(--r-ctl); }
.sk-row { display: flex; align-items: center; gap: var(--s-3); height: var(--row-h); padding: 0 var(--card-pad); border-bottom: 1px solid var(--line-soft); }
.sk-stack { display: grid; gap: 8px; flex: 1; }

/* ---------- Прогресс ---------- */
.progress { height: 6px; border-radius: 999px; background: var(--surface-sunken); overflow: hidden; }
.progress__bar { height: 100%; width: 100%; border-radius: inherit; background: var(--accent-ui); transform-origin: left; transform: scaleX(var(--p, 0)); transition: transform var(--dur-3) var(--ease-out); }
.progress--success .progress__bar { background: var(--success); }
.progress--danger .progress__bar { background: var(--danger); }
.progress--sm { height: 4px; }
/* индикатор перехода между страницами */
.nav-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: var(--z-toast); pointer-events: none; }
.nav-progress__bar { height: 100%; background: var(--accent-ui); transform-origin: left; transform: scaleX(0); opacity: 0; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-4); }
.kpis--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis--6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1199px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpis--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 767px) { .kpis, .kpis--3, .kpis--6 { grid-template-columns: minmax(0, 1fr); gap: var(--s-2); } }
.kpi { padding: var(--s-5) var(--card-pad); display: grid; gap: var(--s-2); align-content: start; }
.kpi__label { display: flex; align-items: center; gap: var(--s-2); color: var(--text-2); font-size: var(--fs-sm); font-weight: var(--fw-medium); }
.kpi__icon { width: 32px; height: 32px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--surface-sunken); color: var(--text-2); flex: none; }
.kpi__icon .ic { width: 18px; height: 18px; }
.kpi__value { font-size: var(--fs-2xl); font-weight: var(--fw-semibold); letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi__value small { font-size: var(--fs-md); color: var(--text-3); font-weight: var(--fw-medium); letter-spacing: 0; }
.kpi__meta { display: flex; gap: var(--s-4); flex-wrap: wrap; font-size: var(--fs-sm); color: var(--text-3); font-variant-numeric: tabular-nums; }
.kpi__meta b { color: var(--text); font-weight: var(--fw-semibold); }
.kpi__link { font-size: var(--fs-sm); font-weight: var(--fw-medium); }
.footnote { font-size: var(--fs-sm); color: var(--text-3); }
@media (max-width: 767px) { .kpi { padding: var(--s-4); grid-template-columns: minmax(0, 1fr) auto; } .kpi__label { grid-column: 1 / -1; } .kpi__value { font-size: 1.5rem; } .kpi__meta { grid-column: 1 / -1; } }

/* ---------- График (SVG, без библиотеки — pages/svgchart.js, P16 H4) ---------- */
.chart { position: relative; width: 100%; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart__grid line { stroke: var(--line-soft); }
.chart__axis text { fill: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart__line { fill: none; stroke: var(--accent-ui); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart__area { fill: color-mix(in srgb, var(--accent-ui) 8%, transparent); }
.chart__bar { fill: color-mix(in srgb, var(--accent-ui) 78%, white); transition: fill var(--dur-1); }
.chart__bar:hover, .chart__bar.is-hover { fill: var(--accent-ui); }
.chart__cursor { stroke: var(--text-3); stroke-dasharray: 3 3; }
.chart__dot { fill: var(--surface); stroke: var(--accent-ui); stroke-width: 2; }
.chart__tip { position: absolute; z-index: 2; pointer-events: none; background: var(--ink); color: #fff; padding: 8px 10px; border-radius: var(--r-sm); font-size: var(--fs-sm); box-shadow: var(--shadow-md); white-space: nowrap; font-variant-numeric: tabular-nums; translate: -50% calc(-100% - 10px); }
.chart__tip small { display: block; color: rgb(255 255 255 / .7); font-size: var(--fs-xs); }
.chart-head { display: flex; align-items: baseline; gap: var(--s-3); flex-wrap: wrap; margin-bottom: var(--s-4); }
.chart-head__value { font-size: var(--fs-2xl); font-weight: var(--fw-semibold); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
/* полоска-доля в ячейке */
.meter { display: flex; align-items: center; gap: var(--s-3); justify-content: flex-end; }
.meter__track { flex: 1; max-width: 160px; height: 6px; border-radius: 999px; background: var(--surface-sunken); overflow: hidden; }
.meter__fill { height: 100%; background: color-mix(in srgb, var(--accent-ui) 70%, white); border-radius: inherit; }

/* ---------- Список «Требует внимания» / ссылки-строки ---------- */
.rows { display: grid; }
.row-link {
  display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--card-pad); min-height: 64px;
  color: var(--text); text-decoration: none; border-top: 1px solid var(--line-soft); transition: background-color var(--dur-1);
}
.rows > .row-link:first-child { border-top: 0; }
.row-link:hover { background: var(--surface-2); }
.row-link__icon { width: 36px; height: 36px; border-radius: var(--r-sm); display: grid; place-items: center; flex: none; background: var(--surface-sunken); color: var(--text-2); }
.row-link__icon--danger { background: var(--danger-bg); color: var(--danger); }
.row-link__icon--warning { background: var(--warning-bg); color: var(--warning); }
.row-link__icon--info { background: var(--info-bg); color: var(--info); }
.row-link__icon--success { background: var(--success-bg); color: var(--success); }
.row-link__text { flex: 1; min-width: 0; }
.row-link__title { font-weight: var(--fw-medium); }
.row-link__sub { font-size: var(--fs-sm); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-link > .ic:last-child { color: var(--text-3); }

/* Легенда цветов строк */
.legend { display: flex; gap: var(--s-4); flex-wrap: wrap; font-size: var(--fs-sm); color: var(--text-2); }
.legend__item { display: inline-flex; align-items: center; gap: 6px; }
.legend__sw { width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--line); background: var(--surface); }
.legend__sw--draft { background: #f4f4f5; border-color: #d4d4d8; }
.legend__sw--announce, .legend__sw--info { background: var(--info-bg); border-color: var(--info-line); }
.legend__sw--danger { background: var(--danger-bg); border-color: var(--danger-line); }
.legend__sw--warn { background: var(--warning-bg); border-color: var(--warning-line); }
.legend__sw--ok { background: var(--success-bg); border-color: var(--success-line); }
.legend__sw--muted { background: #f4f4f5; border-color: #d4d4d8; }
/* подсветка строк (цвет — не единственный носитель: бейдж остаётся) */
.table tr.row--draft, .table tr.row--muted { background: #fafafa; }
.table tr.row--draft td:first-child, .table tr.row--muted td:first-child { box-shadow: inset 3px 0 0 #d4d4d8; }
.table tr.row--announce td:first-child, .table tr.row--info td:first-child { box-shadow: inset 3px 0 0 var(--info-line); }
.table tr.row--announce { background: color-mix(in srgb, var(--info-bg) 60%, white); }
.table tr.row--danger { background: color-mix(in srgb, var(--danger-bg) 70%, white); }
.table tr.row--danger td:first-child { box-shadow: inset 3px 0 0 var(--danger-line); }
.table tr.row--warn { background: color-mix(in srgb, var(--warning-bg) 80%, white); }
.table tr.row--warn td:first-child { box-shadow: inset 3px 0 0 var(--warning-line); }
.table tr.row--ok td:first-child { box-shadow: inset 3px 0 0 var(--success-line); }
.table tr.row--inactive { color: var(--text-3); }
.table tr.row--inactive .cell-title { color: var(--text-2); }
.group-row td { height: 36px !important; background: var(--surface-2); font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--text-2); }
.group-row td .tab__count { margin-left: 6px; }
.price-old { color: var(--text-3); text-decoration: line-through; font-size: var(--fs-sm); margin-left: 6px; }
.due { font-size: var(--fs-sm); }
.due--danger { color: var(--danger); font-weight: var(--fw-medium); }
.due--warn { color: var(--warning); font-weight: var(--fw-medium); }
.due--ok { color: var(--success); }

/* ---------- Редактор записи: раскладка ---------- */
.edit-head { display: grid; gap: var(--s-3); padding-top: var(--s-4); }
.edit-head__row { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; }
.edit-head h1 { font-size: var(--fs-xl); overflow-wrap: anywhere; }
.edit-head__meta { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; color: var(--text-3); font-size: var(--fs-sm); }
.toc { position: sticky; top: var(--topbar-h); z-index: 5; display: flex; gap: var(--s-1); margin: 0 calc(var(--page-pad) * -1); padding: 0 var(--page-pad); background: var(--canvas); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.edit-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--stack); align-items: start; }
.edit-layout__main, .edit-layout__side { display: grid; gap: var(--stack); min-width: 0; }
.edit-layout__side { position: sticky; top: calc(var(--topbar-h) + 60px); }
@media (max-width: 1199px) { .edit-layout { grid-template-columns: minmax(0, 1fr); } .edit-layout__side { position: static; } }
[id] { scroll-margin-top: calc(var(--topbar-h) + 64px); }

/* Чек-лист публикации */
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.checklist li { display: flex; align-items: center; gap: var(--s-2); min-height: 36px; font-size: var(--fs-md); }
.checklist .ic { width: 20px; height: 20px; }
.checklist .is-ok .ic { color: var(--success); }
.checklist .is-no .ic { color: var(--text-3); }
.checklist .is-no { color: var(--text-2); }
.checklist__val { margin-left: auto; color: var(--text-3); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.status-line { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; color: var(--text-2); font-size: var(--fs-sm); }
.stack { display: grid; gap: var(--s-4); }
.stack--sm { display: grid; gap: var(--s-2); }
.hr { height: 1px; background: var(--line-soft); border: 0; margin: 0; }
.note { font-size: var(--fs-sm); color: var(--text-3); display: flex; gap: 6px; align-items: flex-start; }
.note .ic { width: 16px; height: 16px; margin-top: 2px; flex: none; }
.danger-zone { border-top: 1px solid var(--line-soft); padding-top: var(--s-4); display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; }
.price-preview { font-size: var(--fs-sm); color: var(--text-2); padding: 10px var(--s-3); border-radius: var(--r-ctl); background: var(--surface-2); border: 1px dashed var(--line); }
.price-preview b { color: var(--text); }
.subpanel { border: 1px solid var(--line); border-radius: var(--r-ctl); padding: var(--s-4); display: grid; gap: var(--s-4); background: var(--surface-2); }
.subpanel__title { display: flex; align-items: center; gap: var(--s-2); font-weight: var(--fw-semibold); }
.locked-value { display: flex; align-items: center; gap: var(--s-2); min-height: var(--ctl-h); padding: 0 var(--s-3); border-radius: var(--r-ctl); background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); }

/* Хэштеги: чипы + combobox */
.tags-input { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: var(--ctl-h); padding: 5px 6px; border: 1px solid var(--line-input); border-radius: var(--r-ctl); background: var(--surface); position: relative; cursor: text; transition: border-color var(--dur-1), box-shadow var(--dur-1); }
.tags-input:focus-within { border-color: var(--accent-ui); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-ui) 18%, transparent); }
.tags-input__field { flex: 1; min-width: 160px; border: 0; outline: 0; height: 30px; padding: 0 6px; background: none; font-size: var(--fs-md); }
.tags-input .chip { height: 30px; background: var(--surface-sunken); border-color: transparent; color: var(--text); }
.suggest { position: absolute; left: -1px; right: -1px; top: calc(100% + 4px); z-index: var(--z-popover); padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-ctl); box-shadow: var(--shadow-lg); list-style: none; margin: 0; max-height: 300px; overflow-y: auto; }
.suggest li { display: flex; justify-content: space-between; gap: var(--s-3); align-items: center; min-height: 40px; padding: 0 10px; border-radius: calc(var(--r-ctl) - 3px); cursor: pointer; }
.suggest li[aria-selected="true"], .suggest li:hover { background: var(--surface-hover); }
.suggest__n { color: var(--text-3); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }

/* ---------- Загрузка: зона ---------- */
.dropzone {
  position: relative; display: grid; justify-items: center; gap: var(--s-2); text-align: center; padding: var(--s-8) var(--s-6);
  border: 1.5px dashed #c4c4cc; border-radius: var(--r-card); background: var(--surface-2); cursor: pointer;
  transition: border-color var(--dur-2) var(--ease-out), background-color var(--dur-2) var(--ease-out);
}
.dropzone:hover { border-color: var(--line-input); background: var(--surface-hover); }
.dropzone.is-drag { border-color: var(--accent-ui); border-style: solid; background: var(--selected-bg); }
.dropzone:focus-within { box-shadow: var(--focus-ring); }
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.dropzone__icon { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); color: var(--text-2); box-shadow: var(--shadow-xs); transition: transform var(--dur-3) var(--ease-spring); }
.dropzone.is-drag .dropzone__icon { transform: translateY(-4px) scale(1.06); color: var(--accent-ui); }
.dropzone__title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); }
.dropzone__hint { font-size: var(--fs-sm); color: var(--text-3); max-width: 60ch; }
.dropzone .btn { position: relative; z-index: 1; pointer-events: none; }
@media (max-width: 767px) { .dropzone { padding: var(--s-6) var(--s-4); } .dropzone__title-drag { display: none; } }

/* Очередь загрузки: строка на каждый файл */
.upq { border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); overflow: hidden; }
.upq__head { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.upq__summary { flex: 1; min-width: 200px; display: grid; gap: 6px; }
.upq__summary-text { font-weight: var(--fw-medium); font-variant-numeric: tabular-nums; }
.upq__list { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow-y: auto; }
.upq__item { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: var(--s-3); padding: 10px var(--s-4); border-top: 1px solid var(--line-soft); }
.upq__item:first-child { border-top: 0; }
.upq__thumb { width: 40px; height: 40px; border-radius: var(--r-xs); object-fit: cover; background: var(--skeleton); }
.upq__name { font-size: var(--fs-sm); font-weight: var(--fw-medium); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upq__state { font-size: var(--fs-xs); color: var(--text-3); display: flex; gap: 6px; align-items: center; margin-top: 2px; font-variant-numeric: tabular-nums; }
.upq__item .progress { margin-top: 6px; }
.upq__item.is-done .upq__state { color: var(--success); }
.upq__item.is-error .upq__state { color: var(--danger); }
.upq__item.is-error .upq__thumb { outline: 2px solid var(--danger-line); }
.upq__item.is-waiting { color: var(--text-3); }
.upq__item .ic { width: 16px; height: 16px; }

/* ---------- Файлы записи: список и сетка ---------- */
.files-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; }
.files-count { font-size: var(--fs-sm); color: var(--text-2); font-variant-numeric: tabular-nums; }
.files { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.frow {
  position: relative; display: grid; grid-template-columns: auto 104px minmax(0, 1fr) auto; gap: var(--s-4); align-items: start;
  padding: var(--s-3); border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface);
  transition: border-color var(--dur-2), box-shadow var(--dur-2), background-color var(--dur-2);
}
.frow.is-cover { border-color: var(--selected-line); background: var(--selected-bg); }
.frow__drag { align-self: center; width: 32px; height: 44px; display: grid; place-items: center; color: var(--text-3); cursor: grab; border: 0; background: none; border-radius: var(--r-sm); touch-action: none; }
.frow__drag:hover { color: var(--text); background: var(--surface-hover); }
.frow__media { position: relative; width: 104px; height: 104px; border-radius: var(--r-sm); overflow: hidden; background: var(--skeleton); }
.frow__media img { width: 100%; height: 100%; object-fit: cover; }
.cover-flag { position: absolute; left: 6px; top: 6px; display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 7px; border-radius: var(--r-pill); background: var(--ink); color: #fff; font-size: 11px; font-weight: var(--fw-semibold); }
.cover-flag .ic { width: 12px; height: 12px; }
.frow__body { display: grid; gap: var(--s-2); min-width: 0; }
.frow__name { font-weight: var(--fw-medium); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.frow__meta { font-size: var(--fs-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }
.frow__fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: var(--s-2); }
.frow__fields .input, .frow__fields .textarea { height: 36px; min-height: 36px; font-size: var(--fs-sm); }
.frow__fields .textarea { padding-top: 7px; resize: none; }
.frow__fields .textarea:focus { height: 84px; }
.save-state { font-size: var(--fs-xs); color: var(--text-3); display: inline-flex; align-items: center; gap: 4px; min-height: 16px; }
.save-state.is-ok { color: var(--success); }
.save-state.is-err { color: var(--danger); }
.frow__actions { display: flex; flex-direction: column; gap: 4px; align-items: stretch; }
.frow__order { display: flex; gap: 4px; }
.frow.is-busy { opacity: .6; pointer-events: none; }
.frow.sortable-ghost { opacity: .35; }
.frow.sortable-chosen { box-shadow: var(--shadow-lg); }
.frow.sortable-drag { rotate: .6deg; }
/* без перетаскивания */

:root .frow__order--fallback { display: none; }
.files.is-locked .frow { grid-template-columns: 104px minmax(0, 1fr); }
.files.is-locked .frow__drag, .files.is-locked .frow__actions { display: none; }
@media (max-width: 767px) {
  .frow { grid-template-columns: 80px minmax(0, 1fr); gap: var(--s-3); padding: var(--s-3); }
  .frow__media { width: 80px; height: 80px; }
  .frow__drag { position: absolute; right: 6px; top: 6px; }
  .frow__fields { grid-template-columns: minmax(0, 1fr); grid-column: 1 / -1; }
  .frow__actions { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; }
  .frow__actions .btn { flex: 1; }
  .frow__fields .input, .frow__fields .textarea { height: 44px; min-height: 44px; font-size: 16px; }
}
/* сетка файлов */
.files--grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--s-3); }
.files--grid .frow { grid-template-columns: minmax(0, 1fr); padding: 0; gap: 0; overflow: hidden; }
.files--grid .frow__media { width: 100%; height: auto; aspect-ratio: 1; border-radius: 0; }
.files--grid .frow__drag { position: absolute; z-index: 2; right: 6px; top: 6px; background: rgb(255 255 255 / .92); width: 36px; height: 36px; }
.files--grid .frow__body { padding: var(--s-2) var(--s-3); }
.files--grid .frow__fields { grid-template-columns: minmax(0, 1fr); }
.files--grid .frow__fields .textarea { display: none; }
.files--grid .frow__actions { flex-direction: row; padding: 0 var(--s-3) var(--s-3); flex-wrap: wrap; }
.files--grid .frow__actions .btn { flex: 1; }
.files--grid .frow__actions .btn__label { display: none; }
@media (max-width: 767px) { .files--grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .files--grid .frow { grid-template-columns: minmax(0, 1fr); } .files--grid .frow__media { width: 100%; height: auto; } }

/* ---------- История изменений / журнал ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.tl { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: var(--s-3); padding: var(--s-3) 0; position: relative; }
.tl + .tl { border-top: 1px solid var(--line-soft); }
.tl__head { display: flex; gap: var(--s-2); align-items: baseline; flex-wrap: wrap; }
.tl__who { font-weight: var(--fw-medium); }
.tl__what { color: var(--text-2); }
.tl__when { margin-left: auto; color: var(--text-3); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tl__desc { color: var(--text-3); font-size: var(--fs-sm); margin-top: 2px; overflow-wrap: anywhere; }
.tl__thumbs { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.tl__thumbs img, .tl__more { width: 36px; height: 36px; border-radius: var(--r-xs); object-fit: cover; }
.tl__more { display: grid; place-items: center; background: var(--surface-sunken); color: var(--text-2); font-size: var(--fs-xs); font-weight: var(--fw-semibold); }
.diff { font-size: var(--fs-sm); margin-top: 4px; display: grid; gap: 2px; }
.diff__field { color: var(--text-2); }
.diff del { color: var(--text-3); }
.diff ins { text-decoration: none; color: var(--text); background: var(--success-bg); padding: 0 3px; border-radius: 3px; }
details.card > summary { list-style: none; cursor: pointer; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary .chev { transition: transform var(--dur-2) var(--ease-out); }
details.card[open] > summary .chev { transform: rotate(180deg); }
details.card:not([open]) > summary { border-bottom: 0; }

/* ---------- Липкая панель действий ---------- */
.actionbar {
  position: sticky; bottom: 16px; z-index: var(--z-sticky); display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap;
  padding: var(--s-3) var(--s-3) var(--s-3) var(--s-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
}
.actionbar__state { display: flex; align-items: center; gap: var(--s-2); font-weight: var(--fw-medium); flex: 1; min-width: 0; }
.actionbar__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); flex: none; }
.actionbar.is-dirty .actionbar__dot { background: var(--warning); }
.actionbar__sub { color: var(--text-3); font-size: var(--fs-sm); font-weight: var(--fw-regular); }
@media (max-width: 767px) {
  .actionbar { position: fixed; left: 0; right: 0; bottom: 0; border-radius: var(--r-lg) var(--r-lg) 0 0; padding: var(--s-3) var(--s-4) max(var(--s-3), env(safe-area-inset-bottom)); }
  .actionbar__state { flex-basis: 100%; font-size: var(--fs-sm); }
  .actionbar .btn { flex: 1; }
}

/* Роль — карточки-радио */
.choice { display: grid; gap: var(--s-2); }
.choice__opt { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-4); border: 1px solid var(--line); border-radius: var(--r-ctl); cursor: pointer; background: var(--surface); transition: border-color var(--dur-1), background-color var(--dur-1); }
.choice__opt:hover { border-color: var(--line-input); }
.choice__opt:has(input:checked) { border-color: var(--accent-ui); background: var(--selected-bg); box-shadow: 0 0 0 1px var(--accent-ui); }
.choice__opt .check { pointer-events: none; }
.choice--row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 767px) { .choice--row { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Вход и страницы ошибок (без каркаса) ---------- */
.solo { min-height: 100dvh; display: grid; place-items: center; padding: var(--s-6) var(--s-4); }
.solo__card { width: min(420px, 100%); padding: var(--s-8); display: grid; gap: var(--s-6); }
.solo__logo { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: var(--fs-sm); }
.solo__logo img { height: 28px; width: auto; }
.solo__title { font-size: var(--fs-xl); }
.solo__sub { color: var(--text-2); margin-top: 6px; }
.solo__foot { color: var(--text-3); font-size: var(--fs-sm); text-align: center; }
.err-code { font-size: 4.5rem; font-weight: var(--fw-bold); letter-spacing: -.04em; line-height: 1; color: var(--text); font-variant-numeric: tabular-nums; }
@media (max-width: 767px) { .solo__card { padding: var(--s-6) var(--s-5); } .solo { align-items: start; padding-top: 10vh; } }

/* ---------- Поправки специфичности и узкие экраны (после первого просмотра) ---------- */
.topbar .topbar__burger, .sidebar .sidebar__close { display: none; }

@media (max-width: 1023px) {
  .topbar .topbar__burger, .sidebar .sidebar__close { display: inline-flex; }
}

.input-group:has(> .ic) .input { padding-left: 38px; }
.show-narrow { display: none; }
@media (max-width: 1279px) { .table .col-opt { display: none; } .show-narrow { display: inline; } }
.table .td-main { min-width: 220px; }

@media (max-width: 1279px) { .table .col-opt2 { display: none; } .show-narrow2 { display: inline-flex; } }
.show-narrow2 { display: none; margin-left: 6px; vertical-align: middle; }
/* мобильная: все цели нажатия ≥ 44 px */
@media (max-width: 767px) {
  .btn--sm { height: 44px; min-height: 44px; }
  .btn--icon.btn--sm, .tile__menu .btn { width: 44px; height: 44px; }
  .chip__x { width: 36px; height: 36px; margin: -6px -10px -6px -4px; }
  .tags-input .chip { height: 36px; }
  .sidebar__logo, .topbar__logo { min-height: 44px; }
}
.tile__count { background: rgb(24 24 27 / .92); }
@media (max-width: 767px) { .chip__x { width: 44px; height: 44px; margin: -10px -14px -10px -8px; } }
/* колонка сайдбара тянется на всю высоту документа (и на длинных скриншотах) */
@media (min-width: 1024px) {
  .app { background: linear-gradient(to right, var(--surface) calc(var(--sidebar-w) - 1px), var(--line) 0 var(--sidebar-w), transparent 0); }
}
.dropzone__title-tap { display: none; }
@media (max-width: 767px) {
  .dropzone__title-tap { display: inline; }
  .files:not(.files--grid) .frow__body { display: contents; }
  .files:not(.files--grid) .frow__body > div:first-child { grid-column: 2; min-width: 0; padding-right: 36px; }
  .files:not(.files--grid) .frow__fields, .files:not(.files--grid) .frow__body > .save-state { grid-column: 1 / -1; }
  .frow__actions { flex-wrap: nowrap; }
  .frow__actions > .btn { flex: 1 1 auto; }
  .frow__order { flex: none; }
  .frow__order .btn { flex: none; }
}
.save-state:empty { display: none; }
@media (max-width: 1023px) { .nav__group-head { height: 44px; } }
/* Плитка-иконка у заголовка раздела (как маленькая иконка у «Files» в ref-1): нейтральная, одна на всех списках */
.page-head__icon { width: 40px; height: 40px; border-radius: var(--r-ctl); display: grid; place-items: center; flex: none; background: var(--surface); border: 1px solid var(--line); color: var(--text-2); box-shadow: var(--shadow-xs); }
.page-head__icon .ic { width: 20px; height: 20px; }
@media (max-width: 767px) { .page-head__icon { width: 36px; height: 36px; } }

/* ---------- Доступность (по AUDIT.md) ---------- */
/* 1: закрытый мобильный сайдбар не попадает в порядок Tab */
@media (max-width: 1023px) {
  .sidebar:not(.is-open) { visibility: hidden; transition: translate var(--dur-4) var(--ease-emph), visibility 0s linear var(--dur-4); }
  .sidebar.is-open { visibility: visible; transition: translate var(--dur-4) var(--ease-emph), visibility 0s; }
}

/* 6: фокус и якоря не уходят под липкую шапку / оглавление / нижнюю панель */
html { scroll-padding-top: calc(var(--topbar-h) + 16px); }
html:has(.toc) { scroll-padding-top: calc(var(--topbar-h) + 64px); scroll-padding-bottom: 104px; }
/* 8–9: кольцо фокуса внутри прокручиваемых/обрезающих контейнеров и в меню — outline внутрь */
.nav__item:focus-visible, .tab:focus-visible, .nav__group-head:focus-visible, .menu__item:focus-visible, .seg__btn:focus-visible, .row-link:focus-visible, .pager__btn:focus-visible {
  box-shadow: none; outline: 2px solid var(--accent-ui); outline-offset: -2px;
}
/* 14: тосты не закрывают нижнюю панель действий */
body:has(.actionbar:not([hidden])) .toasts { bottom: 104px; }
@media (max-width: 767px) { body:has(.actionbar:not([hidden])) .toasts { bottom: 128px; } }
/* 35: крестик тоста на мобильной */
@media (max-width: 767px) { .toast__close { width: 44px; height: 44px; margin: -12px -12px -12px 0; } }

/* =========================================================================
   РАУНД 2 (правки владельца 2026-10-15)
   ========================================================================= */

/* 2. Шапка — отдельная белая полоса с границей и лёгкой тенью */
.topbar, .topbar.is-scrolled { background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: 0 1px 2px rgb(24 24 27 / .04); }
.topbar.is-scrolled { box-shadow: 0 1px 2px rgb(24 24 27 / .05), 0 4px 12px -6px rgb(24 24 27 / .10); }
.page { padding-top: var(--s-4); }
@media (max-width: 767px) { .topbar { background: var(--surface); } }
/* кнопка профиля: аватар + имя и роль, рамка, меню */
.topbar .me-btn { display: inline-flex; align-items: center; gap: 10px; height: 44px; padding: 3px 10px 3px 4px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--surface); color: var(--text); text-align: left; transition: background-color var(--dur-1), border-color var(--dur-1); }
.me-btn:hover { background: var(--surface-hover); border-color: #d4d4d8; }
.me-btn[aria-expanded="true"] { background: var(--surface-hover); }
.me-btn__text { display: grid; line-height: 1.2; min-width: 0; }
.me-btn__name { font-size: var(--fs-sm); font-weight: var(--fw-semibold); white-space: nowrap; }
.me-btn__role { font-size: var(--fs-xs); color: var(--text-3); }
.me-btn > .ic { width: 16px; height: 16px; color: var(--text-3); }
.me-btn .avatar { width: 34px; height: 34px; }
@media (max-width: 767px) { .topbar .me-btn { padding: 4px; border: 0; width: var(--tap); justify-content: center; } .me-btn__text, .me-btn > .ic { display: none; } }
.topbar__help .ic { width: 22px; height: 22px; }

/* 1. Вкладки: линия только у активной */
.tab::after { transform: scaleX(0); }
.tab[aria-current="location"] { color: var(--text); }
.tab[aria-current="location"]::after { transform: scaleX(1); }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* 5. Строки списков — различимые: заметнее разделители, больше воздуха, подсветка при наведении */
:root { --row-h: 60px; --line-row: #e4e4e7; --row-hover: #f4f4f5; }
:root { --row-h: 48px; }
.table td { border-bottom-color: var(--line-row); padding-top: 10px; padding-bottom: 10px; }
.table tbody tr:hover { background: var(--row-hover); }
.table tbody tr.group-row:hover { background: transparent; }
/* зебра — очень лёгкая */

/* каждая строка — отдельная карточка */

@media (max-width: 767px) {
  .table--stack tr { border-bottom-color: var(--line-row); padding-top: var(--s-4); padding-bottom: var(--s-4); }
}

/* 6. Пагинация (вид «bar»): номера страниц слева, «Показаны A–B из N» и «По 20/50/100» справа — partials/pager.blade.php */
.pager { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; padding: var(--s-3) var(--card-pad); border-top: 1px solid var(--line-row); }
.pager__info { color: var(--text-2); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.pager__info b { color: var(--text); font-weight: var(--fw-semibold); }
.pager__per { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--text-2); }
.select--sm { height: 32px; width: auto; padding: 0 30px 0 10px; font-size: var(--fs-sm); background-position: right 8px center; }
.pager__pages { display: flex; gap: 6px; align-items: center; margin-left: auto; }
@media (max-width: 767px) {
  .pager { flex-direction: column; align-items: stretch; gap: var(--s-3); }
  .pager__pages { margin: 0; justify-content: center; }
  .pager__info { text-align: center; }
  .pager__per { justify-content: center; }
  .select--sm { height: 44px; }
}

/* 7. Спарклайны и тренд */
.spark { display: block; overflow: visible; flex: none; }
.spark__line { fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 0; animation: spark-draw .9s var(--ease-out) both; }
.spark__area { fill: currentColor; opacity: .08; animation: fade-in .9s var(--ease-out) both; }
.spark__dot { fill: var(--surface); stroke: currentColor; stroke-width: 1.75; }
.spark--up { color: var(--success); }
.spark--down { color: var(--danger); }
.spark--flat { color: var(--text-3); }
@keyframes spark-draw { from { stroke-dashoffset: 1; } }
.delta--flat { color: var(--text-2); background: var(--neutral-bg); }
.kpi__trend { display: flex; align-items: center; gap: var(--s-2); }
.kpi__row { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-3); }
@media (prefers-reduced-motion: reduce) { .spark__line, .spark__area { animation: none; } }

/* 10. Превью записей — 3:2 */
.table .thumb, .sk--thumb { width: 72px; height: 48px; aspect-ratio: 3 / 2; object-fit: cover; }
:root .table .thumb { width: 60px; height: 40px; }
.tile__media, .sk--media { aspect-ratio: 3 / 2; }
.toolbar__search { position: relative; }
.toolbar__kbd { position: absolute; right: 10px; top: 50%; translate: 0 -50%; pointer-events: none; }
.toolbar__search .input { padding-right: 44px; }
.toolbar__search:focus-within .toolbar__kbd { opacity: 0; }
@media (max-width: 767px) { .toolbar__kbd { display: none; } .table--stack .thumb { width: 96px; height: 64px; } }

/* 13–15. Редактор: отдельные карточки, «Сохранить» в шапке и в «Публикации», опасная зона внизу */
.edit-head__actions { align-items: center; }
.save-hint { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--warning); font-weight: var(--fw-medium); }
.save-hint__dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.save-hint--ok { color: var(--text-3); font-weight: var(--fw-regular); }
.save-hint--ok .ic { color: var(--success); }
html[data-state="dirty"] .btn--save, html[data-state="dirty"] #saveHead { --btn-bg: var(--primary-bg); --btn-fg: var(--primary-fg); --btn-line: transparent; --btn-bg-hover: var(--primary-bg-hover); --btn-bg-press: var(--primary-bg-press); }
#saveHead { --btn-bg: var(--surface); --btn-fg: var(--text); --btn-line: var(--line); --btn-bg-hover: var(--surface-hover); }
.card__title .ic { color: var(--text-2); }
.danger-card__body { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; }
.danger-card .card__sub { max-width: 70ch; margin-top: 4px; }
@media (max-width: 767px) { .danger-card .btn-group { width: 100%; } .danger-card .btn-group .btn { flex: 1; } .edit-head__actions { width: 100%; } .edit-head__actions #saveHead { margin-left: auto; } }
/* 12. мягкое раскрытие блока «Анонс — предзаказ» */
.reveal { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows var(--dur-4) var(--ease-emph), opacity var(--dur-3) var(--ease-out), margin var(--dur-4) var(--ease-emph); margin-top: calc(var(--stack) * -1); }
.reveal.is-open { grid-template-rows: 1fr; opacity: 1; margin-top: 0; }
.reveal__inner { min-height: 0; overflow: hidden; }
.reveal.is-open .reveal__inner { overflow: visible; }
.reveal:not(.is-open) .reveal__inner { visibility: hidden; transition: visibility 0s var(--dur-4); }
/* отступ при прокрутке к якорю — один (scroll-padding у html), без двойного scroll-margin */
[id] { scroll-margin-top: 0; }
/* пагинация на телефоне: первая, текущая, последняя + стрелки — в одну строку */
@media (max-width: 767px) { .pager__btn--near { display: none; } .pager__pages { flex-wrap: nowrap; } }
/* «Записи»: поиск в шапке — единственный; на телефоне он виден вместо логотипа */
@media (max-width: 767px) {
  html[data-page="items"] .topbar .topbar__search { display: block; flex: 1 1 auto; min-width: 0; }
  html[data-page="items"] .topbar .topbar__logo, html[data-page="items"] .topbar .topbar__search .kbd { display: none; }
  html[data-page="items"] .topbar__search .input { padding-right: 12px; }
}
/* флаги стран (circle-flags, локально) — общие для всех экранов */
.country { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.flag { width: 18px; height: 18px; flex: none; border-radius: 50%; box-shadow: 0 0 0 1px var(--line-soft); }
.topbar .me-btn { border-color: transparent; }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
/* пагинация «bar»: номера слева, сводка и «По 20» справа */
:root .pager__pages { order: -1; margin-left: 0; margin-right: auto; }
@media (max-width: 767px) { :root .pager__pages { order: 0; margin: 0; } }

/* =========================================================================
   Прод (P16 H1): дополнения к компонентам лаборатории
   ========================================================================= */
/* список ошибок в баннере (partials/flash) */
.banner__list { margin: 0; padding-left: 1.1em; display: grid; gap: 2px; }
/* кнопка с загрузкой (motion.js) — и у старых классов кнопок, пока страницы не перенесены */
.is-busy { pointer-events: none; cursor: progress; }
.is-busy:not(.btn) .btn__spinner { display: inline-block; width: 14px; height: 14px; border-width: 2px; }
/* долгий переход между страницами: контент приглушается, сверху — полоса (motion.js) */
.page__inner { transition: opacity var(--dur-3) var(--ease-out); }
.page.is-pending .page__inner { opacity: .55; }
/* скелетон списка, который грузится скриптом (MOTION.skeleton) */
.sk-list { display: grid; }
