/* =========================================================
   ПЕРЕМЕННЫЕ ТЕМ
   ========================================================= */

   :root {
    /* Основные цвета */
    --bg-main: #e9edf2;
    --bg-card: #ffffff;
    --bg-hover: #f3f5f7;
    --bg-subtle: #eef3f7;

    /* Текст */
    --text-main: #1f2937;
    --text-heading: #172b4d;
    --text-muted: #526273;
    --text-faint: #687586;

    /* Границы */
    --border-color: #cfd6df;
    --border-light: #e0e0e0;

    /* Акценты */
    --accent: #667eea;
    --accent-hover: #5568d3;
    --primary: #172b4d;
    --primary-hover: #23466f;

    /* Статусы */
    --success: #246b4f;
    --success-bg: #d4edda;
    --success-border: #c3e6cb;
    --danger: #a33a46;
    --danger-bg: #f8d7da;
    --danger-border: #f5c6cb;
    --warning: #a87800;
    --warning-bg: #fff3cd;
    --warning-border: #ffeaa7;
    --info: #23677a;
    --info-bg: #eef3f7;

    /* Тени */
    --shadow-sm: 0 1px 4px rgba(20, 35, 50, 0.08);
    --shadow-md: 0 5px 20px rgba(20, 35, 50, 0.10);
    --shadow-lg: 0 10px 40px rgba(20, 35, 50, 0.16);

    /* Сайдбар */
    --sidebar-width: 260px;
    --sidebar-mini-width: 76px;
    --sidebar-bg: #172b4d;
    --sidebar-bg-dark: #10213b;
    --sidebar-text: #d9e2ec;
    --sidebar-muted: #91a1b5;
    --sidebar-active: #ffffff;
    --sidebar-active-bg: #23466f;
    --sidebar-border: rgba(255, 255, 255, 0.08);
    --sidebar-transition: 0.25s ease;
}


/* ===== ТЁМНАЯ ТЕМА ===== */
[data-theme="dark"] {
    --bg-main: #12141f;
    --bg-card: #1c2030;
    --bg-hover: #252b40;
    --bg-subtle: #202638;

    --text-main: #e2e5ec;
    --text-heading: #f0f2f7;
    --text-muted: #9aa3b5;
    --text-faint: #7a8399;

    --border-color: #333a52;
    --border-light: #2a3048;

    --accent: #7c8fff;
    --accent-hover: #93a3ff;
    --primary: #2a3a5c;
    --primary-hover: #354a73;

    --success: #2e9e6b;
    --success-bg: #1a3328;
    --success-border: #2a5240;
    --danger: #e05c6a;
    --danger-bg: #3a1f26;
    --danger-border: #5a2f3a;
    --warning: #e0a52e;
    --warning-bg: #33290f;
    --warning-border: #5a4718;
    --info: #3a9ab5;
    --info-bg: #14252e;

    --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 5px 20px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);

    --sidebar-bg: #0d1120;
    --sidebar-bg-dark: #080b16;
    --sidebar-border: rgba(255, 255, 255, 0.06);
}


/* =========================================================
   БАЗОВЫЕ СТИЛИ
   ========================================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Inter, 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    padding-left: var(--sidebar-width);
    transition: background 0.3s, color 0.3s, padding-left var(--sidebar-transition);
    overflow-x: hidden;
}

body.sidebar-is-mini {
    padding-left: var(--sidebar-mini-width);
}

body > .container {
    max-width: 1200px;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-heading);
}

a {
    color: var(--accent);
}

/* =========================================================
   NAVBAR (отключён — навигация через сайдбар)
   ========================================================= */

.navbar {
    display: none !important;
}

/* =========================================================
   FLASH-СООБЩЕНИЯ
   ========================================================= */

.flash-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 2000;
    max-width: 400px;
}

.flash-message {
    background: var(--bg-card);
    padding: 15px 20px;
    border-radius: 7px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: flashIn 0.5s ease-out;
    border-left: 4px solid var(--primary);
    position: relative;
    overflow: hidden;
}

.flash-success { border-left-color: var(--success); }
.flash-error { border-left-color: var(--danger); }
.flash-warning { border-left-color: var(--warning); }
.flash-info { border-left-color: var(--info); }

.flash-icon { font-size: 1.5em; }

.flash-text {
    flex: 1;
    color: var(--text-main);
    font-size: 0.95em;
    line-height: 1.4;
}

.flash-close {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: var(--text-faint);
    padding: 0 5px;
    transition: color 0.3s;
}

.flash-close:hover { color: var(--text-main); }

.flash-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(102, 126, 234, 0.3);
    width: 100%;
}

@keyframes flashIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes flashOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

@keyframes flashProgress {
    from { width: 100%; }
    to { width: 0%; }
}

/* =========================================================
   КОНТЕЙНЕР
   ========================================================= */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px;
}

/* =========================================================
   ALERTS
   ========================================================= */

.alert {
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid var(--success-border);
}

.alert-error,
.alert-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger-border);
}

.alert-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid var(--warning-border);
}

/* =========================================================
   HERO
   ========================================================= */

.hero-section {
    background: var(--bg-card);
    padding: 60px 40px;
    border-radius: 6px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    margin-bottom: 30px;
}

.hero-section h1 {
    color: var(--text-heading);
    font-size: 2.5em;
    margin-bottom: 15px;
}

.hero-section p {
    color: var(--text-muted);
    font-size: 1.2em;
    margin-bottom: 30px;
}

.hero-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* =========================================================
   FEATURES
   ========================================================= */

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.feature-card {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 6px;
    box-shadow: var(--shadow-md);
    transition: transform 0.3s;
}

.feature-card h3 {
    color: var(--text-heading);
    margin-bottom: 15px;
}

.feature-card ul { list-style: none; }

.feature-card li {
    padding: 8px 0;
    color: var(--text-main);
    padding-left: 25px;
    position: relative;
}

.feature-card li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: bold;
}

.info-box {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 6px;
    margin-top: 30px;
    box-shadow: var(--shadow-md);
    border-left: 5px solid var(--primary);
}

.info-box h3 {
    color: var(--text-heading);
    margin-bottom: 15px;
}

.info-box ul { margin-left: 20px; margin-top: 10px; }

.info-box li {
    margin-bottom: 8px;
    color: var(--text-main);
}

/* =========================================================
   АВТОРИЗАЦИЯ
   ========================================================= */

.auth-card {
    background: var(--bg-card);
    max-width: 450px;
    margin: 50px auto;
    padding: 40px;
    border-radius: 6px;
    box-shadow: var(--shadow-lg);
}

.auth-card h2 {
    text-align: center;
    color: var(--text-heading);
    margin-bottom: 30px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* =========================================================
   ФОРМЫ
   ========================================================= */

.form-group { margin-bottom: 20px; }

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-main);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    background: var(--bg-card);
    color: var(--text-main);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-faint);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* =========================================================
   КНОПКИ
   ========================================================= */

.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    font-weight: 500;
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
}

.btn-primary:hover {
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    margin-top: 20px;
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-success {
    background: var(--success);
    color: #ffffff;
}

.btn-success:hover { filter: brightness(0.9); }

.btn-danger {
    background: var(--danger);
    color: #ffffff;
}

.btn-danger:hover { filter: brightness(0.9); }

.btn-sm { padding: 8px 15px; font-size: 0.9em; }
.btn-large { padding: 15px 40px; font-size: 1.1em; }

/* =========================================================
   ЗАГОЛОВКИ СТРАНИЦ
   ========================================================= */

.page-header {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 6px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-md);
}

.page-header h1 {
    color: var(--text-heading);
    margin-bottom: 10px;
}

.assignment-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 15px;
    color: var(--text-muted);
}

/* =========================================================
   ДАШБОРД
   ========================================================= */

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 6px;
    text-align: center;
    box-shadow: var(--shadow-md);
}

.stat-card h3 {
    color: var(--text-muted);
    margin-bottom: 10px;
}

.stat-number {
    font-size: 2.5em;
    font-weight: bold;
    color: var(--text-heading);
}

.dashboard-actions {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 6px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-md);
}

.dashboard-actions h2 {
    color: var(--text-heading);
    margin-bottom: 20px;
}

.action-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* =========================================================
   КОНТЕНТ
   ========================================================= */

.content-section {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 6px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-md);
}

.content-section h2 {
    color: var(--text-heading);
    margin-bottom: 20px;
}

.form-card {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 6px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-md);
}

.form-card h3 {
    color: var(--text-heading);
    margin-bottom: 20px;
}

/* =========================================================
   ТАБЛИЦЫ
   ========================================================= */

.data-table,
.gradebook-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: var(--bg-card);
}

.data-table th,
.data-table td,
.gradebook-table th,
.gradebook-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}

.data-table th,
.gradebook-table th {
    background: var(--primary);
    color: #ffffff;
    font-weight: 600;
}

.data-table tr:hover,
.gradebook-table tr:hover {
    background: var(--bg-hover);
}

.gradebook-container {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 6px;
    box-shadow: var(--shadow-md);
    overflow-x: auto;
}

/* =========================================================
   БЕЙДЖИ
   ========================================================= */

.badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    display: inline-block;
}

.badge-success { background: var(--success); color: #ffffff; }
.badge-warning { background: var(--warning); color: #000000; }
.badge-danger { background: var(--danger); color: #ffffff; }
.badge-info { background: var(--info); color: #ffffff; }

/* =========================================================
   КАРТОЧКИ
   ========================================================= */

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.card {
    background: var(--bg-card);
    padding: 25px;
    border-radius: 7px;
    border-left: 4px solid var(--primary);
    transition: transform 0.3s;
    box-shadow: var(--shadow-md);
}

.card h3 {
    color: var(--text-heading);
    margin-bottom: 10px;
}

.card p {
    color: var(--text-muted);
    margin-bottom: 15px;
    line-height: 1.5;
}

.card-meta {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 15px;
    color: var(--text-muted);
    font-size: 0.9em;
}

/* =========================================================
   ТАБЫ
   ========================================================= */

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 12px 25px;
    background: var(--bg-card);
    border: 2px solid var(--primary);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-heading);
    transition: all 0.3s;
}

.tab-btn.active {
    background: var(--primary);
    color: #ffffff;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* =========================================================
   ВОПРОСЫ И ЗАДАЧИ
   ========================================================= */

.question-block,
.practical-block {
    background: var(--bg-hover);
    padding: 20px;
    border-radius: 7px;
    margin-bottom: 20px;
    border-left: 4px solid var(--primary);
}

.question-header,
.practical-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.question-points {
    color: var(--text-heading);
    font-weight: 600;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option-label {
    display: flex;
    align-items: flex-start;
    padding: 12px;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.option-label:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
}

.option-label input {
    margin-right: 12px;
    margin-top: 4px;
}

.option-label span { flex: 1; }

/* =========================================================
   РЕДАКТОР КОДА
   ========================================================= */

.code-editor {
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 0.95em;
    line-height: 1.5;
    background: #1f2933;
    color: #f8f8f2;
    padding: 15px;
    border-radius: 6px;
}

/* =========================================================
   НАВИГАЦИЯ ПО ШАГАМ
   ========================================================= */

.step-navigation {
    display: flex;
    gap: 15px;
    justify-content: space-between;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}

.submit-section {
    text-align: center;
    margin: 30px 0;
}

/* =========================================================
   ПРОГРЕСС И ТАЙМЕРЫ
   ========================================================= */

.progress-info {
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.progress-bar {
    flex: 1;
    height: 10px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-hover);
    width: 0%;
    transition: width 0.3s;
}

.question-timer,
.task-timer {
    background: var(--primary);
    color: #ffffff;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: bold;
    display: inline-block;
}

.timer-warning {
    background: var(--warning) !important;
    color: #000000 !important;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* =========================================================
   РЕЗУЛЬТАТЫ
   ========================================================= */

.result-card {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 6px;
    box-shadow: var(--shadow-md);
    text-align: center;
    border-left: 10px solid var(--primary);
}

.result-card.success { border-left-color: var(--success); }
.result-card.warning { border-left-color: var(--warning); }
.result-card.error { border-left-color: var(--danger); }

.result-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.result-item {
    background: var(--bg-hover);
    padding: 20px;
    border-radius: 7px;
}

.result-item .label {
    display: block;
    color: var(--text-muted);
    margin-bottom: 10px;
    font-size: 0.9em;
}

.result-item .value {
    display: block;
    font-size: 2em;
    font-weight: bold;
    color: var(--text-heading);
}

.result-date {
    color: var(--text-muted);
    margin-top: 20px;
}

.average-grade {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 7px;
    margin-top: 30px;
    text-align: center;
    box-shadow: var(--shadow-md);
}

/* =========================================================
   ПУСТЫЕ СОСТОЯНИЯ
   ========================================================= */

.empty-state {
    text-align: center;
    color: var(--text-faint);
    padding: 40px;
    font-size: 1.1em;
}

/* =========================================================
   ФУТЕР
   ========================================================= */

footer {
    text-align: center;
    padding: 30px;
    color: var(--text-faint);
    margin-top: 50px;
}

footer a { color: var(--accent); }

/* =========================================================
   СТРАНИЦЫ ОШИБОК
   ========================================================= */

.error-page {
    min-height: 100vh;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.error-content {
    background: var(--bg-card);
    padding: 60px 40px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    max-width: 600px;
    animation: errorIn 0.6s ease-out;
}

@keyframes errorIn {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.error-graphic { margin-bottom: 30px; }

.error-page h1 {
    font-size: 6em;
    color: var(--text-heading);
    margin-bottom: 10px;
    font-weight: bold;
}

.error-page h2 {
    color: var(--text-main);
    margin-bottom: 15px;
    font-size: 1.8em;
}

.error-page p {
    color: var(--text-muted);
    font-size: 1.1em;
    line-height: 1.6;
    margin-bottom: 30px;
}

.error-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Призрак */
.ghost {
    width: 120px;
    height: 140px;
    background: var(--bg-hover);
    border-radius: 60px 60px 0 0;
    margin: 0 auto;
    position: relative;
    animation: ghostFloat 3s ease-in-out infinite;
}

@keyframes ghostFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.ghost-face { position: relative; top: 40px; }

.ghost-eye {
    width: 15px;
    height: 15px;
    background: var(--text-heading);
    border-radius: 50%;
    position: absolute;
    animation: ghostBlink 4s infinite;
}

.ghost-eye.left { left: 35px; }
.ghost-eye.right { right: 35px; }

@keyframes ghostBlink {
    0%, 96%, 100% { height: 15px; }
    98% { height: 2px; }
}

.ghost-mouth {
    width: 20px;
    height: 10px;
    background: var(--text-heading);
    border-radius: 0 0 20px 20px;
    position: absolute;
    top: 40px;
    left: 50px;
}

.ghost-shadow {
    width: 80px;
    height: 10px;
    background: rgba(20, 35, 50, 0.10);
    border-radius: 50%;
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    animation: shadowScale 3s ease-in-out infinite;
}

@keyframes shadowScale {
    0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.1; }
    50% { transform: translateX(-50%) scale(0.8); opacity: 0.05; }
}

/* Робот */
.robot {
    width: 120px;
    height: 140px;
    margin: 0 auto;
    position: relative;
}

.robot-head {
    width: 80px;
    height: 70px;
    background: var(--primary);
    border-radius: 6px;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    animation: robotHeadShake 2s ease-in-out infinite;
}

@keyframes robotHeadShake {
    0%, 100% { transform: translateX(-50%) rotate(0); }
    25% { transform: translateX(-50%) rotate(-5deg); }
    75% { transform: translateX(-50%) rotate(5deg); }
}

.robot-eye {
    width: 20px;
    height: 20px;
    background: #ffffff;
    border-radius: 50%;
    position: absolute;
    top: 25px;
    animation: robotEyeBlink 3s infinite;
}

.robot-eye.left { left: 15px; }
.robot-eye.right { right: 15px; }

@keyframes robotEyeBlink {
    0%, 96%, 100% { height: 20px; }
    98% { height: 2px; }
}

.robot-antenna {
    width: 4px;
    height: 20px;
    background: var(--primary);
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
}

.robot-antenna:after {
    content: '';
    width: 10px;
    height: 10px;
    background: var(--danger);
    border-radius: 50%;
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    animation: antennaBlink 1s infinite;
}

@keyframes antennaBlink {
    0%, 50%, 100% { opacity: 1; }
    25%, 75% { opacity: 0.3; }
}

.robot-body {
    width: 60px;
    height: 50px;
    background: var(--primary-hover);
    border-radius: 7px;
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
}

.robot-warning {
    font-size: 2em;
    color: #ffffff;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* =========================================================
   ЗАГРУЗЧИК СТРАНИЦЫ
   ========================================================= */

.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.5s;
}

[data-theme="dark"] .page-loader {
    background: rgba(18, 20, 31, 0.95);
}

.loader-content { text-align: center; }

.loader-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loader-text {
    color: var(--text-heading);
    font-size: 1.2em;
    font-weight: 600;
    margin-bottom: 15px;
}

.loader-progress {
    width: 200px;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
    margin: 0 auto;
}

.loader-progress-bar {
    height: 100%;
    background: var(--primary-hover);
    width: 0%;
    animation: loaderProgress 2s ease-in-out infinite;
}

@keyframes loaderProgress {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

/* =========================================================
   БАННЕРЫ
   ========================================================= */

.banners-container-page { margin-bottom: 20px; }

.banner-page {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    border-radius: 7px;
    margin-bottom: 15px;
    animation: bannerSlideDown 0.3s ease-out;
}

@keyframes bannerSlideDown {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.banner-page-info {
    background: var(--info-bg);
    color: var(--info);
    border-left: 4px solid var(--info);
}

.banner-page-success {
    background: var(--success-bg);
    color: var(--success);
    border-left: 4px solid var(--success);
}

.banner-page-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border-left: 4px solid var(--warning);
}

.banner-page-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border-left: 4px solid var(--danger);
}

.banner-page .banner-content { flex: 1; }

.banner-page .banner-content strong {
    display: block;
    margin-bottom: 5px;
}

.banner-page .banner-close {
    background: rgba(128, 128, 128, 0.10);
    border: none;
    color: inherit;
    font-size: 1.5em;
    cursor: pointer;
    padding: 0 10px;
    border-radius: 4px;
    transition: background 0.3s;
}

.banner-page .banner-close:hover {
    background: rgba(128, 128, 128, 0.20);
}

/* =========================================================
   УВЕДОМЛЕНИЯ
   ========================================================= */

.nav-notification {
    position: relative;
    font-size: 1.5em;
    text-decoration: none;
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -10px;
    background: var(--danger);
    color: #ffffff;
    font-size: 0.7em;
    padding: 2px 6px;
    border-radius: 7px;
    min-width: 18px;
    text-align: center;
}

.notification-item {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 7px;
    margin-bottom: 15px;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--primary);
}

.notification-unread {
    border-left-color: var(--warning);
    background: var(--warning-bg);
}

.notification-read {
    background: var(--bg-hover);
    border-left-color: var(--border-color);
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.notifications-widget {
    max-height: 400px;
    overflow-y: auto;
}

.notifications-widget .notification-item {
    padding: 15px;
    transition: transform 0.2s;
}

.notifications-widget .notification-item:hover {
    transform: translateX(5px);
}

/* =========================================================
   САЙДБАР
   ========================================================= */

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    height: 100vh;
    z-index: 5000;
    display: flex;
    flex-direction: column;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    border-right: 1px solid rgba(0, 0, 0, 0.15);
    box-shadow: 3px 0 18px rgba(20, 35, 50, 0.12);
    overflow: hidden;
    transition: width var(--sidebar-transition), transform var(--sidebar-transition);
}

.sidebar-header {
    min-height: 72px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

.sidebar-brand {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #ffffff;
    text-decoration: none;
    font-size: 1.08rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-brand-icon {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: grid;
    place-items: center;
    background: var(--sidebar-active-bg);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 6px;
    font-size: 1.15rem;
}

.sidebar-brand-text {
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-collapse {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 5px;
    background: transparent;
    color: #ffffff;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    transition: background var(--sidebar-transition), border-color var(--sidebar-transition);
}

.sidebar-collapse:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.22);
}

.sidebar-user {
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 11px;
    border-bottom: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

.sidebar-user-avatar {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--sidebar-active-bg);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.9rem;
}

.sidebar-user-info {
    min-width: 0;
    overflow: hidden;
}

.sidebar-user-name {
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    margin-top: 3px;
    color: var(--sidebar-muted);
    font-size: 0.76rem;
    white-space: nowrap;
}

.sidebar-nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.sidebar-section-title {
    padding: 12px 10px 7px;
    color: var(--sidebar-muted);
    border-top: 1px solid var(--sidebar-border);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    
}

.sidebar-link {
    position: relative;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 2px 0;
    padding: 9px 10px;
    border-radius: 5px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    white-space: nowrap;
    transition: background var(--sidebar-transition), color var(--sidebar-transition);
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #ffffff;
}

.sidebar-link.active,
.sidebar-link[aria-current="page"] {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active);
}

.sidebar-link-icon {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    display: grid;
    place-items: center;
    font-size: 1.05rem;
}

.sidebar-link-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-badge {
    margin-left: auto;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--danger);
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
}

.sidebar-footer {
    flex-shrink: 0;
    padding: 10px;
    border-top: 1px solid var(--sidebar-border);
}

.sidebar-footer .sidebar-link { margin: 2px 0; }

.sidebar .nav-notification {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    font-size: inherit;
}

.sidebar .notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: var(--danger);
    color: #ffffff;
    font-size: 0.62rem;
    line-height: 1;
}

/* =========================================================
   МИНИ-САЙДБАР
   ========================================================= */

body.sidebar-is-mini .sidebar {
    width: var(--sidebar-mini-width);
}

body.sidebar-is-mini .sidebar-header {
    padding: 0 10px;
    justify-content: center;
}

body.sidebar-is-mini .sidebar .brand-text,
body.sidebar-is-mini .sidebar .sidebar-user-info,
body.sidebar-is-mini .sidebar .sidebar-section-title,
body.sidebar-is-mini .sidebar .sidebar-text {
    display: none !important;
}

body.sidebar-is-mini .sidebar .sidebar-brand {
    justify-content: center;
}

body.sidebar-is-mini .sidebar .brand-icon {
    display: flex;
    margin: 0;
}

body.sidebar-is-mini .sidebar .sidebar-collapse {
    display: grid;
    place-items: center;
}

body.sidebar-is-mini .sidebar .sidebar-user {
    justify-content: center;
    padding: 14px 10px;
}

body.sidebar-is-mini .sidebar .sidebar-user-icon { margin: 0; }

body.sidebar-is-mini .sidebar .sidebar-nav {
    padding-left: 8px;
    padding-right: 8px;
}

body.sidebar-is-mini .sidebar .sidebar-link {
    justify-content: center;
    padding-left: 8px;
    padding-right: 8px;
    position: relative;
}

body.sidebar-is-mini .sidebar .sidebar-icon { margin: 0; }

body.sidebar-is-mini .sidebar .sidebar-notification {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    font-size: 0.6rem;
}

body.sidebar-is-mini .sidebar .sidebar-link[title] {
    cursor: pointer;
}

/* =========================================================
   КНОПКА ПЕРЕКЛЮЧЕНИЯ ТЕМЫ
   ========================================================= */

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    padding: 8px;
    border-radius: 8px;
    color: var(--text-main);
    transition: transform 0.2s, background 0.2s;
}

.theme-toggle:hover {
    background: var(--bg-hover);
    transform: scale(1.1);
}


.emoji-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.emoji-btn:hover {
    background: var(--bg-hover);
}

/* =========================================================
   МОБИЛЬНАЯ ВЕРСИЯ
   ========================================================= */

.sidebar-toggle {
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 4900;
    width: 44px;
    height: 44px;
    display: none;
    place-items: center;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-heading);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    font-size: 1.35rem;
}

.sidebar-toggle:hover { background: var(--bg-hover); }

.sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 4800;
    display: none;
    background: rgba(10, 25, 45, 0.48);
}

body.sidebar-open { overflow: hidden; }

@media (max-width: 768px) {
    body,
    body.sidebar-is-mini {
        padding-left: 0;
    }

    body > .container {
        max-width: 1200px;
        padding-top: 72px;
    }

    .sidebar-toggle { display: grid; }

    .sidebar-overlay {
        display: block;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity var(--sidebar-transition), visibility var(--sidebar-transition);
    }

    .sidebar {
        width: min(86vw, 300px);
        max-width: 300px;
        transform: translateX(-105%);
        box-shadow: 8px 0 28px rgba(20, 35, 50, 0.22);
    }

    body.sidebar-open .sidebar { transform: translateX(0); }

    body.sidebar-open .sidebar-overlay {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    body.sidebar-is-mini .sidebar {
        width: min(86vw, 300px);
    }

    body.sidebar-is-mini .sidebar-brand-text,
    body.sidebar-is-mini .sidebar-user-info,
    body.sidebar-is-mini .sidebar-section-title,
    body.sidebar-is-mini .sidebar-link-text {
        display: block;
    }

    body.sidebar-is-mini .sidebar-brand { display: flex; }

    body.sidebar-is-mini .sidebar-header {
        padding: 0 16px;
        justify-content: space-between;
    }

    body.sidebar-is-mini .sidebar-user {
        justify-content: flex-start;
        padding: 16px;
    }

    body.sidebar-is-mini .sidebar-link {
        justify-content: flex-start;
        padding: 9px 10px;
    }

    body.sidebar-is-mini .sidebar-badge {
        position: static;
        min-width: 20px;
        height: 20px;
        padding: 0 6px;
        font-size: 0.68rem;
    }

    body.sidebar-is-mini .sidebar-footer .sidebar-link {
        justify-content: flex-start;
    }

    .sidebar-collapse { display: none !important; }

    .flash-container {
        top: 70px;
        left: 15px;
        right;