/* ========== ДИЗАЙН-СИСТЕМА АВТОГРАФ ========== */
/* Сетка и базовые цвета страницы — из Bootstrap (bootstrap-theme.css, --bs-*). */
:root {
    /* Цвета бренда (синхрон с bootstrap-theme.css) */
    --dark-blue: #0f172a;
    --accent-yellow: #1d4ed8;
    --accent-yellow-hover: #1e40af;
    --on-accent: #ffffff;
    --text-dark: var(--bs-body-color, #2c3e50);
    --text-muted: var(--bs-secondary-color, #5c6b7a);
    --bg-light: var(--bs-body-bg, #f4f7f9);
    --white: #ffffff;
    --border-color: var(--bs-border-color, #e1e5eb);
    /* Семантика */
    --color-success: #238636;
    --color-success-hover: #2ea043;
    --color-danger: #d90429;
    --color-danger-hover: #b0031f;
    --color-warning: #856404;
    /* Отступы (шкала 4px) */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 40px;
    /* Скругления */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    /* Тени */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
    /* Типографика */
    --font-size-xs: 12px;
    --font-size-sm: 13px;
    --font-size-base: 0.9375rem;
    --font-size-lg: 16px;
    --font-size-xl: 20px;
    --font-size-2xl: 24px;
    --font-size-3xl: 32px;
    --font-weight-medium: 600;
    --font-weight-bold: 700;
    --font-weight-extrabold: 800;
}

/* --- СТРАНИЦА ВХОДА / СБРОСА ПАРОЛЯ: фон как в теме кабинета; градиент только в тёмной теме (bootstrap-theme.css) --- */
.login-page {
    background: var(--bs-body-bg);
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.login-page::before {
    display: none;
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.1) 0%, transparent 70%);
    animation: pulse 8s ease-in-out infinite;
}

[data-bs-theme="dark"] .login-page::before {
    display: block;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

/* Тело auth_layout: центрирование карточки без конфликта с position:fixed (переключатель темы) */
.ag-auth-page-body.login-page {
    display: block;
    min-height: 100vh;
    height: auto;
}
.ag-auth-center-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
}

/* Вход и восстановление пароля: Bootstrap-карточка в общей теме (auth_layout.html) */
.ag-auth-card.card {
    max-width: 420px;
    width: 100%;
    box-shadow: 0 1rem 3rem rgba(15, 23, 42, 0.35);
}
[data-bs-theme="light"] .ag-auth-card.card {
    box-shadow: var(--ag-card-shadow);
    border: 1px solid var(--bs-border-color);
}
/* Кнопки темы на светлом фоне авторизации (раньше был btn-outline-light под градиент) */
[data-bs-theme="light"] .ag-auth-theme-float .btn-outline-light {
    color: var(--bs-emphasis-color);
    border-color: var(--bs-border-color);
    background-color: var(--bs-body-bg);
}
[data-bs-theme="light"] .ag-auth-theme-float .btn-outline-light:hover {
    background-color: var(--bs-secondary-bg);
    color: var(--bs-emphasis-color);
    border-color: var(--bs-border-color);
}
[data-bs-theme="light"] .ag-auth-theme-float .theme-btn.active {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
    color: #fff;
}
/* Логотип + название — одна компактная группа по центру карточки */
.ag-auth-brand-row {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}
.ag-auth-brand-mark {
    width: 48px;
    height: 48px;
    display: block;
    flex-shrink: 0;
}
.ag-auth-brand-title {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.03em;
    color: var(--bs-heading-color);
    margin: 0;
}

.ag-auth-submit-btn {
    min-width: 220px;
}

.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    padding: 12px;
}

.login-card {
    background: var(--white);
    padding: 20px 32px 24px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.1);
    width: 100%;
    text-align: center;
    backdrop-filter: blur(10px);
}

.login-header {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.logo-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-bottom: 8px;
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: logoFloat 3s ease-in-out infinite;
}

.login-logo {
    width: auto;
    height: auto;
    max-width: min(180px, 100%);
    max-height: 180px;
    display: block;
    object-fit: contain;
    box-shadow: none;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.login-subtitle {
    color: var(--bs-secondary-color);
    font-size: 13px;
    font-weight: 500;
    margin: 0;
    letter-spacing: 0.02em;
    max-width: 280px;
    line-height: 1.35;
}

.login-card p {
    color: var(--bs-secondary-color);
    font-size: 13px;
    margin: 0;
    font-weight: 500;
}

/* Стилизация полей ввода внутри формы */
.login-card form {
    margin-top: 22px;
}

.login-card form p {
    text-align: left;
    margin-bottom: 0;
}

.input-group {
    margin-bottom: 16px;
    text-align: left;
}

.input-group:last-of-type {
    margin-bottom: 28px;
}

.login-card label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-dark);
    letter-spacing: 0.3px;
}

.login-card input[type="text"],
.login-card input[type="password"],
.login-card input[type="email"] {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    box-sizing: border-box;
    transition: all 0.3s ease;
    font-size: 15px;
    background: #fafbfc;
}

.login-card input:hover {
    border-color: #cbd5e0;
    background: var(--white);
}

.login-card input:focus {
    border-color: var(--accent-yellow);
    outline: none;
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
    transform: translateY(-1px);
}

.error-msg {
    background: #ffe5e5;
    color: #d90429;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 13px;
    font-weight: 500;
    border-left: 4px solid #d90429;
    text-align: left;
}

.login-forgot-wrap {
    text-align: center;
    margin-top: var(--space-md);
}
.login-forgot-link {
    color: var(--dark-blue);
    font-size: var(--font-size-base);
    font-weight: 600;
    text-decoration: none;
}
.login-forgot-link:hover {
    color: var(--accent-yellow);
}
.login-footer {
    margin-top: var(--space-lg);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: var(--font-size-xs);
}

/* --- ОБЩИЕ СТИЛИ ИНТЕРФЕЙСА --- */

header {
    background: var(--dark-blue);
    color: white;
    padding: 0 5%;
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid var(--accent-yellow);
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.header-logo {
    font-size: 22px;
    font-weight: 800;
    color: var(--accent-yellow);
    text-decoration: none;
    display: flex;
    align-items: center;
}

.header-logo a {
    display: flex;
    align-items: center;
    color: inherit;
    text-decoration: none;
    outline: none;
    box-shadow: none;
    border: none;
}
.header-logo a:hover,
.header-logo a:focus {
    outline: none;
    box-shadow: none;
    opacity: 1;
}

.header-logo img {
    height: 32px !important;
    width: auto;
    max-width: 250px;
    display: block;
    object-fit: contain;
    opacity: 1;
    vertical-align: middle;
    box-shadow: none;
}

.main-menu { display: flex; gap: 30px; }
.menu-item {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: 0.3s;
    padding: 23px 0; /* Чтобы область клика была на всю высоту шапки */
    border-bottom: 3px solid transparent;
}

.menu-item:hover, .menu-item.active {
    color: var(--accent-yellow);
    border-bottom-color: var(--accent-yellow);
}

/* Кнопки (только для submit без Bootstrap-класса .btn) */
button[type="submit"]:not(.btn) {
    background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
    color: var(--on-accent);
    border: none;
    padding: 0.4rem 0.85rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 400;
    font-size: 0.875rem;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}
button[type="submit"]:not(.btn):hover {
    background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
    box-shadow: 0 4px 14px rgba(29, 78, 216, 0.32);
}

/* Кнопки страницы отчётов и фильтров — палитра из bootstrap-theme (.btn-primary) */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.report-filters-actions .btn-primary {
    width: auto;
    padding: 0.35rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
}
.btn-secondary,
.btn-success,
.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    justify-content: center;
}
.import-form-inner {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}
.import-form-inner .field-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--dark-blue);
}

/* --- СТРАНИЦА ОТЧЁТОВ И АНАЛИТИКИ --- */
.report-section {
    background: var(--white);
    padding: 28px;
    border-radius: 12px;
    margin-bottom: 28px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid var(--border-color);
}
.report-section h2 {
    margin: 0 0 20px 0;
    color: var(--dark-blue);
    font-size: 22px;
    font-weight: 800;
}
.report-section h3 {
    margin: 0 0 12px 0;
    color: var(--dark-blue);
    font-size: 16px;
    font-weight: 700;
}
.report-section .stats-grid {
    margin-bottom: 24px;
}
.report-two-cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}
.report-custom-dates {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.report-table thead tr {
    background: var(--dark-blue);
    color: #fff;
}
.report-table th {
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.report-table th.num,
.report-table th:last-child,
.report-table td.num {
    text-align: right;
}
.report-table tbody tr {
    border-bottom: 1px solid var(--border-color);
}
.report-table tbody tr:hover {
    background: rgba(0,0,0,0.02);
}
.report-table td {
    padding: 10px 14px;
    color: var(--text-dark);
}
.report-table td a {
    color: var(--dark-blue);
    text-decoration: none;
    font-weight: 600;
}
.report-table td a:hover {
    color: var(--accent-yellow);
    text-decoration: underline;
}
.report-empty {
    padding: 14px;
    text-align: center;
    color: #6c757d;
    font-size: 14px;
}
.table-empty {
    text-align: center;
    padding: 40px;
    color: #6c757d;
    font-size: 14px;
}
.empty-state {
    text-align: center;
    padding: 40px;
    color: #6c757d;
    font-size: 14px;
}
.empty-state a {
    color: var(--dark-blue);
    text-decoration: underline;
}
.report-filters-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}
.report-filters-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.report-filters-section .field-group label,
.report-filters-section label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--text-dark);
}

/* --- СТРАНИЦА ПОМОЩИ --- */
.help-container {
    max-width: 900px;
    margin: 0 auto;
}
.help-section {
    margin-bottom: 30px;
}
.help-section h2 {
    color: var(--dark-blue);
    margin-bottom: 20px;
    font-size: 24px;
    border-bottom: 3px solid var(--accent-yellow);
    padding-bottom: 10px;
}
.help-intro {
    background: linear-gradient(135deg, var(--dark-blue) 0%, #2c5282 100%);
    color: #fff;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
}
.help-intro h1 {
    margin: 0 0 10px 0;
    font-size: 32px;
}
.help-intro p {
    margin: 0;
    font-size: 16px;
    opacity: 0.9;
}
.back-link {
    display: inline-block;
    margin-bottom: 20px;
    color: var(--dark-blue);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}
.back-link:hover {
    color: var(--accent-yellow);
}
.faq-item {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 15px;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.faq-item:hover {
    border-color: var(--accent-yellow);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.faq-question {
    padding: 18px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: var(--dark-blue);
    background: var(--bg-light);
    transition: background 0.2s ease;
}
.faq-question:hover {
    background: rgba(0,0,0,0.04);
}
.faq-question.active {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.12) 0%, rgba(29, 78, 216, 0.06) 100%);
    color: var(--text-dark);
    border-left: 3px solid #2563eb;
}
.faq-icon {
    font-size: 20px;
    transition: transform 0.3s ease;
}
.faq-question.active .faq-icon {
    transform: rotate(180deg);
}
.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}
.faq-answer.active {
    max-height: 2000px;
}
.faq-answer-content {
    padding: 20px;
    color: var(--text-dark);
    line-height: 1.6;
}
.faq-answer-content h3,
.faq-answer-content h4 {
    color: var(--dark-blue);
    margin-top: 1.25em;
    margin-bottom: 0.5em;
}
.faq-answer-content p,
.faq-answer-content li {
    color: var(--text-dark);
}
.faq-answer-content .help-block {
    margin-top: 1.5em;
}
.faq-answer-content .help-block:first-of-type {
    margin-top: 1em;
}
.permissions-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}
.permissions-table th,
.permissions-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
.permissions-table th {
    background: var(--dark-blue);
    color: #fff;
    font-weight: 600;
}
.permissions-table tbody tr:hover {
    background: var(--bg-light);
}
.permissions-table td {
    color: var(--text-dark);
}
.permission-yes {
    color: #28a745;
    font-weight: 600;
}
.permission-no {
    color: #d90429;
    font-weight: 600;
}
.permission-partial {
    color: #d4a72c;
    font-weight: 600;
}

.text-muted {
    color: var(--text-muted);
}

.site-footer {
    margin-top: var(--space-2xl);
    padding: var(--space-lg) var(--space-md);
    text-align: center;
    color: var(--text-muted);
    font-size: var(--font-size-sm);
    border-top: 1px solid var(--border-color);
}
.site-footer .container {
    padding-top: 0;
    padding-bottom: 0;
}
.site-footer-text { margin: 0; }

/* Хлебные крошки (навигационная цепочка) */
.breadcrumbs {
    margin-bottom: 12px;
    padding: 6px 0;
    font-size: 13px;
    color: var(--bs-secondary-color);
}
.breadcrumbs a {
    color: var(--dark-blue);
    text-decoration: none;
}
.breadcrumbs a:hover {
    text-decoration: underline;
}
.breadcrumbs-sep {
    margin: 0 6px;
    color: var(--border-color);
    user-select: none;
}
.breadcrumbs span:last-child {
    color: var(--text-dark);
}

/* Блок кнопки «Вернуться» — одинаково на всех страницах */
.page-back {
    margin-bottom: 20px;
}

.settings-description {
    color: var(--text-dark);
    margin: 0;
}

/* Кнопки в формах настроек — компактные, не на всю ширину */
.form-actions {
    margin-top: 20px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 10px;
}
.form-actions button[type="submit"],
.form-actions .btn-primary {
    width: auto;
    padding: 0.35rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 400;
}

h3 {
    color: var(--dark-blue);
    margin-top: 0;
    border-left: 5px solid var(--accent-yellow);
    padding-left: 15px;
    margin-bottom: 25px;
}

/*
 * Только «голые» таблицы без Bootstrap (.table), без отчётов и помощи.
 * Таблицы с .table оформляются Bootstrap + bootstrap-theme.css.
 */
main table:not(.table):not(.report-table):not(.permissions-table) {
    width: 100%;
    border-collapse: collapse;
    margin-top: var(--space-md);
    font-size: var(--font-size-base);
    border-radius: var(--radius-md);
    overflow: hidden;
}
main table:not(.table):not(.report-table):not(.permissions-table) th {
    background: var(--dark-blue);
    color: #fff;
    padding: var(--space-md) var(--space-lg);
    text-align: left;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
main table:not(.table):not(.report-table):not(.permissions-table) th a {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
}
main table:not(.table):not(.report-table):not(.permissions-table) th a:hover {
    color: var(--accent-yellow);
}
main table:not(.table):not(.report-table):not(.permissions-table) td {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-dark);
}
main table:not(.table):not(.report-table):not(.permissions-table) tbody tr:hover td {
    background: rgba(0, 0, 0, 0.02);
}
main table:not(.table):not(.report-table):not(.permissions-table) tbody tr:last-child td {
    border-bottom: none;
}

/* Статусы-бейджи */
.badge {
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}
/* Статусы заявок: спокойная семантическая палитра без дублирования цветов */
.status-new { background: #e8eef7; color: #334155; } /* Новая - нейтрально-синий */
.status-in-progress { background: #fff4cc; color: #92400e; } /* В работе - янтарный */
.status-sent { background: #dbeafe; color: #1e40af; } /* Отгружена (в пути) - синий */
.status-completed { background: #dcfce7; color: #166534; } /* Выполнена - зеленый */
.status-cancelled { background: #eceff3; color: #475569; } /* Отменена - серый */
/* Стили для select-ов статусов (цветной фон в зависимости от текущего статуса) */
.status-select { transition: all 0.2s ease; }
.status-select-new { background: #e8eef7; color: #334155; }
.status-select-in-progress { background: #fff4cc; color: #92400e; }
.status-select-sent { background: #dbeafe; color: #1e40af; }
.status-select-completed { background: #dcfce7; color: #166534; }
.status-select-cancelled { background: #eceff3; color: #475569; }
/* Приоритеты заявок */
.priority-low { background: #e5e7eb; color: #374151; } /* Низкий - нейтральный серый */
.priority-medium { background: #dbeafe; color: #1d4ed8; } /* Средний - синий */
.priority-high { background: #fed7aa; color: #c2410c; } /* Высокий - оранжевый */
.priority-urgent { background: #fecaca; color: #b91c1c; } /* Срочный - красный */
/* Просроченная дата «Нужно до» */
.overdue-badge { background: #ffebee; color: #c62828; padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; }
tr.overdue-row { background: #fff5f5; }

/* Заявка → позиции: отправлено (мягкая подсветка строки, читаемый текст) */
.ag-item-sent td {
    background-color: rgba(40, 167, 69, 0.14); /* мягкий зелёный */
    color: var(--text-dark);
}
.ag-item-sent:hover td {
    background-color: rgba(40, 167, 69, 0.20);
}
.ag-item-sent .text-muted {
    color: rgba(0, 0, 0, 0.6) !important;
}
.ag-item-sent-check {
    margin-left: 8px;
    color: #1e7e34;
    font-size: 14px;
    font-weight: 800;
}
[data-bs-theme="dark"] .ag-item-sent td {
    background-color: rgba(40, 167, 69, 0.20);
    color: rgba(255, 255, 255, 0.92);
}
[data-bs-theme="dark"] .ag-item-sent .text-muted {
    color: rgba(255, 255, 255, 0.70) !important;
}
[data-bs-theme="dark"] .ag-item-sent-check {
    color: rgba(116, 255, 172, 0.95);
}
/* Стили для select приоритета в форме создания заявки — только цвет текста */
.priority-select option[value="low"] { color: #374151; }
.priority-select option[value="medium"] { color: #1d4ed8; }
.priority-select option[value="high"] { color: #c2410c; }
.priority-select option[value="urgent"] { color: #b91c1c; }
/* Цвет текста выбранного значения в select (без фона) */
.priority-select.priority-select-low { color: #374151; font-weight: 600; }
.priority-select.priority-select-medium { color: #1d4ed8; font-weight: 600; }
.priority-select.priority-select-high { color: #c2410c; font-weight: 600; }
.priority-select.priority-select-urgent { color: #b91c1c; font-weight: 600; }
/* Старые классы для совместимости */
.status-urgent { background: #ffe5e5; color: #d90429; }
/* Совместимость: status-progress интерпретируем как "в работе" */
.status-progress {
    background-color: #fff4cc;
    color: #92400e;
    font-weight: 400;
}
[data-bs-theme="dark"] .status-progress {
    background-color: #854d0e;
    color: #fde68a;
}

/* --- Спойлер в карточках (формы) --- */
.spoiler-toggle {
    background: linear-gradient(135deg, var(--dark-blue) 0%, #0f1a26 100%);
    border: 1px solid var(--accent-yellow);
    width: 100%;
    text-align: left;
    padding: 8px 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0;
    transition: all 0.2s ease;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.spoiler-toggle:hover {
    border-color: #e0a21f;
    box-shadow: 0 2px 8px rgba(243, 177, 35, 0.2);
}

.spoiler-toggle:active {
    transform: scale(0.99);
}

.spoiler-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.spoiler-icon.open {
    background: linear-gradient(180deg, #60a5fa 0%, #3b82f6 100%);
    color: #0f172a;
    transform: rotate(45deg);
}

.spoiler-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-yellow);
    letter-spacing: 0.2px;
    flex: 1;
}

.spoiler-content {
    margin-top: 8px;
    animation: slideDown 0.3s ease-out;
}

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

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.field-group {
    display: flex;
    flex-direction: column;
}

.field-group.full-width {
    grid-column: 1 / -1;
}

.field-group label {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--bs-emphasis-color, var(--text-dark));
    margin-bottom: 8px;
    line-height: 1.45;
}

.field-group .required {
    color: #d90429;
    font-weight: 700;
    margin-left: 3px;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 14px;
    transition: 0.3s;
}

/* Селекты отдельно: нельзя навешивать «толстые» отступы на .form-select-sm (панели фильтров рядом с .form-control-sm). */
.form-select {
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 14px;
    transition: 0.3s;
    line-height: 1.45;
    background-color: var(--white);
    color: var(--text-dark);
    cursor: pointer;
    border: 2px solid var(--border-color);
    border-radius: 6px;
}

/* Основные формы и отчёты: визуально как .form-input */
.form-select:not(.form-select-sm):not(.form-select-lg) {
    padding: 12px 2.5rem 12px 12px;
    min-height: 0;
}

/* Мульти-выбор: без стрелки и без увеличенного правого отступа */
.form-select[multiple] {
    padding: 12px;
    background-image: none !important;
}

/* Компактные фильтры: та же шкала, что у Bootstrap .form-control-sm */
.form-select.form-select-sm {
    padding: 0.25rem 2rem 0.25rem 0.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
    border-width: 1px;
    border-radius: var(--bs-border-radius-sm, 0.25rem);
    min-height: calc(1.5em + 0.5rem + 2px);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    border-color: var(--accent-yellow);
    outline: none;
    box-shadow: 0 0 0 3px rgba(243, 177, 35, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

/* --- СТИЛИ ДЛЯ ЗАГОЛОВКА И ПОЛЬЗОВАТЕЛЯ --- */
.user-control {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    position: relative;
    cursor: pointer;
}

.user-info:hover .user-name {
    color: var(--accent-yellow);
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.user-name::after {
    content: '▼';
    font-size: 10px;
    opacity: 0.7;
    transition: transform 0.2s ease;
}

.user-info.active .user-name::after {
    transform: rotate(180deg);
}

.user-role {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    text-transform: capitalize;
}

/* Выпадающее меню пользователя */
.user-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--white);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    z-index: 1000;
    overflow: hidden;
}

.user-info.active .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-item {
    display: block;
    padding: 12px 16px;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}

.user-dropdown-item:last-child {
    border-bottom: none;
}

.user-dropdown-item:hover {
    background: var(--bg-light);
    color: var(--dark-blue);
}

/* logout сейчас стилизуем так же, как остальные пункты меню */

.user-dropdown-item button {
    width: 100%;
    text-align: left;
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    padding: 0;
    margin: 0;
}

.user-dropdown form {
    margin: 0;
}

.logout-btn {
    background: transparent;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 8px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: 0.3s;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Переключатель темы в шапке */
.header-theme-switch {
    display: flex;
    align-items: center;
    gap: 4px;
}
.header-theme-switch .theme-btn {
    width: 38px;
    height: 38px;
    padding: 0;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-radius: 8px;
    background: transparent;
    color: white;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
}
.header-theme-switch .theme-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.5);
}
.header-theme-switch .theme-btn.active {
    background: #93c5fd;
    color: #0f172a;
    border-color: #93c5fd;
}

/* Обёртка таблицы: горизонтальный скролл (Bootstrap .table-responsive) */
.table-responsive {
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}
.table-responsive table {
    width: 100%;
    min-width: 880px;
}
.bulk-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-wrap: wrap;
}

/* --- СООБЩЕНИЯ --- */
.messages,
.messages-block {
    margin: 16px 0 24px 0;
    position: relative;
    z-index: 100;
}

.messages-block .message:last-child {
    margin-bottom: 0;
}

.message {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-weight: 500;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    animation: slideInMessage 0.3s ease-out;
    position: relative;
}

@keyframes slideInMessage {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.message::before {
    content: '';
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.message.success {
    background: #e8f5e9;
    color: #2d8659;
    border-left: 4px solid #2d8659;
}

.message.success::before {
    content: '✓';
    color: #2d8659;
    font-weight: bold;
}

.message.error {
    background: #ffebee;
    color: #c62828;
    border-left: 4px solid #d90429;
}

.message.error::before {
    content: '✗';
    color: #d90429;
    font-weight: bold;
}

.message.warning {
    background: #fff3e0;
    color: #e65100;
    border-left: 4px solid #ff9800;
}

.message.warning::before {
    content: '⚠';
    color: #ff9800;
    font-weight: bold;
}

.message.info {
    background: #e3f2fd;
    color: #1565c0;
    border-left: 4px solid #2196f3;
}

.message.info::before {
    content: 'ℹ';
    color: #2196f3;
    font-weight: bold;
}

/* Кнопка закрытия сообщения */
.message-close {
    margin-left: auto;
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.message-close:hover {
    opacity: 1;
}

/* --- ОШИБКИ ФОРМЫ --- */
.errorlist {
    list-style: none;
    padding: 0;
    margin: 8px 0 0 0;
    color: #d90429;
    font-size: 13px;
    background: #ffebee;
    padding: 10px 12px;
    border-radius: 6px;
    border-left: 3px solid #d90429;
}

.errorlist li {
    margin-bottom: 4px;
}

.errorlist li:last-child {
    margin-bottom: 0;
}

.field-group .errorlist {
    margin-top: 8px;
}

.form-input.error,
.form-textarea.error,
.form-select.error {
    border-color: #d90429;
    background: #fff5f5;
}

.form-input.error:focus,
.form-textarea.error:focus,
.form-select.error:focus {
    box-shadow: 0 0 0 3px rgba(217, 4, 41, 0.1);
}

/* Сводка ошибок формы (над формой) */
.form-errors-summary {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
    border-left: 4px solid #d90429;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
}

/* --- СТИЛИ ДЛЯ ЛИЧНОГО КАБИНЕТА (DASHBOARD) --- */
.dashboard-title {
    color: var(--dark-blue);
    font-size: 32px;
    margin: 30px 0 10px 0;
    font-weight: 800;
}

.dashboard-subtitle {
    color: var(--bs-secondary-color);
    font-size: 16px;
    margin-bottom: 30px;
}

/* Статистика */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--white);
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    transition: 0.3s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    font-size: 40px;
    line-height: 1;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--dark-blue);
    line-height: 1;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 14px;
    color: var(--bs-secondary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Модули/Разделы */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.module-card {
    background: var(--white);
    padding: var(--space-xl);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid var(--border-color);
    display: block;
}

.module-card:hover:not(.disabled) {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}
.module-card:hover,
.module-card:hover * {
    text-decoration: none;
}

.module-card.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    position: relative;
}

.module-card.disabled::after {
    content: 'Скоро';
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(180deg, #fcd34d 0%, #fbbf24 100%);
    color: #422006;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.module-icon {
    font-size: 48px;
    margin-bottom: 15px;
    line-height: 1;
}

.module-card--compact .module-description {
    display: none;
}

/* Карточки разделов на дашборде — крупнее */
.dashboard-modules.dashboard-modules {
    margin-bottom: 24px;
}
.dashboard-module-card {
    padding: 22px 20px !important;
    text-align: center;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.dashboard-module-card .module-icon {
    font-size: 2.25rem;
    margin-bottom: 10px;
    color: var(--dark-blue);
    display: flex;
    align-items: center;
    justify-content: center;
}
.dashboard-module-card .module-icon .bi {
    font-size: 1em;
}
.dashboard-module-card:hover .module-icon {
    color: #2563eb;
}
.dashboard-module-card .module-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.module-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--dark-blue);
    margin-bottom: 8px;
}

.module-description {
    font-size: 14px;
    color: var(--bs-secondary-color);
    line-height: 1.5;
}

/* Последние заявки */
.recent-section {
    background: var(--white);
    padding: var(--space-xl);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    margin-bottom: var(--space-lg);
}
/* Напоминания на дашборде */
.reminders-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.reminder-item {
    padding: var(--space-md) var(--space-lg);
    background: var(--white);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-yellow);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
}
.reminder-item a {
    font-weight: var(--font-weight-medium);
    color: var(--dark-blue);
    text-decoration: none;
}
.reminder-item a:hover {
    color: var(--accent-yellow);
}
.reminder-meta {
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

.recent-requests {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.recent-item {
    padding: 15px;
    background: var(--bg-light);
    border-radius: 8px;
    border-left: 4px solid var(--accent-yellow);
}

.recent-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.recent-item-details {
    display: flex;
    gap: 10px;
    font-size: 13px;
    color: var(--bs-secondary-color);
    align-items: center;
}

/* Журнал заявок: колонка «Действия» — фиксированная ширина, кнопки не растягиваются */
.requests-actions-col {
    width: 1%;
    white-space: nowrap;
}
.requests-actions-cell {
    width: 1%;
    white-space: nowrap;
    vertical-align: middle;
}
.requests-actions-btns {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    flex-wrap: nowrap;
}
.requests-actions-btns a,
.requests-actions-btns button {
    flex-shrink: 0;
    white-space: nowrap;
}
.btn-link {
    color: var(--dark-blue);
    text-decoration: none;
    font-weight: 400;
    font-size: 0.875rem;
    transition: 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-link:hover {
    color: var(--accent-yellow);
}

/*
 * Ссылки в ячейках таблиц — цвет как у текста + подчёркивание, без отдельного «синего слоя»
 * (в тёмной теме синий ссылок сливался с тёмной шапкой и фоном).
 */
main .table tbody td a:not(.btn):not(.page-link):not(.dropdown-item) {
    font-size: inherit;
    font-weight: 400;
    color: var(--bs-emphasis-color);
    text-decoration: underline;
    text-decoration-color: rgba(15, 23, 42, 0.22);
    text-underline-offset: 0.2em;
}
main .table tbody td a:not(.btn):not(.page-link):not(.dropdown-item):hover {
    color: var(--bs-emphasis-color);
    text-decoration-color: rgba(15, 23, 42, 0.45);
}
[data-bs-theme="dark"] main .table tbody td a:not(.btn):not(.page-link):not(.dropdown-item) {
    color: #f1f5f9;
    text-decoration-color: rgba(241, 245, 249, 0.35);
}
[data-bs-theme="dark"] main .table tbody td a:not(.btn):not(.page-link):not(.dropdown-item):hover {
    color: #fff;
    text-decoration-color: rgba(248, 250, 252, 0.65);
}

/* --- СТИЛИ ДЛЯ ДЕТАЛЬНОГО ПРОСМОТРА ЗАЯВКИ --- */
.detail-card {
    background: var(--white);
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid var(--accent-yellow);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.detail-label {
    font-size: 0.8125rem;
    text-transform: none;
    letter-spacing: 0.01em;
    color: var(--bs-secondary-color, #475569);
    margin-bottom: 8px;
    font-weight: 600;
}

.detail-value {
    font-size: 1rem;
    line-height: 1.55;
    color: var(--bs-body-color, var(--text-dark));
    font-weight: 500;
}
.detail-value-pre {
    white-space: pre-wrap;
}
.detail-value-photo {
    position: relative;
    display: inline-block;
}
.detail-photo-img {
    max-width: 100%;
    max-height: 500px;
    border-radius: var(--radius-md);
    border: 2px solid var(--dark-blue);
    box-shadow: var(--shadow-md);
}
.detail-photo-form {
    margin-top: var(--space-sm);
}

/* --- СТИЛИ ДЛЯ МОДАЛЬНОГО ОКНА ПОДТВЕРЖДЕНИЯ УДАЛЕНИЯ --- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.modal-overlay.show {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-confirm {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    padding: 0;
    animation: slideUp 0.3s ease-out;
    overflow: hidden;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-confirm-header {
    background: linear-gradient(135deg, #d90429 0%, #b0031f 100%);
    padding: 25px 30px;
    color: white;
    display: flex;
    align-items: center;
    gap: 15px;
}

.modal-confirm-icon {
    font-size: 32px;
    line-height: 1;
}

.modal-confirm-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    flex: 1;
}

.modal-confirm-body {
    padding: 30px;
}

.modal-confirm-message {
    font-size: 16px;
    color: var(--text-dark);
    line-height: 1.6;
    margin: 0 0 20px 0;
}

.modal-confirm-warning {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 12px 15px;
    border-radius: 6px;
    font-size: 14px;
    color: #856404;
    margin-bottom: 20px;
}

.modal-confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.modal-btn-cancel {
    background: #e1e5eb;
    color: var(--text-dark);
}

.modal-btn-cancel:hover {
    background: #cbd5e0;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.modal-btn-delete {
    background: #d90429;
    color: white;
}

.modal-btn-delete:hover {
    background: #b0031f;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(217, 4, 41, 0.4);
}

.modal-btn-delete:active {
    transform: translateY(0);
}

/* --- СТИЛИ ДЛЯ ИНДИКАТОРА ЗАГРУЗКИ --- */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 10001;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 20px;
}

.loading-overlay.show {
    display: flex;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--bg-light);
    border-top-color: var(--accent-yellow);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--dark-blue);
}

/* --- ПАГИНАЦИЯ --- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    padding: 10px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    border: 2px solid var(--border-color);
    background: var(--white);
    color: var(--text-dark);
    min-width: 44px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pagination a:hover {
    background: rgba(37, 99, 235, 0.1);
    color: #1d4ed8;
    border-color: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(29, 78, 216, 0.18);
}

.pagination .current {
    background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff;
    border-color: #1e40af;
    cursor: default;
}

.pagination .disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.pagination-info {
    margin: 20px 0;
    text-align: center;
    color: var(--bs-secondary-color);
    font-size: 14px;
}

.filters-form {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    align-items: flex-end;
}

/* Кликабельные заголовки таблицы */
table thead th a {
    transition: color 0.2s ease;
}

table thead th a:hover {
    color: var(--accent-yellow);
}

/* Массовые операции */
.bulk-actions {
    transition: all 0.2s ease;
}

.bulk-actions input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.bulk-actions select:focus {
    border-color: var(--accent-yellow);
    outline: none;
}

/* --- АДАПТИВНОСТЬ ДЛЯ МОБИЛЬНЫХ УСТРОЙСТВ --- */
@media (max-width: 768px) {
    header {
        padding: 0 3%;
        height: auto;
        min-height: 60px;
        flex-wrap: wrap;
    }
    
    .header-logo {
        font-size: 18px;
    }
    
    .header-logo img {
        height: 28px !important;
        max-width: 200px;
        box-shadow: none;
    }
    
    .user-control {
        width: 100%;
        justify-content: space-between;
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .bulk-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .bulk-actions > div {
        width: 100%;
    }
    
    .bulk-actions select,
    .bulk-actions button {
        width: 100%;
    }
    
    .modules-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-confirm {
        width: 95%;
        margin: 20px;
    }
    
    .modal-confirm-header {
        padding: 20px;
    }
    
    .modal-confirm-body {
        padding: 20px;
    }
    
    .modal-confirm-actions {
        flex-direction: column;
    }
    
    .modal-btn {
        width: 100%;
    }
    
    /* Не трогаем Bootstrap .table (ломает вёрстку display:block) */
    main table:not(.table):not(.report-table):not(.permissions-table) {
        font-size: 12px;
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    main table:not(.table):not(.report-table):not(.permissions-table) th,
    main table:not(.table):not(.report-table):not(.permissions-table) td {
        padding: 8px 6px;
        white-space: nowrap;
    }
    
    .page-back {
        margin-bottom: 12px;
    }
    
    .page-back .btn,
    .btn-secondary {
        display: inline-block;
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .card-body > h3,
    .card-body .h5 {
        font-size: 1.1rem;
    }
    
    .spoiler-toggle {
        padding: 8px 12px;
    }
    
    .spoiler-text {
        font-size: 12px;
    }
    
    .spoiler-icon {
        width: 22px;
        height: 22px;
        font-size: 14px;
    }
    
    .spoiler-content {
        margin-top: 10px;
    }
    
    .detail-card {
        padding: 14px;
    }
    
    .modules-grid .module-card {
        padding: 20px 16px;
        min-height: 100px;
    }
    
    .module-card h4 {
        font-size: 15px;
    }
    
    .messages-block,
    .messages {
        margin: 12px 0 16px 0;
    }
    
    .message {
        padding: 12px 16px;
        font-size: 13px;
    }
    
    .form-errors-summary {
        padding: 10px 14px;
        font-size: 13px;
    }
}

/* --- НАСТРОЙКИ: ПЕРЕКЛЮЧАТЕЛЬ ТЕМЫ --- */
.settings-block {
    max-width: 480px;
}
.theme-toggle-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.theme-label {
    font-weight: 600;
    color: var(--text-dark);
}
.theme-switch {
    display: flex;
    gap: 0;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--border-color);
}
.theme-btn {
    padding: 10px 20px;
    border: none;
    background: var(--bg-light);
    color: var(--text-dark);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.theme-btn:hover {
    background: var(--border-color);
}
.theme-btn.active {
    background: var(--dark-blue);
    color: var(--accent-yellow);
}
.theme-hint {
    margin: 0;
    font-size: 13px;
    color: var(--bs-secondary-color);
}

/* --- Тёмная тема: унаследованные блоки + синхронизация с --bs-* (см. bootstrap-theme.css) --- */
[data-bs-theme="dark"] {
    --bg-light: #161b22;
    --text-dark: #e6edf3;
    --text-muted: var(--bs-secondary-color);
    --white: #1e293b;
    --border-color: #334155;
}
[data-bs-theme="dark"] body {
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
}
[data-bs-theme="dark"] h1,
[data-bs-theme="dark"] h2,
[data-bs-theme="dark"] h3,
[data-bs-theme="dark"] h4 {
    color: #e6edf3;
    border-left-color: var(--accent-yellow);
}
[data-bs-theme="dark"] .dashboard-title {
    color: #e6edf3;
}
[data-bs-theme="dark"] .dashboard-subtitle,
[data-bs-theme="dark"] .theme-hint,
[data-bs-theme="dark"] .module-description,
[data-bs-theme="dark"] small,
[data-bs-theme="dark"] .text-muted {
    color: var(--bs-secondary-color);
}
[data-bs-theme="dark"] .detail-label,
[data-bs-theme="dark"] .field-group label {
    color: #e2e8f0;
}
[data-bs-theme="dark"] .detail-value,
[data-bs-theme="dark"] .stat-value,
[data-bs-theme="dark"] .stat-label {
    color: #e6edf3;
}
[data-bs-theme="dark"] main table:not(.table):not(.report-table):not(.permissions-table) th {
    background: #1e293b;
    color: var(--bs-secondary-color);
    border-bottom: 1px solid var(--bs-border-color);
    font-weight: 600;
}
[data-bs-theme="dark"] main table:not(.table):not(.report-table):not(.permissions-table) td {
    border-bottom: 1px solid var(--bs-border-color);
    color: var(--bs-body-color);
}
[data-bs-theme="dark"] main table:not(.table):not(.report-table):not(.permissions-table) tr:hover td {
    background: rgba(255,255,255,0.02);
}
[data-bs-theme="dark"] .form-input,
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .form-textarea,
[data-bs-theme="dark"] input[type="text"],
[data-bs-theme="dark"] input[type="password"],
[data-bs-theme="dark"] input[type="email"],
[data-bs-theme="dark"] input[type="date"],
[data-bs-theme="dark"] textarea,
[data-bs-theme="dark"] select {
    background: #0d1117;
    border: 1px solid #30363d;
    color: #e6edf3;
    border-radius: 6px;
}
[data-bs-theme="dark"] .form-input:focus,
[data-bs-theme="dark"] .form-select:focus,
[data-bs-theme="dark"] .form-textarea:focus,
[data-bs-theme="dark"] input:focus,
[data-bs-theme="dark"] textarea:focus,
[data-bs-theme="dark"] select:focus {
    border-color: var(--accent-yellow);
    box-shadow: 0 0 0 2px rgba(243, 177, 35, 0.2);
    outline: none;
}
[data-bs-theme="dark"] .form-input::placeholder,
[data-bs-theme="dark"] input::placeholder {
    color: #6e7681;
}
[data-bs-theme="dark"] .module-card:hover,
[data-bs-theme="dark"] .module-card:hover * {
    text-decoration: none;
}
[data-bs-theme="dark"] .module-card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    color: #e6edf3;
}
[data-bs-theme="dark"] .module-title {
    color: #e6edf3;
}
[data-bs-theme="dark"] .dashboard-module-card .module-icon {
    color: var(--bs-secondary-color);
}
[data-bs-theme="dark"] .dashboard-module-card:hover .module-icon {
    color: #93c5fd;
}
[data-bs-theme="dark"] .module-card:hover {
    background: #21262d;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
[data-bs-theme="dark"] .stat-card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    color: #e6edf3;
}
[data-bs-theme="dark"] .theme-btn {
    background: #21262d;
    border: 1px solid #30363d;
    color: #e6edf3;
    border-radius: 8px;
}
[data-bs-theme="dark"] .theme-btn:hover {
    background: #30363d;
    border-color: #8b949e;
}
[data-bs-theme="dark"] .theme-btn.active {
    background: var(--dark-blue);
    border-color: var(--accent-yellow);
    color: var(--accent-yellow);
}
[data-bs-theme="dark"] .message.success {
    background: #1a2e1a;
    color: #7ee787;
    border-left: 4px solid #238636;
}
[data-bs-theme="dark"] .message.error {
    background: #2e1a1a;
    color: #f85149;
    border-left: 4px solid #da3633;
}
[data-bs-theme="dark"] .message.warning {
    background: #2e2a1a;
    color: #d29922;
    border-left: 4px solid #9e6a03;
}
[data-bs-theme="dark"] .message.info {
    background: #1a2a3a;
    color: #58a6ff;
    border-left: 4px solid #1f6feb;
}
[data-bs-theme="dark"] .form-errors-summary {
    background: #2e1a1a;
    color: #f85149;
    border-color: #3d2020;
    border-left-color: #da3633;
}
[data-bs-theme="dark"] .errorlist {
    background: #2e1a1a;
    color: #f85149;
    border-left-color: #da3633;
}
[data-bs-theme="dark"] .pagination a {
    background: #21262d;
    border: 1px solid #30363d;
    color: #58a6ff;
    border-radius: 6px;
}
[data-bs-theme="dark"] .pagination a:hover {
    color: #79b8ff;
    background: #30363d;
    border-color: #8b949e;
}
[data-bs-theme="dark"] .pagination .current {
    background: var(--dark-blue);
    border-color: var(--accent-yellow);
    color: var(--accent-yellow);
}
[data-bs-theme="dark"] .login-subtitle,
[data-bs-theme="dark"] .login-card p {
    color: var(--bs-secondary-color);
}
[data-bs-theme="dark"] .loading-overlay {
    background: rgba(13, 17, 23, 0.92);
}
[data-bs-theme="dark"] .loading-text {
    color: #e6edf3;
}
/* Вне основной .card — как отдельные плитки; внутри карточки переопределяется в bootstrap-theme.css */
[data-bs-theme="dark"] .detail-card {
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    border-left: 4px solid var(--bs-primary);
    border-radius: var(--bs-border-radius, 8px);
    color: var(--bs-body-color);
    box-shadow: none;
}
[data-bs-theme="dark"] .recent-section {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
}
[data-bs-theme="dark"] .recent-item {
    background: #0d1117;
    border: 1px solid #21262d;
    border-left: 4px solid var(--accent-yellow);
    border-radius: 8px;
}
[data-bs-theme="dark"] .recent-item-details {
    color: #8b949e;
}
[data-bs-theme="dark"] .modal-overlay {
    background: rgba(0, 0, 0, 0.75);
}
[data-bs-theme="dark"] .modal-confirm {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.5);
}
[data-bs-theme="dark"] .modal-confirm-header {
    background: linear-gradient(135deg, #b62324 0%, #8b1516 100%);
    border-bottom: 1px solid #30363d;
}
[data-bs-theme="dark"] .modal-confirm-message {
    color: #e6edf3;
}
[data-bs-theme="dark"] .modal-confirm-warning {
    background: #2e2a1a;
    border-left: 4px solid #d29922;
    color: #d29922;
}
[data-bs-theme="dark"] .modal-btn-cancel {
    background: #21262d;
    border: 1px solid #30363d;
    color: #e6edf3;
}
[data-bs-theme="dark"] .modal-btn-cancel:hover {
    background: #30363d;
    border-color: #8b949e;
}
[data-bs-theme="dark"] .spoiler-toggle {
    background: #161b22;
    border: 1px solid #30363d;
}
[data-bs-theme="dark"] .spoiler-toggle:hover {
    border-color: var(--accent-yellow);
}
[data-bs-theme="dark"] .empty-state,
[data-bs-theme="dark"] .empty-state p,
[data-bs-theme="dark"] .table-empty {
    color: #8b949e;
}
[data-bs-theme="dark"] .empty-state a {
    color: #58a6ff;
}
[data-bs-theme="dark"] .empty-state a:hover {
    color: #79b8ff;
}
/* Отчёты и аналитика в тёмной теме */
[data-bs-theme="dark"] .report-section {
    background: #161b22;
    border: 1px solid #30363d;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
[data-bs-theme="dark"] .report-section h2,
[data-bs-theme="dark"] .report-section h3 {
    color: #e6edf3;
}
[data-bs-theme="dark"] .report-table thead tr {
    background: #21262d;
    color: #e6edf3;
}
[data-bs-theme="dark"] .report-table tbody tr {
    border-bottom-color: #21262d;
}
[data-bs-theme="dark"] .report-table tbody tr:hover {
    background: rgba(255,255,255,0.03);
}
[data-bs-theme="dark"] .report-table td {
    color: #e6edf3;
}
[data-bs-theme="dark"] .report-table td a {
    color: #58a6ff;
}
[data-bs-theme="dark"] .report-table td a:hover {
    color: #79b8ff;
}
[data-bs-theme="dark"] .report-empty {
    color: #8b949e;
}
/* Статусы и приоритеты в тёмной теме */
[data-bs-theme="dark"] .status-new { background: #334155; color: #e2e8f0; }
[data-bs-theme="dark"] .status-in-progress { background: #854d0e; color: #fde68a; }
[data-bs-theme="dark"] .status-sent { background: #1d4ed8; color: #bfdbfe; }
[data-bs-theme="dark"] .status-completed { background: #166534; color: #bbf7d0; }
[data-bs-theme="dark"] .status-cancelled { background: #374151; color: #d1d5db; }
[data-bs-theme="dark"] .status-urgent { background: #da3633; color: #ff7b72; }
[data-bs-theme="dark"] .priority-low { background: #374151; color: #e5e7eb; }
[data-bs-theme="dark"] .priority-medium { background: #1e40af; color: #bfdbfe; }
[data-bs-theme="dark"] .priority-high { background: #9a3412; color: #fdba74; }
[data-bs-theme="dark"] .priority-urgent { background: #991b1b; color: #fecaca; }
[data-bs-theme="dark"] .overdue-badge { background: #2e1a1a; color: #f85149; }
[data-bs-theme="dark"] tr.overdue-row { background: #1c1616; }
/* Выпадающее меню пользователя — тёмная тема */
[data-bs-theme="dark"] .user-dropdown {
    background: #161b22;
    border: 1px solid #30363d;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
[data-bs-theme="dark"] .user-dropdown-item {
    color: #e6edf3;
    border-bottom-color: #21262d;
}
[data-bs-theme="dark"] .user-dropdown-item:hover {
    background: #21262d;
    color: var(--accent-yellow);
}
/* logout в тёмной теме тоже без отдельного цвета */

/* Помощь — тёмная тема */
[data-bs-theme="dark"] .help-section h2 {
    color: #e6edf3;
}
[data-bs-theme="dark"] .back-link {
    color: #58a6ff;
}
[data-bs-theme="dark"] .back-link:hover {
    color: #79b8ff;
}
[data-bs-theme="dark"] .faq-item {
    background: #161b22;
    border-color: #30363d;
}
[data-bs-theme="dark"] .faq-item:hover {
    border-color: rgba(59, 130, 246, 0.35);
}
[data-bs-theme="dark"] .faq-question {
    color: #e6edf3;
    background: #21262d;
}
[data-bs-theme="dark"] .faq-question:hover {
    background: #30363d;
}
[data-bs-theme="dark"] .faq-question.active {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.16) 0%, rgba(15, 23, 42, 0.55) 100%);
    color: #f8fafc;
    border-left: 3px solid #3b82f6;
}
[data-bs-theme="dark"] .faq-answer-content,
[data-bs-theme="dark"] .faq-answer-content p,
[data-bs-theme="dark"] .faq-answer-content li {
    color: #e6edf3;
}
[data-bs-theme="dark"] .faq-answer-content h3,
[data-bs-theme="dark"] .faq-answer-content h4 {
    color: #e6edf3;
}
[data-bs-theme="dark"] .permissions-table th {
    background: #21262d;
    color: #e6edf3;
    border-bottom-color: #30363d;
}
[data-bs-theme="dark"] .permissions-table td {
    color: #e6edf3;
    border-bottom-color: #21262d;
}
[data-bs-theme="dark"] .permissions-table tbody tr:hover {
    background: #21262d;
}
[data-bs-theme="dark"] .permission-yes {
    color: #7ee787;
}
[data-bs-theme="dark"] .permission-no {
    color: #f85149;
}
[data-bs-theme="dark"] .permission-partial {
    color: #d4a72c;
}
[data-bs-theme="dark"] .site-footer {
    border-top-color: #30363d;
    color: #8b949e;
}
[data-bs-theme="dark"] .reminder-item {
    background: #21262d;
    border-color: #30363d;
    border-left-color: var(--accent-yellow);
}