/* ==========================================================================
   Aluminium.Web.UI — оформление сайтов компании (корпоративный стиль Reynaers):
   тёмно-синий #0D233B, фирменный синий #013669, акцент #0078FF, шрифт Roboto.
   Светлая и тёмная темы на CSS-переменных, без внешних зависимостей.
   Описание и решения — docs/ДИЗАЙН.md. Источник — site.css HelpDesk (e0a2b5d).
   ========================================================================== */

@font-face { font-family: "Roboto"; font-weight: 300; font-display: swap; src: url("../fonts/roboto-cyrillic-300.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Roboto"; font-weight: 400; font-display: swap; src: url("../fonts/roboto-cyrillic-400.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Roboto"; font-weight: 500; font-display: swap; src: url("../fonts/roboto-cyrillic-500.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Roboto"; font-weight: 700; font-display: swap; src: url("../fonts/roboto-cyrillic-700.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Roboto"; font-weight: 300; font-display: swap; src: url("../fonts/roboto-latin-300.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Roboto"; font-weight: 400; font-display: swap; src: url("../fonts/roboto-latin-400.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Roboto"; font-weight: 500; font-display: swap; src: url("../fonts/roboto-latin-500.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Roboto"; font-weight: 700; font-display: swap; src: url("../fonts/roboto-latin-700.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ---------- Токены ---------- */

:root {
    /* Поверхности и текст */
    --bg: #f7fafb;
    --surface: #ffffff;
    --surface-2: #f7fafb;
    --surface-3: #eef2f5;
    --border: #ebebeb;
    --border-strong: #d7dee3;
    --text: #494949;
    --text-2: #494949;
    --muted: #7c8794;
    --faint: #959595;
    --heading: #013669;

    /* Действие и фирменные цвета */
    --primary: #0078ff;
    --primary-hover: #0062d1;
    --primary-soft: #e8f1ff;
    --primary-soft-text: #0058c4;
    --on-primary: #ffffff;
    --brand: #013669;
    --brand-fill: #013669;

    /* Меню и тёмные плоскости — тёмно-синие в обеих темах */
    --navy: #0d233b;
    --navy-2: #13304f;
    --nav-text: #c9d3dd;
    --nav-muted: #6f7f89;
    --nav-accent: #0078ff;         /* полоса активного пункта, счётчики, главная кнопка меню */
    --nav-accent-hover: #0062d1;
    --nav-accent-text: #4da2ff;    /* иконка активного пункта */
    --nav-btn: #1c3d61;            /* второе действие в меню */
    --nav-btn-hover: #24496f;
    --menu-card: linear-gradient(135deg, #0b5fc4, #0a3f86);
    --hero-gradient: linear-gradient(120deg, #0d233b 0%, #013669 55%, #0a5ad1 115%);
    --empty-gradient: linear-gradient(140deg, #3d8bff, #013669);
    --empty-happy-gradient: linear-gradient(140deg, #34c38f, #0f6e56);

    /* Смысловые цвета: насыщенный / мягкий фон / текст на мягком фоне */
    --red: #d92d20;     --red-soft: #fef3f2;     --red-text: #b42318;
    --green: #079455;   --green-soft: #ecfdf3;   --green-text: #067647;
    --amber: #dc6803;   --amber-soft: #fffaeb;   --amber-text: #b54708;
    --blue: #0078ff;    --blue-soft: #e8f1ff;    --blue-text: #0058c4;
    /* «violet» — исторически фирменный тёмно-синий, а не фиолетовый (ДИЗАЙН.md §1.3) */
    --violet: #013669;  --violet-soft: #e6ecf3;  --violet-text: #013669;
    --gray-soft: #eef2f5; --gray-text: #5b6773;
    --note-bg: #fffcf0;
    --note-border: #fedf89;

    /* Категорийные цвета: аватары без фото, значки типов */
    --cat-1: #6366f1; --cat-2: #0ea5e9; --cat-3: #10b981; --cat-4: #f59e0b; --cat-5: #ef4444;
    --cat-6: #8b5cf6; --cat-7: #ec4899; --cat-8: #14b8a6; --cat-9: #f97316; --cat-10: #64748b;

    /* Фокус и тени */
    --ring: 0 0 0 4px rgba(0, 120, 255, .18);
    --shadow-xs: 0 1px 2px rgba(13, 35, 59, .04);
    --shadow-sm: 0 1px 3px rgba(13, 35, 59, .08), 0 1px 2px rgba(13, 35, 59, .04);
    --shadow-md: 0 12px 28px -12px rgba(13, 35, 59, .35);
    --shadow-lg: 0 16px 40px -12px rgba(13, 35, 59, .25);
    --backdrop: rgba(8, 10, 14, .45);

    /* Радиусы */
    --radius: 16px;
    --radius-sm: 8px;
    --radius-pill: 24px;
    --radius-round: 999px;

    /* Шрифт: шкала размеров (ДИЗАЙН.md §2) */
    --font: Roboto, "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --mono: "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;
    --fs-xs: 11px;
    --fs-sm: 12.5px;
    --fs-md: 13px;
    --fs-base: 14px;
    --fs-lg: 15px;
    --fs-xl: 17px;
    --fs-h1: 28px;
    --fs-display: 40px;

    /* Отступы: шкала (ДИЗАЙН.md §3) */
    --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-7: 32px;

    /* Движение */
    --t-fast: .12s;
    --t-base: .15s;

    /* Слои */
    --z-sbar: 19; --z-topbar: 20; --z-sidebar: 30; --z-peek: 40; --z-dropdown: 50; --z-popover: 60;
    --z-toast: 90; --z-season: 95; --z-topload: 100; --z-tooltip: 120;

    /* Каркас */
    --sidebar-w: 256px;
    --topbar-h: 60px;
    --page-pad: clamp(16px, 2.2vw, 40px);

    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #081626; --surface: #0f2238; --surface-2: #132a44; --surface-3: #183250;
        --border: #213d5e; --border-strong: #34557a;
        --text: #e3eaf2; --text-2: #c9d3dd; --muted: #98abbf; --faint: #8497ac;
        --heading: #d6e6fa;
        --primary: #2f8fff; --primary-hover: #5aa6ff; --primary-soft: rgba(47, 143, 255, .16); --primary-soft-text: #8cc0ff;
        --brand: #2f8fff;
        --brand-fill: #164a80;
        --navy: #06111e; --navy-2: #0f2238; --nav-text: #b8c6d4; --nav-muted: #5f7489;
        --red: #f04438; --red-soft: rgba(240, 68, 56, .14); --red-text: #fda29b;
        --green: #17b26a; --green-soft: rgba(23, 178, 106, .14); --green-text: #75e0a7;
        --amber: #f79009; --amber-soft: rgba(247, 144, 9, .14); --amber-text: #fec84b;
        --blue: #2f8fff; --blue-soft: rgba(47, 143, 255, .16); --blue-text: #8cc0ff;
        --violet: #6fa8e8; --violet-soft: rgba(111, 168, 232, .14); --violet-text: #b3d2f5;
        --gray-soft: rgba(143, 163, 184, .14); --gray-text: #b8c6d4;
        --note-bg: rgba(247, 144, 9, .07); --note-border: rgba(247, 144, 9, .32);
        --ring: 0 0 0 4px rgba(47, 143, 255, .3);
        --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
        --shadow-sm: 0 1px 3px rgba(0, 0, 0, .4);
        --shadow-md: 0 12px 28px -12px rgba(0, 0, 0, .55);
        --shadow-lg: 0 16px 40px -12px rgba(0, 0, 0, .6);
        color-scheme: dark;
    }
}

/* Тот же набор при выбранной вручную тёмной теме (без препроцессора набор повторяется). */
:root[data-theme="dark"] {
    --bg: #081626; --surface: #0f2238; --surface-2: #132a44; --surface-3: #183250;
    --border: #213d5e; --border-strong: #34557a;
    --text: #e3eaf2; --text-2: #c9d3dd; --muted: #98abbf; --faint: #8497ac;
    --heading: #d6e6fa;
    --primary: #2f8fff; --primary-hover: #5aa6ff; --primary-soft: rgba(47, 143, 255, .16); --primary-soft-text: #8cc0ff;
    --brand: #2f8fff;
    --brand-fill: #164a80;
    --navy: #06111e; --navy-2: #0f2238; --nav-text: #b8c6d4; --nav-muted: #5f7489;
    --red: #f04438; --red-soft: rgba(240, 68, 56, .14); --red-text: #fda29b;
    --green: #17b26a; --green-soft: rgba(23, 178, 106, .14); --green-text: #75e0a7;
    --amber: #f79009; --amber-soft: rgba(247, 144, 9, .14); --amber-text: #fec84b;
    --blue: #2f8fff; --blue-soft: rgba(47, 143, 255, .16); --blue-text: #8cc0ff;
    --violet: #6fa8e8; --violet-soft: rgba(111, 168, 232, .14); --violet-text: #b3d2f5;
    --gray-soft: rgba(143, 163, 184, .14); --gray-text: #b8c6d4;
    --note-bg: rgba(247, 144, 9, .07); --note-border: rgba(247, 144, 9, .32);
    --ring: 0 0 0 4px rgba(47, 143, 255, .3);
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .4);
    --shadow-md: 0 12px 28px -12px rgba(0, 0, 0, .55);
    --shadow-lg: 0 16px 40px -12px rgba(0, 0, 0, .6);
    color-scheme: dark;
}

/* ---------- База ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: var(--fs-base)/1.55 var(--font);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
h1, h2, h3 { margin: 0; line-height: 1.25; color: var(--heading); }
h1 { font-size: var(--fs-h1); font-weight: 300; }
h2 { font-size: var(--fs-lg); font-weight: 500; }
h3 { font-size: var(--fs-lg); font-weight: 500; }
p { margin: 0; }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }
img { max-width: 100%; }
[hidden] { display: none !important; }

.icon {
    width: 16px; height: 16px; flex: none;
    fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
    vertical-align: -3px;
}
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: var(--fs-sm); }
.block { display: block; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.req { color: var(--red); }
.text-error { color: var(--red-text); }
.num { color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.dot-sep::before { content: "·"; margin-right: 8px; color: var(--faint); }

.stack { display: flex; flex-direction: column; gap: var(--sp-4); }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.stack-lg { display: flex; flex-direction: column; gap: var(--sp-5); min-width: 0; }

.show-sm { display: none; }
.only-md { display: none; }

/* ---------- Каркас: меню слева, верхняя строка, контент ---------- */

.app { display: flex; min-height: 100vh; }

.sidebar {
    position: sticky; top: 0; z-index: var(--z-sidebar);
    width: var(--sidebar-w); height: 100vh; flex: none;
    display: flex; flex-direction: column; gap: var(--sp-4);
    padding: 18px 14px 14px;
    background: var(--navy); color: var(--nav-text);
    border-right: 1px solid var(--navy);
    overflow-y: auto; scrollbar-color: var(--navy-2) transparent;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 2px 6px; color: #fff; font-weight: 400; font-size: var(--fs-xl); }
.brand:hover { color: #fff; }
.brand-logo { display: block; height: 52px; width: auto; flex: none; }
.brand-name small { display: block; margin-top: 2px; font-size: var(--fs-xs); color: var(--nav-muted); }

/* Главное и второе действие меню («Новая заявка», «Новая задача») */
.sidebar .nav-action { margin: 2px 0 4px; }
.sidebar .nav-action.btn-primary { background: var(--nav-accent); }
.sidebar .nav-action.btn-primary:hover { background: var(--nav-accent-hover); }
.sidebar .nav-action-2 { margin: 4px 0; color: #fff; background: var(--nav-btn); border-color: transparent; }
.sidebar .nav-action-2:hover { color: #fff; background: var(--nav-btn-hover); }
.sidebar .menu-link-btn { margin: 4px 0; color: #fff; background: transparent; border: 1.5px solid var(--nav-accent-text); }
.sidebar .menu-link-btn:hover { color: #fff; background: rgba(0, 120, 255, .16); }
.sidebar .menu-link-btn .menu-link-ext { margin-left: 0; }

/* Прокручивается только список разделов: логотип и кнопки сверху, карточки и пользователь снизу всегда на виду. */
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; min-height: 140px; overflow-y: auto; margin-right: -8px; padding-right: 8px; overscroll-behavior: contain; }
.sidebar > :not(.nav) { flex-shrink: 0; }
.nav-label { margin: 14px 10px 6px; font-size: var(--fs-xs); font-weight: 500; letter-spacing: .05em; text-transform: uppercase; color: var(--nav-muted); }
.nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px 8px 9px; border-left: 3px solid transparent; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--nav-text); font-weight: 500;
    transition: background var(--t-fast), color var(--t-fast);
}
.nav-link .icon { color: var(--nav-muted); }
.nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-link:hover .icon { color: #fff; }
.nav-link.is-active { background: rgba(255, 255, 255, .09); color: #fff; border-left-color: var(--nav-accent); }
.nav-link.is-active .icon { color: var(--nav-accent-text); }
.nav-link-highlight { background: rgba(0, 120, 255, .14); border-left-color: var(--nav-accent-text); color: #fff; }
.nav-link-highlight .icon { color: #6db5ff; }
.menu-link-ext { width: 14px !important; height: 14px !important; margin-left: auto; opacity: .7; }
.nav-count {
    margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
    background: var(--nav-accent); color: #fff; font-size: var(--fs-xs); font-weight: 700; display: inline-grid; place-items: center;
}
.nav-count.is-alert { background: var(--red); color: #fff; }

/* Сворачиваемые группы меню */
.nav-toggle { display: flex; align-items: center; justify-content: space-between; width: calc(100% - 20px); border: 0; background: none; padding: 0; cursor: pointer; font-family: inherit; text-align: left; }
.nav-toggle .icon { width: 14px; height: 14px; transition: transform var(--t-base); opacity: .7; }
.nav-toggle:hover { color: var(--nav-text); }
.nav-group.is-closed .nav-toggle .icon { transform: rotate(-90deg); }
.nav-group.is-closed .nav-group-body { display: none; }
.nav-sep { height: 1px; margin: 10px; background: color-mix(in srgb, var(--nav-muted) 35%, transparent); }

/* Карточки-ссылки на внешние сервисы внизу меню */
.menu-card {
    display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--radius);
    background: var(--menu-card); color: #fff; font-weight: 500;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .25); transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.menu-card:hover { color: #fff; transform: translateY(-1px); box-shadow: 0 10px 24px rgba(0, 0, 0, .32); }
.menu-card + .menu-card { margin-top: -6px; }
.menu-card-icon { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: rgba(255, 255, 255, .16); }
.menu-card-icon .icon { width: 20px; height: 20px; color: #fff; }
.menu-card-text { min-width: 0; line-height: 1.25; }
.menu-card-text small { display: block; margin-top: 2px; font-size: var(--fs-xs); font-weight: 400; color: #bcd6ff; }
.menu-card .menu-link-ext { color: #fff; }

/* Пользователь внизу меню */
.sidebar-user {
    display: flex; align-items: center; gap: 10px;
    padding: 10px; border-radius: var(--radius);
    background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .08);
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { display: block; color: #fff; font-weight: 500; font-size: var(--fs-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.sidebar-user-name:hover { color: #fff; text-decoration: underline; }
.sidebar-user-role { font-size: var(--fs-sm); color: var(--nav-muted); }
.sidebar-user-link { display: inline-flex; border-radius: 50%; }
.sidebar-user form { margin: 0; }
.sidebar .icon-btn { color: var(--nav-text); }
.sidebar .icon-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    position: sticky; top: 0; z-index: var(--z-topbar);
    display: flex; align-items: center; gap: 12px;
    height: var(--topbar-h); padding: 0 28px;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--border);
}
.topbar-search { position: relative; flex: 1; max-width: 520px; }
.topbar-search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.topbar-search input {
    width: 100%; height: 38px; padding: 0 12px 0 38px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text); font: inherit;
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.topbar-search input:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.topbar-kbd { flex: none; margin-left: 6px; padding: 2px 7px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); color: var(--muted); font: 700 var(--fs-xs) var(--font); cursor: pointer; white-space: nowrap; }
.topbar-kbd:hover { color: var(--primary); border-color: var(--primary); }
.topbar-search .topbar-kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }
.topbar-end { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar .menu-btn { display: none; }

/* Резиновая ширина: страницы занимают всё окно, поля растут вместе с экраном. */
.content { width: 100%; padding: 28px var(--page-pad); }

.sidebar-backdrop { display: none; }

/* Полоска загрузки при переходах */
.topload { position: fixed; top: 0; left: 0; z-index: var(--z-topload); height: 3px; width: 0; background: var(--primary); box-shadow: 0 0 8px var(--primary); pointer-events: none; opacity: 0; }
.topload.is-loading { opacity: 1; animation: topload 8s cubic-bezier(.1, .7, .2, 1) forwards; }
@keyframes topload { 0% { width: 0; } 20% { width: 45%; } 100% { width: 92%; } }

/* Страница внутри панели просмотра: без меню и верхней строки */
html.embed .sidebar, html.embed .topbar, html.embed .sidebar-backdrop, html.embed .sbar, html.embed .crumbs,
html.embed .topload, html.embed .notice-banner { display: none !important; }
html.embed .app { display: block; }
html.embed .content { padding: 18px 20px; }

/* ---------- Заголовок страницы и путь ---------- */

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); margin-bottom: 22px; flex-wrap: wrap; }
.page-head > div:first-child { min-width: 0; }
.page-head p { margin-top: 4px; }
.page-head .help { flex-basis: 100%; text-align: right; }
.crumbs { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; font-size: var(--fs-md); color: var(--muted); flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }
.crumbs .icon { width: 14px; height: 14px; color: var(--faint); }

/* ---------- Кнопки ---------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 38px; padding: 0 16px;
    border: 1px solid transparent; border-radius: var(--radius-pill);
    font: inherit; font-weight: 500; white-space: nowrap; text-decoration: none;
    cursor: pointer; user-select: none;
    transition: background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast), color var(--t-fast), transform .06s;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); color: var(--on-primary); }
.btn-secondary { background: transparent; color: var(--brand); border-color: var(--brand); }
.btn-secondary:hover { background: var(--primary-soft); color: var(--brand); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--red-text); color: #fff; }
.btn-danger-text { color: var(--red) !important; }
.btn-danger-text:hover { background: var(--red-soft) !important; }
.btn.is-on { background: var(--primary-soft); color: var(--primary-soft-text); }
.btn-sm { height: 32px; padding: 0 12px; font-size: var(--fs-md); }
.btn-lg { height: 44px; padding: 0 20px; font-size: var(--fs-lg); }
.btn-block { width: 100%; }

.icon-btn {
    display: inline-grid; place-items: center;
    width: 34px; height: 34px; padding: 0;
    border: 0; border-radius: 9px; background: transparent;
    color: var(--muted); cursor: pointer;
    transition: background var(--t-fast), color var(--t-fast);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.icon-btn:disabled { opacity: .3; cursor: default; background: none; }
.icon-btn-sm { width: 26px; height: 26px; border-radius: 7px; }
.icon-btn-sm .icon { width: 14px; height: 14px; }
.copy-btn { vertical-align: middle; opacity: .55; }
.copy-btn:hover { opacity: 1; }
h1 .copy-btn .icon { width: 18px; height: 18px; }

.link { display: inline-flex; align-items: center; gap: 2px; font-size: var(--fs-md); font-weight: 700; }
.link .icon { width: 14px; height: 14px; }
.link-btn { padding: 0; border: 0; background: none; color: var(--primary); font: inherit; font-weight: 700; cursor: pointer; align-self: flex-start; }
.link-btn:hover { text-decoration: underline; }

/* Переключатель темы: луна в светлой, солнце в тёмной */
.theme-dark { display: none; }
:root[data-theme="dark"] .theme-light { display: none; }
:root[data-theme="dark"] .theme-dark { display: inline; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-light { display: none; }
    :root:not([data-theme="light"]) .theme-dark { display: inline; }
}

/* ---------- Формы ---------- */

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field-label { font-size: var(--fs-md); font-weight: 700; color: var(--text-2); }
.field-end { justify-content: flex-end; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.form-row-3 { grid-template-columns: 2fr 1fr 1.2fr; }
.help { font-size: var(--fs-sm); color: var(--muted); }
.field-error { font-size: var(--fs-sm); color: var(--red); }
.field-error:empty { display: none; }
.form-error { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--red-soft); color: var(--red-text); font-weight: 500; }
.form-error ul { margin: 0; padding-left: 18px; }
.form-error.validation-summary-valid { display: none; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }

.input, .select {
    width: 100%; min-height: 38px; padding: 8px 12px;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text);
    font: inherit;
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input::placeholder { color: var(--faint); }
.input:focus, .select:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.input-lg { min-height: 44px; font-size: var(--fs-lg); }
.input-sm, .select-sm { min-height: 32px; padding: 5px 10px; font-size: var(--fs-md); }
textarea.input { resize: vertical; line-height: 1.55; }
.select {
    appearance: none; padding-right: 34px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2398a2b3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}
.input-validation-error { border-color: var(--red) !important; }

.check { display: inline-flex; align-items: flex-start; gap: 9px; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--primary); flex: none; }
.check-desc span { display: flex; flex-direction: column; gap: 2px; }
.check-desc small { color: var(--muted); font-size: var(--fs-sm); line-height: 1.4; }
.check-pill {
    align-items: center; height: 32px; padding: 0 12px;
    border: 1px solid var(--border-strong); border-radius: var(--radius-pill); background: var(--surface); font-size: var(--fs-md);
}
.check-pill input { margin: 0; }
.check-pill:has(input:checked) { border-color: var(--brand); background: var(--primary-soft); color: var(--brand); }

/* Сегменты: выбор одного из нескольких */
.segmented {
    display: inline-flex; gap: 2px; padding: 3px;
    background: var(--surface-3); border-radius: var(--radius-pill); flex-wrap: wrap;
}
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label > span {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 6px 12px; border-radius: var(--radius-pill);
    font-size: var(--fs-md); font-weight: 700; color: var(--muted);
    transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}
.segmented label:hover > span { color: var(--text); }
.segmented input:checked + span { background: var(--brand-fill); color: #fff; }
.segmented input:focus-visible + span { box-shadow: var(--ring); }
.segmented-wide { display: flex; }
.segmented-wide label { flex: 1; }
.segmented-wide label > span { width: 100%; justify-content: center; padding: 8px 12px; }

/* Тумблер */
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track { position: relative; flex: none; width: 38px; height: 22px; border-radius: 11px; background: var(--border-strong); transition: background var(--t-base); }
.switch-track::after {
    content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform var(--t-base);
}
.switch input:checked + .switch-track { background: var(--green); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { box-shadow: var(--ring); }
.switch input:disabled + .switch-track { opacity: .45; cursor: not-allowed; }
.switch-text { font-size: var(--fs-sm); color: var(--muted); min-width: 26px; }
.switch.is-busy { opacity: .6; pointer-events: none; }

/* Загрузка файлов */
.dropzone {
    position: relative;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 22px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius);
    background: var(--surface-2); text-align: center; cursor: pointer;
    transition: border-color var(--t-fast), background var(--t-fast);
}
.dropzone:hover, .dropzone.is-over { border-color: var(--primary); background: var(--primary-soft); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); margin-bottom: 4px; }
.dropzone-text { color: var(--text-2); }
.dropzone-hint { font-size: var(--fs-sm); color: var(--muted); }

.file-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.file-list:empty { display: none; }
.file-list li {
    display: inline-flex; align-items: center; gap: 8px; max-width: 100%;
    padding: 5px 6px 5px 10px; border-radius: var(--radius-sm);
    background: var(--surface-3); font-size: var(--fs-sm);
}
.file-list li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list li small { color: var(--muted); }

/* Выбор из списка с поиском */
.picker { position: relative; }
.picker-box {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    min-height: 38px; padding: 4px 10px;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface);
    cursor: text; transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.picker.is-open .picker-box, .picker-box:focus-within { border-color: var(--primary); box-shadow: var(--ring); }
.picker-input { flex: 1; min-width: 80px; height: 28px; padding: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; }
.picker-input::placeholder { color: var(--faint); }
.picker-single .picker-box { flex-wrap: nowrap; }
.picker-single .picker-input { text-overflow: ellipsis; }
.picker-single .picker-box::after {
    content: ""; width: 16px; height: 16px; flex: none;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2398a2b3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / 16px no-repeat;
}
.picker-list {
    position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: var(--z-dropdown);
    max-height: 280px; overflow-y: auto; padding: 4px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg);
}
.picker-item { display: flex; flex-direction: column; padding: 7px 10px; border-radius: 7px; cursor: pointer; }
.picker-item small { color: var(--muted); font-size: var(--fs-sm); }
.picker-item.is-active { background: var(--surface-3); }
.picker-item.is-selected { color: var(--primary-soft-text); font-weight: 700; }
.picker-empty { padding: 10px; color: var(--muted); font-size: var(--fs-md); }
.chip {
    display: inline-flex; align-items: center; gap: 4px; max-width: 100%;
    height: 26px; padding: 0 4px 0 10px; border-radius: var(--radius-pill);
    background: var(--primary-soft); color: var(--primary-soft-text); font-size: var(--fs-md); font-weight: 500;
}
.chip-x { display: grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 5px; background: transparent; color: inherit; cursor: pointer; font-size: 16px; line-height: 1; }
.chip-x:hover { background: rgba(0, 0, 0, .08); }
.chips-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-link { padding: 5px 12px; border-radius: var(--radius-round); border: 1px solid var(--border-strong); color: var(--text); font-size: var(--fs-md); }
.chip-link:hover { border-color: var(--primary); color: var(--text); }
.chip-link.is-on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-soft-text); }

form[data-autosave].is-saving { opacity: .7; }
.autosave-hint { display: flex; align-items: center; gap: 6px; margin: 0; }
.autosave-hint .icon { width: 14px; height: 14px; }

/* ---------- Карточки и раскладки ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
    min-width: 0;
}
.card-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.card-head h2 .icon { color: var(--muted); }
.card-body { padding: 18px; }
.card-body-tight { padding-top: 0; }
.card-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--border); }
.card-narrow { max-width: 480px; }
.card-tint { background: var(--primary-soft); }
.sticky { position: sticky; top: 84px; }

/* Сворачиваемая карточка: щелчок по шапке */
.card-head.is-collapsible { cursor: pointer; user-select: none; justify-content: flex-start; gap: 8px; }
.collapse-btn { margin-left: auto; color: var(--muted); }
.collapse-btn .icon { transition: transform var(--t-base); }
.card.is-collapsed .collapse-btn .icon { transform: rotate(-90deg); }
.card.is-collapsed > :not(.card-head) { display: none !important; }
.card.is-collapsed > .card-head { border-bottom: 0; }
.aside-tools { display: flex; justify-content: flex-end; gap: 14px; margin-bottom: -8px; }

.count {
    display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px;
    border-radius: 10px; background: var(--surface-3); color: var(--muted); font-size: var(--fs-sm); font-weight: 700;
}
.count-red { background: var(--red-soft) !important; color: var(--red-text) !important; }
.count-green { background: var(--green-soft) !important; color: var(--green-text) !important; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-5); }
.grid-wide-left { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.layout-aside { display: grid; grid-template-columns: minmax(0, 1fr) clamp(300px, 22vw, 420px); gap: var(--sp-6); align-items: start; }
.layout-aside-left { grid-template-columns: clamp(240px, 16vw, 320px) minmax(0, 1fr); }
.layout-aside > aside .form-row { grid-template-columns: 1fr; }

.link-list { list-style: none; margin: 0; padding: 6px; }
.link-list a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--text); }
.link-list a:hover { background: var(--surface-2); color: var(--text); }
.link-list .icon { color: var(--muted); }

details.more summary { cursor: pointer; font-size: var(--fs-md); font-weight: 700; color: var(--primary); margin-bottom: 4px; }
details.more[open] summary { margin-bottom: 14px; }

.divider { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: var(--fs-sm); }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- Сообщения в странице ---------- */

.note-warn {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 10px 14px; border-radius: var(--radius-sm); background: var(--amber-soft); color: var(--amber-text); font-weight: 500;
}
.note-warn > span { flex: 1; min-width: 200px; }
.note-warn form { margin: 0; }

/* Объявления о сбоях и работах — сверху каждой страницы */
.notice-banner { display: flex; align-items: center; gap: 10px; margin: -8px 0 var(--sp-4); padding: 10px 14px; border-radius: 12px; border: 1px solid; font-size: var(--fs-base); }
.notice-banner .icon { flex: none; width: 18px; height: 18px; }
.notice-banner b { font-weight: 700; }
.notice-banner .notice-when { margin-left: auto; white-space: nowrap; font-size: var(--fs-sm); opacity: .8; }
.notice-banner form { margin: 0; }
.notice-banner .link-btn { color: inherit; text-decoration: underline; }
.notice-outage { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 40%, transparent); color: var(--red-text); }
.notice-maintenance { background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 40%, transparent); color: var(--amber-text); }
.notice-info { background: var(--blue-soft); border-color: color-mix(in srgb, var(--blue) 40%, transparent); color: var(--blue-text); }
.notice-banner + .notice-banner { margin-top: -8px; }

/* Всплывающие уведомления (тосты): «Сохранено» исчезает само, ошибка ждёт закрытия */
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: var(--z-toast); display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.flash {
    position: relative; overflow: hidden; pointer-events: auto;
    display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm);
    background: var(--surface); border: 1px solid var(--border); border-left: 4px solid; color: var(--text);
    box-shadow: 0 12px 32px rgba(13, 35, 59, .18); font-weight: 500;
    animation: toast-in .32s cubic-bezier(.2, .9, .3, 1.2);
}
.flash.is-leaving { animation: toast-out .25s ease-in forwards; }
.flash > span { flex: 1; }
.flash > .icon { flex: none; }
.flash-success { border-left-color: var(--green); }
.flash-success > .icon { color: var(--green); }
.flash-error { border-left-color: var(--red); }
.flash-error > .icon { color: var(--red); }
.flash-warning { border-left-color: var(--amber); }
.flash-warning > .icon { color: var(--amber); }
.flash-success::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--green); opacity: .35; transform-origin: left; animation: toast-timer 5s linear forwards; }
.flash-x { display: grid; place-items: center; padding: 2px; border: 0; background: none; color: inherit; opacity: .6; cursor: pointer; }
.flash-x:hover { opacity: 1; }
.flash-undo { padding: 0; border: 0; background: none; color: var(--primary); font: inherit; font-weight: 700; cursor: pointer; }
@keyframes toast-in { from { opacity: 0; transform: translateX(40px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(40px); } }
@keyframes toast-timer { to { transform: scaleX(0); } }

/* Диалог */
.dialog {
    width: min(440px, calc(100vw - 32px)); padding: 22px;
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
.dialog::backdrop { background: var(--backdrop); }
.dialog h2 { font-size: var(--fs-xl); }
.dialog-wide { width: min(640px, calc(100vw - 32px)); }

/* ---------- Метки, люди ---------- */

/* Бейдж: «таблетка» с точкой. Имена по цвету; старые имена HelpDesk — псевдонимы (ДИЗАЙН.md, решение 4). */
.badge {
    display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px;
    border-radius: var(--radius-round); font-size: var(--fs-sm); font-weight: 700; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-blue, .badge-progress { background: var(--blue-soft); color: var(--blue-text); }
.badge-brand, .badge-new { background: var(--violet-soft); color: var(--violet-text); }
.badge-amber, .badge-waiting { background: var(--amber-soft); color: var(--amber-text); }
.badge-green, .badge-resolved { background: var(--green-soft); color: var(--green-text); }
.badge-gray, .badge-closed { background: var(--gray-soft); color: var(--gray-text); }
.badge-red { background: var(--red-soft); color: var(--red-text); }
.badge-sm { height: 20px; padding: 0 8px; font-size: var(--fs-xs); }

/* Метка без точки */
.tag {
    display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px;
    border-radius: var(--radius-pill); background: var(--gray-soft); color: var(--gray-text);
    font-size: var(--fs-sm); font-weight: 700; white-space: nowrap; vertical-align: middle;
}
.tag .icon { width: 12px; height: 12px; vertical-align: 0; }
.tag-primary { background: var(--primary-soft); color: var(--primary-soft-text); }
.tag-amber { background: var(--amber-soft); color: var(--amber-text); }
.tag-green { background: var(--green-soft); color: var(--green-text); }
.tag-red { background: var(--red-soft); color: var(--red-text); }
.tag-violet, .tag-brand { background: var(--violet-soft); color: var(--violet-text); }

/* Индикатор-точка с подписью (приоритет и т. п.) */
.prio { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-md); color: var(--text-2); white-space: nowrap; }
.prio i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.prio-low i { background: var(--faint); }
.prio-normal i { background: var(--brand); }
.prio-high i { background: var(--amber); }
.prio-critical { color: var(--red-text); font-weight: 700; }
.prio-critical i { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }

/* Срок */
.due { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-md); color: var(--muted); white-space: nowrap; }
.due .icon { width: 14px; height: 14px; }
.due-soon { color: var(--amber-text); font-weight: 700; }
.due-over { color: var(--red-text); font-weight: 700; }

/* Тип файла */
.ft {
    display: inline-block; min-width: 34px; padding: 1px 5px; border-radius: 5px; text-align: center;
    font-size: var(--fs-xs); font-weight: 700; letter-spacing: .03em; line-height: 1.6; background: var(--surface-3); color: var(--muted);
}
.ft-pdf { background: var(--red-soft); color: var(--red-text); }
.ft-doc { background: var(--blue-soft); color: var(--blue); }
.ft-xls { background: var(--green-soft); color: var(--green); }
.ft-ppt { background: var(--amber-soft); color: var(--amber); }

/* Аватар: фото или инициалы на цвете по имени (--av) */
.avatar {
    display: inline-grid; place-items: center; flex: none;
    width: 34px; height: 34px; border-radius: 50%;
    background: color-mix(in srgb, var(--av, var(--cat-10)) 18%, var(--surface));
    color: color-mix(in srgb, var(--av, var(--cat-10)) 80%, var(--text));
    font-size: var(--fs-sm); font-weight: 700; letter-spacing: .02em;
}
img.avatar { object-fit: cover; padding: 0; background: var(--surface-3); }
.avatar-xs { width: 22px; height: 22px; font-size: 9.5px; }
.avatar-sm { width: 30px; height: 30px; font-size: var(--fs-xs); }
.avatar-lg { width: 44px; height: 44px; font-size: var(--fs-lg); }
.avatar-xl { width: 112px; height: 112px; font-size: 38px; }
.avatar-empty { background: var(--surface-3); color: var(--faint); }

.person { display: inline-flex; align-items: center; gap: 8px; color: var(--text); min-width: 0; }
.person:hover { color: var(--text); }
.person-name { font-weight: 700; color: var(--text); }

/* Горячая клавиша */
/* Как в HelpDesk (там действовало второе определение kbd): обычное начертание, размер мелкого текста */
kbd {
    display: inline-block; min-width: 22px; padding: 1px 6px; border: 1px solid var(--border-strong); border-bottom-width: 2px;
    border-radius: 6px; background: var(--surface-2); color: var(--text); font: var(--fs-sm) var(--mono); text-align: center;
}
.keys { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; }
.keys dt { white-space: nowrap; }
.keys dd { margin: 0; color: var(--text-2); }

/* ---------- Показатели ---------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 14px; margin-bottom: var(--sp-6); }
.stats-title { margin: 0 0 10px; font-size: var(--fs-md); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stat {
    display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 14px;
    align-items: center; padding: 18px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-xs); color: var(--text);
    transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
a.stat:hover { color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.stat-icon { grid-row: span 2; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; }
.stat-icon .icon { width: 20px; height: 20px; }
.stat-label { font-size: var(--fs-md); color: var(--muted); font-weight: 400; }
.stat-value { font-size: 30px; font-weight: 300; line-height: 1.1; color: var(--heading); font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat-blue { background: var(--blue-soft); color: var(--blue); }
.stat-violet, .stat-brand { background: var(--violet-soft); color: var(--violet); }
.stat-amber { background: var(--amber-soft); color: var(--amber); }
.stat-red { background: var(--red-soft); color: var(--red); }
.stat-green { background: var(--green-soft); color: var(--green); }
.stat-slate { background: var(--surface-3); color: var(--text-2); }
.stat-all { border-style: dashed; }
.stat-alert { border-color: color-mix(in srgb, var(--red) 35%, var(--border)); }
.stat-alert .stat-value { color: var(--red-text); }
/* Первая плитка — фирменная заливка */
.stats > .stat:first-child { background: var(--brand-fill); border-color: var(--brand-fill); }
.stats > .stat:first-child .stat-label { color: rgba(255, 255, 255, .78); }
.stats > .stat:first-child .stat-value { color: #fff; }
.stats > .stat:first-child .stat-icon { background: rgba(255, 255, 255, .14); color: #fff; }
.stats > .stat:first-child .spark-line { stroke: #6db5ff; }
.stats > .stat:first-child .spark-area { fill: rgba(109, 181, 255, .18); }
.stats > .stat:first-child .trend { color: rgba(255, 255, 255, .7); }

.stat-extra { grid-column: 1 / -1; display: flex; align-items: flex-end; gap: 10px; margin-top: 12px; }
.trend { flex: none; font-size: var(--fs-sm); color: var(--muted); white-space: nowrap; }
.trend-up { color: var(--green-text); }
.trend-down { color: var(--red-text); }
.spark { flex: 1; min-width: 40px; height: 28px; overflow: visible; }
.spark-line { fill: none; stroke: var(--primary); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark-area { fill: color-mix(in srgb, var(--primary) 14%, transparent); stroke: none; }

/* Баннер страницы: фирменный градиент, сводка и быстрые действия */
.hero {
    position: relative; overflow: hidden; display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-5); flex-wrap: wrap;
    margin-bottom: var(--sp-6); padding: 26px 28px; border-radius: var(--radius); color: #fff;
    background: var(--hero-gradient);
    box-shadow: 0 10px 30px rgba(13, 35, 59, .18);
}
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.hero::before { right: -60px; top: -80px; width: 240px; height: 240px; border: 34px solid rgba(255, 255, 255, .06); }
.hero::after { right: 140px; bottom: -110px; width: 180px; height: 180px; background: rgba(0, 120, 255, .25); filter: blur(30px); }
.hero-text { position: relative; z-index: 1; min-width: 0; }
.hero h1 { margin: 0; color: #fff; font-size: var(--fs-h1); font-weight: 300; }
.hero p { margin: 6px 0 0; color: #bcd2ea; font-size: var(--fs-base); }
.hero-actions { position: relative; z-index: 1; display: flex; gap: 8px; flex-wrap: wrap; }
.hero-btn {
    display: inline-flex; align-items: center; gap: 7px; padding: 8px 16px; border: 0; border-radius: var(--radius-round);
    background: rgba(255, 255, 255, .12); color: #fff; font: inherit; font-size: var(--fs-md); font-weight: 500; cursor: pointer; transition: background var(--t-fast), transform var(--t-fast);
}
.hero-btn:hover { color: #fff; background: rgba(255, 255, 255, .22); transform: translateY(-1px); }
.hero-btn-primary { background: var(--nav-accent); }
.hero-btn-primary:hover { background: #1a88ff; }

/* Полосы-диаграмма */
.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.bars li { display: grid; grid-template-columns: minmax(90px, 160px) 1fr 36px; align-items: center; gap: 12px; }
.bars-label { font-size: var(--fs-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars-track { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.bars-fill { display: block; height: 100%; border-radius: 4px; background: var(--primary); }
.bars-value { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Мини-полоска в строке таблицы */
.mini-bar { --m: var(--green); display: block; width: 64px; height: 4px; margin-top: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.mini-bar > i { display: block; height: 100%; border-radius: 2px; background: var(--m); }
.mini-warn { --m: var(--amber); }
.mini-bad { --m: var(--red); }
.mini-row { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); }
.mini-row .mini-bar { margin-top: 0; width: 48px; }

/* Кольца-индикаторы */
.gauges { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 4px; padding: 16px 10px; }
.gauge { --g: var(--green); display: grid; grid-template-rows: 72px auto auto; justify-items: center; text-align: center; position: relative; padding: 0 6px; }
.gauge svg { width: 72px; height: 72px; transform: rotate(-90deg); }
.gauge circle { fill: none; stroke-width: 3.4; }
.gauge-track { stroke: var(--surface-3); }
.gauge-fill { stroke: var(--g); stroke-linecap: round; animation: gauge-in .7s ease-out; }
@keyframes gauge-in { from { stroke-dasharray: 0 100; } }
.gauge-value { position: absolute; top: 0; left: 0; right: 0; height: 72px; display: grid; place-items: center; font-size: var(--fs-lg); font-weight: 700; color: var(--heading); }
.gauge-title { margin-top: 6px; font-size: var(--fs-md); font-weight: 700; color: var(--heading); }
.gauge-note { font-size: var(--fs-xs); color: var(--muted); line-height: 1.3; }
.gauge-warn { --g: var(--amber); }
.gauge-bad { --g: var(--red); }
.gauge-bad .gauge-value { color: var(--red); }

/* Шкала этапов */
.steps { list-style: none; display: flex; margin: 4px 0 22px; padding: 16px 8px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-xs); }
.step { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; min-width: 0; padding: 0 6px; }
.step::before { content: ""; position: absolute; top: 11px; right: 50%; width: 100%; height: 3px; background: var(--border); border-radius: 2px; }
.step:first-child::before { display: none; }
.step.is-done::before, .step.is-current::before { background: var(--primary); }
.step-dot { position: relative; z-index: 1; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--surface); border: 3px solid var(--border); color: #fff; }
.step-dot .icon { width: 13px; height: 13px; stroke-width: 3; }
.step.is-done .step-dot { background: var(--primary); border-color: var(--primary); }
.step.is-current .step-dot { border-color: var(--primary); box-shadow: 0 0 0 5px color-mix(in srgb, var(--primary) 18%, transparent); }
.step:last-child.is-current .step-dot { background: var(--green); border-color: var(--green); box-shadow: 0 0 0 5px var(--green-soft); }
.steps.is-waiting .step.is-current .step-dot { border-color: var(--amber); box-shadow: 0 0 0 5px var(--amber-soft); }
.step-title { font-size: var(--fs-md); color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step.is-done .step-title { color: var(--text-2); }
.step.is-current .step-title { color: var(--text); font-weight: 700; }
.step-note { font-size: var(--fs-xs); color: var(--faint); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Заготовки, пока данные грузятся */
.skeleton {
    display: block; height: 12px; border-radius: 6px;
    background: linear-gradient(90deg, var(--surface-3) 25%, color-mix(in srgb, var(--surface-3) 40%, var(--surface)) 50%, var(--surface-3) 75%);
    background-size: 200% 100%; animation: skeleton-shine 1.2s ease-in-out infinite;
}
.skeleton-short { width: 40%; }
.skeleton-title { height: 20px; width: 55%; margin-bottom: 8px; }
.skeleton-block { height: 180px; border-radius: 12px; }
.skeleton-row { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; list-style: none; }
@keyframes skeleton-shine { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Картинки и файлы */
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb { position: relative; width: 120px; height: 90px; border-radius: 9px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-3); }
.thumb-link { display: block; width: 100%; height: 100%; }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.thumb:hover img { transform: scale(1.04); }
.thumb-dl {
    position: absolute; top: 6px; right: 6px; display: grid; place-items: center; width: 28px; height: 28px;
    border-radius: var(--radius-sm); background: rgba(8, 18, 30, .72); color: #fff; opacity: .85; transition: opacity var(--t-fast), background var(--t-fast);
}
.thumb-dl:hover { opacity: 1; color: #fff; background: rgba(8, 18, 30, .9); }
.files-list { list-style: none; margin: 0; padding: 0 6px; }
.files-list li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 8px; padding: 5px 10px; border-radius: var(--radius-sm); font-size: var(--fs-md); }
.files-list li:hover { background: var(--surface-3); }
.files-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.files-name:hover { color: var(--primary); }
.files-size { color: var(--muted); font-size: var(--fs-sm); white-space: nowrap; }
.files-dl { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; color: var(--muted); }
.files-dl:hover { color: var(--primary); background: var(--primary-soft); }

/* ---------- Списки: вкладки, фильтры, таблицы ---------- */

.tabs-line { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: var(--sp-4); overflow-x: auto; scrollbar-width: none; }
.tab {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 12px; margin-bottom: -1px;
    border: 0; border-bottom: 2px solid transparent; background: none;
    color: var(--muted); font: inherit; font-weight: 700; white-space: nowrap; cursor: pointer;
    transition: color var(--t-base), border-color var(--t-base), background-color var(--t-base);
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--heading); border-bottom-color: var(--primary); }
.tab.is-active .count { background: var(--primary-soft); color: var(--primary-soft-text); }
.tabs-muted .tab { opacity: .55; }
.tabs-muted .tab:hover { opacity: 1; }

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: var(--sp-4); }
.filters .select { width: auto; max-width: 220px; }
.filters-search { position: relative; flex: 1 1 260px; max-width: 420px; }
.filters-search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.filters-search .input { min-height: 32px; padding: 5px 10px 5px 34px; font-size: var(--fs-md); }
.filters-total { margin-left: auto; }

/* Плашки активных фильтров: видно, что включено, ✕ снимает */
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 14px; }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px 4px 12px; border: 1px solid var(--primary); border-radius: var(--radius-round); background: var(--primary-soft); color: var(--primary-soft-text); font: inherit; font-size: var(--fs-md); cursor: pointer; }
.filter-chip .icon { width: 14px; height: 14px; }
.filter-chip:hover { background: var(--primary); color: var(--on-primary); }

/* Переключатель вида: таблица / карточки */
.view-switch { margin-left: auto; display: inline-flex; gap: 2px; padding: 3px; border-radius: 9px; background: var(--surface-3); align-self: center; }
.view-switch a { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 30px; height: 26px; padding: 0 7px; border-radius: 7px; color: var(--muted); font-size: var(--fs-sm); font-weight: 500; }
.view-switch a:hover { color: var(--text); }
.view-switch a.is-active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-xs); }
.view-switch .icon { width: 16px; height: 16px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
    padding: 10px 14px; text-align: left; white-space: nowrap;
    font-size: var(--fs-sm); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
    background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.table th:first-child { border-top-left-radius: var(--radius); }
.table th:last-child { border-top-right-radius: var(--radius); }
.table th a { color: inherit; display: inline-flex; align-items: center; gap: 3px; }
.table th a:hover { color: var(--text); }
.sort-icon { width: 13px; height: 13px; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .1s; }
.row-link { cursor: pointer; }
.row-link:hover { background: var(--surface-2); }
.table tr.is-muted { opacity: .55; }
.table tr.is-selected, tr.is-picked td { background: var(--primary-soft); }
.table tr.is-overdue td:first-child { box-shadow: inset 3px 0 0 var(--red); }
/* Текущая строка (J/K, открыта в панели), новая строка */
tr.is-current td { box-shadow: inset 0 0 0 9999px color-mix(in srgb, var(--primary) 8%, transparent); }
tr.is-current td:first-child { box-shadow: inset 3px 0 0 var(--primary), inset 0 0 0 9999px color-mix(in srgb, var(--primary) 8%, transparent); }
tr.is-new td:first-child { box-shadow: inset 3px 0 0 var(--green); }
.col-id { width: 70px; }
.col-actions { width: 56px; text-align: right; white-space: nowrap; }
.col-actions form { display: inline; }
.table .col-check { width: 40px; padding-right: 0; }
.row-check { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; vertical-align: middle; }
.table .col-menu { width: 40px; padding-left: 0; padding-right: 8px; text-align: right; }
.table th.col-menu, .table td.col-menu { position: sticky; right: 0; z-index: 1; background: var(--surface); }
.list-limit { margin: 0; padding: 12px 16px; border-top: 1px solid var(--border); font-size: var(--fs-md); }

/* Меню «⋯» строки */
.row-menu { position: relative; display: inline-block; }
.row-menu > summary { list-style: none; }
.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu-pop { position: fixed; z-index: var(--z-dropdown); min-width: 230px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; display: flex; flex-direction: column; text-align: left; }
.row-menu-pop a, .row-menu-pop button { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: var(--radius-sm); border: 0; background: none; color: var(--text); font: inherit; font-size: var(--fs-base); cursor: pointer; white-space: nowrap; }
.row-menu-pop a:hover, .row-menu-pop button:hover { background: var(--primary-soft); color: var(--primary-soft-text); }
.row-menu-pop .icon { width: 16px; height: 16px; color: var(--muted); }
.row-menu-pop form { margin: 0; display: contents; }

/* Массовые действия: тёмная «таблетка» внизу */
.bulk-bar {
    position: sticky; bottom: 16px; z-index: 15; margin: var(--sp-4) auto 0; width: fit-content; max-width: 100%;
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 10px 12px 10px 18px; border-radius: var(--radius-pill);
    background: var(--navy); color: #fff; box-shadow: var(--shadow-lg);
}
.bulk-bar b { font-weight: 500; }
.bulk-light { color: #fff !important; border-color: rgba(255, 255, 255, .4) !important; background: transparent !important; }
.bulk-light:hover { background: rgba(255, 255, 255, .1) !important; }

/* Плотность таблиц */
html.dense .table th, html.dense .table td { padding-top: 5px; padding-bottom: 5px; }
html.dense .table { font-size: var(--fs-md); }
html.dense .table .avatar-xs { width: 18px; height: 18px; }

/* Колонки: выбор, перестановка, ширина */
.col-chooser { position: relative; margin-left: auto; }
.col-chooser > summary { list-style: none; }
.col-chooser > summary::-webkit-details-marker { display: none; }
.col-chooser-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: var(--z-dropdown); display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; padding: 12px 14px; min-width: 340px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-md); }
th.col-movable { position: relative; cursor: grab; user-select: none; }
th.col-movable.is-dragging { opacity: .45; cursor: grabbing; }
.col-resize { position: absolute; top: 0; right: 0; width: 6px; height: 100%; cursor: col-resize; z-index: 2; }
.col-resize::after { content: ""; position: absolute; top: 25%; bottom: 25%; right: 0; width: 2px; border-radius: 2px; background: transparent; }
th:hover > .col-resize::after { background: var(--border-strong); }
.table [data-col].col-off { display: none; }
/* Перетаскивание колонки: поднятая колонка, «призрак» заголовка, место вставки */
html.col-dragging, html.col-dragging * { cursor: grabbing !important; user-select: none; }
.table .col-lifted { background: color-mix(in srgb, var(--primary) 10%, transparent) !important; color: var(--muted); }
.table th.col-lifted { box-shadow: inset 0 -2px 0 var(--primary); }
th.col-movable.is-dragging { opacity: 1; }
.col-ghost { position: fixed; z-index: var(--z-popover); pointer-events: none; transform: translate(-50%, -140%) rotate(-2deg); padding: 6px 12px; border-radius: var(--radius-sm); background: var(--primary); color: var(--on-primary); font-size: var(--fs-sm); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; box-shadow: 0 10px 24px -8px rgba(0, 0, 0, .5); }
.col-drop { position: fixed; z-index: var(--z-popover); width: 3px; border-radius: 2px; background: var(--primary); pointer-events: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent); }
.col-drop::before, .col-drop::after { content: ""; position: absolute; left: 50%; transform: translateX(-50%); border: 6px solid transparent; }
.col-drop::before { top: -2px; border-top-color: var(--primary); }
.col-drop::after { bottom: -2px; border-bottom-color: var(--primary); }

/* «Есть новые — показать» над списком */
.live-banner { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin: 0 0 12px; padding: 9px 14px; border: 1px solid var(--primary); border-radius: 10px; background: var(--primary-soft); color: var(--primary-soft-text); font: inherit; font-weight: 500; cursor: pointer; }

/* Свой порядок карточек ([data-reorder]): карточку берут целиком или за ручку */
.is-reorderable { cursor: grab; touch-action: pan-y; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.is-reorderable:focus-visible, [data-reorder-handle]:focus-visible { outline: none; box-shadow: var(--ring); }
[data-reorder-handle] { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; color: var(--faint); cursor: grab; touch-action: none; -webkit-touch-callout: none; }
[data-reorder-handle]:hover { background: var(--surface-3); color: var(--text); }
.is-reordering { position: relative; z-index: 2; opacity: .92; cursor: grabbing; box-shadow: var(--shadow-lg) !important; outline: 2px solid var(--primary); outline-offset: 2px; transform: scale(1.02); }
.is-reordering-box { outline: 2px dashed color-mix(in srgb, var(--primary) 35%, transparent); outline-offset: 6px; border-radius: var(--radius); }
html.reorder-dragging, html.reorder-dragging * { cursor: grabbing !important; -webkit-user-select: none; user-select: none; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Группы строк */
tr.group-row td { background: var(--surface-2); padding: 6px 12px !important; border-top: 1px solid var(--border-strong); }
.group-toggle { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; color: var(--heading); font: inherit; cursor: pointer; padding: 2px 0; }
.group-toggle .icon { width: 16px; height: 16px; transition: transform var(--t-base); }
tr.group-row.is-closed .group-toggle .icon { transform: rotate(-90deg); }

/* Липкая полоса длинного списка при прокрутке */
.sbar { position: fixed; z-index: var(--z-sbar); background: var(--bg); border-bottom: 1px solid var(--border); box-shadow: 0 6px 12px -10px rgba(13, 35, 59, .35); padding: 8px var(--page-pad) 0; }
.sbar-row { display: flex; align-items: center; gap: 8px; padding-bottom: 8px; }
.sbar-search { flex: 1 1 260px; max-width: 420px; margin: 0; }
.sbar-search .input { height: 32px; }
.sbar-tabs { position: relative; }
.sbar-tabs > summary { list-style: none; gap: 6px; }
.sbar-tabs > summary::-webkit-details-marker { display: none; }
.sbar-tabs > summary .count { margin-left: 2px; }
.sbar-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 2; min-width: 240px; max-height: 70vh; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-md); padding: 6px; display: flex; flex-direction: column; }
.sbar-menu a { display: flex; align-items: center; gap: 8px; padding: 7px 10px; margin: 0; border: 0; border-radius: var(--radius-sm); color: var(--text); white-space: nowrap; }
.sbar-menu a:hover { background: var(--primary-soft); }
.sbar-menu a.is-active { color: var(--primary); font-weight: 700; }
.sbar-menu .count { margin-left: auto; }
.sbar-menu-title { font-size: var(--fs-sm); color: var(--muted); padding: 8px 10px 4px; border-top: 1px solid var(--border); margin-top: 4px; }
.sbar-pop { padding: 4px 0 10px; }
.sbar-pop .filters { margin-bottom: 0; }
.sbar-title { font-size: var(--fs-lg); color: var(--heading); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%; }
.sbar-head { overflow: hidden; }
.sbar-head .table { margin: 0; }
.sbar-head .table td { display: none; }
.sbar-head .col-resize { display: none; }

/* Пагинатор */
.pager { display: flex; justify-content: center; gap: 4px; margin-top: var(--sp-5); flex-wrap: wrap; }
.pager-btn {
    display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 8px;
    border-radius: var(--radius-sm); color: var(--text-2); font-weight: 700;
}
.pager-btn:hover { background: var(--surface-3); color: var(--text); }
.pager-btn.is-active { background: var(--primary); color: var(--on-primary); }
.pager-gap { display: inline-grid; place-items: center; width: 24px; color: var(--faint); }
.page-size { display: inline-flex; align-items: center; gap: 8px; }
.page-size .select { width: auto; }

/* Пустое состояние */
.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 48px 24px; text-align: center; color: var(--muted); }
.empty h2, .empty h3 { color: var(--text); }
.empty h3 { margin: 0; font-size: var(--fs-xl); }
.empty p { margin: 0; max-width: 420px; }
.empty .btn { margin-top: 8px; }
.empty-icon {
    position: relative; display: grid; place-items: center; width: 64px; height: 64px; margin: 6px 0 12px;
    border-radius: 50%; background: var(--empty-gradient); color: #fff;
    box-shadow: 0 0 0 14px color-mix(in srgb, var(--primary) 9%, transparent), 0 10px 24px rgba(1, 54, 105, .25);
}
.empty-icon::before, .empty-icon::after { content: ""; position: absolute; border-radius: 50%; }
.empty-icon::before { width: 10px; height: 10px; top: -14px; right: -16px; background: #6db5ff; opacity: .8; }
.empty-icon::after { width: 6px; height: 6px; bottom: -8px; left: -20px; background: var(--amber); opacity: .7; }
.empty-icon .icon { width: 28px; height: 28px; }
.empty-happy .empty-icon { background: var(--empty-happy-gradient); box-shadow: 0 0 0 14px color-mix(in srgb, var(--green) 10%, transparent), 0 10px 24px rgba(15, 110, 86, .25); }
.empty-art { width: 180px; max-width: 70%; height: auto; margin: 0 auto 6px; display: block; }
.empty-sm { flex-direction: row; justify-content: center; padding: 28px 16px; font-size: var(--fs-md); }
.empty-page { min-height: 50vh; justify-content: center; }
.empty-code { font-size: 64px; font-weight: 300; line-height: 1; color: var(--heading); }

/* ---------- Быстрый переход (Ctrl+K) ---------- */

.palette { width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 120px); margin: 10vh auto auto; padding: 0; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
.palette::backdrop { background: var(--backdrop); }
.palette-box { display: flex; flex-direction: column; max-height: calc(100vh - 122px); }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.palette-input .icon { color: var(--muted); }
.palette-input input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); font: 16px var(--font); }
.palette-input input::-webkit-search-cancel-button { display: none; }
.palette-list { overflow: auto; padding: 6px; }
.palette-group { padding: 10px 10px 4px; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); }
.palette-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text); }
.palette-item .icon { color: var(--muted); }
.palette-item.is-active { background: var(--primary-soft); color: var(--primary-soft-text); }
.palette-item.is-active .icon { color: var(--primary); }
.palette-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-hint { font-size: var(--fs-sm); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.palette-empty { padding: 24px; text-align: center; color: var(--muted); }
.palette-foot { display: flex; gap: 16px; padding: 8px 16px; border-top: 1px solid var(--border); font-size: var(--fs-sm); color: var(--muted); }

/* ---------- Панель просмотра справа ---------- */

.peek { position: fixed; z-index: var(--z-peek); top: 0; right: 0; bottom: 0; width: min(760px, 52vw); background: var(--bg); border-left: 1px solid var(--border); box-shadow: -20px 0 40px -24px rgba(0, 0, 0, .45); display: none; flex-direction: column; }
body.peek-open .peek { display: flex; animation: peek-in .18s ease-out; }
@keyframes peek-in { from { transform: translateX(24px); opacity: .6; } }
.peek-bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 18px; border-bottom: 1px solid var(--border); background: var(--surface); }
.peek-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--heading); }
.peek-body { position: relative; flex: 1; display: flex; min-height: 0; }
.peek iframe { flex: 1; width: 100%; border: 0; background: var(--bg); }
.peek-skel { position: absolute; inset: 0; display: none; flex-direction: column; gap: 12px; padding: 22px 24px; background: var(--bg); }
.peek.is-loading .peek-skel { display: flex; animation: fade-in .15s .12s both; }
.peek-skel .skeleton-title { height: 26px; width: 60%; }
.peek-skel-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; margin: 10px 0; }
@keyframes fade-in { from { opacity: 0; } }

/* ---------- Страница входа (общая с темой Keycloak, ДИЗАЙН.md §5.9) ---------- */

.auth-body { background: var(--surface); }
.auth { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }
.auth-hero { position: relative; overflow: hidden; display: flex; align-items: center; padding: 48px 56px; color: #fff; background: #0d233b; }
.auth-hero.has-photo {
    background: linear-gradient(160deg, rgba(13, 35, 59, .78) 0%, rgba(13, 35, 59, .9) 60%, rgba(1, 54, 105, .95) 100%), var(--hero-photo) center / cover no-repeat, #0d233b;
}
.auth-hero-inner { position: relative; z-index: 1; max-width: 460px; }
.auth-logo { display: block; height: 110px; width: auto; }
.auth-frame { margin-top: 48px; padding: 30px 28px; border: 1.5px solid rgba(255, 255, 255, .85); }
.auth-greet { margin: 0 0 6px; font-size: var(--fs-lg); opacity: .85; }
.auth-hero h1 { margin: 0; color: #fff; font-size: var(--fs-display); font-weight: 300; }
.auth-hero p { margin-top: 14px; font-size: 16px; font-weight: 300; line-height: 1.6; opacity: .88; }
.auth-points { list-style: none; margin: 28px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; font-size: var(--fs-lg); }
.auth-points li { display: flex; align-items: center; gap: 10px; }
.auth-points .icon { display: grid; padding: 3px; width: 22px; height: 22px; border-radius: 50%; background: rgba(0, 120, 255, .35); }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--surface); }
.auth-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 18px; }
.auth-title { font-size: 30px; font-weight: 300; color: var(--heading); }
.auth-card > .muted { margin-top: -10px; }
.auth-card .flash { box-shadow: none; animation: none; }
.auth-foot { text-align: center; font-size: var(--fs-md); }
.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
/* Ошибка над формой (как alert у Keycloak): видна, только когда есть что сказать */
.auth-alert.validation-summary-valid { display: none; }
.auth-alert ul { margin: 0; padding: 0; list-style: none; }
.sidebar-login { margin-top: auto; }

/* ---------- Праздничное оформление ---------- */

.season-canvas { position: fixed; inset: 0; z-index: var(--z-season); pointer-events: none; }
.confetti-canvas { z-index: var(--z-tooltip); }
.confetti-msg { position: fixed; left: 50%; top: 28%; transform: translateX(-50%); z-index: calc(var(--z-tooltip) + 1); padding: 14px 22px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: 18px; font-weight: 700; color: var(--heading); animation: fade-in .3s ease-out; transition: opacity .4s; }
.confetti-msg.is-leaving { opacity: 0; }
.season-newyear .topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -7px; height: 10px; pointer-events: none;
    background: radial-gradient(circle, #f04438 3px, transparent 3.5px) 0 0 / 56px 10px, radial-gradient(circle, #fde047 3px, transparent 3.5px) 14px 0 / 56px 10px,
                radial-gradient(circle, #17b26a 3px, transparent 3.5px) 28px 0 / 56px 10px, radial-gradient(circle, #2f8fff 3px, transparent 3.5px) 42px 0 / 56px 10px;
    animation: garland 2.4s steps(2) infinite; }
@keyframes garland { 50% { filter: brightness(1.6) saturate(1.3); opacity: .75; } }
.season-newyear .hero-text h1::after { content: " 🎄"; }
.season-march8 .topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 3px; background: linear-gradient(90deg, #f472b6, #86efac, #f472b6); }
.season-march8 .hero-text h1::after { content: " 🌷"; }
.season-feb23 .topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 4px; background: repeating-linear-gradient(90deg, #15803d 0 40px, #ca8a04 40px 80px); }
.season-feb23 .hero-text h1::after { content: " 🎖"; }
.season-newyear .auth-frame h1::after { content: " ❄"; }
.season-march8 .auth-frame h1::after { content: " 🌷"; }

/* ---------- Плавные переходы ---------- */

@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
@keyframes panel-in { from { opacity: 0; transform: translateY(4px); } }
.row-menu[open] > .row-menu-pop, .col-chooser[open] > .col-chooser-pop, .picker-list:not([hidden]) { animation: pop-in .14s ease-out; transform-origin: top right; }
[data-panel]:not([hidden]) { animation: panel-in .18s ease-out; }
.icon-btn, .chip-link, .nav-link, .table tbody tr, .card { transition: background-color var(--t-base), border-color var(--t-base), color var(--t-base), box-shadow var(--t-base); }
dialog[open] { animation: pop-in .16s ease-out; }
dialog[open]::backdrop { animation: fade-in .16s ease-out; }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media (hover: none) {
    .copy-btn { opacity: 1; }
}

/* ---------- Адаптивность: 1100 / 960 / 640 (ДИЗАЙН.md, решение 7) ---------- */

@media (max-width: 1100px) {
    .layout-aside, .layout-aside-left { grid-template-columns: minmax(0, 1fr); }
    .sticky { position: static; }
    .hide-md { display: none; }
    .only-md { display: block; }
}

@media (max-width: 960px) {
    .sidebar {
        position: fixed; left: 0; top: 0; bottom: 0;
        transform: translateX(-100%); transition: transform .2s ease;
        box-shadow: var(--shadow-lg);
    }
    body.sidebar-open .sidebar { transform: none; }
    body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: calc(var(--z-sidebar) - 5); background: rgba(8, 10, 14, .4); }
    .topbar .menu-btn { display: inline-grid; }
    .grid-2, .grid-wide-left { grid-template-columns: minmax(0, 1fr); }
    .peek { width: 100vw; }
    .auth { grid-template-columns: 1fr; }
    .auth-hero { padding: 32px 24px; }
    .auth-frame { margin-top: 24px; }
    .auth-hero h1 { font-size: var(--fs-h1); }
    .auth-points { display: none; }
}

@media (max-width: 640px) {
    .content { padding: 20px 16px; }
    .topbar { padding: 0 12px; gap: 6px; }
    .topbar-kbd, .palette-foot, .palette-hint { display: none; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .show-sm { display: block; }
    .hide-sm { display: none; }
    h1 { font-size: 21px; }
    .page-head > .btn { width: 100%; }
    .filters .select { flex: 1 1 140px; max-width: none; }
    .hero { padding: 20px; }
    .hero h1 { font-size: 22px; }
    .bars li { grid-template-columns: 100px 1fr 30px; }
    .step-note { display: none; }
    .step-title { font-size: var(--fs-xs); }
    .toasts { bottom: 16px; right: 16px; }

    /* Таблица .table-cards-sm — строками-карточками с подписями из data-label */
    .table.table-cards-sm thead { display: none; }
    .table.table-cards-sm, .table.table-cards-sm tbody { display: block; }
    .table.table-cards-sm tr { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); position: relative; }
    .table.table-cards-sm td { display: block; padding: 0; border: 0; min-width: 0; text-align: left !important; }
    .table.table-cards-sm td.col-off, .table.table-cards-sm td:empty { display: none; }
    .table.table-cards-sm td:first-child, .table.table-cards-sm td.col-main { grid-column: 1 / -1; font-size: var(--fs-lg); }
    .table.table-cards-sm td[data-label]:not(:first-child):not(.col-main):not(.col-menu):not(.col-check)::before { content: attr(data-label); display: block; font-size: var(--fs-xs); color: var(--muted); }
    .table.table-cards-sm tr:has(> td.col-check) { padding-left: 44px; }
    /* grid-column: auto — иначе флажок отсчитывается от области сетки, а не от края строки */
    .table.table-cards-sm td.col-check { position: absolute; left: 14px; top: 14px; grid-column: auto; }
    .table.table-cards-sm td.col-check + td { grid-column: 1 / -1; font-size: var(--fs-lg); }
    .table.table-cards-sm td.col-check + td::before { display: none !important; }
    .table.table-cards-sm td.col-menu { position: absolute; right: 8px; top: 8px; width: auto; background: none; }
    .table.table-cards-sm .hide-sm, .table.table-cards-sm .hide-md { display: block; }
    /* Полосы «просрочено» и «новая» — по краю карточки, а не у первой ячейки */
    .table.table-cards-sm tr td:first-child { box-shadow: none; }
    .table.table-cards-sm tr.is-overdue { box-shadow: inset 3px 0 0 var(--red); }
    .table.table-cards-sm tr.is-new { box-shadow: inset 3px 0 0 var(--green); }
    .table.table-cards-sm tr.group-row { display: block; padding: 0; }
    .table.table-cards-sm tr.group-row td { display: block; }
    .table-wrap:has(.table-cards-sm) { overflow-x: visible; }
}
