/* ================== ШРИФТЫ ==================
   Бренд «НЕ ДЫМ»: Oswald — заголовки, Golos Text — текст, JetBrains Mono — логи
   и табличные цифры. Загружаются ОДНИМ <link> в base.html (быстрее блокирующего
   @import) — здесь дублировать не нужно. */

/* ================== ПЕРЕМЕННЫЕ (тёмная тема — «родная» для бренда) ================== */
/* Бренд «НЕ ДЫМ»: чёрный — сцена, белый — голос, неон — характер.
   Пять акцентов работают только вместе с чёрным и не заливают большие плоскости. */
:root {
    /* Поверхности */
    --bg: #0C0C0E;                        /* Космос */
    --bg-secondary: #131316;
    --sidebar: rgba(12, 12, 14, 0.85);
    --card: rgba(19, 19, 22, 0.72);       /* карточка ≈ #131316 */
    --card-hover: rgba(28, 28, 33, 0.92);
    --input: rgba(255, 255, 255, 0.045);
    --input-focus: rgba(255, 255, 255, 0.07);
    /* Текст */
    --text: #EDEDEF;
    --text-secondary: #9B9BA3;
    --text-muted: #8A8A93;                /* поднят до WCAG AA (≈5:1 на #0C0C0E) */
    /* Неон — характер бренда. Маджента — первичный акцент. */
    --accent: #EC2A70;                    /* Маджента */
    --accent-hover: #FF3D82;
    --accent2: #7B2FBE;                   /* Фиолет */
    --accent-light: rgba(236, 42, 112, 0.13);
    --accent-glow: rgba(236, 42, 112, 0.35);
    --border: rgba(255, 255, 255, 0.07);       /* ≈ #232327 */
    --border-light: rgba(255, 255, 255, 0.13); /* ≈ #33333A */
    --success: #0FA470;                   /* Изумруд */
    --success-light: rgba(15, 164, 112, 0.14);
    --warning: #F7931E;                   /* Оранж */
    --warning-light: rgba(247, 147, 30, 0.14);
    --danger: #f85149;
    --danger-light: rgba(248, 81, 73, 0.13);
    /* Семантические токены (по методике ui-ux-pro-max: цвета — через токены,
       не «сырым» hex в компонентах). */
    --on-accent: #ffffff;                 /* текст на цветных кнопках */
    --ring: var(--accent);                /* цвет фокус-ринга — следует за темой */
    --info: #29ABE2;                      /* Циан (прогнозы, подсказки) */
    --info-light: rgba(41, 171, 226, 0.14);
    /* Затемнённые оттенки ТОЛЬКО под белый текст на кнопках — проходят WCAG AA
       4.5:1 (чистый неон для белого текста чуть светел). */
    --accent-strong: #C2185B;             /* белый на нём: 5.9:1 (из палитры логотипа) */
    --accent-strong-hover: #D81B60;
    --accent2-strong: #7B2FBE;            /* 7:1 */
    --success-strong: #0B7D55;            /* 5.1:1 */
    --success-strong-hover: #0FA470;      /* чуть светлее для hover */
    --danger-strong: #c0392b;             /* 5.4:1 */
    --danger-strong-hover: #d73a34;       /* 4.6:1 */
    /* Тени бренд почти не использует — глубину даёт свечение. Держим мягкими. */
    --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.35);
    --shadow: 0 6px 26px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 12px 44px rgba(0, 0, 0, 0.55);
    --shadow-glow: 0 0 32px var(--accent-glow);
    --radius-sm: 12px;
    --radius: 18px;
    --radius-pill: 999px;                 /* кнопки-пилюли */
    --transition-fast: 0.12s ease;
    --transition: 0.22s ease;
    --transition-slow: 0.35s ease;
    --blur: blur(20px);
    --font-head: 'Oswald', 'Segoe UI', sans-serif;
    --font-body: 'Golos Text', 'Segoe UI', Arial, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    /* «Пружинные» кривые — дают анимациям сочный, чуть упругий характер */
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Светлая тема — адаптация бренда: неон на белом «пережигает», поэтому
   маджента берётся глубже (#C2185B) ради контраста; палитра та же. */
[data-theme="light"] {
    --bg: #F4F4F7;
    --bg-secondary: #ffffff;
    --sidebar: rgba(255, 255, 255, 0.78);
    --card: rgba(255, 255, 255, 0.82);
    --card-hover: rgba(255, 255, 255, 0.96);
    --input: rgba(18, 16, 22, 0.04);
    --input-focus: rgba(18, 16, 22, 0.07);
    --text: #17131C;
    --text-secondary: #5C5A66;
    --text-muted: #6E6C77;                 /* поднят до WCAG AA (≈4.6:1 на #F4F4F7) */
    --accent: #C2185B;                     /* глубже — читаемо на светлом */
    --accent-hover: #EC2A70;
    --accent2: #7B2FBE;
    --accent-light: rgba(194, 24, 91, 0.09);
    --accent-glow: rgba(194, 24, 91, 0.16);
    --info: #1183BD;                       /* циан темнее — читаемо на светлом */
    --info-light: rgba(17, 131, 189, 0.1);
    --success: #0B7D55;
    --success-light: rgba(11, 125, 85, 0.1);
    --warning: #C9720A;                    /* оранж темнее — читаемо на светлом */
    --warning-light: rgba(201, 114, 10, 0.1);
    --danger: #d0342b;
    --danger-light: rgba(208, 52, 43, 0.09);
    --border: rgba(20, 16, 26, 0.08);
    --border-light: rgba(20, 16, 26, 0.14);
    --accent-strong: #C2185B;
    --accent-strong-hover: #A8154F;
    --accent2-strong: #6A28A5;
    --success-strong: #0B7D55;
    --success-strong-hover: #0A6D4A;
    --danger-strong: #C0392B;
    --danger-strong-hover: #A93226;
    --shadow-sm: 0 2px 12px rgba(20, 16, 26, 0.06);
    --shadow: 0 6px 26px rgba(20, 16, 26, 0.1);
    --shadow-lg: 0 12px 44px rgba(20, 16, 26, 0.14);
    --shadow-glow: 0 0 30px rgba(194, 24, 91, 0.14);
    --blur: blur(16px);
}

/* ================== СБРОС ================== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

/* Выделение текста — фирменной магентой (бренд) */
::selection { background: var(--accent); color: #fff; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    transition: background var(--transition-slow), color var(--transition-slow);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    /* Табличные цифры: одинаковая ширина знаков — числа в картах,
       таблицах, зарплатах и датах выравниваются по колонкам и не «прыгают». */
    font-variant-numeric: tabular-nums;
}

body::before {
    content: '';
    position: fixed; top: -50%; left: -50%; width: 200%; height: 200%;
    /* Орбы-свечения бренда: маджента, циан, фиолет — размытые пятна по углам */
    background: radial-gradient(circle at 22% 18%, rgba(236, 42, 112, 0.07) 0%, transparent 48%),
                radial-gradient(circle at 82% 30%, rgba(41, 171, 226, 0.05) 0%, transparent 48%),
                radial-gradient(circle at 68% 88%, rgba(123, 47, 190, 0.06) 0%, transparent 50%);
    pointer-events: none; z-index: -1;
    /* Медленный «дрейф» фоновых пятен — фон живой, но не отвлекает */
    animation: bgDrift 24s ease-in-out infinite alternate;
}
@keyframes bgDrift {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-4%, -3%) scale(1.08); }
}

/* ================== СКРОЛЛБАР ================== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ================== ЗАГОЛОВКИ (Oswald — бренд «кричит») ================== */
/* Все заголовки — Oswald. Градиент на тексте бренд не допускает
   (градиенты — только размытые «орбы» свечения), поэтому цвет сплошной. */
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 600; letter-spacing: 0.3px; }

.page-header h1 {
    font-family: var(--font-head);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text);
}

/* ================== МОНОШИРИННЫЕ ЦИФРЫ ================== */
.card-value, .highlight-number, .font-mono, td.font-mono {
    font-family: var(--font-mono);
    font-weight: 600;
}

/* ================== БОКОВОЕ МЕНЮ ================== */
.sidebar {
    width: 260px; background: var(--sidebar);
    backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
    height: 100vh; position: fixed; padding: 0; z-index: 100;
    transition: transform var(--transition-slow), background var(--transition-slow);
    box-shadow: var(--shadow); overflow-y: auto; overflow-x: hidden;
    display: flex; flex-direction: column; border-right: 1px solid var(--border);
}

.sidebar-header { padding: 26px 22px 18px; border-bottom: 1px solid var(--border); }

.sidebar-logo { font-family: var(--font-head); font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: 0.5px; display: flex; align-items: center; gap: 12px; }
/* Знак на чёрном чипе с неоновым свечением (бренд: знак живёт только на тёмном) */
.sidebar-logo .logo-icon {
    width: 46px; height: 46px; flex-shrink: 0;
    background: #0C0C0E;
    border: 1px solid var(--border-light);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; color: var(--accent);
    box-shadow: var(--shadow-glow);
    transition: transform var(--transition-slow) var(--ease-spring), box-shadow var(--transition);
    animation: logoPulse 3.2s ease-in-out infinite;
}
@keyframes logoPulse {
    0%, 100% { box-shadow: 0 0 18px var(--accent-glow); }
    50%      { box-shadow: 0 0 38px var(--accent-glow); }
}
.sidebar-logo .logo-icon:hover { transform: scale(1.06) rotate(-4deg); }
.sidebar-logo > div > span { color: var(--text-secondary); font-family: var(--font-body); font-size: 10px; font-weight: 500; display: block; text-transform: uppercase; letter-spacing: 1.5px; }

.sidebar-nav { flex: 1; padding: 10px 8px; }
.sidebar-section { margin-bottom: 14px; }
.sidebar-section-title { font-size: 10px; text-transform: uppercase; letter-spacing: 2px; color: var(--text-muted); padding: 0 14px; margin-bottom: 4px; font-weight: 700; }

.sidebar-nav a {
    display: flex; align-items: center; gap: 12px; color: var(--text-secondary);
    text-decoration: none; padding: 10px 14px; margin: 1px 0;
    border-radius: var(--radius-sm); transition: all var(--transition);
    font-size: 13.5px; font-weight: 500; position: relative; overflow: hidden;
}
.sidebar-nav a:hover { color: var(--text); background: var(--accent-light); transform: translateX(3px); }
.sidebar-nav a:hover .icon { transform: scale(1.15); }
.sidebar-nav a.active { color: var(--on-accent); background: linear-gradient(135deg, var(--accent-strong), var(--accent2-strong)); box-shadow: var(--shadow-glow); font-weight: 600; }
.sidebar-nav a.active::before {
    content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    width: 3px; height: 55%; background: white; border-radius: 0 4px 4px 0;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.6);
}
.sidebar-nav a .icon { font-size: 16px; width: 22px; text-align: center; flex-shrink: 0; transition: transform var(--transition); }

.sidebar-bottom { border-top: 1px solid var(--border); padding: 6px 0; margin-top: auto; }
.sidebar-bottom a { display: flex; align-items: center; gap: 12px; color: var(--text-secondary); text-decoration: none; padding: 11px 22px; font-size: 13.5px; font-weight: 500; transition: all var(--transition); }
.sidebar-bottom a:hover { color: var(--danger); background: var(--danger-light); }
/* Карточка пользователя — тоже ссылка (ведёт в профиль), но с нейтральным
   hover, а не «красным» как у «Выйти». */
.sidebar-bottom a.user-info { color: inherit; padding: 12px 14px; font-weight: 400; }
.sidebar-bottom a.user-info:hover { color: inherit; background: var(--card-hover); }
.sidebar-bottom a.user-info.active { background: var(--accent-light); }
/* Кнопка выхода оформлена как пункт меню (logout теперь POST-форма ради CSRF) */
.sidebar-bottom form.logout-form { margin: 0; }
.sidebar-bottom button.logout-link { display: flex; align-items: center; gap: 12px; width: 100%;
    background: none; border: none; cursor: pointer; text-align: left; font-family: inherit;
    color: var(--text-secondary); padding: 11px 22px; font-size: 13.5px; font-weight: 500;
    transition: all var(--transition); }
.sidebar-bottom button.logout-link:hover { color: var(--danger); background: var(--danger-light); }

/* ================== ГАМБУРГЕР ================== */
.hamburger {
    display: none; position: fixed; top: 14px; left: 14px; z-index: 200;
    background: var(--card); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--border); color: var(--text); font-size: 20px;
    padding: 10px 14px; border-radius: var(--radius-sm); cursor: pointer;
    box-shadow: var(--shadow-sm); transition: all var(--transition);
}
.hamburger:hover { background: var(--accent); color: white; border-color: var(--accent); box-shadow: var(--shadow-glow); }
.overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 99; backdrop-filter: blur(4px); }

/* ================== КОНТЕНТ ================== */
.content { margin-left: 260px; padding: 32px 36px; min-height: 100vh; transition: margin var(--transition-slow); }
.page-header { margin-bottom: 26px; }
.page-header h1 { font-size: 28px; font-weight: 700; margin-bottom: 4px; letter-spacing: 0.6px; }
.page-header p { color: var(--text-secondary); font-size: 13.5px; }

/* ================== КАРТОЧКИ ================== */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 28px; perspective: 1000px; }

.card {
    background: var(--card); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
    padding: 24px; border-radius: var(--radius); text-align: center;
    transition: all var(--transition); box-shadow: var(--shadow-sm);
    border: 1px solid var(--border); position: relative; overflow: hidden; cursor: default;
	transform-style: preserve-3d;
}
.card:hover { 
    transform: translateY(-4px) rotateX(var(--rotate-x, 0deg)) rotateY(var(--rotate-y, 0deg));
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
} 

.card-value { font-size: 32px; font-weight: 800; color: var(--text); margin-bottom: 2px; letter-spacing: -0.5px; position: relative; z-index: 1; }
.card-divider { width: 36px; height: 3px; background: var(--accent); margin: 10px auto; border-radius: 2px; transition: width var(--transition) var(--ease-out); position: relative; z-index: 1; }
.card:hover .card-divider { width: 50px; }
.card-label { color: var(--text-secondary); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; font-weight: 600; position: relative; z-index: 1; }

/* ================== БЛОКИ ================== */
.box {
    background: var(--card); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
    padding: 24px; border-radius: var(--radius); margin-bottom: 18px;
    transition: all var(--transition); box-shadow: var(--shadow-sm); border: 1px solid var(--border);
}
.box:hover { box-shadow: var(--shadow); }
.box-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.box-header h3 { font-size: 15px; font-weight: 600; }
.badge { background: var(--accent-light); color: var(--accent); padding: 5px 12px; border-radius: 20px; font-size: 11px; font-weight: 700; letter-spacing: 0.3px; }
.badge-warn { background: var(--warning-light); color: var(--warning); padding: 2px 8px; border-radius: 20px; font-size: 10px; font-weight: 700; letter-spacing: 0.3px; margin-left: 6px; vertical-align: middle; }
/* Разделитель групп сотрудников в ведомости зарплаты (две строки-периода на человека) */
.emp-group-start td { border-top: 2px solid var(--border-light); }

/* ================== ТАБЛИЦЫ ================== */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
/* Сортировка таблиц не реализована, поэтому у заголовков нет курсора-указателя
   и ховера — иначе они выглядели бы кликабельными, но ничего не делали.
   При добавлении доступной сортировки — button + aria-sort. */
th { background: var(--input); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-secondary); padding: 12px 14px; text-align: left; white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; transition: all var(--transition-fast); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--accent-light); }
tr { animation: fadeInRow 0.4s ease forwards; opacity: 0; }
@keyframes fadeInRow { to { opacity: 1; } }
tr:nth-child(1) { animation-delay: 0.05s; }
tr:nth-child(2) { animation-delay: 0.1s; }
tr:nth-child(3) { animation-delay: 0.15s; }
tr:nth-child(4) { animation-delay: 0.2s; }
tr:nth-child(5) { animation-delay: 0.25s; }

/* ================== ФОРМЫ ================== */
input, select, textarea {
    padding: 10px 14px; border-radius: var(--radius-sm);
    border: 2px solid var(--border); background: var(--input);
    color: var(--text); font-size: 14px; font-family: var(--font-body);
    transition: all var(--transition); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-light); background: var(--input-focus); }
textarea { resize: vertical; min-height: 80px; }

/* Пункты выпадающего списка: нативный попап рисуется ОС и требует НЕпрозрачный
   фон — полупрозрачные токены (--input/--card) давали в тёмной теме тёмный
   текст на тёмном фоне (не читалось). Задаём сплошные цвета по теме. */
select option, select optgroup { background-color: #17171B; color: var(--text); }
[data-theme="light"] select option,
[data-theme="light"] select optgroup { background-color: #FFFFFF; color: var(--text); }

/* ================== КНОПКИ ================== */
.btn {
    padding: 11px 24px; background: var(--accent-strong); color: var(--on-accent);
    border: none; border-radius: var(--radius-pill); cursor: pointer;
    font-size: 13.5px; font-weight: 600; font-family: var(--font-body);
    text-decoration: none; display: inline-flex; align-items: center; gap: 7px;
    transition: transform var(--transition) var(--ease-spring), box-shadow var(--transition), background var(--transition);
    white-space: nowrap; letter-spacing: 0.2px;
    position: relative; overflow: hidden;
}
/* Пробегающий блик по кнопке при наведении */
.btn::before {
    content: ''; position: absolute; top: 0; left: -120%; width: 80%; height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.28), transparent);
    transform: skewX(-18deg); transition: left 0.55s var(--ease-out); pointer-events: none;
}
.btn:hover::before { left: 130%; }
.btn:hover { background: var(--accent-strong-hover); transform: translateY(-2px); box-shadow: var(--shadow-glow); }
.btn:active { transform: translateY(0) scale(0.97); transition: all 0.05s ease; }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-red { background: var(--danger-strong); }
.btn-red:hover { background: var(--danger-strong-hover); box-shadow: 0 4px 20px rgba(215, 58, 52, 0.35); }
.btn-green { background: var(--success-strong); }
.btn-green:hover { background: var(--success-strong-hover); box-shadow: 0 4px 20px rgba(35, 134, 54, 0.35); }
.btn-outline { background: transparent; border: 2px solid var(--border); color: var(--text-secondary); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

/* ================== КНОПКА НАВЕРХ ================== */
.scroll-top-btn {
    position: fixed; bottom: 24px; right: 24px; z-index: 500;
    width: 44px; height: 44px; background: var(--accent); color: white;
    border: none; border-radius: 50%; cursor: pointer;
    font-size: 18px; display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-lg); transition: all var(--transition);
    opacity: 0; transform: translateY(20px); pointer-events: none;
}
.scroll-top-btn.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.scroll-top-btn:hover { background: var(--accent-hover); transform: translateY(-3px); box-shadow: var(--shadow-glow); }

/* ================== ХЛЕБНЫЕ КРОШКИ ================== */
.breadcrumbs { display: flex; gap: 6px; align-items: center; margin-bottom: 14px; font-size: 13px; color: var(--text-secondary); }
.breadcrumbs a { color: var(--text-secondary); text-decoration: none; transition: color var(--transition-fast); padding: 2px 4px; border-radius: 4px; }
.breadcrumbs a:hover { color: var(--accent); background: var(--accent-light); }
.breadcrumbs .separator { opacity: 0.3; font-size: 16px; }
.breadcrumbs .current { color: var(--text); font-weight: 600; }


/* ================== ПУСТЫЕ СОСТОЯНИЯ ================== */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-secondary); }
.empty-state p { font-size: 14px; }

/* ================== МОДАЛЬНЫЕ ОКНА ================== */

.modal-header { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: var(--card); z-index: 1; }
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text-secondary); font-size: 20px; cursor: pointer; padding: 4px 8px; border-radius: 6px; transition: all var(--transition-fast); }
.modal-close:hover { background: var(--accent-light); color: var(--accent); }
.modal-body { padding: 20px; color: var(--text-secondary); font-size: 14px; line-height: 1.6; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ================== TOAST ================== */
.toast { position: fixed; bottom: 24px; right: 24px; padding: 14px 22px; border-radius: var(--radius-pill); color: white; font-weight: 600; font-size: 13.5px; z-index: 2000; transform: translateX(120%); transition: transform var(--transition); box-shadow: var(--shadow-lg); font-family: var(--font-body); backdrop-filter: var(--blur); }
.toast.show { transform: translateX(0); }
.toast-ok { background: var(--success); }
.toast-err { background: var(--danger); }

/* ================== ИНДИКАТОР ЗАГРУЗКИ ================== */
.loader-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); z-index: 3000; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity var(--transition); backdrop-filter: blur(2px); }
.loader-overlay.show { opacity: 1; }
.loader-spinner { width: 40px; height: 40px; border: 3px solid rgba(255,255,255,0.15); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ================== ГРАФИКИ ================== */
.chart-container { position: relative; height: 300px; width: 100%; }
.chart-container.pie { height: 350px; max-width: 500px; margin: 0 auto; }
.chart-container canvas { width: 100% !important; height: 100% !important; }

/* ================== ТЕМА-ПЕРЕКЛЮЧАТЕЛЬ ================== */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin: 0 12px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 13px;
    font-family: inherit;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    /* Сбрасываем дефолтные стили <button> */
    background: transparent;
    border: none;
    width: calc(100% - 24px);
    text-align: left;
}
.theme-toggle:hover {
    background: var(--accent-light);
    color: var(--text);
}
.theme-switch { width: 40px; height: 22px; background: var(--border); border-radius: 11px; position: relative; cursor: pointer; transition: background var(--transition); }
.theme-switch::after { content: ''; width: 18px; height: 18px; background: var(--accent); border-radius: 50%; position: absolute; top: 2px; left: 2px; transition: transform var(--transition); box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
[data-theme="light"] .theme-switch { background: var(--accent-light); }
[data-theme="light"] .theme-switch::after { transform: translateX(18px); }

/* ================== АДАПТИВ (ТЕЛЕФОН) ================== */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .hamburger { display: block; }
    .overlay.show { display: block; }
    
    .content { margin-left: 0; padding: 70px 12px 20px 12px; }
    .page-header h1 { font-size: 20px; }
    
    .cards { grid-template-columns: repeat(2, 1fr); gap: 8px; perspective: 1000px;}
    .card { padding: 14px; transform-style: preserve-3d;}
    .card-value { font-size: 22px; }

    .box { padding: 16px; }
    
    .form-row { flex-direction: column; }
    .form-row input { width: 100% !important; }
    
    table { font-size: 11px; }
    th, td { padding: 8px 6px; }
    
    .modal-box { width: 95%; max-height: 85vh; margin: 10px; }
    
    .breadcrumbs { flex-wrap: wrap; }
    
    .chart-container { height: 220px; }
    .chart-container.pie { height: 250px; }
    
    .toast { left: 12px; right: 12px; bottom: 12px; text-align: center; }
    .scroll-top-btn { bottom: 16px; right: 16px; width: 38px; height: 38px; }
}

/* ===== FLASH-СООБЩЕНИЯ ===== */
.flash-messages {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.flash {
    padding: 12px 16px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    animation: flashSlideIn 0.3s ease;
    transition: opacity 0.3s ease;
    font-size: 14px;
    line-height: 1.4;
}

.flash-text {
    flex: 1;
}

.flash-ok {
    background: rgba(46, 160, 67, 0.15);
    border: 1px solid rgba(46, 160, 67, 0.5);
    color: #56d364;
}

.flash-err {
    background: rgba(248, 81, 73, 0.15);
    border: 1px solid rgba(248, 81, 73, 0.5);
    color: #ff7b72;
}

.flash-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    padding: 0 4px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.flash-close:hover {
    opacity: 1;
}

.flash.flash-fade {
    opacity: 0;
}

@keyframes flashSlideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* В светлой теме — чуть другие оттенки */
[data-theme="light"] .flash-ok {
    background: rgba(46, 160, 67, 0.1);
    color: #1a7f37;
}

[data-theme="light"] .flash-err {
    background: rgba(248, 81, 73, 0.1);
    color: #cf222e;
}

/* ===== USER INFO В САЙДБАРЕ ===== */
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    margin: 0 12px 8px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    font-size: 13px;
}

.user-info i {
    font-size: 24px;
    opacity: 0.7;
}

.user-info-text {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.user-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 11px;
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Focus только при навигации с клавиатуры — не мешает кликам мышью */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

/* ===== СТРАНИЦА ВХОДА ===== */
.login-body {
    font-family: var(--font-body);
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
    transition: background 0.3s;
    margin: 0;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: var(--card);
    border-radius: 16px;
    padding: 40px 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: loginSlideUp 0.6s ease;
}

@keyframes loginSlideUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo .icon {
    width: 72px;
    height: 72px;
    background: #0C0C0E;
    border: 1px solid var(--border-light);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 30px;
    color: var(--accent);
    box-shadow: var(--shadow-glow);
}

.login-logo h1 {
    font-family: var(--font-head);
    font-size: 26px;
    color: var(--text);
    font-weight: 700;
    letter-spacing: 0.5px;
    margin: 0;
}

.login-logo p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
}

.input-wrapper {
    position: relative;
}

.input-wrapper .input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 16px;
    z-index: 1;
    pointer-events: none;
}

.input-wrapper input {
    width: 100%;
    padding: 12px 40px 12px 42px;
    border-radius: 10px;
    border: 2px solid transparent;
    background: var(--input);
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    transition: all 0.3s;
    outline: none;
}

.input-wrapper input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-light);
}

.eye-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    z-index: 1;
}

.eye-btn:hover { color: var(--accent); }

.btn-login {
    width: 100%;
    padding: 14px;
    background: var(--accent-strong);
    color: var(--on-accent);
    border: none;
    border-radius: var(--radius-pill);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 8px;
    font-family: inherit;
}

.btn-login:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--accent-glow);
}

.btn-login:active:not(:disabled) { transform: translateY(0); }

.btn-login:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.login-flash {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    text-align: center;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.login-flash-err {
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid #f85149;
    color: #f85149;
    animation: shake 0.5s ease;
}

.login-flash-ok {
    background: rgba(46, 160, 67, 0.1);
    border: 1px solid #2ea043;
    color: #56d364;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-5px); }
    75%      { transform: translateX(5px); }
}

.caps-warning {
    margin-top: 6px;
    padding: 6px 10px;
    background: var(--warning-light);
    border: 1px solid var(--warning);
    color: var(--warning);
    border-radius: 6px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.theme-toggle-login {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 13px;
    background: var(--card);
    padding: 8px 14px;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border: none;
    font-family: inherit;
}

/* На странице логина переключатель темы — это отдельная штука,
   а .theme-switch внутри неё ведёт себя так же, как в сайдбаре */
.theme-toggle-login .theme-switch {
    width: 36px;
    height: 20px;
    background: var(--input);
    border-radius: 10px;
    position: relative;
    transition: background 0.3s;
}

.theme-toggle-login .theme-switch::after {
    content: '';
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
}

[data-theme="light"] .theme-toggle-login .theme-switch::after {
    transform: translateX(16px);
}

.login-help {
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 20px;
    margin-bottom: 0;
}


/* ===== УТИЛИТАРНЫЕ КЛАССЫ ===== */
.text-danger  { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-muted   { color: var(--text-secondary); }

.text-sm { font-size: 12px; }
.font-mono { font-family: var(--font-mono, 'Courier New', monospace); }
.font-bold { font-weight: 700; }
.font-italic { font-style: italic; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.ml-2 { margin-left: 8px; }

/* ===== СЕТКА КАРТОЧЕК ===== */
.cards { display: grid; gap: 16px; }
.cards-2 { grid-template-columns: repeat(2, 1fr); }
.cards-3 { grid-template-columns: repeat(3, 1fr); }
.cards-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
    .cards-3, .cards-4 { grid-template-columns: repeat(2, 1fr); }
    .cards-2 { grid-template-columns: 1fr; }
}

/* ===== ИНФО-БЛОКИ ===== */
.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
.info-grid > div { padding: 4px 0; }
.info-label {
    color: var(--text-secondary);
    font-size: 12px;
    margin: 0 0 4px 0;
}
.info-value {
    font-weight: 600;
    margin: 0;
}

@media (max-width: 768px) {
    .info-grid { grid-template-columns: 1fr; }
}

/* ===== ФОРМЫ ===== */
.form-row {
    margin-bottom: 12px;
    max-width: 320px;
}
.form-row label {
    display: block;
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 4px;
}

.password-field {
    position: relative;
}
.password-field input {
    width: 100%;
    padding-right: 40px;
}
.password-field .eye-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
}
.password-field .eye-btn:hover { color: var(--accent); }

/* ===== БЕЙДЖИ ===== */
.badge-grid {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.badge-card {
    background: var(--input);
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    text-align: center;
    min-width: 120px;
    border: 1px solid;        /* цвет придёт через inline style */
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-family: inherit;
    color: inherit;
}
.badge-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.badge-icon {
    font-size: 28px;
    line-height: 1;
}
.badge-name {
    font-size: 12px;
    font-weight: 600;
    margin-top: 4px;
}
/* Подпись месяца для повторяемых достижений («Лучший продавец» · май 2026) */
.badge-sub {
    display: block;
    font-size: 10.5px;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 2px;
    text-transform: capitalize;
    font-variant-numeric: tabular-nums;
}
.badge-name-row .badge-sub {
    display: inline;
    margin-top: 0;
    margin-left: 4px;
    opacity: 0.75;
}

/* Сворачиваемые блоки (архив сотрудников, детальные прогнозы и т.п.) */
.archive-details > summary,
.collapse-box > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 16px;
    user-select: none;
}
.archive-details > summary::-webkit-details-marker,
.collapse-box > summary::-webkit-details-marker { display: none; }
.archive-details > summary::before,
.collapse-box > summary::before {
    content: '▸';
    color: var(--text-muted);
    transition: transform var(--transition);
}
.archive-details[open] > summary::before,
.collapse-box[open] > summary::before { transform: rotate(90deg); }

.badge-modal-box {
    max-width: 320px;
    text-align: center;
}
.badge-modal-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

/* ===== СТАТИСТИКА ПО ТОЧКАМ ===== */
.point-stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.point-stat-item {
    background: var(--input);
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    text-align: center;
}
.point-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
}
.point-stat-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 48px;
    opacity: 0.3;
    margin-bottom: 12px;
}
.empty-state p {
    margin: 4px 0;
}

/* ===== ПОДСВЕТКА СТРОКИ "ЭТО Я" В ЛИДЕРБОРДЕ ===== */
.row-self {
    background: var(--accent-light);
    font-weight: 700;
}

/* ===== МОДАЛКИ — управление через класс .show ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s;
}
.modal-overlay.show {
    display: flex;
    opacity: 1;
}
.modal-box {
    background: var(--card);
    border-radius: 12px;
    padding: 24px;
    max-width: 500px;
    width: 100%;
    transform: scale(0.95);
    transition: transform 0.3s;
}
.modal-overlay.show .modal-box {
    transform: scale(1);
}
/* .modal-header и .modal-close:hover заданы выше (липкая шапка + accent-hover),
   здесь оставляем только уникальные базовые стили, чтобы не переопределять их. */
.modal-header h3 { margin: 0; }
.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
}

/* ===== ВЫСОТА ГРАФИКОВ ===== */
.chart-container {
    position: relative;
    height: 300px;
}
.chart-container.pie {
    height: 350px;
}
@media (max-width: 768px) {
    .chart-container { height: 220px; }
    .chart-container.pie { height: 280px; }
}

/* ===== ВАРИАНТ КНОПКИ ===== */
.btn-accent2 { background: var(--accent2-strong); color: var(--on-accent); }
.btn-accent2:hover { background: var(--accent-strong); }

/* ===== ПОИСК ===== */
.search-input {
    width: 100%;
    max-width: 400px;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--input);
    color: var(--text);
    font-size: 14px;
    margin-bottom: 12px;
    font-family: inherit;
}
.search-input:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-light);
}

/* ===== ШИРОКИЕ ФОРМЫ (без max-width) ===== */
.form-row-wide {
    max-width: 100%;
}

/* ===== СЕКЦИИ ВНУТРИ МОДАЛКИ ===== */
.modal-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.modal-section h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
}

.danger-zone {
    margin-top: 16px;
}

/* ===== РАДИО-КНОПКИ ДОСТУПА ===== */
.access-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    border: none;
    padding: 0;
    margin: 0;
}
.access-actions label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
}
.access-actions input[type="radio"]:disabled + * {
    opacity: 0.5;
}
.access-actions label:has(input:disabled) {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== СКРЫТЫЕ ДЛЯ СКРИНРИДЕРА ===== */
.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== УТИЛИТЫ ===== */
.w-full { width: 100%; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }

/* ===== БЕЙДЖИ В ВАРИАНТЕ "СТРОКА" (для employee_stats) ===== */
.badge-card-row {
    display: flex !important;
    align-items: center;
    gap: 10px;
    text-align: left !important;
    padding: 12px 18px !important;
    border: none !important;
    border-left: 3px solid !important;
}
.badge-icon-row { font-size: 24px; }
.badge-name-row { font-weight: 600; }

/* ===== НОВОСТИ ===== */
.box-pinned {
    border-left: 3px solid var(--accent);
}

.news-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.inline-form {
    display: inline;
}

.news-text {
    color: var(--text-secondary);
    white-space: pre-wrap;
    margin: 8px 0;
}

.news-image {
    max-width: 100%;
    border-radius: 8px;
    margin-top: 12px;
    display: block;
}

.news-video {
    max-width: 100%;
    border-radius: 8px;
    margin-top: 12px;
    display: block;
}

.news-attachment {
    margin-top: 8px;
}

.news-attachment a {
    color: var(--accent);
}

.news-author {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* ===== FAQ ===== */
.faq-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.faq-search-wrapper {
    flex: 1;
    min-width: 250px;
}

.faq-search-wrapper .search-input {
    width: 100%;
    max-width: none;
    margin-bottom: 0;
}

.faq-item {
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
}

.faq-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.faq-question {
    cursor: pointer;
    font-weight: 600;
    padding: 8px 0;
    color: var(--text);
    font-size: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.faq-question-text {
    flex: 1;
}

/* ===== FAQ — ОТВЕТ И ВЛОЖЕНИЕ ===== */
.faq-answer {
    padding: 12px 0 0 0;
    color: var(--text-secondary);
    line-height: 1.6;
}

.faq-answer-text {
    white-space: pre-wrap;
    margin-bottom: 12px;
}

.faq-answer-text:last-child {
    margin-bottom: 0;
}

/* Карточка вложения — выглядит как кликабельная кнопка */
.faq-attachment-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text);
    transition: all var(--transition);
    margin-top: 8px;
    margin-bottom: 8px;
    max-width: 400px;
}

.faq-attachment-card:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    transform: translateY(-1px);
}

.faq-attachment-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.faq-attachment-label {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}

.faq-attachment-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.faq-attachment-download {
    font-size: 16px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.faq-attachment-card:hover .faq-attachment-download {
    color: var(--accent);
}

.faq-keywords {
    margin-top: 12px;
    margin-bottom: 0;
}

/* Кнопки действий в заголовке вопроса */
.faq-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

/* Информация о текущем вложении в форме редактирования */
.current-attachment {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--input);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    margin-bottom: 4px;
}

.current-attachment i {
    color: var(--accent);
}

.faq-attachment-icon {
    font-size: 20px;
    color: var(--accent);
    flex-shrink: 0;
}

/* ===== ФОРМЫ ОБЩИЕ ===== */
.checkbox-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
    flex-wrap: wrap;
}

/* small под полями формы — для подсказок */
.form-row small {
    display: block;
    margin-top: 4px;
}

/* ===== ПОДСВЕТКА ТОП-3 В ТАБЛИЦАХ ===== */
.row-gold {
    background: rgba(255, 215, 0, 0.08);
    font-weight: 700;
}
.row-medal {
    background: rgba(192, 192, 192, 0.05);
}

/* ===== КАСТОМНЫЙ INPUT FILE ===== */
.file-upload-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.file-upload-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .file-upload-form {
        width: 100%;
    }
    .file-upload-form > * {
        width: 100%;
        justify-content: center;
    }
}

/* ===== БЕЙДЖ С ОПАСНЫМ СОСТОЯНИЕМ ===== */
.badge.text-danger {
    background: var(--danger-light);
    color: var(--danger);
}

/* ===== ДИАГНОСТИКА (HEALTH) ===== */
.health-card {
    text-align: center;
    padding: 18px 16px;
}
.health-card-icon {
    font-size: 36px;
    margin-bottom: 10px;
}
.health-card h3 {
    margin: 0 0 8px 0;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}
.health-stat {
    margin: 5px 0;
    font-size: 14px;
}
.health-stat-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}
.health-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.danger-zone-box {
    border: 1px solid var(--danger);
}

/* ===== СТАТУС-КРУЖКИ ===== */
.status-row {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}
.status-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
}
.status-dot-ok {
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
    animation: pulse 2s infinite;
}
.status-dot-err {
    background: var(--danger);
    box-shadow: 0 0 10px var(--danger);
}
.status-dot-warn {
    background: var(--warning);
    box-shadow: 0 0 10px var(--warning);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.5; }
}

/* ===== ПРОГРЕСС-БАРЫ (диск, память) ===== */
.progress-bar {
    height: 8px;
    background: var(--input);
    border-radius: 4px;
    overflow: hidden;
    margin: 8px 0 4px;
}
.progress-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
}
.progress-bar-fill.ok   { background: var(--success); }
.progress-bar-fill.warn { background: var(--warning); }
.progress-bar-fill.crit { background: var(--danger); }

/* ===== ЛОГИ ===== */
.logs-box { padding: 0; }
.logs-content {
    background: var(--input);
    padding: 16px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.5;
    color: var(--text);
    max-height: 600px;
    white-space: pre-wrap;
    word-break: break-all;
    margin: 0;
}
.logs-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

/* ===== АДМИН-ТЕГИ ===== */
.admin-tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.admin-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--input);
    padding: 6px 10px;
    border-radius: 14px;
    font-size: 13px;
    border: 1px solid var(--border);
}
.admin-tag-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 2px;
    border-radius: 50%;
    transition: all var(--transition);
}
.admin-tag-remove:hover {
    color: var(--danger);
    background: var(--danger-light);
}
.admin-tag-self {
    color: var(--accent);
    font-size: 14px;
}

.inline-add-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 4px;
}
.inline-add-form input[type="text"] {
    flex: 1;
    min-width: 150px;
    max-width: 250px;
}

/* ===== ФОРМА ДОБАВЛЕНИЯ ТОЧКИ ===== */
/* Расположение полей в ряд на десктопе, столбиком на мобильном */
.point-add-form {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: end;
}
.point-add-form .form-row {
    margin-bottom: 0;
    flex: 1;
    min-width: 150px;
}
.point-add-form button {
    height: fit-content;
}

@media (max-width: 768px) {
    .point-add-form {
        flex-direction: column;
        align-items: stretch;
    }
    .point-add-form button {
        width: 100%;
    }
}

/* ===== ПРОГРЕСС-БАР ЗАГРУЗКИ ФАЙЛА ===== */
.upload-progress {
    margin-top: 12px;
    padding: 12px 14px;
    background: var(--input);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.upload-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.upload-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    border-radius: 4px;
    transition: width 0.2s ease;
}

.upload-progress-text {
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

/* ===== ПРОГНОЗ ВЫРУЧКИ ===== */

/* Карточка прогноза для продавца */
.forecast-box {
    border-left: 3px solid var(--warning);
}

.forecast-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 768px) {
    .forecast-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

.forecast-value-big {
    font-size: 32px;
    font-weight: 800;
    font-family: var(--font-mono);
    color: var(--warning);
    letter-spacing: -0.5px;
    line-height: 1.1;
    margin-bottom: 4px;
}

.forecast-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13.5px;
    color: var(--text-secondary);
}

.forecast-details strong {
    color: var(--text);
}

/* Подсветка статуса в таблице планов */
.forecast-done {
    color: var(--success);
    font-weight: 700;
}
.forecast-close {
    color: var(--info);
    font-weight: 600;
}
.forecast-on_track {
    color: var(--warning);
    font-weight: 600;
}
.forecast-behind {
    color: var(--danger);
    font-weight: 600;
}

/* Значение прогноза в ячейке таблицы (с тултипом) */
.forecast-value {
    cursor: help;
    border-bottom: 1px dashed currentColor;
    padding-bottom: 1px;
}

/* Мини-блоки прогноза по точкам на дашборде */
.point-forecasts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.point-forecast-item {
    background: var(--input);
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.point-forecast-name {
    font-weight: 700;
    font-size: 14px;
    color: var(--text);
    text-transform: capitalize;
    margin-bottom: 4px;
}

.point-forecast-fact,
.point-forecast-value {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.point-forecast-value strong {
    color: var(--warning);
    font-family: var(--font-mono);
}

.point-forecast-fact strong {
    font-family: var(--font-mono);
}

/* ===== МОДАЛКА ПРОГНОЗА ===== */
.forecast-modal-box {
    max-width: 560px;
}

/* Кнопка-прогноз в таблице */
.forecast-value {
    background: none;
    border: none;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 14px;
    border-bottom: 1px dashed currentColor;
    transition: background var(--transition-fast);
}

.forecast-value:hover {
    background: var(--accent-light);
}

/* Главная сводка в модалке */
.forecast-modal-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px;
    background: var(--input);
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
}

.forecast-modal-stat {
    flex: 1;
    text-align: center;
}

.forecast-modal-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.forecast-modal-value {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 18px;
    color: var(--text);
}

.forecast-modal-value-main {
    color: var(--warning);
    font-size: 22px;
}

.forecast-modal-arrow {
    font-size: 24px;
    color: var(--text-muted);
    flex-shrink: 0;
}

@media (max-width: 600px) {
    .forecast-modal-summary {
        flex-direction: column;
    }
    .forecast-modal-arrow {
        transform: rotate(90deg);
    }
}

/* Секции модалки */
.forecast-modal-section {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.forecast-modal-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.forecast-modal-section h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.forecast-modal-section p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 13.5px;
    line-height: 1.6;
}

/* Цветной блок совета */
.forecast-advice-block {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    margin-top: 8px;
    border-bottom: none !important;
    padding-bottom: 14px !important;
    margin-bottom: 0;
}

.forecast-advice-success {
    background: rgba(46, 160, 67, 0.1);
    border-color: rgba(46, 160, 67, 0.4);
}
.forecast-advice-success h4 {
    color: var(--success);
}

.forecast-advice-info {
    background: var(--accent-light);
    border-color: var(--accent-glow);
}
.forecast-advice-info h4 {
    color: var(--accent);
}

.forecast-advice-warning {
    background: rgba(210, 153, 29, 0.1);
    border-color: rgba(210, 153, 29, 0.4);
}
.forecast-advice-warning h4 {
    color: var(--warning);
}

.forecast-advice-danger {
    background: rgba(248, 81, 73, 0.1);
    border-color: rgba(248, 81, 73, 0.4);
}
.forecast-advice-danger h4 {
    color: var(--danger);
}
/* ==================================================================== */
/* ==================   ✨ ВИЗУАЛЬНАЯ ПОЛИРОВКА ✨   =================== */
/* Дополнительный «сочный» слой: свет за курсором, каскады появления,   */
/* блики и градиенты. Всё уважает prefers-reduced-motion (см. ниже).    */
/* ==================================================================== */

/* ---- КАРТОЧКИ: свет за курсором + верхняя градиентная линия ---- */
/* JS (script.js) пишет --mouse-x / --mouse-y при движении мыши —
   здесь мы наконец используем их для «прожектора» под курсором. */
.card::before {
    content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none;
    background: radial-gradient(320px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
                                var(--accent-light), transparent 65%);
    opacity: 0; transition: opacity var(--transition);
}
.card:hover::before { opacity: 1; }

.card::after {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; z-index: 1;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    transform: scaleX(0); transform-origin: left;
    transition: transform var(--transition-slow) var(--ease-out);
}
.card:hover::after { transform: scaleX(1); }

/* Каскадное появление карточек — «выплывают» снизу друг за другом */
.cards .card { animation: cardIn 0.55s var(--ease-out) backwards; }
@keyframes cardIn {
    from { opacity: 0; transform: translateY(18px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.cards .card:nth-child(1) { animation-delay: 0.04s; }
.cards .card:nth-child(2) { animation-delay: 0.10s; }
.cards .card:nth-child(3) { animation-delay: 0.16s; }
.cards .card:nth-child(4) { animation-delay: 0.22s; }
.cards .card:nth-child(5) { animation-delay: 0.28s; }
.cards .card:nth-child(6) { animation-delay: 0.34s; }
.cards .card:nth-child(7) { animation-delay: 0.40s; }
.cards .card:nth-child(8) { animation-delay: 0.46s; }

/* Число в карточке слегка «оживает» вместе с карточкой */
.card:hover .card-value { transform: scale(1.04); transition: transform var(--transition) var(--ease-spring); }

/* ---- БЛОКИ: плавный подъём при наведении ---- */
.box { transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition); }
.box:hover { transform: translateY(-2px); border-color: var(--border-light); }

/* ---- ПРОГРЕСС-БАР «СРАВНЕНИЕ С ЛИДЕРОМ» ---- */
/* Дашборд использует .progress / .progress-fill / .progress-ok, но этих
   классов в стилях не было — полоса не отрисовывалась. Добавляем + блик. */
.progress {
    height: 12px; background: var(--input); border-radius: 8px;
    overflow: hidden; margin: 10px 0 4px; position: relative;
}
.progress-fill {
    height: 100%; border-radius: 8px; position: relative; overflow: hidden;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    transition: width 0.8s var(--ease-out);
    box-shadow: 0 0 12px var(--accent-glow);
}
.progress-fill.progress-ok { background: linear-gradient(90deg, var(--success), #3fb950); box-shadow: 0 0 12px rgba(46, 160, 67, 0.4); }
.progress-fill.progress-warn { background: linear-gradient(90deg, var(--warning), #e3b341); }
.progress-fill.progress-crit { background: linear-gradient(90deg, var(--danger), #ff7b72); }
/* Бегущий диагональный блик поверх заливки */
.progress-fill::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.35) 50%, transparent 70%);
    background-size: 200% 100%;
    animation: progressShine 2.2s linear infinite;
}
@keyframes progressShine {
    0%   { background-position: 200% 0; }
    100% { background-position: -80% 0; }
}

/* ---- ТАБЛИЦЫ: акцентная линия слева при наведении на строку ---- */
tbody tr { position: relative; transition: background var(--transition-fast); }
tbody tr:hover td:first-child {
    box-shadow: inset 3px 0 0 var(--accent);
}

/* ---- БЕЙДЖ: мягкая пульсация акцентного бейджа ---- */
.badge { transition: transform var(--transition) var(--ease-spring); }
.box-header:hover .badge { transform: scale(1.06); }

/* ---- СТАТ-ЭЛЕМЕНТЫ ТОЧЕК: приподнимаются при наведении ---- */
.point-stat-item, .point-forecast-item {
    transition: transform var(--transition) var(--ease-spring), box-shadow var(--transition), border-color var(--transition);
}
.point-stat-item:hover, .point-forecast-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-sm);
    border-color: var(--accent);
}

/* ===== ДЕЙСТВИЯ В ЖУРНАЛЕ (правка/удаление смены) ===== */
.journal-actions { display: flex; gap: 6px; align-items: center; }
.journal-actions .inline-form { display: inline-flex; margin: 0; }
.journal-actions .btn-sm { padding: 5px 9px; }

/* ===== ПЕРЕКЛЮЧАТЕЛИ ФУНКЦИЙ БОТА (страница «Настройки») ===== */
.feature-list { display: flex; flex-direction: column; gap: 8px; }
.feature-row {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 14px 16px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--input);
    cursor: pointer; transition: background var(--transition), border-color var(--transition), transform var(--transition);
    position: relative;
}
.feature-row:hover { border-color: var(--border-light); background: var(--input-focus); transform: translateX(2px); }
.feature-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.feature-name { font-weight: 600; font-size: 14px; color: var(--text); }
.feature-desc { font-size: 12px; color: var(--text-muted); line-height: 1.4; }

/* Скрываем нативный чекбокс, но оставляем его доступным для клавиатуры */
.feature-checkbox { position: absolute; opacity: 0; width: 0; height: 0; }

.feature-track {
    flex-shrink: 0; width: 48px; height: 27px; border-radius: 14px;
    background: var(--border-light); position: relative;
    transition: background var(--transition);
}
.feature-thumb {
    position: absolute; top: 3px; left: 3px; width: 21px; height: 21px;
    border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    transition: transform var(--transition) var(--ease-spring);
}
.feature-checkbox:checked + .feature-track {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    box-shadow: 0 0 12px var(--accent-glow);
}
.feature-checkbox:checked + .feature-track .feature-thumb { transform: translateX(21px); }
.feature-checkbox:focus-visible + .feature-track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ================== ДОСТУПНОСТЬ: УМЕНЬШЕНИЕ ДВИЖЕНИЯ ==================
   Если в системе включено «Уменьшить движение» (accessibility-настройка),
   отключаем анимации и переходы — важно для людей с вестибулярными
   расстройствами и просто для комфорта. */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ================== БАЗА ЗНАНИЙ (/faq) ================== */
.kb-search { display: flex; gap: 10px; margin-bottom: 22px; }
.kb-search input {
    flex: 1; padding: 12px 16px; border-radius: var(--radius-pill);
    background: var(--input); border: 1px solid var(--border); color: var(--text);
    font-size: 14px; transition: border-color var(--transition), background var(--transition);
}
.kb-search input:focus { outline: none; border-color: var(--accent); background: var(--input-focus); }

/* Карточка быстрого доступа на обзоре базы знаний (напр. «Поставщики») */
.kb-feature-card {
    display: flex; align-items: center; gap: 16px; padding: 16px 18px;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    text-decoration: none; color: var(--text); margin-bottom: 22px;
    transition: background var(--transition), border-color var(--transition), transform var(--transition);
}
.kb-feature-card:hover { background: var(--card-hover); border-color: var(--accent); transform: translateY(-1px); }
.kb-feature-icon {
    width: 44px; height: 44px; flex: none; display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm); background: var(--accent-light); color: var(--accent); font-size: 18px;
}
.kb-feature-body { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kb-feature-title { font-weight: 600; font-size: 15px; }

/* Обзор: список статей внутри категории */
.kb-article-list { display: flex; flex-direction: column; }
.kb-article-link {
    display: flex; align-items: center; gap: 12px; padding: 12px 10px;
    border-radius: var(--radius-sm); color: var(--text); text-decoration: none;
    border-bottom: 1px solid var(--border); transition: background var(--transition);
}
.kb-article-list .kb-article-link:last-child { border-bottom: none; }
.kb-article-link:hover { background: var(--card-hover); }
.kb-article-link > span { flex: 1; }
.kb-article-link > .fa-file-lines { color: var(--accent); opacity: 0.8; }
.kb-chevron { color: var(--text-muted); font-size: 12px; }

/* Поиск: результаты */
.kb-results { display: flex; flex-direction: column; gap: 4px; }
.kb-result { display: block; padding: 12px 10px; border-radius: var(--radius-sm);
    text-decoration: none; color: var(--text); transition: background var(--transition); }
.kb-result:hover { background: var(--card-hover); }
.kb-result-title { font-weight: 600; }
.kb-result-snippet { margin-top: 2px; }

/* Статья: двухколоночная раскладка */
.kb-layout { display: grid; grid-template-columns: 264px 1fr; gap: 20px; align-items: start; }
.kb-nav { position: sticky; top: 16px; background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 12px; max-height: calc(100vh - 32px); overflow-y: auto; }
.kb-nav-header { padding: 6px 8px 10px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.kb-nav-header a { color: var(--text-secondary); text-decoration: none; font-size: 13px; font-weight: 500; }
.kb-nav-header a:hover { color: var(--accent); }
.kb-nav-cat { margin-bottom: 4px; }
.kb-nav-cat > summary {
    list-style: none; cursor: pointer; padding: 8px; border-radius: var(--radius-sm);
    font-weight: 600; font-size: 13px; color: var(--text); user-select: none;
    display: flex; align-items: center; gap: 8px;
}
.kb-nav-cat > summary::-webkit-details-marker { display: none; }
.kb-nav-cat > summary::before { content: '▸'; color: var(--text-muted); transition: transform var(--transition); }
.kb-nav-cat[open] > summary::before { transform: rotate(90deg); }
.kb-nav-cat > summary:hover { background: var(--card-hover); }
.kb-nav-cat ul { list-style: none; margin: 2px 0 6px; padding: 0 0 0 8px; }
.kb-nav-cat li a {
    display: block; padding: 6px 8px; border-radius: var(--radius-sm);
    color: var(--text-secondary); text-decoration: none; font-size: 13px; line-height: 1.35;
    transition: background var(--transition), color var(--transition);
}
.kb-nav-cat li a:hover { background: var(--card-hover); color: var(--text); }
.kb-nav-cat li a.active { background: var(--accent-light); color: var(--accent); font-weight: 600; }

/* Статья: контент (типографика Markdown) */
.kb-article { min-width: 0; }
.kb-title { font-size: 26px; margin: 0 0 4px; }
.kb-meta { margin: 0 0 18px; }
.kb-content { line-height: 1.7; color: var(--text); font-size: 15px; }
.kb-content > *:first-child { margin-top: 0; }
.kb-content h1, .kb-content h2, .kb-content h3, .kb-content h4 {
    margin: 26px 0 10px; line-height: 1.3; }
.kb-content h1 { font-size: 22px; }
.kb-content h2 { font-size: 20px; }
.kb-content h3 { font-size: 17px; }
.kb-content h4 { font-size: 15px; }
.kb-content p { margin: 0 0 14px; }
.kb-content ul, .kb-content ol { margin: 0 0 14px; padding-left: 24px; }
.kb-content li { margin-bottom: 6px; }
.kb-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.kb-content a:hover { color: var(--accent-hover); }
.kb-content img {
    max-width: 100%; height: auto; border-radius: var(--radius-sm);
    border: 1px solid var(--border); margin: 8px 0; display: block;
}
.kb-content video { max-width: 100%; border-radius: var(--radius-sm); margin: 8px 0; }
.kb-content code {
    font-family: var(--font-mono); font-size: 0.9em; background: var(--input);
    padding: 2px 6px; border-radius: 6px;
}
.kb-content pre { background: var(--input); padding: 14px; border-radius: var(--radius-sm);
    overflow-x: auto; margin: 0 0 14px; }
.kb-content pre code { background: none; padding: 0; }
.kb-content blockquote {
    margin: 0 0 14px; padding: 8px 16px; border-left: 3px solid var(--accent);
    background: var(--accent-light); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.kb-content hr { border: none; border-top: 1px solid var(--border); margin: 22px 0; }
.kb-content table { width: 100%; border-collapse: collapse; margin: 0 0 14px; }
.kb-content th, .kb-content td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; }
.kb-content th { background: var(--input); }

@media (max-width: 900px) {
    .kb-layout { grid-template-columns: 1fr; }
    .kb-nav { position: static; max-height: none; margin-bottom: 4px; }
}

/* База знаний — управление и редактор */
.kb-cat-row { display: flex; align-items: center; gap: 10px; padding: 6px 0;
    border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.kb-cat-row:last-of-type { border-bottom: none; }
.kb-cat-edit { display: flex; align-items: center; gap: 8px; flex: 1; flex-wrap: wrap; }
.kb-cat-edit input[type="text"] { flex: 1; min-width: 160px; padding: 8px 12px;
    border-radius: var(--radius-sm); background: var(--input); border: 1px solid var(--border); color: var(--text); }
.kb-cat-edit input[type="number"] { width: 74px; padding: 8px; border-radius: var(--radius-sm);
    background: var(--input); border: 1px solid var(--border); color: var(--text); }
.kb-manage-cat { font-weight: 600; margin: 16px 0 6px; display: flex; align-items: center; gap: 8px; }
.kb-manage-cat:first-of-type { margin-top: 4px; }
.kb-manage-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.kb-editor { width: 100%; min-height: 360px; padding: 14px; border-radius: var(--radius-sm);
    background: var(--input); border: 1px solid var(--border); color: var(--text);
    font-family: var(--font-mono); font-size: 13.5px; line-height: 1.6; resize: vertical; }
.kb-editor:focus { outline: none; border-color: var(--accent); }
.kb-upload-row { display: flex; align-items: center; gap: 12px; margin: 4px 0 16px; flex-wrap: wrap; }
.kb-edit-actions { display: flex; gap: 10px; align-items: center; }

/* Поставщики и накладные — таблица чтения */
.supplier-table td, .supplier-table th { vertical-align: middle; }
.supplier-table td.text-muted { font-size: 13px; }
.supplier-col-action { white-space: nowrap; text-align: right; width: 1%; }

/* Поставщики и накладные — построчный редактор */
.supplier-edit-row { display: flex; align-items: center; gap: 8px; padding: 8px 0;
    border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.supplier-edit-row:last-of-type { border-bottom: none; }
.supplier-edit { display: flex; align-items: center; gap: 8px; flex: 1; flex-wrap: wrap; }
.supplier-edit input[type="text"], .supplier-edit input[type="url"] {
    flex: 1; min-width: 150px; padding: 8px 12px; border-radius: var(--radius-sm);
    background: var(--input); border: 1px solid var(--border); color: var(--text); font-size: 13.5px; }
.supplier-edit input.supplier-link-input { flex: 2; min-width: 220px; }
.supplier-edit input[type="number"] { width: 72px; flex: none; padding: 8px; border-radius: var(--radius-sm);
    background: var(--input); border: 1px solid var(--border); color: var(--text); }

/* ================== КАРТОЧКА СОТРУДНИКА: АВАТАР / ДОКУМЕНТЫ ================== */
/* Хедер профиля с аватаром слева */
.profile-hero { display: flex; align-items: center; gap: 18px; }

/* Крупный аватар (карточка сотрудника, профиль) */
.avatar-preview {
    width: 96px; height: 96px; border-radius: 50%;
    object-fit: cover; display: block; flex: none;
    border: 2px solid var(--border-light); background: var(--input);
}
.avatar-hero { width: 72px; height: 72px; }

/* Плейсхолдер с инициалом, когда аватар не задан */
.avatar-placeholder {
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-head); font-weight: 700; font-size: 34px;
    color: var(--on-accent); text-transform: uppercase;
    background: linear-gradient(135deg, var(--accent-strong), var(--accent2-strong));
}
.avatar-hero.avatar-placeholder { font-size: 26px; }
.avatar-thumb.avatar-placeholder { font-size: 13px; }

/* Мини-аватар в таблице сотрудников */
.avatar-thumb {
    width: 30px; height: 30px; border-radius: 50%;
    object-fit: cover; vertical-align: middle; margin-right: 8px;
    border: 1px solid var(--border-light);
}

/* Блок управления аватаром на карточке (превью + формы рядом) */
.avatar-manage { display: flex; align-items: flex-start; gap: 18px; flex-wrap: wrap; }
.avatar-manage-actions { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 10px; }

/* Подсветка своей строки в лидерборде (раньше класс был, стиля — не было) */
tr.row-self { background: var(--accent-light); }
tr.row-self td:first-child { border-left: 3px solid var(--accent); }

/* Лидерборд: строки за пределами топ-5 скрыты до раскрытия по кнопке */
#leaderboardTable .lb-extra { display: none; }
#leaderboardTable.lb-open .lb-extra { display: table-row; }

@media (max-width: 640px) {
    .avatar-hero { width: 56px; height: 56px; }
    .avatar-preview { width: 80px; height: 80px; }
    .avatar-manage { gap: 14px; }
}
