/*
 * Полный переход интерфейса на Tabler (github.com/tabler/tabler, MIT):
 * assets/template/tabler/css/tabler.min.css — официальная сборка
 * @tabler/core, подключена в layout/header.php ВМЕСТО шаблона Hando.
 * Tabler (@tabler/core) + app.css: единая дизайн-система поверх Tabler.
 * Tabler даёт базовые компоненты; app.css задаёт токены (--app-*),
 * компактный ритм, таблицы, dataTables, flatpickr и уникальные блоки
 * (дашборд, сайдбар, сервисные кнопки, конструктор форм).
 */

/* шрифт по умолчанию — Open Sans (Google Fonts) */
@import url('https://fonts.googleapis.com/css2?family=Open+Sans&display=swap');

/* Feather: плейсхолдер невидим до replace; SVG сразу нужного размера (без 24→15 сверху слева) */
[data-feather]:not(svg) {
    display: inline-block;
    width: 1em;
    height: 1em;
    vertical-align: -0.15em;
    flex-shrink: 0;
    overflow: hidden;
    visibility: hidden;
    speak: never;
}

.app-menu-icon [data-feather]:not(svg),
.app-sidebar .nav-link-icon [data-feather]:not(svg),
.app-topbar-menu__link-icon [data-feather]:not(svg),
.app-topbar-menu__group-icon [data-feather]:not(svg),
.app-topbar-menu__dropdown-icon [data-feather]:not(svg) {
    width: 15px;
    height: 15px;
}

.btn [data-feather]:not(svg) {
    width: 1em;
    height: 1em;
}

/* Меню: иконки уже inline с сервера — без клиентской перерисовки */
.app-menu-icon > svg.feather,
.app-sidebar .nav-link-icon > .app-menu-icon > svg.feather,
.app-topbar-menu__link-icon > svg.feather,
.app-topbar-menu__group-icon > svg.feather,
.app-topbar-menu__dropdown-icon > svg.feather {
    display: block;
    width: 15px !important;
    height: 15px !important;
    flex-shrink: 0;
}

/* шрифт Geist (Vercel, SIL OFL) — самостоятельно, без внешних сервисов;
   один variable-файл покрывает все начертания (100–900); оставлен как fallback */
@font-face {
    font-family: 'Geist';
    src: url('../fonts/geist/Geist-Variable.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Geist Mono';
    src: url('../fonts/geist/GeistMono-Variable.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

.font-monospace,
code,
pre,
kbd,
samp {
    font-family: 'Geist Mono', var(--tblr-font-monospace, monospace);
}

/* --- мост переменных: у Tabler свой префикс (--tblr-*), а не Bootstrap
   (--bs-*), на котором были написаны наши собственные классы (виджеты,
   дерево сущностей, flatpickr-тема, dataTables). Явно не задаём тут
   ничего в --tblr-primary/border-radius и т.п. — дефолты Tabler уже
   совпадают с нашим фирменным синим (#066fd1) и нужными скруглениями,
   переопределять их незачем. Мост просто разрешает нашим старым
   классам находить значения по знакомым именам. --- */
:root {
    --brand-accent: #0B679E;
    --tblr-font-sans-serif: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

    --bs-primary: var(--tblr-primary);
    --bs-primary-rgb: var(--tblr-primary-rgb);
    --bs-body-bg: var(--tblr-body-bg);
    --bs-body-color: var(--tblr-body-color);
    --bs-border-color: var(--tblr-border-color);
    --bs-secondary-color: var(--tblr-secondary-color);
    --bs-tertiary-bg: var(--tblr-bg-surface-secondary);
    --bs-card-bg: var(--tblr-bg-surface);
    --bs-border-radius: var(--tblr-border-radius);
    --bs-font-monospace: var(--tblr-font-monospace, monospace);
    --bs-link-color: var(--tblr-link-color);
    --bs-link-color-rgb: var(--tblr-primary-rgb);
    --bs-success: var(--tblr-success);
}

html,
body {
    font-family: 'Open Sans', sans-serif;
    overflow-x: hidden;
}

body, p, span, div, a, button, label, input, select, textarea,
table, th, td, li, h1, h2, h3, h4, h5, h6, small, strong, b {
    font-family: 'Open Sans', sans-serif !important;
}

/* Font Awesome (solid) требует вес 900 для отображения глифов — иначе показывает
   пустые квадраты. Глиф иконки рисуется через content на псевдоэлементе
   ::before (так работает Font Awesome / наша самохостящаяся Line Awesome),
   поэтому вес нужно задавать именно на ::before/::after — псевдоэлементы
   не наследуют переопределённый вес шрифта от родителя. */
.fas,
.fa,
.fas::before,
.fas::after,
.fa::before,
.fa::after {
    font-weight: 900 !important;
}

/* --- заголовки разделов бокового меню (см. layout/header.php,
   .nav-section-title) — своего готового класса под тёмный сайдбар
   в Tabler нет, стиль подобран по образцу их .subheader --- */
.nav-section-title {
    padding: .5rem 1.5rem .2rem;
    font-size: .7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--tblr-secondary-color);
}

.nav-section-title:first-child {
    padding-top: .15rem;
}

/* --- вспомогательные классы, которых нет в Bootstrap/Tabler --- */
.text-xs {
    font-size: .7rem;
}

.text-gray-300 {
    color: var(--tblr-gray-300, #d1d5db) !important;
}

.text-gray-600 {
    color: var(--tblr-secondary-color) !important;
}

.text-gray-800 {
    color: var(--tblr-body-color) !important;
}

.font-weight-bold {
    font-weight: 700 !important;
}

.border-left-primary {
    border-left: .25rem solid var(--tblr-primary) !important;
}

.border-left-success {
    border-left: .25rem solid var(--tblr-success, #2fb344) !important;
}

/* --- дерево сущностей --- */
.entity-tree .entity-row {
    padding: .5rem .6rem;
    border-radius: var(--tblr-border-radius);
    border-left: 2px solid transparent;
}

.entity-tree .entity-row:hover {
    background: rgba(var(--tblr-primary-rgb), .06);
    border-left-color: var(--tblr-primary);
}

/* --- кнопки-иконки: геометрия задаётся в блоке «Единая система размеров» --- */

/* --- second-tier outline-кнопки (btn-outline-secondary): у Tabler они по
   умолчанию на hover/active инвертируются в сплошной тёмно-серый фон с
   белым текстом — выглядит слишком грубо на фоне остальных кнопок сайта.
   Меняем на мягкую светлую заливку вместо инверсии. */
.btn-outline-secondary {
    --tblr-btn-hover-color: var(--tblr-secondary);
    --tblr-btn-hover-bg: var(--tblr-bg-surface-secondary);
    --tblr-btn-hover-border-color: var(--tblr-border-active-color, var(--tblr-secondary));
    --tblr-btn-active-color: var(--tblr-secondary);
    --tblr-btn-active-bg: var(--tblr-bg-surface-secondary);
    --tblr-btn-active-border-color: var(--tblr-border-active-color, var(--tblr-secondary));
}

/* --- круглые кнопки-иконки в шапке (избранное, переключатель темы):
   вместо инверсии в сплошной серый фон на hover — просто меняем цвет
   иконки на фирменный синий, фон остаётся прозрачным --- */
.app-topbar .btn-ghost-secondary {
    --tblr-btn-hover-color: var(--brand-accent);
    --tblr-btn-hover-bg: transparent;
    --tblr-btn-hover-border-color: transparent;
    --tblr-btn-active-color: var(--brand-accent);
    --tblr-btn-active-bg: transparent;
    --tblr-btn-active-border-color: transparent;
}

/* --- кнопки-ссылки на управление дашбордом внизу главной: рамка и иконка
   в фирменном синем (#0B679E), иконка в заливке слева, текст акцентом --- */
.btn-accent-split {
    display: inline-flex;
    align-items: stretch;
    height: 30px;
    padding: 0 !important;
    overflow: hidden;
    border-color: var(--brand-accent) !important;
    background: transparent !important;
    line-height: 1;
}

.btn-accent-split-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    background: linear-gradient(135deg, #1583C0, var(--brand-accent));
    color: #fff;
}

.btn-accent-split-icon svg.feather {
    margin-right: 0 !important;
    width: 15px;
    height: 15px;
    color: #fff;
    stroke: #fff;
    flex: 0 0 auto;
}

.btn-accent-split-label {
    display: flex;
    align-items: center;
    padding: 0 14px;
    color: var(--brand-accent);
    white-space: nowrap;
}

.btn-accent-split:hover {
    background: color-mix(in srgb, var(--brand-accent) 6%, transparent) !important;
}

.btn-accent-split:hover .btn-accent-split-label { color: var(--brand-accent); }

/* иконка + подпись во всех кнопках — Font Awesome (feather — через gap в .btn) */

/* Inline-code задаётся в блоке «Единая система размеров». */

.system-field-row {
    color: var(--tblr-secondary-color);
}

.system-fields-title {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 8px;
    color: var(--tblr-body-color);
    font-size: var(--app-font-size, 14px);
    font-weight: 600;
    line-height: 1.2;
}

.system-fields-title span {
    color: var(--tblr-secondary-color);
    font-size: inherit;
    font-weight: 400;
}

.field-lock-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border-radius: 5px;
    background: #f3f4f6;
    color: #64748b;
    vertical-align: middle;
    flex: 0 0 auto;
}

.field-lock-badge .icon-svg {
    width: 12px;
    height: 12px;
    display: block;
}

.system-fields-panel {
    margin-bottom: 1.15rem;
    border: 1px solid var(--tblr-border-color-translucent, rgba(15, 45, 66, .1));
    border-radius: var(--app-control-radius, 0.375rem);
    background: #fff;
}

.system-fields-panel__summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1rem;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.system-fields-panel__summary::-webkit-details-marker,
.system-fields-panel__summary::marker {
    display: none;
    content: '';
}

.system-fields-panel__summary::before {
    content: '';
    width: 0;
    height: 0;
    border-left: 5px solid #94a3b8;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    flex: 0 0 auto;
    transition: transform .15s ease;
}

.system-fields-panel[open] > .system-fields-panel__summary::before {
    transform: rotate(90deg);
}

.system-fields-panel__title {
    font-size: var(--app-font-size, 14px);
    font-weight: 600;
    color: var(--tblr-body-color);
}

.system-fields-panel__count {
    margin-left: auto;
    color: #94a3b8;
    font-size: 12px;
}

.system-fields-panel__body {
    border-top: 1px solid var(--tblr-border-color-translucent, rgba(15, 45, 66, .1));
}

.system-fields-panel__body .table {
    margin-bottom: 0;
}

.field-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 22px;
    padding: 2px 7px;
    border: 1px solid #d7c58d;
    border-radius: 5px;
    background: #fff9e8;
    color: #65521e;
    font-size: var(--app-font-size, 14px);
    font-weight: 500;
    line-height: 1;
    vertical-align: middle;
    white-space: nowrap;
}

.field-status-badge svg.feather {
    width: 13px;
    height: 13px;
    flex: 0 0 auto;
    stroke-width: 2;
}

.field-status-badge-icon {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    cursor: help;
}

.field-status-badge-icon .icon-svg {
    width: 15px;
    height: 15px;
    fill: #b08c1f;
}

/* --- свои inline-svg иконки (логотип / редактировать / удалить) --- */
.icon-svg {
    width: 1em;
    height: 1em;
    vertical-align: -0.15em;
    fill: currentColor;
    flex-shrink: 0;
}

/* МАКС: широкий viewBox — выравниваем по центру линии иконок 16px */
.icon-svg--max {
    width: 1.25em;
    height: 0.86em;
    overflow: visible;
    vertical-align: middle;
    display: inline-block;
}

.app-menu-icon .icon-svg--max,
.app-topbar-menu__link-icon .icon-svg--max,
.app-topbar-menu__group-icon .icon-svg--max,
.app-topbar-menu__dropdown-icon .icon-svg--max {
    width: 18px !important;
    height: 12px !important;
    max-width: none;
    max-height: none;
}

.app-topbar-max-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    height: 16px;
    line-height: 0;
    color: var(--tblr-secondary-color);
    text-decoration: none;
}

.app-topbar-max-btn .icon-svg--max,
.app-topbar-square-btn .icon-svg--max {
    width: 18px !important;
    height: 12px !important;
    margin: 0 !important;
    vertical-align: 0;
    display: block;
    transform: translateY(-2px);
}

.app-topbar-max-btn:hover,
.app-topbar-max-btn.is-active {
    color: #0B679E;
}

/* иконка меню сущности / группы меню, когда значение — сама SVG-разметка
   (выбрана из библиотеки Line Awesome или своя), а не CSS-класс — см.
   includes/functions.php::icon_value_render() */
.icon-value-svg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: 0;
    line-height: 0;
    overflow: visible;
}

.icon-value-svg svg,
.icon-svg-custom {
    width: 1em;
    height: 1em;
    flex-shrink: 0;
    display: block;
    overflow: visible;
}

.icon-value-svg svg:not([fill="none"]),
.icon-svg-custom:not([fill="none"]) {
    fill: currentColor;
}

.icon-value-svg svg [stroke],
.icon-svg-custom [stroke] {
    fill: none;
}

/* превью в подборщике иконки (настройки сущности / меню) */
.fa-icon-picker-preview {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    box-sizing: border-box;
    overflow: hidden;
    font-size: 22px;
    line-height: 0;
    color: var(--tblr-body-color);
}

.fa-icon-picker-preview .icon-value-svg,
.fa-icon-picker-preview > i,
.fa-icon-picker-preview > svg {
    width: 100%;
    height: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: inherit;
    line-height: 1;
}

.fa-icon-picker-preview .icon-value-svg svg,
.fa-icon-picker-preview > svg,
.fa-icon-picker-preview .icon-svg-custom {
    width: 100% !important;
    height: 100% !important;
    max-width: 100%;
    max-height: 100%;
}

.fa-icon-picker-preview__empty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--tblr-secondary-color);
    opacity: .55;
    font-size: 18px;
    line-height: 1;
}

.logo-box .icon-svg {
    width: 22px;
    height: 22px;
    color: var(--tblr-primary);
}

.auth-brand .icon-svg {
    width: 32px;
    height: 32px;
    color: var(--brand-accent);
}

.auth-brand__logo {
    --auth-logo-size: 120px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
}

.auth-brand__logo .app-brand-logo,
.auth-brand__logo .icon-svg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--auth-logo-size);
    height: var(--auth-logo-size);
    color: inherit;
}

.auth-brand__logo .app-brand-logo svg,
.auth-brand__logo .icon-svg svg,
.auth-brand__logo svg {
    width: var(--auth-logo-size) !important;
    height: var(--auth-logo-size) !important;
    max-width: var(--auth-logo-size);
    max-height: var(--auth-logo-size);
    display: block;
}

.btn-icon .icon-svg {
    width: 13px;
    height: 13px;
}

/* --- главная: компактные карточки-статистики ---
   max-width — чтобы виджет не растягивался шире остальных карточек, когда
   в ряду мало элементов (flex-grow иначе отдаёт ему всё свободное место) */
.stat-card {
    display: flex;
    align-items: center;
    gap: .9rem;
    flex: 1 1 220px;
    max-width: 300px;
    background: var(--tblr-bg-surface);
    border: 1px solid var(--tblr-border-color);
    border-radius: 8px;
    box-shadow: var(--app-shadow-sm, 0 1px 3px rgba(15, 23, 42, .035));
    padding: .9rem 1.1rem;
    text-decoration: none;
    color: inherit;
    transition: border-color .15s ease;
}

/* Сетка главной (раскладка виджетов) */
.dash-layout-root {
    position: relative;
    min-height: 40vh;
}
/* Как кнопка настроек сущности в service-toolbar */
.dash-edit-fab {
    position: absolute;
    top: -2px;
    right: 0;
    z-index: 30;
    width: var(--app-control-height, 30px);
    min-width: var(--app-control-height, 30px);
    height: var(--app-control-height, 30px);
    min-height: var(--app-control-height, 30px);
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: var(--tblr-border-radius, .375rem);
    background: transparent;
    color: #64748b;
    box-shadow: none;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.dash-edit-fab:hover {
    background: rgba(11, 103, 158, 0.06);
    border-color: transparent;
    color: var(--tblr-body-color, #1e293b);
}
.dash-edit-fab.is-active {
    color: var(--brand-accent, #0B679E);
    background: rgba(11, 103, 158, 0.1);
    border-color: transparent;
}
.dash-edit-fab .icon-svg {
    width: 16px;
    height: 16px;
}
.dash-edit-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .5rem .75rem;
    margin: 0 44px 12px 0;
    padding: .55rem .75rem;
    background: #eef6ff;
    border: 1px solid #c7ddf7;
    border-radius: 10px;
}
.dash-edit-bar__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 12px;
    min-width: 0;
}
.dash-edit-bar__text strong { font-size: 13px; color: #1e3a5f; }
.dash-edit-bar__actions {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}
.dash-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-start;
    width: 100%;
}
.dash-grid__cell {
    position: relative;
    box-sizing: border-box;
    flex: 0 0 auto;
    /* 24 колонки с учётом gap: ширина = n долей ряда + (n−1) промежутков */
    width: calc(
        (100% - 23 * 12px) / 24 * var(--dash-span, 6)
        + (var(--dash-span, 6) - 1) * 12px
    );
    min-width: 0;
    max-width: 100%;
}
.dash-grid__cell--full {
    width: 100%;
    flex-basis: 100%;
}
.dash-grid__break {
    flex: 0 0 100%;
    width: 100%;
    height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    overflow: hidden;
}
.dash-grid__body > .stat-card,
.dash-grid__body > .stat-card--custom,
.dash-grid__cell > .stat-card,
.dash-grid__cell > .stat-card--custom {
    max-width: none;
    width: 100%;
    flex: none;
}
/* Кнопки (Реестр-триггер, «+ счёт») — всегда свой стандартный размер, не от сетки */
.dash-grid__body > .dash-qa,
.dash-grid__body > .dash-qa-form,
.dash-grid__cell > .dash-qa,
.dash-grid__cell > .dash-qa-form {
    width: auto;
    max-width: 100%;
    flex: none;
}
.dash-grid__body > .dash-qa-form,
.dash-grid__cell > .dash-qa-form {
    display: inline-flex;
}
.dash-grid__body > .dash-qa-form > .dash-qa,
.dash-grid__cell > .dash-qa-form > .dash-qa {
    width: auto;
}
.dash-grid__body > .reestr-dash-widget,
.dash-grid__cell--reestr .reestr-dash-widget {
    /* как в модуле: компактная кнопка / панель до 560px */
    width: min(560px, 100%);
    max-width: min(560px, 100%);
}
.dash-grid__cell--compact {
    width: max-content;
    max-width: 100%;
}
.dash-grid__cell--compact .dash-grid__body {
    width: max-content;
    max-width: 100%;
}
.dash-grid__cell--reestr {
    width: max-content;
    max-width: 100%;
}
.dash-grid__cell--reestr.is-panel-open,
.dash-grid__cell--reestr:has(.reestr-dash-widget.is-open) {
    /* раскрытая панель Реестра — занимает колонку сетки (основная часть) */
    width: calc(
        (100% - 23 * 12px) / 24 * var(--dash-span, 6)
        + (var(--dash-span, 6) - 1) * 12px
    );
    max-width: 100%;
}
.dash-grid__cell--reestr:has(.reestr-dash-widget.is-open) .reestr-dash-widget {
    width: 100%;
    max-width: min(560px, 100%);
}
.dash-grid__chrome {
    display: none;
}
.dash-is-editing .dash-grid {
    padding: 10px;
    background: color-mix(in srgb, var(--bs-tertiary-bg, #f1f5f9) 80%, transparent);
    border: 1px dashed #b6c9de;
    border-radius: 12px;
}
.dash-is-editing .dash-grid__cell[data-layout-key] {
    outline: 1px solid transparent;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
    padding: 0;
}
.dash-is-editing .dash-grid__cell[data-layout-key].is-dragging {
    opacity: .4;
}
.dash-is-editing .dash-grid__chrome {
    display: block;
    position: relative;
    z-index: 2;
    padding: 6px 10px 4px;
    border-bottom: 1px solid var(--bs-border-color);
    background: #f8fafc;
    border-radius: 10px 10px 0 0;
}
.dash-grid__chrome-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 11px;
    color: #64748b;
    padding-right: 12px;
}
.dash-grid__chrome-title {
    font-weight: 600;
    color: #334155;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.dash-grid__chrome-meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}
.dash-grid__newrow {
    appearance: none;
    border: 1px solid var(--bs-border-color);
    background: #fff;
    border-radius: 4px;
    font-size: 10px;
    padding: 1px 6px;
    cursor: pointer;
    color: #64748b;
}
.dash-grid__newrow.is-on {
    background: color-mix(in srgb, var(--tblr-primary, #206bc4) 12%, #fff);
    border-color: color-mix(in srgb, var(--tblr-primary, #206bc4) 40%, #fff);
    color: var(--tblr-primary, #206bc4);
}
.dash-grid__resize {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 10px;
    cursor: col-resize;
}
.dash-grid__resize::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 3px;
    width: 3px;
    height: 22px;
    margin-top: -11px;
    border-radius: 2px;
    background: #94a3b8;
    opacity: .75;
}
.dash-is-editing .dash-grid__cell[data-layout-key]:hover .dash-grid__resize::after {
    background: var(--tblr-primary, #206bc4);
    opacity: 1;
}
.dash-is-editing .dash-grid__body {
    user-select: none;
    padding: 8px 10px 10px;
}
/* Тянуть блок удобнее за шапку; содержимое кликабельно (модалка поверх страницы) */
.dash-is-editing .dash-grid__chrome,
.dash-is-editing .dash-grid__chrome-bar {
    cursor: grab;
}
.dash-is-editing .dash-grid__chrome:active,
.dash-is-editing .dash-grid__chrome-bar:active {
    cursor: grabbing;
}
@media (max-width: 768px) {
    .dash-grid__cell:not(.dash-grid__cell--full):not(.dash-grid__cell--compact):not(.dash-grid__cell--reestr) {
        width: 100%;
        flex-basis: 100%;
    }
    .dash-edit-fab {
        position: fixed;
        top: auto;
        bottom: 18px;
        right: 18px;
    }
    .dash-edit-bar {
        margin-right: 0;
    }
}

.stat-card:hover {
    border-color: var(--tblr-primary);
    text-decoration: none;
    color: inherit;
}

.stat-card .stat-number {
    font-size: 16px;
    line-height: 1;
}

/* --- главная: кнопки быстрого создания записи --- */
.dash-qa-form {
    display: inline-flex;
    margin: 0;
}
.dash-qa {
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 6px 16px;
    font-size: 13px;
    line-height: 1.25;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    background: transparent;
    color: inherit;
    transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
    white-space: nowrap;
}
.dash-qa__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    line-height: 0;
}
.dash-qa__icon svg,
.dash-qa__icon i {
    width: 14px;
    height: 14px;
}
.dash-qa__label {
    display: inline-block;
}
.dash-qa--outline-blue {
    color: #1e3a5f;
    border-color: #8ab2e6;
}
.dash-qa--outline-blue:hover { background: rgba(138, 178, 230, .08); border-color: #6d9fd9; }
.dash-qa--outline-blue .dash-qa__icon { color: #6d8eb0; }

.dash-qa--outline-slate {
    color: #334155;
    border-color: #94a3b8;
}
.dash-qa--outline-slate:hover { background: rgba(148, 163, 184, .1); }

.dash-qa--outline-teal {
    color: #0f766e;
    border-color: #5eead4;
}
.dash-qa--outline-teal:hover { background: rgba(45, 212, 191, .1); }

.dash-qa--outline-amber {
    color: #92400e;
    border-color: #fbbf24;
}
.dash-qa--outline-amber:hover { background: rgba(251, 191, 36, .12); }

.dash-qa--solid-primary {
    background: var(--tblr-primary, #206bc4);
    border-color: var(--tblr-primary, #206bc4);
    color: #fff;
}
.dash-qa--solid-primary:hover { filter: brightness(.95); color: #fff; }

.dash-qa--solid-success {
    background: var(--tblr-success, #2fb344);
    border-color: var(--tblr-success, #2fb344);
    color: #fff;
}
.dash-qa--solid-success:hover { filter: brightness(.95); color: #fff; }

.dash-qa--solid-info {
    background: var(--tblr-info, #4299e1);
    border-color: var(--tblr-info, #4299e1);
    color: #fff;
}
.dash-qa--solid-info:hover { filter: brightness(.95); color: #fff; }

.dash-qa--solid-warning {
    background: var(--tblr-warning, #f76707);
    border-color: var(--tblr-warning, #f76707);
    color: #fff;
}
.dash-qa--solid-warning:hover { filter: brightness(.95); color: #fff; }

.dash-qa--solid-danger {
    background: var(--tblr-danger, #d63939);
    border-color: var(--tblr-danger, #d63939);
    color: #fff;
}
.dash-qa--solid-danger:hover { filter: brightness(.95); color: #fff; }

.dash-qa--solid-dark {
    background: #1e293b;
    border-color: #1e293b;
    color: #fff;
}
.dash-qa--solid-dark:hover { filter: brightness(1.1); color: #fff; }

.dash-qa--soft-primary {
    background: color-mix(in srgb, var(--tblr-primary, #206bc4) 12%, #fff);
    border-color: color-mix(in srgb, var(--tblr-primary, #206bc4) 28%, #fff);
    color: var(--tblr-primary, #206bc4);
}
.dash-qa--soft-primary:hover { background: color-mix(in srgb, var(--tblr-primary, #206bc4) 18%, #fff); }

.dash-qa--soft-success {
    background: color-mix(in srgb, var(--tblr-success, #2fb344) 12%, #fff);
    border-color: color-mix(in srgb, var(--tblr-success, #2fb344) 28%, #fff);
    color: #1a7a32;
}
.dash-qa--soft-success:hover { background: color-mix(in srgb, var(--tblr-success, #2fb344) 18%, #fff); }

.dash-qa--soft-info {
    background: color-mix(in srgb, var(--tblr-info, #4299e1) 12%, #fff);
    border-color: color-mix(in srgb, var(--tblr-info, #4299e1) 28%, #fff);
    color: #1d6fa5;
}
.dash-qa--soft-info:hover { background: color-mix(in srgb, var(--tblr-info, #4299e1) 18%, #fff); }

.dash-qa--soft-warning {
    background: color-mix(in srgb, var(--tblr-warning, #f76707) 12%, #fff);
    border-color: color-mix(in srgb, var(--tblr-warning, #f76707) 28%, #fff);
    color: #b45309;
}
.dash-qa--soft-warning:hover { background: color-mix(in srgb, var(--tblr-warning, #f76707) 18%, #fff); }

.dash-qa--soft-danger {
    background: color-mix(in srgb, var(--tblr-danger, #d63939) 12%, #fff);
    border-color: color-mix(in srgb, var(--tblr-danger, #d63939) 28%, #fff);
    color: #b42318;
}
.dash-qa--soft-danger:hover { background: color-mix(in srgb, var(--tblr-danger, #d63939) 18%, #fff); }

.dash-qa--ghost {
    background: transparent;
    border-color: transparent;
    color: #1e3a5f;
    padding-left: 8px;
    padding-right: 8px;
}
.dash-qa--ghost:hover { background: rgba(30, 58, 95, .06); }

.dash-qa--pill-solid {
    background: var(--tblr-primary, #206bc4);
    border-color: var(--tblr-primary, #206bc4);
    color: #fff;
    border-radius: 999px;
    padding-left: 18px;
    padding-right: 18px;
}
.dash-qa--pill-solid:hover { filter: brightness(.95); color: #fff; }

.dash-qa--pill-outline {
    color: #1e3a5f;
    border-color: #8ab2e6;
    border-radius: 999px;
    padding-left: 18px;
    padding-right: 18px;
}
.dash-qa--pill-outline:hover { background: rgba(138, 178, 230, .08); }

.dash-qa--tile {
    flex-direction: column;
    gap: 8px;
    min-width: 88px;
    padding: 12px 14px;
    border-radius: 10px;
    border-color: var(--tblr-border-color, #e6e8eb);
    background: var(--tblr-bg-surface, #fff);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
    white-space: normal;
    text-align: center;
}
.dash-qa--tile .dash-qa__icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--tblr-primary, #206bc4) 12%, #fff);
    color: var(--tblr-primary, #206bc4);
}
.dash-qa--tile .dash-qa__icon svg,
.dash-qa--tile .dash-qa__icon i {
    width: 16px;
    height: 16px;
}
.dash-qa--tile .dash-qa__label {
    font-size: 12px;
    color: #334155;
    max-width: 7.5rem;
}
.dash-qa--tile:hover {
    border-color: #8ab2e6;
    box-shadow: 0 2px 8px rgba(30, 58, 95, .08);
}

.dash-qa--accent-bar {
    position: relative;
    padding-left: 14px;
    border-color: var(--tblr-border-color, #e6e8eb);
    background: var(--tblr-bg-surface, #fff);
    color: #1e3a5f;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.dash-qa--accent-bar::before {
    content: '';
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 3px;
    border-radius: 2px;
    background: var(--tblr-primary, #206bc4);
}
.dash-qa--accent-bar:hover {
    border-color: #8ab2e6;
}

.dash-qa-style-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: .5rem;
}
.dash-qa-style-grid .btn-check + .dash-qa-style-option {
    display: flex;
    flex-direction: column;
    gap: .45rem;
    align-items: flex-start;
    padding: .55rem .65rem;
    border: 1px solid var(--tblr-border-color, #e6e8eb);
    border-radius: .4rem;
    background: #fff;
    cursor: pointer;
    min-height: 100%;
}
.dash-qa-style-grid .btn-check:checked + .dash-qa-style-option {
    border-color: var(--tblr-primary, #206bc4);
    box-shadow: 0 0 0 1px var(--tblr-primary, #206bc4);
}
.dash-qa-style-option__name {
    font-size: .72rem;
    color: #64748b;
}

.stat-card .stat-label {
    font-size: 14px;
    color: var(--tblr-secondary-color);
    line-height: 1.3;
}

/* --- универсальный виджет: своя иконка/рамка/фон/PNG-подложка/ярлычки/график --- */
.stat-card--custom {
    position: relative;
    overflow: hidden;
    display: block;
}

.stat-card--custom .stat-card__body {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem .9rem;
}

.stat-card__bg-image {
    position: absolute;
    max-width: none;
    z-index: 1;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

.stat-card__icon-svg {
    display: inline-flex;
    align-items: center;
}

.stat-card__icon-svg svg {
    width: 1.35rem;
    height: 1.35rem;
    display: block;
}

.brand-mark .app-brand-logo,
.brand-mark .app-brand-logo svg {
    width: 1.75rem;
    height: 1.75rem;
    display: block;
}
.app-brand-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    line-height: 0;
}
.app-brand-logo svg,
.app-brand-logo-svg {
    max-width: 100%;
    max-height: 100%;
    display: block;
    overflow: hidden;
}

/* Логотип с градиентами — не перекрашивать в currentColor */
.app-brand-logo svg,
.app-brand-logo-svg,
.app-sidebar-brand .app-brand-logo svg,
.app-sidebar-brand .app-brand-logo-svg {
    fill: unset;
}

.field-layout-icon-svg svg,
.field-layout-icon {
    width: 1rem;
    height: 1rem;
    display: block;
    flex-shrink: 0;
}

/* currentColor для кастомных SVG; не затираем fill="none" у stroke-иконок */
.field-layout-icon-svg > svg {
    fill: currentColor;
    color: inherit;
}

.field-layout-icon-svg > svg [fill="none"] {
    fill: none;
}

.field-layout-icon-svg > svg [stroke]:not([stroke="none"]) {
    stroke: currentColor;
}

.field-layout-label--inline,
.field-layout-label-inline {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}

.field-layout-label-stack {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .2rem;
}

.field-layout-label-stack--reverse {
    flex-direction: column-reverse;
}

.field-layout-input-icon-wrap {
    position: relative;
}

.field-layout-input-icon-wrap--group {
    display: flex;
    align-items: stretch;
    width: 100%;
}

.field-layout-input-icon-wrap--group .field-layout-input-addon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 2.35rem;
    padding: 0 .65rem;
    color: var(--tblr-secondary);
    background: var(--tblr-bg-surface-secondary, #f8fafc);
    border: 1px solid var(--bs-border-color);
    border-right: 0;
    border-radius: var(--bs-border-radius, .375rem) 0 0 var(--bs-border-radius, .375rem);
}

.field-layout-input-icon-wrap--group .field-layout-input-body {
    flex: 1 1 auto;
    min-width: 0;
}

.field-layout-input-icon-wrap--group .field-layout-input-body .dadata-field-wrap {
    width: 100%;
}

.field-layout-input-icon-wrap--group .field-layout-input-body > .form-control,
.field-layout-input-icon-wrap--group .field-layout-input-body > .form-select,
.field-layout-input-icon-wrap--group .field-layout-input-body .dadata-field-wrap > .form-control,
.field-layout-input-icon-wrap--group .field-layout-input-body .dadata-field-wrap > .form-select {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* связанная сущность / users-picker: иконка в одном контуре с полем, как у даты и списка */
.field-layout-input-icon-wrap--group:has(.related-entity-picker),
.field-layout-input-icon-wrap--group:has(.users-picker) {
    align-items: flex-start;
}

.field-layout-input-icon-wrap--group:has(.related-entity-picker) .field-layout-input-addon,
.field-layout-input-icon-wrap--group:has(.users-picker) .field-layout-input-addon {
    min-height: var(--app-control-height, 36px);
    height: var(--app-control-height, 36px);
    box-sizing: border-box;
}

.field-layout-input-icon-wrap--group .field-layout-input-body > .related-entity-picker,
.field-layout-input-icon-wrap--group .field-layout-input-body > .users-picker {
    width: 100%;
    min-width: 0;
}

.field-layout-input-icon-wrap--group .field-layout-input-body .related-entity-picker__row {
    width: 100%;
    min-width: 0;
}

.field-layout-input-icon-wrap--group .field-layout-input-body .related-entity-picker__control,
.field-layout-input-icon-wrap--group .field-layout-input-body .users-picker__control {
    min-width: 0;
    flex: 1 1 auto;
}

.field-layout-input-icon-wrap--group .field-layout-input-body .related-entity-picker__control > .form-control,
.field-layout-input-icon-wrap--group .field-layout-input-body .related-entity-picker__control--chips,
.field-layout-input-icon-wrap--group .field-layout-input-body .users-picker__control {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.field-layout-input-icon-wrap--group .field-layout-input-body .related-entity-picker__control > .form-control {
    height: var(--app-control-height, 36px);
}

.field-layout-input-icon-wrap .field-layout-input-icon,
.field-layout-input-icon-wrap .field-layout-icon-svg {
    position: absolute;
    left: .75rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    pointer-events: none;
    color: var(--tblr-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
}

.field-layout-input-icon-wrap:not(.field-layout-input-icon-wrap--group) .form-control:not(textarea),
.field-layout-input-icon-wrap:not(.field-layout-input-icon-wrap--group) .form-select {
    padding-left: 2.35rem;
}

.field-layout-input-icon-wrap--static {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}

.field-layout-input-icon-wrap--static .field-layout-input-icon {
    position: static;
    transform: none;
}

.info-field-label.field-layout-label--inline,
.info-field-label .field-layout-label-inline,
.info-field-label .field-layout-label-stack {
    display: inline-flex;
}

.stat-suffix {
    font-size: .7em;
    font-weight: 400;
    opacity: .85;
}

.stat-card__badges {
    flex-basis: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
}

.stat-card__badges .badge {
    font-weight: 500;
    font-size: .7rem;
}

.stat-card__chart {
    flex-basis: 100%;
    width: 100%;
    height: auto;
    max-height: 56px;
    display: block;
}

.stat-card__chart--donut {
    flex-basis: auto;
    width: 56px;
    height: 56px;
}

/* --- предпросмотр в форме виджета: перетаскиваемая/масштабируемая подложка --- */
#widget-preview {
    min-height: 90px;
}

#wp-bgimg {
    pointer-events: auto;
    cursor: move;
    touch-action: none;
}

.widget-resize-handle {
    position: absolute;
    width: 16px;
    height: 16px;
    background: var(--tblr-primary);
    border: 2px solid #fff;
    border-radius: 50%;
    z-index: 5;
    cursor: nwse-resize;
    touch-action: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
}

/* --- пикер иконок Line Awesome: квадратная кнопка, иконка по центру --- */
.la-icon-btn {
    width: 54px;
    height: 54px;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.la-icon-btn img {
    width: 24px;
    height: 24px;
    pointer-events: none;
}

.footer {
    display: none !important;
}

/* --- flatpickr: компактная тема "синяя плашка" --- */
.flatpickr-calendar {
    --fp-day-size: 36px;
    --fp-grid-width: calc(var(--fp-day-size) * 7);
    width: var(--fp-grid-width);
    background: var(--tblr-bg-surface);
    border: 1px solid var(--tblr-border-color);
    border-radius: var(--tblr-border-radius);
    box-shadow: 0 .35rem 1rem rgba(0, 0, 0, .12);
    font-family: inherit;
    font-size: 12px;
    line-height: 18px;
    user-select: none;
    -webkit-user-select: none;
}

<input.flatpickr-date[readonly] {
    background-color: #fff;
    cursor: pointer;
}

input.flatpickr-datetime[readonly] {
    background-color: #fff;
    cursor: pointer;
}

/* datetime: календарь + список слотов справа */
.flatpickr-calendar.hasTime.flatpickr-calendar--time-slots {
    display: grid;
    grid-template-columns: var(--fp-grid-width, 252px) 88px;
    grid-template-rows: auto 1fr auto;
    width: auto !important;
    max-width: calc(100vw - 16px);
}

.flatpickr-calendar.hasTime.flatpickr-calendar--time-slots .flatpickr-months {
    grid-column: 1 / -1;
}

.flatpickr-calendar.hasTime.flatpickr-calendar--time-slots .flatpickr-innerContainer {
    grid-column: 1;
    grid-row: 2;
}

.flatpickr-calendar.hasTime.flatpickr-calendar--time-slots .flatpickr-time {
    display: none !important;
}

.flatpickr-calendar.hasTime.flatpickr-calendar--time-slots .flatpickr-time-slots {
    grid-column: 2;
    grid-row: 2 / 4;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--tblr-border-color);
    min-height: 0;
    max-height: 248px;
}

.flatpickr-time-slots__list {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 4px;
    -webkit-overflow-scrolling: touch;
}

.flatpickr-time-slots__item {
    display: block;
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--tblr-body-color);
    font: inherit;
    font-size: 12px;
    line-height: 1.2;
    text-align: center;
    padding: 7px 4px;
    border-radius: .3rem;
    cursor: pointer;
}

.flatpickr-time-slots__item:hover {
    background: var(--tblr-bg-surface-secondary);
}

.flatpickr-time-slots__item.is-active {
    background: color-mix(in srgb, var(--tblr-primary) 16%, #fff);
    color: var(--tblr-primary);
    font-weight: 600;
}

.flatpickr-time-slots__clear {
    flex: 0 0 auto;
    border: 0;
    border-top: 1px solid var(--tblr-border-color);
    background: transparent;
    color: var(--tblr-secondary-color);
    font: inherit;
    font-size: 12px;
    padding: 8px 4px;
    cursor: pointer;
}

.flatpickr-time-slots__clear:hover {
    color: var(--tblr-primary);
    background: var(--tblr-bg-surface-secondary);
}

.flatpickr-calendar.hasTime.flatpickr-calendar--time-slots.arrowBottom,
.flatpickr-calendar.hasTime.flatpickr-calendar--time-slots.arrowTop {
    animation: none;
}

.flatpickr-calendar.arrowTop:before,
.flatpickr-calendar.arrowTop:after {
    display: none;
}

.flatpickr-months {
    background: color-mix(in srgb, var(--tblr-primary) 78%, #fff);
    border-radius: var(--tblr-border-radius) var(--tblr-border-radius) 0 0;
    padding: .2rem 0;
    height: 34px;
}

.flatpickr-months .flatpickr-month {
    height: 34px;
}

.flatpickr-current-month {
    font-size: 110%;
    height: 34px;
    padding: 4px 0 0;
}

.flatpickr-month,
.flatpickr-current-month,
.flatpickr-current-month .cur-month,
.flatpickr-current-month input.cur-year {
    color: #fff;
    fill: #fff;
    font-weight: 500;
}

.flatpickr-current-month input.cur-year {
    background: transparent;
    font-size: inherit;
}

.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
    top: 4px;
    padding: 4px 8px;
    height: 26px;
    color: #fff;
    fill: #fff;
}

.flatpickr-months .flatpickr-prev-month svg,
.flatpickr-months .flatpickr-next-month svg {
    width: 12px;
    height: 12px;
    fill: #fff;
}

.flatpickr-months .flatpickr-prev-month:hover,
.flatpickr-months .flatpickr-next-month:hover {
    color: #fff;
    fill: #fff;
}

.flatpickr-months .flatpickr-prev-month:hover svg,
.flatpickr-months .flatpickr-next-month:hover svg {
    fill: rgba(255, 255, 255, .72);
}

.flatpickr-innerContainer,
.flatpickr-rContainer,
.flatpickr-days {
    width: var(--fp-grid-width, 252px);
}

.flatpickr-weekdays {
    background: var(--tblr-bg-surface);
    height: 26px;
}

.flatpickr-weekdays .flatpickr-weekdaycontainer {
    display: grid;
    grid-template-columns: repeat(7, var(--fp-day-size, 36px));
    width: var(--fp-grid-width, 252px);
}

span.flatpickr-weekday {
    color: var(--tblr-secondary-color);
    font-weight: 600;
    font-size: .65rem;
    text-transform: uppercase;
    background: var(--tblr-bg-surface);
    width: var(--fp-day-size, 36px);
    max-width: none;
    flex: unset;
}

/* суббота и воскресенье в шапке */
span.flatpickr-weekday:nth-child(6),
span.flatpickr-weekday:nth-child(7) {
    color: var(--tblr-danger, #d63939);
}

.dayContainer {
    width: var(--fp-grid-width, 252px);
    min-width: var(--fp-grid-width, 252px);
    max-width: var(--fp-grid-width, 252px);
    display: grid;
    grid-template-columns: repeat(7, var(--fp-day-size, 36px));
    justify-items: center;
}

.flatpickr-day {
    color: var(--tblr-body-color);
    border-radius: .3rem;
    width: 32px;
    height: 30px;
    line-height: 30px;
    max-width: 32px;
    flex: unset;
    margin: 1px 0;
    font-size: 12px;
}

.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay {
    color: var(--tblr-secondary-color);
    opacity: .5;
}

.flatpickr-day:hover,
.flatpickr-day.today:hover {
    background: var(--tblr-bg-surface-secondary);
    border-color: transparent;
}

.flatpickr-day.today {
    border-color: transparent;
    color: var(--tblr-primary);
    font-weight: 700;
    background: transparent;
}

.flatpickr-day.today.selected,
.flatpickr-day.selected,
.flatpickr-day.selected:hover,
.flatpickr-day.selected:focus {
    background: color-mix(in srgb, var(--tblr-primary) 16%, #fff);
    border-color: transparent;
    color: var(--tblr-primary);
    font-weight: 600;
}

.flatpickr-day.flatpickr-disabled,
.flatpickr-day.flatpickr-disabled:hover {
    color: var(--tblr-secondary-color);
    opacity: .35;
}

/* выходные: числа субботы и воскресенья — красные */
.flatpickr-day.is-weekend:not(.selected):not(.flatpickr-disabled) {
    color: var(--tblr-danger, #d63939) !important;
}

.flatpickr-day.is-weekend.prevMonthDay,
.flatpickr-day.is-weekend.nextMonthDay {
    color: color-mix(in srgb, var(--tblr-danger, #d63939) 70%, var(--tblr-secondary-color)) !important;
    opacity: .6;
}

.flatpickr-day.today.is-weekend:not(.selected) {
    color: var(--tblr-danger, #d63939) !important;
}

.flatpickr-day.selected.is-weekend,
.flatpickr-day.selected.is-weekend:hover,
.flatpickr-day.selected.is-weekend:focus {
    color: var(--tblr-primary) !important;
}

/* --- Tabler application shell ------------------------------------------------ */
:root {
    --app-sidebar-width: 220px;
    --app-sidebar-width-collapsed: 56px;
}

.app-sidebar {
    --tblr-navbar-bg: var(--brand-accent);
    --tblr-navbar-border-color: rgba(255, 255, 255, .07);
    background: linear-gradient(200deg, var(--brand-accent) 0%, #094F7C 50%, #062C43 100%) !important;
    box-shadow: 4px 0 24px rgba(6, 48, 73, .14);
}

.app-sidebar__inner {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-height: 100%;
    padding: 0;
}

.app-sidebar__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    position: relative;
    flex-shrink: 0;
    min-height: 52px;
    padding: 8px 40px 8px 10px;
}

.app-sidebar .navbar-brand {
    min-height: 0;
    margin: 0;
    padding: 0;
    color: #fff;
}

.app-sidebar .navbar-brand:hover { text-decoration: none; }

.app-sidebar-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
    margin: 0;
    padding: 0;
    color: #fff;
    text-decoration: none;
    --app-logo-size: 28px;
    --app-logo-title-size: 15px;
    --app-logo-subtitle-size: 10px;
    --app-logo-title-color: #ffffff;
    --app-logo-subtitle-color: #b7c9d8;
}

.app-sidebar-brand--bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.app-sidebar-brand--hidden {
    flex: 0 0 auto;
}

.app-sidebar-brand .app-brand-logo,
.app-sidebar-brand .icon-svg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--app-logo-size);
    height: var(--app-logo-size);
    flex-shrink: 0;
    color: #fff;
}

.app-sidebar-brand .app-brand-logo svg,
.app-sidebar-brand .icon-svg,
.app-sidebar-brand .app-brand-logo-svg {
    width: var(--app-logo-size) !important;
    height: var(--app-logo-size) !important;
    max-width: var(--app-logo-size);
    max-height: var(--app-logo-size);
    display: block;
    object-fit: contain;
}

.app-logo-icon-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 0;
}

.app-sidebar__brand-text {
    min-width: 0;
    overflow: hidden;
}

.app-sidebar__brand-text strong {
    display: block;
    font-size: var(--app-logo-title-size);
    line-height: 1.15;
    font-weight: 500;
    color: var(--app-logo-title-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-sidebar__brand-text small {
    display: block;
    margin-top: .1rem;
    color: var(--app-logo-subtitle-color);
    font-size: var(--app-logo-subtitle-size);
    font-weight: 500;
    letter-spacing: .02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-sidebar-collapsed .app-sidebar-brand .app-sidebar__brand-text {
    display: none !important;
}

.app-sidebar-collapsed .app-sidebar-brand {
    flex: 0 0 auto;
    flex-direction: row;
}

.app-sidebar__toggle {
    position: absolute;
    top: 6px;
    right: 8px;
    z-index: 2;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 6px;
    background: rgba(255, 255, 255, .08);
    color: rgba(255, 255, 255, .85);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: none;
}

.app-sidebar__toggle:hover {
    color: #fff;
    background: rgba(255, 255, 255, .12);
    border-color: rgba(255, 255, 255, .22);
}

.app-sidebar__toggle svg {
    width: 15px;
    height: 15px;
}

.app-sidebar-collapsed .app-sidebar__toggle svg {
    transform: rotate(180deg);
    transition: transform .15s ease;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    color: #fff;
    background: linear-gradient(135deg, var(--tblr-primary), #5c8df6);
    border-radius: 8px;
    box-shadow: 0 6px 16px rgba(var(--tblr-primary-rgb), .28);
}

.brand-mark .icon-svg { width: 18px; height: 18px; }

/* Настройки: предпросмотр и размещение логотипа */
.settings-brand {
    display: grid;
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.settings-brand__preview-col {
    position: sticky;
    top: 12px;
}

.settings-brand__fields {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.settings-brand__block-title {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--tblr-secondary);
    margin-bottom: 8px;
}

.settings-page .settings-field .form-label {
    margin-bottom: 4px;
    font-size: 12.5px;
}

.settings-page .settings-field .form-control,
.settings-page .settings-field .form-select {
    min-height: 34px;
    padding-top: 5px;
    padding-bottom: 5px;
}

.settings-page .settings-field .form-text {
    margin-top: 2px;
    font-size: 11.5px;
}

.app-logo-preview {
    --app-logo-size: 28px;
    --app-logo-title-size: 15px;
    --app-logo-subtitle-size: 10px;
    --app-logo-title-color: #ffffff;
    --app-logo-subtitle-color: #b7c9d8;
}

.app-logo-preview__bar {
    display: flex;
    align-items: center;
    min-height: 72px;
    padding: 14px 16px;
    border-radius: 12px;
    background: linear-gradient(200deg, var(--brand-accent) 0%, #094F7C 50%, #062C43 100%);
    color: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
}

.app-logo-preview__brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: #fff;
    --app-logo-size: inherit;
    --app-logo-title-size: inherit;
    --app-logo-subtitle-size: inherit;
    --app-logo-title-color: inherit;
    --app-logo-subtitle-color: inherit;
}

.app-logo-preview__brand.app-sidebar-brand--bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.app-logo-preview__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--app-logo-size);
    height: var(--app-logo-size);
    flex-shrink: 0;
    color: #fff;
}

.app-logo-preview__icon .app-brand-logo,
.app-logo-preview__icon .icon-svg,
.app-logo-preview__icon svg {
    width: var(--app-logo-size) !important;
    height: var(--app-logo-size) !important;
    max-width: var(--app-logo-size) !important;
    max-height: var(--app-logo-size) !important;
    display: block;
}

.app-logo-preview[data-layout="hidden"] .app-logo-preview__text {
    display: none;
}

.app-logo-preview__hint {
    margin-top: 8px;
    font-size: 11.5px;
    color: var(--tblr-secondary);
}

.app-logo-svg-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border: 1px solid var(--tblr-border-color);
    border-radius: 10px;
    background: var(--tblr-bg-surface);
}

.app-logo-svg-card__thumb {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 8px;
    background: linear-gradient(200deg, var(--brand-accent) 0%, #094F7C 100%);
    color: #fff;
}

.app-logo-svg-card__thumb svg,
.app-logo-svg-card__thumb .icon-svg {
    width: 22px !important;
    height: 22px !important;
    display: block;
    color: #fff;
}

.app-logo-svg-card__thumb--empty {
    opacity: .85;
}

.app-logo-svg-card__meta {
    min-width: 0;
    flex: 1;
}

.app-logo-svg-card__status {
    font-size: 12px;
    color: var(--tblr-secondary);
    margin-bottom: 4px;
}

.app-logo-svg-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.app-logo-svg-modal-preview {
    min-height: 48px;
    display: flex;
    align-items: center;
}

.app-logo-svg-modal-preview svg {
    width: 40px;
    height: 40px;
    display: block;
    color: var(--brand-accent);
}

.app-logo-size-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-logo-size-control .form-range {
    flex: 1;
    min-width: 0;
}

.app-logo-size-control__value {
    flex-shrink: 0;
    min-width: 44px;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: var(--tblr-secondary);
    text-align: right;
}

.app-logo-color-control {
    display: flex;
    align-items: center;
    gap: 6px;
}

.app-logo-color-control .form-control-color {
    width: 36px;
    height: 32px;
    padding: 3px;
}

.app-logo-color-control__hex {
    flex: 1;
    min-width: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
}

.app-logo-layout-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.app-logo-layout-option {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin: 0;
    cursor: pointer;
}

.app-logo-layout-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.app-logo-layout-option__card {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    min-height: 44px;
    padding: 6px 8px;
    border: 1px solid var(--tblr-border-color);
    border-radius: 8px;
    background: var(--tblr-bg-surface);
    transition: border-color .15s, box-shadow .15s, background .15s;
}

.app-logo-layout-option__card--bottom {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
}

.app-logo-layout-option__card--hidden {
    justify-content: center;
}

.app-logo-layout-option__icon {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    background: color-mix(in srgb, var(--brand-accent) 75%, #000);
    flex-shrink: 0;
}

.app-logo-layout-option__lines {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    flex: 1;
}

.app-logo-layout-option__lines span {
    display: block;
    height: 3px;
    border-radius: 2px;
    background: var(--tblr-border-color);
}

.app-logo-layout-option__lines span:first-child {
    width: 72%;
    background: color-mix(in srgb, var(--tblr-body-color) 35%, transparent);
}

.app-logo-layout-option__lines span:last-child {
    width: 48%;
}

.app-logo-layout-option__label {
    font-size: 10.5px;
    line-height: 1.2;
    color: var(--tblr-secondary);
    text-align: center;
}

.app-logo-layout-option input:checked + .app-logo-layout-option__card {
    border-color: color-mix(in srgb, var(--brand-accent) 55%, transparent);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-accent) 14%, transparent);
    background: color-mix(in srgb, var(--brand-accent) 6%, #fff);
}

.app-logo-layout-option input:focus-visible + .app-logo-layout-option__card {
    outline: 2px solid var(--brand-accent);
    outline-offset: 2px;
}

@media (max-width: 991.98px) {
    .settings-brand {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .settings-brand__preview-col {
        position: static;
    }
}

.app-sidebar__nav {
    padding: 4px 0 10px;
}

.app-sidebar.navbar-expand-lg .navbar-collapse {
    display: flex !important;
    flex: 1 1 auto;
    flex-direction: column;
}

.app-sidebar.navbar-expand-lg .navbar-collapse .navbar-nav {
    flex-direction: column;
    flex-grow: 1;
}

.app-sidebar .nav-section-title {
    color: rgba(255, 255, 255, .32);
    padding: 10px 12px 4px;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: .06em;
    text-transform: uppercase;
    line-height: 1.2;
}

.app-sidebar-section {
    margin-top: 2px;
}

.app-sidebar-section__toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: calc(100% - 16px);
    margin: 1px 8px;
    padding: 7px 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    font-size: 13px;
    font-weight: 400;
    color: rgba(255, 255, 255, .72);
    line-height: 1.2;
    text-align: left;
    cursor: pointer;
}

.app-sidebar-section__toggle:hover,
.app-sidebar-section__toggle:focus-visible {
    color: #fff;
    background: rgba(255, 255, 255, .07);
    outline: none;
}

.app-sidebar-section__toggle[aria-expanded="true"] {
    color: #fff;
    background: rgba(255, 255, 255, .1);
}

.app-sidebar-section__toggle::after {
    display: none;
}

.app-sidebar-section__chevron {
    width: 13px;
    height: 13px;
    margin-left: auto;
    opacity: .5;
    flex-shrink: 0;
    transition: transform .15s ease;
}

.app-sidebar-section__toggle[aria-expanded="true"] .app-sidebar-section__chevron {
    transform: rotate(180deg);
}

.app-sidebar-section__list {
    padding: 0;
    margin: 0;
}

.app-sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 1px 8px;
    padding: 7px 10px;
    border-radius: 6px;
    color: rgba(255,255,255,.72);
    font-size: 13px;
    line-height: 1.2;
}

.app-sidebar .nav-link:hover { color: #fff; background: rgba(255,255,255,.07); text-decoration: none; }
.app-sidebar .nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, .12);
}

.app-sidebar .nav-link-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    min-width: 18px;
    color: inherit;
    opacity: .9;
}

.app-sidebar .nav-link-icon svg,
.app-sidebar .nav-link-icon .icon-svg,
.app-sidebar .nav-link-icon svg.feather {
    width: 16px;
    height: 16px;
}

.app-sidebar .nav-link-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-sidebar-group__toggle {
    width: calc(100% - 16px);
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.app-sidebar-group__toggle::after {
    display: none;
    margin-left: auto;
    opacity: .45;
}

.app-sidebar-group__toggle .app-sidebar-section__chevron {
    margin-left: auto;
}

.app-sidebar-group__toggle[aria-expanded="true"] .app-sidebar-section__chevron {
    transform: rotate(180deg);
}

.app-sidebar-group__panel .nav-link {
    margin-left: 8px;
    margin-right: 8px;
    padding-left: 10px !important;
    padding-right: 10px !important;
    font-size: 13px;
}

.app-sidebar-group__panel .nav {
    padding: 0;
    margin: 0;
}

/* свёрнутый сайдбар: подменю по наведению */
@media (hover: hover) {
    body.app-sidebar-collapsed .app-sidebar-group:hover > .app-sidebar-group__panel,
    body.app-sidebar-collapsed .app-sidebar-group.is-hover-open > .app-sidebar-group__panel,
    body.app-sidebar-collapsed .app-sidebar-group.is-flyout-open > .app-sidebar-group__panel {
        display: block !important;
        height: auto !important;
        visibility: visible !important;
    }
}

@media (min-width: 992px) {
    .navbar-expand-lg.navbar-vertical.app-sidebar {
        width: var(--app-sidebar-width) !important;
        transition: width .18s ease;
        overflow-x: visible;
        overflow-y: auto;
    }

    .navbar-expand-lg.navbar-vertical.app-sidebar ~ .navbar,
    .navbar-expand-lg.navbar-vertical.app-sidebar ~ .page-wrapper {
        margin-left: var(--app-sidebar-width) !important;
        width: calc(100% - var(--app-sidebar-width));
        max-width: calc(100% - var(--app-sidebar-width));
        transition: margin-left .18s ease, width .18s ease, max-width .18s ease;
    }

    .app-sidebar-collapsed {
        --app-sidebar-width: var(--app-sidebar-width-collapsed);
    }

    .app-sidebar-collapsed .nav-link-title,
    .app-sidebar-collapsed .nav-section-title,
    .app-sidebar-collapsed .app-sidebar-section__toggle,
    .app-sidebar-collapsed .app-sidebar-group__toggle::after {
        display: none !important;
    }

    .app-sidebar-collapsed .app-sidebar-section__panel.collapse {
        display: block !important;
        height: auto !important;
        visibility: visible;
    }

    .app-sidebar-collapsed .app-sidebar__head {
        justify-content: center;
        padding: 8px 6px;
    }

    .app-sidebar-collapsed .app-sidebar-brand,
    .app-sidebar-collapsed .navbar-brand {
        justify-content: center;
    }

    .app-sidebar-collapsed .app-sidebar__toggle {
        top: 4px;
        right: -12px;
        width: 24px;
        height: 24px;
        border-radius: 999px;
        background: #fff;
        color: var(--brand-accent);
        border-color: var(--app-table-border);
        box-shadow: 0 2px 8px rgba(15, 23, 42, .12);
    }

    .app-sidebar-collapsed .app-sidebar__toggle:hover {
        background: #fff;
        color: var(--brand-accent);
        border-color: var(--app-table-border);
    }

    .app-sidebar-collapsed .nav-link {
        justify-content: center;
        padding: 7px 6px;
        margin: 2px 5px;
    }

    .app-sidebar-collapsed .app-sidebar-group {
        position: relative;
    }

    .app-sidebar-collapsed .app-sidebar-group__panel {
        position: absolute;
        left: calc(100% + 6px);
        top: 0;
        z-index: 1050;
        display: none !important;
        min-width: 200px;
        padding: 6px;
        background: linear-gradient(200deg, var(--brand-accent) 0%, #094F7C 100%);
        border: 1px solid rgba(255, 255, 255, .12);
        border-radius: 8px;
        box-shadow: 8px 8px 24px rgba(6, 48, 73, .28);
    }

    .app-sidebar-collapsed .app-sidebar-group__panel.show,
    .app-sidebar-collapsed .app-sidebar-group.is-flyout-open .app-sidebar-group__panel {
        display: block !important;
        height: auto !important;
        visibility: visible !important;
    }

    .app-sidebar-collapsed .app-sidebar-group__panel .nav-link-title {
        display: inline !important;
    }

    .app-sidebar-collapsed .app-sidebar-group__panel .nav {
        gap: 2px;
    }
}

.app-topbar {
    position: relative;
    z-index: 1030;
    min-height: 52px;
    padding: 0;
    background: color-mix(in srgb, var(--tblr-bg-surface) 92%, transparent);
    border-bottom: 1px solid var(--tblr-border-color-translucent);
    backdrop-filter: blur(12px);
    overflow: visible;
}

.app-topbar__inner {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 52px;
    min-width: 0;
}

.app-topbar-menu {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    font-size: 13px;
}

.app-topbar-menu__list {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-wrap: nowrap;
    width: max-content;
    max-width: none;
    padding: 0;
}

.app-topbar-menu__link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 2px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    color: var(--tblr-secondary-color);
    text-decoration: none;
    white-space: nowrap;
    border: none;
    transition: background .15s ease, color .15s ease;
}

.app-topbar-menu__link-icon,
.app-topbar-menu__group-icon,
.app-topbar-menu__dropdown-icon,
.app-menu-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    min-width: 18px;
    opacity: .85;
    overflow: visible;
    line-height: 0;
}

.app-topbar-menu__link-icon .icon-value-svg,
.app-topbar-menu__group-icon .icon-value-svg,
.app-topbar-menu__dropdown-icon .icon-value-svg,
.app-menu-icon .icon-value-svg {
    width: 18px;
    height: 18px;
    font-size: 15px;
    vertical-align: 0;
}

.app-topbar-menu__link-icon svg,
.app-topbar-menu__group-icon svg,
.app-topbar-menu__dropdown-icon svg,
.app-menu-icon svg,
.app-menu-icon svg.feather,
.app-menu-icon .icon-svg,
.app-menu-icon .icon-value-svg svg,
.app-menu-icon .icon-svg-custom {
    width: 15px !important;
    height: 15px !important;
    max-width: 15px;
    max-height: 15px;
    overflow: visible;
}

.app-topbar-menu__group {
    flex-shrink: 0;
    position: relative;
}

.app-topbar-menu__group-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border: none;
    border-radius: 2px;
    background: transparent;
    color: var(--tblr-secondary-color);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    box-shadow: none;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.app-topbar-menu__dropdown {
    min-width: 220px;
    padding: 6px;
    border: 1px solid var(--tblr-border-color-translucent);
    border-radius: 4px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .12);
    background: #fff;
    z-index: 2000;
}

.app-topbar-menu .dropdown.show > .app-topbar-menu__dropdown,
.dropdown-menu.app-topbar-menu__dropdown.show {
    display: block !important;
}

/* запасной путь: hover/focus, если JS ещё не обновился */
@media (hover: hover) {
    .app-topbar-menu__group:hover > .app-topbar-menu__dropdown,
    .app-topbar-menu__group:focus-within > .app-topbar-menu__dropdown {
        display: block !important;
        position: absolute;
        top: calc(100% + 2px);
        left: 0;
        margin: 0;
    }
}

.app-topbar-menu__group-btn:hover,
.app-topbar-menu__group-btn:focus,
.app-topbar-menu__group-btn:focus-visible,
.app-topbar-menu__group-btn.show,
.dropdown.show > .app-topbar-menu__group-btn {
    background: var(--app-table-hover);
    color: var(--tblr-body-color);
    box-shadow: none;
    outline: none;
}

.app-topbar-menu__group-btn::after {
    margin-left: 2px;
    opacity: .45;
    vertical-align: middle;
}

.app-topbar-menu__dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 2px;
    padding: 8px 10px;
    font-size: 13px;
}

/* Единая колонка иконок: без двойного margin от .dropdown-item и без сдвига по типу иконки */
.app-topbar-menu__dropdown-item .app-topbar-menu__dropdown-icon,
.app-topbar-menu__dropdown-item > .app-menu-icon {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    min-width: 18px;
}

.app-topbar-menu__dropdown-item svg.feather,
.app-topbar-menu__dropdown-item .icon-svg,
.app-topbar-menu__dropdown-item .icon-value-svg,
.app-topbar-menu__dropdown-item .dropdown-item__icon {
    margin-right: 0 !important;
}

.app-topbar-menu__dropdown-icon .icon-value-svg {
    width: 18px;
    height: 18px;
    font-size: 15px;
    vertical-align: 0;
}

.app-topbar-menu__dropdown-icon > i,
.app-menu-icon > i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    margin: 0;
    font-size: 15px;
    line-height: 1;
}

.app-topbar-menu__dropdown-icon svg,
.app-topbar-menu__dropdown-icon .icon-value-svg svg {
    display: block;
    margin: 0 auto;
}

.app-topbar-menu-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border: 1px solid color-mix(in srgb, var(--brand-accent) 22%, transparent);
    border-radius: 2px;
    background: color-mix(in srgb, var(--brand-accent) 7%, #fff);
    color: var(--brand-accent);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    box-shadow: none;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.app-topbar-menu-btn:hover,
.app-topbar-menu-btn:focus,
.app-topbar-menu-btn:focus-visible {
    background: color-mix(in srgb, var(--brand-accent) 12%, #fff);
    border-color: color-mix(in srgb, var(--brand-accent) 32%, transparent);
    color: var(--brand-accent);
    box-shadow: none;
    outline: none;
}

.app-topbar-menu__link:hover {
    background: var(--app-table-hover);
    color: var(--tblr-body-color);
    text-decoration: none;
}

.app-topbar-menu__link.is-active {
    background: transparent;
    color: var(--brand-accent);
    box-shadow: inset 0 -1px 0 var(--brand-accent);
}

.app-topbar-menu__item--action {
    flex-shrink: 0;
}

.app-topbar-menu__item--action + .app-topbar-menu__item--action,
.app-topbar-menu__link + .app-topbar-menu__item--action {
    margin-left: 4px;
}

.app-menu-settings-table td,
.app-menu-settings-table th {
    vertical-align: middle;
}

.app-menu-icon-fields {
    display: flex;
    align-items: center;
    gap: 4px;
}

.app-menu-icon-fields__feather {
    min-width: 88px;
    max-width: 110px;
}

.app-menu-icon-fields__pick {
    width: 30px;
    min-width: 30px;
    height: 30px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.app-menu-icon-fields__preview {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    overflow: visible;
    line-height: 0;
}

.app-menu-icon-fields__preview .icon-value-svg,
.app-menu-icon-fields__preview svg {
    width: 15px !important;
    height: 15px !important;
}

.shared-menu-icon-picker-host > .d-flex {
    display: none !important;
}

.app-menu-group-card .form-check {
    margin-bottom: 0;
}

@media (max-width: 991.98px) {
    .app-topbar-menu {
        display: none;
    }
}

.app-topbar .container-fluid {
    overflow: visible;
}

.app-topbar > .container-fluid {
    padding-right: var(--tblr-page-padding, 1.25rem);
}

.app-topbar-actions .dropdown-menu {
    z-index: 1050;
    display: none;
    position: absolute;
    top: 100%;
    left: auto;
    right: 0;
    margin-top: 0.35rem;
    min-width: 12rem;
}

.app-topbar-actions .dropdown-menu.show {
    display: block;
}

.app-eyebrow { font-size: var(--app-font-size-sm, 12px); letter-spacing: .06em; }
.page-wrapper { background: var(--tblr-body-bg); }
.form-control, .form-select { transition: border-color .15s ease, box-shadow .15s ease; }
.form-control:focus, .form-select:focus { box-shadow: 0 0 0 3px rgba(var(--tblr-primary-rgb), .11); }

/* Dashboard */
.dashboard-hero {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 190px;
    padding: 2.1rem;
    overflow: hidden;
    border: 1px solid var(--tblr-border-color-translucent);
    border-radius: 12px;
    background: linear-gradient(120deg, var(--tblr-bg-surface) 0%, color-mix(in srgb, var(--tblr-primary) 7%, var(--tblr-bg-surface)) 100%);
}

.dashboard-hero-content { position: relative; z-index: 2; max-width: 650px; }
.dashboard-hero .display-6 { font-size: clamp(1.6rem, 3vw, 2.15rem); font-weight: 750; letter-spacing: -.04em; }
.dashboard-hero-art { position: absolute; right: 5%; width: 210px; height: 150px; opacity: .9; }
.dashboard-hero-art span { position: absolute; display: block; border-radius: 18px; transform: rotate(-8deg); }
.dashboard-hero-art span:nth-child(1) { inset: 22px 18px 20px 20px; background: rgba(var(--tblr-primary-rgb), .09); }
.dashboard-hero-art span:nth-child(2) { inset: 46px 44px 2px 0; background: rgba(var(--tblr-primary-rgb), .15); }
.dashboard-hero-art span:nth-child(3) { width: 54px; height: 54px; right: 0; top: 0; background: linear-gradient(135deg, var(--tblr-primary), #6d91f5); box-shadow: 0 16px 34px rgba(var(--tblr-primary-rgb), .25); }
.dashboard-shortcut { min-height: 100%; color: inherit; text-decoration: none !important; }
.dashboard-shortcut .avatar svg { width: 20px; height: 20px; }
.dashboard-shortcut .card-title { margin-bottom: .35rem; font-size: .95rem; }
.dashboard-shortcut p { font-size: .78rem; line-height: 1.5; }

/* Authentication */
.account-body {
    margin: 0;
    min-height: 100vh;
    background: #f4f7fa;
}

.account-page {
    min-height: 100vh;
}

.login-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
    min-height: 100vh;
}

.login-panel {
    position: relative;
    display: flex;
    min-height: 100vh;
}

.login-panel--brand {
    align-items: center;
    justify-content: center;
    padding: 48px;
    overflow: hidden;
    color: #fff;
    background: linear-gradient(200deg, var(--brand-accent) 0%, #094F7C 52%, #062C43 100%);
}

.login-panel__glow {
    position: absolute;
    inset: auto -18% -22% auto;
    width: 68%;
    height: 68%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(142, 197, 255, .28) 0%, transparent 68%);
    pointer-events: none;
    animation: login-glow 8s ease-in-out infinite alternate;
}

.login-panel__grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(circle at 35% 40%, #000 0%, transparent 72%);
    pointer-events: none;
    opacity: .7;
}

.login-panel__brand {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 28px;
    max-width: 420px;
    animation: login-rise .55s ease both;
}

.login-panel__titles {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.login-panel__title {
    font-size: clamp(2rem, 3.4vw, 2.75rem);
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -.03em;
    color: #fff;
}

.login-panel__subtitle {
    font-size: 1.05rem;
    font-weight: 400;
    line-height: 1.45;
    color: rgba(183, 201, 216, .95);
}

.login-panel--brand .auth-brand__logo,
.login-panel--brand .auth-brand__logo .icon-svg {
    color: #fff;
}

.login-panel--form {
    align-items: center;
    justify-content: center;
    padding: 40px 28px;
    background:
        radial-gradient(circle at 85% 12%, color-mix(in srgb, var(--brand-accent) 10%, transparent), transparent 34%),
        linear-gradient(180deg, #f7fafc 0%, #eef3f7 100%);
}

.login-form {
    width: 100%;
    max-width: 400px;
    animation: login-rise .55s ease .08s both;
}

.login-form__head {
    margin-bottom: 28px;
}

.login-form__logo-mobile {
    display: none;
    margin-bottom: 20px;
}

.login-form__title {
    margin: 0 0 8px;
    font-size: clamp(1.55rem, 2.4vw, 1.9rem);
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -.02em;
    color: #0f2a3d;
}

.login-form__subtitle {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: #6b7c8a;
}

.login-form__error {
    margin-bottom: 18px;
    padding: 12px 14px;
    border: 1px solid color-mix(in srgb, var(--tblr-danger) 28%, transparent);
    border-left: 3px solid var(--tblr-danger);
    border-radius: 4px;
    background: color-mix(in srgb, var(--tblr-danger) 7%, #fff);
    color: #8a1f2b;
    font-size: 13px;
}

.login-form__fields {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-field__label {
    display: block;
    margin-bottom: 7px;
    font-size: 13px;
    font-weight: 600;
    color: #243846;
}

.login-field__control {
    position: relative;
    display: flex;
    align-items: center;
}

.login-field__icon {
    position: absolute;
    left: 14px;
    display: inline-flex;
    color: #8aa0b0;
    pointer-events: none;
}

.login-field__icon svg {
    width: 17px;
    height: 17px;
}

.login-field__input {
    width: 100%;
    height: 48px;
    padding: 0 14px 0 42px;
    border: 1px solid #d5e0e8;
    border-radius: 4px;
    background: rgba(255, 255, 255, .92);
    color: #142833;
    font-size: 14px;
    line-height: 1.2;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.login-field__input::placeholder {
    color: #97a8b5;
}

.login-field__input:hover {
    border-color: #b8c9d5;
}

.login-field__input:focus {
    border-color: color-mix(in srgb, var(--brand-accent) 55%, #b8c9d5);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-accent) 14%, transparent);
    background: #fff;
}

.login-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 48px;
    margin-top: 6px;
    border: none;
    border-radius: 4px;
    background: linear-gradient(135deg, #1583C0, var(--brand-accent));
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: .01em;
    cursor: pointer;
    box-shadow: 0 10px 24px color-mix(in srgb, var(--brand-accent) 24%, transparent);
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}

.login-submit svg {
    width: 17px;
    height: 17px;
    transition: transform .15s ease;
}

.login-submit:hover {
    filter: brightness(1.04);
    box-shadow: 0 12px 28px color-mix(in srgb, var(--brand-accent) 30%, transparent);
}

.login-submit:hover svg {
    transform: translateX(2px);
}

.login-submit:active {
    transform: translateY(1px);
}

.login-form__footer {
    margin-top: 28px;
    font-size: 12px;
    color: #8aa0b0;
}

.login-form__info {
    margin-bottom: 18px;
    padding: 12px 14px;
    border: 1px solid color-mix(in srgb, var(--brand-accent) 28%, transparent);
    border-left: 3px solid var(--brand-accent);
    border-radius: 4px;
    background: color-mix(in srgb, var(--brand-accent) 8%, #fff);
    color: #0f3a52;
    font-size: 13px;
}

.login-form--otp {
    max-width: 440px;
}

.login-form__eyebrow {
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--brand-accent);
}

.login-stepbar {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
}

.login-stepbar__step {
    flex: 1;
    height: 3px;
    border-radius: 2px;
    background: #dce8ef;
}

.login-stepbar__step.is-done {
    background: linear-gradient(90deg, #7eb0cc, var(--brand-accent));
}

.login-stepbar__step.is-active {
    background: var(--brand-accent);
    box-shadow: 0 0 12px color-mix(in srgb, var(--brand-accent) 40%, transparent);
}

.login-otp {
    position: relative;
    margin: 8px 0 4px;
    padding: 28px 4px 0;
    --otp-filled: 0;
}

.login-otp__glow {
    position: absolute;
    inset: 0 -8% 24px;
    background: radial-gradient(
        ellipse 80% 70% at 50% 55%,
        color-mix(in srgb, var(--brand-accent) calc(6% + var(--otp-filled) * 5%), transparent),
        transparent 72%
    );
    pointer-events: none;
    transition: background .25s ease;
}

.login-otp__row {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.login-otp__row.is-shake {
    animation: login-otp-shake .42s ease;
}

.login-otp__cell {
    flex: 1 1 0;
    min-width: 0;
    max-width: 52px;
    height: 56px;
    padding: 0;
    border: 1.5px solid #d8e6ee;
    border-radius: 14px;
    background: rgba(255, 255, 255, .92);
    color: #0f2a3d;
    font-size: 1.65rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-align: center;
    outline: none;
    caret-color: var(--brand-accent);
    box-sizing: border-box;
    box-shadow: 0 1px 2px rgba(15, 42, 61, .04);
    transition:
        border-color .18s ease,
        box-shadow .18s ease,
        transform .18s ease,
        background .18s ease,
        color .18s ease;
    animation: login-otp-rise .5s cubic-bezier(.2, .8, .2, 1) both;
    animation-delay: calc(var(--otp-i, 0) * 45ms + 80ms);
}

.login-otp__cell:hover:not(:focus):not(:disabled) {
    border-color: #b5cedc;
    background: #fff;
}

.login-otp__cell:focus {
    border-color: var(--brand-accent);
    background: #fff;
    box-shadow:
        0 0 0 4px color-mix(in srgb, var(--brand-accent) 14%, transparent),
        0 10px 28px color-mix(in srgb, var(--brand-accent) 18%, transparent);
    transform: translateY(-2px) scale(1.03);
}

.login-otp__cell.is-filled {
    border-color: color-mix(in srgb, var(--brand-accent) 45%, #d8e6ee);
    background: #f6fbfe;
}

.login-otp__cell.is-success {
    border-color: #5cb894;
    background: linear-gradient(180deg, #edf9f3 0%, #e2f5ec 100%);
    color: #176b4c;
    box-shadow: 0 6px 20px rgba(47, 158, 116, .16);
    animation: login-otp-cell-flash .55s cubic-bezier(.2, .85, .25, 1.2) both;
    animation-delay: calc(var(--otp-i, 0) * 65ms);
}

.login-otp__track {
    position: relative;
    z-index: 1;
    height: 2px;
    margin: 18px 0 0;
    border-radius: 1px;
    background: #e4edf3;
    overflow: hidden;
}

.login-otp__track-fill {
    display: block;
    height: 100%;
    width: calc(var(--otp-filled, 0) / 6 * 100%);
    border-radius: inherit;
    background: linear-gradient(90deg, #5a9fc4, var(--brand-accent));
    transition: width .22s cubic-bezier(.4, 0, .2, 1);
}

.login-otp__hint {
    position: relative;
    z-index: 1;
    margin: 12px 0 0;
    font-size: 12.5px;
    color: #8aa0b0;
    text-align: center;
    line-height: 1.4;
}

.login-otp.is-success .login-otp__glow {
    background: radial-gradient(
        ellipse 80% 70% at 50% 55%,
        color-mix(in srgb, #2f9e74 22%, transparent),
        transparent 72%
    );
}

.login-otp.is-success .login-otp__track-fill {
    width: 100%;
    background: linear-gradient(90deg, #5cb894, #2f9e74);
}

.login-form--otp.is-otp-success .login-form__title {
    color: #176b4c;
}

.login-form--otp.is-otp-success .login-form__eyebrow {
    color: #2f9e74;
}

@keyframes login-otp-rise {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes login-otp-cell-flash {
    0% {
        transform: scale(.92);
        filter: brightness(1);
    }
    45% {
        transform: scale(1.06);
        filter: brightness(1.08);
    }
    100% {
        transform: scale(1);
        filter: brightness(1);
    }
}

@keyframes login-otp-badge-pop {
    0% { transform: scale(.85); }
    55% { transform: scale(1.12); }
    100% { transform: scale(1); }
}

@keyframes login-otp-ring {
    0% {
        opacity: .9;
        transform: scale(.7);
    }
    100% {
        opacity: 0;
        transform: scale(1.35);
    }
}

@keyframes login-otp-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

.login-otp-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 18px;
}

.login-link-btn {
    border: 0;
    background: transparent;
    color: var(--brand-accent);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 6px;
    transition: opacity .15s ease, color .15s ease;
}

.login-link-btn:hover:not(:disabled) {
    opacity: .85;
    text-decoration: underline;
}

.login-link-btn:disabled {
    color: #8aa0b0;
    cursor: default;
    opacity: 1;
}

.login-link-btn--muted {
    color: #6b7c8a;
    font-weight: 500;
}

@keyframes login-rise {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes login-glow {
    from { transform: translate(0, 0) scale(1); opacity: .85; }
    to { transform: translate(-6%, -4%) scale(1.08); opacity: 1; }
}

@media (max-width: 991.98px) {
    .login-shell {
        grid-template-columns: 1fr;
    }

    .login-panel--brand {
        display: none;
    }

    .login-panel--form {
        min-height: 100vh;
        padding: 32px 20px;
        background:
            radial-gradient(circle at 50% -10%, color-mix(in srgb, var(--brand-accent) 14%, transparent), transparent 42%),
            linear-gradient(180deg, #f8fbfd 0%, #eef3f7 100%);
    }

    .login-form__logo-mobile {
        display: block;
    }

    .login-form__logo-mobile .auth-brand__logo,
    .login-form__logo-mobile .auth-brand__logo .icon-svg {
        color: var(--brand-accent);
    }

    .login-otp {
        padding-top: 20px;
    }

    .login-otp__row {
        gap: 5px;
    }

    .login-otp__cell {
        max-width: 44px;
        height: 50px;
        font-size: 1.4rem;
        border-radius: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .login-panel__brand,
    .login-form,
    .login-panel__glow,
    .login-otp,
    .login-otp__cell,
    .login-otp__row.is-shake,
    .login-submit,
    .login-submit svg {
        animation: none !important;
        transition: none !important;
    }
}

.login-card { width: 100%; max-width: 440px; margin: auto; border-radius: 16px; }
.login-card .form-label { font-weight: 600; }
.login-card .input-icon-addon svg { width: 18px; height: 18px; }
.login-card .btn svg { width: 18px; margin-left: .4rem; }

@media (max-width: 991.98px) {
    .app-sidebar .navbar-brand { min-height: 48px; }
    .dashboard-hero { padding: 1.5rem; min-height: 165px; }
    .dashboard-hero-art { opacity: .35; right: -60px; }
}

/* --- всплывающие уведомления об успехе/ошибке действия (flash_set()):
   компактная плашка в правом верхнем углу вместо во всю ширину страницы,
   сама исчезает через пару секунд --- */
.app-toast-stack {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1040;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    max-width: 360px;
}

.app-toast {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: .65rem .8rem;
    background: var(--tblr-bg-surface);
    border: 1px solid var(--tblr-border-color);
    border-left: 3px solid var(--tblr-secondary);
    border-radius: var(--tblr-border-radius);
    box-shadow: var(--tblr-shadow-lg, 0 8px 24px rgba(0, 0, 0, .1));
    font-size: var(--app-font-size);
    color: var(--tblr-body-color);
    opacity: 0;
    transform: translateX(12px);
    transition: opacity .2s ease, transform .2s ease;
}

.app-toast.show { opacity: 1; transform: translateX(0); }
.app-toast.hide { opacity: 0; transform: translateX(12px); }

.app-toast svg.feather { width: 16px; height: 16px; flex: 0 0 auto; }
.app-toast-text { flex: 1; }

.app-toast-close {
    border: none;
    background: none;
    padding: 0 0 0 6px;
    font-size: 16px;
    line-height: 1;
    color: var(--tblr-secondary-color);
    cursor: pointer;
}

.app-toast-success { border-left-color: var(--tblr-success); }
.app-toast-success svg.feather { color: var(--tblr-success); }
.app-toast-danger { border-left-color: var(--tblr-danger); }
.app-toast-danger svg.feather { color: var(--tblr-danger); }
.app-toast-warning { border-left-color: var(--tblr-warning); }
.app-toast-warning svg.feather { color: var(--tblr-warning); }
.app-toast-info { border-left-color: var(--tblr-info); }
.app-toast-info svg.feather { color: var(--tblr-info); }

/* --- Единая система размеров интерфейса ------------------------------------
   Один базовый кегль, одна высота интерактивных элементов и компактный
   вертикальный ритм. Эти правила намеренно находятся последними: они сводят
   Tabler, DataTables и старые Bootstrap-классы к одной визуальной системе. */
:root {
    --brand-accent: #0B679E;
    --tblr-primary: var(--brand-accent);
    --tblr-primary-rgb: 11, 103, 158;
    --tblr-link-color: var(--brand-accent);

    --app-font-size: 14px;
    --app-font-size-sm: 12px;
    --app-control-height: 30px;
    --app-control-radius: 6px;
    --app-control-padding-x: 12px;
    --app-card-padding: 12px;
    --app-section-gap: 12px;
    --app-shadow-sm: 0 1px 3px rgba(15, 23, 42, .035);

    --app-table-padding-y: 6px;
    --app-table-padding-x: 10px;
    --app-table-header-size: 13px;
    --app-table-action-size: 26px;
    --app-table-border: #e8ecf1;
    --app-table-header-bg: #f8fafc;
    --app-table-hover: rgba(11, 103, 158, 0.04);
    --app-table-zebra: #fafbfc;

    /* DataTables 3 — мягкая зебра/hover в тон интерфейса */
    --dt_background-selected: 11, 103, 158;
    --dt-row_background-stripe: 250, 251, 252;
    --dt-row_background-hover: 11, 103, 158;
    --dt-column-ordering_background: 11, 103, 158;

    --tblr-body-font-size: var(--app-font-size);
    --tblr-border-radius: var(--app-control-radius);
}

html { font-size: 14px; }

body {
    font-size: var(--app-font-size);
    line-height: 1.4;
}

/* Кнопки: варианты sm/lg меняют только смысл в разметке, но не геометрию. */
.btn,
.btn.btn-sm,
.btn.btn-lg {
    min-height: var(--app-control-height);
    padding: 0 var(--app-control-padding-x);
    border-radius: var(--app-control-radius);
    font-size: var(--app-font-size);
    line-height: 1.2;
    gap: 6px;
    align-items: center;
    justify-content: center;
    box-shadow: none;
}

.btn:not(.btn-link) { display: inline-flex; }

.btn-icon,
.btn.btn-sm.btn-icon,
.btn.btn-lg.btn-icon {
    width: var(--app-control-height);
    min-width: var(--app-control-height);
    height: var(--app-control-height);
    min-height: var(--app-control-height);
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    flex: 0 0 auto;
}

.btn:not(.btn-icon) svg.feather,
.btn:not(.btn-icon) .icon-svg,
.btn i.fa,
.btn i.fas,
.btn i.far,
.btn i.fal,
.btn i.fab {
    margin-right: 0;
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
}

.btn i.fa,
.btn i.fas,
.btn i.far,
.btn i.fal,
.btn i.fab,
.btn i.fa-sm {
    font-size: var(--app-font-size) !important;
}

.btn svg.feather { flex: 0 0 auto; }

.btn-icon svg.feather,
.btn-icon .icon-svg { width: 14px; height: 14px; }

.btn-accent-split { height: var(--app-control-height); }

/* Поля, списки и дополнения к ним совпадают с кнопками по высоте и радиусу. */
.form-control,
.form-control-sm,
.form-control-lg,
.form-select,
.form-select-sm,
.form-select-lg,
.input-group-text {
    min-height: var(--app-control-height);
    padding-top: 6px;
    padding-bottom: 6px;
    border-radius: var(--app-control-radius);
    font-size: var(--app-font-size);
    line-height: 1.2;
}

.form-control,
.form-control-sm,
.form-control-lg { padding-left: 10px; padding-right: 10px; }

.form-select,
.form-select-sm,
.form-select-lg { padding-left: 10px; }

textarea.form-control { min-height: 82px; line-height: 1.4; }
.form-control-color { width: var(--app-control-height); padding: 4px; }
.form-label { margin-bottom: 5px; font-size: var(--app-font-size); }
.form-text { margin-top: 4px; font-size: 12px; line-height: 1.35; }

.field-unique-wrap {
    position: relative;
}
.field-unique-wrap .form-control {
    padding-right: 2.35rem;
}
.field-unique-badge {
    position: absolute;
    top: calc(var(--app-control-height, 36px) / 2);
    right: 10px;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 2;
    line-height: 0;
}
.field-unique-badge__icon {
    width: 16px;
    height: 16px;
    display: block;
}
.field-unique-badge__icon.is-ok {
    color: var(--tblr-success, #2fb344);
}
.field-unique-badge__icon.is-err {
    color: var(--tblr-danger, #d63939);
}
.field-unique-input--ok {
    border-color: color-mix(in srgb, var(--tblr-success, #2fb344) 55%, var(--tblr-border-color, #dce1e7)) !important;
}
.field-unique-input--err {
    border-color: color-mix(in srgb, var(--tblr-danger, #d63939) 65%, var(--tblr-border-color, #dce1e7)) !important;
}
.field-unique-input--ok:focus,
.field-unique-input--err:focus {
    box-shadow: none;
}

/* Карточки и заголовки используют тот же спокойный компактный ритм. */
.card {
    border-color: var(--tblr-border-color-translucent);
    border-radius: 8px;
    box-shadow: var(--app-shadow-sm);
}

/* Контент страниц — без отдельной «коробки», встроен в фон */
.page-body .card:not(.stat-card):not(.stat-card--custom):not(.login-card):not(.keep-card) {
    border: none;
    box-shadow: none;
    background: transparent;
    border-radius: 0;
}

.page-body .card:not(.stat-card):not(.stat-card--custom):not(.login-card):not(.keep-card) > .card-body {
    padding: 0;
}

.page-body .card:not(.stat-card):not(.stat-card--custom):not(.login-card):not(.keep-card) > .card-header,
.page-body .card:not(.stat-card):not(.stat-card--custom):not(.login-card):not(.keep-card) > .card-footer {
    padding-left: 0;
    padding-right: 0;
    background: transparent;
    border: none;
}

.item-page .keep-card {
    background: var(--tblr-bg-surface, #fff);
    border: 1px solid var(--tblr-border-color-translucent, rgba(98, 105, 118, .16));
    border-radius: 8px;
    box-shadow: none;
}

.item-page .item-page-copy-wrap {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
}

.item-page .item-page-copy-wrap__text {
    min-width: 0;
}

.item-page .item-page-copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    color: #64748b;
    box-shadow: none;
    cursor: pointer;
    transition: color .12s ease;
}

.item-page .item-page-copy-btn:hover,
.item-page .item-page-copy-btn:focus-visible {
    background: transparent;
    border: none;
    color: var(--brand-accent);
    outline: none;
    box-shadow: none;
}

.item-page .item-page-copy-btn:active {
    background: transparent;
}

.item-page .item-page-copy-btn svg.feather {
    width: 14px;
    height: 14px;
}

.item-page .related-entity-info-btns {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.item-page .related-entity-info-btn {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-page .related-entity-info-links .related-entity-info-link + .related-entity-info-link::before {
    content: ', ';
    color: var(--bs-body-color);
    text-decoration: none;
}

.app-listing .related-entity-listing-link + .related-entity-listing-link::before {
    content: ', ';
    color: inherit;
    text-decoration: none;
}

.item-page .accordion-button {
    font-size: var(--app-font-size);
    font-weight: 400;
}

/* Блоки раскладки страницы записи */
.info-layout-collapsible {
    font-size: 13px;
    margin: 0 0 8px;
    color: #2c3e50;
    line-height: 1.25;
    border: 1px solid #eaeef2;
    border-radius: 8px;
    background: transparent;
    overflow: hidden;
}
.info-layout-collapsible__head {
    width: 100%;
    padding: 10px 14px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    text-align: left;
}
.info-layout-collapsible__head:hover { background: #e8f4fd; }
.info-layout-collapsible__head--compact {
    padding: 8px 12px;
    border-top: 1px solid #eaeef2;
}
.info-layout-collapsible__head--field {
    width: 100%;
    padding: 8px 12px;
    min-height: 0;
    background: transparent;
    border: none;
    border-bottom: 1px solid #eaeef2;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    text-align: left;
}
.info-layout-collapsible__head--field:hover { background: #e8f4fd; }
.info-layout-collapsible__head--field .info-field-inner {
    border: none !important;
    padding: 0 !important;
    background: transparent !important;
    width: 100%;
    min-height: 0 !important;
    display: block !important;
}
.info-layout-collapsible__head--field .info-field-label {
    margin-bottom: 0 !important;
}
.info-layout-collapsible__head--field .info-field-value {
    line-height: 1.3;
}
.info-layout-collapsible__field {
    flex: 1 1 auto;
    min-width: 0;
}
.info-layout-collapsible__chev {
    width: 14px;
    height: 14px;
    opacity: .6;
    flex-shrink: 0;
    transition: transform .15s ease;
}
.info-layout-collapsible__head[aria-expanded="false"] .info-layout-collapsible__chev {
    transform: rotate(-90deg);
}
.info-layout-collapsible__pinned {
    padding: 0;
}
.info-layout-collapsible__title { display: block; font-size: 16px; font-weight: 500; color: #2c3e50; }
.info-layout-collapsible__title--muted { font-size: 13px; font-weight: 500; color: #6c7a89; }
.info-layout-collapsible__sub { display: block; font-size: 12px; color: #7f8c8d; margin-top: 4px; }
.info-layout-collapsible__phone {
    color: #2c3e50;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}
.info-layout-collapsible__phone:hover { color: #3498db; }
.info-layout-collapsible__body {
    padding: 20px;
    border-top: 1px solid #eaeef2;
    background: #fff;
}
.info-layout-row--inline {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}
.info-layout-section {
    margin: 0;
}
.form-layout-section,
.form-layout-row,
.form-layout-collapsible {
    margin: 0;
}
.form-layout-section[style],
.form-layout-row[style],
.form-layout-collapsible[style] {
    margin-bottom: .25rem;
}
.info-layout-section .row > [class*="col-"],
.info-layout-root > [class*="col-"] {
    min-width: 0;
}
.info-layout-root > .info-layout-block-wrap {
    padding-top: 0;
    padding-bottom: 0;
}
.info-layout-break {
    flex: 0 0 100%;
    width: 100%;
    height: 0;
    margin: 0 0 calc(var(--bs-gutter-y, .5rem) * -1) 0 !important;
    padding: 0 !important;
    overflow: hidden;
    border: 0;
}
.item-page .info-layout-root.row,
.item-page .info-layout-section .row,
.item-page .info-layout-row .row,
.item-page .info-layout-collapsible__body .row,
.item-page .info-layout-collapsible__pinned .row,
.item-page .row.g-1 {
    --bs-gutter-y: .25rem;
    --bs-gutter-x: .5rem;
    align-items: flex-start;
}
.item-page .info-layout-root > .info-layout-block-wrap {
    padding-top: 0;
    padding-bottom: 0;
    margin-bottom: 0;
}
.item-page .info-field-cell {
    line-height: 1.25;
}
.item-page .info-field-inner {
    padding: 0;
    font-size: 13px;
}
.item-page .info-field-inner[style*="padding"] {
    padding: .3rem .5rem !important;
}
.item-page .info-field-cell .info-field-label {
    font-size: inherit;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
    margin-bottom: 2px;
    line-height: 1.3;
}
.item-page .info-field-cell .info-field-value {
    font-size: inherit;
    line-height: 1.3;
}
.item-page .info-field-cell > .info-field-inner > div:last-child,
.item-page .info-field-cell .info-field-value {
    margin: 0;
}
.item-page .info-layout-spacer {
    padding: 0;
    margin: 0;
    border: 0;
    min-height: 0;
    height: auto;
    align-self: flex-start;
}
.item-page .info-layout-spacer + .info-field-cell {
    align-self: flex-start;
}
.item-page .row.g-1 > [class*="col-grid-"] > .info-field-inner,
.item-page .info-layout-section .row > [class*="col-grid-"] > .info-field-inner {
    flex: 0 1 auto;
}
.info-layout-inline-field__label {
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
    color: #95a5a6;
    display: block;
    margin-bottom: 2px;
}
.info-layout-inline-field__value { font-size: 13px; color: #2c3e50; }

.info-layout-collapsible__body .info-layout-section:first-child,
.info-layout-collapsible__body .info-layout-row:first-child { margin-top: 0; }

.card-body { padding: var(--app-card-padding); }

.card-header,
.card-header.py-3,
.card-header.bg-white {
    min-height: 36px;
    padding: 7px var(--app-card-padding) !important;
    background: var(--tblr-bg-surface);
    border-bottom: 1px solid var(--tblr-border-color-translucent);
}

.card-footer {
    padding: 7px var(--app-card-padding);
    background: var(--tblr-bg-surface);
    border-top: 1px solid var(--tblr-border-color-translucent);
}

.card-title { font-size: var(--app-font-size); font-weight: 400; margin-bottom: 0; }

.app-topbar-page-title {
    font-size: var(--app-font-size);
    font-weight: 400;
    color: var(--tblr-body-color);
}

.page-body { padding-top: 8px; padding-bottom: 24px; }

.page-body h1,
.page-body h2,
.page-body h3,
.page-body h4,
.page-body h5,
.page-body h6,
.page-body .fw-semibold,
.page-body .fw-bold,
.page-body .fw-medium {
    font-weight: 400 !important;
}

.app-sidebar .nav-link,
.app-sidebar .nav-link.active {
    font-weight: 400;
}

.page-header {
    margin-top: 0 !important;
    margin-bottom: var(--app-section-gap) !important;
}

.page-header--compact {
    margin-bottom: 8px !important;
}

.page-header--crumb-only {
    margin-bottom: 10px !important;
}

.page-header--crumb-only .breadcrumb {
    margin-bottom: 0;
}

.page-header__meta {
    font-size: var(--app-font-size-sm);
    font-weight: 400;
    color: var(--tblr-secondary-color);
}

.page-header__meta::before {
    content: '·';
    margin: 0 5px;
    color: var(--tblr-secondary-color);
    opacity: 0.55;
}

.page-header--compact .page-title {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0;
}

.page-header--compact .page-title + .text-secondary {
    margin-top: 0;
}

.page-header.mb-3 { margin-bottom: var(--app-section-gap) !important; }

.page-header .row { row-gap: 8px; }

.page-header-actions {
    margin-top: 8px;
}

.page-header-actions--left .table-actions {
    justify-content: flex-start;
}

.page-header-actions-right {
    align-self: flex-start;
    padding-top: 22px;
}

/* Вкладки разделов сущности */
.related-entity-cfg {
    padding: 12px 14px;
    border: 1px solid rgba(15, 45, 66, .1);
    border-radius: 8px;
    background: rgba(11, 103, 158, .03);
}

.related-entity-mappings {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.related-entity-mapping-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr) 36px;
    gap: 8px;
    align-items: center;
}

.related-entity-mapping-row__arrow {
    text-align: center;
    color: #7a93a6;
    font-weight: 600;
}

.related-entity-filters {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.related-display-fields {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.related-display-fields__row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 36px;
    gap: 8px;
    align-items: center;
}

.related-entity-filter-row {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(110px, 0.7fr) minmax(130px, 0.8fr) minmax(0, 1fr) 36px;
    gap: 8px;
    align-items: start;
}

.related-entity-filter-row__value {
    min-width: 0;
}

.related-entity-filter-picker .users-picker {
    width: 100%;
}

.related-entity-filter-picker .users-picker__control {
    min-height: var(--app-control-height, 30px);
}

.related-entity-picker {
    position: relative;
}

.related-multi-picker {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.related-multi-picker__row {
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.related-multi-picker__control {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}

.related-multi-picker__control--chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-height: var(--app-control-height, 30px);
    padding: 5px 8px;
    border: 1px solid var(--tblr-border-color, rgba(15, 45, 66, .14));
    border-radius: var(--app-control-radius, 6px);
    background: #fff;
}

.related-multi-picker__control--chips:focus-within {
    border-color: rgba(11, 103, 158, .45);
    box-shadow: 0 0 0 3px rgba(11, 103, 158, .12);
}

.related-multi-picker__chips {
    display: contents;
}

.related-multi-picker__chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: min(100%, 28rem);
    padding: 4px 8px 4px 10px;
    border-radius: 5px;
    border: 1px solid rgba(15, 45, 66, .16);
    background: #fff;
    color: #16324a;
    font-size: 14px;
    line-height: 1.35;
}

.related-multi-picker__chip-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #16324a;
}

.related-multi-picker__chip-remove {
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: #64748b;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.related-multi-picker__chip-remove:hover {
    color: #0f172a;
}

.related-multi-picker__control--chips .related-multi-picker__search {
    flex: 1 1 140px;
    min-width: 120px;
    border: 0;
    padding: 4px 4px;
    box-shadow: none;
    outline: none;
    background: transparent;
    height: auto;
    min-height: 22px;
}

.related-multi-picker__search {
    padding-right: 2rem;
}

.related-multi-picker__option.is-selected {
    color: #8aa0b0;
    cursor: default;
}

.related-multi-picker__clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: #8aa0b0;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

.related-multi-picker__clear:hover {
    color: #334155;
}

.related-multi-picker__suggest {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    z-index: 30;
    max-height: 240px;
    overflow: auto;
    border: 1px solid #d5e0e8;
    border-radius: var(--tblr-border-radius, .375rem);
    background: #fff;
    box-shadow: 0 10px 28px rgba(15, 42, 61, .12);
}

.related-multi-picker__suggest--portal {
    position: fixed;
    right: auto;
    z-index: 2060;
}

.related-multi-picker__suggest[hidden] {
    display: none !important;
}

.related-multi-picker__option {
    display: block;
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    padding: 8px 12px;
    cursor: pointer;
    color: #142833;
}

.related-multi-picker__option:hover,
.related-multi-picker__option:focus {
    background: rgba(11, 103, 158, 0.08);
}

.related-multi-picker__empty {
    padding: 10px 12px;
    color: #8aa0b0;
    font-size: 13px;
}

.related-entity-picker__row {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.numeric-quick {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex-wrap: nowrap;
}

.numeric-quick__input {
    position: relative;
    flex: 0 0 auto;
    flex-shrink: 0;
    width: var(--numeric-quick-input-width, 5.5rem);
    min-width: 3rem;
    max-width: 100%;
}

.numeric-quick__input.is-resizing {
    user-select: none;
}

.numeric-quick__input .form-control {
    width: 100%;
    min-width: 0;
}

.numeric-quick__resize {
    display: none;
    position: absolute;
    top: 0;
    right: -5px;
    bottom: 0;
    width: 10px;
    cursor: ew-resize;
    z-index: 3;
    touch-action: none;
}

.numeric-quick__resize::after {
    content: '';
    position: absolute;
    top: 22%;
    bottom: 22%;
    right: 3px;
    width: 2px;
    border-radius: 1px;
    background: color-mix(in srgb, var(--tblr-border-color, #d8dee6) 90%, #64748b);
    opacity: 0;
    transition: opacity .15s ease, background .15s ease;
}

.numeric-quick__input:hover .numeric-quick__resize::after,
.numeric-quick__input.is-resizing .numeric-quick__resize::after {
    opacity: 1;
}

.numeric-quick__options {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    flex: 0 0 auto;
    width: fit-content;
    max-width: 100%;
    min-width: 0;
    padding: 3px;
    border-radius: var(--app-control-radius, 6px);
    background: color-mix(in srgb, var(--tblr-border-color, #d8dee6) 28%, #fff);
    box-shadow: inset 0 1px 2px rgba(15, 45, 66, .06);
}

.numeric-quick__btn {
    appearance: none;
    margin: 0;
    padding: 4px 11px;
    min-height: calc(var(--app-control-height, 30px) - 6px);
    border: 0;
    border-radius: calc(var(--app-control-radius, 6px) - 2px);
    background: transparent;
    color: var(--tblr-secondary-color, #64748b);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}

.numeric-quick__btn:hover:not(.is-active) {
    color: var(--tblr-body-color, #334155);
    background: color-mix(in srgb, #fff 55%, transparent);
}

.numeric-quick__btn.is-active {
    background: #fff;
    color: var(--tblr-body-color, #1e293b);
    font-weight: 500;
    box-shadow:
        0 1px 2px rgba(15, 45, 66, .08),
        0 3px 10px rgba(15, 45, 66, .14);
}

.numeric-quick__btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-accent, #0b679e) 30%, transparent);
}

.numeric-quick__btn.is-active:focus-visible {
    box-shadow:
        0 1px 2px rgba(15, 45, 66, .08),
        0 3px 10px rgba(15, 45, 66, .14),
        0 0 0 2px color-mix(in srgb, var(--brand-accent, #0b679e) 30%, transparent);
}

.field-input-copy {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.field-input-copy__control {
    flex: 1 1 auto;
    min-width: 0;
}

.field-input-copy__btn {
    flex: 0 0 auto;
    align-self: stretch;
    width: var(--app-control-height);
    min-width: var(--app-control-height);
    height: auto;
    min-height: var(--app-control-height);
    padding: 0;
    border: 1px solid transparent;
    background: transparent;
    color: #64748b;
    box-shadow: none;
    border-radius: var(--tblr-border-radius, 0.375rem);
}

.field-input-copy__btn:hover,
.field-input-copy__btn:focus {
    background: rgba(11, 103, 158, 0.06);
    border-color: transparent;
    color: var(--brand-accent, #0b679e);
}

.field-input-copy__btn.is-copied {
    color: #1f7a58;
    background: color-mix(in srgb, #2f9e74 12%, transparent);
}

.field-input-copy__btn svg,
.field-input-copy__svg {
    width: 16px;
    height: 16px;
    display: inline-flex;
}

.field-input-copy__svg svg {
    width: 16px;
    height: 16px;
}

.related-entity-picker__row .related-entity-picker__control {
    flex: 1 1 auto;
    min-width: 0;
}

.related-entity-picker__create {
    flex: 0 0 auto;
    align-self: stretch;
    width: var(--app-control-height);
    min-width: var(--app-control-height);
    height: auto;
    min-height: var(--app-control-height);
    padding: 0;
    border: 1px solid transparent;
    background: transparent;
    color: #64748b;
    box-shadow: none;
    border-radius: var(--tblr-border-radius, 0.375rem);
}

.related-entity-picker__create:hover,
.related-entity-picker__create:focus {
    background: rgba(11, 103, 158, 0.06);
    border-color: transparent;
    color: #475569;
    box-shadow: none;
}

.related-entity-picker__create:focus-visible {
    outline: 2px solid rgba(11, 103, 158, 0.28);
    outline-offset: 1px;
}

.related-entity-picker__create svg {
    display: block;
    width: 15px;
    height: 15px;
}

.auto-number-field__control {
    display: flex;
    align-items: stretch;
    gap: 0;
    max-width: 420px;
}

.auto-number-field__prefix,
.auto-number-field__sep {
    display: inline-flex;
    align-items: center;
    padding: 0 0.7rem;
    background: var(--tblr-bg-surface-secondary, #f1f5f9);
    border: 1px solid var(--tblr-border-color, rgba(15, 45, 66, .14));
    color: #475569;
    font-size: 13px;
    white-space: nowrap;
}

.auto-number-field__prefix {
    border-radius: var(--app-control-radius, 0.375rem) 0 0 var(--app-control-radius, 0.375rem);
    border-right: 0;
    min-width: 3.5rem;
    justify-content: center;
    font-weight: 600;
}

.auto-number-field__sep {
    border-left: 0;
    border-right: 0;
    padding: 0 0.35rem;
    color: #94a3b8;
}

.auto-number-field__number {
    border-radius: 0 var(--app-control-radius, 0.375rem) var(--app-control-radius, 0.375rem) 0;
    max-width: 140px;
}

.auto-number-field__hint {
    margin-top: 0.35rem;
}

.auto-number-field.is-unique-err .auto-number-field__prefix,
.auto-number-field.is-unique-err .auto-number-field__sep,
.auto-number-field.is-unique-err .auto-number-field__number {
    border-color: var(--tblr-danger, #d63939);
    color: var(--tblr-danger, #d63939);
}

.auto-number-field.is-unique-ok .auto-number-field__prefix,
.auto-number-field.is-unique-ok .auto-number-field__sep,
.auto-number-field.is-unique-ok .auto-number-field__number {
    border-color: var(--tblr-success, #2fb344);
}

.related-entity-picker__control {
    position: relative;
}

.related-entity-picker__control--chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-height: var(--app-control-height, 30px);
    padding: 5px 8px;
    border: 1px solid var(--tblr-border-color, rgba(15, 45, 66, .14));
    border-radius: var(--app-control-radius, 6px);
    background: #fff;
}

.related-entity-picker__control--chips:focus-within {
    border-color: rgba(11, 103, 158, .45);
    box-shadow: 0 0 0 3px rgba(11, 103, 158, .12);
}

.related-entity-picker__chips {
    display: contents;
}

.related-entity-picker__chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: min(100%, 28rem);
    padding: 4px 8px 4px 10px;
    border-radius: 5px;
    border: 1px solid rgba(15, 45, 66, .16);
    background: #fff;
    color: #16324a;
    font-size: 14px;
    line-height: 1.35;
}

.related-entity-picker__chip-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #16324a;
}

.related-entity-picker__chip-remove {
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: #64748b;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.related-entity-picker__chip-remove:hover {
    color: #0f172a;
}

.related-entity-picker__control--chips .related-entity-picker__search {
    flex: 1 1 140px;
    min-width: 120px;
    border: 0;
    padding: 4px 4px;
    box-shadow: none;
    outline: none;
    background: transparent;
    height: auto;
    min-height: 26px;
    font-size: 14px;
    line-height: 1.35;
}

.related-entity-picker__clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: #7a93a6;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    z-index: 2;
}

.related-entity-picker__search {
    padding-right: 2rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.related-entity-picker__control--chips .related-entity-picker__search {
    padding-right: 4px;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
}

.related-entity-picker__suggest,
.related-entity-picker__suggest--portal {
    z-index: 2060;
    max-height: 240px;
    overflow: auto;
    background: #fff;
    border: 1px solid rgba(15, 45, 66, .14);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(15, 45, 66, .12);
}

.related-entity-picker__suggest:not(.related-entity-picker__suggest--portal) {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 2px);
}

.related-entity-picker__suggest--portal {
    position: fixed;
}

.related-entity-picker__suggest[hidden] {
    display: none !important;
}

.related-entity-picker__option {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    padding: 9px 12px;
    font-size: 14px;
    color: #16324a;
    cursor: pointer;
}

.related-entity-picker__option:hover,
.related-entity-picker__option:focus,
.related-entity-picker__option.is-active {
    background: rgba(11, 103, 158, .08);
    outline: none;
}

.related-entity-picker__option.is-selected,
.related-entity-picker__option:disabled {
    opacity: .55;
    cursor: default;
}

.related-entity-picker__empty {
    padding: 10px 12px;
    font-size: 13px;
    color: #7a93a6;
}

@media (max-width: 700px) {
    .related-entity-mapping-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .related-entity-mapping-row__arrow {
        display: none;
    }

    .related-entity-filter-row {
        grid-template-columns: 1fr;
    }
}


.entity-admin-nav {
    position: relative;
    z-index: 30;
    margin: 0 0 1.1rem;
}

.entity-admin-nav__scroll {
    display: flex;
    align-items: stretch;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(15, 45, 66, .12);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.entity-admin-nav__tab,
.entity-admin-nav__group-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.25;
    font-weight: 400;
    color: #5a7388;
    text-decoration: none;
    white-space: nowrap;
    border: 0;
    border-bottom: 1px solid transparent;
    margin-bottom: -1px;
    background: transparent;
    box-shadow: none;
}

.entity-admin-nav__icon {
    width: 14px;
    height: 14px;
    min-width: 14px;
    stroke-width: 2;
    flex: 0 0 auto;
    opacity: .85;
}

.entity-admin-nav__dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 2px;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 400;
    color: #334155;
}

.entity-admin-nav__dropdown-item .entity-admin-nav__icon {
    opacity: .7;
}

.entity-admin-nav__tab:hover,
.entity-admin-nav__group-btn:hover,
.entity-admin-nav__group-btn:focus,
.entity-admin-nav__group-btn.show {
    color: #0B679E;
    text-decoration: none;
    background: transparent;
    box-shadow: none;
    outline: none;
}

.entity-admin-nav__tab.is-active,
.entity-admin-nav__group-btn.is-active {
    color: #0B679E;
    font-weight: 400;
    border-bottom-color: #0B679E;
}

.entity-admin-nav__group {
    position: relative;
    flex: 0 0 auto;
}

.entity-admin-nav__group-btn.dropdown-toggle::after {
    margin-left: 6px;
    vertical-align: 0.15em;
    opacity: .45;
}

.entity-admin-nav__dropdown {
    min-width: 200px;
    padding: 6px;
    border: 1px solid var(--tblr-border-color-translucent);
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .12);
    z-index: 2050;
}

.entity-admin-nav__dropdown-item:hover,
.entity-admin-nav__dropdown-item:focus {
    background: var(--app-table-hover, #f1f5f9);
    color: #0B679E;
}

.entity-admin-nav__dropdown-item.is-active {
    color: #0B679E;
    font-weight: 400;
    background: rgba(11, 103, 158, .06);
}

.item-page-documents__btn .icon-svg {
    width: 15px;
    height: 15px;
}

.item-page-documents .dropdown-menu {
    min-width: min(360px, calc(100vw - 24px));
    padding: .35rem 0;
}

.item-page-documents__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: .45rem .85rem;
    white-space: normal;
    color: inherit;
    text-decoration: none;
}

.item-page-documents__row:hover,
.item-page-documents__row:focus {
    background: var(--tblr-bg-surface-secondary, #f1f5f9);
    color: inherit;
}

.item-page-documents__name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 13px;
    line-height: 1.35;
}

.item-page-documents__formats {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
}

.item-page-documents__fmt {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    color: #5a7388;
    text-decoration: none;
    transition: background .12s ease, color .12s ease;
}

.item-page-documents__fmt:hover,
.item-page-documents__fmt:focus-visible {
    background: rgba(11, 103, 158, .1);
    color: var(--brand-accent, #0B679E);
    outline: none;
}

.item-page-documents__fmt.is-static {
    pointer-events: none;
    color: #7a93a6;
}

.item-page-documents__fmt-icon {
    width: 16px;
    height: 16px;
    display: block;
}

.page-title,
h1.page-title,
h2.page-title {
    margin-bottom: 0;
    font-size: 18px;
    font-weight: 400;
    line-height: 1.3;
    letter-spacing: 0;
}

.page-title.mb-3,
h1.page-title.mb-3,
h2.page-title.mb-3 { margin-bottom: 0 !important; }

.page-title .text-muted,
.page-title small {
    font-size: var(--app-font-size);
    font-weight: 400;
}

.breadcrumb {
    margin-bottom: 2px;
    font-size: var(--app-font-size-sm);
    background: none;
    box-shadow: none;
    user-select: none;
}

.breadcrumb-item,
.breadcrumb-item.active {
    font-weight: 400;
    color: var(--tblr-body-color);
    background: none;
    box-shadow: none;
    text-shadow: none;
}

.breadcrumb-item a {
    font-weight: 400;
    text-decoration: none;
}

.breadcrumb-item a:hover {
    color: var(--brand-accent);
}

.breadcrumb ::selection {
    background: transparent;
    color: inherit;
}

.badge { font-size: 11px; line-height: 1.35; padding: 4px 8px; border-radius: 6px; font-weight: 500; }

.app-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px 3px 8px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
    border-radius: 999px;
    white-space: nowrap;
    vertical-align: middle;
}

.app-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.app-status--on {
    background: #eef6f1;
    color: #1f6b3f;
}

.app-status--on::before {
    background: #34a853;
    box-shadow: 0 0 0 2px rgba(52, 168, 83, 0.18);
}

.app-status--off {
    background: #f3f4f6;
    color: #64748b;
}

.app-status--off::before {
    background: #94a3b8;
}

/* Остальные badge — без конфликта цвета Tabler secondary на цветном фоне */
.badge.bg-success,
.badge.text-bg-success {
    background-color: #eef6f1 !important;
    color: #1f6b3f !important;
    border: none;
}

.badge.bg-secondary,
.badge.text-bg-secondary {
    background-color: #f3f4f6 !important;
    color: #64748b !important;
    border: none;
}

.badge.bg-danger,
.badge.text-bg-danger {
    background-color: #fef2f2 !important;
    color: #b42318 !important;
    border: none;
}

.badge.bg-warning,
.badge.text-bg-warning {
    background-color: #fff8eb !important;
    color: #9a5b13 !important;
    border: none;
}

.badge.bg-info,
.badge.text-bg-info {
    background-color: #eff6ff !important;
    color: #1d5fad !important;
    border: none;
}

.subheader {
    margin-bottom: var(--app-section-gap);
    color: var(--tblr-secondary-color);
    font-size: var(--app-font-size-sm);
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
}

/* Подсказки и ошибки — один компактный вид на всех страницах. */
.alert {
    padding: 8px 12px;
    margin-bottom: var(--app-section-gap);
    border-radius: var(--app-control-radius);
    font-size: var(--app-font-size);
    line-height: 1.4;
}

.alert.small,
.alert-sm {
    padding: 6px 10px;
    font-size: var(--app-font-size-sm);
}

.alert .small { font-size: var(--app-font-size-sm); }

.alert strong { font-weight: 600; }

/* Список записей (режим list) и прочие list-group. */
.list-group { font-size: var(--app-font-size); }

.list-group-item {
    padding: 8px var(--app-card-padding);
    border-color: var(--tblr-border-color-translucent);
}

.list-group-flush > .list-group-item { padding-left: 0; padding-right: 0; }

/* Вкладки форм и виджетов. */
.nav-tabs {
    gap: 2px;
    margin-bottom: var(--app-section-gap);
    border-bottom: 1px solid var(--tblr-border-color-translucent);
}

.nav-tabs .nav-link {
    padding: 6px 12px;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: var(--app-control-radius) var(--app-control-radius) 0 0;
    color: var(--tblr-secondary-color);
    font-size: var(--app-font-size);
    font-weight: 500;
}

.nav-tabs .nav-link:hover {
    color: var(--tblr-body-color);
    background: var(--tblr-bg-surface-secondary);
    border-color: transparent;
}

.nav-tabs .nav-link.active {
    color: var(--tblr-primary);
    background: transparent;
    border-bottom-color: var(--tblr-primary);
}

/* Пагинация вне DataTables — та же геометрия, что у .page-link в таблицах. */
.pagination { margin-bottom: 0; gap: 4px; }

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: var(--app-control-height);
    height: var(--app-control-height);
    padding: 0 10px;
    border-radius: var(--app-control-radius) !important;
    font-size: var(--app-font-size);
    line-height: 1;
    box-shadow: none;
}

.page-item.active .page-link {
    background: var(--tblr-primary);
    border-color: var(--tblr-primary);
}

/* Пустые inline-сообщения (legacy). */
.card-body.text-center.text-muted.py-4,
.card-body.text-center.text-muted.py-5 {
    padding-top: 28px !important;
    padding-bottom: 28px !important;
    color: var(--tblr-secondary-color) !important;
    font-size: var(--app-font-size);
}

/* Legacy Bootstrap-разметка форм. */
.form-group { margin-bottom: var(--app-section-gap); }

/* Поля с иконкой (логин, профиль). */
.input-icon .form-control { padding-left: 36px; }

.input-icon-addon {
    color: var(--tblr-secondary-color);
}

.input-icon-addon svg.feather {
    width: 16px;
    height: 16px;
}

/* Inline-code в тексте и таблицах. */
code {
    padding: 1px 5px;
    border-radius: 4px;
    font-size: .92em;
    background: var(--tblr-bg-surface-secondary);
    color: inherit;
}

code.column-name {
    padding: 1px 5px;
    border-radius: 4px;
}

/* Служебная строка таблицы (админ-группа и т.п.). */
.table tbody tr.table-light,
.table tbody tr.table-light td {
    background: #f0f4f8 !important;
    color: #64748b;
}

/* Topbar: круглые ghost-кнопки совпадают с .btn-icon. */
.app-topbar .btn-icon.rounded-circle {
    width: var(--app-control-height);
    height: var(--app-control-height);
}

.app-topbar .navbar-nav .nav-link {
    font-size: var(--app-font-size);
}

.app-topbar .badge.bg-yellow {
    font-size: 9px;
    font-weight: 400;
    min-width: 14px;
    height: 14px;
    line-height: 14px;
    padding: 0;
    border-radius: 3px;
    color: #fff;
    top: -2px !important;
    right: -4px !important;
}

/* Минималистичная панель действий в шапке */
.app-topbar-actions {
    display: inline-flex;
    align-items: center;
    gap: 20px;
    flex: 0 0 auto;
    position: relative;
    z-index: 3;
    margin-left: auto;
    padding-left: 14px;
    align-self: stretch;
    /* перекрывает хвост горизонтального меню при узкой шапке / свёртке сайдбара */
    background: color-mix(in srgb, var(--tblr-bg-surface) 96%, #fff);
    box-shadow: -16px 0 14px -10px color-mix(in srgb, var(--tblr-bg-surface) 96%, #fff);
}

.app-topbar-actions > .dropdown {
    position: relative;
    flex: 0 0 auto;
    display: inline-flex;
}

.app-topbar-square-btn {
    width: auto;
    min-width: 0;
    height: auto;
    min-height: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--tblr-secondary-color);
    box-shadow: none !important;
    outline: none;
    transition: color .15s ease;
}

.app-topbar-square-btn:hover {
    border-color: transparent;
    background: transparent;
    color: var(--tblr-body-color);
}

.app-topbar-square-btn:focus,
.app-topbar-square-btn:focus-visible,
.app-topbar-square-btn.show,
.app-topbar-square-btn:active {
    border-color: transparent;
    background: transparent;
    color: var(--tblr-body-color);
    box-shadow: none !important;
    outline: none;
}

.app-topbar-square-btn svg.feather,
.app-topbar-square-btn .icon-svg {
    width: 16px;
    height: 16px;
}

.app-topbar-square-btn > *,
.app-topbar-profile-chip > * {
    pointer-events: none;
}

.app-topbar-profile-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--tblr-body-color);
    text-decoration: none;
    line-height: 1;
    box-shadow: none !important;
    outline: none;
    cursor: pointer;
    font: inherit;
    transition: color .15s ease;
}

.app-topbar-profile-chip:hover {
    border-color: transparent;
    background: transparent;
    color: var(--tblr-body-color);
    text-decoration: none;
}

.app-topbar-profile-chip:focus,
.app-topbar-profile-chip:focus-visible,
.app-topbar-profile-chip:active,
.app-topbar-profile-chip.show,
.dropdown.show > .app-topbar-profile-chip,
.app-topbar-profile-chip[aria-expanded="true"] {
    border-color: transparent;
    background: transparent;
    color: var(--tblr-body-color);
    text-decoration: none;
    box-shadow: none !important;
    outline: none;
}

.dropdown.show > .app-topbar-profile-chip {
    z-index: 1;
}

.app-topbar-avatar {
    flex: 0 0 auto;
}

.app-topbar-avatar--img {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    object-fit: cover;
}

.app-topbar-username {
    font-size: var(--app-font-size);
    font-weight: 400;
    color: var(--tblr-body-color);
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-topbar-chevron {
    width: 13px;
    height: 13px;
    color: var(--tblr-secondary-color);
    flex: 0 0 auto;
}

.app-topbar-profile-chip.dropdown-toggle::after {
    display: none;
}

@media (max-width: 575.98px) {
    .app-topbar-profile-chip {
        padding-right: 0;
    }
}

/* --- Таблицы: DataTables 3 + лёгкий современный слой поверх Tabler --- */
table.dataTable {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    width: 100% !important;
    border-collapse: collapse;
}

table.dataTable td,
table.dataTable th {
    box-sizing: border-box;
}

/* Tabler по умолчанию делает thead UPPERCASE и «офисную» сетку — переопределяем */
.table thead th {
    text-transform: none;
    letter-spacing: 0;
}

.app-page-table .table,
.dt-container .table {
    --bs-table-border-color: var(--app-table-border);
    --bs-table-striped-bg: var(--app-table-zebra);
    --bs-table-hover-bg: var(--app-table-hover);
    margin-bottom: 0;
    font-size: var(--app-font-size);
    line-height: 1.25;
}

.app-page-table .table > :not(caption) > * > *,
.dt-container .table > :not(caption) > * > * {
    border-width: 0 0 1px;
    border-color: var(--app-table-border);
    padding: var(--app-table-padding-y) var(--app-table-padding-x);
    vertical-align: middle;
    box-shadow: none;
}

.app-page-table .table > tbody > tr > td,
.dt-container .table > tbody > tr > td,
table.dataTable > tbody > tr > td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-page-table .table > thead > tr > th.app-table-col--compact,
.app-page-table .table > tbody > tr > td.app-table-col--compact,
.app-page-table .table > tfoot > tr > td.app-table-col--compact,
.app-page-table .table > thead > tr > th.app-listing-sum-check,
.app-page-table .table > tbody > tr > td.app-listing-sum-check,
.app-page-table .table > thead > tr > th.app-table-col--id,
.app-page-table .table > tbody > tr > td.app-table-col--id,
.app-page-table .table > thead > tr > th.app-table-col--actions,
.app-page-table .table > tbody > tr > td.app-table-col--actions {
    width: 1%;
    max-width: none;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
}

.app-page-table .table > thead > tr > th.app-table-col--fluid,
.app-page-table .table > tbody > tr > td.app-table-col--fluid,
.app-page-table .table > tfoot > tr > td.app-table-col--fluid {
    max-width: 22rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-page-table .table > thead > tr > th.app-table-col--content,
.app-page-table .table > tbody > tr > td.app-table-col--content,
.app-page-table .table > tfoot > tr > td.app-table-col--content {
    max-width: none;
    width: auto;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
}

.app-page-table .table > thead > tr > th.app-table-col--truncated,
.app-page-table .table > tbody > tr > td.app-table-col--truncated,
.app-page-table .table > tfoot > tr > td.app-table-col--truncated {
    max-width: 18rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-page-table .table > tbody > tr > td[colspan],
.dt-container .table > tbody > tr > td[colspan],
table.dataTable > tbody > tr > td[colspan],
.app-page-table .table > tbody > tr > td:has(.table-actions),
.dt-container .table > tbody > tr > td:has(.table-actions),
table.dataTable > tbody > tr > td:has(.table-actions),
.app-page-table .table > tbody > tr > td.text-nowrap,
.dt-container .table > tbody > tr > td.text-nowrap,
table.dataTable > tbody > tr > td.text-nowrap {
    max-width: none;
    overflow: visible;
    text-overflow: clip;
}

.app-page-table .table thead th,
.dt-container .table thead th,
table.dataTable thead th {
    text-transform: none;
    font-size: var(--app-table-header-size);
    font-weight: 600;
    letter-spacing: 0;
    line-height: 1.25;
    color: #64748b;
    background: var(--app-table-header-bg);
    border-bottom: 1px solid var(--app-table-border);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-listing-sort {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 100%;
    color: inherit;
    font: inherit;
    font-weight: inherit;
    text-decoration: none;
    cursor: pointer;
}

.app-listing-sort:hover,
.app-listing-sort:focus,
.app-listing-sort.is-active {
    color: inherit;
    font-weight: inherit;
    text-decoration: none;
}

.app-listing-sort__label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-listing-sort__ind {
    display: inline-flex;
    flex: 0 0 auto;
    opacity: 0.35;
}

.app-listing-sort__ind svg {
    display: block;
    fill: currentColor;
}

.app-listing-sort__up,
.app-listing-sort__down {
    opacity: 0.45;
}

.app-listing-sort:hover .app-listing-sort__ind {
    opacity: 0.7;
}

.app-listing-sort.is-active .app-listing-sort__ind {
    opacity: 0.9;
}

.app-listing-sort.is-asc .app-listing-sort__up,
.app-listing-sort.is-desc .app-listing-sort__down {
    opacity: 1;
}

.app-listing-sort.is-asc .app-listing-sort__down,
.app-listing-sort.is-desc .app-listing-sort__up {
    opacity: 0.25;
}

.app-page-table .table tbody tr:last-child > *,
.dt-container .table tbody tr:last-child > *,
table.dataTable tbody tr:last-child > * {
    border-bottom-width: 0;
}

.app-page-table .table tfoot.app-listing-sum-foot td,
.app-listing-sum-foot td {
    border-top: 1px solid var(--app-table-border);
    background: var(--app-table-zebra);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.app-listing-sum-check {
    width: 36px;
    text-align: center;
    vertical-align: middle !important;
}

.app-listing-sum-label {
    font-weight: 600;
    white-space: nowrap;
}

.app-page-table .table > tbody > tr > td.js-listing-sum-cell {
    font-variant-numeric: tabular-nums;
}

table.table.dataTable.table-striped > tbody > tr:nth-of-type(2n+1) > * {
    box-shadow: inset 0 0 0 9999px var(--app-table-zebra);
}

table.table.dataTable.table-hover > tbody > tr:hover > * {
    box-shadow: inset 0 0 0 9999px var(--app-table-hover);
}

.app-page-table .table > tbody > tr.table-light > *,
.dt-container .table > tbody > tr.table-light > * {
    background-color: #f1f5f9 !important;
    box-shadow: none !important;
}

/* Сортировка — тихие стрелки, заметнее при наведении */
table.dataTable thead .dt-column-order::before,
table.dataTable thead .dt-column-order::after {
    opacity: 0;
    transition: opacity .12s ease;
}

table.dataTable thead th:hover .dt-column-order::before,
table.dataTable thead th:hover .dt-column-order::after,
table.dataTable thead th.dt-ordering-asc .dt-column-order::before,
table.dataTable thead th.dt-ordering-desc .dt-column-order::after {
    opacity: 0.4;
}

.table tbody td a:not(.btn):not(.dropdown-item) {
    font-weight: 500;
    text-decoration: none;
}

.table tbody td a:not(.btn):not(.dropdown-item):hover {
    color: var(--brand-accent);
}

/* Инлайн-редактирование ячеек списка */
td.listing-inline-edit {
    cursor: pointer;
    position: relative;
}

td.listing-inline-edit:hover {
    background: color-mix(in srgb, var(--brand-accent, #0B679E) 6%, transparent);
}

td.listing-inline-edit.is-editing {
    cursor: default;
    background: color-mix(in srgb, var(--brand-accent, #0B679E) 5%, transparent);
    /* без inset-обводки — иначе вместе с focus ring съедает место под значение */
    box-shadow: none;
    overflow: visible;
    z-index: 3;
    vertical-align: middle;
}

td.listing-inline-edit.is-saving {
    opacity: .65;
    pointer-events: none;
}

td.listing-inline-edit.is-saved {
    background: color-mix(in srgb, #2fb344 12%, transparent);
}

td.listing-inline-edit.is-error {
    background: color-mix(in srgb, #d63939 10%, transparent);
}

td.listing-inline-edit .listing-inline-edit__control {
    display: block;
    width: 100%;
    min-width: 100%;
    max-width: none;
    margin: 0;
    box-sizing: border-box;
    height: auto;
    min-height: 1.75rem;
    padding: .2rem .5rem;
    font-size: inherit;
    line-height: 1.35;
    border: 1px solid color-mix(in srgb, var(--brand-accent, #0B679E) 40%, var(--tblr-border-color, #c8d0da));
    border-radius: .25rem;
    box-shadow: none;
    background: #fff;
}

td.listing-inline-edit .listing-inline-edit__control:focus {
    border-color: var(--brand-accent, #0B679E);
    /* тонкое кольцо вместо толстого bootstrap glow */
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--brand-accent, #0B679E) 35%, transparent);
    outline: none;
}

td.listing-inline-edit .form-select.listing-inline-edit__control {
    padding-right: 1.75rem;
    background-position: right .4rem center;
}

td.listing-inline-edit[data-field-type="fieldtype_input_numeric"] .listing-inline-edit__control,
td.listing-inline-edit.text-end .listing-inline-edit__control {
    text-align: right;
}

td.listing-inline-edit .listing-inline-edit__view:empty::before {
    content: '—';
    color: var(--tblr-secondary-color, #6c757d);
}

.table tbody td .text-muted.small,
.table tbody td .table-row-id {
    margin-left: 4px;
    color: var(--tblr-secondary-color) !important;
    font-size: 12px;
    font-weight: 400;
}

.table-responsive > .table { margin-bottom: 0; }

/* Кнопки в строках таблицы и в виджете файлов — лёгкие ghost-иконки.
   Иконки в шапке списка (.service-toolbar / .page-header) остаются обычными btn-icon. */
.table .btn-icon,
.table .btn.btn-sm.btn-icon,
.table .btn.btn-lg.btn-icon,
.app-table-icon-actions .btn-icon,
.app-table-icon-actions .btn.btn-sm.btn-icon,
.app-table-icon-actions .btn.btn-lg.btn-icon,
.entity-files .table-actions .btn-icon,
.entity-files .table-actions .btn.btn-sm.btn-icon,
.entity-files .table-actions .btn.btn-lg.btn-icon,
.entity-files-modal .table-actions .btn-icon,
.entity-files-modal .table-actions .btn.btn-sm.btn-icon,
.entity-files-modal .table-actions .btn.btn-lg.btn-icon {
    width: var(--app-table-action-size);
    min-width: var(--app-table-action-size);
    height: var(--app-table-action-size);
    min-height: var(--app-table-action-size);
    padding: 0;
    border: 1px solid transparent;
    background: transparent;
    color: #64748b;
    box-shadow: none;
}

.table .btn-icon:hover,
.table .btn.btn-sm.btn-icon:hover,
.app-table-icon-actions .btn-icon:hover,
.app-table-icon-actions .btn.btn-sm.btn-icon:hover,
.app-table-icon-actions .btn.btn-lg.btn-icon:hover,
.entity-files .table-actions .btn-icon:hover,
.entity-files .table-actions .btn.btn-sm.btn-icon:hover,
.entity-files .table-actions .btn.btn-lg.btn-icon:hover,
.entity-files-modal .table-actions .btn-icon:hover,
.entity-files-modal .table-actions .btn.btn-sm.btn-icon:hover,
.entity-files-modal .table-actions .btn.btn-lg.btn-icon:hover {
    background: rgba(11, 103, 158, 0.06);
    border-color: var(--app-table-border);
    color: var(--tblr-body-color);
}

.table .btn-outline-danger.btn-icon,
.app-table-icon-actions .btn-outline-danger.btn-icon,
.entity-files .table-actions .btn-outline-danger.btn-icon {
    color: var(--tblr-danger);
}

.table .btn-outline-danger.btn-icon:hover,
.app-table-icon-actions .btn-outline-danger.btn-icon:hover,
.entity-files .table-actions .btn-outline-danger.btn-icon:hover {
    background: color-mix(in srgb, var(--tblr-danger) 8%, transparent);
    border-color: color-mix(in srgb, var(--tblr-danger) 20%, var(--app-table-border));
}

.table .btn-icon svg.feather,
.table .btn-icon .icon-svg,
.app-table-icon-actions .btn-icon svg.feather,
.app-table-icon-actions .btn-icon .icon-svg,
.entity-files .table-actions .btn-icon svg.feather,
.entity-files .table-actions .btn-icon .icon-svg,
.entity-files-modal .table-actions .btn-icon svg.feather,
.entity-files-modal .table-actions .btn-icon .icon-svg {
    width: 15px;
    height: 15px;
}

/* Тулбар списка: иконки настроек = высота основных кнопок, без обводки */
.service-toolbar .table-actions,
.page-header .table-actions {
    gap: 6px;
    min-height: var(--app-control-height);
}

.service-toolbar .table-actions .btn-icon,
.service-toolbar .table-actions .btn.btn-sm.btn-icon,
.page-header .table-actions .btn-icon,
.page-header .table-actions .btn.btn-sm.btn-icon {
    width: var(--app-control-height);
    min-width: var(--app-control-height);
    height: var(--app-control-height);
    min-height: var(--app-control-height);
    padding: 0;
    border: 1px solid transparent;
    background: transparent;
    color: #64748b;
    box-shadow: none;
}

.service-toolbar .table-actions .btn-icon:hover,
.service-toolbar .table-actions .btn.btn-sm.btn-icon:hover,
.page-header .table-actions .btn-icon:hover,
.page-header .table-actions .btn.btn-sm.btn-icon:hover {
    background: rgba(11, 103, 158, 0.06);
    border-color: transparent;
    color: var(--tblr-body-color);
}

.service-toolbar .table-actions .btn-icon svg.feather,
.service-toolbar .table-actions .btn-icon .icon-svg,
.page-header .table-actions .btn-icon svg.feather,
.page-header .table-actions .btn-icon .icon-svg {
    width: 16px;
    height: 16px;
}

.table .badge {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 6px;
}

.table code.column-name {
    font-size: 12px;
    padding: 2px 7px;
    border-radius: 5px;
    border: 1px solid var(--app-table-border);
    background: #f8fafc;
    color: #475569;
}

/* Карточка + таблица (формы, пустые состояния) */
.card:has(> .card-body.p-0) > .card-header {
    border-bottom-color: var(--app-table-border);
}

.card-body.p-0 .table thead th {
    border-top: none;
}

/* Таблица на всю ширину страницы */
.app-page-table {
    width: 100%;
    margin-bottom: var(--app-section-gap);
    overflow: visible;
}

/* Список записей: область прокрутки прижата к низу экрана */
.page-wrapper:has(.app-page-table--fill) {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.page-body:has(.app-page-table--fill) {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
}

.page-body:has(.app-page-table--fill) > .container-fluid {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
}

.app-page-table--fill {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 280px;
    margin-bottom: 0;
}

.app-page-table--fill .app-page-table__scroll {
    flex: 1 1 auto;
    min-height: 0;
}

.app-page-table__scroll {
    width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}

.app-page-table__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    padding-bottom: 0;
    border-bottom: none;
}

.app-page-table__title {
    font-size: var(--app-font-size);
    font-weight: 400;
    color: var(--tblr-body-color);
}

.app-page-table__meta {
    font-size: var(--app-font-size-sm);
    color: var(--tblr-secondary-color);
}

.app-page-table + .app-page-table,
.app-page-table + .card,
.card + .app-page-table {
    margin-top: var(--app-section-gap);
}

.app-page-table .table,
.app-page-table table.dataTable {
    width: max-content;
    min-width: 100%;
    max-width: none;
}

/* DataTables 3: панель управления и пагинация */
.dt-container {
    font-size: var(--app-font-size-sm);
    color: var(--tblr-secondary-color);
    overflow: visible;
}

.dt-container .dt-layout-table,
.dt-container .dt-layout-table > div {
    overflow: visible;
}

/* Модальные формы — по центру экрана, без анимации сдвига */
#appFormModal.modal {
    transition: none;
}

#appFormModal.modal.show {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 1.5rem;
}

#appFormModal .modal-dialog {
    margin: 0;
    width: 100%;
    max-height: calc(100vh - 3rem);
    transition: none !important;
}

/* Родительская форма свёрнута в угол, пока открыто создание связанной записи */
#appFormModal.modal.show.is-docked {
    display: block !important;
    align-items: unset !important;
    justify-content: unset !important;
    padding: 0 !important;
    pointer-events: none;
    z-index: 1070;
    background: transparent;
}

#appFormModal.modal.is-docked .modal-dialog,
#appFormModal.modal.is-docked .modal-dialog.modal-dialog-centered {
    position: fixed !important;
    right: 16px !important;
    bottom: 16px !important;
    left: auto !important;
    top: auto !important;
    margin: 0 !important;
    width: min(340px, calc(100vw - 24px)) !important;
    max-width: none !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    display: block !important;
    align-items: unset !important;
    transform: none !important;
    pointer-events: auto;
    animation: app-modal-dock-in .22s ease;
}

#appFormModal.modal.is-docked .modal-content {
    max-height: none !important;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 10px 32px rgba(15, 23, 42, .22);
    border: 1px solid color-mix(in srgb, var(--app-table-border, #d7dee8) 80%, #94a3b8);
    cursor: pointer;
    background: var(--tblr-bg-surface, #fff);
}

#appFormModal.modal.is-docked .modal-content:hover {
    border-color: color-mix(in srgb, var(--brand-accent, #0B679E) 35%, var(--app-table-border, #d7dee8));
}

#appFormModal.modal.is-docked .modal-header {
    padding: 10px 12px;
    border-bottom: 0;
    gap: 2px;
    flex-direction: column;
    align-items: stretch;
}

#appFormModal.modal.is-docked .modal-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

#appFormModal.modal.is-docked .modal-header::after {
    content: 'Нажмите, чтобы вернуться';
    display: block;
    width: 100%;
    font-size: 11px;
    font-weight: 400;
    color: var(--tblr-secondary-color, #6c757d);
    line-height: 1.2;
}

#appFormModal.modal.is-docked .modal-body,
#appFormModal.modal.is-docked .btn-close {
    display: none !important;
}

@keyframes app-modal-dock-in {
    from {
        opacity: 0;
        transform: translateY(10px) scale(.96);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.modal-backdrop.is-parent-docked-hidden {
    opacity: 0 !important;
    pointer-events: none !important;
}

#appFormModal.modal-static .modal-content,
#appRelatedCreateModal.modal-static .modal-content {
    animation: app-modal-attention .42s ease;
}

@keyframes app-modal-attention {
    0%, 100% { transform: translateX(0); }
    18% { transform: translateX(-7px); }
    36% { transform: translateX(7px); }
    54% { transform: translateX(-5px); }
    72% { transform: translateX(5px); }
    90% { transform: translateX(-2px); }
}

#appFormModal .modal-content {
    max-height: calc(100vh - 3rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#appFormModal .modal-body {
    padding-top: 1.35rem;
    overflow-y: auto;
}

#appFormModal .form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

/* Вложенная модалка создания связанной записи — поверх формы родителя */
#appRelatedCreateModal.modal {
    transition: none;
    z-index: 1065;
}

#appRelatedCreateModal.modal.show {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 1.5rem;
}

#appRelatedCreateModal .modal-dialog {
    margin: 0;
    width: 100%;
    max-height: calc(100vh - 3rem);
    transition: none !important;
}

#appRelatedCreateModal .modal-content {
    max-height: calc(100vh - 3rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#appRelatedCreateModal .modal-body {
    padding-top: 1.35rem;
    overflow-y: auto;
}

#appRelatedCreateModal .form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

/* Специфичность выше общих правил backdrop (в т.ч. от модулей) */
body.modal-open .modal-backdrop.show.related-create-backdrop {
    z-index: 1060;
}

#appFormModal .app-modal-form .alert-info {
    font-size: var(--app-font-size-sm);
}

.dt-container .dt-layout-row {
    margin-bottom: 10px;
    align-items: center;
}

.dt-container .dt-length label,
.dt-container .dt-search label,
.dt-container .dt-info {
    font-weight: 400;
    color: var(--tblr-secondary-color);
}

.dt-container .dt-search input,
.dt-container .dt-length select {
    min-height: 30px;
    padding: 4px 10px;
    border: 1px solid var(--app-table-border);
    border-radius: var(--app-control-radius);
    background: var(--tblr-bg-surface);
    font-size: var(--app-font-size-sm);
    color: var(--tblr-body-color);
    box-shadow: none;
    transition: border-color .12s ease, box-shadow .12s ease;
}

.dt-container .dt-search input {
    width: 200px;
    margin-left: 6px;
}

.dt-container .dt-search input:focus,
.dt-container .dt-length select:focus {
    border-color: color-mix(in srgb, var(--brand-accent) 35%, var(--app-table-border));
    outline: none;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-accent) 10%, transparent);
}

.dt-container .dt-search input::placeholder {
    color: color-mix(in srgb, var(--tblr-secondary-color) 72%, transparent);
}

.dt-container .dt-info {
    padding-top: 8px;
}

.dt-container .dt-paging {
    padding-top: 8px;
}

.dt-container .page-link {
    min-width: 28px;
    padding: 4px 10px !important;
    border-radius: var(--app-control-radius) !important;
    border-color: var(--app-table-border) !important;
    font-size: var(--app-font-size-sm);
    line-height: 1.2;
    box-shadow: none !important;
}

.dt-container .page-item.active .page-link {
    background: var(--brand-accent) !important;
    border-color: var(--brand-accent) !important;
    color: #fff !important;
}

.dt-container .page-item:not(.active) .page-link:hover {
    background: var(--app-table-zebra);
    border-color: #d5dbe3;
}

/* Убираем двойную рамку у пагинации Bootstrap */
.dt-container .dt-paging .dt-paging-button.page-item,
.dt-container .dt-paging .dt-paging-button.page-item:hover,
.dt-container .dt-paging .dt-paging-button.page-item.disabled {
    width: auto;
    min-width: 0;
    height: auto;
    margin-left: 4px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

.dt-container .pagination { margin: 0; }

/* Системные поля — компактная 3-колоночная таблица */
.app-system-fields-table .app-col-id,
.app-system-fields-table th.app-col-id,
.app-system-fields-table td:first-child {
    width: 52px;
    white-space: nowrap;
}

/* Модальные окна, выпадающие меню и навигация не выбиваются по кеглю. */
.dropdown-menu,
.modal-content,
.nav-link,
.pagination { font-size: var(--app-font-size); }

.dropdown-menu { padding: 4px; }
.dropdown-item {
    display: flex;
    align-items: center;
    min-height: 30px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: var(--app-font-size);
    line-height: 1.15;
}

.dropdown-item svg.feather {
    width: 16px;
    height: 16px;
    min-width: 16px;
    margin-right: 8px !important;
    stroke-width: 2;
}

.dropdown-item .icon-svg,
.dropdown-item__icon {
    width: 16px;
    height: 16px;
    min-width: 16px;
    margin-right: 8px;
}

.dropdown-divider { margin: 4px -4px; }
.modal-header, .modal-footer { padding: 12px 14px; }
.modal-title {
    font-weight: 400;
}
.modal-body { padding: 14px; }

/* Сетка полей: авто-ширина по содержимому, фиксируем только узкие колонки */
.app-data-grid {
    width: 100% !important;
    table-layout: auto;
}

.app-data-grid .app-col-id { width: 52px; }
.app-data-grid .app-col-name { width: auto; min-width: 120px; }
.app-data-grid .app-col-type { width: auto; min-width: 140px; }
.app-data-grid .app-col-db { width: auto; min-width: 160px; }
.app-data-grid .app-col-required { width: 88px; }
.app-data-grid .app-col-actions { width: 72px; }

.app-data-grid th,
.app-data-grid td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-data-grid th:last-child,
.app-data-grid td:last-child {
    text-align: right;
}

.table-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 3px;
    min-height: 0;
    white-space: nowrap;
}

/* Вторая карточка под таблицей (системные поля и т.п.) */
.card + .card {
    margin-top: var(--app-section-gap);
}

/* Отступы первой/последней колонки внутри карточки */
.card .table thead th:first-child,
.card .table tbody td:first-child,
.card .table-responsive .table thead th:first-child,
.card .table-responsive .table tbody td:first-child {
    padding-left: var(--app-card-padding);
}

.card .table thead th:last-child,
.card .table tbody td:last-child,
.card .table-responsive .table thead th:last-child,
.card .table-responsive .table tbody td:last-child {
    padding-right: var(--app-card-padding);
}

@media (max-width: 767.98px) {
    .dt-container .dt-search,
    .dt-container .dt-paging,
    .dt-container .dt-length,
    .dt-container .dt-info { justify-content: flex-start; }
}

.card.mb-3,
.alert.mb-3,
.subheader.mb-3 { margin-bottom: var(--app-section-gap) !important; }

/* Сервисная панель списка записей — те же outline-кнопки, что и в остальной системе. */
.service-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.service-toolbar > .btn-primary {
    margin-left: 4px;
}

/* Панель фильтров списка записей */
.items-filters {
    margin-bottom: var(--app-section-gap);
    font-size: 14px;
}

.items-filters__active {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.items-filters__active-label {
    font-size: 14px;
    color: var(--tblr-secondary-color);
}

.items-filters__chip {
    display: inline-flex;
    align-items: center;
    max-width: min(280px, 100%);
    background: color-mix(in srgb, var(--brand-accent) 8%, #fff);
    border: 1px solid color-mix(in srgb, var(--brand-accent) 22%, var(--app-table-border));
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.2;
    overflow: hidden;
}

.items-filters__chip-text {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    padding: 5px 2px 5px 10px;
    color: var(--brand-accent);
}

.items-filters__chip-key {
    color: color-mix(in srgb, var(--brand-accent) 70%, #334155);
    flex-shrink: 0;
}

.items-filters__chip-key::after {
    content: ':';
}

.items-filters__chip-val {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.items-filters__chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    min-width: 26px;
    height: 26px;
    color: color-mix(in srgb, var(--brand-accent) 65%, #64748b);
    text-decoration: none;
    font-size: 16px;
    line-height: 1;
}

.items-filters__chip-remove:hover {
    color: var(--tblr-danger);
    background: color-mix(in srgb, var(--tblr-danger) 8%, transparent);
    text-decoration: none;
}

.items-filters__clear-all {
    font-size: 14px;
    color: var(--tblr-secondary-color);
    text-decoration: none;
    margin-left: 2px;
}

.items-filters__clear-all:hover {
    color: var(--brand-accent);
    text-decoration: underline;
}

.items-filters__bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--app-table-header-bg);
    border: 1px solid var(--app-table-border);
    border-radius: 8px;
}

.items-filters__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    min-width: 30px;
    height: 30px;
    margin-top: 0;
    color: var(--tblr-secondary-color);
    background: #fff;
    border: 1px solid var(--app-table-border);
    border-radius: 6px;
}

.items-filters__icon svg {
    width: 15px;
    height: 15px;
}

.items-filters__form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.items-filters__fields {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.items-filters__field {
    flex: 1 1 140px;
    min-width: 120px;
    max-width: 220px;
}

.items-filters__field--date {
    max-width: 160px;
}

.items-filters__field--period {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1 1 260px;
    min-width: 220px;
    max-width: 320px;
}

.items-filters__field--period .items-filters__control {
    flex: 1 1 0;
    min-width: 0;
}

.items-filters__period-sep {
    flex: 0 0 auto;
    color: var(--bs-secondary-color);
    font-size: 14px;
    line-height: 1;
}

.items-filters__control {
    width: 100%;
    background: #fff;
    border-color: var(--app-table-border);
    border-radius: 6px !important;
    font-size: 14px !important;
}

.items-filters__control:focus {
    border-color: var(--brand-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-accent) 12%, transparent);
}

.items-filters__actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.items-filters__apply {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 88px;
    height: 31px;
    padding: 0 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    color: #5a7388;
    background: #fff;
    border: 1px solid var(--app-table-border);
    box-shadow: none;
    cursor: pointer;
    transition: color .15s ease, border-color .15s ease, background .15s ease;
}

.items-filters__apply:hover {
    color: var(--brand-accent);
    background: #fff;
    border-color: color-mix(in srgb, var(--brand-accent) 32%, var(--app-table-border));
}

.items-filters__apply:focus-visible {
    color: var(--brand-accent);
    background: #fff;
    border-color: var(--brand-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-accent) 12%, transparent);
}

.items-filters__footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    margin-top: 8px;
    padding: 0 2px;
}

.items-filters__presets {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1 1 auto;
}

.items-filters__presets-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    color: var(--tblr-secondary-color);
    white-space: nowrap;
}

.items-filters__presets-label svg {
    width: 14px;
    height: 14px;
}

.items-filters__presets-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.filter-panel-chip {
    display: inline-flex;
    align-items: stretch;
    max-width: 100%;
    background: #fff;
    border: 1px solid var(--app-table-border);
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.2;
    overflow: hidden;
}

.filter-panel-chip__link {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    color: var(--tblr-body-color);
    text-decoration: none;
    font-size: 14px;
}

.filter-panel-chip__link:hover {
    background: var(--app-table-hover);
    color: var(--brand-accent);
    text-decoration: none;
}

.filter-panel-chip__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    padding: 0 6px;
    color: var(--tblr-secondary-color);
    text-decoration: none;
    font-size: 16px;
    line-height: 1;
}

.filter-panel-chip__remove:hover {
    color: var(--tblr-danger);
    background: color-mix(in srgb, var(--tblr-danger) 8%, transparent);
}

.items-filters__save-trigger {
    margin-left: auto;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    font-size: 14px;
    color: var(--tblr-secondary-color);
    user-select: none;
    white-space: nowrap;
}

.items-filters__save-trigger:hover {
    color: var(--brand-accent);
}

.items-filters__save-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.items-filters__save-label {
    margin: 0;
    font-size: 14px;
    color: var(--tblr-secondary-color);
    white-space: nowrap;
}

.items-filters__save-name {
    flex: 1 1 200px;
    max-width: 320px;
    min-width: 160px;
}

.items-filters.is-saving .items-filters__save-trigger {
    visibility: hidden;
}

.items-filters__save-form .btn {
    border-radius: 6px;
    font-size: 14px;
}

@media (max-width: 767.98px) {
    .items-filters__bar {
        flex-direction: column;
        align-items: stretch;
    }

    .items-filters__icon {
        display: none;
    }

    .items-filters__field {
        max-width: none;
    }

    .items-filters__field--period {
        max-width: none;
    }

    .items-filters__actions {
        width: 100%;
    }

    .items-filters__apply {
        width: 100%;
    }

    .items-filters__footer {
        flex-direction: column;
        align-items: stretch;
    }

    .items-filters__save-trigger {
        margin-left: 0;
    }

    .items-filters__save-name {
        max-width: none;
    }
}

/* Отладка — служебная информация, а не авария: мягкая жёлтая подложка
   вместо тяжёлой чёрной консоли. */
.debug-panel {
    border-color: #ead99e;
    background: #fffdf5;
    box-shadow: none;
}

.debug-panel .card-body { padding: 10px 12px; }

.debug-panel-title {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 7px;
    color: #79601c;
    font-size: var(--app-font-size);
    line-height: 1.2;
}

.debug-panel-title svg {
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
}

.debug-query {
    padding: 8px 10px;
    overflow-x: auto;
    border: 1px solid #ebdca7;
    border-radius: var(--app-control-radius);
    background: #fff8d9;
    color: #5d4b19;
    font-size: var(--app-font-size);
    line-height: 1.35;
    white-space: pre-wrap;
    word-break: break-word;
}

.debug-query code {
    padding: 0;
    background: transparent;
    color: inherit;
}

@media (max-width: 991.98px) {
    .service-toolbar {
        width: 100%;
        margin-top: 8px;
        justify-content: flex-start;
    }
}

/* --- страница «Мой профиль» --- */
.profile-page .card-header .card-title {
    font-weight: 600;
}

.profile-side-card .card-body {
    padding: 16px var(--app-card-padding) 14px;
}

.profile-avatar {
    width: 88px;
    height: 88px;
    margin-bottom: 12px;
    border-radius: 12px;
    overflow: hidden;
    background: color-mix(in srgb, var(--tblr-primary) 10%, var(--tblr-bg-surface));
    border: 1px solid color-mix(in srgb, var(--tblr-primary) 14%, transparent);
}

.profile-avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.profile-avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--tblr-primary);
    font-size: 28px;
    font-weight: 600;
    line-height: 1;
}

.profile-side-name {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.25;
    color: var(--tblr-body-color);
}

.profile-side-login {
    margin-top: 4px;
    font-size: var(--app-font-size-sm);
    color: var(--tblr-secondary-color);
}

.profile-avatar-form {
    border-top: 1px solid var(--tblr-border-color-translucent);
}

.profile-readonly-field {
    display: flex;
    align-items: center;
    min-height: var(--app-control-height);
    padding: 0 10px;
    border: 1px solid var(--tblr-border-color-translucent);
    border-radius: var(--app-control-radius);
    background: var(--tblr-bg-surface-secondary);
    color: var(--tblr-secondary-color);
    font-size: var(--app-font-size);
    font-family: 'Geist Mono', var(--tblr-font-monospace, monospace);
}

.profile-form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--tblr-border-color-translucent);
}

.profile-form-actions .btn {
    margin: 0;
    padding: 0 14px;
}

.profile-page .input-group .btn {
    min-width: var(--app-control-height);
    padding: 0;
}

.profile-page .input-group .btn svg.feather {
    width: 14px;
    height: 14px;
    margin: 0;
}

@media (max-width: 991.98px) {
    .profile-side-card {
        height: auto !important;
    }

    .profile-avatar-form {
        margin-top: 12px !important;
        padding-top: 12px !important;
    }
}

/* --- подсказка под заголовком страницы (вместо тяжёлого alert-secondary) --- */
.page-hint {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid color-mix(in srgb, var(--tblr-primary) 12%, transparent);
    border-radius: var(--app-control-radius);
    background: color-mix(in srgb, var(--tblr-primary) 4%, var(--tblr-bg-surface));
    color: var(--tblr-secondary-color);
    font-size: var(--app-font-size-sm);
    line-height: 1.45;
}

.page-hint svg.feather {
    width: 16px;
    height: 16px;
    margin-top: 1px;
    flex: 0 0 auto;
    color: var(--tblr-primary);
}

/* legacy: старые alert-secondary.small выглядят как page-hint */
.alert.alert-secondary.small {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: var(--app-section-gap);
    border: 1px solid color-mix(in srgb, var(--tblr-primary) 12%, transparent);
    border-radius: var(--app-control-radius);
    background: color-mix(in srgb, var(--tblr-primary) 4%, var(--tblr-bg-surface));
    color: var(--tblr-secondary-color);
    font-size: var(--app-font-size-sm);
    line-height: 1.45;
}

.alert.alert-info:not(.alert-dismissible) {
    padding: 10px 12px;
    margin-bottom: var(--app-section-gap);
    border-radius: var(--app-control-radius);
    font-size: var(--app-font-size-sm);
    line-height: 1.45;
}

.ui-form-card .card-header .card-title {
    font-weight: 600;
}

.field-form .form-label {
    margin-bottom: 0.25rem;
}

.field-form .form-text {
    margin-top: 0.25rem;
}

.field-form__flags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 1.25rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--tblr-border-color-translucent);
    border-radius: var(--app-control-radius);
    background: var(--tblr-bg-surface-secondary, var(--app-table-zebra));
}

.field-form__flags .form-check {
    margin: 0;
    min-height: 0;
    padding-left: 1.5rem;
}

.field-choices-editor {
    border: 1px solid var(--tblr-border-color-translucent);
    border-radius: var(--app-control-radius);
    background: var(--tblr-bg-surface-secondary, var(--app-table-zebra));
    padding: 0.55rem 0.65rem;
}

.field-choices-editor__none {
    margin-bottom: 0.45rem;
    padding-bottom: 0.45rem;
    border-bottom: 1px solid rgba(15, 45, 66, .08);
}

.field-choices-editor__default {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    cursor: pointer;
    color: #64748b;
    font-size: 13px;
    user-select: none;
}

.field-choices-editor__default input {
    margin: 0;
    accent-color: var(--tblr-primary, #0b679e);
}

.field-choices-editor__list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.field-choices-editor__row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.45rem;
    align-items: center;
}

.field-choices-editor__row .field-choices-editor__default {
    width: 28px;
    height: 28px;
    justify-content: center;
}

.field-choices-editor__remove {
    color: #94a3b8;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.field-choices-editor__remove:hover {
    color: var(--tblr-danger);
    background: rgba(220, 53, 69, 0.06);
}

.entity-cfg-form .form-label {
    margin-bottom: 0.25rem;
}

.entity-cfg-form .form-text {
    margin-top: 0.25rem;
}

.entity-cfg-form .fa-icon-picker-preview {
    width: 38px;
    height: 38px;
}

.item-page-cfg-form .form-label {
    margin-bottom: 0.2rem;
    font-size: var(--app-font-size-sm);
}

.item-page-cfg-form .form-text {
    margin-top: 0.2rem;
}

.row-color-rules {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.row-color-rules__row {
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--tblr-border-color-translucent);
    border-radius: var(--app-control-radius);
    background: var(--tblr-bg-surface-secondary, var(--app-table-zebra));
}

.row-color-rules__presets {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 3px;
}

.row-color-rules__swatch {
    width: 16px;
    height: 16px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 3px;
    padding: 0;
    cursor: pointer;
}

.row-color-rules__swatch:hover {
    outline: 2px solid var(--tblr-primary);
    outline-offset: 1px;
}

.app-listing-heading-link {
    color: var(--tblr-primary);
    text-decoration: none;
    font-weight: 600;
}

.app-listing-heading-link:hover {
    color: var(--tblr-primary);
    text-decoration: none;
    opacity: 0.85;
}

.app-page-table .table > tbody > tr.app-listing-row--hl > *,
table.table.dataTable > tbody > tr.app-listing-row--hl > *,
.list-group-item.app-listing-row--hl,
.card.app-listing-row--hl {
    --bs-table-bg: var(--listing-row-bg);
    --bs-table-striped-bg: var(--listing-row-bg);
    --bs-table-hover-bg: var(--listing-row-bg);
    background-color: var(--listing-row-bg) !important;
    box-shadow: none !important;
}

.card.app-listing-row--hl .card-footer {
    background-color: transparent;
}

.items-filters .form-control.flatpickr-date {
    border-radius: 6px !important;
    font-size: 14px !important;
}

.ui-form-card .form-actions,
.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 12px;
    margin-top: 8px;
    border-top: 1px solid var(--tblr-border-color-translucent);
}

.form-actions .btn,
.ui-form-card .form-actions .btn {
    min-height: var(--app-control-height);
    padding: 0 14px;
    margin: 0;
}

/* --- пустое состояние страниц и списков --- */
.page-empty-state {
    padding: 40px 0 24px;
}

.page-empty-state__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    color: var(--tblr-secondary-color);
    opacity: 0.42;
}

.page-empty-state__icon svg.feather {
    width: 30px;
    height: 30px;
    stroke-width: 1.5;
}

.page-empty-state__icon .icon-svg {
    width: 30px;
    height: 30px;
    opacity: 0.42;
}

.page-empty-state__title {
    margin-bottom: 4px;
    font-size: var(--app-font-size);
    font-weight: 400;
    color: var(--tblr-body-color);
}

.page-empty-state__text {
    max-width: 420px;
    margin: 0 auto 14px;
    color: var(--tblr-secondary-color);
    font-size: var(--app-font-size);
    line-height: 1.45;
}

/* --- список виджетов --- */
.widget-list-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-weight: 500;
}

.widget-list-title__icon {
    display: inline-flex;
    flex: 0 0 auto;
}

.widget-list-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.widget-list-tags .badge {
    font-weight: 500;
}

/* Выбор полей на странице «Дизайн страницы записи» */
.cfg-field-picker__chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    padding: 4px 6px 4px 10px;
    border: 1px solid var(--bs-border-color);
    border-radius: 999px;
    background: var(--bs-tertiary-bg);
    font-size: 13px;
    line-height: 1.2;
}
.cfg-field-picker__chip-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cfg-field-picker__chip-remove {
    border: none;
    background: transparent;
    color: var(--bs-secondary-color);
    font-size: 16px;
    line-height: 1;
    padding: 0 4px;
    cursor: pointer;
}
.cfg-field-picker__chip-remove:hover {
    color: var(--bs-danger);
}

.item-page-subentity__row-main {
    font-weight: 500;
    line-height: 1.3;
}
.item-page-subentity__row-meta {
    margin-top: 2px;
    font-size: 12px;
    color: var(--bs-secondary-color);
    line-height: 1.3;
}
.item-page-subentity__row-inline {
    font-size: 13px;
    line-height: 1.35;
}
.item-page-subentity__row-stacked .item-page-subentity__stack-line + .item-page-subentity__stack-line {
    margin-top: 2px;
}
.item-page-subentity__row-stacked .item-page-subentity__stack-line {
    font-size: 13px;
    line-height: 1.35;
}
.item-page-subentity--layout {
    margin-bottom: 0.75rem;
}
.info-layout-root .item-page-subentity--layout:last-child {
    margin-bottom: 0;
}
.item-page-subentity .list-group-flush > .list-group-item {
    padding-left: var(--app-card-padding);
    padding-right: var(--app-card-padding);
}
.item-page-subentity .list-group-item:not(.list-group-item-action) {
    cursor: default;
}

.cfg-subentity-settings .form-label {
    margin-bottom: 4px;
    font-size: 13px;
}
.cfg-subentity-preview-label {
    font-weight: 500;
    letter-spacing: .01em;
}
.cfg-subentity-preview {
    margin-bottom: 0;
}
.cfg-subentity-preview .card-header .btn.disabled {
    pointer-events: none;
}
.cfg-subentity-preview__body .list-group-item-action:hover {
    background: var(--bs-tertiary-bg);
}

/* Ссылки: без подчёркивания — hover через цвет и фон (Tabler/Bootstrap по умолчанию underline). */
a,
a:hover,
a:focus,
a:focus-visible,
a:active,
.btn-link,
.btn-link:hover,
.btn-link:focus,
.btn-link:focus-visible,
.btn-link:active,
.dt-container a:hover,
.page-hint a:hover,
.dropdown-item:hover {
    text-decoration: none;
}

/* Счётчик файлов в таблице записей */
.entity-files-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--tblr-secondary);
    font-size: var(--app-font-size-sm);
    line-height: 1;
    white-space: nowrap;
}
.entity-files-count__icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}
.entity-files-count__value {
    font-variant-numeric: tabular-nums;
}

/* Связанная сущность: иконка + (N) в списке */
.related-listing-count {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    border: 0;
    background: transparent;
    color: var(--tblr-secondary);
    font-size: var(--app-font-size-sm);
    line-height: 1;
    padding: .15rem .2rem;
    border-radius: .35rem;
    cursor: pointer;
    white-space: nowrap;
}
.related-listing-count:hover,
.related-listing-count:focus-visible {
    color: var(--tblr-primary);
    background: color-mix(in srgb, var(--tblr-primary, #066fd1) 8%, transparent);
    outline: none;
}
.related-listing-count__icon,
.related-listing-count__icon-svg {
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
    display: block;
}
.related-listing-count__icon svg,
.related-listing-count__icon-svg {
    width: 15px;
    height: 15px;
}
.related-listing-count__value {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}
.related-listing-count--value-only .related-listing-count__icon,
.related-listing-count--value-only .related-listing-count__icon-svg,
.related-listing-count[data-mode="value_only"] .related-listing-count__icon,
.related-listing-count[data-mode="value_only"] .related-listing-count__icon-svg {
    display: none !important;
}

.related-listing-popover {
    position: fixed;
    z-index: 2080;
    min-width: 220px;
    max-width: min(360px, calc(100vw - 24px));
    max-height: min(320px, 50vh);
    overflow: auto;
    padding: .4rem 0;
    margin: 0;
    list-style: none;
    background: var(--tblr-bg-surface, #fff);
    border: 1px solid var(--tblr-border-color, #e6e7e9);
    border-radius: .5rem;
    box-shadow: 0 10px 28px rgba(15, 23, 42, .12);
}
.related-listing-popover[hidden] {
    display: none !important;
}
.related-listing-popover__item {
    display: block;
    padding: .4rem .75rem;
    color: inherit;
    text-decoration: none;
    white-space: normal;
    line-height: 1.35;
    font-size: var(--app-font-size-sm, 12px);
    border: 0;
    background: transparent;
    width: 100%;
    text-align: left;
}
.related-listing-popover__item:hover,
.related-listing-popover__item:focus {
    background: color-mix(in srgb, var(--tblr-primary, #066fd1) 8%, transparent);
    color: inherit;
    outline: none;
}
.related-listing-popover__empty {
    padding: .55rem .75rem;
    color: var(--tblr-secondary-color, #6b7280);
    font-size: var(--app-font-size-sm, 12px);
}

.print-form-buttons__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.print-form-buttons__icon {
    display: inline-flex;
    width: 18px;
    height: 18px;
}
.print-form-buttons__icon svg {
    width: 18px;
    height: 18px;
    display: block;
}

/* Иконка в заголовке не должна сжиматься и наезжать на стрелки сортировки */
.app-table-col-icon-header .app-listing-sort {
    gap: 8px;
    max-width: none;
}

.app-table-col-icon-header .app-listing-sort__label {
    flex: 0 0 auto;
    overflow: visible;
    min-width: auto;
}

.app-table-col-icon-header .app-listing-sort__ind {
    margin-left: 2px;
}

.print-form-buttons__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.print-form-buttons__icon {
    display: inline-flex;
    width: 18px;
    height: 18px;
}
.print-form-buttons__icon svg {
    width: 18px;
    height: 18px;
    display: block;
}

.app-table-col-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    flex-shrink: 0;
}

.app-table-col-icon .icon-svg,
.app-table-col-icon svg {
    width: 16px;
    height: 16px;
    display: block;
    flex-shrink: 0;
    color: var(--tblr-secondary);
}

/* Поле «Файлы» — хранение на диске, виджет в стиле системы */
.entity-files__drop {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px dashed var(--app-table-border);
    border-radius: var(--app-control-radius);
    background: var(--app-table-zebra);
    color: var(--tblr-secondary-color);
    font-size: var(--app-font-size-sm);
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.entity-files__drop:hover,
.entity-files__drop.is-dragover {
    border-color: var(--brand-accent);
    background: var(--app-table-hover);
    color: var(--tblr-body-color);
}
.entity-files--photos .entity-files__drop {
    display: none;
}
.entity-files--photos .entity-files__gallery-wrap {
    margin-top: 0;
}
.entity-files--photos .entity-files__gallery-wrap.is-dragover {
    outline: 2px dashed color-mix(in srgb, var(--brand-accent) 55%, transparent);
    outline-offset: 4px;
    border-radius: var(--app-control-radius);
}
.entity-files__card--add {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    border: 1px dashed color-mix(in srgb, var(--brand-accent) 40%, var(--app-table-border));
    background: color-mix(in srgb, var(--brand-accent) 4%, var(--app-table-zebra));
    color: var(--tblr-secondary-color);
    cursor: pointer;
    transition: border-color .15s, background .15s, color .15s;
}
.entity-files__card--add:hover,
.entity-files__card--add:focus-visible {
    border-color: var(--brand-accent);
    background: color-mix(in srgb, var(--brand-accent) 10%, var(--app-table-hover));
    color: var(--tblr-body-color);
    outline: none;
}
.entity-files__card-add-icon {
    width: 28px;
    height: 28px;
    display: block;
    flex-shrink: 0;
}
.entity-files__progress--inline {
    margin: 0 0 8px;
}
.entity-files__input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.entity-files__drop > i,
.entity-files__drop > span {
    pointer-events: none;
}
.entity-files__section-label {
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    color: var(--tblr-secondary-color);
    margin: 12px 0 8px;
}
.entity-files__gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 8px;
}
.entity-files__card {
    position: relative;
    border: 1px solid var(--app-table-border);
    border-radius: var(--app-control-radius);
    padding: 0;
    background-color: var(--app-table-zebra, #f1f5f9);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow: hidden;
    width: 100%;
    aspect-ratio: 1 / 1;
    height: auto;
    min-height: 0;
    cursor: pointer;
}
.entity-files__card-del {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: #fff;
    border: 1px solid var(--app-table-border);
    line-height: 18px;
    text-align: center;
    font-size: 14px;
    opacity: 0;
    transition: opacity .15s;
}
.entity-files__card:hover .entity-files__card-del { opacity: 1; }
.entity-files__list {
    border: 1px solid var(--app-table-border);
    border-radius: var(--app-control-radius);
    overflow: hidden;
    background: #fff;
}
.entity-files__row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--app-table-border);
    min-height: 42px;
}
.entity-files__row:last-child { border-bottom: none; }
.entity-files__row-name {
    flex: 1;
    min-width: 0;
    font-size: var(--app-font-size-sm);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.entity-files__row-meta {
    font-size: 11px;
    color: var(--tblr-secondary-color);
    white-space: nowrap;
}
.entity-files__row-actions {
    flex-shrink: 0;
}

.files-access-rules-table__perm {
    width: 88px;
    white-space: nowrap;
}
.files-access-rules-table__actions {
    width: 44px;
}
.files-access-rules-table .form-select-sm {
    min-width: 140px;
}
.entity-files__q-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.entity-files__progress-bar {
    height: 3px;
    background: var(--app-table-border);
    border-radius: 4px;
    overflow: hidden;
}
.entity-files__progress-bar span {
    display: block;
    height: 100%;
    width: 0;
    background: var(--brand-accent);
    transition: width .2s;
}
.entity-files__queue-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}
.entity-files-modal {
    position: fixed;
    inset: 0;
    z-index: 1055;
    background: rgba(15, 23, 42, .35);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.entity-files-modal[hidden] { display: none !important; }
.entity-files-modal__box {
    width: min(1100px, 100%);
    max-height: 90vh;
    background: #fff;
    border-radius: 12px;
    border: 1px solid var(--app-table-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.entity-files-modal__head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--app-table-border);
    background: var(--app-table-header-bg);
}
.entity-files-modal__title {
    flex: 1;
    min-width: 0;
    font-size: var(--app-font-size-sm);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.entity-files-modal__image-tools {
    display: none;
    flex-shrink: 0;
}
.entity-files-modal--image .entity-files-modal__image-tools {
    display: flex;
}
.entity-files-modal__toolbar {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}
.entity-files-modal--image .entity-files-modal__head {
    border-bottom: none;
    padding-bottom: 6px;
}
.entity-files-modal--image .entity-files-modal__title {
    display: none !important;
}
.entity-files-modal--image .entity-files-modal__body {
    padding-top: 0;
}
.entity-files-modal__head-actions {
    display: flex;
    gap: 2px;
    align-items: center;
    flex-shrink: 0;
    margin-left: auto;
}
.entity-files-modal__body {
    padding: 16px;
    overflow: auto;
    background: var(--app-table-zebra);
}
.entity-files-modal__stage {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 200px;
    max-height: 75vh;
    overflow: auto;
}
.entity-files-modal__img {
    max-width: 100%;
    max-height: 75vh;
    display: block;
    margin: 0 auto;
    border: none;
    border-radius: 8px;
    background: #fff;
    transform-origin: center center;
    transition: transform .15s ease;
}
.entity-files-modal__content iframe {
    max-width: 100%;
    max-height: 75vh;
    display: block;
    margin: 0 auto;
    border: none;
    border-radius: 8px;
    background: #fff;
    width: 100%;
    height: 75vh;
}


/* --- поле ЭЦП --- */
.field-eds {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}

.field-eds--has-doc {
    padding: 14px 16px 12px;
    border: 1px solid var(--bs-border-color);
    border-radius: 10px;
    background: var(--bs-card-bg);
    overflow: visible;
}

.field-eds--has-ribbon {
    padding-top: 16px;
}

.field-eds__ribbon {
    position: absolute;
    top: 0;
    right: 20px;
    z-index: 2;
    pointer-events: none;
    transform: translateY(-50%);
}

.field-eds__ribbon-text {
    display: inline-block;
    padding: 4px 11px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: .02em;
    color: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .1);
    white-space: nowrap;
}

.field-eds__ribbon--ready .field-eds__ribbon-text {
    background: var(--brand-accent, #0B679E);
}

.field-eds__ribbon--in_progress .field-eds__ribbon-text {
    background: #f59e0b;
}

.field-eds__ribbon--completed .field-eds__ribbon-text {
    background: var(--tblr-success, #2fb344);
}

.field-eds__status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #64748b;
}

.field-eds__status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
    flex: 0 0 auto;
}

.field-eds__status-dot--ready { background: var(--brand-accent, #0B679E); }
.field-eds__status-dot--in_progress { background: #f59e0b; }
.field-eds__status-dot--completed { background: var(--tblr-success); }

.field-eds__doc-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
}

.field-eds__doc-row > svg.feather,
.field-eds__doc-row > i[data-feather],
.field-eds__doc-row > .field-eds__doc-icon {
    width: 16px;
    height: 16px;
    color: var(--brand-accent, #0B679E);
    flex: 0 0 auto;
}

.field-eds__doc-row > .field-eds__doc-icon--signed,
.field-eds__doc-row.is-signed > .field-eds__doc-icon {
    color: var(--tblr-success, #2fb344);
}

.field-eds__doc-name {
    font-weight: 500;
    word-break: break-word;
    flex: 1 1 auto;
    min-width: 0;
    font-size: 13px;
}

.field-eds__doc-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    margin-left: auto;
}

.field-eds__doc {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field-eds__reset-confirm {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border: 1px solid color-mix(in srgb, var(--tblr-danger) 28%, var(--tblr-border-color));
    border-radius: 10px;
    background: color-mix(in srgb, var(--tblr-danger) 5%, #fff);
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}

.field-eds__reset-confirm[hidden] {
    display: none !important;
}

.field-eds__reset-confirm-text {
    font-size: 13px;
    font-weight: 500;
    color: #991b1b;
}

.field-eds__reset-confirm-label {
    margin-bottom: 0;
    font-size: 12px;
    color: #64748b;
}

.field-eds__reset-password {
    display: block !important;
    width: 100% !important;
    min-width: 0;
    max-width: none;
    min-height: var(--app-control-height, 36px);
    opacity: 1 !important;
    visibility: visible !important;
    position: static !important;
    pointer-events: auto !important;
    background: #fff;
}

.field-eds__reset-confirm-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.field-eds__empty {
    display: flex;
    align-items: center;
}

.field-eds__start-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.field-eds__start-btn .field-eds__start-icon,
.field-eds__start-btn svg.feather {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
}

.field-eds__manage {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--tblr-border-color);
    border-radius: 10px;
    background: color-mix(in srgb, var(--tblr-border-color) 18%, #fff);
}

.field-eds__manage[hidden] {
    display: none !important;
}

.field-eds__manage-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.field-eds__manage-title {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

.field-eds__drop {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1.5px dashed color-mix(in srgb, var(--brand-accent, #0B679E) 28%, var(--tblr-border-color));
    border-radius: 10px;
    color: var(--brand-accent, #0B679E);
    cursor: pointer;
    font-size: 13px;
    background: #fff;
}

.field-eds__drop:hover {
    background: color-mix(in srgb, var(--brand-accent, #0B679E) 4%, #fff);
}

.field-eds__file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.field-eds__drop svg.feather {
    width: 16px;
    height: 16px;
}

.field-eds__signers-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.field-eds__signers-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}

@media (max-width: 576px) {
    .field-eds__signers-list {
        grid-template-columns: 1fr;
    }
}

.field-eds__signer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--tblr-border-color);
    border-radius: 8px;
    font-size: 13px;
    min-width: 0;
}

.field-eds__signer-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.field-eds__signer.is-signed {
    border-color: color-mix(in srgb, var(--tblr-success) 30%, transparent);
    background: color-mix(in srgb, var(--tblr-success) 6%, #fff);
}

.field-eds__signer-state {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #64748b;
    white-space: nowrap;
    font-size: 12px;
}

.field-eds__signer-signed-icon {
    width: 14px;
    height: 14px;
    color: var(--tblr-success, #2fb344);
    flex: 0 0 auto;
}

.field-eds__signer-date {
    color: #166534;
}

.field-eds__signer.is-signed .field-eds__signer-state {
    color: #166534;
}

.field-eds__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.field-eds__actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.field-eds__actions .btn svg.feather {
    width: 14px;
    height: 14px;
}

.field-eds__msg {
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
}

.field-eds__msg--error {
    background: color-mix(in srgb, var(--tblr-danger) 8%, #fff);
    color: #991b1b;
}

.field-eds__msg--ok {
    background: color-mix(in srgb, var(--tblr-success) 8%, #fff);
    color: #166534;
}

.field-eds .app-table-icon-actions .btn-icon,
.field-eds .app-table-icon-actions .btn.btn-sm.btn-icon {
    width: 28px;
    height: 28px;
}

/* --- выбор пользователей (поиск + чипы) --- */
.users-picker {
    position: relative;
    width: 100%;
}

.users-picker__control {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-height: var(--app-control-height, 36px);
    padding: 4px 8px;
    border: 1px solid var(--tblr-border-color);
    border-radius: var(--app-control-radius, 6px);
    background: #fff;
    cursor: text;
}

.users-picker__control:focus-within {
    border-color: color-mix(in srgb, var(--brand-accent, #0B679E) 55%, var(--tblr-border-color));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-accent, #0B679E) 12%, transparent);
}

.users-picker__chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.users-picker__chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 4px 8px 4px 10px;
    border-radius: 5px;
    border: 1px solid rgba(15, 45, 66, .16);
    background: #fff;
    color: #16324a;
    font-size: 14px;
    line-height: 1.35;
    position: relative;
    z-index: 1;
}

.users-picker__chip-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #16324a;
}

.users-picker__chip-remove {
    appearance: none;
    border: 0;
    background: transparent;
    color: #64748b;
    width: 18px;
    height: 18px;
    line-height: 1;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    flex: 0 0 auto;
}

.users-picker__chip-remove:hover {
    background: color-mix(in srgb, var(--tblr-danger) 12%, #fff);
    color: #991b1b;
}

.users-picker__search {
    flex: 1 1 140px;
    min-width: 120px;
    border: 0 !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 4px 2px !important;
    min-height: 26px;
    font-size: 14px;
    line-height: 1.35;
}

.users-picker__dropdown {
    position: absolute;
    z-index: 1055;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    max-height: 240px;
    overflow: auto;
    padding: 4px;
    border: 1px solid var(--tblr-border-color);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.users-picker__dropdown--portal {
    position: fixed;
    right: auto;
    z-index: 2000;
}

.users-picker__options {
    display: none !important;
}

.users-picker__dropdown[hidden] {
    display: none !important;
}

.users-picker__option {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    padding: 9px 12px;
    border-radius: 6px;
    font-size: 14px;
    color: #16324a;
    cursor: pointer;
}

.users-picker__option:hover,
.users-picker__option.is-active {
    background: color-mix(in srgb, var(--brand-accent, #0B679E) 10%, #fff);
}

.users-picker__empty {
    padding: 10px;
    font-size: 12px;
    color: #64748b;
}

/* --- комментарии записи (чат) --- */
.item-comments {
    overflow: hidden;
}

.item-comments__head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px 0;
}

.item-comments__title {
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    text-transform: none;
    letter-spacing: 0;
}

.item-comments__count {
    font-size: 12px;
    color: #94a3b8;
}

.item-comments__count.is-empty {
    display: none;
}

.item-comments__trigger-wrap {
    padding: 10px 12px;
}

.item-comments__trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    appearance: none;
    border: 0;
    background: transparent;
    padding: 0;
    color: #334155;
    font-size: 14px;
    cursor: pointer;
}

.item-comments__trigger:hover {
    color: var(--brand-accent, #0B679E);
}

.item-comments__trigger-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    color: inherit;
}

.item-comments__trigger-label {
    font-weight: 500;
}

.item-comments--collapsed .item-comments__body[hidden],
.item-comments__body[hidden] {
    display: none !important;
}

/* --- плавающий чат справа --- */
.item-comments-chat {
    position: static;
}

.item-comments-fab {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 1040;
    appearance: none;
    border: 0;
    background: transparent;
    padding: 6px;
    margin: 0;
    color: #94a3b8;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: color .15s ease;
}

.item-comments-fab:hover {
    color: #64748b;
}

.item-comments-chat.is-open .item-comments-fab,
.item-comments-fab.has-unread {
    color: var(--brand-accent, #0B679E);
}

.item-comments-fab.has-unread {
    animation: item-comments-fab-blink 1.4s ease-in-out infinite;
}

.item-comments-chat.is-open .item-comments-fab.has-unread {
    animation: none;
}

@keyframes item-comments-fab-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: .35; }
}

.item-comments-fab__icon {
    width: 24px;
    height: 24px;
    flex: 0 0 auto;
}

.item-comments-fab__badge {
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    color: inherit;
}

.item-comments-fab__badge.is-empty {
    display: none;
}

.item-comments-drawer {
    position: fixed;
    inset: 0;
    z-index: 1050;
    pointer-events: none;
}

.item-comments-drawer.is-open {
    pointer-events: auto;
}

.item-comments-drawer[hidden] {
    display: none !important;
}

.item-comments-drawer.is-open[hidden] {
    display: block !important;
}

.item-comments-drawer__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .28);
    opacity: 0;
    transition: opacity .25s ease;
}

.item-comments-drawer.is-open .item-comments-drawer__backdrop {
    opacity: 1;
}

.item-comments-drawer__panel {
    position: absolute;
    top: 0;
    right: 0;
    width: min(420px, 100vw);
    height: 100%;
    background: #fff;
    box-shadow: -12px 0 40px rgba(15, 23, 42, .18);
    display: flex;
    flex-direction: column;
    transform: translateX(104%);
    transition: transform .28s cubic-bezier(.22, 1, .36, 1);
}

.item-comments-drawer.is-open .item-comments-drawer__panel {
    transform: translateX(0);
}

.item-comments-drawer__head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #eef2f7;
}

.item-comments-drawer__title-wrap {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
}

.item-comments-drawer__title {
    font-size: 15px;
    font-weight: 400;
    color: #0f172a;
}

.item-comments-drawer__count {
    font-size: 12px;
    color: #94a3b8;
}

.item-comments-drawer__count.is-empty {
    display: none;
}

.item-comments-drawer__close {
    appearance: none;
    border: 0;
    background: transparent;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: #64748b;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.item-comments-drawer__close:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.item-comments-drawer__body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1 1 auto;
    min-height: 0;
    padding: 12px 14px;
    overflow: hidden;
    background:
        linear-gradient(180deg, #f8fafc 0%, #fff 48px);
}

.item-comments-drawer__body .item-comments__list {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow: auto;
    padding: 2px 2px 8px;
}

.item-comments-drawer__footer {
    flex: 0 0 auto;
    padding: 12px 14px 14px;
    border-top: 1px solid #eef2f7;
    background: #fff;
}

.item-comments-drawer__footer .item-comments__composer {
    width: 100%;
    margin: 0;
}

@media (max-width: 575.98px) {
    .item-comments-fab {
        right: 12px;
        bottom: 12px;
    }

    .item-comments-drawer__panel {
        width: 100vw;
    }
}

.item-comments__body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 12px 12px;
}

.item-comments__list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 360px;
    overflow: auto;
}

.item-comments__empty {
    padding: 16px 8px;
    text-align: center;
    font-size: 13px;
    color: #94a3b8;
}

.item-comments__more {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--brand-accent, #0B679E);
    font-size: 12px;
    padding: 0;
    text-align: left;
    cursor: pointer;
    flex: 0 0 auto;
}

.item-comments__more:hover {
    text-decoration: underline;
}

.item-comments__older {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.item-comments__older[hidden] {
    display: none !important;
}

.item-comments__item {
    display: flex;
    justify-content: flex-start;
    width: 100%;
    min-width: 0;
}

.item-comments__item.is-mine {
    justify-content: flex-end;
}

.item-comments__bubble {
    max-width: min(92%, 420px);
    min-width: 0;
    box-sizing: border-box;
    padding: 8px 10px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #eef2f7;
}

.item-comments__item.is-mine .item-comments__bubble {
    background: color-mix(in srgb, var(--brand-accent, #0B679E) 6%, #fff);
    border-color: color-mix(in srgb, var(--brand-accent, #0B679E) 14%, #eef2f7);
}

.item-comments__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
    min-height: 16px;
    min-width: 0;
}

.item-comments__author {
    font-size: 12px;
    font-weight: 400;
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.item-comments__date {
    font-size: 11px;
    color: #94a3b8;
    flex: 0 0 auto;
}

.item-comments__delete {
    appearance: none;
    margin-left: auto;
    border: 0;
    background: transparent;
    color: #94a3b8;
    width: 18px;
    height: 18px;
    padding: 0;
    line-height: 1;
    font-size: 16px;
    cursor: pointer;
    opacity: 0;
}

.item-comments__item:hover .item-comments__delete,
.item-comments__item:focus-within .item-comments__delete {
    opacity: 1;
}

.item-comments__delete:hover {
    color: #dc2626;
}

.item-comments__text {
    font-size: 13px;
    font-weight: 400;
    line-height: 1.4;
    color: #334155;
    white-space: pre-wrap;
    word-break: break-word;
}

.item-comments__composer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: end;
}

.item-comments__input {
    width: 100%;
    min-height: 34px;
    max-height: 110px;
    resize: none;
    border: 1px solid var(--tblr-border-color);
    border-radius: 8px;
    background: #fff;
    padding: 7px 10px;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.35;
    color: #0f172a;
    outline: none;
    box-shadow: none;
}

.item-comments__input:focus {
    border-color: color-mix(in srgb, var(--brand-accent, #0B679E) 40%, var(--tblr-border-color));
    box-shadow: none;
}

.item-comments__input::placeholder {
    color: #94a3b8;
}

.item-comments__send {
    white-space: nowrap;
}

.item-comments__error {
    grid-column: 1 / -1;
    margin: 0;
    font-size: 12px;
    color: #b91c1c;
}

/* SQL-поле на странице записи */
.field-sql-query__table-wrap {
    border: 1px solid rgba(15, 23, 42, .06);
    border-radius: 8px;
    overflow: auto;
    background: #fff;
}

.field-sql-query__table {
    width: 100%;
    margin: 0;
    table-layout: fixed;
    --bs-table-striped-bg: rgba(248, 250, 252, .65);
}

.field-sql-query__table thead th {
    font-size: 12px;
    font-weight: 500;
    color: #94a3b8;
    background: transparent;
    text-transform: none;
    letter-spacing: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-bottom-color: rgba(15, 23, 42, .06) !important;
    padding-top: .55rem;
    padding-bottom: .45rem;
}

.field-sql-query__table td {
    vertical-align: middle;
    overflow: hidden;
    color: #334155;
    border-bottom-color: rgba(15, 23, 42, .05) !important;
    padding-top: .42rem;
    padding-bottom: .42rem;
}

.field-sql-query__table tbody tr:last-child td {
    border-bottom-color: transparent !important;
}

.field-sql-query__cell {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.field-sql-query__th--num,
.field-sql-query__td--num,
.field-sql-query__total-value {
    text-align: right;
}

.field-sql-query__td--num .field-sql-query__cell,
.field-sql-query__total-value .field-sql-query__cell {
    font-variant-numeric: tabular-nums;
}

.field-sql-query__table tfoot td {
    border-top: 1px solid rgba(15, 23, 42, .08);
    background: transparent;
    font-size: 13px;
    vertical-align: middle;
    padding-top: .55rem;
    padding-bottom: .55rem;
}

.field-sql-query__total-label {
    font-weight: 500;
    color: #94a3b8;
}

.field-sql-query__total-value {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: #0f172a;
}

.field-sql-query__pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
    padding: 0 2px;
}

.field-sql-query__pager-info {
    font-size: 12px;
}

.field-sql-query__stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.field-sql-query__stat {
    flex: 1 1 140px;
    min-width: 120px;
    max-width: 240px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid var(--app-table-border, var(--tblr-border-color));
    border-radius: 8px;
}

.field-sql-query__stat-label {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 4px;
}

.field-sql-query__stat-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--tblr-body-color);
    line-height: 1.25;
    word-break: break-word;
}

.field-sql-query__cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field-sql-query__card {
    padding: 10px 12px;
    background: #fff;
    border: 1px solid var(--app-table-border, var(--tblr-border-color));
    border-radius: 8px;
}

.field-sql-query__card-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 3px 0;
    font-size: 13px;
}

.field-sql-query__card-key {
    color: #64748b;
    flex-shrink: 0;
}

.field-sql-query__card-val {
    text-align: right;
    font-weight: 500;
    word-break: break-word;
}

.info-field-cell--sql {
    min-width: 0;
}


/* --- каталог модулей --- */
.modules-catalog {
    --modules-ink: #0f2d42;
    --modules-muted: #6b8498;
    --modules-line: #e4edf3;
    --modules-accent: var(--brand-accent, #0b679e);
    margin: 4px 0 28px;
}

.modules-catalog__empty {
    padding: 36px 16px;
    text-align: center;
    color: var(--modules-muted);
    font-size: 14px;
}

.modules-panel {
    border: 1px solid var(--modules-line);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 45, 66, .04);
    overflow: hidden;
}

.modules-panel__summary {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--modules-line);
    background: linear-gradient(180deg, #f8fbfd 0%, #fff 100%);
}

.modules-panel__summary-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex-shrink: 0;
}

.modules-panel__summary-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--modules-muted);
}

.modules-panel__summary-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--modules-ink);
}

.modules-panel__meter {
    flex: 1 1 auto;
    height: 6px;
    border-radius: 999px;
    background: #e8f0f5;
    overflow: hidden;
    min-width: 120px;
}

.modules-panel__meter-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #5a9fc4, var(--modules-accent));
    transition: width .35s ease;
}

.modules-panel__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.modules-panel__item {
    min-width: 0;
}

.modules-panel__item:not(:nth-child(3n)) {
    border-right: 1px solid var(--modules-line);
}

.modules-panel__item:nth-child(n + 4) {
    border-top: 1px solid var(--modules-line);
}

.modules-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto;
    align-items: start;
    gap: 4px 12px;
    padding: 12px 14px;
    text-decoration: none !important;
    color: var(--modules-ink);
    transition: background .15s ease;
    height: 100%;
    box-sizing: border-box;
}

.modules-row:hover {
    background: #f6fafc;
    color: var(--modules-ink);
}

.modules-row:focus-visible {
    outline: 2px solid var(--modules-accent);
    outline-offset: -2px;
}

.modules-row__icon {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: center;
    position: relative;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(11, 103, 158, .09);
    color: var(--modules-accent);
}

.modules-row.is-off .modules-row__icon {
    background: #eef3f7;
    color: #7a93a6;
}

.modules-row.is-on .modules-row__icon::after {
    content: '';
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22a05a;
    border: 1.5px solid #fff;
}

.modules-row__icon svg.feather,
.modules-row__icon .icon-svg {
    width: 18px;
    height: 18px;
}

.modules-row__icon .icon-svg--max {
    width: 22px !important;
    height: 15px !important;
}

.modules-row__main {
    grid-column: 2;
    grid-row: 1 / span 2;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    align-self: center;
}

.modules-row__title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.25;
    color: var(--modules-ink);
}

.modules-row__desc {
    font-size: 12px;
    line-height: 1.35;
    color: var(--modules-muted);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.modules-row__status {
    display: none;
}

.modules-row__chevron {
    grid-column: 3;
    grid-row: 1 / span 2;
    align-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #a8bcc9;
    transition: transform .15s ease, color .15s ease;
}

.modules-row__chevron svg.feather {
    width: 16px;
    height: 16px;
}

.modules-row:hover .modules-row__chevron {
    color: var(--modules-accent);
    transform: translateX(2px);
}

@media (max-width: 1100px) {
    .modules-panel__list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .modules-panel__item:not(:nth-child(3n)) {
        border-right: none;
    }

    .modules-panel__item:nth-child(n + 4) {
        border-top: none;
    }

    .modules-panel__item:nth-child(odd) {
        border-right: 1px solid var(--modules-line);
    }

    .modules-panel__item:nth-child(n + 3) {
        border-top: 1px solid var(--modules-line);
    }
}

@media (max-width: 768px) {
    .modules-panel__summary {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .modules-panel__list {
        grid-template-columns: 1fr;
    }

    .modules-panel__item:nth-child(odd) {
        border-right: none;
    }

    .modules-panel__item:nth-child(n + 3) {
        border-top: none;
    }

    .modules-panel__item + .modules-panel__item {
        border-top: 1px solid var(--modules-line);
    }
}

@media (prefers-reduced-motion: reduce) {
    .modules-row,
    .modules-row__chevron,
    .modules-panel__meter-fill {
        transition: none;
    }
}

/* --- визуальный редактор фильтров (entities/filters) --- */
.filter-editor {
    margin-bottom: 8px;
}

.filter-editor__preview-wrap {
    margin-bottom: 14px;
}

.filter-editor__preview {
    margin-bottom: 0;
}

.filter-editor__preview .items-filters__form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.filter-editor__fields {
    flex-wrap: wrap;
}

.filter-editor__field {
    position: relative;
    cursor: grab;
    transition: box-shadow .15s ease, outline-color .15s ease;
}

/* disabled/readonly controls глотают click — клик должен попадать в поле для инспектора */
.filter-editor__preview .filter-editor__field input,
.filter-editor__preview .filter-editor__field select,
.filter-editor__preview .filter-editor__field textarea,
.filter-editor__preview .filter-editor__field .field-layout-input-addon,
.filter-editor__preview .filter-editor__field .items-filters__period-sep {
    pointer-events: none;
}

.filter-editor__field.is-selected {
    outline: 2px solid color-mix(in srgb, var(--brand-accent, #0b679e) 55%, transparent);
    outline-offset: 1px;
    border-radius: 8px;
    z-index: 2;
}

.filter-editor__field.is-dragging {
    opacity: .45;
}

.filter-editor__resize {
    position: absolute;
    top: 4px;
    right: 0;
    bottom: 4px;
    width: 8px;
    cursor: ew-resize;
    border-radius: 0 6px 6px 0;
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--brand-accent, #0b679e) 18%, transparent));
    opacity: 0;
    transition: opacity .15s ease;
}

.filter-editor__field:hover .filter-editor__resize,
.filter-editor__field.is-selected .filter-editor__resize {
    opacity: 1;
}

.filter-editor__empty {
    margin: 10px 0 0;
    font-size: 13px;
    color: #8aa0b0;
    text-align: center;
}

.filter-editor__inspector {
    margin-bottom: 14px;
    padding: 14px 16px;
    border: 1px solid #dce8ef;
    border-radius: 12px;
    background: linear-gradient(180deg, #f8fbfd 0%, #fff 100%);
}

.filter-editor__inspector-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.filter-editor__inspector-remove {
    border: none;
    background: transparent;
    color: #c45c5c;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
}

.filter-editor__inspector-remove:hover {
    text-decoration: underline;
}

.filter-editor__inspector-grid {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 10px 14px;
    align-items: center;
}

.filter-editor__label {
    margin: 0;
    font-size: 13px;
    color: #5a7388;
}

.filter-editor__width {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-editor__width input[type="range"] {
    flex: 1 1 auto;
    min-width: 0;
}

.filter-editor__width output {
    min-width: 36px;
    font-size: 13px;
    font-weight: 600;
    color: #0f2d42;
    text-align: right;
}

.filter-editor__pool {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    margin-bottom: 14px;
    padding: 12px 14px;
    border: 1px dashed #d5e3ec;
    border-radius: 10px;
    background: #fafcfd;
}

.filter-editor__pool-label {
    font-size: 13px;
    color: #6b8498;
    font-weight: 500;
}

.filter-editor__pool-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.filter-editor__pool-btn {
    border: 1px solid #d5e3ec;
    border-radius: 999px;
    background: #fff;
    color: #334155;
    font-size: 12px;
    font-weight: 500;
    padding: 5px 12px;
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease, background .15s ease;
}

.filter-editor__pool-btn:hover {
    border-color: color-mix(in srgb, var(--brand-accent, #0b679e) 35%, #d5e3ec);
    color: var(--brand-accent, #0b679e);
    background: #f6fbfe;
}

.filter-editor__footer {
    margin-top: 4px;
}

.filter-editor--resizing {
    cursor: ew-resize;
    user-select: none;
}

.filter-editor--resizing .filter-editor__field {
    cursor: ew-resize;
}

.items-filters__field .field-layout-input-icon-wrap--group {
    width: 100%;
    --items-filter-control-height: 30px;
}

.items-filters__field .field-layout-input-icon-wrap--group .field-layout-input-addon {
    min-height: var(--items-filter-control-height);
    height: var(--items-filter-control-height);
    box-sizing: border-box;
    padding: 0 .55rem;
    min-width: 2.1rem;
}

.items-filters__field .field-layout-input-icon-wrap--group .field-layout-input-body {
    flex: 1 1 auto;
    min-width: 0;
}

.items-filters__field .field-layout-input-icon-wrap--group .field-layout-input-body > .form-control,
.items-filters__field .field-layout-input-icon-wrap--group .field-layout-input-body > .form-select {
    min-height: var(--items-filter-control-height);
    height: var(--items-filter-control-height);
    padding-top: 0;
    padding-bottom: 0;
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
    border-top-right-radius: 6px !important;
    border-bottom-right-radius: 6px !important;
}

.items-filters__field .field-layout-input-icon-wrap--group .field-layout-input-addon .field-layout-icon-svg svg,
.items-filters__field .field-layout-input-icon-wrap--group .field-layout-input-addon [data-feather] {
    width: 15px;
    height: 15px;
}

/* Переключатель да/нет: подпись рисуется отдельно, без пустого label внутри */
.form-check.form-switch.form-switch--solo {
    display: inline-flex;
    align-items: center;
    align-self: center;
    padding-left: 0;
    min-height: 0;
    margin-bottom: 0;
}

.form-check.form-switch.form-switch--solo .form-check-input {
    margin: 0;
    float: none;
}

.field-form-boolean-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    min-height: var(--app-control-height, 30px);
    width: 100%;
}

.field-form-boolean-row.field-form-boolean-align--top,
.field-form-boolean-stack.field-form-boolean-align--top {
    align-items: flex-start;
}

.field-form-boolean-row.field-form-boolean-align--center,
.field-form-boolean-stack.field-form-boolean-align--center {
    align-items: center;
}

.field-form-boolean-row.field-form-boolean-align--bottom,
.field-form-boolean-stack.field-form-boolean-align--bottom {
    align-items: flex-end;
}

.field-form-boolean-stack {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    width: 100%;
}

.field-form-boolean-stack--label-top .field-form-boolean-row__label .form-label,
.field-form-boolean-stack--label-bottom .field-form-boolean-row__label .form-label {
    margin-bottom: 0;
}

.field-form-boolean-row__label {
    flex: 1 1 auto;
    min-width: 0;
}

.field-form-boolean-row__label .form-label {
    margin-bottom: 0;
}

.field-form-boolean-row__control {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}

.fd-field-preview .field-form-boolean-row,
.fd-field-preview .field-form-boolean-stack {
    padding-right: 4px;
}

.fd-field-preview[data-label-position="left"] .form-check.form-switch {
    display: inline-flex;
    align-items: center;
    padding-left: 0;
    min-height: 0;
    margin-bottom: 0;
}

.fd-field-preview[data-label-position="left"] .form-check.form-switch .form-check-input {
    margin: 0;
    float: none;
}

.fd-field-preview[data-label-position="left"] .form-check.form-switch .form-check-label:empty {
    display: none;
}

/* Сетка полей 24 колонки (~4% шаг): форма и страница записи */
@media (min-width: 768px) {
    :is(
        form .row.g-3,
        .item-page .row.g-3,
        .item-page .row.g-1,
        .item-page .info-layout-section .row,
        .item-page .info-layout-collapsible__body .row,
        .item-page .info-layout-collapsible__pinned .row,
        .row.g-3
    ) > [class*="col-grid-"] {
        flex: 0 0 auto;
    }
    :is(
        form .row.g-3,
        .item-page .row.g-3,
        .item-page .row.g-1,
        .item-page .info-layout-section .row,
        .item-page .info-layout-collapsible__body .row,
        .item-page .info-layout-collapsible__pinned .row,
        .row.g-3
    ) > .col-grid-1 { width: calc(100% / 24 * 1); }
    :is(
        form .row.g-3,
        .item-page .row.g-3,
        .item-page .row.g-1,
        .item-page .info-layout-section .row,
        .item-page .info-layout-collapsible__body .row,
        .item-page .info-layout-collapsible__pinned .row,
        .row.g-3
    ) > .col-grid-2 { width: calc(100% / 24 * 2); }
    :is(
        form .row.g-3,
        .item-page .row.g-3,
        .item-page .row.g-1,
        .item-page .info-layout-section .row,
        .item-page .info-layout-collapsible__body .row,
        .item-page .info-layout-collapsible__pinned .row,
        .row.g-3
    ) > .col-grid-3 { width: calc(100% / 24 * 3); }
    :is(
        form .row.g-3,
        .item-page .row.g-3,
        .item-page .row.g-1,
        .item-page .info-layout-section .row,
        .item-page .info-layout-collapsible__body .row,
        .item-page .info-layout-collapsible__pinned .row,
        .row.g-3
    ) > .col-grid-4 { width: calc(100% / 24 * 4); }
    :is(
        form .row.g-3,
        .item-page .row.g-3,
        .item-page .row.g-1,
        .item-page .info-layout-section .row,
        .item-page .info-layout-collapsible__body .row,
        .item-page .info-layout-collapsible__pinned .row,
        .row.g-3
    ) > .col-grid-5 { width: calc(100% / 24 * 5); }
    :is(
        form .row.g-3,
        .item-page .row.g-3,
        .item-page .row.g-1,
        .item-page .info-layout-section .row,
        .item-page .info-layout-collapsible__body .row,
        .item-page .info-layout-collapsible__pinned .row,
        .row.g-3
    ) > .col-grid-6 { width: calc(100% / 24 * 6); }
    :is(
        form .row.g-3,
        .item-page .row.g-3,
        .item-page .row.g-1,
        .item-page .info-layout-section .row,
        .item-page .info-layout-collapsible__body .row,
        .item-page .info-layout-collapsible__pinned .row,
        .row.g-3
    ) > .col-grid-7 { width: calc(100% / 24 * 7); }
    :is(
        form .row.g-3,
        .item-page .row.g-3,
        .item-page .row.g-1,
        .item-page .info-layout-section .row,
        .item-page .info-layout-collapsible__body .row,
        .item-page .info-layout-collapsible__pinned .row,
        .row.g-3
    ) > .col-grid-8 { width: calc(100% / 24 * 8); }
    :is(
        form .row.g-3,
        .item-page .row.g-3,
        .item-page .row.g-1,
        .item-page .info-layout-section .row,
        .item-page .info-layout-collapsible__body .row,
        .item-page .info-layout-collapsible__pinned .row,
        .row.g-3
    ) > .col-grid-9 { width: calc(100% / 24 * 9); }
    :is(
        form .row.g-3,
        .item-page .row.g-3,
        .item-page .row.g-1,
        .item-page .info-layout-section .row,
        .item-page .info-layout-collapsible__body .row,
        .item-page .info-layout-collapsible__pinned .row,
        .row.g-3
    ) > .col-grid-10 { width: calc(100% / 24 * 10); }
    :is(
        form .row.g-3,
        .item-page .row.g-3,
        .item-page .row.g-1,
        .item-page .info-layout-section .row,
        .item-page .info-layout-collapsible__body .row,
        .item-page .info-layout-collapsible__pinned .row,
        .row.g-3
    ) > .col-grid-11 { width: calc(100% / 24 * 11); }
    :is(
        form .row.g-3,
        .item-page .row.g-3,
        .item-page .row.g-1,
        .item-page .info-layout-section .row,
        .item-page .info-layout-collapsible__body .row,
        .item-page .info-layout-collapsible__pinned .row,
        .row.g-3
    ) > .col-grid-12 { width: calc(100% / 24 * 12); }
    :is(
        form .row.g-3,
        .item-page .row.g-3,
        .item-page .row.g-1,
        .item-page .info-layout-section .row,
        .item-page .info-layout-collapsible__body .row,
        .item-page .info-layout-collapsible__pinned .row,
        .row.g-3
    ) > .col-grid-13 { width: calc(100% / 24 * 13); }
    :is(
        form .row.g-3,
        .item-page .row.g-3,
        .item-page .row.g-1,
        .item-page .info-layout-section .row,
        .item-page .info-layout-collapsible__body .row,
        .item-page .info-layout-collapsible__pinned .row,
        .row.g-3
    ) > .col-grid-14 { width: calc(100% / 24 * 14); }
    :is(
        form .row.g-3,
        .item-page .row.g-3,
        .item-page .row.g-1,
        .item-page .info-layout-section .row,
        .item-page .info-layout-collapsible__body .row,
        .item-page .info-layout-collapsible__pinned .row,
        .row.g-3
    ) > .col-grid-15 { width: calc(100% / 24 * 15); }
    :is(
        form .row.g-3,
        .item-page .row.g-3,
        .item-page .row.g-1,
        .item-page .info-layout-section .row,
        .item-page .info-layout-collapsible__body .row,
        .item-page .info-layout-collapsible__pinned .row,
        .row.g-3
    ) > .col-grid-16 { width: calc(100% / 24 * 16); }
    :is(
        form .row.g-3,
        .item-page .row.g-3,
        .item-page .row.g-1,
        .item-page .info-layout-section .row,
        .item-page .info-layout-collapsible__body .row,
        .item-page .info-layout-collapsible__pinned .row,
        .row.g-3
    ) > .col-grid-17 { width: calc(100% / 24 * 17); }
    :is(
        form .row.g-3,
        .item-page .row.g-3,
        .item-page .row.g-1,
        .item-page .info-layout-section .row,
        .item-page .info-layout-collapsible__body .row,
        .item-page .info-layout-collapsible__pinned .row,
        .row.g-3
    ) > .col-grid-18 { width: calc(100% / 24 * 18); }
    :is(
        form .row.g-3,
        .item-page .row.g-3,
        .item-page .row.g-1,
        .item-page .info-layout-section .row,
        .item-page .info-layout-collapsible__body .row,
        .item-page .info-layout-collapsible__pinned .row,
        .row.g-3
    ) > .col-grid-19 { width: calc(100% / 24 * 19); }
    :is(
        form .row.g-3,
        .item-page .row.g-3,
        .item-page .row.g-1,
        .item-page .info-layout-section .row,
        .item-page .info-layout-collapsible__body .row,
        .item-page .info-layout-collapsible__pinned .row,
        .row.g-3
    ) > .col-grid-20 { width: calc(100% / 24 * 20); }
    :is(
        form .row.g-3,
        .item-page .row.g-3,
        .item-page .row.g-1,
        .item-page .info-layout-section .row,
        .item-page .info-layout-collapsible__body .row,
        .item-page .info-layout-collapsible__pinned .row,
        .row.g-3
    ) > .col-grid-21 { width: calc(100% / 24 * 21); }
    :is(
        form .row.g-3,
        .item-page .row.g-3,
        .item-page .row.g-1,
        .item-page .info-layout-section .row,
        .item-page .info-layout-collapsible__body .row,
        .item-page .info-layout-collapsible__pinned .row,
        .row.g-3
    ) > .col-grid-22 { width: calc(100% / 24 * 22); }
    :is(
        form .row.g-3,
        .item-page .row.g-3,
        .item-page .row.g-1,
        .item-page .info-layout-section .row,
        .item-page .info-layout-collapsible__body .row,
        .item-page .info-layout-collapsible__pinned .row,
        .row.g-3
    ) > .col-grid-23 { width: calc(100% / 24 * 23); }
    :is(
        form .row.g-3,
        .item-page .row.g-3,
        .item-page .row.g-1,
        .item-page .info-layout-section .row,
        .item-page .info-layout-collapsible__body .row,
        .item-page .info-layout-collapsible__pinned .row,
        .row.g-3
    ) > .col-grid-24 { width: 100%; }
}

/* Страница записи: доли col-grid без col-12, совпадают с редактором */
.item-page .info-field-col[class*="col-grid-"],
.item-page .row.g-1 > [class*="col-grid-"],
.item-page .info-layout-section .row > [class*="col-grid-"],
.item-page .info-layout-collapsible__body .row > [class*="col-grid-"],
.item-page .info-layout-collapsible__pinned .row > [class*="col-grid-"] {
    width: 100%;
    flex: 0 0 100%;
    max-width: 100%;
}
@media (min-width: 768px) {
    :is(.item-page .row.g-1,
    .item-page .info-layout-section .row,
    .item-page .info-layout-collapsible__body .row,
    .item-page .info-layout-collapsible__pinned .row,
    .item-page .info-layout-root.row) > .col-grid-1 {
        flex: 0 0 calc(100% / 24 * 1);
        width: calc(100% / 24 * 1);
        max-width: calc(100% / 24 * 1);
    }
    :is(.item-page .row.g-1,
    .item-page .info-layout-section .row,
    .item-page .info-layout-collapsible__body .row,
    .item-page .info-layout-collapsible__pinned .row,
    .item-page .info-layout-root.row) > .col-grid-2 {
        flex: 0 0 calc(100% / 24 * 2);
        width: calc(100% / 24 * 2);
        max-width: calc(100% / 24 * 2);
    }
    :is(.item-page .row.g-1,
    .item-page .info-layout-section .row,
    .item-page .info-layout-collapsible__body .row,
    .item-page .info-layout-collapsible__pinned .row,
    .item-page .info-layout-root.row) > .col-grid-3 {
        flex: 0 0 calc(100% / 24 * 3);
        width: calc(100% / 24 * 3);
        max-width: calc(100% / 24 * 3);
    }
    :is(.item-page .row.g-1,
    .item-page .info-layout-section .row,
    .item-page .info-layout-collapsible__body .row,
    .item-page .info-layout-collapsible__pinned .row,
    .item-page .info-layout-root.row) > .col-grid-4 {
        flex: 0 0 calc(100% / 24 * 4);
        width: calc(100% / 24 * 4);
        max-width: calc(100% / 24 * 4);
    }
    :is(.item-page .row.g-1,
    .item-page .info-layout-section .row,
    .item-page .info-layout-collapsible__body .row,
    .item-page .info-layout-collapsible__pinned .row,
    .item-page .info-layout-root.row) > .col-grid-5 {
        flex: 0 0 calc(100% / 24 * 5);
        width: calc(100% / 24 * 5);
        max-width: calc(100% / 24 * 5);
    }
    :is(.item-page .row.g-1,
    .item-page .info-layout-section .row,
    .item-page .info-layout-collapsible__body .row,
    .item-page .info-layout-collapsible__pinned .row,
    .item-page .info-layout-root.row) > .col-grid-6 {
        flex: 0 0 calc(100% / 24 * 6);
        width: calc(100% / 24 * 6);
        max-width: calc(100% / 24 * 6);
    }
    :is(.item-page .row.g-1,
    .item-page .info-layout-section .row,
    .item-page .info-layout-collapsible__body .row,
    .item-page .info-layout-collapsible__pinned .row,
    .item-page .info-layout-root.row) > .col-grid-7 {
        flex: 0 0 calc(100% / 24 * 7);
        width: calc(100% / 24 * 7);
        max-width: calc(100% / 24 * 7);
    }
    :is(.item-page .row.g-1,
    .item-page .info-layout-section .row,
    .item-page .info-layout-collapsible__body .row,
    .item-page .info-layout-collapsible__pinned .row,
    .item-page .info-layout-root.row) > .col-grid-8 {
        flex: 0 0 calc(100% / 24 * 8);
        width: calc(100% / 24 * 8);
        max-width: calc(100% / 24 * 8);
    }
    :is(.item-page .row.g-1,
    .item-page .info-layout-section .row,
    .item-page .info-layout-collapsible__body .row,
    .item-page .info-layout-collapsible__pinned .row,
    .item-page .info-layout-root.row) > .col-grid-9 {
        flex: 0 0 calc(100% / 24 * 9);
        width: calc(100% / 24 * 9);
        max-width: calc(100% / 24 * 9);
    }
    :is(.item-page .row.g-1,
    .item-page .info-layout-section .row,
    .item-page .info-layout-collapsible__body .row,
    .item-page .info-layout-collapsible__pinned .row,
    .item-page .info-layout-root.row) > .col-grid-10 {
        flex: 0 0 calc(100% / 24 * 10);
        width: calc(100% / 24 * 10);
        max-width: calc(100% / 24 * 10);
    }
    :is(.item-page .row.g-1,
    .item-page .info-layout-section .row,
    .item-page .info-layout-collapsible__body .row,
    .item-page .info-layout-collapsible__pinned .row,
    .item-page .info-layout-root.row) > .col-grid-11 {
        flex: 0 0 calc(100% / 24 * 11);
        width: calc(100% / 24 * 11);
        max-width: calc(100% / 24 * 11);
    }
    :is(.item-page .row.g-1,
    .item-page .info-layout-section .row,
    .item-page .info-layout-collapsible__body .row,
    .item-page .info-layout-collapsible__pinned .row,
    .item-page .info-layout-root.row) > .col-grid-12 {
        flex: 0 0 calc(100% / 24 * 12);
        width: calc(100% / 24 * 12);
        max-width: calc(100% / 24 * 12);
    }
    :is(.item-page .row.g-1,
    .item-page .info-layout-section .row,
    .item-page .info-layout-collapsible__body .row,
    .item-page .info-layout-collapsible__pinned .row,
    .item-page .info-layout-root.row) > .col-grid-13 {
        flex: 0 0 calc(100% / 24 * 13);
        width: calc(100% / 24 * 13);
        max-width: calc(100% / 24 * 13);
    }
    :is(.item-page .row.g-1,
    .item-page .info-layout-section .row,
    .item-page .info-layout-collapsible__body .row,
    .item-page .info-layout-collapsible__pinned .row,
    .item-page .info-layout-root.row) > .col-grid-14 {
        flex: 0 0 calc(100% / 24 * 14);
        width: calc(100% / 24 * 14);
        max-width: calc(100% / 24 * 14);
    }
    :is(.item-page .row.g-1,
    .item-page .info-layout-section .row,
    .item-page .info-layout-collapsible__body .row,
    .item-page .info-layout-collapsible__pinned .row,
    .item-page .info-layout-root.row) > .col-grid-15 {
        flex: 0 0 calc(100% / 24 * 15);
        width: calc(100% / 24 * 15);
        max-width: calc(100% / 24 * 15);
    }
    :is(.item-page .row.g-1,
    .item-page .info-layout-section .row,
    .item-page .info-layout-collapsible__body .row,
    .item-page .info-layout-collapsible__pinned .row,
    .item-page .info-layout-root.row) > .col-grid-16 {
        flex: 0 0 calc(100% / 24 * 16);
        width: calc(100% / 24 * 16);
        max-width: calc(100% / 24 * 16);
    }
    :is(.item-page .row.g-1,
    .item-page .info-layout-section .row,
    .item-page .info-layout-collapsible__body .row,
    .item-page .info-layout-collapsible__pinned .row,
    .item-page .info-layout-root.row) > .col-grid-17 {
        flex: 0 0 calc(100% / 24 * 17);
        width: calc(100% / 24 * 17);
        max-width: calc(100% / 24 * 17);
    }
    :is(.item-page .row.g-1,
    .item-page .info-layout-section .row,
    .item-page .info-layout-collapsible__body .row,
    .item-page .info-layout-collapsible__pinned .row,
    .item-page .info-layout-root.row) > .col-grid-18 {
        flex: 0 0 calc(100% / 24 * 18);
        width: calc(100% / 24 * 18);
        max-width: calc(100% / 24 * 18);
    }
    :is(.item-page .row.g-1,
    .item-page .info-layout-section .row,
    .item-page .info-layout-collapsible__body .row,
    .item-page .info-layout-collapsible__pinned .row,
    .item-page .info-layout-root.row) > .col-grid-19 {
        flex: 0 0 calc(100% / 24 * 19);
        width: calc(100% / 24 * 19);
        max-width: calc(100% / 24 * 19);
    }
    :is(.item-page .row.g-1,
    .item-page .info-layout-section .row,
    .item-page .info-layout-collapsible__body .row,
    .item-page .info-layout-collapsible__pinned .row,
    .item-page .info-layout-root.row) > .col-grid-20 {
        flex: 0 0 calc(100% / 24 * 20);
        width: calc(100% / 24 * 20);
        max-width: calc(100% / 24 * 20);
    }
    :is(.item-page .row.g-1,
    .item-page .info-layout-section .row,
    .item-page .info-layout-collapsible__body .row,
    .item-page .info-layout-collapsible__pinned .row,
    .item-page .info-layout-root.row) > .col-grid-21 {
        flex: 0 0 calc(100% / 24 * 21);
        width: calc(100% / 24 * 21);
        max-width: calc(100% / 24 * 21);
    }
    :is(.item-page .row.g-1,
    .item-page .info-layout-section .row,
    .item-page .info-layout-collapsible__body .row,
    .item-page .info-layout-collapsible__pinned .row,
    .item-page .info-layout-root.row) > .col-grid-22 {
        flex: 0 0 calc(100% / 24 * 22);
        width: calc(100% / 24 * 22);
        max-width: calc(100% / 24 * 22);
    }
    :is(.item-page .row.g-1,
    .item-page .info-layout-section .row,
    .item-page .info-layout-collapsible__body .row,
    .item-page .info-layout-collapsible__pinned .row,
    .item-page .info-layout-root.row) > .col-grid-23 {
        flex: 0 0 calc(100% / 24 * 23);
        width: calc(100% / 24 * 23);
        max-width: calc(100% / 24 * 23);
    }
    :is(.item-page .row.g-1,
    .item-page .info-layout-section .row,
    .item-page .info-layout-collapsible__body .row,
    .item-page .info-layout-collapsible__pinned .row,
    .item-page .info-layout-root.row) > .col-grid-24 {
        flex: 0 0 100%;
        width: 100%;
        max-width: 100%;
    }
}

/* Форма: одинаковая высота соседних полей в строке */
form .row.g-3 > [class*="col-md-"],
form .row.g-3 > [class*="col-grid-"],
.item-page .row.g-3 > [class*="col-grid-"],
.item-page .row.g-1 > [class*="col-grid-"],
.item-page .info-layout-section .row > [class*="col-grid-"],
.item-page .info-layout-collapsible__body .row > [class*="col-grid-"],
.item-page .info-layout-collapsible__pinned .row > [class*="col-grid-"] {
    display: flex;
    flex-direction: column;
}

form .row.g-3 > [class*="col-md-"] > div,
form .row.g-3 > [class*="col-grid-"] > div {
    flex: 1 1 auto;
    min-width: 0;
}

.item-page .row.g-3 > [class*="col-grid-"] > div,
.item-page .row.g-1 > [class*="col-grid-"] > div,
.item-page .info-layout-section .row > [class*="col-grid-"] > div,
.item-page .info-layout-collapsible__body .row > [class*="col-grid-"] > div,
.item-page .info-layout-collapsible__pinned .row > [class*="col-grid-"] > div {
    flex: 0 1 auto;
    min-width: 0;
}

@media (max-width: 768px) {
    .filter-editor__inspector-grid {
        grid-template-columns: 1fr;
    }
}

/* --- редактор меню (дерево) --- */
.menu-tree-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}

.menu-tree,
.menu-tree-head {
    --menu-cols: 28px minmax(160px, 1.35fr) minmax(150px, 1fr) minmax(140px, 1fr) 168px 210px 36px;
}

.menu-tree {
    list-style: none;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    overflow: visible;
}

.menu-tree__item,
.menu-tree__group {
    list-style: none;
}

.menu-tree-head,
.menu-tree__row,
.menu-tree__row--group,
.menu-tree__children .menu-tree__row {
    display: grid;
    grid-template-columns: var(--menu-cols);
    gap: 8px;
    align-items: center;
    padding: 8px 0;
}

.menu-tree-head {
    padding: 0 0 6px;
    font-size: 11px;
    color: #7a93a6;
    text-transform: uppercase;
    letter-spacing: .03em;
    border-bottom: 1px solid rgba(15, 45, 66, .1);
    margin-bottom: 4px;
}

.menu-tree__row {
    border-bottom: 1px solid rgba(15, 45, 66, .06);
    background: transparent;
}

.menu-tree__row--group {
    background: rgba(11, 103, 158, .04);
    border-radius: 6px;
    padding-left: 8px;
    padding-right: 8px;
    margin: 2px 0;
    border-bottom-color: transparent;
}

.menu-tree__children {
    list-style: none;
    margin: 0;
    padding: 0;
    background: transparent;
    border-bottom: none;
    min-height: 8px;
}

.menu-tree__children .menu-tree__row {
    background: transparent;
}

.menu-tree__row--nested .menu-tree__main {
    padding-left: 18px;
    position: relative;
}

.menu-tree__row--nested .menu-tree__main::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 50%;
    width: 8px;
    height: 8px;
    border-left: 1px solid #b7c9d6;
    border-bottom: 1px solid #b7c9d6;
    transform: translateY(-30%);
}

.menu-tree__handle {
    cursor: grab;
    color: #8aa0b2;
    font-size: 14px;
    letter-spacing: -2px;
    user-select: none;
    text-align: center;
}

.menu-tree__item.is-dragging,
.menu-tree__group.is-dragging {
    opacity: .45;
}

.menu-tree__item.is-drop-before > .menu-tree__row,
.menu-tree__group.is-drop-before > .menu-tree__row {
    box-shadow: inset 0 2px 0 #0B679E;
}

.menu-tree__item.is-drop-after > .menu-tree__row,
.menu-tree__group.is-drop-after > .menu-tree__row {
    box-shadow: inset 0 -2px 0 #0B679E;
}

.menu-tree__group.is-drop-into {
    outline: 2px solid rgba(11, 103, 158, .45);
    outline-offset: -2px;
}

.menu-tree__main {
    min-width: 0;
}

.menu-tree__title {
    font-size: 13px;
    font-weight: 600;
    color: #0f2d42;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.menu-tree__meta {
    font-size: 11px;
    color: #7a93a6;
}

.menu-tree__group-label {
    font-weight: 600;
}

.menu-tree__field {
    min-width: 0;
}

.menu-tree__field .form-control,
.menu-tree__field .form-select {
    width: 100%;
}

.menu-tree__field--muted {
    color: #a0b3c2;
}

.menu-tree__placeholder {
    display: inline-block;
    padding: 0 4px;
    color: #a0b3c2;
}

.menu-tree__zones {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    min-width: 0;
}

.menu-tree__check {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    font-size: 12px;
    color: #5a7388;
    white-space: nowrap;
    cursor: pointer;
}

.menu-tree__actions {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
}

.menu-tree__field--label input {
    min-width: 0;
}

.menu-tree-hint {
    max-width: none;
    font-size: 13px;
}

.menu-help-steps {
    margin: 6px 0 0;
    padding-left: 1.25rem;
}

.menu-help-steps li {
    margin: 2px 0;
}

.menu-tree__group-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    color: #0B679E;
    background: rgba(11, 103, 158, .1);
    border-radius: 4px;
    padding: 1px 6px;
    margin-bottom: 4px;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.menu-tree__empty {
    list-style: none;
    padding: 10px 12px 12px 46px;
    font-size: 12px;
    color: #8aa0b2;
    font-style: italic;
}

.menu-tree__field--group .form-select {
    min-width: 0;
}

@media (max-width: 1100px) {
    .menu-tree,
    .menu-tree-head {
        --menu-cols: 28px 1fr;
    }

    .menu-tree-head span:nth-child(n+3) {
        display: none;
    }

    .menu-tree__field,
    .menu-tree__zones,
    .menu-tree__actions {
        grid-column: 2;
    }
}

/* --- настройки меню (карточки, как у сущностей) --- */
.menu-tree-editor {
    margin-bottom: 1rem;
}

.menu-tree--menu,
.menu-tree-head--menu,
.menu-tree--menu .menu-tree__row {
    --menu-cols: 28px minmax(140px, 1.2fr) minmax(120px, 0.85fr) minmax(120px, 0.85fr) minmax(120px, 0.9fr) max-content 36px;
}

.menu-tree-head--menu {
    padding: 0 12px 8px;
    margin: 0 0 8px;
    border-bottom: none;
    color: #8a9aab;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: none;
}

.menu-tree--menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.menu-tree--menu > .menu-tree__item,
.menu-tree--menu > .menu-tree__group {
    background: #fff;
    border: 1px solid rgba(15, 45, 66, .08);
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(15, 45, 66, .04);
    overflow: visible;
}

.menu-tree--menu .menu-tree__row,
.menu-tree--menu .menu-tree__row--group,
.menu-tree--menu .menu-tree__children .menu-tree__row {
    position: relative;
    gap: 10px;
    padding: 6px 12px;
    margin: 0;
    border-radius: 0;
    border-bottom: 1px solid rgba(15, 45, 66, .06);
    background: transparent;
    overflow: visible;
}

.menu-tree--menu > .menu-tree__item > .menu-tree__row,
.menu-tree--menu > .menu-tree__group > .menu-tree__row {
    border-bottom: none;
}

.menu-tree--menu > .menu-tree__group.menu-tree__group--parent > .menu-tree__row,
.menu-tree--menu > .menu-tree__group:has(.menu-tree__children .menu-tree__item) > .menu-tree__row {
    border-bottom: 1px solid rgba(15, 45, 66, .06);
}

.menu-tree--menu .menu-tree__row--group {
    background: color-mix(in srgb, var(--brand-accent, #0B679E) 8%, #fff);
}

.menu-tree--menu .menu-tree__row--group:hover {
    background: color-mix(in srgb, var(--brand-accent, #0B679E) 12%, #fff);
}

.menu-tree--menu .menu-tree__row--nested {
    background: transparent;
}

.menu-tree--menu .menu-tree__row--nested:hover {
    background: rgba(15, 45, 66, .025);
}

.menu-tree--menu .menu-tree__children {
    background: #f7fafc;
    min-height: 0;
    overflow: visible;
    border-radius: 0 0 10px 10px;
}

.menu-tree--menu .menu-tree__children > .menu-tree__item:last-child > .menu-tree__row {
    border-bottom: none;
    border-radius: 0 0 10px 10px;
}

.menu-tree--menu .menu-tree__handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 26px;
    color: #9aabb8;
    cursor: grab;
    user-select: none;
    font-size: 0;
    letter-spacing: 0;
}

.menu-tree--menu .menu-tree__grip {
    width: 10px;
    height: 14px;
    background-image: radial-gradient(circle, currentColor 1.1px, transparent 1.25px);
    background-size: 5px 5px;
    background-position: 0 0;
    opacity: .55;
}

.menu-tree--menu .menu-tree__main {
    min-width: 0;
    display: flex;
    align-items: center;
}

.menu-tree--menu .menu-tree__title-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 8px;
    min-width: 0;
    width: 100%;
}

.menu-tree--menu .menu-tree__title {
    font-size: 13.5px;
    font-weight: 600;
    color: #1f2d3a;
    line-height: 1.25;
}

.menu-tree--menu .menu-tree__meta {
    display: inline-flex;
    align-items: baseline;
    margin: 0;
    font-size: 12px;
    color: #8a9aab;
    line-height: 1.25;
}

.menu-tree--menu .menu-tree__group-badge {
    margin: 0;
    flex: 0 0 auto;
}

.menu-tree--menu .menu-tree__group-label {
    flex: 1 1 120px;
    min-width: 100px;
    max-width: 220px;
    height: 28px;
    min-height: 28px;
    padding: 0 8px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
}

.menu-tree--menu .menu-tree__row--nested .menu-tree__main {
    padding-left: 22px;
    position: relative;
}

.menu-tree--menu .menu-tree__row--nested .menu-tree__main::before {
    content: '';
    position: absolute;
    left: 6px;
    top: -10px;
    bottom: 50%;
    width: 12px;
    border-left: 1.5px solid #c5d0db;
    border-bottom: 1.5px solid #c5d0db;
    border-bottom-left-radius: 3px;
    transform: none;
    height: auto;
}

.menu-tree--menu .menu-tree__field .form-control,
.menu-tree--menu .menu-tree__field .form-select,
.menu-tree--menu .menu-tree__field .form-control-sm,
.menu-tree--menu .menu-tree__field .form-select-sm {
    height: 28px;
    min-height: 28px;
    padding-top: 0;
    padding-bottom: 0;
    font-size: 12.5px;
    border-radius: 6px;
}

.menu-tree--menu .menu-tree__zones {
    gap: 6px 10px;
}

.menu-tree--menu .menu-tree__check {
    font-size: 12px;
    color: #5a7388;
}

.menu-tree--menu .menu-tree__actions {
    min-height: 28px;
}

.menu-tree--menu .menu-tree__actions .btn.btn-sm {
    box-sizing: border-box;
    min-width: 28px;
    width: 28px;
    min-height: 28px;
    height: 28px;
    padding: 0;
    border-radius: 6px;
    font-size: 16px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.menu-tree--menu .app-menu-icon-fields {
    gap: 4px;
}

.menu-tree--menu .app-menu-icon-fields__feather,
.menu-tree--menu .app-menu-icon-fields__pick {
    height: 28px;
    min-height: 28px;
}

.menu-tree--menu .app-menu-icon-fields__pick {
    width: 28px;
    min-width: 28px;
    padding: 0;
}

.menu-tree--menu .menu-tree__empty {
    padding: 8px 12px 10px 46px;
    font-size: 12px;
    color: #8aa0b2;
    font-style: italic;
}

.menu-tree--menu .menu-tree__item.is-dragging,
.menu-tree--menu .menu-tree__group.is-dragging {
    opacity: .45;
}

.menu-tree--menu .menu-tree__item.is-drop-before > .menu-tree__row,
.menu-tree--menu .menu-tree__group.is-drop-before > .menu-tree__row {
    box-shadow: inset 0 2px 0 var(--brand-accent, #0B679E);
}

.menu-tree--menu .menu-tree__item.is-drop-after > .menu-tree__row,
.menu-tree--menu .menu-tree__group.is-drop-after > .menu-tree__row {
    box-shadow: inset 0 -2px 0 var(--brand-accent, #0B679E);
}

.menu-tree--menu .menu-tree__group.is-drop-into > .menu-tree__row {
    background: rgba(11, 103, 158, .1);
    outline: 2px solid rgba(11, 103, 158, .35);
    outline-offset: -2px;
}

@media (max-width: 1100px) {
    .menu-tree--menu,
    .menu-tree-head--menu,
    .menu-tree--menu .menu-tree__row {
        --menu-cols: 28px minmax(0, 1fr);
    }

    .menu-tree-head--menu span:nth-child(n+3) {
        display: none;
    }

    .menu-tree--menu .menu-tree__field,
    .menu-tree--menu .menu-tree__zones,
    .menu-tree--menu .menu-tree__actions {
        grid-column: 2;
    }
}

/* --- дерево сущностей --- */
.menu-tree--entities,
.menu-tree-head--entities,
.menu-tree--entities .menu-tree__row {
    --menu-cols: 32px minmax(160px, 1.35fr) minmax(120px, 0.9fr) max-content;
}

.entities-tree-editor {
    margin-bottom: 1rem;
}

.menu-tree-head--entities {
    padding: 0 14px 8px;
    margin: 0 0 10px;
    border-bottom: none;
    color: #8a9aab;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
}

.menu-tree--entities {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.menu-tree--entities > .menu-tree__item {
    background: #fff;
    border: 1px solid rgba(15, 45, 66, .08);
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(15, 45, 66, .04);
    overflow: visible;
}

.menu-tree--entities .menu-tree__row,
.menu-tree--entities .menu-tree__row--group,
.menu-tree--entities .menu-tree__children .menu-tree__row {
    position: relative;
    gap: 10px;
    padding: 6px 12px;
    margin: 0;
    border-radius: 0;
    border-bottom: 1px solid rgba(15, 45, 66, .06);
    background: transparent;
    overflow: visible;
}

/* Пока открыт «⋯» — поднимаем только эту строку, иначе кнопки соседей лезут поверх меню */
.menu-tree--entities .menu-tree__item:has(.dropdown.show),
.menu-tree--entities .menu-tree__item:has(.dropdown-menu.show) {
    position: relative;
    z-index: 30;
}

.menu-tree--entities > .menu-tree__item > .menu-tree__row {
    border-bottom: none;
}

.menu-tree--entities > .menu-tree__item.menu-tree__item--parent > .menu-tree__row {
    border-bottom: 1px solid rgba(15, 45, 66, .06);
}

/* Группа с подсущностями — синяя подсветка основной строки */
.menu-tree--entities .menu-tree__row--nested {
    background: transparent;
}

.menu-tree--entities .menu-tree__row--nested:hover {
    background: rgba(15, 45, 66, .025);
}

.menu-tree--entities .menu-tree__row--group {
    background: color-mix(in srgb, var(--brand-accent, #0B679E) 8%, #fff);
}

.menu-tree--entities .menu-tree__row--group:hover {
    background: color-mix(in srgb, var(--brand-accent, #0B679E) 12%, #fff);
}

.menu-tree--entities .menu-tree__children {
    background: #f7fafc;
    min-height: 0;
    overflow: visible;
    border-radius: 0 0 10px 10px;
}

.menu-tree--entities .menu-tree__children > .menu-tree__item:last-child > .menu-tree__row {
    border-bottom: none;
    border-radius: 0 0 10px 10px;
}

.menu-tree--entities .menu-tree__children[hidden] {
    display: none !important;
}

.menu-tree--entities .menu-tree__handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 26px;
    color: #9aabb8;
    cursor: grab;
    user-select: none;
}

.menu-tree--entities .menu-tree__grip {
    width: 10px;
    height: 14px;
    background-image: radial-gradient(circle, currentColor 1.1px, transparent 1.25px);
    background-size: 5px 5px;
    background-position: 0 0;
    opacity: .55;
}

.menu-tree--entities .menu-tree__main {
    min-width: 0;
    display: flex;
    align-items: center;
}

.menu-tree--entities .menu-tree__title-line {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px 8px;
    min-width: 0;
}

.menu-tree--entities .menu-tree__title {
    font-size: 14px;
    font-weight: 600;
    color: #1f2d3a;
    line-height: 1.25;
    text-decoration: none;
}

.menu-tree--entities .menu-tree__title:hover {
    color: var(--brand-accent, #0B679E);
}

.menu-tree--entities .menu-tree__meta {
    display: inline-flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 6px;
    margin: 0;
    font-size: 12px;
    color: #8a9aab;
    line-height: 1.25;
}

.menu-tree--entities .menu-tree__id {
    font-variant-numeric: tabular-nums;
}

.menu-tree--entities .menu-tree__meta-sep {
    opacity: .7;
}

.menu-tree--entities .menu-tree__row--nested .menu-tree__main {
    padding-left: 22px;
    position: relative;
}

.menu-tree--entities .menu-tree__row--nested .menu-tree__main::before {
    content: '';
    position: absolute;
    left: 6px;
    top: -10px;
    bottom: 50%;
    width: 12px;
    border-left: 1.5px solid #c5d0db;
    border-bottom: 1.5px solid #c5d0db;
    border-bottom-left-radius: 3px;
}

.menu-tree--entities .menu-tree__field--table {
    min-width: 0;
}

.menu-tree--entities .menu-tree__field--table .entities-tree__code {
    display: block;
    max-width: 100%;
    padding: 6px 10px;
    font-size: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    color: #4a6578;
    background: #f3f5f7;
    border: 1px solid rgba(15, 45, 66, .08);
    border-radius: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.menu-tree--entities .menu-tree__field--actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: max-content;
    width: max-content;
    justify-self: end;
}

.menu-tree--entities .menu-tree__btn-group {
    display: inline-flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0;
    width: max-content;
    max-width: none;
    overflow: visible;
}

.menu-tree--entities .menu-tree__btn-group > .btn.btn-sm,
.menu-tree--entities .menu-tree__btn-group > .menu-tree__actions > .btn.btn-sm {
    box-sizing: border-box;
    flex: 0 0 auto;
    min-width: 0;
    width: auto;
    min-height: 28px;
    height: 28px;
    margin: 0;
    padding: 0 10px;
    border-radius: 0;
    font-size: 12.5px;
    line-height: 26px;
    box-shadow: none;
    white-space: nowrap;
    overflow: visible;
}

.menu-tree--entities .menu-tree__btn-group > .btn.btn-sm:first-child {
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

.menu-tree--entities .menu-tree__btn-group > .menu-tree__actions:last-child > .btn.btn-sm {
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
    min-width: 34px;
    padding: 0 10px;
}

.menu-tree--entities .menu-tree__btn-group > .btn + .btn,
.menu-tree--entities .menu-tree__btn-group > .btn + .menu-tree__actions > .btn,
.menu-tree--entities .menu-tree__btn-group > .menu-tree__actions + .btn {
    margin-left: -1px;
}

.menu-tree--entities .menu-tree__actions.dropdown {
    display: inline-flex;
    align-items: center;
    position: relative;
    flex: 0 0 auto;
    width: auto;
    min-width: 0;
    min-height: 28px;
    overflow: visible;
}

.menu-tree--entities .menu-tree__item.is-dragging {
    opacity: .45;
}

.menu-tree--entities .menu-tree__item.is-drop-before > .menu-tree__row {
    box-shadow: inset 0 2px 0 var(--brand-accent, #0B679E);
}

.menu-tree--entities .menu-tree__item.is-drop-after > .menu-tree__row {
    box-shadow: inset 0 -2px 0 var(--brand-accent, #0B679E);
}

.menu-tree--entities .menu-tree__item.is-drop-into > .menu-tree__row {
    background: rgba(11, 103, 158, .06);
    outline: 2px solid rgba(11, 103, 158, .35);
    outline-offset: -2px;
}

.entities-tree-status {
    margin-top: 8px;
    font-size: 12px;
    color: #6b8499;
}

.entities-tree-status.is-error {
    color: #c0392b;
}

.entities-tree-status.is-ok {
    color: #0f7a45;
}

@media (max-width: 1100px) {
    .menu-tree--entities,
    .menu-tree-head--entities,
    .menu-tree--entities .menu-tree__row {
        --menu-cols: 28px minmax(0, 1fr) max-content;
    }

    .menu-tree-head--entities span:nth-child(n+3) {
        display: none;
    }

    .menu-tree--entities .menu-tree__field--table {
        display: none;
    }
}

/* --- дерево сущностей (drag & drop) — legacy, удалить после миграции --- */
.entities-tree-wrap {
    --et-cols: 32px minmax(0, 1fr) 176px 176px 36px;
    --et-indent: 28px;
    background: #fff;
    border: 1px solid rgba(15, 45, 66, .08);
    border-radius: 12px;
    overflow: hidden;
    padding: 0;
}

.entities-tree-wrap > .app-page-table__head {
    padding: 12px 16px 0;
    margin-bottom: 0;
}

.entities-tree-hint {
    margin: 0;
    padding: 6px 16px 10px;
    font-size: 12.5px;
    color: #6b8499;
}

.entities-tree-head,
.entities-tree__row {
    display: grid;
    grid-template-columns: var(--et-cols);
    column-gap: 12px;
    align-items: center;
    padding: 0 12px 0 8px;
    box-sizing: border-box;
    width: 100%;
}

.entities-tree-head {
    min-height: 32px;
    padding-top: 4px;
    padding-bottom: 6px;
    margin: 0;
    font-size: 10.5px;
    font-weight: 600;
    color: #7a93a6;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid rgba(15, 45, 66, .08);
}

.entities-tree {
    list-style: none;
    margin: 0;
    padding: 4px 0 8px;
}

.entities-tree__node {
    list-style: none;
    position: relative;
}

.entities-tree__row {
    min-height: 52px;
    margin: 2px 0;
    border: 1px solid transparent;
    border-radius: 10px;
    background: #fff;
    transition: background .14s ease, border-color .14s ease, box-shadow .14s ease;
}

.entities-tree__node.is-child > .entities-tree__row {
    background: #f3f7fa;
}

.entities-tree__row:hover {
    border-color: rgba(15, 45, 66, .08);
    background: #f3f8fb;
}

.entities-tree__node.is-child > .entities-tree__row:hover {
    background: #eaf2f7;
}

/*
 * Явная синяя ветка дерева (как раньше), только сдвиг названия
 * через guides — колонки Таблица/Действия остаются на месте.
 */
.entities-tree__children {
    list-style: none;
    margin: 0;
    padding: 0;
    min-height: 0;
}

.entities-tree__children[hidden] {
    display: none !important;
}

.entities-tree__handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin: 0;
    border-radius: 7px;
    cursor: grab;
    color: #9bb0c0;
    user-select: none;
}

.entities-tree__handle:hover {
    background: rgba(15, 45, 66, .05);
    color: #5f7b91;
}

.entities-tree__handle:active {
    cursor: grabbing;
}

.entities-tree__grip {
    width: 12px;
    height: 14px;
    background-image: radial-gradient(circle, currentColor 1.1px, transparent 1.2px);
    background-size: 5px 5px;
    background-position: 1px 1px;
    opacity: .9;
}

.entities-tree__main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.entities-tree__guides {
    flex: 0 0 calc(var(--depth, 0) * var(--et-indent));
    width: calc(var(--depth, 0) * var(--et-indent));
    min-width: calc(var(--depth, 0) * var(--et-indent));
    align-self: stretch;
    position: relative;
    flex-shrink: 0;
    box-sizing: border-box;
}

/* Вертикаль + горизонталь — сплошной синий 3px */
.entities-tree__node.is-child > .entities-tree__row .entities-tree__guides::before {
    content: '';
    position: absolute;
    left: calc((var(--depth, 1) - 1) * var(--et-indent) + var(--et-indent) * .5 - 1.5px);
    top: -4px;
    bottom: -4px;
    width: 3px;
    background: #0b679e;
    border-radius: 2px;
    box-shadow: calc(var(--et-indent) * -1) 0 0 #0b679e;
}

.entities-tree__node.is-child > .entities-tree__row .entities-tree__guides::after {
    content: '';
    position: absolute;
    left: calc((var(--depth, 1) - 1) * var(--et-indent) + var(--et-indent) * .5 - 1.5px);
    top: 50%;
    width: calc(var(--et-indent) * .5 + 6px);
    height: 3px;
    background: #0b679e;
    border-radius: 2px;
    transform: translateY(-50%);
}

/* На 1-м уровне вторая тень не нужна */
.entities-tree__node.is-child > .entities-tree__row[style*="--depth: 1"] .entities-tree__guides::before,
.entities-tree__node.is-child > .entities-tree__row[style*="--depth:1"] .entities-tree__guides::before {
    box-shadow: none;
}

.entities-tree__icon {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    flex-shrink: 0;
    border-radius: 9px;
    background: #d9eaf4 !important;
    color: #0b679e !important;
    border: 1px solid #b7d3e4;
}

.entities-tree__icon svg {
    width: 16px !important;
    height: 16px !important;
    display: block !important;
    stroke: currentColor !important;
    fill: none !important;
}

.entities-tree__icon--folder {
    background: #cfe3f0 !important;
}

.entities-tree__icon--corner {
    background: #e2e9ef !important;
    color: #3d6f8f !important;
    border-color: #c5d3de;
}

.entities-tree__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.entities-tree__title {
    font-weight: 500;
    font-size: 13.5px;
    line-height: 1.25;
    color: #16324a;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.entities-tree__title:hover {
    color: #0b679e;
}

.entities-tree__meta {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.entities-tree__id {
    color: #8aa0b2;
    font-size: 11.5px;
    font-weight: 400;
    flex-shrink: 0;
}

.entities-tree__nest {
    display: inline-flex;
    align-items: center;
    max-width: 220px;
    padding: 1px 7px;
    border-radius: 999px;
    background: #dce8f0;
    color: #0b679e;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.entities-tree__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 16px;
    padding: 0 5px;
    border-radius: 999px;
    background: #d9eaf4;
    color: #0b679e;
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1;
}

.entities-tree__table {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 3px 8px;
    border-radius: 6px;
    background: #f1f5f8;
    border: 1px solid rgba(15, 45, 66, .06);
    font-size: 11.5px;
    font-weight: 400;
    color: #4a667a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
}

.entities-tree__links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    width: 100%;
    min-width: 0;
}

.entities-tree__btn {
    width: 100%;
    min-width: 0;
    justify-content: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-left: .45rem;
    padding-right: .45rem;
    font-weight: 400;
}

.entities-tree__actions {
    display: flex;
    justify-content: center;
}

.entities-tree__more {
    color: #6b8499;
}

.entities-tree__node.is-dragging {
    opacity: .45;
}

.entities-tree__node.is-dragging > .entities-tree__row {
    box-shadow: 0 8px 20px rgba(15, 45, 66, .12);
}

.entities-tree__node.is-drop-before > .entities-tree__row {
    box-shadow: inset 0 2px 0 #0b679e;
}

.entities-tree__node.is-drop-after > .entities-tree__row {
    box-shadow: inset 0 -2px 0 #0b679e;
}

.entities-tree__node.is-drop-into > .entities-tree__row {
    background: #e3eef6;
    border-color: #7eb0cc;
    outline: 1px dashed #0b679e;
    outline-offset: -2px;
}

.entities-tree-status {
    padding: 8px 16px 12px;
    font-size: 13px;
    color: #0b679e;
}

.entities-tree-status.is-error {
    color: #b42318;
}

.entities-tree-status.is-ok {
    color: #0f7a45;
}

@media (max-width: 900px) {
    .entities-tree-wrap {
        --et-cols: 28px minmax(0, 1fr) 36px;
    }

    .entities-tree-head span:nth-child(3),
    .entities-tree-head span:nth-child(4) {
        display: none;
    }

    .entities-tree__table,
    .entities-tree__links {
        display: none;
    }
}

/* --- Вложенная сущность: в стиле обычных полей формы --- */
.subentity-table {
    background: transparent;
    border: 0;
    border-radius: 0;
    overflow: visible;
}

.subentity-table__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: 0 0 .5rem;
    margin: 0 0 .55rem;
    border: 0;
    border-bottom: 1px dashed color-mix(in srgb, var(--tblr-border-color, #e6e7e9) 85%, transparent);
    background: transparent;
}

.subentity-table__head-actions {
    display: flex;
    align-items: center;
    gap: .35rem;
    flex: 0 0 auto;
}

.subentity-table__fill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    min-height: var(--app-control-height, 30px);
    padding: .15rem .55rem;
    font-size: var(--app-font-size-sm, 12px);
    line-height: 1.2;
}

.subentity-table__fill i,
.subentity-table__fill svg {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
}

.subentity-table__title {
    font-weight: 500;
    font-size: var(--app-font-size, 14px);
    line-height: 1.3;
    color: var(--tblr-body-color, inherit);
    min-width: 0;
}

.subentity-table__add.related-entity-picker__create {
    flex: 0 0 auto;
    align-self: center;
    width: var(--app-control-height, 30px);
    min-width: var(--app-control-height, 30px);
    min-height: var(--app-control-height, 30px);
    height: var(--app-control-height, 30px);
    margin-top: -2px;
}

.subentity-table__scroll {
    overflow-x: auto;
    margin: 0 -.15rem;
    padding: 0 .15rem;
}

.subentity-table__grid {
    width: 100%;
    border-collapse: separate;
    border-spacing: .5rem 0;
    table-layout: fixed;
    margin: 0 -.5rem;
    width: calc(100% + 1rem);
}

.subentity-table__grid thead th {
    padding: 0 0 .35rem;
    border: 0;
    background: transparent;
    vertical-align: bottom;
    font-weight: inherit;
    color: inherit;
    text-transform: none;
    letter-spacing: normal;
    font-size: inherit;
}

.subentity-table__grid thead th .form-label {
    display: block;
    margin: 0;
}

.subentity-table__grid tbody td {
    padding: 0 0 .65rem;
    border: 0;
    vertical-align: top;
    background: transparent;
}

.subentity-table__grid tbody tr:last-child td {
    padding-bottom: 0;
}

.subentity-table__grid tbody tr:hover td {
    background: transparent;
}

.subentity-table__col-actions {
    width: calc(var(--app-control-height, 30px) + .25rem);
    text-align: center;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.subentity-table__remove {
    color: #94a3b8 !important;
    margin-top: 0;
}

.subentity-table__remove:hover,
.subentity-table__remove:focus {
    color: #dc2626 !important;
    background: rgba(220, 38, 38, 0.06) !important;
}

.subentity-table__empty {
    padding: .15rem 0 .25rem;
    font-size: var(--app-font-size-sm, 12px);
}

.subentity-table--readonly .subentity-table__grid tbody td {
    padding-bottom: .55rem;
}

.subentity-table--readonly .form-control-plaintext {
    min-height: var(--app-control-height, 30px);
    display: flex;
    align-items: center;
    font-size: var(--app-font-size, 14px);
}

.subentity-table .form-control,
.subentity-table .form-select {
    width: 100%;
}

.subentity-cfg-columns {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.subentity-cfg-columns__row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 110px auto 36px;
    gap: .5rem;
    align-items: center;
}

.subentity-cfg-columns__sum {
    display: flex;
    align-items: center;
    gap: .25rem;
    white-space: nowrap;
    min-height: 30px;
}

.subentity-cfg-columns__sum.is-disabled {
    opacity: .35;
    pointer-events: none;
}

.subentity-fill-maps {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.subentity-fill-maps__row {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) 18px minmax(0, .95fr) minmax(0, 1.2fr) 36px;
    gap: .4rem;
    align-items: center;
}

.subentity-fill-maps__value {
    min-width: 0;
}

.subentity-fill-maps__arrow {
    text-align: center;
    color: #7a93a6;
    font-weight: 600;
}

@media (max-width: 768px) {
    .subentity-fill-maps__row {
        grid-template-columns: minmax(0, 1fr) 36px;
    }
    .subentity-fill-maps__arrow {
        display: none;
    }
}

@media (max-width: 576px) {
    .subentity-cfg-columns__row {
        grid-template-columns: minmax(0, 1fr) 90px auto 36px;
    }

    .subentity-table__grid {
        border-spacing: .35rem 0;
        margin: 0 -.35rem;
        width: calc(100% + .7rem);
    }
}

.subentity-table__sum-row td {
    padding-top: .35rem !important;
    padding-bottom: 0 !important;
    border-top: 1px dashed color-mix(in srgb, var(--tblr-border-color, #e6e7e9) 90%, transparent);
    vertical-align: middle;
}

.subentity-table__sum-label {
    font-size: var(--app-font-size-sm, 12px);
    font-weight: 500;
}

.subentity-table__sum-value {
    font-weight: 600;
    font-size: var(--app-font-size, 14px);
    text-align: right;
    min-height: var(--app-control-height, 30px);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 2px;
}

.subentity-table__sum-value[data-text-align="left"] {
    text-align: left;
    justify-content: flex-start;
}

.subentity-table__sum-value[data-text-align="center"] {
    text-align: center;
    justify-content: center;
}

.subentity-table__sum-value[data-text-align="right"] {
    text-align: right;
    justify-content: flex-end;
}

/* Журнал изменений: панель фильтров и меню очистки */
.change-log-toolbar .form-label {
    font-size: var(--app-font-size-sm, 12px);
    color: var(--tblr-secondary, #6c7a91);
}

.change-log-cleanup-menu {
    min-width: 16.5rem;
    max-width: 20rem;
}

.change-log-item-picker {
    position: relative;
}

.change-log-item-picker__control {
    position: relative;
}

.change-log-item-picker__control .form-control {
    padding-right: 1.75rem;
}

.change-log-item-picker__clear {
    position: absolute;
    right: .35rem;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--tblr-secondary, #6c7a91);
    width: 1.25rem;
    height: 1.25rem;
    line-height: 1;
    padding: 0;
    font-size: 1rem;
    cursor: pointer;
}

.change-log-item-picker__clear:hover {
    color: var(--tblr-body-color, #1e293b);
}

.change-log-item-picker__dropdown {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 2px);
    z-index: 30;
    max-height: 240px;
    overflow: auto;
    background: var(--tblr-bg-surface, #fff);
    border: 1px solid var(--tblr-border-color, #e6e7e9);
    border-radius: .375rem;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .12);
}

.change-log-item-picker__option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    padding: .4rem .65rem;
    font-size: var(--app-font-size-sm, 12px);
    color: inherit;
    cursor: pointer;
}

.change-log-item-picker__option:hover,
.change-log-item-picker__option.is-active {
    background: color-mix(in srgb, var(--tblr-primary, #206bc4) 12%, transparent);
}

.change-log-item-picker__label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.change-log-item-picker__id {
    flex-shrink: 0;
    color: var(--tblr-secondary, #6c7a91);
    font-size: 11px;
}

.change-log-item-picker__empty {
    padding: .55rem .65rem;
    font-size: var(--app-font-size-sm, 12px);
    color: var(--tblr-secondary, #6c7a91);
}

/* Совпадающие записи */
.matched-records-widget [data-role="matched-body"].is-loading {
    opacity: .55;
    pointer-events: none;
}

.matched-records__table th,
.matched-records__table td {
    vertical-align: middle;
    font-size: var(--app-font-size-sm, 12px);
}

.matched-records__link {
    text-decoration: none;
}

.matched-records__link:hover {
    text-decoration: underline;
}

.matched-records--empty {
    padding: .5rem 0;
}

/* Скрыть весь блок поля (с заголовком), если нет совпадений */
[id^="field-row-"]:has([data-matched-records][data-hide-when-empty="1"][data-has-rows="0"]),
.info-field-cell--matched:has([data-matched-records][data-hide-when-empty="1"][data-has-rows="0"]) {
    display: none !important;
}

/* Массовые действия списка */
.listing-bulk-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    margin-bottom: .65rem;
    padding: .55rem .75rem;
    border: 1px solid var(--app-table-border, #e6ebf1);
    border-radius: 8px;
    background: color-mix(in srgb, var(--brand-accent, #0b679e) 6%, #fff);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.listing-bulk-bar.is-loading {
    opacity: .7;
    pointer-events: none;
}

.listing-bulk-bar__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .55rem .75rem;
}

.listing-bulk-bar__count {
    font-size: 13px;
    color: #334155;
}

.listing-bulk-bar__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
}

.listing-bulk-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 88px;
    height: 31px;
    padding: 0 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    color: #5a7388;
    background: #fff;
    border: 1px solid var(--app-table-border, #e6ebf1);
    box-shadow: none;
    cursor: pointer;
    transition: color .15s ease, border-color .15s ease, background .15s ease;
}

.listing-bulk-btn:hover {
    color: var(--brand-accent, #0b679e);
    background: #fff;
    border-color: color-mix(in srgb, var(--brand-accent, #0b679e) 32%, var(--app-table-border, #e6ebf1));
}

.listing-bulk-btn:focus-visible {
    color: var(--brand-accent, #0b679e);
    background: #fff;
    border-color: var(--brand-accent, #0b679e);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-accent, #0b679e) 12%, transparent);
    outline: none;
}

.listing-bulk-btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.listing-bulk-btn--danger {
    color: #b42318;
    border-color: color-mix(in srgb, #b42318 28%, var(--app-table-border, #e6ebf1));
}

.listing-bulk-btn--danger:hover,
.listing-bulk-btn--danger:focus-visible {
    color: #912018;
    border-color: #b42318;
    background: color-mix(in srgb, #b42318 6%, #fff);
}

.listing-bulk-btn--ghost {
    min-width: 0;
    border-color: transparent;
    background: transparent;
    color: #64748b;
}

.listing-bulk-btn--ghost:hover,
.listing-bulk-btn--ghost:focus-visible {
    color: #334155;
    border-color: transparent;
    background: color-mix(in srgb, #64748b 8%, #fff);
    box-shadow: none;
}

