/* ==========================================================================
   HelpDesk — дизайн-система в корпоративном стиле Reynaers (reynaers4you.ru):
   тёмно-синий #0D233B, фирменный синий #013669, акцент #0078FF, шрифт Roboto.
   Светлая и тёмная темы, без внешних зависимостей.
   ========================================================================== */

@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;

    --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: #013669;  --violet-soft: #e6ecf3;  --violet-text: #013669;
    --gray-soft: #eef2f5; --gray-text: #5b6773;

    --note-bg: #fffcf0;
    --note-border: #fedf89;

    --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-lg: 0 16px 40px -12px rgba(13, 35, 59, .25);

    --radius: 16px;
    --radius-sm: 8px;
    --radius-pill: 24px;
    --sidebar-w: 256px;
    --font: Roboto, "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --mono: "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;
    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-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-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: 14px/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: 28px; font-weight: 300; }
h2 { font-size: 15px; font-weight: 500; }
h3 { font-size: 15px; 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: 12.5px; }
.block { display: block; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.req { color: var(--red); }

.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.stack-lg { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* ---------- Каркас ---------- */

.app { display: flex; min-height: 100vh; }

.sidebar {
    position: sticky; top: 0;
    width: var(--sidebar-w); height: 100vh; flex: none;
    display: flex; flex-direction: column; gap: 16px;
    padding: 18px 14px 14px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px; color: var(--text); font-weight: 700; font-size: 16px; }
.brand:hover { color: var(--text); }
.brand-mark {
    display: grid; place-items: center;
    width: 32px; height: 32px; border-radius: 9px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff; box-shadow: 0 4px 12px -4px rgba(99, 102, 241, .6);
}
.brand-mark .icon { width: 18px; height: 18px; }

.new-ticket { margin: 2px 0 4px; }
/* Вторая кнопка создания: та же форма, что у «Новой заявки», но спокойный тёмно-синий в тон меню. */
.sidebar .new-task { margin: 4px 0 4px; color: #fff; background: #1c3d61; border-color: transparent; }
.sidebar .new-task:hover { color: #fff; background: #24496f; }

/* Прокручивается только список разделов: логотип и кнопки сверху, карточки ссылок и пользователь снизу всегда на виду. */
.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: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: var(--radius-sm);
    color: var(--text-2); font-weight: 500;
    transition: background .12s, color .12s;
}
.nav-link .icon { color: var(--muted); }
.nav-link:hover { background: var(--surface-3); color: var(--text); }
.nav-link.is-active { background: var(--primary-soft); color: var(--primary-soft-text); }
.nav-link.is-active .icon { color: var(--primary-soft-text); }

.sidebar-user {
    display: flex; align-items: center; gap: 10px;
    padding: 10px; border-radius: var(--radius);
    background: var(--surface-2); border: 1px solid var(--border);
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-role { font-size: 12px; color: var(--muted); }
.sidebar-user form { margin: 0; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 12px;
    height: 60px; 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: 10px;
    background: var(--surface); color: var(--text); font: inherit;
    transition: border-color .12s, box-shadow .12s;
}
.topbar-search input:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.topbar .icon-btn:last-child { margin-left: auto; }
.topbar .menu-btn { display: none; }

/* Резиновая ширина: страницы занимают всё окно, поля растут вместе с экраном. */
.content { width: 100%; padding: 28px clamp(16px, 2.2vw, 40px); }

.sidebar-backdrop { display: none; }

/* ---------- Заголовки страниц ---------- */

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head > div:first-child { min-width: 0; }
.page-head p { margin-top: 4px; }
.crumbs { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: 13px; color: var(--muted); }
.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: 10px;
    font: inherit; font-weight: 600; white-space: nowrap;
    cursor: pointer; user-select: none;
    transition: background .12s, border-color .12s, box-shadow .12s, color .12s, 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); box-shadow: var(--shadow-xs); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); color: var(--on-primary); }
.btn-secondary { background: var(--surface); color: var(--text-2); border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { background: var(--surface-2); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger-text { color: var(--red) !important; }
.btn-danger-text:hover { background: var(--red-soft) !important; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 15px; }
.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 .12s, color .12s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn-sm { width: 26px; height: 26px; border-radius: 7px; }
.icon-btn-sm .icon { width: 14px; height: 14px; }

.link { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; font-weight: 600; }
.link .icon { width: 14px; height: 14px; }
.link-btn { padding: 0; border: 0; background: none; color: var(--primary); font: inherit; font-weight: 600; 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: 13px; font-weight: 600; color: var(--text-2); }
.field-end { justify-content: flex-end; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.help { font-size: 12.5px; color: var(--muted); }
.field-error { font-size: 12.5px; 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: 10px;
    background: var(--surface); color: var(--text);
    font: inherit;
    transition: border-color .12s, box-shadow .12s;
}
.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: 15px; }
.input-sm, .select-sm { min-height: 32px; padding: 5px 10px; font-size: 13px; border-radius: 8px; }
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: 12.5px; line-height: 1.4; }
.check-pill {
    align-items: center; height: 32px; padding: 0 12px;
    border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); font-size: 13px;
}
.check-pill input { margin: 0; }
.check-pill:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-soft-text); }

.segmented {
    display: inline-flex; gap: 2px; padding: 3px;
    background: var(--surface-3); border-radius: 10px; 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: 8px;
    font-size: 13px; font-weight: 600; color: var(--muted);
    transition: background .12s, color .12s, box-shadow .12s;
}
.segmented label:hover > span { color: var(--text); }
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.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; }

.prio-opt i, .prio i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.prio-opt.prio-low i { background: var(--faint); }
.prio-opt.prio-normal i { background: var(--blue); }
.prio-opt.prio-high i { background: var(--amber); }
.prio-opt.prio-critical i { background: var(--red); }

/* Загрузка файлов */
.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 .12s, background .12s;
}
.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: 12px; 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: 8px;
    background: var(--surface-3); font-size: 12.5px;
}
.file-list li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list li small { color: var(--muted); }
.file-btn { cursor: pointer; }

/* Выбор из списка с поиском */
.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: 10px; background: var(--surface);
    cursor: text; transition: border-color .12s, box-shadow .12s;
}
.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: 50;
    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: 12px; }
.picker-item.is-active { background: var(--surface-3); }
.picker-item.is-selected { color: var(--primary-soft-text); font-weight: 600; }
.picker-empty { padding: 10px; color: var(--muted); font-size: 13px; }
.chip {
    display: inline-flex; align-items: center; gap: 4px; max-width: 100%;
    height: 26px; padding: 0 4px 0 10px; border-radius: 7px;
    background: var(--primary-soft); color: var(--primary-soft-text); font-size: 13px; 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); }

/* ---------- Карточки ---------- */

.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-narrow { max-width: 480px; }
.card-tint { background: linear-gradient(160deg, var(--primary-soft), var(--surface) 70%); }
.sticky { position: sticky; top: 84px; }
.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: 12px; font-weight: 600;
}

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.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: 24px; align-items: start; }
.layout-aside-left { grid-template-columns: clamp(240px, 16vw, 320px) minmax(0, 1fr); }

/* ---------- Сообщения ---------- */

/* Всплывающие уведомления: выезжают справа сверху, «Сохранено» исчезает само, ошибка ждёт закрытия */
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 90; 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, #f79009); }
.flash-warning > .icon { color: var(--amber, #f79009); }
.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; }
@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); } }
@media (max-width: 640px) { .toasts { bottom: 16px; right: 16px; } }
.flash-x { display: grid; place-items: center; padding: 2px; border: 0; background: none; color: inherit; opacity: .6; cursor: pointer; }
.flash-x:hover { opacity: 1; }
@keyframes flash-in { from { opacity: 0; transform: translateY(-4px); } }

/* ---------- Значки ---------- */

.badge {
    display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px;
    border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-new { background: var(--blue-soft); color: var(--blue-text); }
.badge-progress { background: var(--violet-soft); color: var(--violet-text); }
.badge-waiting { background: var(--amber-soft); color: var(--amber-text); }
.badge-resolved { background: var(--green-soft); color: var(--green-text); }
.badge-closed { background: var(--gray-soft); color: var(--gray-text); }
.badge-red { background: var(--red-soft); color: var(--red-text); }

/* ---------- Админка статусов ---------- */

.col-order { width: 84px; }
.order-btns { display: flex; gap: 2px; }
.order-btns form { margin: 0; }
.order-btns .icon-btn:disabled { opacity: .3; cursor: default; background: none; }
.status-role { display: flex; align-items: center; gap: 5px; margin-top: 6px; }
.status-role .icon { width: 12px; height: 12px; vertical-align: 0; }
.color-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.color-pick label { cursor: pointer; }
.color-pick input { position: absolute; opacity: 0; pointer-events: none; }
.color-pick .badge { border: 2px solid transparent; transition: border-color .12s; }
.color-pick input:checked + .badge { border-color: currentColor; }
.color-pick input:focus-visible + .badge { box-shadow: var(--ring); }

/* ---------- Задачи ---------- */

.task-list { list-style: none; margin: 0; padding: 6px; }
.task-list-compact { padding: 4px 6px; }
.task-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 9px; }
.task-row:hover { background: var(--surface-2); }
.task-row.is-closed .task-title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.task-check-form { margin: 0; display: contents; }
.task-check {
    display: grid; place-items: center; flex: none;
    width: 22px; height: 22px; padding: 0;
    border: 1.5px solid var(--border-strong); border-radius: 50%;
    background: var(--surface); color: transparent; cursor: pointer;
    transition: border-color .12s, background .12s, color .12s;
}
.task-check .icon { width: 13px; height: 13px; stroke-width: 3; vertical-align: 0; }
.task-check:hover:not(.is-static) { border-color: var(--green); color: var(--green); }
.task-check.is-done { background: var(--green); border-color: var(--green); color: #fff; }
.task-check.is-static { cursor: default; }
.task-row.is-overdue .task-check { border-color: var(--red); }
.task-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; color: var(--text); }
.task-main:hover { color: var(--text); }
.task-title { font-weight: 500; overflow-wrap: anywhere; }
.task-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.task-meta:empty { display: none; }
.task-meta .icon { width: 12px; height: 12px; }
.task-progress { height: 4px; background: var(--surface-3); }
.task-progress span { display: block; height: 100%; background: var(--green); transition: width .3s; }
.count-red { background: var(--red-soft) !important; color: var(--red-text) !important; }
.count-green { background: var(--green-soft) !important; color: var(--green-text) !important; }
.dash-tasks { margin-bottom: 20px; }

.quick-task { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; margin-bottom: 18px; }
.quick-task-icon { color: var(--primary); }
.quick-task-input { flex: 1; min-width: 0; height: 34px; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 14.5px; }
.quick-task-input::placeholder { color: var(--faint); }
.quick-task .select { width: auto; }
.quick-row { display: flex; align-items: center; gap: 8px; }
.quick-row > .select, .quick-row > .picker { flex: 1; min-width: 0; }
.quick-row .picker-box { min-height: 32px; padding: 1px 10px; border-radius: 8px; font-size: 13px; }

.linked-ticket {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 10px 14px; border-radius: var(--radius); background: var(--primary-soft); color: var(--primary-soft-text); font-size: 13.5px;
}
.linked-ticket a { color: inherit; }
.comment { display: flex; gap: 10px; }
.comment-box { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.comment-form { display: flex; flex-direction: column; gap: 8px; }
.hours-field { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.hours-field .input { width: 64px; }
.msg-action { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; color: var(--faint); }
.msg-action:hover { background: var(--surface-3); color: var(--primary); }

.card-form { max-width: none; }
.card-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--border); }
.chips-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn {
    height: 26px; padding: 0 10px; border: 1px solid var(--border); border-radius: 7px;
    background: var(--surface); color: var(--text-2); font: inherit; font-size: 12.5px; cursor: pointer;
}
.chip-btn:hover { border-color: var(--primary); color: var(--primary); }
.weekdays { display: flex; flex-wrap: wrap; gap: 6px; }
.weekdays label { cursor: pointer; }
.weekdays input { position: absolute; opacity: 0; pointer-events: none; }
.weekdays span {
    display: inline-grid; place-items: center; width: 42px; height: 36px;
    border: 1px solid var(--border-strong); border-radius: 9px; font-weight: 600; color: var(--text-2);
}
.weekdays input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.weekdays input:focus-visible + span { box-shadow: var(--ring); }

.tpl-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.tpl-num { display: grid; place-items: center; flex: none; width: 24px; height: 24px; margin-top: 4px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-soft-text); font-size: 12px; font-weight: 700; }
.tpl-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.tpl-row { display: flex; gap: 8px; flex-wrap: wrap; }
.tpl-row .select { flex: 1 1 200px; width: auto; }
.tpl-days { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.tpl-days .input { width: 64px; }
.show-sm { display: none; }
.layout-aside > aside .form-row { grid-template-columns: 1fr; }

/* ---------- Active Directory ---------- */

.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; }
.sync-domains { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-2); }
.sync-domains .icon { color: var(--green); }
.sync-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.sync-stats span { padding: 6px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.sync-stats b { color: var(--text); font-size: 15px; margin-right: 4px; }
.sync-list summary { cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.sync-list ul { margin: 8px 0 0; padding-left: 20px; max-height: 320px; overflow-y: auto; font-size: 13px; color: var(--text-2); columns: 2 260px; }
.dup-list { list-style: none; margin: 0; padding: 6px; }
.dup-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.dup-list li:last-child { border-bottom: 0; }
.dup-names { display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; min-width: 0; }
.dup-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.dup-actions form { margin: 0; }
.more summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--primary); margin-bottom: 4px; }
.more[open] summary { margin-bottom: 14px; }
.card-body-tight { padding-top: 0; }
.sync-manual { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--border); }
.sync-manual .ticket-actions { flex-direction: column; }
.sync-manual .ticket-actions form, .sync-manual .ticket-actions .btn { width: 100%; }
.page-head .help { flex-basis: 100%; text-align: right; }
.user-logins { margin-top: 24px; }
.login-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.login-list li { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 12px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); }
.merge-form { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; padding-top: 14px; border-top: 1px solid var(--border); }
.merge-form .field { flex: 1 1 320px; }

/* ---------- Список пользователей: доступ и массовые действия ---------- */

.page-size { display: inline-flex; align-items: center; gap: 8px; }
.page-size .select { width: auto; }
.filters-total { margin-left: auto; }
.col-check { width: 44px; padding-right: 0 !important; }
.row-check { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; vertical-align: middle; }
.col-access { width: 120px; }
.users-table tr.is-selected-row { background: var(--primary-soft); }
.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 .15s;
}
.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 .15s;
}
.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: 12.5px; color: var(--muted); min-width: 26px; }
.switch.is-busy { opacity: .6; pointer-events: none; }
.users-table tr.is-muted .switch { opacity: 1; }
.users-table tr.is-muted td:not(.col-access):not(.col-check) { opacity: .55; }
.users-table tr.is-muted { opacity: 1; }

.bulk-bar {
    position: sticky; bottom: 16px; z-index: 15; margin: 16px 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; }

/* ---------- Колокольчик ---------- */

.nav-count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--primary-soft); color: var(--primary-soft-text); font-size: 11.5px; font-weight: 700; display: inline-grid; place-items: center; }
.nav-count.is-alert { background: var(--red); color: #fff; }
.bell { position: relative; margin-left: auto; }
.topbar .bell + .icon-btn { margin-left: 0; }
.bell .icon-btn { position: relative; }
.bell-count {
    position: absolute; top: 3px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px;
    border-radius: 8px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
    box-shadow: 0 0 0 2px var(--bg);
}
.bell-panel {
    position: absolute; right: 0; top: calc(100% + 8px); z-index: 60;
    width: min(380px, calc(100vw - 24px)); max-height: 480px; display: flex; flex-direction: column;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.bell-head, .bell-foot { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; }
.bell-head { border-bottom: 1px solid var(--border); }
.bell-foot { border-top: 1px solid var(--border); justify-content: center; }
.bell-list { list-style: none; margin: 0; padding: 4px; overflow-y: auto; }
.bell-list a { display: flex; align-items: flex-start; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--text); font-size: 13px; }
.bell-list a:hover { background: var(--surface-2); color: var(--text); }
.bell-list a.is-unread { background: var(--primary-soft); }
.bell-list a.is-unread { box-shadow: inset 3px 0 0 var(--primary); }
.bell-list a.is-unread .bell-text > span { font-weight: 600; color: var(--heading); }
.bell-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bell-group { padding: 10px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.bell-ic { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--surface-2); color: var(--muted); }
.bell-ic .icon { width: 16px; height: 16px; }
.bell-ic-ticket { background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); }
.bell-ic-reply { background: color-mix(in srgb, #0ea5e9 15%, transparent); color: #0284c7; }
.bell-ic-task { background: color-mix(in srgb, #10b981 15%, transparent); color: #059669; }
.bell-ic-license { background: color-mix(in srgb, #f59e0b 18%, transparent); color: #b45309; }
.bell-ic-computer { background: color-mix(in srgb, #8b5cf6 15%, transparent); color: #7c3aed; }
.bell-ic-kb { background: color-mix(in srgb, #ec4899 14%, transparent); color: #db2777; }
.bell-list small { color: var(--muted); font-size: 11.5px; }
.bell-empty { padding: 24px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- Админка почты ---------- */

.form-row-3 { grid-template-columns: 2fr 1fr 1.2fr; }
.mail-status {
    display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px;
    border-radius: 10px; background: var(--green-soft); color: var(--green-text); font-size: 13px; font-weight: 500;
}
.mail-status.is-error { background: var(--red-soft); color: var(--red-text); max-width: 520px; }
.mail-log-card { margin-top: 24px; }
.text-error { color: var(--red-text); }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--red-text); color: #fff; }

.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: rgba(8, 10, 14, .45); }
.dialog h2 { font-size: 17px; }

.prio { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.prio-low i { background: var(--faint); }
.prio-normal i { background: var(--blue); }
.prio-high i { background: var(--amber); }
.prio-critical { color: var(--red-text); font-weight: 600; }
.prio-critical i { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }

.tag {
    display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px;
    border-radius: 6px; background: var(--gray-soft); color: var(--gray-text);
    font-size: 12px; font-weight: 600; 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 { background: var(--violet-soft); color: var(--violet-text); }

.due { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.due .icon { width: 14px; height: 14px; }
.due-soon { color: var(--amber-text); font-weight: 600; }
.due-over { color: var(--red-text); font-weight: 600; }

.avatar {
    display: inline-grid; place-items: center; flex: none;
    width: 34px; height: 34px; border-radius: 50%;
    background: color-mix(in srgb, var(--av) 18%, var(--surface));
    color: color-mix(in srgb, var(--av) 80%, var(--text));
    font-size: 12.5px; font-weight: 700; letter-spacing: .02em;
}
.avatar-xs { width: 22px; height: 22px; font-size: 9.5px; }
.avatar-sm { width: 30px; height: 30px; font-size: 11px; }
.avatar-lg { width: 44px; height: 44px; font-size: 15px; }

.person { display: inline-flex; align-items: center; gap: 8px; color: var(--text); min-width: 0; }
.person:hover { color: var(--text); }
.person-name { font-weight: 600; color: var(--text); }

/* ---------- Обзор ---------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 14px; margin-bottom: 24px; }
.list-limit { margin: 0; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 13px; }
/* Заготовки строк, пока данные грузятся */
.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-row { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; list-style: none; }
.viewer-skeleton { display: flex; flex-direction: column; gap: 12px; width: min(720px, 92%); margin: 40px auto; padding: 32px; background: #fff; border-radius: 8px; }
@keyframes skeleton-shine { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- Визуальный редактор статей ---------- */
.rte { border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); }
.rte:focus-within { border-color: var(--primary); box-shadow: var(--ring); }
/* Панель прилипает под верхней строкой сайта (60px) — при правке длинной статьи кнопки всегда под рукой. */
.rte-toolbar {
    position: sticky; top: 60px; z-index: 15; box-shadow: 0 6px 12px -10px rgba(13, 35, 59, .35); display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 6px;
    border-bottom: 1px solid var(--border); background: var(--surface-2); border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.rte-toolbar button {
    display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 7px; border: 0; border-radius: 7px;
    background: none; color: var(--text-2); font: inherit; font-size: 14px; cursor: pointer;
}
.rte-toolbar button:hover { background: var(--surface-3); color: var(--text); }
.rte-toolbar button.is-on { background: var(--primary-soft); color: var(--primary); }
.rte-toolbar .icon { width: 17px; height: 17px; }
.rte-toolbar .rte-ref { font-weight: 700; color: var(--primary); }
.rte-block { width: auto; height: 30px; }
.rte-sep { width: 1px; height: 20px; margin: 0 4px; background: var(--border); }
.rte-table { display: inline-flex; align-items: center; gap: 2px; }
.rte-table[hidden] { display: none; }
.rte-table button { font-size: 12.5px; }
.rte-area { min-height: 360px; padding: 16px 18px; outline: none; color: var(--text); }
.rte-area img { max-width: 100%; }
.rte-area table, .kb-article table { border-collapse: collapse; width: 100%; }
.rte-area td, .rte-area th { border: 1px solid var(--border-strong); padding: 6px 10px; min-width: 60px; }
.rte-area th { background: var(--surface-2); }
/* Цвета текста и выделения из палитры редактора (в статье и в редакторе) */
.tc-red { color: #d92d20; } .tc-orange { color: #dc6803; } .tc-green { color: #079455; }
.tc-blue { color: #0b6bcb; } .tc-violet { color: #6941c6; } .tc-gray { color: #667085; }
[class*="hl-"]:is(span, i) { color: #1d2939; padding: 0 2px; border-radius: 3px; }
.hl-yellow { background: #fff1a8; } .hl-green { background: #c6f6d5; } .hl-blue { background: #cfe6ff; } .hl-pink { background: #ffd6e7; }
:root[data-theme="dark"] .tc-red { color: #ff8a80; } :root[data-theme="dark"] .tc-orange { color: #fdb022; }
:root[data-theme="dark"] .tc-green { color: #47cd89; } :root[data-theme="dark"] .tc-blue { color: #6db5ff; }
:root[data-theme="dark"] .tc-violet { color: #b692f6; } :root[data-theme="dark"] .tc-gray { color: #98a2b3; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .tc-red { color: #ff8a80; } :root:not([data-theme="light"]) .tc-orange { color: #fdb022; }
    :root:not([data-theme="light"]) .tc-green { color: #47cd89; } :root:not([data-theme="light"]) .tc-blue { color: #6db5ff; }
    :root:not([data-theme="light"]) .tc-violet { color: #b692f6; } :root:not([data-theme="light"]) .tc-gray { color: #98a2b3; }
}
.kb-article img { height: auto; }
/* Размер шрифта и выравнивание из редактора */
.fs-sm { font-size: .85em; } .fs-lg { font-size: 1.25em; } .fs-xl { font-size: 1.6em; line-height: 1.3; }
.ta-center { text-align: center; } .ta-right { text-align: right; } .ta-justify { text-align: justify; }
.rte-fs { display: inline-flex !important; align-items: baseline; justify-content: center; font-weight: 700; font-size: 15px !important; }
.rte-fs small { font-size: 10px; margin-left: 1px; }
.rte-palette-list { grid-template-columns: 1fr !important; min-width: 170px; }
.rte-palette-list button { width: 100% !important; height: auto !important; justify-content: flex-start; padding: 6px 10px !important; display: flex !important; }
.rte-link-dialog .rte-link-kind { width: 100%; }

.rte-drop { position: relative; display: inline-flex; }
.rte-color { flex-direction: column; gap: 1px; padding-top: 3px !important; }
.rte-color > span { font-weight: 700; line-height: 1; }
.rte-marker { font-size: 12px; font-style: italic; }
.rte-swatch { display: block; width: 16px; height: 3px; border-radius: 2px; background: currentColor; }
.rte-swatch[class*="tc-"] { background: currentColor; }
.rte-swatch.hl-yellow, .rte-swatch.hl-green, .rte-swatch.hl-blue, .rte-swatch.hl-pink { padding: 0; }
.rte-palette {
    position: absolute; top: calc(100% + 4px); left: 0; z-index: 20; display: grid; grid-template-columns: repeat(6, 30px); gap: 4px;
    padding: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg);
}
.rte-palette[data-palette="hl"] { grid-template-columns: repeat(4, 30px); }
.rte-palette[hidden] { display: none; }
.rte-palette button { width: 30px; height: 30px; padding: 0 !important; min-width: 0 !important; }
.rte-dot { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; font-style: normal; font-weight: 700; font-size: 13px; border: 1px solid var(--border); }
.rte-palette .rte-palette-clear { grid-column: 1 / -1; width: auto; height: 28px; font-size: 12.5px; }

/* Выбранная картинка: рамка, уголок и быстрые размеры */
.rte-body { position: relative; }
.rte-area img { cursor: pointer; }
.rte-imgbox { position: absolute; z-index: 4; pointer-events: none; outline: 2px solid var(--primary); outline-offset: 1px; border-radius: 4px; }
.rte-imgbox[hidden] { display: none; }
.rte-imgbar {
    position: absolute; left: 8px; top: 8px; display: flex; align-items: center; gap: 2px; padding: 4px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 9px; box-shadow: var(--shadow-lg); pointer-events: auto; white-space: nowrap;
}
.rte-imgbar button { padding: 4px 9px; border: 0; border-radius: 6px; background: none; color: var(--text-2); font: inherit; font-size: 12.5px; cursor: pointer; }
.rte-imgbar button:hover { background: var(--primary-soft); color: var(--primary); }
.rte-imgsize { padding: 0 6px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rte-handle {
    position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px; border-radius: 4px; pointer-events: auto;
    background: var(--primary); border: 2px solid #fff; cursor: nwse-resize; box-shadow: var(--shadow-sm);
}

.rte-hint { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 8px 12px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }
kbd {
    display: inline-block; min-width: 20px; padding: 0 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px;
    border-radius: 5px; background: var(--surface); color: var(--text); font: 600 11.5px/18px var(--mono, Consolas, monospace); text-align: center;
}
.kb-drop {
    display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 10px; border: 2px dashed var(--border-strong);
    border-radius: var(--radius-sm); color: var(--text-2); font-size: 13px; text-align: center; cursor: pointer;
}
.kb-drop small { color: var(--muted); font-size: 11.5px; }
.kb-drop:hover, .kb-drop.is-over { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.files-card .files-list { padding: 0; }
.kb-files { padding: 6px 6px 0 !important; }

/* Ссылки «#»: плашки в тексте и список подсказок */
.ref {
    display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 1px 9px 1px 7px; margin: 0 1px;
    border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--border)); border-radius: 999px;
    background: var(--primary-soft); color: var(--primary-soft-text); font-size: .92em; font-weight: 500; line-height: 1.6;
    text-decoration: none !important; vertical-align: baseline; white-space: nowrap;
}
.ref > span { overflow: hidden; text-overflow: ellipsis; }
.ref .icon { width: 14px; height: 14px; flex: none; }
.ref .badge { height: 18px; padding: 0 7px; font-size: 11px; }
.ref .badge::before { display: none; }
a.ref:hover { border-color: var(--primary); color: var(--primary); }
.ref-lock, .ref-missing { background: var(--surface-3); border-color: var(--border); color: var(--muted); font-weight: 400; }
.msg-body .ref { white-space: nowrap; }
.refs-hint { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; margin-top: -6px; font-size: 12px; color: var(--muted); }
.refs-btn {
    display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border: 1px solid var(--border); border-radius: 999px;
    background: var(--surface); color: var(--primary); font: inherit; font-size: 12px; font-weight: 500; cursor: pointer;
}
.refs-btn:hover { border-color: var(--primary); background: var(--primary-soft); }
.refs-btn .icon { width: 13px; height: 13px; }
.rte-missing { color: var(--amber-text); background: var(--amber-soft); padding: 2px 6px; border-radius: 5px; font-style: normal; }
.ref-pop {
    position: absolute; z-index: 120; width: 320px; max-height: 340px; overflow-y: auto; padding: 6px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg);
}
.ref-pop-group { padding: 6px 8px 3px; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.ref-pop-item {
    display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; border: 0; border-radius: 7px;
    background: none; color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer;
}
.ref-pop-item > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ref-pop-item .icon { width: 15px; height: 15px; color: var(--primary); flex: none; }
.ref-pop-item .badge { height: 20px; font-size: 11px; }
.ref-pop-item.is-active, .ref-pop-item:hover { background: var(--primary-soft); }
.ref-pop-empty { padding: 10px; color: var(--muted); font-size: 13px; }

/* ---------- Канбан-доска ---------- */
.board-head { align-items: center; }
.board-switch { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface-3); }
.board-switch a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; color: var(--muted); font-size: 13px; font-weight: 500; }
.board-switch a.is-active { background: var(--brand-fill, var(--primary)); color: #fff; }
.board-switch .icon { width: 15px; height: 15px; }
.board-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.board-chip { padding: 5px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 13px; }
.board-chip:hover { color: var(--text); border-color: var(--border-strong); }
.board-chip.is-active { background: var(--navy, #0d233b); border-color: var(--navy, #0d233b); color: #fff; }
.board-filters .select { width: auto; }

.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(205px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.board-col { display: flex; flex-direction: column; min-height: 240px; max-height: calc(100vh - 230px); padding: 10px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); transition: background .12s, box-shadow .12s; }
.board-col.is-over { background: var(--primary-soft); box-shadow: inset 0 0 0 2px var(--primary); }
.board-col-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 10px; font-weight: 600; font-size: 14px; }
.board-col-note { font-size: 12px; font-weight: 400; color: var(--muted); }
.board-col-head .count { margin-left: auto; }
.board-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--faint); }
.dot-new { background: var(--blue); } .dot-progress { background: var(--violet); } .dot-waiting { background: var(--amber); }
.dot-resolved { background: var(--green); } .dot-red { background: var(--red); } .dot-closed { background: var(--faint); }
.board-list { flex: 1; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; overflow-x: hidden; min-height: 60px; padding: 2px; margin: -2px; }
.bcard-top [data-status] { min-width: 0; display: flex; }
.bcard-status { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 2px; min-width: 0; padding: 0; border: 0; border-radius: 999px; background: none; font: inherit; line-height: 1; cursor: pointer; }
.bcard-status > .icon { width: 13px; height: 13px; flex: none; color: var(--muted); opacity: 0; transition: opacity .12s; }
.bcard:hover .bcard-status > .icon, .bcard-status:focus-visible > .icon { opacity: 1; }
.bcard-status:hover .badge { box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 35%, transparent); }
@media (hover: none) { .bcard-status > .icon { opacity: 1; } }
/* Значок статуса на карточке: длинное название обрезается многоточием, точка и текст по центру строки */
.bcard-top .badge { display: block; min-width: 0; max-width: 100%; height: 22px; line-height: 22px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bcard-top .badge::before { display: inline-block; vertical-align: middle; margin: -2px 6px 0 0; }
.board-empty { display: none; padding: 18px 8px; border: 2px dashed var(--border); border-radius: var(--radius-sm); text-align: center; color: var(--faint); font-size: 13px; }
.board-list:not(:has([data-card])) .board-empty { display: block; }
.board-col.is-over .board-empty { border-color: var(--primary); color: var(--primary); }

.bcard {
    --stripe: var(--faint);
    position: relative; display: flex; flex-direction: column; gap: 6px; padding: 10px 12px 10px 11px;
    background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--stripe); border-radius: var(--radius-sm);
    box-shadow: var(--shadow-xs); font-size: 13px; transition: box-shadow .12s, transform .12s, opacity .12s;
}
.bcard[draggable="true"] { cursor: grab; }
.bcard:hover { box-shadow: var(--shadow-sm); }
.bcard.is-dragging { opacity: .45; transform: rotate(-2deg); }
.bcard.is-saving { opacity: .6; }
.bcard.is-overdue { background: color-mix(in srgb, var(--red-soft) 35%, var(--surface)); }
.bcard-link { position: absolute; inset: 0; z-index: 0; border-radius: inherit; }
.bcard-top, .bcard-meta { position: relative; display: flex; align-items: center; gap: 6px; pointer-events: none; }
.bcard-top button, .bcard-meta a { pointer-events: auto; }
.bcard-num { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.bcard-title { position: relative; pointer-events: none; font-weight: 600; line-height: 1.35; color: var(--text); overflow-wrap: anywhere; }
.bcard-task .bcard-top .bcard-title { flex: 1; min-width: 0; }
.bcard-meta { flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.bcard-meta .due { display: inline-flex; align-items: center; gap: 3px; }
.bcard-meta .icon { width: 13px; height: 13px; }
.bcard-tasks { display: inline-flex; align-items: center; gap: 3px; }
.bcard-person { margin-left: auto; }
.bcard-sub { position: relative; pointer-events: none; font-size: 12px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bcard-menu {
    position: relative; z-index: 1; margin-left: auto; display: grid; place-items: center; width: 24px; height: 24px; flex: none;
    border: 0; border-radius: 6px; background: none; color: var(--faint); cursor: pointer; opacity: 0; transition: opacity .12s, background .12s;
}
.bcard:hover .bcard-menu, .bcard-menu:focus-visible { opacity: 1; }
.bcard-menu:hover { background: var(--surface-3); color: var(--text); }
@media (hover: none) { .bcard-menu { opacity: 1; } }
.bcard-check {
    position: relative; z-index: 1; display: grid; place-items: center; width: 18px; height: 18px; flex: none; padding: 0;
    border: 1.5px solid var(--border-strong); border-radius: 5px; background: var(--surface); color: transparent; cursor: pointer;
}
.bcard-check:hover { border-color: var(--green); color: var(--green); }
.bcard-check .icon { width: 12px; height: 12px; stroke-width: 3; }
.bcard-check.is-checked, .bcard.is-done .bcard-check { background: var(--green); border-color: var(--green); color: #fff; }
.bcard.is-done .bcard-title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }

.board-dialog .muted { margin: 4px 0 14px; font-size: 13px; }
.board-options { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.board-option { text-align: left; padding: 9px 12px; border: 1px solid transparent; border-radius: 8px; background: none; color: var(--text); font: inherit; cursor: pointer; }
.board-option:hover { background: var(--surface-3); }
.board-option.is-active { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 35%, transparent); color: var(--primary-soft-text); font-weight: 600; }
.board-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.board-dialog:has(.board-days) { width: min(560px, calc(100vw - 32px)); }
.board-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-bottom: 14px; }
.board-day {
    display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; padding: 8px 2px 7px;
    border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--text);
    font: inherit; cursor: pointer; white-space: nowrap; transition: border-color .12s, background .12s, transform .12s;
}
.board-day:hover { border-color: var(--primary); transform: translateY(-1px); }
.board-day.is-active, .board-day:focus-visible { background: var(--primary); border-color: var(--primary); color: #fff; outline: none; }
.board-day-top { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.board-day-big { font-size: 19px; font-weight: 600; line-height: 1.1; }
.board-day-bottom { font-size: 10.5px; color: var(--muted); }
.board-day.is-weekend .board-day-top { color: var(--red-text); }
.board-day.is-active span, .board-day:focus-visible span { color: rgba(255, 255, 255, .85); }
@media (max-width: 480px) { .board-days { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.board-dialog > .board-actions:last-child { justify-content: flex-end; margin-top: 4px; }
@media (max-width: 760px) { .board { grid-auto-columns: 82%; scroll-snap-type: x mandatory; } .board-col { scroll-snap-align: start; max-height: none; } }

/* Шкала этапов заявки */
.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: 13px; 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: 600; }
.step-note { font-size: 11.5px; color: var(--faint); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) { .step-note { display: none; } .step-title { font-size: 11.5px; } }

/* Список заявок карточками: полоса слева по цвету статуса */
.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: 12.5px; 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); }
.tabs-muted .tab { opacity: .55; }
.tabs-muted .tab:hover { opacity: 1; }
.view-switch .icon { width: 16px; height: 16px; }
.view-cards .ticket-table-card, .view-table .tcards { display: none; }
.tcards { display: flex; flex-direction: column; gap: 8px; }
.tcard {
    --stripe: var(--gray-text);
    display: flex; align-items: center; gap: 14px; padding: 12px 16px 12px 14px;
    background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--stripe); border-radius: var(--radius-sm);
    box-shadow: var(--shadow-xs); color: var(--text); transition: border-color .12s, box-shadow .12s, transform .12s;
}
.tcard:hover { color: var(--text); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.tcard.is-overdue { background: color-mix(in srgb, var(--red-soft) 35%, var(--surface)); }
.stripe-new { --stripe: var(--blue); }
.stripe-progress { --stripe: var(--violet); }
.stripe-waiting { --stripe: var(--amber); }
.stripe-resolved { --stripe: var(--green); }
.stripe-red { --stripe: var(--red); }
.stripe-closed { --stripe: var(--faint); }
.tcard-num { flex: none; width: 44px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.tcard-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.tcard-subject { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tcard-sub { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.tcard-sub .icon { width: 14px; height: 14px; }
.tcard-meta { flex: none; display: flex; align-items: center; gap: 10px; }
.tcard-meta .due { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; }
.tcard-meta .due .icon { width: 13px; height: 13px; }
.avatar-empty { display: inline-grid; place-items: center; background: var(--surface-3); color: var(--faint); }
@media (max-width: 760px) {
    .tcard { flex-wrap: wrap; gap: 8px 12px; }
    .tcard-num { width: auto; }
    .tcard-main { flex-basis: calc(100% - 60px); }
    .tcard-meta { flex-basis: 100%; flex-wrap: wrap; }
    .tcard-subject { white-space: normal; }
}

/* Баннер на обзоре: фирменный градиент, сводка дня и быстрые действия */
.hero {
    position: relative; overflow: hidden; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap;
    margin-bottom: 24px; padding: 26px 28px; border-radius: var(--radius); color: #fff;
    background: linear-gradient(120deg, #0d233b 0%, #013669 55%, #0a5ad1 115%);
    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: 28px; font-weight: 300; }
.hero p { margin: 6px 0 0; color: #bcd2ea; font-size: 14px; }
.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-radius: 999px;
    background: rgba(255, 255, 255, .12); color: #fff; font-size: 13px; font-weight: 500; transition: background .12s, transform .12s;
}
.hero-btn:hover { color: #fff; background: rgba(255, 255, 255, .22); transform: translateY(-1px); }
.hero-btn-primary { background: #0078ff; }
.hero-btn-primary:hover { background: #1a88ff; }
@media (max-width: 640px) { .hero { padding: 20px; } .hero h1 { font-size: 22px; } }

/* Тренд и мини-график на карточках статистики */
.stat-extra { grid-column: 1 / -1; display: flex; align-items: flex-end; gap: 10px; margin-top: 12px; }
.trend { flex: none; font-size: 12px; 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; }
.stat:first-child .spark-line { stroke: #6db5ff; }
.stat:first-child .spark-area { fill: rgba(109, 181, 255, .18); }
.stat:first-child .trend { color: rgba(255, 255, 255, .7); }

.stats-title { margin: 0 0 10px; font-size: 13px; font-weight: 600; 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 .12s, box-shadow .12s, transform .12s;
}
.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: 13px; color: var(--muted); font-weight: 500; }
.stat-value { font-size: 26px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-blue { background: var(--blue-soft); color: var(--blue); }
.stat-violet { 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); }

.ticket-rows { list-style: none; margin: 0; padding: 6px; }
.ticket-row {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 9px; color: var(--text);
}
.ticket-row:hover { background: var(--surface-2); color: var(--text); }
.ticket-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ticket-row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-row-meta { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.ticket-row-meta .badge { height: 20px; font-size: 11.5px; padding: 0 8px; }
.num { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }

.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: 13px; 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: linear-gradient(90deg, var(--primary), #8b5cf6); }
.bars-value { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

.link-list { list-style: none; margin: 0; padding: 6px; }
.link-list a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--text); }
.link-list a:hover { background: var(--surface-2); color: var(--text); }
.link-list .icon { color: var(--muted); }

/* ---------- Список заявок ---------- */

.tabs-line { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; 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: 600; white-space: nowrap; cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--primary-soft-text); border-bottom-color: var(--primary); }
.tab.is-active .count { background: var(--primary-soft); color: var(--primary-soft-text); }
.ticket-layout .tabs-line { margin-bottom: 0; }

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.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: 13px; border-radius: 8px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
    padding: 10px 14px; text-align: left; white-space: nowrap;
    font-size: 12px; font-weight: 600; 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 { background: var(--primary-soft); }
.table tr.is-overdue td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.col-id { width: 70px; }
.col-actions { width: 56px; text-align: right; white-space: nowrap; }
.col-actions form { display: inline; }
.ticket-subject { display: block; color: var(--text); font-weight: 600; }
.ticket-subject:hover { color: var(--primary); }
.ticket-sub { display: flex; align-items: center; gap: 8px; margin-top: 2px; font-size: 12.5px; color: var(--muted); }
.ticket-sub .icon { width: 13px; height: 13px; }
.dot-sep::before { content: "·"; margin-right: 8px; color: var(--faint); }

.pager { display: flex; justify-content: center; gap: 4px; margin-top: 20px; }
.pager-btn {
    display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 8px;
    border-radius: 8px; color: var(--text-2); font-weight: 600;
}
.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); }

.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 .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: linear-gradient(140deg, #3d8bff, #013669); 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: linear-gradient(140deg, #34c38f, #0f6e56); box-shadow: 0 0 0 14px color-mix(in srgb, var(--green) 10%, transparent), 0 10px 24px rgba(15, 110, 86, .25); }
.empty h3 { margin: 0; font-size: 17px; }
.empty p { margin: 0; max-width: 420px; }
.empty-sm { flex-direction: row; justify-content: center; padding: 28px 16px; font-size: 13px; }
.empty-page { min-height: 50vh; justify-content: center; }
.empty-code { font-size: 64px; font-weight: 800; line-height: 1; letter-spacing: -.04em; background: linear-gradient(135deg, var(--primary), #8b5cf6); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- Карточка заявки ---------- */

.ticket-head h1 { font-size: 22px; overflow-wrap: anywhere; }
.ticket-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; font-size: 13px; }
.ticket-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ticket-actions form { margin: 0; }

.thread { display: flex; flex-direction: column; gap: 16px; }
/* Переписка как в мессенджере: заявитель и коллеги слева (серые облачка), поддержка справа (синие).
   Подряд идущие сообщения одного автора склеены: без фото и имени, с маленьким отступом. */
.chat { gap: 4px; }
.chat .msg + .msg:not(.msg-cont) { margin-top: 12px; }
.chat-day { display: flex; justify-content: center; margin: 14px 0 6px; position: sticky; top: 64px; z-index: 2; pointer-events: none; }
.chat-day:first-child { margin-top: 0; }
.chat-day span { padding: 3px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); box-shadow: var(--shadow-xs); }
.msg { display: flex; align-items: flex-start; gap: 10px; }
.msg > .avatar { flex: none; }
.msg-cont > .avatar { visibility: hidden; height: 0; }
.msg-box {
    max-width: min(72%, 680px); min-width: 120px; padding: 9px 14px 6px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 18px; border-top-left-radius: 6px; box-shadow: var(--shadow-xs);
    animation: panel-in .2s ease-out both;
}
.msg-cont .msg-box { border-top-left-radius: 6px; }
.msg-right { flex-direction: row-reverse; }
.msg-right .msg-box { border-radius: 18px; border-top-right-radius: 6px; }
.msg-right.msg-cont .msg-box { border-top-right-radius: 6px; }
.msg-staff .msg-box { background: var(--primary); border-color: var(--primary); color: #fff; }
.msg-staff .msg-head b, .msg-staff .msg-body, .msg-staff .msg-body a, .msg-staff .msg-foot, .msg-staff .msg-action { color: #fff; }
.msg-staff .msg-body a { text-decoration: underline; }
.msg-staff .msg-foot, .msg-staff .msg-action { opacity: .8; }
.msg-staff .msg-action:hover { background: rgba(255, 255, 255, .18); color: #fff; }
.msg-staff .files-list li:hover { background: rgba(255, 255, 255, .14); }
.msg-staff .files-list a, .msg-staff .files-size { color: #fff; }
.msg-staff .ref { background: rgba(255, 255, 255, .92); }
.msg-internal .msg-box { background: var(--note-bg); border-color: var(--note-border); border-style: dashed; }
.msg-initial .msg-box { border-top: 1px solid var(--border); box-shadow: inset 3px 0 0 var(--primary), var(--shadow-xs); }
.msg-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 3px; font-size: 13px; }
.msg-head b { color: var(--heading); }
.msg-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 2px; font-size: 11.5px; color: var(--muted); }
.msg-foot .icon { width: 13px; height: 13px; vertical-align: -2px; }
.msg-foot .msg-action { width: 22px; height: 22px; margin-right: auto; opacity: 0; transition: opacity .15s; }
.msg:hover .msg-foot .msg-action, .msg-foot .msg-action:focus-visible { opacity: 1; }
.msg-box .files-list { padding: 4px 0 0; margin: 0 -6px; }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }

.attachments { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.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: 8px; background: rgba(8, 18, 30, .72); color: #fff; opacity: .85; transition: opacity .12s, background .12s;
}
.thumb-dl:hover { opacity: 1; color: #fff; background: rgba(8, 18, 30, .9); }
.thumb-dl .icon { width: 16px; height: 16px; }

/* Метка типа файла */
.ft {
    display: inline-block; min-width: 34px; padding: 1px 5px; border-radius: 5px; text-align: center;
    font-size: 10.5px; 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); }

/* Вложения сообщения: таблица, колонка имён — по самому длинному названию */
.file-table {
    display: inline-grid; grid-template-columns: auto minmax(0, max-content) auto auto; align-self: flex-start; max-width: 100%;
    border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: var(--surface-2); font-size: 13px;
}
.file-row { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; align-items: center; border-top: 1px solid var(--border); }
.file-row:first-child { border-top: 0; }
.file-row:not(.file-head):hover { background: var(--surface-3); }
.file-row > * { padding: 7px 10px; }
.file-type { padding-right: 0 !important; }
.file-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; color: var(--text); }
.file-name:hover { color: var(--primary); }
.file-size { color: var(--muted); font-size: 12px; white-space: nowrap; text-align: right; }
.file-dl {
    display: flex; align-items: center; justify-content: center; gap: 4px; align-self: stretch;
    border: 0; border-left: 1px solid var(--border); background: none; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer;
}
.file-dl:hover { color: var(--primary); background: var(--primary-soft); }
.file-head { background: var(--surface); color: var(--muted); font-size: 12px; }
.file-dl-all { color: var(--primary); font-weight: 600; white-space: nowrap; }
.file-dl-images { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 0; color: var(--primary); cursor: pointer; font: inherit; font-size: 13px; }

.reply { padding: 14px; display: flex; flex-direction: column; gap: 12px; scroll-margin-top: 80px; }
.reply-modes { align-self: flex-start; }
.reply-input { min-height: 110px; }
.reply.is-internal { background: var(--note-bg); border-color: var(--note-border); }
.reply-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.reply-submit { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.reply-submit .select { width: auto; }

.timeline { list-style: none; margin: 0; padding: 18px 18px 18px 22px; position: relative; }
.timeline li { position: relative; display: flex; gap: 14px; padding-bottom: 18px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 14px; bottom: -4px; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline-dot { flex: none; width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; background: var(--surface); border: 2px solid var(--primary); position: relative; z-index: 1; }

.props { display: flex; flex-direction: column; gap: 12px; }
.prop { display: flex; flex-direction: column; gap: 5px; }
.prop > span { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.prop .picker-box { min-height: 32px; padding: 1px 10px; border-radius: 8px; font-size: 13px; }

.dl { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; margin: 0; align-items: center; }
.dl dt { color: var(--muted); font-size: 13px; }
.dl dd { margin: 0; text-align: right; font-weight: 500; }

.person-card { display: flex; align-items: center; gap: 12px; }
.contact-list { list-style: none; margin: 14px 0 0; padding: 14px 0 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.contact-list li { display: flex; align-items: center; gap: 8px; overflow-wrap: anywhere; }
.contact-list .icon { color: var(--muted); }

.people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.people:empty { display: none; }
.people li { display: flex; align-items: center; gap: 8px; }
.people-name { flex: 1; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people form { margin: 0; }
/* Сворачиваемые карточки правой колонки */
.aside-tools { display: flex; justify-content: flex-end; gap: 14px; margin-bottom: -8px; }
.aside-tools .link { border: 0; background: none; padding: 0; cursor: pointer; font: inherit; font-size: 13px; color: var(--primary); }
.card-head.is-collapsible { cursor: pointer; user-select: none; justify-content: flex-start; gap: 8px; }
.collapse-btn { margin-left: auto; color: var(--muted); }
.card-head .files-all + .collapse-btn { margin-left: 4px; }
.collapse-btn .icon { transition: transform .15s; }
.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; }

/* «Все файлы» в правой колонке: группы по сообщениям */
.files-card .card-head .files-all { margin-left: auto; }
.files-group { display: block; padding: 10px 16px 4px; font-size: 12px; color: var(--muted); }
.files-group:hover { color: var(--primary); }
.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: 8px; font-size: 13px; }
.files-list li:hover { background: var(--surface-3); }
.files-mini { width: 34px; height: 24px; border-radius: 4px; object-fit: cover; border: 1px solid var(--border); }
.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: 12px; 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); }
.files-foot { margin-top: 8px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }

.tips { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 13px; display: flex; flex-direction: column; gap: 4px; }

/* ---------- База знаний ---------- */

.kb-hero {
    position: relative; overflow: hidden;
    margin-bottom: 24px; padding: 40px 32px;
    border-radius: 18px; text-align: center; color: #fff;
    background:
        radial-gradient(600px 200px at 15% 0%, rgba(255, 255, 255, .18), transparent 60%),
        linear-gradient(135deg, #4f46e5, #7c3aed 60%, #a855f7);
}
.kb-hero h1 { font-size: 28px; }
.kb-hero p { margin-top: 6px; opacity: .85; }
.kb-search { position: relative; display: flex; gap: 8px; max-width: 600px; margin: 22px auto 0; }
.kb-search .icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.kb-search input {
    flex: 1; height: 48px; padding: 0 16px 0 44px; min-width: 0;
    border: 0; border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; font-size: 15px;
    box-shadow: 0 8px 24px -8px rgba(0, 0, 0, .3);
}
.kb-search input:focus { outline: none; box-shadow: 0 0 0 4px rgba(255, 255, 255, .35); }
.kb-search .btn { height: 48px; padding: 0 22px; background: rgba(255, 255, 255, .18); border: 1px solid rgba(255, 255, 255, .35); }
.kb-search .btn:hover { background: rgba(255, 255, 255, .28); }

.side-nav { padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.side-link { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 8px; color: var(--text-2); font-weight: 500; }
.side-link:hover { background: var(--surface-3); color: var(--text); }
.side-link.is-active { background: var(--primary-soft); color: var(--primary-soft-text); }

.kb-list { list-style: none; margin: 0; padding: 6px; }
.kb-list a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: var(--text); }
.kb-list a:hover { background: var(--surface-2); color: var(--text); }
.kb-list .icon { color: var(--muted); }
.kb-list-title { flex: 1; font-weight: 500; }
.kb-arrow { opacity: 0; transition: opacity .12s, transform .12s; }
.kb-list a:hover .kb-arrow { opacity: 1; transform: translateX(2px); }
/* Главная базы знаний: частые запросы и плитки разделов */
.kb-popular { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 8px; max-width: 760px; margin: 16px auto 0; font-size: 13px; }
.kb-popular > span { color: rgba(255, 255, 255, .7); }
.kb-popular a { padding: 4px 12px; border-radius: 999px; background: rgba(255, 255, 255, .12); color: #fff; }
.kb-popular a:hover { background: rgba(255, 255, 255, .22); color: #fff; }
.kb-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 24px 0 12px; }
.kb-section-head h2 { font-size: 18px; }
.kb-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.kb-tile {
    --tile: var(--blue); --tile-soft: var(--blue-soft);
    display: flex; flex-direction: column; gap: 8px; padding: 16px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-xs); transition: box-shadow .12s, transform .12s;
}
.kb-tile:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.tile-c1 { --tile: var(--green); --tile-soft: var(--green-soft); }
.tile-c2 { --tile: var(--violet); --tile-soft: var(--violet-soft); }
.tile-c3 { --tile: var(--amber); --tile-soft: var(--amber-soft); }
.tile-c4 { --tile: var(--red); --tile-soft: var(--red-soft); }
.tile-c5 { --tile: var(--faint); --tile-soft: var(--surface-3); }
.kb-tile-head { display: flex; align-items: center; gap: 10px; color: var(--text); }
.kb-tile-head:hover { color: var(--primary); }
.kb-tile-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--tile-soft); color: var(--tile); flex: none; }
.kb-tile-icon .icon { width: 18px; height: 18px; }
.kb-tile-name { flex: 1; font-weight: 600; font-size: 15px; }
.kb-tile-desc { margin: 0; font-size: 13px; color: var(--muted); }
.kb-tile-empty { margin: 0; font-size: 13px; color: var(--faint); }
.kb-tile-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.kb-tile-list a { display: flex; align-items: center; gap: 8px; padding: 5px 6px; margin: 0 -6px; border-radius: 7px; color: var(--text-2); font-size: 13.5px; }
.kb-tile-list a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-tile-list a:hover { background: var(--surface-2); color: var(--primary); }
.kb-tile-list .icon { width: 15px; height: 15px; color: var(--faint); flex: none; }
.kb-tile-all { margin-top: auto; display: inline-flex; align-items: center; gap: 2px; font-size: 13px; font-weight: 500; }
.kb-tile-all .icon { width: 14px; height: 14px; }

/* Раздел и поиск: список статей с началом текста */
.kb-list-head { align-items: flex-start; }
.kb-list-head form { flex: none; }
.kb-rows { list-style: none; margin: 0; padding: 4px; }
.kb-rows li + li { border-top: 1px solid var(--border); }
.kb-rows a { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 8px; color: var(--text); }
.kb-rows a:hover { background: var(--surface-2); color: var(--text); }
.kb-rows a:hover .kb-row-title { color: var(--primary); }
.kb-row-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-weight: 600; font-size: 15px; }
.kb-row-snippet { font-size: 13.5px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kb-rows mark { background: color-mix(in srgb, var(--amber) 30%, transparent); color: inherit; padding: 0 2px; border-radius: 3px; }
.kb-row-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); }
.kb-row-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.kb-row-meta .icon { width: 13px; height: 13px; }

.kb-suggest { border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); }

.prose { font-size: 15px; line-height: 1.7; color: var(--text-2); overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose h1, .prose h2, .prose h3 { color: var(--text); margin: 1.6em 0 .6em; }
.prose h1 { font-size: 22px; } .prose h2 { font-size: 19px; } .prose h3 { font-size: 16px; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre, .prose table { margin: 0 0 1em; }
.prose li { margin: .3em 0; }
.prose blockquote { padding: 12px 16px; border-left: 3px solid var(--primary); background: var(--primary-soft); border-radius: 0 8px 8px 0; color: var(--text); }
.prose blockquote p { margin: 0; }
.prose pre { padding: 14px; background: var(--surface-3); border-radius: 8px; overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
.prose img { border-radius: 8px; border: 1px solid var(--border); }
.prose table { border-collapse: collapse; width: 100%; font-size: 14px; }
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; }
.prose th { background: var(--surface-2); }
.prose a { text-decoration: underline; text-underline-offset: 2px; }

.editor-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.md-preview { min-height: 200px; padding: 16px; border: 1px solid var(--border); border-radius: 10px; }
.md-help { width: 100%; border-collapse: collapse; }
.md-help td { padding: 4px 0; vertical-align: top; }
.md-help td:first-child { padding-right: 10px; }

/* ---------- Вход ---------- */

.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: 56px;
    color: #fff;
    background:
        radial-gradient(800px 400px at 0% 0%, rgba(255, 255, 255, .16), transparent 60%),
        radial-gradient(600px 400px at 100% 100%, rgba(236, 72, 153, .35), transparent 60%),
        linear-gradient(135deg, #4338ca, #6d28d9 55%, #9333ea);
}
.auth-hero::after {
    content: ""; position: absolute; inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, .12) 1px, transparent 1px);
    background-size: 22px 22px; mask-image: linear-gradient(180deg, transparent, #000 40%, transparent);
}
.auth-hero-inner { position: relative; z-index: 1; max-width: 460px; }
.brand-light, .brand-light:hover { color: #fff; }
.brand-light .brand-mark { background: rgba(255, 255, 255, .18); box-shadow: none; }
.auth-hero h1 { margin-top: 48px; font-size: 40px; font-weight: 750; letter-spacing: -.03em; }
.auth-hero p { margin-top: 14px; font-size: 16px; 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: 15px; }
.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(255, 255, 255, .18); }
.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: 26px; font-weight: 700; }
.auth-card > .muted { margin-top: -10px; }
.auth-foot { text-align: center; font-size: 13px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 12.5px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- Просмотр PDF, Word и Excel ---------- */

.viewer {
    position: fixed; inset: 0; z-index: 100; display: flex; padding: 24px;
    background: rgba(8, 10, 14, .7); animation: flash-in .15s ease-out;
}
.viewer-panel {
    flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden;
    background: var(--surface); border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0, 0, 0, .4);
}
.viewer-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 18px; border-bottom: 1px solid var(--border); }
.viewer-title { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-body { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--surface-2); }
.viewer-frame { flex: 1; width: 100%; min-height: 0; border: 0; background: #fff; }
.viewer-status { margin: auto; padding: 24px; color: var(--muted); text-align: center; }
.viewer-tabs { display: flex; gap: 4px; padding: 8px 12px 0; overflow-x: auto; border-bottom: 1px solid var(--border); background: var(--surface); }
.viewer-tab {
    padding: 6px 12px; border: 1px solid transparent; border-bottom: 0; border-radius: 8px 8px 0 0;
    background: none; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.viewer-tab.is-active { background: #fff; border-color: var(--border); color: var(--text); font-weight: 600; }
.viewer-note:empty { display: none; }
.viewer-note { padding: 8px 14px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--border); background: var(--surface); }
body.has-viewer { overflow: hidden; }
@media (max-width: 640px) { .viewer { padding: 0; } .viewer-panel { border-radius: 0; } }

/* ---------- Просмотр картинок ---------- */

.lightbox {
    position: fixed; inset: 0; z-index: 100;
    display: grid; place-items: center; padding: 24px;
    background: rgba(8, 10, 14, .85); cursor: zoom-out;
    animation: flash-in .15s ease-out;
}
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }

/* ---------- Корпоративный стиль Reynaers ---------- */

.sidebar { background: var(--navy); border-right-color: var(--navy); color: var(--nav-text); scrollbar-color: var(--navy-2) transparent; }
.brand, .brand:hover { color: #fff; font-weight: 400; font-size: 17px; gap: 12px; }
.brand-logo { display: block; height: 52px; width: auto; flex: none; }
.brand-name small { display: block; margin-top: 2px; font-size: 11.5px; color: var(--nav-muted); }
.nav-label { color: var(--nav-muted); font-weight: 500; letter-spacing: .05em; }
.nav-link { color: var(--nav-text); border-left: 3px solid transparent; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding-left: 9px; }
.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: #0078ff; }
.nav-link.is-active .icon { color: #4da2ff; }
.nav-count { background: #0078ff; color: #fff; }
.sidebar-user { background: rgba(255, 255, 255, .05); border-color: rgba(255, 255, 255, .08); }

/* Ссылки на внешние сервисы в меню (Администрирование → Ссылки в меню) */
.menu-link-ext { width: 14px !important; height: 14px !important; margin-left: auto; opacity: .7; }
.nav-link-highlight { background: rgba(0, 120, 255, .14); border-left-color: #4da3ff; color: #fff; }
.nav-link-highlight .icon { color: #6db5ff; }
.sidebar .menu-link-btn { margin: 4px 0; color: #fff; background: transparent; border: 1.5px solid #4da3ff; }
.sidebar .menu-link-btn:hover { color: #fff; background: rgba(0, 120, 255, .16); }
.sidebar .menu-link-btn .menu-link-ext { margin-left: 0; }
.menu-card {
    display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--radius);
    background: linear-gradient(135deg, #0b5fc4, #0a3f86); color: #fff; font-weight: 500;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .25); transition: transform .12s, box-shadow .12s;
}
.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: 11.5px; font-weight: 400; color: #bcd6ff; }
.menu-card .menu-link-ext { color: #fff; }
.sidebar-user-name { color: #fff; font-weight: 500; }
.sidebar-user-role { color: var(--nav-muted); }
.sidebar .icon-btn { color: var(--nav-text); }
.sidebar .icon-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.new-ticket.btn-primary { background: #0078ff; }
.new-ticket.btn-primary:hover { background: #0062d1; }

.btn, .btn-sm, .btn-lg { border-radius: var(--radius-pill); font-weight: 500; }
.btn-primary { box-shadow: none; }
.btn-secondary { background: transparent; color: var(--brand); border-color: var(--brand); box-shadow: none; }
.btn-secondary:hover { background: var(--primary-soft); color: var(--brand); }
.input, .select, .picker-box, .topbar-search input, .filters-search .input { border-radius: var(--radius-sm); }
.segmented { border-radius: var(--radius-pill); }
.segmented label > span { border-radius: var(--radius-pill); }
.segmented input:checked + span { background: var(--brand-fill); color: #fff; box-shadow: none; }
.check-pill { border-radius: var(--radius-pill); }
.check-pill:has(input:checked) { border-color: var(--brand); background: var(--primary-soft); color: var(--brand); }
.chip, .tag { border-radius: var(--radius-pill); }

.badge-new { background: var(--violet-soft); color: var(--violet-text); }
.badge-progress { background: var(--blue-soft); color: var(--blue-text); }
.prio-normal i, .prio-opt.prio-normal i { background: var(--brand); }

.stat { border-radius: var(--radius); }
.stat-value { font-weight: 300; font-size: 30px; color: var(--heading); letter-spacing: 0; }
.stat-label { font-weight: 400; }
.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; }
.stat-alert .stat-value { color: var(--red-text); }
.bars-fill { background: var(--primary); }
.empty-code { background: none; -webkit-text-fill-color: currentColor; color: var(--heading); font-weight: 300; }
.ticket-head h1 { font-size: 26px; }
.card-tint { background: var(--primary-soft); }
.tab.is-active { color: var(--heading); border-bottom-color: var(--primary); }

/* Синий баннер базы знаний с тонкой белой рамкой — как первый экран корпоративного сайта. */
.kb-hero { background: var(--navy); border-radius: var(--radius); outline: 1.5px solid rgba(255, 255, 255, .65); outline-offset: -14px; padding: 44px 36px; }
.kb-hero h1 { color: #fff; font-size: 32px; font-weight: 300; }
.kb-hero p { font-weight: 300; }
.kb-search input { border-radius: var(--radius-pill); }
.kb-search .btn { background: #0078ff; border: 0; }
.kb-search .btn:hover { background: #0062d1; }

/* Вход: тёмно-синяя половина с логотипом и рамкой, белая форма. */
.auth-body { background: #fff; }
.auth-hero { background: #0d233b; padding: 48px 56px; }
.auth-hero::after { display: none; }
.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-card .flash { box-shadow: none; animation: none; }
.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-hero h1 { margin: 0; color: #fff; font-size: 40px; font-weight: 300; letter-spacing: 0; }
.auth-hero p { font-weight: 300; }
.auth-points .icon { background: rgba(0, 120, 255, .35); }
.auth-panel { background: var(--surface); }
.auth-title { font-weight: 300; font-size: 30px; color: var(--heading); }
/* ---------- Адаптивность ---------- */

@media (max-width: 1100px) {
    .layout-aside, .layout-aside-left { grid-template-columns: minmax(0, 1fr); }
    .sticky { position: static; }
    .hide-md { display: none; }
}

@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: 25; background: rgba(8, 10, 14, .4); }
    .topbar .menu-btn { display: inline-grid; }
    .grid-2, .grid-wide-left { grid-template-columns: minmax(0, 1fr); }
    .auth { grid-template-columns: 1fr; }
    .auth-hero { padding: 32px 24px; }
    .auth-hero h1 { margin-top: 24px; font-size: 28px; }
    .auth-points { display: none; }
}

@media (max-width: 640px) {
    .content { padding: 20px 16px; }
    .topbar { padding: 0 12px; gap: 6px; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .show-sm { display: block; }
    .quick-task { flex-wrap: wrap; }
    .quick-task-input { flex-basis: 100%; }
    .hide-sm { display: none; }
    h1 { font-size: 21px; }
    .page-head > .btn { width: 100%; }
    .filters .select { flex: 1 1 140px; max-width: none; }
    .msg > .avatar { display: none; }
    .msg-box { max-width: 88%; }
    .kb-hero { padding: 28px 18px; }
    .kb-search { flex-direction: column; }
    .bars li { grid-template-columns: 100px 1fr 30px; }
    .reply-submit { width: 100%; }
    .reply-submit .select { flex: 1; }

    /* Список заявок — карточками вместо таблицы. */
    .tickets-table thead { display: none; }
    .tickets-table tbody tr { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
    .tickets-table tbody tr:last-child { border-bottom: 0; }
    .tickets-table td { padding: 0; border: 0; }
    .tickets-table td:nth-child(3) { grid-column: 2; }
}

/* ---------- ИИ-помощник ---------- */
.ai-card { border-color: color-mix(in srgb, var(--primary) 28%, var(--border)); background: linear-gradient(180deg, color-mix(in srgb, var(--primary-soft) 55%, var(--surface)), var(--surface) 120px); }
.ai-card .card-head h2 .icon, .ai-ask-icon .icon { color: var(--primary); }
.ai-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-actions form { display: contents; }
.ai-out { font-size: 14px; line-height: 1.55; color: var(--text); }
.ai-out p { margin: 0 0 8px; }
.ai-out ol, .ai-out ul { margin: 0 0 8px; padding-left: 20px; }
.ai-out li { margin: 2px 0; }
.ai-out > :last-child { margin-bottom: 0; }
.ai-writing { display: inline-flex; gap: 3px; vertical-align: middle; margin: 0 4px; }
.ai-writing i { width: 5px; height: 5px; border-radius: 50%; background: var(--primary); animation: ai-dot 1.2s infinite ease-in-out; }
.ai-writing i:nth-child(2) { animation-delay: .15s; }
.ai-writing i:nth-child(3) { animation-delay: .3s; }
@keyframes ai-dot { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }
.tag-ai { background: var(--primary-soft); color: var(--primary-soft-text); display: inline-flex; align-items: center; gap: 3px; }
.tag-ai .icon { width: 12px; height: 12px; }

/* «Спросить помощника» над результатами поиска */
.ai-ask { margin: 0 16px 12px; padding: 14px 16px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--primary) 25%, var(--border));
    background: linear-gradient(135deg, color-mix(in srgb, var(--primary-soft) 70%, var(--surface)), var(--surface)); display: grid; gap: 10px; }
.ai-ask-head { display: flex; align-items: center; gap: 12px; }
.ai-ask-head > div { flex: 1; min-width: 0; }
.ai-ask-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface); box-shadow: var(--shadow-xs); flex: none; }
.ai-ask .ai-out { padding-top: 10px; border-top: 1px dashed var(--border-strong); }
.ai-sources { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* Меню «Помощник» у поля ввода */
.ai-menu { position: relative; }
.ai-menu > summary { list-style: none; cursor: pointer; }
.ai-menu > summary::-webkit-details-marker { display: none; }
.ai-menu > summary .icon { color: var(--primary); }
.ai-menu-pop { position: absolute; z-index: 30; bottom: calc(100% + 6px); left: 0; width: 290px; padding: 6px; border-radius: 12px; background: var(--surface);
    border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); display: grid; gap: 4px; }
.ai-menu-section { display: grid; gap: 6px; padding: 8px; }
.ai-menu-section + .ai-menu-section { border-top: 1px solid var(--border); }
.ai-menu-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.ai-menu-item { text-align: left; border: 0; background: none; padding: 7px 8px; border-radius: 8px; color: var(--text); font: inherit; cursor: pointer; }
.ai-menu-item:hover { background: var(--primary-soft); color: var(--primary-soft-text); }
.ai-menu-rte { display: inline-flex; }
.ai-menu-rte > summary { display: inline-grid; place-items: center; min-width: 32px; height: 32px; border-radius: 8px; }
.ai-menu-rte > summary:hover { background: var(--primary-soft); }
.ai-menu-rte .ai-menu-pop { top: calc(100% + 6px); bottom: auto; left: auto; right: 0; width: 250px; }
.field-tools { display: flex; justify-content: flex-end; }
.field-tools .ai-menu-pop { left: auto; right: 0; }
.ai-status { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 13px; color: var(--muted); padding: 6px 2px 0; }
textarea.is-ai-writing { background: color-mix(in srgb, var(--primary-soft) 45%, var(--surface)); }
.ai-rte-mark { background: var(--primary-soft); border-radius: 3px; animation: ai-pulse 1.4s infinite; }
@keyframes ai-pulse { 50% { background: transparent; } }

/* Прогресс помощника: что делается, сколько прошло и осталось */
.ai-prog { display: grid; gap: 6px; min-width: 0; flex: 1 1 260px; }
.ai-prog-head { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.ai-prog-stage { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-prog-time { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ai-prog-bar { height: 6px; border-radius: 3px; background: var(--gray-soft); overflow: hidden; }
.ai-prog-bar i { display: block; height: 100%; width: 3%; border-radius: inherit; transition: width .25s linear;
    background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 55%, #8b5cf6)); background-size: 200% 100%; animation: ai-shine 1.6s linear infinite; }
.ai-prog-bar.is-indeterminate i { width: 35%; animation: ai-slide 1.2s ease-in-out infinite; }
@keyframes ai-shine { to { background-position: -200% 0; } }
@keyframes ai-slide { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
.ai-card .ai-prog, .ai-ask .ai-prog { padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); }
.ai-status .ai-prog { max-width: 480px; }
.ai-search-wait { display: grid; gap: 6px; max-width: 640px; margin: 12px auto 0; font-size: 13px; color: var(--muted); text-align: center; }

/* Окошко правки текста в редакторе статьи */
.ai-float { position: fixed; z-index: 60; right: 20px; bottom: 20px; width: min(380px, calc(100vw - 32px)); display: grid; gap: 10px;
    padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); }
.ai-float-head { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.ai-float-head .icon { color: var(--primary); }
.ai-float-head strong { flex: 1; }
.ai-float-count { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.ai-float-slot { display: grid; gap: 8px; justify-items: start; }
.ai-float-slot .ai-prog { width: 100%; }
.ai-float-msg { margin: 0; font-size: 13.5px; line-height: 1.45; }
.rte-area .ai-working { background: color-mix(in srgb, var(--primary-soft) 70%, transparent); border-radius: 4px; animation: ai-pulse 1.4s infinite; }
.rte-area .ai-changed { background: var(--green-soft); border-radius: 4px; transition: background 1s; }
.ai-float-preview { max-height: 140px; overflow: auto; font-size: 13.5px; line-height: 1.5; padding: 8px 10px; border-radius: 8px;
    background: var(--gray-soft); white-space: pre-wrap; }

/* Похожие заявки */
.ai-similar { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.ai-similar a { display: grid; gap: 4px; padding: 8px; margin: 0 -8px; border-radius: 8px; color: inherit; text-decoration: none; }
.ai-similar a:hover { background: var(--gray-soft); }
.ai-similar-title { font-size: 13.5px; line-height: 1.35; }
.ai-similar-meta { display: flex; align-items: center; gap: 8px; }

/* Подсказка категории на новой заявке */
.ai-suggest { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: 14px; }
.ai-suggest dt { color: var(--muted); }
.ai-suggest dd { margin: 0; font-weight: 600; }

/* Окно «Разбить на задачи» */
.ai-dialog { width: min(640px, calc(100vw - 32px)); }
.ai-dialog h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; }
.ai-tasks { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 8px; max-height: 55vh; overflow: auto; }
.ai-tasks li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; padding: 10px; border: 1px solid var(--border); border-radius: 10px; }
.ai-tasks li:has(input[type=checkbox]:not(:checked)) { opacity: .5; }
.ai-tasks input[type=checkbox] { width: 16px; height: 16px; margin-top: 8px; accent-color: var(--primary); }
.ai-task-fields { display: grid; gap: 4px; min-width: 0; }
.ai-task-days { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.ai-task-days input { width: 64px; }

/* Настройки */
.ai-features { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px 24px; }
.ai-features .check span .d-block, .d-block { display: block; }
.check-lg { font-size: 15px; }
.sep { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.ai-test-result { font-size: 13.5px; padding: 10px 12px; border-radius: 10px; background: var(--gray-soft); }
.ai-test-result.is-ok { background: var(--green-soft); color: var(--green-text); }
.ai-test-result.is-warn { background: var(--amber-soft); color: var(--amber-text); }
.ai-test-result.is-error { background: var(--red-soft); color: var(--red-text); }
.ai-progress { display: grid; grid-template-columns: 60px 1fr auto; gap: 10px; align-items: center; font-size: 13.5px; }
.ai-progress meter { width: 100%; height: 8px; }
@media (max-width: 640px) {
    .ai-ask-head { flex-wrap: wrap; }
    .ai-ask-head .btn { width: 100%; }
    .ai-menu-pop { width: min(290px, calc(100vw - 48px)); }
}

/* ---------- Компьютеры и ПО ---------- */
.text-red { color: var(--red-text); }
.text-amber { color: var(--amber-text); }
.num-col { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.break { overflow-wrap: anywhere; }
.tag-blue { background: var(--blue-soft); color: var(--blue-text); display: inline-flex; align-items: center; gap: 3px; }
.tag-blue .icon { width: 12px; height: 12px; }
.is-error-row td { background: color-mix(in srgb, var(--red-soft) 55%, transparent); }

.sw-summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.sw-stat { display: grid; gap: 4px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-xs); }
.sw-stat-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.sw-stat-value { font-size: 18px; font-weight: 600; color: var(--heading); }
.sw-stat-value .badge { font-size: 13px; }

.card-flash { margin: 0 16px 12px; }
.card-foot-note { margin: 0; padding: 0 18px 16px; }

.sw-runs { list-style: none; margin: 0; padding: 0; }
.sw-runs > li { border-top: 1px solid var(--border); }
.sw-runs > li:first-child { border-top: 0; }
.sw-runs summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 18px; cursor: pointer; list-style: none; }
.sw-runs summary::-webkit-details-marker { display: none; }
.sw-runs summary::before { content: "›"; color: var(--muted); transition: transform .15s; }
.sw-runs details[open] summary::before { transform: rotate(90deg); }
.sw-runs details > :not(summary) { margin: 0 18px 12px; }
.sw-log { max-height: 320px; overflow: auto; padding: 10px 12px; border-radius: 8px; background: var(--gray-soft); font: 12px/1.5 var(--mono); white-space: pre-wrap; word-break: break-word; }

.sw-aliases { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; border-top: 1px solid var(--border); }
.sw-aliases > .muted { width: 100%; }

.sw-failed { list-style: none; margin: 0; padding: 0 18px 16px; display: grid; gap: 6px; }
.sw-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sw-checks li { display: grid; grid-template-columns: auto 1fr; gap: 8px; padding: 8px 10px; border-radius: 8px; font-size: 13px; line-height: 1.4; }
.sw-checks li .icon { margin-top: 2px; }
.sw-checks .is-ok { background: var(--green-soft); color: var(--green-text); }
.sw-checks .is-error { background: var(--red-soft); color: var(--red-text); }
.sw-checks .is-warn { background: var(--amber-soft); color: var(--amber-text); }
.sw-checks .mono { overflow-wrap: anywhere; }

.pc-plaque-name { display: block; font-weight: 600; font-size: 15px; }
.pager-simple { display: flex; justify-content: space-between; margin-top: 12px; }
/* Домен под именем компьютера — когда колонка «Домен» скрыта (одинаковые имена есть в обоих доменах). */
.only-md { display: none; }
@media (max-width: 1100px) { .only-md { display: block; } }

/* ---------- Боковое меню: сворачиваемые группы ---------- */
.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 .15s; 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 10px; background: color-mix(in srgb, var(--nav-muted) 35%, transparent); }

/* ---------- Быстрый переход (Ctrl+K) ---------- */
.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: 600 11px var(--font); cursor: pointer; white-space: nowrap; }
.topbar-kbd:hover { color: var(--primary); border-color: var(--primary); }
.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: rgba(8, 10, 14, .45); }
.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 kbd { padding: 1px 6px; border: 1px solid var(--border-strong); border-radius: 5px; font: 600 11px var(--font); color: var(--muted); background: var(--gray-soft); }
.palette-list { overflow: auto; padding: 6px; }
.palette-group { padding: 10px 10px 4px; font-size: 11px; font-weight: 600; 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: 8px; color: var(--text); text-decoration: none; }
.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: 12px; 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: 12px; color: var(--muted); }
@media (max-width: 640px) { .topbar-kbd, .palette-foot { display: none; } .palette-hint { display: none; } }

/* ---------- Администрирование ---------- */
.admin-hub { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.admin-hub-list { list-style: none; margin: 0; padding: 6px; }
.admin-hub-list a { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px; border-radius: 10px; color: var(--text); text-decoration: none; }
.admin-hub-list a:hover { background: var(--gray-soft); }
.admin-hub-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--primary-soft); color: var(--primary); }
.admin-hub-text { display: grid; gap: 2px; }
.admin-hub-text small { color: var(--muted); font-size: 12.5px; }
.admin-hub-go { color: var(--faint); }
.topbar-search .topbar-kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); margin: 0; }
.topbar-search input { padding-right: 64px; }

/* Быстрые фильтры исполнителя в строке вкладок заявок */
.quick-sep { flex: none; width: 1px; height: 20px; margin: 0 6px; align-self: center; background: var(--border); }
.quick-filters { display: inline-flex; gap: 6px; align-self: center; }
.quick {
    display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px;
    border: 1px solid var(--border); border-radius: 999px;
    color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap;
}
.quick .icon { width: 15px; height: 15px; }
.quick:hover { color: var(--text); border-color: var(--border-strong); }
.quick.is-on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-soft-text); }
.quick .count { min-width: 18px; height: 18px; padding: 0 5px; font-size: 11.5px; }
.quick.is-on .count { background: var(--primary); color: #fff; }
.quick.is-alert:not(.is-on) .count { background: var(--red-soft); color: var(--red-text); }

/* Этап 1б: управление каталогом */
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.table tr.is-muted td { opacity: .55; }
.sw-pilot-bar { margin-bottom: 16px; }
.sw-pilot-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.sw-pilot-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sw-progress { display: flex; flex-direction: column; gap: 6px; }
.sw-progress-bar { height: 8px; border-radius: 4px; background: var(--surface-3); position: relative; overflow: hidden; }
.sw-progress-bar::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--p, 0%); background: var(--primary); transition: width .2s; }
.sw-external { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: space-between; margin-bottom: 16px; padding: 14px 18px; border-radius: var(--radius); background: var(--red-soft); color: var(--red-text); }
.sw-external .btn { flex: none; }
.diff { margin: 0; padding: 12px 0; overflow-x: auto; font: 12.5px/1.55 ui-monospace, Consolas, monospace; }
.diff div { padding: 0 18px; white-space: pre; }
.diff .d-add { background: var(--green-soft); color: var(--green-text); }
.diff .d-del { background: var(--red-soft); color: var(--red-text); }
.diff .d-gap { color: var(--faint); text-align: center; }
.diff .d-add::before { content: "+ "; }
.diff .d-del::before { content: "− "; }
.diff .d-same::before { content: "  "; }
.check-row { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.sw-mode-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.text-green { color: var(--green-text); }

/* Этап 2: карточка компьютера */
.sw-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 20px; }
.sw-facts > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sw-facts b { font-weight: 600; overflow-wrap: anywhere; }
.sw-hw { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 640px) { .sw-hw { grid-template-columns: 1fr; } }
.table tr.is-sub td { background: var(--surface-2); font-size: 13px; }
.sw-people { display: flex; flex-wrap: wrap; gap: 6px; }
.sw-sw-head { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.sw-sw-head .filters-search { flex: 1 1 260px; max-width: 420px; }
.line-chart { position: relative; }
.line-chart svg { display: block; width: 100%; height: 220px; overflow: visible; }
.line-chart .lc-grid { stroke: var(--border); stroke-width: 1; }
.line-chart .lc-axis { fill: var(--muted); font-size: 11px; }
.line-chart .lc-line { fill: none; stroke: var(--primary); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.line-chart .lc-threshold { stroke: var(--red); stroke-width: 1; stroke-dasharray: 4 4; }
.line-chart .lc-cross { stroke: var(--muted); stroke-width: 1; }
.line-chart .lc-dot { fill: var(--primary); stroke: var(--surface); stroke-width: 2; }
.line-chart .lc-tip { position: absolute; top: 0; pointer-events: none; padding: 6px 9px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-xs); font-size: 12.5px; white-space: nowrap; transform: translateX(-50%); }
.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: 20; 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, var(--shadow-xs)); }
.table [data-col].col-off { display: none; }
.sw-nav { margin-bottom: 16px; }
.sw-assign { position: relative; display: inline-block; }
.sw-assign > summary { list-style: none; }
.sw-assign > summary::-webkit-details-marker { display: none; }
.sw-assign-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 280px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-md, var(--shadow-xs)); white-space: normal; }
.sw-num { width: 80px; display: inline-block; margin-left: 6px; }
.sw-rules td { vertical-align: middle; }
.dash-windows { margin-bottom: 20px; }

/* Карточка ПК: ручные установка и удаление (ТЗ 13.8) */
.sw-assign { display: flex; gap: 8px; align-items: center; margin-left: auto; flex-wrap: wrap; }
.sw-assign .select { width: auto; min-width: 240px; max-width: 360px; height: 32px; }
.sw-manual { list-style: none; margin: 0; padding: 0 16px 8px; }
.sw-manual li { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--border); }
.sw-manual li:first-child { border-top: 0; }
.sw-manual li > span { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; min-width: 0; }
.table td.text-right { text-align: right; }

/* «В сети» и «Выполнить сейчас» (ТЗ 13.9) */
.online { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.online-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint, #9aa4b2); flex: none; }
.online[data-online="on"] { color: var(--green-text); }
.online[data-online="on"] .online-dot { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.online[data-online="off"] .online-dot { background: var(--muted); opacity: .5; }
.online.is-checking .online-dot { animation: online-pulse 1s ease-in-out infinite; }
@keyframes online-pulse { 50% { opacity: .25; } }
.online .btn-icon { border: 0; background: none; padding: 2px; color: inherit; cursor: pointer; display: inline-flex; opacity: .7; }
.online .btn-icon:hover { opacity: 1; }
.online .btn-icon .icon { width: 14px; height: 14px; }
.run-choice { display: flex; gap: 8px; flex-wrap: wrap; }
.run-progress { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.run-status { display: flex; align-items: center; gap: 8px; }
.run-progress[data-status="done"] .run-status b { color: var(--green-text); }
.run-progress[data-status="error"] .run-status b, .run-progress[data-status="timeout"] .run-status b { color: var(--red-text); }
.spinner { width: 14px; height: 14px; border: 2px solid var(--border-strong); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
.spinner[hidden] { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
td .online-dot { display: inline-block; margin-right: 6px; vertical-align: middle; }
td .online-dot.is-on { background: var(--green); }

/* Компактная полоса списка при прокрутке */
.sbar { position: fixed; z-index: 19; background: var(--bg); border-bottom: 1px solid var(--border); box-shadow: 0 6px 12px -10px rgba(13, 35, 59, .35); padding: 8px clamp(16px, 2.2vw, 40px) 0; }
.sbar[hidden] { display: none; }
.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: 0 12px 28px -12px rgba(13, 35, 59, .35); padding: 6px; display: flex; flex-direction: column; }
.sbar-menu a { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; color: var(--text); text-decoration: none; border: 0; white-space: nowrap; }
.sbar-menu a:hover { background: var(--primary-soft); }
.sbar-menu a.is-active, .sbar-menu a.is-on { color: var(--primary); font-weight: 600; }
.sbar-menu .count { margin-left: auto; }
.sbar-menu-title { font-size: 12px; color: var(--muted); padding: 8px 10px 4px; border-top: 1px solid var(--border); margin-top: 4px; }
.sbar .btn.is-on { background: var(--primary-soft); color: var(--primary-soft-text); }
.sbar-pop { padding: 4px 0 10px; }
.sbar-pop[hidden] { display: none; }
.sbar-pop .filters { margin-bottom: 0; }
.sbar-head { overflow: hidden; }
.sbar-head .table { margin: 0; }
.sbar-head .table td { display: none; }
.sbar-title { font-size: 15px; color: var(--heading); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%; }

/* ---------- Удобства списков (ux.js) ---------- */
.btn-icon { display: inline-flex; align-items: center; justify-content: center; border: 0; background: none; color: var(--muted); padding: 4px; border-radius: 6px; cursor: pointer; line-height: 0; }
.btn-icon:hover { background: var(--surface-3); color: var(--text); }
.btn-icon .icon { width: 16px; height: 16px; }
.copy-btn { vertical-align: middle; opacity: .55; }
.copy-btn:hover { opacity: 1; }
h1 .copy-btn .icon { width: 18px; height: 18px; }

/* Меню «⋯» строки */
.table .col-menu { width: 40px; padding-left: 0; padding-right: 8px; text-align: right; }
.table .col-check { width: 36px; padding-right: 0; }
.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: absolute; right: 0; top: calc(100% + 4px); z-index: 25; 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: 8px; border: 0; background: none; color: var(--text); font: inherit; font-size: 14px; text-decoration: none; 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); }
tr.is-picked td { background: var(--primary-soft); }

/* Текущая строка (J/K, открыта в панели), новые заявки */
tr.is-current td, a.tcard.is-current { 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); }
a.tcard.is-current { outline: 2px solid var(--primary); outline-offset: -2px; }
tr.is-new td:first-child, a.tcard.is-new { box-shadow: inset 3px 0 0 var(--green); }
tr.is-new .ticket-subject::after, a.tcard.is-new .tcard-subject::after { content: "новая"; margin-left: 8px; font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 6px; background: var(--green-soft); color: var(--green-text); vertical-align: 2px; }
.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; }

/* Панель просмотра справа */
.peek { position: fixed; z-index: 40; 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; }
.skeleton-block { height: 180px; border-radius: 12px; }
@keyframes fade-in { from { opacity: 0; } }
@media (max-width: 900px) { .peek { width: 100vw; } }
html.embed .sidebar, html.embed .topbar, html.embed .sidebar-backdrop, html.embed .sbar, html.embed .crumbs { display: none !important; }
html.embed .app { display: block; }
html.embed .content { padding: 18px 20px; }

/* Массовые действия «Компьютеров»: строка внизу экрана */
[data-pc-bulk-bar][hidden] { display: none; }
[data-pc-bulk-bar] { position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; margin: 0; z-index: 30; }

/* Горячие клавиши */
.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); }
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); font: 12px var(--mono); text-align: center; color: var(--text); }

/* Колонки: перестановка и ширина */
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); }
.col-drop { position: fixed; z-index: 60; width: 3px; border-radius: 2px; background: var(--primary); pointer-events: none; }
.sbar-head .col-resize { display: none; }

/* Плотность таблиц */
html.dense .table th, html.dense .table td { padding-top: 5px; padding-bottom: 5px; }
html.dense .table { font-size: 13px; }
html.dense .table .avatar-xs { width: 18px; height: 18px; }

/* «Мои виды» */
.views-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -6px 0 14px; }
.view-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border: 1px solid var(--border-strong); border-radius: 999px; color: var(--text); font-size: 13px; text-decoration: none; }
.view-chip:hover { border-color: var(--primary); color: var(--primary); }
.view-chip.is-on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-soft-text); }
.view-chip .icon { width: 14px; height: 14px; }
.view-x { border: 0; background: none; padding: 2px; border-radius: 50%; color: var(--muted); cursor: pointer; line-height: 0; }
.view-x:hover { background: var(--surface-3); color: var(--red-text, #b42318); }
.view-strip:empty { display: none; }

/* Автосохранение «Учёта» */
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; }

/* Телефон: строки таблиц — карточками с подписями */
@media (max-width: 640px) {
    .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; }
    .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-subject { grid-column: 1 / -1; font-size: 15px; }
    .table.table-cards-sm td[data-label]:not(:first-child):not(.col-subject):not(.col-menu):not(.col-check)::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted); }
    .table.table-cards-sm td.col-check { position: absolute; left: -2px; top: 12px; }
    .table.table-cards-sm td.col-menu { position: absolute; right: 8px; top: 8px; width: auto; }
    .table.table-cards-sm .hide-sm, .table.table-cards-sm .hide-md { display: block; }
    .table-wrap:has(.table-cards-sm) { overflow-x: visible; }
    .peek { width: 100vw; }
}
.table th.col-menu, .table td.col-menu { position: sticky; right: 0; z-index: 1; background: var(--surface); }
.row-menu-pop { position: fixed; }
.filters .input-sm[name=without] { flex: 0 1 200px; width: auto; }
@media (max-width: 640px) {
    .table.table-cards-sm td { text-align: left !important; }
    .table.table-cards-sm tr:has(> td.col-check) { padding-left: 44px; }
    .table.table-cards-sm td.col-check { left: -30px; top: 16px; }
    .table.table-cards-sm td.col-check + td { grid-column: 1 / -1; font-size: 15px; }
    .table.table-cards-sm td.col-check + td::before { display: none !important; }
    .table.table-cards-sm td.col-menu { background: none; }
}

/* Список компьютеров: уместить колонки по умолчанию без горизонтальной прокрутки */
.table[data-columns] th, .table[data-columns] td { padding-left: 9px; padding-right: 9px; }
.table[data-columns] th { white-space: normal; line-height: 1.25; vertical-align: bottom; }
.table[data-columns] td { vertical-align: middle; }
.table[data-columns] td .badge { white-space: normal; text-align: left; }
.table[data-columns] .person-name.nowrap { white-space: nowrap; }

/* Перетаскивание колонки: поднятая колонка, «призрак» заголовка, место вставки */
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: 70; pointer-events: none; transform: translate(-50%, -140%) rotate(-2deg); padding: 6px 12px; border-radius: 8px; background: var(--primary); color: var(--on-primary); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; box-shadow: 0 10px 24px -8px rgba(0, 0, 0, .5); }
.col-drop { width: 3px; 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); }

/* Площадки */
.site-row { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(220px, 2fr) 90px auto; gap: 12px; align-items: end; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.site-row:last-of-type { border-bottom: 0; }
.site-row .field { margin: 0; }
.site-actions { display: flex; align-items: center; gap: 8px; padding-bottom: 4px; }
@media (max-width: 760px) { .site-row { grid-template-columns: 1fr; } }
.pc-events { list-style: none; margin: 0; padding: 8px 0 0; border-top: 1px solid var(--border); display: grid; gap: 6px; font-size: 13px; }
.reply-tpl-row { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(260px, 2.5fr) 90px auto; gap: 12px; align-items: end; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.reply-tpl-row .field { margin: 0; }
@media (max-width: 760px) { .reply-tpl-row { grid-template-columns: 1fr; } }
.bcard:has(> a.bcard-link.is-current) { outline: 2px solid var(--primary); outline-offset: -2px; }

/* Шаблоны ответов */
.tpl-pop { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; margin-top: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; display: grid; gap: 2px; max-height: 320px; overflow: auto; }
.tpl-item { display: grid; gap: 2px; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--text); font: inherit; }
.tpl-item b { font-weight: 600; font-size: 14px; }
.tpl-item span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpl-item.is-active, .tpl-item:hover { background: var(--primary-soft); }
.tpl-empty { padding: 8px 10px; color: var(--muted); font-size: 13px; }
.draft-hint { margin-top: 4px; }

/* Плашки активных фильтров */
.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: 999px; background: var(--primary-soft); color: var(--primary-soft-text); font: inherit; font-size: 13px; cursor: pointer; }
.filter-chip .icon { width: 14px; height: 14px; }
.filter-chip:hover { background: var(--primary); color: var(--on-primary); }

/* Группы строк */
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 .15s; }
tr.group-row.is-closed .group-toggle .icon { transform: rotate(-90deg); }
@media (max-width: 640px) { .table.table-cards-sm tr.group-row { display: block; padding: 0; } .table.table-cards-sm tr.group-row td { display: block; } }

/* Полоска загрузки */
.topload { position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 100; 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 .topload { display: none; }
.compare-card select { width: auto; } .compare-list { list-style: none; margin: 0; padding: 4px 16px 14px; display: grid; gap: 8px; } .compare-list li { display: flex; gap: 8px; align-items: baseline; }
.admin-crumbs { margin-bottom: 10px; }
.sites-warning { margin-bottom: 16px; } .sites-help { margin-top: 12px; }
.sidebar-user-link { display: inline-flex; border-radius: 50%; } a.sidebar-user-name { color: inherit; text-decoration: none; display: block; } a.sidebar-user-name:hover { text-decoration: underline; }

/* Фото и профиль */
img.avatar.avatar-photo { object-fit: cover; padding: 0; background: var(--surface-3); }
.avatar-xl { width: 112px; height: 112px; font-size: 38px; }
.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; align-items: start; }
.profile-photo { display: flex; gap: 20px; align-items: center; }
.profile-photo label.btn { cursor: pointer; }
.profile-photo-sm { flex-direction: column; gap: 6px; align-items: center; }
.profile-photo-sm label { cursor: pointer; }
.user-head { display: flex; gap: 18px; align-items: center; }

/* Категории: цвет и значок */
.cat-tag { display: inline-flex; align-items: center; gap: 5px; }
.cat-tag .icon { width: 13px; height: 13px; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch { cursor: pointer; }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch .tag { border: 2px solid transparent; }
.swatch input:checked + .tag { border-color: var(--primary); }
.tag-violet { background: var(--violet-soft); color: var(--violet-text); }
.tag-gray { background: var(--gray-soft); color: var(--gray-text); }
.step-person { display: inline-flex; align-items: center; gap: 6px; }

/* Оценка заявки */
.rate-card { margin-bottom: 20px; border-color: var(--primary); }
.rate-form { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.rate-form .input { flex: 1 1 240px; }
.rate-buttons { display: flex; gap: 8px; }
.rate-btn { border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); border-radius: 999px; padding: 7px 14px; font: inherit; cursor: pointer; transition: transform .12s, background .12s; }
.rate-btn:hover { transform: translateY(-1px) scale(1.04); }
.rate-up:hover { background: var(--green-soft); border-color: var(--green); }
.rate-down:hover { background: var(--red-soft); border-color: var(--red); }
.rate-done { margin-bottom: 16px; padding: 10px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.rate-done.is-up { background: var(--green-soft); border-color: transparent; }

/* Обзор: поздравления и «Ваш день» */
.bday-banner { margin: 0 0 18px; padding: 12px 16px; border-radius: 14px; background: linear-gradient(90deg, color-mix(in srgb, var(--amber) 22%, transparent), color-mix(in srgb, var(--primary) 18%, transparent)); color: var(--text); font-size: 15px; }
.my-day { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 24px; margin: 0 0 24px; padding: 18px 22px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.my-day-ring { --p: 0; width: 84px; height: 84px; border-radius: 50%; flex: none; display: grid; place-items: center; background: conic-gradient(var(--green) calc(var(--p) * 1%), var(--surface-3) 0); }
.my-day-ring > span { width: 66px; height: 66px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; align-content: center; line-height: 1.1; }
.my-day-ring b { font-size: 22px; color: var(--heading); }
.my-day-ring small { font-size: 11px; color: var(--muted); }
.my-day-text { flex: 1 1 280px; min-width: 0; }
.my-day-text h2 { margin: 0 0 4px; font-size: 17px; }
.my-day-text p { margin: 2px 0; }
.my-week { flex: 1 1 260px; padding: 10px 14px; border-radius: 12px; background: var(--primary-soft); color: var(--primary-soft-text); }
.my-week h3 { margin: 0 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.my-week p { margin: 0; color: var(--text); }

/* Праздничное оформление */
.season-canvas { position: fixed; inset: 0; z-index: 95; pointer-events: none; }
.confetti-canvas { z-index: 120; }
.confetti-msg { position: fixed; left: 50%; top: 28%; transform: translateX(-50%); z-index: 121; padding: 14px 22px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: 18px; font-weight: 600; color: var(--heading); animation: flash-in .3s ease-out; transition: opacity .4s; }
.confetti-msg.is-leaving { opacity: 0; }
.season-newyear .topbar { position: sticky; }
.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: " 🌷"; }
.auth-greet { margin: 0 0 6px; font-size: 15px; opacity: .85; }
@media (prefers-reduced-motion: reduce) { .season-newyear .topbar::after { animation: none; } }
.empty-art { width: 180px; max-width: 70%; height: auto; margin: 0 auto 6px; display: block; } [data-theme="dark"] .empty-art, html:not([data-theme="light"]) .empty-art { filter: none; }

/* Объявления о сбоях */
.notice-banner { display: flex; align-items: center; gap: 10px; margin: -8px 0 16px; padding: 10px 14px; border-radius: 12px; border: 1px solid; font-size: 14px; }
.notice-banner .icon { flex: none; width: 18px; height: 18px; }
.notice-banner b { font-weight: 600; }
.notice-banner .notice-when { margin-left: auto; white-space: nowrap; font-size: 12px; 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; }
.notice-templates { display: flex; flex-wrap: wrap; gap: 8px; }
.notice-tpl { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; border: 1px solid; text-decoration: none; font-size: 13px; }
.notice-tpl .icon { width: 14px; height: 14px; }
.notice-list { list-style: none; margin: 0; padding: 0 16px 12px; display: grid; gap: 10px; }
.notice-row { display: flex; gap: 12px; justify-content: space-between; align-items: center; padding: 12px 14px; border-radius: 12px; border: 1px solid; }
.notice-actions { display: flex; gap: 8px; align-items: center; flex: none; }
.notice-actions form { margin: 0; }
html.embed .notice-banner { display: none; }
.merged-note { margin-bottom: 16px; }
.similar-box { margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: var(--amber-soft); border: 1px solid color-mix(in srgb, var(--amber) 35%, transparent); font-size: 13px; }
.similar-title { display: flex; align-items: center; gap: 6px; font-weight: 600; color: var(--amber-text); margin-bottom: 4px; }
.similar-title .icon { width: 15px; height: 15px; }
.similar-box ul { margin: 0; padding-left: 20px; display: grid; gap: 2px; }

/* Отчёты */
.report-filters { align-items: center; }
.report-periods { display: flex; gap: 6px; flex-wrap: wrap; margin-right: 8px; }
.chip-link { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--text); text-decoration: none; font-size: 13px; }
.chip-link:hover { border-color: var(--primary); }
.chip-link.is-on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-soft-text); }
.report-filters input[type=date] { width: auto; }
.report-kpis { margin-bottom: 20px; }
.report-days { display: flex; align-items: flex-end; gap: 3px; height: 180px; padding-bottom: 26px; }
.report-day { flex: 1; min-width: 4px; height: 100%; display: flex; flex-direction: column; align-items: center; position: relative; }
.report-bars { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 1px; }
.report-bars i { display: block; width: 45%; max-width: 12px; min-height: 2px; border-radius: 3px 3px 0 0; }
.bar-in { background: var(--primary); }
.bar-out { background: var(--green); }
.report-day-label { position: absolute; bottom: -20px; font-size: 11px; color: var(--muted); }
.report-day-label.is-weekend { color: var(--red-text, #d92d20); }
.legend-dot { display: inline-block; width: 9px; height: 9px; border-radius: 2px; vertical-align: middle; }
.legend-in { background: var(--primary); }
.legend-out { background: var(--green); }
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; margin: 20px 0; }
.report-grid .bars li { grid-template-columns: minmax(140px, 55%) 1fr 36px; }
.report-grid .bars-label .tag { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.report-days { overflow: hidden; }

/* Лицензии */
.lic-list { list-style: none; margin: 0; padding: 0 16px 10px; }
.lic-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.lic-list li:first-child { border-top: 0; }
.lic-list li > span { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.lic-list form { margin: 0; }
.lic-assign { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; border-top: 1px solid var(--border); }
.lic-assign .picker, .lic-assign select { min-width: 220px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }

/* Состояние сайта */
.health-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.health-tile { border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; background: var(--surface); }
.health-tile.is-bad { border-color: color-mix(in srgb, var(--red) 55%, transparent); background: var(--red-soft); }
.health-tile.is-warn { border-color: color-mix(in srgb, var(--amber) 55%, transparent); background: var(--amber-soft); }
.health-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; color: var(--heading); }
.health-head .icon { width: 16px; height: 16px; color: var(--muted); }
.health-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); flex: none; }
.is-bad .health-dot { background: var(--red); box-shadow: 0 0 0 4px color-mix(in srgb, var(--red) 25%, transparent); }
.is-warn .health-dot { background: var(--amber); }
.health-tile p { margin: 0; font-size: 13px; color: var(--text-2); word-break: break-word; }
.health-fix { margin-top: 8px !important; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.health-fix a { display: inline-flex; align-items: center; gap: 2px; }
.health-fix .icon { width: 14px; height: 14px; }
.report-grid .bars.card-body { padding: 14px 18px 16px; }
.tcard-wrap { position: relative; }
.tcard-wrap > .tcard { padding-right: 52px; }
.row-menu.tcard-menu { position: absolute; right: 12px; top: 50%; margin-top: -14px; }
.health-ack { margin: 0 0 0 auto; }
.health-ack-btn { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 2px 6px; border-radius: 6px; font: inherit; font-size: 12px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.health-ack-btn:hover { background: var(--surface-3); color: var(--text); }
.health-ack-btn .icon { width: 13px; height: 13px; color: inherit; }

/* ---------- Плавные переходы: вкладки, всплывающие меню, кнопки ---------- */
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
@keyframes panel-in { from { opacity: 0; transform: translateY(4px); } }
.bell-panel:not([hidden]), .row-menu[open] > .row-menu-pop, .col-chooser-pop:not([hidden]), .sw-assign-pop:not([hidden]),
.ai-menu-pop:not([hidden]), .tpl-pop:not([hidden]), .ref-pop:not([hidden]) { animation: pop-in .14s ease-out; transform-origin: top right; }
[data-panel]:not([hidden]) { animation: panel-in .18s ease-out; }
.tab { transition: color .15s, border-color .15s, background-color .15s; }
.btn, .icon-btn, .chip-link, .nav-link, .table tbody tr, .tcard, .card { transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s; }
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; }
}

/* ---------- База знаний: оглавление и «Статья помогла?» ---------- */

.kb-toc-list { list-style: none; margin: 0; padding: 6px 8px 10px; display: flex; flex-direction: column; gap: 1px; max-height: 60vh; overflow: auto; }
.kb-toc-list a { display: block; padding: 6px 10px; border-radius: 8px; border-left: 2px solid transparent; color: var(--text); font-size: 13.5px; line-height: 1.35; }
.kb-toc-list .is-sub a { padding-left: 22px; font-size: 13px; color: var(--muted); }
.kb-toc-list a:hover { background: var(--surface-2); }
.kb-toc-list a.is-active { border-left-color: var(--primary); background: var(--primary-soft); color: var(--primary-soft-text); }
.kb-article h2, .kb-article h3 { scroll-margin-top: 80px; }
.kb-vote { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.kb-vote > span:first-child { font-weight: 600; color: var(--heading); margin-right: 4px; }
.kb-vote .btn.is-on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-soft-text); }
.side-link .cat-tag { font-size: 12.5px; }

/* ---------- Шапка заявки: заявитель → исполнитель и таймер срока ---------- */
.ticket-people { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-top: 12px; }
.tp-person { display: inline-flex; align-items: center; gap: 9px; padding: 5px 12px 5px 5px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.tp-person > span:last-child, .due-timer > span { display: flex; flex-direction: column; line-height: 1.2; }
.tp-person small, .due-timer small { font-size: 11px; color: var(--muted); }
.tp-person b, .due-timer b { font-size: 13.5px; font-weight: 600; color: var(--heading); }
.tp-none b { color: var(--muted); font-weight: 500; }
.tp-empty { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 1px dashed var(--border-strong, var(--border)); color: var(--muted); }
.tp-empty .icon { width: 15px; height: 15px; }
.tp-arrow { color: var(--faint); display: inline-flex; }
.due-timer { --due: var(--green); position: relative; overflow: hidden; display: inline-flex; align-items: center; gap: 9px; padding: 7px 14px 9px 12px; margin-left: auto; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--due) 35%, var(--border)); background: color-mix(in srgb, var(--due) 9%, var(--surface)); }
.due-timer > .icon { color: var(--due); width: 18px; height: 18px; }
.due-timer.is-soon { --due: var(--amber); }
.due-timer.is-over { --due: var(--red); }
.due-timer.is-over b { color: var(--due); }
.due-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: color-mix(in srgb, var(--due) 18%, transparent); }
.due-bar > i { display: block; height: 100%; background: var(--due); border-radius: 0 3px 3px 0; transition: width .4s; }
@media (max-width: 700px) { .due-timer { margin-left: 0; } .tp-arrow { display: none; } }

/* ---------- Паспорт ПК: кольца-индикаторы ---------- */
.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: 15px; font-weight: 700; color: var(--heading); letter-spacing: -.01em; }
.gauge-title { margin-top: 6px; font-size: 13px; font-weight: 600; color: var(--heading); }
.gauge-note { font-size: 11.5px; color: var(--muted); line-height: 1.3; }
.gauge-warn { --g: var(--amber); }
.gauge-bad { --g: var(--red); }
.gauge-bad .gauge-value { color: var(--red); }

/* ---------- Список ПК: мини-полоски и плашка Windows ---------- */
.mini-bar { --m: var(--green); display: block; width: 64px; height: 4px; margin-top: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.num-col .mini-bar { margin-left: auto; }
.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: 11.5px; }
.mini-row .mini-bar { margin-top: 0; width: 48px; }
.os-badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px 1px 3px; border-radius: 6px; font-size: 12px; background: var(--surface-2); color: var(--text); }
.os-badge b { display: inline-grid; place-items: center; min-width: 20px; height: 18px; padding: 0 4px; border-radius: 4px; font-size: 11px; color: #fff; background: var(--faint); }
.os-11 b { background: #0078d4; }
.os-10 b { background: var(--amber); }
.os-srv b { background: #475569; }
html.embed .chat-day { top: 6px; }
