/* ===================================
   Vooca Web - Основные стили
   Стиль: Киберпанк/Неон
   =================================== */

/* Тема по умолчанию (Киберпанк) */
:root {
    /* Цветовая палитра */
    --bg-dark: #0a0e1a;
    --bg-panel: #1a1f3a;
    --bg-panel-light: #252b4d;
    --primary: #00f0ff;
    --primary-dark: #00c0cc;
    --secondary: #ff00ff;
    --secondary-dark: #cc00cc;
    --accent: #ffcc00;
    --success: #00ff88;
    --chart-issued: #ffaa00;
    --chart-repaid: #4da3ff;
    --danger: #ff4444;
    --warning: #ffaa00;
    --text: #ffffff;
    --text-muted: #8892b0;
    --border: #2d3561;
    --border-glow: #00f0ff;

    /* Размеры */
    --sidebar-width: 280px;
    --header-height: 60px;
    --border-radius: 8px;
    --border-radius-lg: 12px;

    /* Тени и свечение */
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
    --glow: none;
    --glow-secondary: none;

    /* Тематические слои (фон SVG + декор) */
    --theme-main-gradient-end: #12182e;
    --theme-art-opacity: 0.22;
    --theme-art-bg-size: 380px 380px;
    --theme-art-blend: soft-light;
    --sidebar-art-top: 168px;
    --theme-sidebar-opacity: 0.42;
    --theme-sidebar-art-size: cover;
    --theme-sidebar-blend: normal;
    --theme-sidebar-bg: url("../images/sidebar/cyberpunk.jpg");
    --theme-stat-water-opacity: 0.09;
    --theme-art-bg: url("../images/themes/cyberpunk-bg.svg");
}

/* Светлая тема */
body[data-theme="light"] {
    --bg-dark: #f5f7fa;
    --bg-panel: #ffffff;
    --bg-panel-light: #f0f2f5;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #7c3aed;
    --secondary-dark: #6d28d9;
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --text: #1f2937;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --border-glow: #2563eb;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.15);
    --glow: none;
    --glow-secondary: none;
    --theme-main-gradient-end: #e8ecf4;
    --theme-art-opacity: 0.1;
    --theme-art-bg-size: 420px 420px;
    --theme-art-blend: multiply;
    --theme-sidebar-opacity: 0.35;
    --theme-sidebar-art-size: cover;
    --theme-sidebar-bg: url("../images/sidebar/light.jpg");
    --theme-stat-water-opacity: 0.05;
    --theme-art-bg: url("../images/themes/light-bg.svg");
}

/* Тёмная тема */
body[data-theme="dark"] {
    --bg-dark: #1a1a2e;
    --bg-panel: #16213e;
    --bg-panel-light: #1f2b4d;
    --primary: #4a9eff;
    --primary-dark: #3a8eef;
    --secondary: #a855f7;
    --secondary-dark: #9333ea;
    --accent: #fbbf24;
    --success: #34d399;
    --danger: #f87171;
    --warning: #fbbf24;
    --text: #e5e7eb;
    --text-muted: #9ca3af;
    --border: #2d3748;
    --border-glow: #4a9eff;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
    --glow: none;
    --glow-secondary: none;
    --theme-main-gradient-end: #141828;
    --theme-art-opacity: 0.18;
    --theme-art-bg-size: 400px 400px;
    --theme-art-blend: screen;
    --theme-sidebar-opacity: 0.38;
    --theme-sidebar-bg: url("../images/sidebar/dark.jpg");
    --theme-stat-water-opacity: 0.08;
    --theme-art-bg: url("../images/themes/dark-bg.svg");
}

/* Тема Сёдзё (аниме) */
body[data-theme="shojo"] {
    --bg-dark: #fff0f5;
    --bg-panel: #ffe4e9;
    --bg-panel-light: #ffd6e0;
    --primary: #ff69b4;
    --primary-dark: #ff1493;
    --secondary: #dda0dd;
    --secondary-dark: #ba55d3;
    --accent: #ffb6c1;
    --success: #00a86b;
    --danger: #dc143c;
    --warning: #ff8c00;
    --text: #4a4a4a;
    --text-muted: #6b6b6b;
    --border: #ffb6c1;
    --border-glow: #ff69b4;
    --shadow: 0 4px 8px rgba(255, 105, 180, 0.2);
    --shadow-lg: 0 8px 16px rgba(255, 105, 180, 0.3);
    --glow: none;
    --glow-secondary: none;
    --theme-main-gradient-end: #fff8fb;
    --theme-art-opacity: 0.14;
    --theme-art-bg-size: 360px 360px;
    --theme-art-blend: multiply;
    --theme-sidebar-opacity: 0.34;
    --theme-sidebar-bg: url("../images/sidebar/shojo.jpg");
    --theme-stat-water-opacity: 0.06;
    --theme-art-bg: url("../images/themes/shojo-bg.svg");
}

/* Тема Grayscale (Оттенки серого) */
body[data-theme="grayscale"] {
    --bg-dark: #1a1a1a;
    --bg-panel: #2a2a2a;
    --bg-panel-light: #3a3a3a;
    --primary: #808080;
    --primary-dark: #606060;
    --secondary: #a0a0a0;
    --secondary-dark: #707070;
    --accent: #c0c0c0;
    --success: #606060;
    --chart-issued: #e0e0e0;
    --chart-repaid: #9a9a9a;
    --danger: #505050;
    --warning: #909090;
    --text: #d0d0d0;
    --text-muted: #808080;
    --border: #404040;
    --border-glow: #808080;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 20px rgba(0, 0, 0, 0.6);
    --glow: none;
    --glow-secondary: none;
    --theme-main-gradient-end: #222;
    --theme-art-opacity: 0.2;
    --theme-art-bg-size: 320px 320px;
    --theme-art-blend: overlay;
    --theme-sidebar-opacity: 0.4;
    --theme-sidebar-bg: url("../images/sidebar/grayscale.jpg");
    --theme-stat-water-opacity: 0.1;
    --theme-art-bg: url("../images/themes/grayscale-bg.svg");
}

/* Тема Милитари */
body[data-theme="military"] {
    --bg-dark: #1a1a1a;
    --bg-panel: #2a2a2a;
    --bg-panel-light: #3a3a3a;
    --primary: #6b8e23;
    --primary-dark: #556b2f;
    --secondary: #a0825a;
    --secondary-dark: #8b7355;
    --accent: #daa520;
    --success: #6b8e23;
    --danger: #dc143c;
    --warning: #daa520;
    --text: #f0f0f0;
    --text-muted: #c0c0c0;
    --border: #555555;
    --border-glow: #6b8e23;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 20px rgba(0, 0, 0, 0.6);
    --glow: none;
    --glow-secondary: none;
    --theme-main-gradient-end: #1a1e14;
    --theme-art-opacity: 0.2;
    --theme-art-bg-size: 440px 440px;
    --theme-art-blend: multiply;
    --theme-sidebar-opacity: 0.4;
    --theme-sidebar-bg: url("../images/sidebar/military.jpg");
    --theme-stat-water-opacity: 0.09;
    --theme-art-bg: url("../images/themes/military-bg.svg");
}

/* Тема Стимпанк */
body[data-theme="steampunk"] {
    --bg-dark: #2c1810;
    --bg-panel: #3d2317;
    --bg-panel-light: #4a2f1f;
    --primary: #cd7f32;
    --primary-dark: #b8702a;
    --secondary: #8b4513;
    --secondary-dark: #6b3410;
    --accent: #ffd700;
    --success: #228b22;
    --danger: #8b0000;
    --warning: #daa520;
    --text: #f5deb3;
    --text-muted: #b8a082;
    --border: #8b4513;
    --border-glow: #cd7f32;
    --shadow: 0 4px 8px rgba(139, 69, 19, 0.4);
    --shadow-lg: 0 8px 20px rgba(139, 69, 19, 0.5);
    --glow: none;
    --glow-secondary: none;
    --theme-main-gradient-end: #1f120c;
    --theme-art-opacity: 0.2;
    --theme-art-bg-size: 400px 400px;
    --theme-art-blend: soft-light;
    --theme-sidebar-opacity: 0.4;
    --theme-sidebar-bg: url("../images/sidebar/steampunk.jpg");
    --theme-stat-water-opacity: 0.09;
    --theme-art-bg: url("../images/themes/steampunk-bg.svg");
}

/* Тема Матрица */
body[data-theme="matrix"] {
    --bg-dark: #000000;
    --bg-panel: #0a0a0a;
    --bg-panel-light: #0f0f0f;
    --primary: #00ff00;
    --primary-dark: #00cc00;
    --secondary: #008800;
    --secondary-dark: #006600;
    --accent: #00ff00;
    --success: #00ff00;
    --chart-issued: #ffff66;
    --chart-repaid: #33bbff;
    --danger: #ff0000;
    --warning: #ffff00;
    --text: #00ff00;
    --text-muted: #008800;
    --border: #003300;
    --border-glow: #00ff00;
    --shadow: 0 0 10px rgba(0, 255, 0, 0.3);
    --shadow-lg: 0 0 20px rgba(0, 255, 0, 0.5);
    --glow: none;
    --glow-secondary: none;
    --theme-main-gradient-end: #020802;
    --theme-art-opacity: 0.28;
    --theme-art-bg-size: 340px 340px;
    --theme-art-blend: screen;
    --theme-sidebar-opacity: 0.42;
    --theme-sidebar-bg: url("../images/sidebar/matrix.jpg");
    --theme-stat-water-opacity: 0.12;
    --theme-art-bg: url("../images/themes/matrix-bg.svg");
}

/* Тема Вуду */
body[data-theme="voodoo"] {
    --bg-dark: #1a0a0a;
    --bg-panel: #2d1010;
    --bg-panel-light: #3d1515;
    --primary: #ff4500;
    --primary-dark: #cc3700;
    --secondary: #8b0000;
    --secondary-dark: #660000;
    --accent: #ffd700;
    --success: #228b22;
    --danger: #dc143c;
    --warning: #ff8c00;
    --text: #f5ebe5;
    --text-muted: #a08078;
    --border: #4a2828;
    --border-glow: #ff4500;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 20px rgba(0, 0, 0, 0.6);
    --glow: none;
    --glow-secondary: none;
    --theme-main-gradient-end: #120808;
    --theme-art-opacity: 0.22;
    --theme-art-bg-size: 400px 400px;
    --theme-art-blend: soft-light;
    --theme-sidebar-opacity: 0.4;
    --theme-sidebar-bg: url("../images/sidebar/voodoo.png");
    --theme-stat-water-opacity: 0.09;
    --theme-art-bg: url("../images/themes/voodoo-bg.svg");
}

/* Тема Dota 2 */
body[data-theme="dota2"] {
    --bg-dark: #0d0d0f;
    --bg-panel: #1a1209;
    --bg-panel-light: #2a1a0a;
    --primary: #c82333;
    --primary-dark: #8b0000;
    --secondary: #b8860b;
    --secondary-dark: #8b6914;
    --accent: #ffd700;
    --success: #228b22;
    --danger: #c82333;
    --warning: #daa520;
    --text: #f5e6c8;
    --text-muted: #a08060;
    --border: #4a3020;
    --border-glow: #c82333;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.75);
    --glow: none;
    --glow-secondary: none;
    --theme-main-gradient-end: #0a0604;
    --theme-art-opacity: 0.26;
    --theme-art-bg-size: 420px 420px;
    --theme-art-blend: soft-light;
    --theme-sidebar-opacity: 0.4;
    --theme-sidebar-bg: url("../images/sidebar/dota2.jpg");
    --theme-stat-water-opacity: 0.1;
    --theme-art-bg: url("../images/themes/dota2-bg.svg");
}

/* Няшное аниме */
body[data-theme="anime"] {
    --theme-sidebar-bg: url("../images/sidebar/anime.png");
    --bg-dark: #1a1528;
    --bg-panel: #2d2640;
    --bg-panel-light: #3d3456;
    --primary: #ff9ecb;
    --primary-dark: #ff6bb3;
    --secondary: #b794f6;
    --secondary-dark: #9f7aea;
    --accent: #ffd93d;
    --success: #68d391;
    --danger: #fc8181;
    --warning: #f6ad55;
    --text: #fef3ff;
    --text-muted: #c4b5d8;
    --border: #5a4a78;
    --border-glow: #ff9ecb;
    --shadow: 0 4px 14px rgba(255, 158, 203, 0.15);
    --shadow-lg: 0 10px 28px rgba(183, 148, 246, 0.25);
    --glow: none;
    --glow-secondary: none;
    --theme-main-gradient-end: #120e1c;
    --theme-art-opacity: 0.2;
    --theme-art-bg-size: 400px 400px;
    --theme-art-blend: soft-light;
    --theme-sidebar-opacity: 0.42;
    --theme-sidebar-blend: normal;
    --theme-sidebar-art-size: cover;
    --theme-stat-water-opacity: 0.08;
    --theme-art-bg: url("../images/themes/anime-bg.svg");
}

/* Фон сайдбара: assets/images/sidebar/{theme}.jpg|.png */

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ===================================
   Тематические слои (SVG: assets/images/themes/)
   Оригинальные векторные паттерны; можно заменить файлы на свои (лицензия).
   =================================== */
#app-screen {
    position: relative;
    min-height: 100vh;
}

#app-screen::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -7;
    pointer-events: none;
    opacity: var(--theme-art-opacity, 0.16);
    background-image: var(--theme-art-bg, none);
    background-size: var(--theme-art-bg-size, 400px 400px);
    background-position: center top;
    background-repeat: repeat;
    mix-blend-mode: var(--theme-art-blend, normal);
}

/* Утилиты */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-primary { color: var(--primary); }
.text-secondary { color: var(--secondary); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }

/* ===================================
   Экраны
   =================================== */
.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: flex;
}

/* ===================================
   Авторизация
   =================================== */
#auth-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    width: 100%;
    background: linear-gradient(135deg, var(--bg-dark) 0%, #1a1025 100%);
}

.auth-container {
    background: var(--bg-panel);
    border: 2px solid var(--border);
    border-radius: var(--border-radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg), var(--glow);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header .logo {
    width: 80px;
    height: 80px;
    margin-bottom: 15px;
}

.auth-header .logo.auth-logo-cycle {
    cursor: pointer;
    transition: transform 0.15s ease, filter 0.15s ease;
}

.auth-header .logo.auth-logo-cycle:hover {
    transform: scale(1.06);
    filter: brightness(1.08);
}

.auth-header .logo.auth-logo-cycle:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 4px;
    border-radius: 8px;
}

.auth-header h1 {
    color: var(--primary);
    font-size: 2rem;
    margin-bottom: 5px;
    text-shadow: var(--glow);
}

.auth-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.auth-form .form-group {
    margin-bottom: 20px;
}

.auth-form .login-users-wrapper {
    margin-bottom: 20px;
}

.auth-form label {
    display: block;
    margin-bottom: 8px;
    color: var(--text);
    font-weight: 500;
}

.auth-form input,
.auth-form .btn-block {
    width: 100%;
    padding: 12px 15px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    color: var(--text);
    font-size: 1rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--glow);
}

.auth-form .btn-block {
    margin-bottom: 0;
    margin-left: 0;
    margin-right: 0;
    cursor: pointer;
}

.error-message {
    color: var(--danger);
    margin-top: 15px;
    text-align: center;
}

/* Список пользователей на экране авторизации */
.login-users-list {
    background: var(--bg-panel-light);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 10px;
    margin-bottom: 20px;
    max-height: 200px;
    overflow-y: auto;
}

.login-users-list .user-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    cursor: pointer;
    border-radius: var(--border-radius);
    transition: background 0.2s ease;
}

.login-users-list .user-item:hover {
    background: var(--bg-dark);
}

.login-users-list .user-icon {
    font-size: 1.2rem;
}

/* ===================================
   Кнопки
   =================================== */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    color: var(--text);
}

.btn-action {
    min-height: 50px;
    padding: 14px 20px;
}

.btn-primary {
    background: var(--primary);
    color: var(--bg-dark);
    border: 1px solid var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-secondary {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-panel-light);
    border-color: var(--primary);
}

.modal-footer .btn-ghost,
.modal .btn-ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.modal-footer .btn-ghost:hover,
.modal .btn-ghost:hover {
    background: var(--bg-panel-light);
    border-color: var(--primary);
    color: var(--text);
}

.data-table .btn-secondary.btn-sm {
    color: var(--text);
    border-color: var(--border);
}

.analytics-module-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 12px 0 20px;
}

.analytics-module-tabs .analytics-tab-btn {
    padding: 6px 12px;
    font-size: 0.875rem;
    border-radius: var(--border-radius, 8px);
    border: 1px solid var(--border);
    background: var(--bg-panel);
    color: var(--text);
    cursor: pointer;
}

.analytics-module-tabs .analytics-tab-btn.active {
    background: var(--primary);
    color: var(--bg-dark);
    border-color: var(--primary);
}

.gph-contract-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.gph-contract-editor {
    min-height: 420px;
    max-height: 55vh;
    overflow: auto;
    padding: 16px;
    border: 1px solid var(--border, #2d3a66);
    border-radius: 8px;
    background: #fff;
    color: #111;
    line-height: 1.55;
    font-family: Georgia, serif;
}

.gph-contract-editor:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.gph-contract-editor h1 { font-size: 1.25rem; text-align: center; }
.gph-contract-editor h2 { font-size: 1rem; margin-top: 1.2em; }

.btn-danger {
    background: var(--danger);
    color: #fff;
    border: 1px solid color-mix(in srgb, var(--danger) 80%, #000 20%);
}

.btn-danger:hover {
    filter: brightness(1.08);
    color: #fff;
}

.btn-danger,
.btn-danger.btn-sm {
    background: var(--danger);
    color: #fff !important;
    border-color: color-mix(in srgb, var(--danger) 80%, #000 20%);
}

.btn-primary,
.btn-primary.btn-sm {
    color: var(--bg-dark);
}

body[data-theme="light"] .btn-primary,
body[data-theme="anime"] .btn-primary {
    color: #111;
}

.btn-success {
    background: var(--success);
    color: #0d1a12;
    border: 1px solid color-mix(in srgb, var(--success) 70%, #000 30%);
}

.btn-block {
    width: 100%;
}

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

.btn-sm {
    padding: 8px 16px;
    font-size: 0.9rem;
    min-height: 36px;
}

/* ===================================
   Сайдбар
   =================================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-panel);
    border-right: 2px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: var(--sidebar-art-top, 168px);
    bottom: 0;
    z-index: 0;
    pointer-events: none;
    opacity: var(--theme-sidebar-opacity, 0.1);
    background-image: var(--theme-sidebar-bg, none);
    background-size: var(--theme-sidebar-art-size, cover);
    background-position: center bottom;
    background-repeat: no-repeat;
    mix-blend-mode: var(--theme-sidebar-blend, soft-light);
}

.sidebar-header.sidebar-header-modern {
    flex-shrink: 0;
    background: var(--bg-panel);
    position: relative;
    z-index: 3;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.sidebar > * {
    position: relative;
    z-index: 1;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
    color: var(--primary);
    font-size: 1.5rem;
    margin-bottom: 15px;
    text-shadow: var(--glow);
    display: flex;
    align-items: center;
    gap: 10px;
}

.version-badge {
    font-size: 0.7rem;
    background: var(--primary);
    color: var(--bg-dark);
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: bold;
    white-space: nowrap;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.user-info #user-login {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.user-info #user-name {
    font-weight: 600;
}

.role-badge {
    background: var(--secondary);
    color: var(--text);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    align-self: flex-start;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0 20px;
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--bg-panel) 0%, transparent) 0%,
        color-mix(in srgb, var(--bg-panel) 72%, transparent) 12%,
        color-mix(in srgb, var(--bg-panel) 80%, transparent) 100%
    );
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 2px 10px;
    padding: 11px 14px;
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    border-left: 3px solid transparent;
    background: color-mix(in srgb, var(--bg-panel) 42%, transparent);
}

.nav-item:hover {
    background: color-mix(in srgb, var(--bg-panel-light) 82%, transparent);
    color: var(--text);
}

.nav-item.active {
    background: color-mix(in srgb, var(--bg-panel-light) 90%, transparent);
    color: var(--primary);
    border-left-color: var(--primary);
}

.nav-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
}

/* Уведомления */
.notifications-wrap {
    margin-top: 10px;
}

#notifications-btn {
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
    position: relative;
    padding: 4px 8px;
    line-height: 1;
}

#notifications-badge {
    position: absolute;
    top: -2px;
    right: 0;
    background: var(--danger);
    color: #fff;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    font-size: 0.7rem;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-sizing: border-box;
}

#notifications-badge.is-visible {
    display: inline-flex;
}

#notifications-badge.is-pending-only {
    background: var(--warning);
    color: #111;
}

.notifications-badge-summary {
    margin: 0;
    padding: 8px 14px 10px;
    font-size: 0.82rem;
    line-height: 1.4;
    border-bottom: 1px solid var(--border);
}

.notifications-panel {
    position: fixed;
    z-index: 1200;
    display: none;
    flex-direction: column;
    width: min(360px, calc(100vw - 16px));
    max-height: min(420px, calc(100vh - 16px));
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
    overflow: hidden;
}

.notifications-panel.is-open {
    display: flex;
}

.notifications-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-panel);
    flex-shrink: 0;
}

.notifications-mark-all {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.8rem;
    text-align: right;
    line-height: 1.3;
    padding: 0;
    flex-shrink: 0;
    max-width: 52%;
}

.notifications-panel-list {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-panel);
    min-height: 80px;
}

.notifications-panel-footer {
    padding: 10px 12px;
    text-align: center;
    border-top: 1px solid var(--border);
    background: var(--bg-panel);
    flex-shrink: 0;
}

.notifications-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
}

.notification-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s ease;
    background: transparent;
}

.notification-item:hover {
    background: var(--bg-panel-light);
}

.notification-item.unread {
    background: var(--bg-dark);
}

/* ===================================
   Основной контент
   =================================== */
.main-content {
    position: relative;
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 30px;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--theme-main-gradient-end, var(--bg-panel)) 100%);
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page.page-is-loading {
    pointer-events: none;
    user-select: none;
}

/* ===================================
   Индикатор загрузки
   =================================== */
.app-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
}

.app-loader[hidden] {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.app-loader.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.app-loader--global {
    position: fixed;
    inset: 0;
    background: rgba(10, 14, 26, 0.72);
    backdrop-filter: blur(4px);
}

.app-loader--page {
    position: absolute;
    inset: 0;
    min-height: 200px;
    background: rgba(10, 14, 26, 0.55);
    backdrop-filter: blur(2px);
    border-radius: var(--border-radius, 8px);
}

.app-loader--auth {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(10, 14, 26, 0.8);
    backdrop-filter: blur(6px);
}

body.app-loading-global .main-content,
body.app-loading-global .sidebar {
    pointer-events: none;
}

.app-loader__card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 22px 28px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
    max-width: min(90vw, 320px);
}

.app-loader__spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(0, 240, 255, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: app-loader-spin 0.85s linear infinite;
}

.app-loader__text {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.35;
}

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

.page h1 {
    position: relative;
    display: block;
    width: 100%;
    color: var(--primary);
    font-size: 2rem;
    line-height: 1.3;
    margin: 0 0 28px 0;
    padding: 0 12px 26px 14px;
    text-shadow: var(--glow);
}

.page h1::before {
    content: "";
    position: absolute;
    left: -4px;
    top: 0;
    width: 6px;
    height: 1.1em;
    border-radius: 3px;
    background: linear-gradient(180deg, var(--primary), var(--secondary));
    opacity: 0.85;
}

.page h1::after {
    content: "";
    position: absolute;
    left: 0;
    right: 28%;
    bottom: 8px;
    height: 3px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--primary), var(--secondary), transparent);
    opacity: 0.75;
    pointer-events: none;
}

/* ===================================
   Формы
   =================================== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text);
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

.form-group input[type="checkbox"],
.form-group input[type="radio"] {
    width: auto;
    padding: 0;
}

.form-option-card {
    margin-bottom: 20px;
}

.form-group.form-option-card > .form-option-card__label {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 0;
    padding: 14px 16px;
    background: var(--bg-dark);
    border: 2px solid var(--border);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.form-group.form-option-card > .form-option-card__label:hover {
    border-color: var(--primary);
}

.form-option-card--warning .form-group.form-option-card > .form-option-card__label:has(input:checked) {
    border-color: var(--danger, #ff5c5c);
    background: rgba(255, 92, 92, 0.1);
    box-shadow: 0 0 0 1px rgba(255, 92, 92, 0.25);
}

.form-group.form-option-card > .form-option-card__label:has(input:disabled) {
    opacity: 0.72;
    cursor: not-allowed;
}

.form-option-card__checkbox {
    width: 24px !important;
    height: 24px !important;
    min-width: 24px;
    margin-top: 2px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}

.form-option-card__content {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    flex: 1;
}

.form-option-card__title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text);
    line-height: 1.35;
}

.form-option-card__hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--glow);
}

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

/* ===================================
   Dashboard
   =================================== */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.stat-card {
    position: relative;
    overflow: hidden;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.stat-card::after {
    content: "";
    position: absolute;
    right: -30%;
    top: -40%;
    width: 70%;
    height: 100%;
    background-image: var(--theme-art-bg, none);
    background-size: cover;
    background-position: center;
    opacity: var(--theme-stat-water-opacity, 0.07);
    pointer-events: none;
    transform: rotate(-8deg);
    mix-blend-mode: var(--theme-art-blend, normal);
}

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

.stat-card h3 {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    text-shadow: var(--glow);
    position: relative;
    z-index: 1;
}

.chart-container {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    margin-top: 20px;
    margin-bottom: 30px;
    max-width: 100%;
}

.chart-container.large {
    height: 420px;
    min-height: 420px;
    display: flex;
    flex-direction: column;
}

.chart-container h3 {
    color: var(--text);
    margin-bottom: 8px;
    text-align: center;
}

.chart-container-subtitle {
    text-align: center;
    font-size: 0.85rem;
    margin: 0 0 16px;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.chart-wrapper {
    background: var(--bg-dark);
    border-radius: var(--border-radius);
    padding: 15px;
    height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.chart-wrapper canvas {
    max-width: 100%;
    max-height: 200px;
}

.chart-container.large canvas {
    flex: 1;
    min-height: 300px;
    max-width: 100%;
    max-height: none;
    height: auto !important;
}

/* ===================================
   Форма смены
   =================================== */
.shift-form {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-lg);
    padding: 30px;
}

.shift-header {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.toggle-group {
    display: flex;
    gap: 15px;
}

.toggle-group input[type="radio"] {
    display: none;
}

.toggle-group label {
    padding: 10px 20px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-group input[type="radio"]:checked + label {
    background: var(--primary);
    color: var(--bg-dark);
    border-color: var(--primary);
    box-shadow: var(--glow);
}

.shift-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.shift-section {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 20px;
}

.shift-section h3 {
    color: var(--primary);
    margin-bottom: 15px;
    font-size: 1.1rem;
}

/* Номиналы купюр */
.cash-denominations {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.denomination-row {
    display: grid;
    grid-template-columns: 60px 1fr auto;
    gap: 10px;
    align-items: center;
}

.denomination-row label,
.denomination-row .denom-label {
    color: var(--text-muted);
    font-weight: 600;
}

.denomination-row input {
    padding: 8px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    color: var(--text);
    text-align: right;
    min-width: 0;
}

.denom-total {
    text-align: right;
    color: var(--text-muted);
    font-size: 0.9rem;
    white-space: nowrap;
    min-width: 80px;
}

.cash-total {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid var(--border);
    text-align: right;
    font-size: 1.2rem;
}

.cash-total strong {
    color: var(--success);
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

/* Превью зарплаты */
.salary-preview {
    text-align: center;
}

.salary-display {
    margin-bottom: 15px;
    padding: 15px;
    background: var(--bg-panel);
    border-radius: var(--border-radius);
}

.salary-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.salary-amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
}

/* --- Форма смены v2 (три колонки, как в десктопе) --- */
.shift-form-v2 {
    padding: 24px 28px 28px;
}

.shift-form-v2 .shift-topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 16px 24px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

#page-shift > h1 {
    margin-bottom: 24px;
}

.shift-form-v2 .shift-page-title {
    position: relative;
    display: block;
    width: 100%;
    margin: 0 0 20px 0;
    padding: 0 12px 16px 14px;
    font-size: 2rem;
    line-height: 1.25;
    font-weight: 700;
    color: var(--primary);
    text-shadow: var(--glow);
}

.shift-form-v2 .shift-page-title::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.1em;
    width: 6px;
    height: 1.1em;
    border-radius: 3px;
    background: linear-gradient(180deg, var(--primary), var(--secondary));
    opacity: 0.85;
}

.shift-form-v2 .shift-page-title::after {
    content: "";
    position: absolute;
    left: 0;
    right: 28%;
    bottom: 4px;
    height: 3px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--primary), var(--secondary), transparent);
    opacity: 0.75;
}

.shift-form-v2 .shift-header-fields {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px 24px;
    width: 100%;
}

.shift-form-v2 .shift-type-field .field-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.shift-form-v2 .shift-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    align-items: stretch;
}

.shift-form-v2 .shift-section {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.shift-form-v2 .shift-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 16px 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--primary);
}

.shift-form-v2 .shift-section-ico {
    font-size: 1.25rem;
    line-height: 1;
}

.shift-form-v2 .shift-section-cash .cash-total-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 2px solid var(--border);
    text-align: right;
    font-size: 1.1rem;
}

.shift-form-v2 .shift-section-cash .cash-total-footer strong {
    color: var(--success);
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.35);
}

.shift-form-v2 .shift-section-mixed textarea {
    width: 100%;
    min-height: 72px;
    padding: 10px 12px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
}

.shift-form-v2 .shift-revenue-hint {
    margin-top: auto;
    padding-top: 14px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.shift-form-v2 .shift-revenue-hint span {
    color: var(--text);
    font-weight: 600;
}

.shift-form-v2 .shift-salary-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.shift-form-v2 .shift-salary-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 14px 16px;
    text-align: center;
    box-shadow: inset 0 0 0 1px rgba(0, 240, 255, 0.06);
}

.shift-form-v2 .shift-salary-card-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    letter-spacing: 0.02em;
}

.shift-form-v2 .shift-salary-card-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.2;
}

.shift-form-v2 .shift-footer-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid var(--border);
}

.shift-form-v2 .shift-footer-actions .btn-primary {
    min-width: 180px;
}

.shift-form-v2 .btn-ghost {
    background: transparent;
    border: 1px dashed var(--border);
    color: var(--text-muted);
    margin-left: auto;
}

.shift-form-v2 .btn-ghost:hover {
    color: var(--text);
    border-color: var(--text-muted);
}

@media (max-width: 1100px) {
    .shift-form-v2 .shift-grid-3 {
        grid-template-columns: 1fr;
    }

    .shift-form-v2 .btn-ghost {
        margin-left: 0;
        width: 100%;
    }
}

@media (max-width: 600px) {
    .shift-form-v2 .shift-header-fields {
        flex-direction: column;
        align-items: stretch;
    }

    .shift-form-v2 .toggle-group {
        width: 100%;
        justify-content: stretch;
    }

    .shift-form-v2 .toggle-group label {
        flex: 1;
        text-align: center;
    }
}

.form-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* ===================================
   Страница зарплаты
   =================================== */
.salary-page {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-lg);
    padding: 30px;
}

/* ===================================
   Отчетность
   =================================== */
.reports-page {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-lg);
    padding: 30px;
    height: calc(100vh - 100px);
    display: flex;
    flex-direction: column;
}

.reports-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-panel);
    z-index: 10;
}

.reports-header p {
    margin: 0;
}

.reports-table-wrapper {
    flex: 1;
    overflow-y: auto;
}

#reports-table {
    width: 100%;
    border-collapse: collapse;
}

#reports-table th,
#reports-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

#reports-table th {
    background: var(--bg-panel-light);
    color: var(--text);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 5;
}

#reports-table tbody tr {
    cursor: pointer;
    transition: background 0.2s ease;
}

#reports-table tbody tr:hover {
    background: var(--bg-panel-light);
}

#reports-table tbody tr.selected {
    background: var(--primary);
    color: var(--bg-dark);
}

.report-actions {
    display: flex;
    gap: 10px;
}

.piggybank-info {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--bg-dark);
    border-radius: var(--border-radius);
}

.piggybank-info h2 {
    color: var(--accent);
    font-size: 1.8rem;
}

.salary-payout-form {
    max-width: 400px;
    margin: 0 auto 30px;
    padding: 20px;
    background: var(--bg-dark);
    border-radius: var(--border-radius);
}

.payout-total {
    text-align: center;
    font-size: 1.3rem;
    margin: 20px 0;
    color: var(--success);
}

.salary-history {
    margin-top: 30px;
}

.salary-history h3 {
    color: var(--primary);
    margin-bottom: 15px;
}

/* ===================================
   Таблицы
   =================================== */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-dark);
    border-radius: var(--border-radius);
    overflow: hidden;
}

thead {
    background: var(--bg-panel-light);
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
}

tr:hover {
    background: var(--bg-panel);
}

/* ===================================
   Модальные окна
   =================================== */
.modal-overlay {
    display: none !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    overflow-y: auto;
    padding: 20px;
}

.modal-overlay.active {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

.modal-overlay .modal {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    max-height: 90vh;
    overflow: hidden;
    margin: 0;
    align-self: center;
}

.modal {
    display: none;
    background: var(--bg-panel);
    border: 2px solid var(--border);
    border-radius: var(--border-radius-lg);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg), var(--glow);
    animation: modalSlideIn 0.3s ease;
    position: relative;
    margin: auto;
    z-index: 10000;
}

.modal.active {
    display: block !important;
}

.modal[style*="display: block"] {
    display: block !important;
}

.modal-large {
    max-width: 800px !important;
    width: 95% !important;
    max-height: 92vh !important;
    overflow: hidden;
}

.modal-xl {
    max-width: 1200px !important;
    width: 95% !important;
    max-height: 90vh !important;
    overflow-y: auto;
}

.modal-lg {
    max-width: 900px !important;
    width: 90% !important;
    max-height: min(92vh, 860px) !important;
    overflow: hidden;
}

/* flex только у открытой модалки — иначе display:flex !important ломает openModal() */
.modal-lg.active,
.modal-lg[style*="display: block"] {
    display: flex !important;
    flex-direction: column;
    overflow: hidden;
}

.modal-lg .modal-body {
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 12px;
}

.modal-lg .modal-body form > .btn.btn-block {
    margin-bottom: 20px;
}

/* Обязательные поля — звёздочка у label */
.form-group > label:has(+ input[required])::after,
.form-group > label:has(+ textarea[required])::after,
.form-group > label:has(+ select[required])::after {
    content: ' *';
    color: var(--danger);
    font-weight: 700;
}

/* Отступы в модальных окнах */
.modal .form-group {
    padding: 0 20px;
}

.modal .form-actions {
    padding: 20px;
}

.modal .form-group > .btn-block,
.modal form > .form-group:last-child > .btn-block {
    width: 100%;
    margin: 0;
    box-sizing: border-box;
}

/* Кнопки submit вне .form-group — та же ширина, что у полей */
.modal .modal-body form > .btn.btn-block {
    display: block;
    width: calc(100% - 40px);
    max-width: 100%;
    margin: 0 20px 20px;
    box-sizing: border-box;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(100vh);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    color: var(--primary);
    font-size: 1.3rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    cursor: pointer;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: var(--danger);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

#badge-canvas {
    width: 100%;
    height: auto;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
}

/* ===================================
   Админка
   =================================== */
.admin-page {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-lg);
    padding: 30px;
}

.admin-filters {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.admin-filters .form-group {
    margin-bottom: 0;
}

.admin-filters .toggle-group {
    display: flex;
    gap: 15px;
    align-items: center;
    height: 42px;
}

.admin-filters .toggle-group label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 1rem;
}

/* Увеличенные чекбоксы */
.admin-filters input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Валидация денежных полей */
input[type="number"].invalid,
input[type="number"][value^="-"] {
    border-color: var(--danger);
    background: rgba(255, 68, 68, 0.1);
}

/* Поля только для целых чисел */
input[type="number"][step="1"]::-webkit-inner-spin-button,
input[type="number"][step="1"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.admin-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
}

.summary-card h3 {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.summary-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.admin-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.tab-btn:hover {
    color: var(--text);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Подразделы внутри вкладок (Клуб и др.) */
.section-subtabs {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    padding: 4px;
    background: var(--bg-panel-light);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    width: fit-content;
    max-width: 100%;
}

.section-subtab-btn {
    appearance: none;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: calc(var(--border-radius) - 2px);
    cursor: pointer;
    font: inherit;
    font-size: 0.95rem;
    line-height: 1.2;
    transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.section-subtab-btn:hover {
    color: var(--text);
    background: var(--bg-panel);
}

.section-subtab-btn.active {
    color: var(--primary);
    background: var(--bg-panel);
    border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary) 25%, transparent);
    font-weight: 600;
}

.club-tab-panel {
    display: none;
}

.club-tab-panel.active {
    display: block;
}

/* Сортировка таблицы */
.sortable {
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

.sortable:hover {
    background: var(--bg-panel-light);
}

.sort-icon {
    font-size: 0.8em;
    margin-left: 5px;
    opacity: 0.3;
}

.sortable:hover .sort-icon {
    opacity: 0.7;
}

.sortable.sorted-asc .sort-icon {
    opacity: 1;
}

.sortable.sorted-desc .sort-icon {
    opacity: 1;
}

.formula-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--bg-dark);
    border-radius: var(--border-radius);
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* ===================================
   Адаптивность
   =================================== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .shift-grid {
        grid-template-columns: 1fr;
    }
    
    .modal {
        max-width: 95%;
    }
}

/* ===================================
   Настройки - Выбор темы
   =================================== */
.settings-page {
    max-width: 800px;
}

.settings-section {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-lg);
    padding: 30px;
    margin-bottom: 30px;
}

.settings-section h2 {
    margin-bottom: 10px;
    color: var(--primary);
}

.settings-section .text-muted {
    color: var(--text-muted);
    margin-bottom: 25px;
}

.language-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.lang-btn {
    padding: 12px 24px;
    border: 2px solid var(--border);
    border-radius: var(--border-radius);
    background: var(--bg-dark);
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.lang-btn:hover {
    border-color: var(--primary);
    background: var(--bg-panel-light);
}

.lang-btn.active {
    border-color: var(--primary);
    background: var(--primary);
    color: var(--bg-dark);
}

.theme-selector {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 20px;
    border: 2px solid var(--border);
    border-radius: var(--border-radius-lg);
    background: var(--bg-panel-light);
    transition: all 0.3s ease;
    min-width: 150px;
}

.theme-option:hover {
    border-color: var(--primary);
    transform: translateY(-5px);
}

.theme-option input[type="radio"] {
    display: none;
}

.theme-option input[type="radio"]:checked + .theme-preview {
    outline: 3px solid var(--primary);
    outline-offset: 3px;
}

.theme-option:has(input:checked) {
    border-color: var(--primary);
    background: var(--bg-panel);
    box-shadow: var(--glow);
}

.theme-preview {
    width: 100%;
    height: 80px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border);
}

.theme-light {
    background: linear-gradient(135deg, #f5f7fa 0%, #ffffff 100%);
}

.theme-dark {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.theme-cyberpunk {
    background: linear-gradient(135deg, #0a0e1a 0%, #1a1f3a 100%);
    position: relative;
    overflow: hidden;
}

.theme-cyberpunk::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, 
        rgba(0, 240, 255, 0.3) 0%, 
        transparent 50%, 
        rgba(255, 0, 255, 0.3) 100%);
}

.theme-shojo {
    background: linear-gradient(135deg, #fff0f5 0%, #ffe4e9 100%);
    position: relative;
    overflow: hidden;
}

.theme-shojo::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 30% 50%, rgba(255, 105, 180, 0.4) 0%, transparent 70%);
}

.theme-military {
    background: linear-gradient(135deg, #2f2f2f 0%, #3d3d3d 100%);
    position: relative;
    overflow: hidden;
}

.theme-military::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(74, 93, 35, 0.1) 10px,
        rgba(74, 93, 35, 0.1) 20px
    );
}

.theme-steampunk {
    background: linear-gradient(135deg, #2c1810 0%, #3d2317 100%);
    position: relative;
    overflow: hidden;
}

.theme-steampunk::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 70% 30%, rgba(205, 127, 50, 0.3) 0%, transparent 60%);
}

.theme-grayscale {
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    position: relative;
    overflow: hidden;
}

.theme-grayscale::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 10px,
        rgba(128, 128, 128, 0.1) 10px,
        rgba(128, 128, 128, 0.1) 20px
    );
}

.theme-matrix {
    background: linear-gradient(135deg, #000000 0%, #0a0a0a 100%);
    position: relative;
    overflow: hidden;
}

.theme-matrix::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 255, 0, 0.1) 2px,
        rgba(0, 255, 0, 0.1) 4px
    );
}

.theme-voodoo {
    background: linear-gradient(135deg, #1a0a0a 0%, #2d1010 100%);
    position: relative;
    overflow: hidden;
}

.theme-voodoo::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 50%, rgba(255, 69, 0, 0.2) 0%, transparent 70%);
}

.theme-option span:last-child {
    font-weight: 600;
    color: var(--text);
}

/* ===================================
   Пересчёт копилки
   =================================== */
.recalculate-section {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-lg);
    padding: 30px;
    max-width: 800px;
}

.recalculate-section h2 {
    color: var(--primary);
    margin-bottom: 15px;
}

.recalculate-warning {
    background: var(--bg-panel-light);
    border-left: 4px solid var(--warning);
    padding: 15px;
    margin: 20px 0;
    border-radius: var(--border-radius);
}

.recalculate-result {
    margin-top: 20px;
    padding: 20px;
    background: var(--bg-dark);
    border-radius: var(--border-radius);
}

.recalculate-success {
    color: var(--success);
}

.recalculate-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.recalculate-table th,
.recalculate-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.recalculate-table th {
    color: var(--text-muted);
    font-weight: 600;
}

/* ===================================
   Адаптивность (Mobile First)
   =================================== */

.burger-menu {
    display: none;
    border: none;
    padding: 0;
    margin: 0;
    -webkit-tap-highlight-color: transparent;
}

.sidebar-overlay {
    display: none;
}

/* Планшеты и меньше (1024px) */
@media (max-width: 1024px) {
    .sidebar {
        width: var(--sidebar-width);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar-nav {
        position: relative;
        z-index: 2;
    }
    
    .nav-item {
        min-height: 48px;
        touch-action: manipulation;
    }
    
    .main-content {
        margin-left: 0;
        padding: 56px 15px 16px;
        min-width: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Бургер-меню */
    .burger-menu {
        display: flex !important;
        position: fixed;
        top: max(15px, env(safe-area-inset-top, 0px));
        left: max(15px, env(safe-area-inset-left, 0px));
        z-index: 1001;
        background: var(--primary);
        border: none;
        border-radius: 8px;
        width: 50px;
        height: 50px;
        cursor: pointer;
        align-items: center;
        justify-content: center;
        box-shadow: var(--shadow-lg);
        touch-action: manipulation;
    }
    
    .burger-menu span:not(:first-child) {
        display: none !important;
    }
    
    .burger-menu span {
        display: block;
        width: 24px;
        height: 3px;
        background: var(--bg-dark);
        border-radius: 2px;
        position: relative;
        transition: all 0.3s ease;
    }
    
    .burger-menu span::before,
    .burger-menu span::after {
        content: '';
        position: absolute;
        width: 24px;
        height: 3px;
        background: var(--bg-dark);
        border-radius: 2px;
        transition: all 0.3s ease;
    }
    
    .burger-menu span::before {
        top: -8px;
    }
    
    .burger-menu span::after {
        top: 8px;
    }
    
    /* Анимация бургера */
    .burger-menu.active span {
        background: transparent;
    }
    
    .burger-menu.active span::before {
        top: 0;
        transform: rotate(45deg);
    }
    
    .burger-menu.active span::after {
        top: 0;
        transform: rotate(-45deg);
    }
    
    /* Overlay для меню */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        pointer-events: auto;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    /* Dashboard stats - 2 колонки */
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Charts - 1 колонка */
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    /* Формы в 1 колонку */
    .form-row {
        grid-template-columns: 1fr !important;
    }
    
    .bookings-calendar-wrap,
    .bookings-my-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }
    
    .calendar-grid {
        min-width: 0;
        grid-template-columns: repeat(7, minmax(0, 1fr));
        gap: 4px;
        padding: 10px;
    }

    .calendar-day-header {
        padding: 4px 2px;
        font-size: 0.75rem;
    }

    .calendar-day {
        min-height: 72px;
        padding: 4px;
    }

    .calendar-day-number {
        font-size: 0.85rem;
    }

    .calendar-shift {
        font-size: 0.65rem;
        padding: 2px 4px;
        white-space: normal;
    }
    
    #my-bookings-table {
        min-width: 0;
    }

    .shift-form-v2 .shift-grid-3 {
        grid-template-columns: 1fr;
    }

    .formula-form-compact .formula-grid {
        grid-template-columns: 1fr;
    }

    .main-content {
        padding-left: 12px;
        padding-right: 12px;
        overflow-x: hidden;
    }

    .table-wrap,
    .table-responsive {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Мобильные телефоны (768px) */
@media (max-width: 768px) {
    /* Сайдбар на весь экран */
    .sidebar {
        width: 100%;
        max-width: 300px;
    }
    
    /* Статистика — 2 колонки (компактные плитки) */
    .dashboard-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    
    .stat-card {
        padding: 10px;
    }
    
    .stat-value {
        font-size: 1.15rem;
    }
    
    /* Таблицы - горизонтальная прокрутка */
    .debtors-table-wrapper,
    .reports-table-wrapper,
    .salary-history,
    #admin-shifts-table,
    #admin-admins-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Кнопки — компактнее на телефоне */
    .btn {
        padding: 8px 12px;
        font-size: 0.875rem;
        min-height: 36px;
    }
    
    .btn-block {
        width: 100%;
    }
    
    /* Модальные окна */
    .modal {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 100dvh;
        margin: 0;
    }
    
    .modal-large,
    .modal-xl,
    .modal-lg {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Формы — 16px против зума iOS, компактные отступы */
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 8px 10px;
        font-size: 16px;
    }
    
    /* Toolbar в 1 колонку */
    .debtors-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .toolbar-left {
        flex-direction: column;
    }
    
    .debtors-filters {
        flex-direction: column;
    }
    
    .search-input,
    .status-filter {
        min-width: 100%;
    }
    
    /* Виджеты дашборда */
    [data-widget] {
        margin-bottom: 15px;
    }
    
    /* Скрываем некоторые элементы на мобильных */
    .sidebar-footer {
        padding: 10px;
    }
    
    .sidebar-footer .btn-block {
        min-height: 50px;
    }
}

/* Маленькие телефоны (480px) */
@media (max-width: 480px) {
    .main-content {
        padding: 68px 10px 16px;
    }
    
    .page h1 {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }
    
    /* Карточки вместо таблиц на мобильных */
    table {
        font-size: 14px;
    }
    
    th, td {
        padding: 8px;
    }
    
    /* Кнопки действий - иконки */
    .btn-sm {
        padding: 6px 10px;
        font-size: 1.2rem;
    }
    
    .btn-sm span {
        display: none;
    }
    
    /* Превращаем таблицы в карточки на очень маленьких экранах */
    @media (max-width: 400px) {
        table, thead, tbody, th, td, tr {
            display: block;
        }
        
        thead tr {
            position: absolute;
            top: -9999px;
            left: -9999px;
        }
        
        tr {
            background: var(--bg-panel);
            border: 1px solid var(--border);
            border-radius: var(--border-radius);
            margin-bottom: 10px;
            padding: 10px;
        }
        
        td {
            border: none;
            position: relative;
            padding-left: 50%;
        }
        
        td:before {
            position: absolute;
            top: 8px;
            left: 10px;
            width: 45%;
            padding-right: 10px;
            white-space: nowrap;
            font-weight: 600;
            color: var(--text-muted);
        }
        
        /* Добавляем заголовки для ячеек через data-label */
        td[data-label]:before {
            content: attr(data-label);
        }
    }
}

/* Пейзажная ориентация на мобильных */
@media (max-width: 768px) and (orientation: landscape) {
    .modal {
        max-height: 95vh;
    }
    
    .sidebar {
        max-width: 250px;
    }
}

/* Печать */
@media print {
    .sidebar,
    .burger-menu,
    .sidebar-overlay,
    .form-actions,
    .modal-header,
    .modal-footer,
    button,
    nav {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
        padding: 0;
    }

    #envelope-print {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
    }
}

/* ===================================
   Должники - новые стили
   =================================== */
.debtors-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.debtors-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.debtors-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.search-input,
.status-filter {
    padding: 10px 15px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    color: var(--text);
    font-size: 0.9rem;
    min-width: 200px;
}

.search-input:focus,
.status-filter:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--glow);
}

.debtors-table-wrapper {
    overflow-x: auto;
    margin-bottom: 20px;
    width: 100%;
}

#debtors-table {
    width: 100%;
    min-width: 800px;
    border-collapse: collapse;
    table-layout: auto;
}

#debtors-table th,
#debtors-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

#debtors-table th:nth-child(2),
#debtors-table td:nth-child(2) {
    min-width: 200px;
    white-space: normal;
}

#debtors-table th {
    background: var(--bg-panel-light);
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

#debtors-table tbody tr:hover {
    background: var(--bg-panel-light);
}

.sortable {
    cursor: pointer;
    user-select: none;
}

.sortable:hover {
    color: var(--primary);
}

.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-badge.active {
    background: var(--success);
    color: var(--bg-dark);
}

.status-badge.paid {
    background: var(--text-muted);
    color: var(--bg-dark);
}

.status-badge.warning {
    background: var(--warning);
    color: var(--bg-dark);
}

.status-badge.blacklist {
    background: var(--danger);
    color: var(--text);
}

.debt-amount {
    font-weight: 700;
    color: var(--danger);
}

.debt-amount.paid {
    color: var(--success);
}

/* Модальное окно движений */
.debtor-info-header {
    background: var(--bg-panel-light);
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    border-left: 4px solid var(--primary);
}

.debtor-info-header h3 {
    color: var(--primary);
    margin-bottom: 10px;
}

.debtor-info-header p {
    margin: 5px 0;
}

.movement-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.movement-tabs .tab-btn {
    flex: 1;
    padding: 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    color: var(--text);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.movement-tabs .tab-btn.active {
    background: var(--primary);
    color: var(--bg-dark);
    border-color: var(--primary);
}

.movement-form .form-group {
    margin-bottom: 15px;
}

.movement-history {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid var(--border);
}

#movement-history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

#movement-history-table th,
#movement-history-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

#movement-history-table th {
    background: var(--bg-panel-light);
    color: var(--text-muted);
    font-weight: 600;
}

.type-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.type-badge.loan {
    background: var(--danger);
    color: var(--text);
}

.type-badge.redemption {
    background: var(--success);
    color: var(--bg-dark);
}

.type-badge.writeoff {
    background: var(--warning);
    color: var(--bg-dark);
}

/* Пагинация */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* Встроенная панель движений */
.movement-panel {
    background: var(--bg-panel);
    border: 2px solid var(--primary);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    margin-top: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-lg), var(--glow);
}

.movement-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 20px;
}

.movement-panel-header .debtor-info-header {
    flex: 1;
    margin-bottom: 0;
    border-left: none;
    background: var(--bg-dark);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.movement-history {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid var(--border);
}

.movement-history h3 {
    color: var(--text);
    margin-bottom: 15px;
}

#movement-history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

#movement-history-table th,
#movement-history-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

#movement-history-table th {
    background: var(--bg-panel-light);
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
}

#movement-history-table tbody tr:hover {
    background: var(--bg-dark);
}

.pagination button {
    padding: 8px 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s ease;
}

.pagination button:hover {
    background: var(--bg-panel-light);
    border-color: var(--primary);
}

.pagination button.active {
    background: var(--primary);
    color: var(--bg-dark);
    border-color: var(--primary);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-info {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Редактирование должника */
.edit-form .form-group {
    margin-bottom: 15px;
}

.edit-form label {
    display: block;
    margin-bottom: 5px;
    color: var(--text);
    font-weight: 500;
}

.edit-form input,
.edit-form select,
.edit-form textarea {
    width: 100%;
    padding: 10px 15px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
}

.edit-form input:focus,
.edit-form select:focus,
.edit-form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--glow);
}

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

/* Настройки клуба */
.club-settings-form .form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.club-settings-form {
    max-width: 800px;
}

/* Настройки дашборда */
.dashboard-settings-form {
    max-width: 600px;
}

.widget-toggles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.widget-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
}

.widget-toggle:hover {
    background: var(--bg-panel-light);
    border-color: var(--primary);
}

.widget-toggle input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.widget-toggle span {
    font-weight: 500;
    color: var(--text);
}

.toolbar-left {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ===================================
   Страница бронирования смен
   =================================== */
.bookings-page-layout {
    display: grid;
    grid-template-columns: minmax(220px, 280px) 1fr;
    gap: 24px;
    align-items: start;
}

.bookings-rules-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-lg);
    padding: 18px 20px;
    position: sticky;
    top: 16px;
}

.bookings-rules-panel h3 {
    margin: 0 0 12px 0;
    font-size: 1.05rem;
    color: var(--primary);
}

.bookings-rules-list {
    margin: 0;
    padding-left: 1.15rem;
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.55;
}

.bookings-rules-list li {
    margin-bottom: 10px;
}

.bookings-main {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.bookings-calendar-scroll {
    position: relative;
}

.bookings-calendar-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    position: static;
    top: auto;
    z-index: auto;
}

.bookings-month-title {
    position: static;
}

.bookings-month-title {
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text);
}

.bookings-form-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    max-width: 420px;
}

.bookings-form-panel h3 {
    margin: 0 0 14px 0;
    color: var(--primary);
}

.bookings-my-table-wrap h3 {
    margin: 0 0 10px 0;
    color: var(--primary);
}

#my-bookings-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

#my-bookings-table th,
#my-bookings-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

#my-bookings-table th {
    background: var(--bg-panel-light);
    color: var(--text-muted);
    font-size: 0.85rem;
}

#my-bookings-table tr:last-child td {
    border-bottom: none;
}

@media (max-width: 960px) {
    .bookings-page-layout {
        grid-template-columns: 1fr;
    }

    .bookings-rules-panel {
        position: static;
    }
    
    .bookings-calendar-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .bookings-calendar-toolbar .btn {
        width: 100%;
    }
}

/* ===================================
   Календарь смен
   =================================== */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
    background: var(--bg-panel);
    padding: 20px;
    border-radius: var(--border-radius-lg);
}

.calendar-day-header {
    text-align: center;
    font-weight: 600;
    color: var(--text-muted);
    padding: 10px;
    font-size: 0.9rem;
}

.calendar-day {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    min-height: 100px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.calendar-day:hover {
    border-color: var(--primary);
    box-shadow: var(--glow);
}

.calendar-day.today {
    border-color: var(--primary);
    background: var(--bg-panel-light);
}

.calendar-day.other-month {
    opacity: 0.5;
}

.calendar-day-number {
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 1.1rem;
}

.calendar-day-head {
    margin-bottom: 5px;
}

.calendar-day-head .calendar-day-number {
    margin-bottom: 0;
}

.calendar-day-weekday {
    display: none;
}

.calendar-day-shifts {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.calendar-day.shift-day {
    border-left: 3px solid var(--primary);
}

.calendar-day.shift-night {
    border-left: 3px solid var(--secondary);
}

.calendar-shift {
    background: var(--bg-panel);
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-shift.day {
    background: rgba(0, 240, 255, 0.2);
    color: var(--primary);
}

.calendar-shift.night {
    background: rgba(255, 0, 255, 0.2);
    color: var(--secondary);
}

.calendar-shift.shift-worked {
    box-shadow: inset 0 0 0 1px var(--success);
    pointer-events: none;
    cursor: default;
}

.calendar-shift.shift-worked .shift-worked-tag {
    font-size: 0.72rem;
    color: var(--success);
    font-weight: 600;
}

.calendar-shift.shift-awaiting-work {
    box-shadow: inset 0 0 0 1px var(--warning);
}

.calendar-legend-color.worked {
    background: color-mix(in srgb, var(--success) 35%, transparent);
    border: 1px solid var(--success);
}

.calendar-shift .admin-name {
    font-weight: 600;
}

.calendar-shift-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 2px;
}

.calendar-shift-type {
    font-weight: 700;
}

.calendar-shift .shift-code-tag {
    font-size: 0.72rem;
    color: var(--warning);
    font-weight: 600;
    white-space: nowrap;
    text-align: right;
}

.calendar-shift.shift-awaiting-code {
    outline: 2px solid var(--warning);
    box-shadow: 0 0 14px color-mix(in srgb, var(--warning) 60%, transparent);
    cursor: pointer;
    animation: shift-awaiting-pulse 1.6s ease-in-out infinite;
}

@keyframes shift-awaiting-pulse {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.2); }
}

.lang-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.lang-btn {
    border: 1px solid var(--border);
    background: var(--bg-panel);
    color: var(--text);
    border-radius: 8px;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.95rem;
}

.lang-btn:hover,
.lang-btn.active {
    border-color: var(--primary);
    box-shadow: 0 0 8px color-mix(in srgb, var(--primary) 40%, transparent);
}

.debtors-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    margin-bottom: 16px;
}

.debtors-toolbar .form-group {
    margin-bottom: 0;
}

.debtors-toolbar-search {
    flex: 1;
    min-width: 180px;
}

.debtors-toolbar-status {
    min-width: 160px;
}

.debtors-toolbar .btn {
    height: 42px;
    align-self: flex-end;
}

body[data-theme="anime"] .calendar-shift.day,
body[data-theme="shojo"] .calendar-shift.day {
    background: rgba(255, 182, 193, 0.55);
    color: #3d1e30;
}

body[data-theme="anime"] .calendar-shift.night,
body[data-theme="shojo"] .calendar-shift.night {
    background: rgba(186, 164, 224, 0.55);
    color: #2e1f4a;
}

body[data-theme="anime"] .calendar-shift .admin-name,
body[data-theme="shojo"] .calendar-shift .admin-name {
    color: #2a1522;
}

body[data-theme="anime"] .calendar-shift .shift-worked-tag,
body[data-theme="shojo"] .calendar-shift .shift-worked-tag {
    color: #0a5c38;
    font-weight: 700;
}

body[data-theme="anime"] .calendar-shift .shift-code-tag,
body[data-theme="shojo"] .calendar-shift .shift-code-tag {
    color: #9a4d00;
    font-weight: 700;
}

.calendar-legend {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    padding: 15px;
    background: var(--bg-panel);
    border-radius: var(--border-radius);
}

.calendar-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.calendar-legend-color {
    width: 15px;
    height: 15px;
    border-radius: 3px;
}

.calendar-legend-color.day {
    background: var(--primary);
}

.calendar-legend-color.night {
    background: var(--secondary);
}

/* Бронирования: список дней на узком экране */
@media (max-width: 1024px) {
    .bookings-calendar-wrap {
        overflow-x: visible;
    }

    #bookings-calendar-grid.calendar-grid {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 12px;
        min-width: 0;
    }

    #bookings-calendar-grid .calendar-day-header {
        display: none;
    }

    #bookings-calendar-grid .calendar-day.other-month {
        display: none;
    }

    #bookings-calendar-grid .calendar-day {
        display: flex;
        flex-direction: row;
        align-items: flex-start;
        gap: 12px;
        min-height: auto;
        padding: 12px 14px;
    }

    #bookings-calendar-grid .calendar-day-head {
        flex: 0 0 52px;
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        margin-bottom: 0;
        padding-top: 2px;
    }

    #bookings-calendar-grid .calendar-day-number {
        font-size: 1.2rem;
        line-height: 1.1;
    }

    #bookings-calendar-grid .calendar-day-weekday {
        display: block;
        margin-top: 4px;
        font-size: 0.72rem;
        font-weight: 600;
        color: var(--text-muted);
        letter-spacing: 0.02em;
    }

    #bookings-calendar-grid .calendar-day.today .calendar-day-weekday {
        color: var(--primary);
    }

    #bookings-calendar-grid .calendar-day-shifts {
        flex: 1;
        gap: 6px;
    }

    #bookings-calendar-grid .calendar-shift {
        font-size: 0.8rem;
        padding: 6px 8px;
        white-space: normal;
        margin-bottom: 0;
    }

    .bookings-calendar-wrap .calendar-legend {
        flex-wrap: wrap;
        gap: 10px 16px;
    }
}

.chart-box {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-lg);
    padding: 20px;
}

.chart-box h3 {
    color: var(--text);
    margin-bottom: 15px;
    text-align: center;
}

#receipt-content {
    background: #fff;
    color: #000;
    padding: 40px;
    border-radius: 8px;
}

#receipt-content * {
    color: #000 !important;
}

/* Вкладки настроек: только панели с id settings-tab-* */
#page-settings .settings-tab-panel.tab-content {
    display: none;
}

#page-settings .settings-tab-panel.tab-content.active {
    display: block;
}

.theme-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 12px;
}

.theme-card {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    flex: 1 1 160px;
    max-width: 220px;
    min-height: 100px;
    border-radius: var(--border-radius-lg);
    border: 2px solid var(--border);
    background: var(--bg-panel-light);
    cursor: pointer;
    text-align: left;
    padding: 12px 14px;
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.theme-card[data-theme]::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.26;
    background: center/cover no-repeat;
    mix-blend-mode: soft-light;
    transition: opacity 0.2s;
}

.theme-card:hover::before {
    opacity: 0.38;
}

.theme-card .theme-card-swatches,
.theme-card .theme-card-title {
    position: relative;
    z-index: 1;
}

.theme-card[data-theme="cyberpunk"]::before {
    background-image: url("../images/themes/cyberpunk-bg.svg");
}

.theme-card[data-theme="light"]::before {
    background-image: url("../images/themes/light-bg.svg");
    mix-blend-mode: multiply;
    opacity: 0.18;
}

.theme-card[data-theme="dark"]::before {
    background-image: url("../images/themes/dark-bg.svg");
}

.theme-card[data-theme="shojo"]::before {
    background-image: url("../images/themes/shojo-bg.svg");
    mix-blend-mode: multiply;
    opacity: 0.2;
}

.theme-card[data-theme="grayscale"]::before {
    background-image: url("../images/themes/grayscale-bg.svg");
}

.theme-card[data-theme="military"]::before {
    background-image: url("../images/themes/military-bg.svg");
}

.theme-card[data-theme="steampunk"]::before {
    background-image: url("../images/themes/steampunk-bg.svg");
}

.theme-card[data-theme="matrix"]::before {
    background-image: url("../images/themes/matrix-bg.svg");
    mix-blend-mode: screen;
}

.theme-card[data-theme="voodoo"]::before {
    background-image: url("../images/themes/voodoo-bg.svg");
}

.theme-card[data-theme="dota2"]::before {
    background-image: url("../images/themes/dota2-bg.svg");
}

.theme-card[data-theme="anime"]::before {
    background-image: url("../images/themes/anime-bg.svg");
}

.theme-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}

.theme-card.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--border-glow);
}

.theme-card-title {
    display: block;
    font-weight: 600;
    margin-top: 10px;
}

.theme-card-swatches {
    display: flex;
    gap: 6px;
}

.theme-card-swatches span {
    flex: 1;
    height: 22px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.theme-card[data-theme="cyberpunk"] .theme-card-swatches span:nth-child(1) { background: #0a0e1a; }
.theme-card[data-theme="cyberpunk"] .theme-card-swatches span:nth-child(2) { background: #00f0ff; }
.theme-card[data-theme="cyberpunk"] .theme-card-swatches span:nth-child(3) { background: #ff00ff; }

.theme-card[data-theme="dota2"] .theme-card-swatches span:nth-child(1) { background: #0d0d0f; }
.theme-card[data-theme="dota2"] .theme-card-swatches span:nth-child(2) { background: #c82333; }
.theme-card[data-theme="dota2"] .theme-card-swatches span:nth-child(3) { background: #b8860b; }

.theme-card[data-theme="anime"] .theme-card-swatches span:nth-child(1) { background: #1a1528; }
.theme-card[data-theme="anime"] .theme-card-swatches span:nth-child(2) { background: #ff9ecb; }
.theme-card[data-theme="anime"] .theme-card-swatches span:nth-child(3) { background: #b794f6; }

.theme-card[data-theme="light"] .theme-card-swatches span:nth-child(1) { background: #f5f7fa; }
.theme-card[data-theme="light"] .theme-card-swatches span:nth-child(2) { background: #2563eb; }
.theme-card[data-theme="light"] .theme-card-swatches span:nth-child(3) { background: #7c3aed; }

.theme-card[data-theme="dark"] .theme-card-swatches span:nth-child(1) { background: #1a1a2e; }
.theme-card[data-theme="dark"] .theme-card-swatches span:nth-child(2) { background: #4a9eff; }
.theme-card[data-theme="dark"] .theme-card-swatches span:nth-child(3) { background: #a855f7; }

.theme-card[data-theme="shojo"] .theme-card-swatches span:nth-child(1) { background: #fff0f5; }
.theme-card[data-theme="shojo"] .theme-card-swatches span:nth-child(2) { background: #ff69b4; }
.theme-card[data-theme="shojo"] .theme-card-swatches span:nth-child(3) { background: #dda0dd; }

.theme-card[data-theme="grayscale"] .theme-card-swatches span:nth-child(1) { background: #1a1a1a; }
.theme-card[data-theme="grayscale"] .theme-card-swatches span:nth-child(2) { background: #808080; }
.theme-card[data-theme="grayscale"] .theme-card-swatches span:nth-child(3) { background: #c0c0c0; }

.theme-card[data-theme="military"] .theme-card-swatches span:nth-child(1) { background: #1a1a1a; }
.theme-card[data-theme="military"] .theme-card-swatches span:nth-child(2) { background: #6b8e23; }
.theme-card[data-theme="military"] .theme-card-swatches span:nth-child(3) { background: #a0825a; }

.theme-card[data-theme="steampunk"] .theme-card-swatches span:nth-child(1) { background: #2c1810; }
.theme-card[data-theme="steampunk"] .theme-card-swatches span:nth-child(2) { background: #cd7f32; }
.theme-card[data-theme="steampunk"] .theme-card-swatches span:nth-child(3) { background: #8b4513; }

.theme-card[data-theme="matrix"] .theme-card-swatches span:nth-child(1) { background: #000000; }
.theme-card[data-theme="matrix"] .theme-card-swatches span:nth-child(2) { background: #00ff00; }
.theme-card[data-theme="matrix"] .theme-card-swatches span:nth-child(3) { background: #003300; }

.theme-card[data-theme="voodoo"] .theme-card-swatches span:nth-child(1) { background: #1a0a0a; }
.theme-card[data-theme="voodoo"] .theme-card-swatches span:nth-child(2) { background: #ff4500; }
.theme-card[data-theme="voodoo"] .theme-card-swatches span:nth-child(3) { background: #8b0000; }

.theme-card-user {
    border-style: dashed;
    padding-right: 52px;
}

.theme-card-user .theme-card-edit {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--primary), color-mix(in srgb, var(--primary) 75%, #000 25%));
    color: var(--bg-dark);
    border: 2px solid color-mix(in srgb, var(--primary) 55%, #fff 45%);
    box-shadow:
        0 2px 10px rgba(0, 0, 0, 0.22),
        0 0 14px color-mix(in srgb, var(--primary) 40%, transparent);
    cursor: pointer;
    pointer-events: auto;
    transition: box-shadow 0.2s, transform 0.2s;
}

.theme-card-user:hover .theme-card-edit {
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.28),
        0 0 18px color-mix(in srgb, var(--primary) 55%, transparent);
    transform: scale(1.06);
}

.theme-card-user .theme-card-edit-icon {
    width: 22px;
    height: 22px;
    display: block;
    transform-origin: center center;
}

.theme-card-user:hover .theme-card-edit-icon {
    animation: theme-card-gear-spin 1.4s linear infinite;
}

body[data-theme="light"] .theme-card-user .theme-card-edit,
body[data-theme="anime"] .theme-card-user .theme-card-edit {
    color: #111;
}

@keyframes theme-card-gear-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .theme-card-user:hover .theme-card-edit-icon {
        animation: none;
        transform: rotate(45deg);
    }

    .theme-card-user:hover .theme-card-edit {
        transform: none;
    }
}

.formula-form-compact .formula-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 16px;
}

.formula-form-compact .formula-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 18px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-lg);
}

.formula-form-compact .formula-col-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 10px;
    margin-bottom: 2px;
    border-bottom: 1px solid var(--border);
}

.formula-form-compact .formula-col-icon {
    font-size: 1.15rem;
    line-height: 1;
}

.formula-form-compact .formula-col-head h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
}

.formula-form-compact .formula-block {
    padding: 14px 16px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
}

.formula-form-compact .formula-block-title {
    margin: 0 0 12px 0;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.formula-form-compact .formula-fields {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px 14px;
    align-items: end;
}

@media (max-width: 900px) {
    .formula-form-compact .formula-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 480px) {
    .formula-form-compact .formula-fields {
        grid-template-columns: 1fr;
    }
}

.formula-form-compact .formula-fields label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
    min-width: 0;
}

.formula-form-compact .formula-fields label .formula-label {
    display: block;
    white-space: nowrap;
}

.formula-form-compact .formula-fields input {
    width: 100%;
    min-width: 0;
    min-height: 38px;
    padding: 8px 10px;
    box-sizing: border-box;
    border-radius: var(--border-radius);
    border: 1px solid var(--border);
    background: var(--bg-panel);
    color: var(--text);
}

.formula-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.modal-badge-dialog {
    overflow: hidden !important;
}

.modal-badge-header {
    flex-wrap: wrap;
    gap: 10px;
}

.modal-badge-header h2 {
    flex: 1 1 auto;
}

.modal-badge-body {
    overflow: hidden !important;
    text-align: center;
    padding: 12px 16px 20px;
}

.badge-scale-wrap {
    display: inline-block;
    max-width: min(92vw, 900px);
    max-height: 72vh;
}

.badge-scale-wrap canvas {
    display: block;
    width: 100%;
    height: auto;
    max-height: 72vh;
}

#modal-envelope .modal-body {
    background: #fff !important;
}

#envelope-print {
    background: #fff;
}

.envelope-sheet {
    width: 190mm;
    max-height: 132mm;
    margin: 0 auto;
    padding: 6mm 10mm;
    overflow: hidden;
    box-sizing: border-box;
    background: #fff !important;
    color: #111 !important;
    font-family: "Segoe UI", system-ui, sans-serif;
    border: none;
}

.envelope-sheet .envelope-club {
    margin: 0 0 2mm;
    font-size: 9pt;
    font-weight: 600;
    color: #111 !important;
}

.envelope-sheet .envelope-title {
    text-align: center;
    margin: 0 0 3mm;
    font-size: 12pt;
    color: #111 !important;
}

.envelope-sheet .envelope-meta {
    margin: 0 0 3mm;
    font-size: 9pt;
    color: #111 !important;
}

.envelope-sheet .envelope-comment {
    margin: 2mm 0 0;
    font-size: 8pt;
    color: #111 !important;
}

.envelope-sheet p,
.envelope-sheet strong,
.envelope-sheet td {
    color: #111 !important;
}

.envelope-sheet .envelope-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9pt;
    background: transparent !important;
}

.envelope-sheet tr {
    background: transparent !important;
}

.envelope-sheet td {
    padding: 2px 4px;
    vertical-align: top;
    background: transparent !important;
    border-bottom: 1px solid #ddd;
}

.envelope-sheet .sum {
    text-align: right;
    font-weight: 600;
}

@font-face {
    font-family: 'Peckkin';
    src: url('../fonts/PECHKIN_.TTF') format('truetype');
    font-weight: normal;
    font-style: normal;
}

#envelope-print .env-top,
.envelope-sheet .env-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
}

#envelope-print .env-meta-line,
.envelope-sheet .env-meta-line {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-size: 14px;
    line-height: 1.45;
    margin-bottom: 4px;
    border-bottom: 1px solid #000;
    padding-bottom: 2px;
}

#envelope-print .env-label,
.envelope-sheet .env-label {
    color: #000;
    white-space: nowrap;
}

#envelope-print .env-value,
.envelope-sheet .env-value,
#envelope-print .env-fin-value,
.envelope-sheet .env-fin-value,
#envelope-print .env-comments-text,
.envelope-sheet .env-comments-text {
    color: #3333ff;
}

#envelope-print .env-top,
.envelope-sheet .env-top {
    overflow: visible;
}

#envelope-print .env-stamps-col,
.envelope-sheet .env-stamps-col {
    position: relative;
    width: 150px;
    height: 104px;
    flex-shrink: 0;
    padding: 12px 4px 4px;
    box-sizing: content-box;
    overflow: visible;
}

#envelope-print .env-stamp,
.envelope-sheet .env-stamp {
    position: absolute;
    width: 46px;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.12));
    transform-origin: center center;
}

#envelope-print .env-stamp--1,
.envelope-sheet .env-stamp--1 { top: 12px; right: 54px; }
#envelope-print .env-stamp--2,
.envelope-sheet .env-stamp--2 { top: 14px; right: 2px; }
#envelope-print .env-stamp--3,
.envelope-sheet .env-stamp--3 { top: 28px; right: 92px; }

#envelope-print .env-main,
.envelope-sheet .env-main {
    display: flex;
    gap: 16px;
    align-items: stretch;
    margin-bottom: 8px;
    min-height: 140px;
}

#envelope-print .env-left-col,
.envelope-sheet .env-left-col {
    flex: 0 0 46%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

#envelope-print .env-amount-row,
.envelope-sheet .env-amount-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-shrink: 0;
    overflow: visible;
}

#envelope-print .env-peckkin-digit,
.envelope-sheet .env-peckkin-digit {
    font-family: 'Peckkin', "Courier New", Courier, monospace;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.15;
    color: #111;
    border: none;
    background: none;
    padding: 0 0 2px;
    display: inline-block;
    overflow: visible;
}

#envelope-print .env-finance,
.envelope-sheet .env-finance {
    flex: 1;
    min-width: 0;
}

#envelope-print .env-fin-row,
.envelope-sheet .env-fin-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 14px;
    line-height: 1.4;
    border-bottom: 1px solid #000;
    margin-bottom: 3px;
    padding-bottom: 2px;
}

#envelope-print .env-comments-block,
.envelope-sheet .env-comments-block {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border: 1px solid #000;
    box-sizing: border-box;
    padding: 6px 8px;
    min-height: 72px;
    overflow: hidden;
}

#envelope-print .env-comments-block--small .env-comments-text,
.envelope-sheet .env-comments-block--small .env-comments-text {
    font-size: 12px;
    line-height: 1.28;
}

#envelope-print .env-comments-block--compact .env-comments-text,
.envelope-sheet .env-comments-block--compact .env-comments-text {
    font-size: 11px;
    line-height: 1.25;
}

#envelope-print .env-comments-block--tiny .env-comments-text,
.envelope-sheet .env-comments-block--tiny .env-comments-text {
    font-size: 10px;
    line-height: 1.22;
}

#envelope-print .env-comments-label,
.envelope-sheet .env-comments-label {
    color: #000;
    font-size: 13px;
    line-height: 1.2;
}

#envelope-print .env-comments-text,
.envelope-sheet .env-comments-text {
    flex: 1;
    overflow: hidden;
}

#envelope-print .env-bottom,
.envelope-sheet .env-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    padding-bottom: 4px;
    overflow: visible;
    flex-shrink: 0;
}

#envelope-print .env-digit-sample,
.envelope-sheet .env-digit-sample {
    font-family: 'Peckkin', "Courier New", Courier, monospace;
    font-size: 22px;
    letter-spacing: 8px;
    font-weight: 700;
    color: #000;
    line-height: 1.15;
    padding-bottom: 2px;
    overflow: visible;
}

#envelope-print .env-bottom .env-amount-row,
.envelope-sheet .env-bottom .env-amount-row {
    margin-left: auto;
}

.dashboard-leaders-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.dashboard-top-list {
    margin: 8px 0 0;
    padding-left: 1.2rem;
    line-height: 1.6;
}

.sidebar-header-modern {
    padding: 16px;
}

.sidebar-brand-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    margin-bottom: 12px;
}

.sidebar-club-title {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.3;
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-width: 0;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.sidebar-club-title .version-badge {
    display: inline-block;
    margin-top: 0;
    margin-left: 0;
    vertical-align: middle;
    white-space: nowrap;
    flex-shrink: 0;
}

.club-logo-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.sidebar-user-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg-panel-light);
    border-radius: var(--border-radius);
    border: 1px solid var(--border);
}

.sidebar-user-name {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
}

.sidebar-role-badge {
    margin-top: 8px;
    display: inline-block;
}

.notifications-btn {
    position: relative;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px 10px;
    cursor: pointer;
}

.notifications-badge-pill {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    font-size: 0.7rem;
    line-height: 18px;
    text-align: center;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
}

.booking-panel-highlight {
    outline: 2px solid var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 240, 255, 0.15);
    transition: box-shadow 0.3s ease;
}

@media (max-width: 768px) {
    .dashboard-leaders-row {
        grid-template-columns: 1fr;
    }
}

/* Контраст текста в темах с близкими цветами */
body[data-theme="shojo"] .text-muted,
body[data-theme="anime"] .text-muted,
body[data-theme="steampunk"] .text-muted,
body[data-theme="voodoo"] .text-muted,
body[data-theme="grayscale"] .text-muted {
    color: var(--text) !important;
    opacity: 0.82;
}

body[data-theme="shojo"] .stat-card,
body[data-theme="anime"] .stat-card,
body[data-theme="steampunk"] .stat-card {
    color: var(--text);
}

body[data-theme="military"] .calendar-day.other-month,
body[data-theme="matrix"] .calendar-day.other-month {
    color: var(--text-muted);
    opacity: 0.75;
}

.nav-section-badge,
.tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: auto;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
}

.nav-section-badge[hidden],
.tab-badge[hidden] {
    display: none !important;
}

.notification-item {
    cursor: pointer;
}

.notification-item:hover {
    background: var(--bg-panel-light);
}

.dashboard-widget-toggles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 10px 16px;
    margin-bottom: 16px;
}

.dashboard-widget-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 10px 12px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border);
    background: var(--bg-dark);
    cursor: pointer;
}

.dashboard-widget-toggle input {
    width: 18px;
    height: 18px;
    margin: 0;
    flex-shrink: 0;
}

.dashboard-widget-toggle span {
    color: var(--text);
    font-size: 0.95rem;
}

.stat-card,
.chart-container,
.chart-box,
.dashboard-admin-month-card,
.dashboard-top-three-card,
#top-debtors-widget {
    position: relative;
    overflow: hidden;
}

.stat-card > *,
.chart-container > *,
.chart-box > *,
.dashboard-admin-month-card > *,
.dashboard-top-three-card > * {
    position: relative;
    z-index: 1;
}

.stat-card::before,
.chart-container::before,
.chart-box::before,
.dashboard-admin-month-card::before,
.dashboard-top-three-card::before,
#top-debtors-widget::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image: var(--theme-art-bg, none);
    background-size: var(--theme-art-bg-size, 280px);
    background-position: right bottom;
    background-repeat: no-repeat;
    opacity: var(--theme-widget-bg-opacity, 0.1);
}

/* Чат */
#page-chat.page.active {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
    min-height: 420px;
    overflow: hidden;
}

.chat-layout {
    display: grid;
    grid-template-columns: minmax(200px, 260px) 1fr;
    gap: 16px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.chat-sidebar {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-lg);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    max-height: 100%;
    overflow-y: auto;
}

.chat-channel-btn,
.chat-peer-btn {
    width: 100%;
    text-align: left;
    border: 1px solid var(--border);
    background: var(--bg-dark);
    color: var(--text);
    border-radius: var(--border-radius);
    padding: 10px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.chat-channel-btn.active,
.chat-peer-btn.active {
    border-color: var(--primary);
    background: var(--bg-panel-light);
}

.chat-nav-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-sidebar-title {
    margin: 8px 0 4px;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.chat-peers-select {
    display: none;
    width: 100%;
    margin: 6px 0 8px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    background: var(--bg-panel-light);
    color: var(--text);
    font-size: 1rem;
}

.chat-peers-search {
    width: 100%;
    margin: 6px 0 8px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    background: var(--bg-panel-light);
    color: var(--text);
    font-size: 0.9rem;
}

.chat-peer-btn--fired {
    opacity: 0.65;
    cursor: pointer;
    border-style: dashed;
}

.chat-peer-fired {
    font-size: 0.75rem;
    color: var(--warning);
}

.chat-peers-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-peer-unread,
.chat-channel-badge {
    background: var(--danger);
    color: #fff;
    font-size: 0.75rem;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 700;
}

.chat-main {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-lg);
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.chat-thread-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}

.chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-message {
    max-width: 85%;
    align-self: flex-start;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px 12px;
}

.chat-message--mine {
    align-self: flex-end;
    border-color: var(--primary);
    background: rgba(0, 240, 255, 0.08);
}

.chat-message-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.chat-message-body {
    white-space: pre-wrap;
    word-break: break-word;
}

.chat-compose {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    border-top: 1px solid var(--border);
    align-items: stretch;
    flex-shrink: 0;
}

.chat-compose textarea {
    flex: 1;
    resize: vertical;
    min-height: 44px;
    max-height: 120px;
    padding: 10px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border);
    background: var(--bg-dark);
    color: var(--text);
}

.notifications-pending-tasks {
    padding: 0 12px 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}

.notifications-pending-title {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 600;
}

.notification-pending-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    text-align: left;
    border: none;
    background: var(--bg-dark);
    color: var(--text);
    padding: 8px 10px;
    border-radius: var(--border-radius);
    margin-bottom: 4px;
    cursor: pointer;
}

.notification-pending-item:hover {
    background: var(--bg-panel-light);
}

.notification-pending-count {
    color: var(--primary);
    font-weight: 700;
}

@media (max-width: 768px) {
    #page-chat.page.active {
        height: calc(100dvh - 96px);
        min-height: 0;
    }

    .chat-layout {
        grid-template-columns: 1fr;
    }

    .chat-sidebar {
        max-height: 180px;
    }
}

.dashboard-legal-gate {
    margin-bottom: 16px;
}

.dashboard-legal-gate__card {
    background: var(--bg-panel, #1a1f3a);
    border: 1px solid var(--border, #2d3a66);
    border-radius: var(--border-radius-lg, 12px);
    padding: 20px;
    text-align: center;
}

.dashboard-legal-gate__card h2 {
    margin: 0 0 8px;
    font-size: 1.1rem;
}

.shift-page-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 14px;
}

.shift-close-other-hint {
    margin: 0 0 14px;
    padding: 10px 14px;
    border-radius: var(--border-radius-lg, 12px);
    border: 1px solid var(--primary, #00f0ff);
    background: color-mix(in srgb, var(--primary, #00f0ff) 10%, var(--bg-panel, #1a1f3a));
    font-size: 0.9rem;
}

.close-other-shift-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.close-other-shift-list .close-other-shift-item {
    text-align: left;
}

.open-shift-banner {
    padding: 10px 14px;
    border-radius: var(--border-radius, 8px);
    margin-bottom: 12px;
    border: 1px solid var(--border, #2d3a66);
}

.open-shift-banner--active {
    background: rgba(0, 240, 255, 0.08);
    border-color: rgba(0, 240, 255, 0.35);
}

.open-shift-banner--blocked {
    background: rgba(255, 120, 80, 0.1);
    border-color: rgba(255, 120, 80, 0.4);
}

.open-shift-banner--hint {
    background: rgba(255, 200, 0, 0.08);
    border-color: rgba(255, 200, 0, 0.35);
}

.open-shift-banner .open-shift-banner__btn {
    margin-left: 8px;
    vertical-align: middle;
}

.open-shift-banner--active .open-shift-banner__btn,
.open-shift-banner--blocked .open-shift-banner__btn,
.open-shift-banner--hint .open-shift-banner__btn {
    color: var(--bg-dark);
}

.open-shift-banner--blocked .btn-warning.open-shift-banner__btn {
    color: #1a1208;
}

/* Аналитика (Master Admin) */
.analytics-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.analytics-custom-range {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.analytics-custom-range input[type="date"] {
    min-height: 38px;
    padding: 6px 10px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border);
    background: var(--bg-dark);
    color: var(--text);
}

.analytics-period-label {
    margin: 0 0 16px;
    font-size: 0.9rem;
}

.analytics-email-summary {
    margin-bottom: 12px;
}

.analytics-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.analytics-chart-wrap {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-lg);
    padding: 16px;
    margin-bottom: 24px;
    height: 300px;
    position: relative;
}

.analytics-chart-wrap canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.analytics-section-title {
    margin: 24px 0 12px;
    font-size: 1.1rem;
    color: var(--primary);
}

.analytics-unused-list {
    margin: 0;
    padding-left: 1.2rem;
    color: var(--text-muted);
}

.analytics-unused-list li {
    margin-bottom: 6px;
}

.analytics-visit-hint {
    margin: -4px 0 12px;
    font-size: 0.9rem;
}

.analytics-email-body-cell {
    max-width: 360px;
}

.analytics-email-body-preview {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.9em;
    margin-bottom: 6px;
}

.analytics-email-body-full {
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 280px;
    overflow: auto;
    font-size: 0.85em;
    margin-top: 8px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.visit-log-table .visit-log-expand-cell {
    width: 36px;
    text-align: center;
    vertical-align: middle;
}

.visit-log-expand {
    min-width: 28px;
    padding: 2px 6px;
    font-size: 1rem;
    line-height: 1;
}

.visit-log-detail td {
    background: rgba(0, 0, 0, 0.15);
    border-top: none;
    padding: 0 12px 12px;
}

.visit-log-detail-inner {
    padding: 10px 12px 4px 40px;
    border-left: 2px solid var(--primary);
}

.visit-log-actions {
    margin: 0;
    padding: 0;
    list-style: none;
}

.visit-log-actions li {
    padding: 4px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.92rem;
}

.visit-log-actions li:last-child {
    border-bottom: none;
}

.visit-log-action-time {
    display: inline-block;
    min-width: 118px;
    margin-right: 8px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.visit-log-empty {
    margin: 0;
    padding: 8px 0 8px 28px;
}

.visit-client-type {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.78rem;
    line-height: 1.35;
    white-space: nowrap;
    border: 1px solid var(--border);
    background: var(--bg-panel-light, var(--bg-panel));
    color: var(--text);
}

.visit-client-type--pwa {
    border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
    color: var(--primary);
}

.visit-client-type--browser {
    border-color: color-mix(in srgb, var(--secondary) 35%, var(--border));
}

.visit-client-type--unknown {
    color: var(--text-muted);
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.chat-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-shrink: 0;
}

.chat-page-header h1 {
    margin: 0;
}

.announcement-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 11000;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(4px);
    padding: 20px;
    align-items: center;
    justify-content: center;
}

.announcement-overlay.active {
    display: flex;
}

.announcement-view-card {
    width: min(560px, 100%);
    max-height: min(85vh, 720px);
    overflow-y: auto;
    background: var(--bg-panel);
    border: 2px solid var(--primary);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg), var(--glow);
    padding: 24px;
}

.announcement-view-card h2 {
    margin: 0 0 8px;
    color: var(--primary);
}

.announcement-view-meta {
    margin: 0 0 16px;
    font-size: 0.9rem;
}

.announcement-view-body {
    white-space: pre-wrap;
    line-height: 1.5;
    margin-bottom: 20px;
    max-height: 50vh;
    overflow-y: auto;
}

.announcement-target-fieldset {
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 12px 16px;
    margin: 16px 0;
}

.announcement-target-fieldset legend {
    padding: 0 6px;
    color: var(--text-muted);
}

.announcement-target-option {
    display: block;
    margin-bottom: 8px;
}

.announcement-recipients-list {
    display: grid;
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
    margin-top: 8px;
}

.announcement-recipient-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--bg-dark);
    border-radius: var(--border-radius);
}

.announcement-compose-footer {
    padding: 0;
    margin-top: 16px;
    border-top: none;
}

@media (max-width: 768px) {
    .announcement-overlay {
        padding: 12px;
    }

    .announcement-view-card {
        padding: 18px;
    }
}

/* Подписи меню — чёткий текст на фоновой иллюстрации (без размытой тени) */
.nav-item span:not(.nav-icon):not(.nav-section-badge) {
    flex: 1;
    min-width: 0;
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1.3;
    letter-spacing: 0.01em;
    -webkit-font-smoothing: antialiased;
    text-shadow:
        0 1px 0 rgba(0, 0, 0, 0.65),
        1px 0 0 rgba(0, 0, 0, 0.35),
        -1px 0 0 rgba(0, 0, 0, 0.35);
}

.nav-item.active span:not(.nav-icon):not(.nav-section-badge) {
    font-weight: 600;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
}

.page-title-with-help {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.help-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.65rem;
    height: 1.65rem;
    padding: 0;
    border-radius: 50%;
    border: 1px solid var(--primary);
    background: rgba(0, 240, 255, 0.12);
    color: var(--primary);
    font-weight: 700;
    font-size: 0.85rem;
    line-height: 1;
    cursor: pointer;
}

.help-icon-btn:hover {
    background: rgba(0, 240, 255, 0.25);
}

.help-icon-btn--inline {
    width: 1.35rem;
    height: 1.35rem;
    font-size: 0.75rem;
}

.admin-tab-wrap {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.help-layout {
    display: grid;
    grid-template-columns: minmax(220px, 280px) 1fr;
    gap: 20px;
    align-items: start;
}

.help-toc {
    position: sticky;
    top: 16px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 14px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.help-toc-group h3 {
    margin: 12px 0 8px;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.help-toc-group:first-child h3 {
    margin-top: 0;
}

.help-toc-link {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 10px;
    margin-bottom: 4px;
    border: none;
    border-radius: var(--border-radius);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font-size: 0.92rem;
}

.help-toc-link:hover,
.help-toc-link.active {
    background: var(--bg-dark);
    color: var(--primary);
}

.help-content {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 22px 24px;
}

.help-article h2 {
    margin-top: 0;
}

.help-intro {
    font-size: 1.05rem;
    line-height: 1.55;
    color: var(--text-muted);
}

.help-steps {
    line-height: 1.6;
    padding-left: 1.5rem;
    list-style: decimal;
}

.help-steps li {
    margin-bottom: 8px;
    padding-left: 0.25rem;
}

.help-screenshots {
    display: grid;
    gap: 16px;
    margin: 18px 0 22px;
    justify-items: start;
}

.help-screenshot {
    margin: 0;
    width: 100%;
    max-width: 800px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    background: var(--bg-dark);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
}

.help-screenshot img {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
}

.help-screenshot figcaption {
    padding: 10px 14px;
    font-size: 0.88rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    background: var(--bg-panel);
}

.help-flow-wrap {
    margin: 20px 0 24px;
    padding: 16px 18px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-lg);
}

.help-flow-heading,
.help-flow-wrap > h3 {
    margin: 0 0 14px;
    font-size: 1rem;
    font-weight: 600;
}

.help-flow {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
}

.help-flow-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
}

.help-flow-num {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--primary);
    color: var(--bg-dark);
    font-size: 0.85rem;
    font-weight: 700;
}

.help-flow-text {
    flex: 1;
    font-size: 0.95rem;
    line-height: 1.45;
    padding-top: 3px;
}

.help-flow-hint {
    display: block;
    margin-top: 4px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.help-flow-arrow {
    width: 2px;
    height: 14px;
    margin: 2px auto 2px 25px;
    background: var(--primary);
    opacity: 0.55;
    position: relative;
}

.help-flow-arrow::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--primary);
    opacity: 0.85;
}

@media (max-width: 600px) {
    .help-flow-arrow {
        margin-left: 22px;
    }
}

.help-tips {
    margin-top: 20px;
    padding: 14px 16px;
    background: var(--bg-dark);
    border-radius: var(--border-radius);
    border-left: 3px solid var(--primary);
}

.help-changelog-current {
    margin: 12px 0 20px;
}

.help-changelog-timeline {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.help-changelog-release {
    padding: 16px 18px;
    background: var(--bg-panel-light);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
}

.help-changelog-version {
    margin: 0 0 12px;
    font-size: 1.15rem;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
}

.help-changelog-date {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--text-muted);
}

.help-changelog-type {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 8px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--primary) 18%, transparent);
    color: var(--primary);
}

.help-changelog-category {
    margin-top: 10px;
}

.help-changelog-category h4 {
    margin: 0 0 6px;
    font-size: 0.92rem;
    color: var(--primary);
}

.help-changelog-category--added h4 { color: #00c853; }
.help-changelog-category--fixed h4 { color: #ff9800; }
.help-changelog-category--removed h4 { color: #f44336; }
.help-changelog-category--security h4 { color: #e91e63; }

.help-changelog-list {
    margin: 0;
    padding-left: 1.25rem;
}

.help-changelog-list li {
    margin-bottom: 4px;
    line-height: 1.45;
}

.help-changelog-empty {
    margin: 0;
    font-size: 0.9rem;
}

.help-illustration {
    margin: 18px 0;
}

.help-illustration-screen {
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    overflow: hidden;
    background: var(--bg-dark);
}

.help-illustration-bar {
    padding: 10px 14px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}

.help-illustration-body {
    padding: 16px;
    display: grid;
    gap: 10px;
}

.help-illustration-block {
    height: 14px;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--border), transparent);
}

.help-illustration-block.short {
    width: 55%;
}

.help-illustration-caption {
    margin: 6px 0 0;
    font-size: 0.82rem;
    color: var(--text-muted);
    text-align: center;
}

.help-page-lead {
    margin-bottom: 18px;
}

@media (max-width: 900px) {
    .help-layout {
        grid-template-columns: 1fr;
    }

    .help-toc {
        position: static;
        max-height: none;
    }
}

.chat-compose-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chat-compose-row textarea {
    flex: 1;
}

.chat-emoji-btn {
    flex-shrink: 0;
    font-size: 1.2rem;
    padding: 8px 10px;
}

.chat-emoji-panel[hidden] {
    display: none !important;
}

.chat-emoji-panel:not([hidden]) {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px;
    margin-top: 8px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    max-height: 140px;
    overflow-y: auto;
}

.chat-emoji-item {
    border: none;
    background: transparent;
    font-size: 1.35rem;
    padding: 4px;
    cursor: pointer;
    border-radius: 6px;
}

.chat-emoji-item:hover {
    background: var(--bg-panel);
}

#envelope-print .envelope-sheet {
    background: #fff;
    color: #000;
    padding: 12px 12px 16px;
    border: 1px solid #ccc;
    overflow: visible;
}

/* Онбординг — интерактивное обучение */
.vooca-onboarding-overlay {
    position: fixed;
    inset: 0;
    z-index: 12000;
    pointer-events: none;
    display: none;
}

.vooca-onboarding-overlay.active {
    display: block;
    pointer-events: none;
}

.vooca-onboarding-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4, 8, 20, 0.72);
    pointer-events: none;
}

.vooca-onboarding-spotlight {
    position: fixed;
    border-radius: var(--border-radius, 8px);
    box-shadow:
        0 0 0 9999px rgba(4, 8, 20, 0.72),
        0 0 0 2px var(--primary, #00f0ff),
        var(--glow, 0 0 12px rgba(0, 240, 255, 0.45));
    pointer-events: none;
    transition: top 0.2s ease, left 0.2s ease, width 0.2s ease, height 0.2s ease;
}

.vooca-onboarding-panel {
    position: fixed;
    z-index: 2;
    max-width: min(420px, calc(100vw - 24px));
    background: var(--bg-panel, #1a1f3a);
    border: 1px solid var(--border, #2d3561);
    border-radius: var(--border-radius-lg, 12px);
    padding: 16px 18px;
    box-shadow: var(--shadow-lg, 0 10px 30px rgba(0, 0, 0, 0.5));
    pointer-events: auto;
}

.vooca-onboarding-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.vooca-onboarding-part-badge {
    font-size: 0.85rem;
    color: var(--text-muted, #8892b0);
}

.vooca-onboarding-close {
    background: transparent;
    border: none;
    color: var(--text-muted, #8892b0);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

.vooca-onboarding-step-title {
    margin: 0 0 8px;
    font-size: 1.1rem;
}

.vooca-onboarding-step-text {
    margin: 0 0 12px;
    color: var(--text-muted, #8892b0);
    line-height: 1.45;
}

.vooca-onboarding-progress {
    font-size: 0.8rem;
    color: var(--text-muted, #8892b0);
    margin-bottom: 14px;
}

.vooca-onboarding-actions {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.vooca-onboarding-actions .vooca-onboarding-back {
    background: var(--bg-dark);
    color: var(--text);
    border: 1px solid var(--border);
}

.vooca-onboarding-actions .vooca-onboarding-back:hover:not(:disabled) {
    background: var(--bg-panel-light, var(--bg-panel));
    border-color: var(--primary);
    color: var(--text);
}

.vooca-onboarding-actions .vooca-onboarding-back:disabled {
    opacity: 1;
    color: var(--text-muted);
    background: color-mix(in srgb, var(--bg-dark) 85%, var(--text-muted) 15%);
    border-color: var(--border);
    cursor: not-allowed;
}

.vooca-onboarding-actions .vooca-onboarding-next {
    color: var(--bg-dark);
}

body[data-theme="light"] .vooca-onboarding-actions .vooca-onboarding-next,
body[data-theme="anime"] .vooca-onboarding-actions .vooca-onboarding-next {
    color: #111;
}

.help-page-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.help-page-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

#page-help [data-help-panel][hidden],
#page-help [data-help-panel].help-panel-hidden {
    display: none !important;
}

.help-training-panel {
    margin-top: 0;
}

.help-training-badge {
    display: inline-block;
    margin: 0 0 10px;
    padding: 4px 10px;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 999px;
    background: color-mix(in srgb, var(--primary) 18%, transparent);
    color: var(--primary);
}

.help-training-content {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 22px 24px;
}

.help-training-intro {
    margin-bottom: 20px;
}

.help-training-intro h2 {
    margin: 0 0 8px;
}

.help-onboarding-lead {
    font-size: 0.95rem;
    margin: 0 0 14px;
    line-height: 1.5;
}

.help-training-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.help-training-card {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    text-align: left;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    background: var(--bg-dark);
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.help-training-card:hover {
    border-color: var(--primary);
    background: var(--bg-panel);
}

.help-training-card-icon {
    font-size: 1.6rem;
    line-height: 1;
    flex-shrink: 0;
}

.help-training-card-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.help-training-card-title {
    font-weight: 600;
    font-size: 0.98rem;
}

.help-training-card-action {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 600;
}

.help-training-card-meta {
    font-size: 0.8rem;
    color: var(--text-muted, var(--text));
    opacity: 0.75;
}

.help-training-card-preview {
    font-size: 0.82rem;
    color: var(--text-muted, var(--text));
    opacity: 0.85;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.help-training-card-done {
    font-size: 0.78rem;
    color: var(--success);
    font-weight: 600;
}

.help-training-card.is-done {
    border-color: color-mix(in srgb, var(--success) 45%, var(--border));
}
