/* ============================================================
   oss-web-panel - Design System
   ============================================================
   Единые токены, сетка, типографика и компоненты.
   Палитра: чёрный фон и оттенки розового. Мобильная версия
   поддерживается media-правилами в конце файла.
   ============================================================ */

/* ---------- Animations ---------- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

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

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

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

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.6; }
}

@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ---------- Design tokens (Dark / Default: черный и оттенки, розовый цвет иконки сайта #fd60c9 и его оттенки, белый и оттенки) ---------- */
:root,
html[data-theme="dark"] {
    --bg-page: #000000;
    --bg-gradient: radial-gradient(circle at 18% 15%, rgba(253, 96, 201, 0.08) 0%, transparent 45%), radial-gradient(circle at 82% 80%, rgba(224, 74, 168, 0.05) 0%, transparent 45%), #000000;
    --bg-surface: #0a0a0d;
    --bg-surface-1: #0e0e13;
    --bg-surface-2: #121217;
    --bg-surface-3: #1a1a22;
    --bg-surface-elevated: #16161d;

    --text-primary: #ffffff;
    --text-secondary: #e2e8f0;
    --text-tertiary: #94a3b8;
    --text-inverse: #000000;

    /* Розовый акцент: брендовый цвет иконки сайта #fd60c9 и его гармоничные оттенки */
    --primary: #fd60c9;
    --primary-hover: #fe82d5;
    --primary-active: #e04aa8;
    --primary-gradient: linear-gradient(135deg, #fd60c9 0%, #ff8fe0 100%);
    --primary-soft: rgba(253, 96, 201, 0.12);
    --primary-glow: 0 0 16px rgba(253, 96, 201, 0.35);

    /* Статусы в гармоничных оттенках розового иконки сайта */
    --status-new: #fd60c9;
    --status-new-bg: rgba(253, 96, 201, 0.14);
    --status-progress: #e04aa8;
    --status-progress-bg: rgba(224, 74, 168, 0.14);
    --status-done: #ff8fe0;
    --status-done-bg: rgba(255, 143, 224, 0.14);
    --status-transferred: #c95cb3;
    --status-transferred-bg: rgba(201, 92, 179, 0.14);
    --status-anon: #a1a1aa;
    --status-anon-bg: rgba(161, 161, 170, 0.14);

    --danger: #e04a75;
    --danger-bg: rgba(224, 74, 117, 0.14);
    --danger-soft: rgba(224, 74, 117, 0.16);
    --success: #fd60c9;
    --success-bg: rgba(253, 96, 201, 0.14);
    --warning: #eab308;
    --warning-soft: rgba(234, 179, 8, 0.15);

    --line: #202028;
    --line-strong: #2e2e3a;
    --border-color: #202028;
    --color-muted: #94a3b8;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.8);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.85);
    --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.9);

    /* Полустеклянные карточки (Frosted Glass / Glassmorphism) */
    --bg-glass: rgba(10, 10, 14, 0.85);
    --bg-glass-card: rgba(14, 14, 18, 0.78);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-glass-hover: rgba(253, 96, 201, 0.35);
    --glass-blur: blur(18px) saturate(190%);
    --glass-shadow: 0 10px 32px 0 rgba(0, 0, 0, 0.6), inset 0 1px 1px 0 rgba(255, 255, 255, 0.12), inset 0 0 20px 0 rgba(253, 96, 201, 0.03);

    --r-xs: 4px;
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-full: 9999px;
}

/* ---------- Светлая тема (Light Mode: белый и оттенки, розовый иконки сайта и его оттенки, шрифт черный и оттенки) ---------- */
html[data-theme="light"] {
    --bg-page: #ffffff;
    --bg-gradient: radial-gradient(circle at 18% 15%, rgba(253, 96, 201, 0.05) 0%, transparent 45%), radial-gradient(circle at 82% 80%, rgba(216, 43, 153, 0.03) 0%, transparent 45%), #ffffff;
    --bg-surface: #ffffff;
    --bg-surface-1: #f8fafc;
    --bg-surface-2: #f8fafc;
    --bg-surface-3: #f1f5f9;
    --bg-surface-elevated: #f1f5f9;

    --text-primary: #09090b;
    --text-secondary: #27272a;
    --text-tertiary: #52525b;
    --text-inverse: #ffffff;

    /* Розовый акцент: контрастные оттенки розового иконки для белого фона */
    --primary: #d82b99;
    --primary-hover: #b81b7e;
    --primary-gradient: linear-gradient(135deg, #d82b99 0%, #e04aa8 100%);
    --primary-soft: rgba(253, 96, 201, 0.10);
    --primary-glow: 0 4px 14px rgba(216, 43, 153, 0.20);

    /* Статусы в гармоничных оттенках */
    --status-new: #d82b99;
    --status-new-bg: rgba(253, 96, 201, 0.10);
    --status-progress: #b81b7e;
    --status-progress-bg: rgba(184, 27, 126, 0.10);
    --status-done: #941362;
    --status-done-bg: rgba(148, 19, 98, 0.10);
    --status-transferred: #a62074;
    --status-transferred-bg: rgba(166, 32, 116, 0.10);
    --status-anon: #71717a;
    --status-anon-bg: rgba(113, 113, 122, 0.08);

    --danger: #be185d;
    --danger-bg: rgba(190, 24, 93, 0.10);
    --danger-soft: rgba(190, 24, 93, 0.12);
    --success: #d82b99;
    --success-bg: rgba(253, 96, 201, 0.10);
    --warning: #b45309;
    --warning-soft: rgba(180, 83, 9, 0.12);

    --line: #e2e8f0;
    --line-strong: #cbd5e1;
    --border-color: #e2e8f0;
    --color-muted: #52525b;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.07), 0 1px 3px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.09), 0 3px 8px rgba(0, 0, 0, 0.04);

    /* Полустеклянные карточки для светлой темы */
    --bg-glass: rgba(255, 255, 255, 0.94);
    --bg-glass-card: rgba(255, 255, 255, 0.90);
    --border-glass: rgba(0, 0, 0, 0.08);
    --border-glass-hover: rgba(216, 43, 153, 0.35);
    --glass-blur: blur(16px) saturate(180%);
    --glass-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.05), 0 2px 6px -1px rgba(216, 43, 153, 0.03), inset 0 1px 1px 0 #ffffff;
}

/* ---------- Reset & base ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
}

/* ---------- Modern Dark Scrollbars ---------- */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--line-strong) transparent;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--line-strong);
    border-radius: var(--r-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

::-webkit-scrollbar-corner {
    background: transparent;
}

body {
    font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-primary);
    background: var(--bg-gradient);
    background-color: var(--bg-page);
    background-attachment: fixed;
    min-height: 100vh;
    position: relative;
    animation: fadeInSlow 0.5s ease-out;
}

body::before,
body::after {
    content: "";
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    filter: blur(90px);
}

:root body::before,
html[data-theme="dark"] body::before {
    width: 450px;
    height: 450px;
    top: -50px;
    right: 5%;
    background: radial-gradient(circle, rgba(255, 77, 157, 0.18) 0%, transparent 70%);
}

:root body::after,
html[data-theme="dark"] body::after {
    width: 500px;
    height: 500px;
    bottom: -50px;
    left: 10%;
    background: radial-gradient(circle, rgba(214, 93, 177, 0.12) 0%, transparent 70%);
}

html[data-theme="light"] body::before {
    width: 450px;
    height: 450px;
    top: -50px;
    right: 5%;
    background: radial-gradient(circle, rgba(244, 114, 182, 0.12) 0%, transparent 70%);
}

html[data-theme="light"] body::after {
    width: 480px;
    height: 480px;
    bottom: -50px;
    left: 10%;
    background: radial-gradient(circle, rgba(251, 113, 133, 0.08) 0%, transparent 70%);
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.user-vk-link,
.ticket-user-link {
    color: var(--primary, #fd60c9) !important;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.user-vk-link:hover,
.ticket-user-link:hover {
    color: var(--primary-hover, #fe82d5) !important;
    text-shadow: 0 0 10px rgba(253, 96, 201, 0.6);
    text-decoration: underline;
}

.user-vk-name {
    color: var(--primary, #fd60c9) !important;
    font-weight: 600;
}

@keyframes rowGlowPink {
    0% { background-color: rgba(253, 96, 201, 0.28); }
    100% { background-color: transparent; }
}

.ticket-row-updated {
    animation: rowGlowPink 2.5s ease-out;
}

button:disabled,
button[disabled] {
    cursor: not-allowed;
    opacity: 0.6;
}

h1, h2, h3, h4 {
    line-height: 1.25;
    color: var(--text-primary);
}

code {
    background: var(--bg-surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-xs);
    padding: 1px 6px;
    font-size: 0.9em;
    color: var(--text-primary);
}

/* ---------- Layout ---------- */
.container {
    display: flex;
    min-height: 100vh;
    width: 100%;
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    width: 250px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--border-glass);
    padding: 20px 14px;
    gap: 18px;
    overflow-y: auto;
    z-index: 100;
    animation: slideInLeft 0.4s ease-out;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), margin-left 0.3s ease, box-shadow 0.3s ease;
}

/* Свёрнутое состояние боковой панели на десктопе */
.container.sidebar-collapsed .sidebar {
    margin-left: -250px;
}

.sidebar-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
}

.sidebar-top-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.sidebar-theme-btn {
    width: 32px;
    height: 32px;
}

.sidebar-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--r-sm);
    background: var(--bg-surface-2);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    padding: 0;
}

.sidebar-close-btn:hover {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: var(--primary);
}

.main-content {
    flex: 1;
    min-width: 0;
    padding: 24px 28px 48px;
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
    animation: fadeInSlow 0.3s ease-out;
    transition: max-width 0.3s ease, padding 0.3s ease;
}

.container.sidebar-collapsed .main-content {
    max-width: 1440px;
}

/* Верхняя панель навигации (меню, уведомления, тема, быстрые действия) */
.top-nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    margin-bottom: 20px;
    background: var(--bg-surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    position: sticky;
    top: 12px;
    z-index: 105;
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow-sm);
}

@media (min-width: 901px) {
    .container:not(.sidebar-collapsed) .top-nav-bar .nav-toggle-btn,
    .container:not(.sidebar-collapsed) .top-nav-bar .mobile-brand {
        display: none !important;
    }
}

.top-nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mobile-nav-toggle,
.nav-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-surface-2);
    border: 1px solid var(--line-strong);
    color: var(--text-primary);
    border-radius: var(--r-sm);
    padding: 7px 14px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-nav-toggle:hover,
.nav-toggle-btn:hover {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: var(--primary);
}

.nav-icon {
    font-size: 16px;
    line-height: 1;
}

.mobile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 800;
    font-size: 15px;
}

.mobile-brand:hover {
    text-decoration: none;
}

.monogram-sm {
    width: 28px;
    height: 28px;
    font-size: 12px;
    border-radius: var(--r-xs);
}

.mobile-user-badge {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    background: var(--bg-surface-2);
    padding: 4px 10px;
    border-radius: var(--r-full);
    border: 1px solid var(--line);
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Затемнение фона при открытом меню */
.mobile-menu-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 95;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.mobile-menu-backdrop.is-active {
    opacity: 1;
    pointer-events: auto;
}

body.no-scroll {
    overflow: hidden;
}

/* ---------- Sidebar ---------- */
.sidebar-header {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    text-decoration: none;
}

.brand:hover {
    text-decoration: none;
}

.monogram {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--r-sm);
    background: #fd60c9 url('/static/logo_squircle.png') no-repeat center / cover;
    color: transparent;
    font-weight: 800;
    font-size: 0;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(253, 96, 201, 0.3);
}

.brand-name {
    display: block;
    font-weight: 800;
    font-size: 15px;
    line-height: 1.2;
}

.brand-sub {
    display: block;
    color: var(--text-tertiary);
    font-size: 12px;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px;
    background: var(--bg-surface-2);
    border: 1px solid var(--border-glass);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.user-info-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--primary-soft);
    border: 1px solid var(--border-glass-hover);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    flex-shrink: 0;
}

.user-info-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.user-name {
    font-weight: 700;
    font-size: 13.5px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.user-role-badge {
    display: inline-block;
    align-self: flex-start;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 8px;
    border-radius: var(--r-full);
    background: var(--primary-soft);
    color: var(--primary);
    letter-spacing: 0.02em;
}

.user-dept {
    font-size: 12px;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-info-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
}

.btn-user-action {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: var(--r-sm);
    background: var(--bg-surface);
    border: 1px solid var(--line);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.btn-user-action:hover {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: var(--primary);
    text-decoration: none;
}

.btn-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border: 1px solid transparent;
    background: var(--danger-bg);
    color: var(--danger);
    font-weight: 600;
    font-size: 12px;
    padding: 6px 8px;
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    background: var(--danger);
    color: #ffffff;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    padding: 14px 10px 6px;
}

.nav-section-title-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 6px 6px 10px;
    gap: 8px;
}

.nav-section-title-wrap .nav-label {
    padding: 0;
    margin: 0;
}

.btn-sidebar-notif {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 28px;
    height: 28px;
    border-radius: var(--r-sm);
    border: 1px solid var(--line-strong);
    background: var(--bg-surface-2);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-sidebar-notif:hover,
.btn-sidebar-notif.active {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: var(--primary);
    transform: translateY(-1px);
}

.sidebar-notif-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    background: var(--primary);
    color: var(--text-inverse);
    font-size: 10px;
    font-weight: 700;
    line-height: 17px;
    border-radius: var(--r-full);
    text-align: center;
    box-shadow: 0 0 6px var(--primary-glow);
}

.sidebar-notif-badge.hidden,
.notifications-badge.hidden,
.hidden,
[hidden] {
    display: none !important;
}

/* ---------- Модальное окно Центра уведомлений (отдельное окно) ---------- */
.notifications-modal-content {
    max-width: 540px;
    width: 100%;
    padding: 24px 26px;
}

.notifications-modal-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.notif-bell-icon-wrap {
    width: 38px;
    height: 38px;
    border-radius: var(--r-sm);
    background: var(--primary-soft);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 0 10px var(--primary-glow);
}

.notifications-modal-sub {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.notifications-modal-list {
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 4px;
}

.notifications-modal-list .notifications-item {
    background: var(--bg-surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 12px 14px;
    transition: all 0.2s ease;
}

.notifications-modal-list .notifications-item:hover {
    background: var(--bg-surface-3);
    border-color: var(--border-glass-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.nav-label-spaced {
    padding-top: 22px;
    border-top: 1px solid var(--line);
    margin-top: 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--r-sm);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 13.5px;
    transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.nav-link:hover {
    background: var(--bg-surface-2);
    color: var(--text-primary);
    text-decoration: none;
    transform: translateX(3px);
}

.nav-link.active {
    background: var(--primary-soft);
    color: var(--primary);
    box-shadow: inset 3px 0 0 var(--primary);
}

.nav-link .ico {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: inherit;
}

.nav-link .ico svg {
    width: 16px;
    height: 16px;
    display: block;
}

.nav-badges-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.nav-badge-flame {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(255, 77, 157, 0.22), rgba(255, 107, 0, 0.25));
    border: 1px solid rgba(255, 107, 0, 0.45);
    color: #ff8533;
    font-size: 11.5px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--r-full);
    line-height: 1.2;
    letter-spacing: 0.02em;
    animation: flamePulse 2.4s infinite ease-in-out;
    box-shadow: 0 0 8px rgba(255, 107, 0, 0.25);
    white-space: nowrap;
}

.nav-badge-reply {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.45);
    color: #60a5fa;
    font-size: 11.5px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--r-full);
    line-height: 1.2;
    letter-spacing: 0.02em;
    animation: replyPulse 2.4s infinite ease-in-out;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.25);
    white-space: nowrap;
}

.nav-badge-partner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    background: rgba(168, 85, 247, 0.2);
    border: 1px solid rgba(168, 85, 247, 0.45);
    color: #c084fc;
    font-size: 11.5px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--r-full);
    line-height: 1.2;
    letter-spacing: 0.02em;
    animation: partnerPulse 2.4s infinite ease-in-out;
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.25);
    white-space: nowrap;
}

@keyframes flamePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 8px rgba(255, 107, 0, 0.25);
    }
    50% {
        transform: scale(1.06);
        box-shadow: 0 0 14px rgba(255, 107, 0, 0.5);
    }
}

@keyframes replyPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 8px rgba(59, 130, 246, 0.25);
    }
    50% {
        transform: scale(1.06);
        box-shadow: 0 0 14px rgba(59, 130, 246, 0.5);
    }
}

@keyframes partnerPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 8px rgba(168, 85, 247, 0.25);
    }
    50% {
        transform: scale(1.06);
        box-shadow: 0 0 14px rgba(168, 85, 247, 0.5);
    }
}

.nav-badge-flame.hidden,
.nav-badge-reply.hidden,
.nav-badge-partner.hidden {
    display: none !important;
}

/* ==========================================
   Центр уведомлений (Top Navigation Dropdown)
   ========================================== */
.notifications-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.btn-notifications {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--r-sm);
    background: var(--bg-surface);
    border: 1px solid var(--line);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.btn-notifications:hover,
.btn-notifications.active {
    background: var(--bg-surface-2);
    border-color: var(--primary);
    color: var(--text-primary);
}

.notifications-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 10.5px;
    font-weight: 800;
    line-height: 1;
    border-radius: var(--r-full);
    background: linear-gradient(135deg, #ff4d9d, #e11d48);
    color: #fff;
    border: 2px solid var(--bg-page);
    box-shadow: 0 2px 6px rgba(255, 77, 157, 0.4);
    animation: flamePulse 2s infinite ease-in-out;
}

.notifications-badge.hidden {
    display: none !important;
}

.notifications-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 360px;
    max-width: min(360px, calc(100vw - 32px));
    max-height: calc(100vh - 120px);
    display: none;
    flex-direction: column;
    background: var(--bg-surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 1000;
    animation: fadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
    box-sizing: border-box;
}

@media (min-width: 901px) {
    .container:not(.sidebar-collapsed) .notifications-dropdown {
        /* Адаптивное ограничение по ширине с учётом боковой панели */
        max-width: min(360px, calc(100vw - 280px));
    }
}

@media (max-width: 900px) {
    .notifications-dropdown {
        width: min(360px, calc(100vw - 24px));
        max-width: calc(100vw - 24px);
    }
}

@media (max-width: 480px) {
    .notifications-dropdown {
        width: calc(100vw - 20px);
        max-width: calc(100vw - 20px);
        right: -8px;
    }
}

.notifications-dropdown.active {
    display: flex;
}

.notifications-dropdown-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--line);
    background: var(--bg-surface-2);
}

.notifications-dropdown-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.notifications-dropdown-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.notifications-tags {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.notif-tag {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--r-full);
    white-space: nowrap;
}

.notif-tag-tickets {
    background: rgba(255, 107, 0, 0.15);
    color: #ff8533;
    border: 1px solid rgba(255, 107, 0, 0.3);
}

.notif-tag-replies {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.notif-tag-partner {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.notif-tag.hidden {
    display: none !important;
}

.notifications-items-list {
    flex: 1;
    overflow-y: auto;
    max-height: 340px;
    display: flex;
    flex-direction: column;
}

.notifications-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    text-decoration: none;
    color: inherit;
    transition: background 0.15s ease;
}

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

.notifications-item:hover {
    background: var(--bg-surface-2);
    text-decoration: none;
}

.notifications-item-icon,
.notif-item-icon {
    font-size: 18px;
    flex-shrink: 0;
    line-height: 1.2;
    margin-top: 1px;
}

.notifications-item-content,
.notif-item-body {
    flex: 1;
    min-width: 0;
}

.notifications-item-title-row,
.notif-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.notifications-item-title,
.notif-item-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 6px;
    flex: 1;
    min-width: 0;
}

.notifications-item-badge {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--r-full);
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1.3;
}

.notifications-item-badge.badge-new_ticket {
    background: var(--primary-soft);
    color: var(--primary);
    border: 1px solid rgba(253, 96, 201, 0.4);
}

.notifications-item-badge.badge-student_reply {
    background: rgba(224, 74, 168, 0.16);
    color: #fe82d5;
    border: 1px solid rgba(224, 74, 168, 0.4);
}

.notifications-item-badge.badge-partnership {
    background: rgba(253, 96, 201, 0.16);
    color: #ff8fe0;
    border: 1px solid rgba(253, 96, 201, 0.4);
}

.notifications-item-dept,
.notif-item-dept {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: var(--primary);
    background: var(--bg-surface-3);
    border: 1px solid var(--line-strong);
    padding: 1px 7px;
    border-radius: var(--r-xs);
    margin-bottom: 4px;
    line-height: 1.4;
}

.notifications-item-text,
.notif-item-preview {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 4px;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notifications-item-time,
.notif-item-time {
    font-size: 11px;
    color: var(--text-tertiary);
    display: block;
    margin-top: 2px;
}

.notifications-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 13px;
}

.notifications-loading {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 13px;
}

.notifications-dropdown-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 14px;
    border-top: 1px solid var(--line);
    background: var(--bg-surface-2);
}

.notifications-footer-link {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.notifications-footer-link:hover {
    text-decoration: underline;
}

/* ---------- Page header ---------- */
.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.page-header h1 {
    font-size: 22px;
    font-weight: 800;
}

.crumb {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    margin-bottom: 2px;
}

.page-desc {
    color: var(--text-tertiary);
    margin-top: 2px;
    max-width: 560px;
}

.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: var(--r-md);
    padding: 9px 18px;
    font-size: 13.5px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    background: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--line-strong);
    white-space: nowrap;
    user-select: none;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.btn-primary,
.btn-success {
    background: #fd60c9;
    border: 1px solid rgba(253, 96, 201, 0.8);
    color: #000000;
    box-shadow: 0 2px 10px rgba(253, 96, 201, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    font-weight: 700;
}

.btn-primary:hover,
.btn-success:hover {
    background: #fe82d5;
    border-color: #fe82d5;
    color: #000000;
    transform: translateY(-1.5px);
    box-shadow: 0 5px 18px rgba(253, 96, 201, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.btn-primary:active,
.btn-success:active {
    background: #e04aa8;
    color: #000000;
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(253, 96, 201, 0.2);
}

.btn-secondary {
    background: var(--bg-surface);
    border-color: var(--line-strong);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background: var(--bg-surface-2);
    border-color: var(--primary);
    color: var(--text-primary);
}

html[data-theme="light"] .btn-primary,
html[data-theme="light"] .btn-success {
    background: #d82b99;
    border-color: #d82b99;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(216, 43, 153, 0.25);
    font-weight: 700;
}

html[data-theme="light"] .btn-primary:hover,
html[data-theme="light"] .btn-success:hover {
    background: #b81b7e;
    border-color: #b81b7e;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(216, 43, 153, 0.35);
}

html[data-theme="light"] .btn-secondary {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #09090b;
}

html[data-theme="light"] .btn-secondary:hover {
    background: #f1f5f9;
    border-color: #d82b99;
    color: #d82b99;
}

.btn-danger {
    background: var(--danger-bg);
    border-color: transparent;
    color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    color: #fff;
}

.btn-small {
    padding: 5px 12px;
    font-size: 12.5px;
    border-radius: var(--r-xs);
}

.btn-full {
    width: 100%;
}

/* ---------- Alerts ---------- */
.alert {
    padding: 11px 14px;
    border-radius: var(--r-sm);
    font-size: 13.5px;
    margin-bottom: 16px;
    border: 1px solid transparent;
    animation: fadeIn 0.4s ease-out;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.alert-error {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: rgba(255, 56, 96, 0.25);
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border-color: rgba(255, 126, 179, 0.25);
}

/* ---------- Cards ---------- */
.card {
    background: var(--bg-glass-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-glass);
    border-radius: var(--r-lg);
    box-shadow: var(--glass-shadow);
    padding: 26px 28px;
    margin-bottom: 28px;
    overflow: hidden;
    animation: fadeIn 0.6s ease-out 0.15s both;
    transition: box-shadow 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}

.card:hover {
    box-shadow: var(--shadow-md), 0 0 20px rgba(255, 77, 157, 0.08);
    border-color: var(--border-glass-hover);
}

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

.card-header h2 {
    font-size: 18px;
    font-weight: 800;
    line-height: 1.35;
}

/* ---------- Stats grid ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-glass-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-glass);
    border-radius: var(--r-lg);
    padding: 22px 24px;
    box-shadow: var(--glass-shadow);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease, background 0.25s ease;
    animation: scaleIn 0.5s ease-out both;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-soft);
}

.stat-card h3 {
    color: var(--text-tertiary);
    font-size: 13.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
    line-height: 1.35;
}

.stat-card .value {
    font-size: 32px;
    font-weight: 800;
    line-height: 1.2;
    color: var(--text-primary);
}

.stat-card.yellow h3 { color: var(--status-progress); }
.stat-card.green h3 { color: var(--status-done); }
.stat-card.red h3 { color: var(--danger); }
/* ---------- Tables ---------- */
.table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--bg-surface);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 100%;
}

th {
    text-align: left;
    padding: 13px 16px;
    background: var(--bg-surface-2);
    color: var(--text-tertiary);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
    color: var(--text-primary);
    line-height: 1.45;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr {
    transition: background 0.2s ease, transform 0.15s ease;
}

tbody tr:hover {
    background: var(--bg-surface-2);
    transform: scale(1.005);
}

.td-topic {
    font-weight: 600;
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.td-actions {
    white-space: nowrap;
    text-align: right;
}

/* ---------- Badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--r-full);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.badge-new {
    background: var(--status-new-bg);
    color: var(--status-new);
    animation: pulse 2s ease-in-out infinite;
}

.badge-in-progress {
    background: var(--status-progress-bg);
    color: var(--status-progress);
}

.badge-completed {
    background: var(--status-done-bg);
    color: var(--status-done);
}

.badge-anonymous {
    background: var(--status-anon-bg);
    color: var(--status-anon);
}

.badge-warning {
    background: var(--warning-soft, rgba(234, 179, 8, 0.15));
    color: var(--warning, #eab308);
}

.badge-danger {
    background: var(--danger-soft, rgba(239, 68, 68, 0.15));
    color: var(--danger, #ef4444);
}

.badge-primary {
    background: var(--primary-soft);
    color: var(--primary);
    border: 1px solid var(--primary-soft);
}

.badge-secondary {
    background: var(--bg-surface-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--line);
}

html[data-theme="light"] .badge-secondary {
    background: #f1f5f9;
    color: #27272a;
    border: 1px solid #cbd5e1;
}

.badge-info {
    background: var(--primary-soft);
    color: var(--primary);
}

html[data-theme="light"] .badge-info {
    background: rgba(216, 43, 153, 0.10);
    color: #d82b99;
    border: 1px solid rgba(216, 43, 153, 0.20);
}

html[data-theme="light"] .badge-anonymous {
    background: #f1f5f9;
    color: #52525b;
    border: 1px solid #cbd5e1;
}

/* Обращение без отдела («Общие вопросы»): приглушённый акцент темы,
   чтобы отличать от обычного бейджа отдела, но не пугать. */
.badge-general {
    background: var(--status-transferred-bg);
    color: var(--status-transferred);
    border: 1px dashed var(--status-transferred);
    font-weight: 600;
}

/* Пометка общего обращения в выпадающем центре уведомлений. */
.notifications-item-general {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: var(--status-transferred);
    background: var(--status-transferred-bg);
    border: 1px solid var(--status-transferred-bg);
    padding: 1px 7px;
    border-radius: var(--r-xs);
    white-space: nowrap;
}

/* ---------- Виджет «Общие (без отдела)» на дашборде ---------- */
.unassigned-card {
    margin-bottom: 20px;
}

.unassigned-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 10px;
}

.unassigned-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1 1 180px;
    padding: 14px 18px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--bg-surface-2);
}

.unassigned-stat-alert {
    border-color: var(--status-transferred);
    background: var(--status-transferred-bg);
}

.unassigned-label {
    color: var(--text-tertiary);
    font-size: 12.5px;
    font-weight: 600;
}

.unassigned-value {
    font-size: 26px;
    font-weight: 800;
    line-height: 1.1;
    color: var(--text-primary);
}

.unassigned-hint {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
}

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

/* ---------- Дашборд: обновлённая композиция ---------- */
/* Структура: hero-строка с приветствием и статусом системы, затем сетка
   метрик (разного веса), затем «ленты» — общие обращения и последние заявки. */
.dash-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    padding: 22px 26px;
    margin-bottom: 20px;
    border: 1px solid var(--line);
    border-radius: var(--r-lg, 16px);
    background:
        linear-gradient(135deg, var(--primary, #fd60c9) 0%, transparent 55%),
        var(--bg-surface-2);
    position: relative;
    overflow: hidden;
}
.dash-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--bg-surface-2);
    opacity: 0.82;
    pointer-events: none;
}
.dash-hero > * {
    position: relative;
    z-index: 1;
}
.dash-hero-title {
    font-size: 21px;
    font-weight: 800;
    margin: 0 0 6px;
    line-height: 1.25;
}
.dash-hero-sub {
    color: var(--text-secondary);
    font-size: 13.5px;
    margin: 0;
}
.dash-hero-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Метрики: первая карточка крупнее остальных — задаёт иерархию. */
.dash-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.dash-metric {
    position: relative;
    padding: 18px 20px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--bg-surface-2);
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: transform 0.2s ease, border-color 0.2s ease;
}
a.dash-metric:hover {
    transform: translateY(-2px);
    border-color: var(--user-accent, var(--primary));
    text-decoration: none;
}
.dash-metric-head {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-tertiary);
    font-size: 12.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.dash-metric-value {
    font-size: 30px;
    font-weight: 800;
    line-height: 1.05;
    color: var(--text-primary);
}
.dash-metric-accent {
    position: absolute;
    inset: auto 0 0 0;
    height: 3px;
    background: var(--user-accent, var(--primary));
    opacity: 0.85;
}
.dash-metric[data-tone="warn"] .dash-metric-value { color: var(--status-transferred); }
.dash-metric[data-tone="danger"] .dash-metric-value { color: var(--danger); }
.dash-metric[data-tone="ok"] .dash-metric-value { color: var(--status-done); }

/* Две колонки: общие обращения слева, лента заявок справа. */
.dash-columns {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(0, 1.6fr);
    gap: 18px;
    align-items: start;
}
@media (max-width: 900px) {
    .dash-columns {
        grid-template-columns: 1fr;
    }
}

.dash-list {
    display: flex;
    flex-direction: column;
}
.dash-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid var(--line);
    color: var(--text-secondary);
    font-size: 13.5px;
}
.dash-list-item:last-child {
    border-bottom: none;
}
.dash-list-item .icon {
    color: var(--text-tertiary);
}
.dash-list-item-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dash-list-item-value {
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}
.dash-list-item.is-alert .dash-list-item-value {
    color: var(--status-transferred);
}
.dash-list-item.is-alert .icon {
    color: var(--status-transferred);
}

/* ---------- Forms ---------- */
.form-group {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-weight: 600;
    font-size: 13.5px;
    color: var(--text-secondary);
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="datetime-local"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-sm);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
    background: var(--bg-surface-2);
}

textarea {
    resize: vertical;
}

input::placeholder,
textarea::placeholder {
    color: var(--text-tertiary);
    opacity: 0.85;
}

.input-full {
    width: 100%;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.checkbox-label input {
    width: auto;
}

.filter-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 16px;
}

.filter-bar input[type="text"],
.filter-bar select {
    width: auto;
    min-width: 180px;
    flex: 1;
}

.filter-bar .btn {
    flex-shrink: 0;
}
/* ---------- Pagination ---------- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 0 4px;
    flex-wrap: wrap;
}

.page-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
    padding: 6px 13px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-sm);
    transition: background 0.12s;
}

.page-link:hover {
    background: var(--primary-soft);
    text-decoration: none;
}

.page-info {
    color: var(--text-tertiary);
    font-size: 12.5px;
}

.tickets-count {
    padding: 12px 0 2px;
    font-size: 12.5px;
    color: var(--text-tertiary);
}

/* ---------- Muted / empty ---------- */
.muted {
    color: var(--text-tertiary);
}

.empty-state {
    text-align: center;
    padding: 40px 20px !important;
    color: var(--text-tertiary);
}

.grid-full {
    grid-column: 1 / -1;
}

.dashboard-note {
    color: var(--text-secondary);
    line-height: 1.8;
}

/* ---------- Modal ---------- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(8, 8, 14, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 6vh 16px 32px;
    z-index: 9999;
    overflow-y: auto;
    box-sizing: border-box;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-surface-elevated, var(--bg-glass-card));
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-glass);
    border-radius: var(--r-lg);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65), var(--glass-shadow);
    width: 100%;
    max-width: 580px;
    padding: 26px 28px;
    margin: auto;
    animation: scaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    z-index: 10000;
}

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

.modal-header h3 {
    font-size: 19px;
    font-weight: 800;
    line-height: 1.35;
}

.close-btn {
    border: 1px solid var(--line);
    background: var(--bg-surface-2);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: var(--r-sm);
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.close-btn:hover {
    background: var(--bg-surface-3);
    color: var(--text-primary);
    border-color: var(--line-strong);
}

/* ---------- Карточка шаблонов импорта и поле загрузки файла ---------- */
.template-download-card {
    background: var(--bg-surface-2);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-sm);
    padding: 12px 14px;
    margin-bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.template-download-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
}

.template-download-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.template-download-buttons .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.file-dropzone {
    position: relative;
    border-radius: var(--r-sm);
}

.file-input-field,
input[type="file"] {
    display: block;
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg-surface-2);
    border: 1px dashed var(--line-strong);
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.file-input-field:hover,
input[type="file"]:hover {
    border-color: var(--primary);
    background: var(--bg-surface-3);
    color: var(--text-primary);
}

.file-input-field::file-selector-button,
input[type="file"]::file-selector-button {
    background: var(--bg-surface-3);
    color: var(--text-primary);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-xs);
    padding: 6px 12px;
    margin-right: 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.file-input-field::file-selector-button:hover,
input[type="file"]::file-selector-button:hover {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: var(--primary);
}

.form-hint {
    color: var(--text-tertiary);
    font-size: 12px;
    display: block;
    margin-top: 5px;
    line-height: 1.4;
}

/* ---------- Ticket detail (modal body) ---------- */
.detail-block {
    margin-bottom: 12px;
    font-size: 13.5px;
    color: var(--text-secondary);
}

.detail-block strong {
    color: var(--text-primary);
}

.detail-box {
    margin-top: 4px;
    padding: 10px 12px;
    background: var(--bg-surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    white-space: pre-wrap;
}

.detail-box-response {
    background: var(--success-bg);
    border-color: rgba(255, 126, 179, 0.3);
}

.detail-form {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ---------- Ticket dialogue & chat styles ---------- */
.modal-content.modal-ticket-lg {
    max-width: 880px;
    width: 95%;
    padding: 28px 32px;
}

.ticket-header-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px 20px;
    background: var(--bg-surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 18px 22px;
    margin-bottom: 20px;
    font-size: 14px;
}

.ticket-header-summary .summary-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ticket-header-summary .summary-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    line-height: 1.3;
}

.ticket-header-summary .summary-value {
    font-weight: 600;
    font-size: 14.5px;
    line-height: 1.45;
    color: var(--text-primary);
}

.ticket-chat-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 480px;
    min-height: 240px;
    overflow-y: auto;
    padding: 22px 24px;
    background: var(--bg-surface-1);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    margin-bottom: 18px;
    scroll-behavior: smooth;
}

.chat-bubble {
    max-width: 82%;
    padding: 14px 18px;
    border-radius: 16px;
    font-size: 14.5px;
    line-height: 1.55;
    position: relative;
    word-break: break-word;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    animation: fadeIn 0.2s ease-out;
}

.chat-bubble-user {
    align-self: flex-start;
    background: var(--bg-surface-2);
    border: 1px solid var(--line);
    border-bottom-left-radius: 4px;
    color: var(--text-primary);
}

.chat-bubble-admin {
    align-self: flex-end;
    background: var(--primary);
    color: var(--text-inverse);
    border-bottom-right-radius: 4px;
}

.chat-bubble-admin .chat-bubble-header,
.chat-bubble-admin .chat-bubble-time {
    color: var(--text-inverse);
    opacity: 0.85;
}

.chat-bubble-system {
    align-self: center;
    background: var(--bg-surface-2);
    border: 1px dashed var(--line);
    border-radius: 20px;
    padding: 8px 18px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-secondary);
    text-align: center;
    max-width: 90%;
}

.chat-bubble-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 12.5px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.chat-bubble-time {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-tertiary);
}

.chat-bubble-text {
    white-space: pre-wrap;
    line-height: 1.55;
}

.chat-input-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 16px 20px;
    margin-bottom: 18px;
}

.chat-input-textarea {
    width: 100%;
    min-height: 84px;
    max-height: 180px;
    resize: vertical;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    padding: 12px 14px;
    background: var(--bg-surface-1);
    color: var(--text-primary);
    font-size: 14.5px;
    font-family: inherit;
    line-height: 1.5;
}

.chat-input-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-soft);
}

.chat-input-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 14px;
}

.chat-send-shortcut-hint {
    font-size: 12px;
    color: var(--text-tertiary);
}

.ticket-management-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    font-size: 14px;
}

.ticket-management-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.ticket-action-form {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.ticket-action-label {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-secondary);
}

.ticket-action-select {
    padding: 6px 12px;
    font-size: 13.5px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--bg-surface-1);
    color: var(--text-primary);
}

/* ---------- Admins ---------- */
.admins-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
}

.admin-card {
    background: var(--bg-surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    animation: scaleIn 0.5s ease-out both;
}

.admin-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-soft);
}

.admin-card:nth-child(1) { animation-delay: 0.05s; }
.admin-card:nth-child(2) { animation-delay: 0.1s; }
.admin-card:nth-child(3) { animation-delay: 0.15s; }
.admin-card:nth-child(4) { animation-delay: 0.2s; }
.admin-card:nth-child(5) { animation-delay: 0.25s; }

.admin-card-top {
    display: flex;
    align-items: center;
    gap: 14px;
}

.admin-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--r-full);
    background: var(--primary-soft);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 17px;
    flex-shrink: 0;
}

.admin-card-top-info {
    min-width: 0;
}

.admin-name {
    font-weight: 700;
    font-size: 15.5px;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-vk {
    color: var(--text-tertiary);
    font-size: 13px;
    margin-top: 2px;
}

.admin-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.admin-dept {
    color: var(--text-tertiary);
    font-size: 13px;
}

.admin-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--line);
    padding-top: 14px;
    gap: 10px;
    flex-wrap: wrap;
}

.admin-card-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.admin-id {
    color: var(--text-tertiary);
    font-size: 12.5px;
    font-weight: 600;
}

/* ---------- Индикатор активности администратора (Онлайн / Офлайн / Истёк) ---------- */

/* Обёртка нужна, чтобы точка позиционировалась относительно аватара,
   а не карточки: карточка растягивается, точка «уезжала» бы от аватара. */
.admin-avatar-wrap {
    position: relative;
    flex-shrink: 0;
    line-height: 0;
}

/* Точка «висит» на правом нижнем углу аватара — как в мессенджерах. */
.admin-avatar-wrap .status-dot {
    position: absolute;
    right: -2px;
    bottom: -2px;
    z-index: 1;
}

.status-dot {
    display: inline-block;
    width: 11px;
    height: 11px;
    border-radius: var(--r-full);
    border: 2px solid var(--bg-surface-2);
    background: var(--text-tertiary);
    flex-shrink: 0;
}

.status-dot-online {
    background: var(--status-done);
    box-shadow: 0 0 0 2px var(--status-done-bg);
    /* Мягкая пульсация: индикатор «дышит», привлекая внимание без мигания. */
    animation: statusPulse 2.4s ease-in-out infinite;
}

.status-dot-offline {
    background: var(--status-anon);
    box-shadow: 0 0 0 2px var(--status-anon-bg);
}

.status-dot-expired {
    background: var(--danger);
    box-shadow: 0 0 0 2px var(--danger-bg);
}

@keyframes statusPulse {
    0%, 100% { opacity: 1;   transform: scale(1); }
    50%      { opacity: 0.6; transform: scale(0.88); }
}

/* Уважаем системную настройку «уменьшить движение»: оставляем цвет,
   отключаем только анимацию. */
@media (prefers-reduced-motion: reduce) {
    .status-dot-online {
        animation: none;
    }
}

.admin-last-seen {
    color: var(--text-tertiary);
    font-size: 12.5px;
    flex-basis: 100%;
}

.presence-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 20px;
    padding: 12px 18px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--bg-surface-2);
    color: var(--text-secondary);
    font-size: 14px;
}

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

/* Кнопка, заблокированная для временного администратора: не прячем её,
   а гасим — иначе непонятно, куда делась возможность добавить админа. */
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: saturate(0.6);
}

/* ---------- Иконки (заменяют эмодзи) ---------- */
.icon {
    display: inline-block;
    vertical-align: -0.15em;
    flex-shrink: 0;
    color: currentColor;
    pointer-events: none;
}

/* Иконка внутри кнопки/ссылки не должна сжимать текст. */
.btn > .icon,
a > .icon,
.badge > .icon {
    margin-right: 6px;
}
.btn > .icon:last-child,
a > .icon:last-child {
    margin-right: 0;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    min-width: 36px;
}

/* ---------- Отдельный блок сохранения настроек в самом низу страницы (не подвал, отдельный div) ---------- */
.settings-save-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 20px;
    margin-top: 28px;
    margin-bottom: 36px;
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    text-align: center;
    gap: 12px;
}

.settings-save-block .btn {
    min-width: 170px;
    padding: 10px 28px;
    font-size: 14.5px;
    font-weight: 700;
    border-radius: var(--r-sm);
    color: #000000;
    background: var(--primary);
    border: 1px solid rgba(253, 96, 201, 0.7);
    box-shadow: 0 2px 10px rgba(253, 96, 201, 0.25);
    transition: all 0.2s ease;
}

.settings-save-block .btn:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #000000;
    box-shadow: 0 4px 16px rgba(253, 96, 201, 0.4);
    transform: translateY(-1.5px);
}

.settings-save-block .btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(253, 96, 201, 0.2);
}

html[data-theme="light"] .settings-save-block .btn {
    color: #ffffff;
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(216, 43, 153, 0.25);
}

html[data-theme="light"] .settings-save-block .btn:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(216, 43, 153, 0.35);
}

.settings-save-status {
    color: var(--primary);
    font-weight: 600;
    font-size: 13.5px;
    display: none;
    transition: opacity 0.2s ease;
}

.settings-container {
    padding-bottom: 24px;
}

/* ---------- FAQ accordion ---------- */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.faq-item {
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    overflow: hidden;
    background: var(--bg-surface);
    animation: fadeIn 0.5s ease-out both;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.faq-item:hover {
    border-color: var(--line-strong);
    box-shadow: var(--shadow-sm);
}

.faq-item:nth-child(1) { animation-delay: 0.05s; }
.faq-item:nth-child(2) { animation-delay: 0.1s; }
.faq-item:nth-child(3) { animation-delay: 0.15s; }
.faq-item:nth-child(4) { animation-delay: 0.2s; }
.faq-item:nth-child(5) { animation-delay: 0.25s; }

.faq-question {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    user-select: none;
    background: var(--bg-surface-2);
}

.faq-question:hover {
    background: var(--bg-surface-3);
}

.faq-question::after {
    content: "+";
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.faq-item.open .faq-question::after {
    transform: rotate(45deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease-out;
}

.faq-item.open .faq-answer {
    max-height: 500px;
}

.faq-answer-inner {
    padding: 4px 16px 16px;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* ---------- Login ---------- */
.auth-page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: var(--bg-gradient);
    background-color: var(--bg-page);
    background-attachment: fixed;
    position: relative;
    overflow: hidden;
}

.auth-page-wrapper::before,
.auth-page-wrapper::after {
    content: "";
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    filter: blur(80px);
}

:root .auth-page-wrapper::before,
html[data-theme="dark"] .auth-page-wrapper::before {
    width: 380px;
    height: 380px;
    top: 12%;
    left: 15%;
    background: radial-gradient(circle, rgba(255, 77, 157, 0.22) 0%, transparent 70%);
}

:root .auth-page-wrapper::after,
html[data-theme="dark"] .auth-page-wrapper::after {
    width: 420px;
    height: 420px;
    bottom: 12%;
    right: 15%;
    background: radial-gradient(circle, rgba(214, 93, 177, 0.18) 0%, transparent 70%);
}

html[data-theme="light"] .auth-page-wrapper::before {
    width: 450px;
    height: 450px;
    top: 10%;
    left: 10%;
    background: radial-gradient(circle, rgba(255, 182, 217, 0.70) 0%, transparent 70%);
}

html[data-theme="light"] .auth-page-wrapper::after {
    width: 420px;
    height: 420px;
    bottom: 10%;
    right: 12%;
    background: radial-gradient(circle, rgba(255, 105, 180, 0.35) 0%, transparent 70%);
}

.auth-main-content {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px 20px;
    width: 100%;
    position: relative;
    z-index: 1;
}

.login-container {
    width: 100%;
    max-width: 430px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: auto 0;
    padding: 10px 0;
}

.login-card {
    background: var(--bg-glass-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-glass);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg), var(--glass-shadow), 0 0 32px rgba(255, 77, 157, 0.08);
    width: 100%;
    padding: 34px 30px;
    animation: fadeIn 0.5s ease-out 0.1s both;
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #ff4d9d 0%, #ff9ec8 50%, #d65db1 100%);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.login-brand .monogram {
    width: 44px;
    height: 44px;
    border-radius: 11px;
    box-shadow: 0 2px 14px rgba(253, 96, 201, 0.3);
}

.login-brand h1 {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.2px;
}

.login-brand .subtitle {
    color: var(--text-tertiary);
    font-size: 13px;
    margin-top: 2px;
}
/* ---------- Password toggle button ---------- */
.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    flex: 1;
    padding-right: 44px;
}

.toggle-password {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 16px;
    border-radius: var(--r-xs);
    transition: color 0.2s ease, background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-password:hover {
    color: var(--text-primary);
    background: var(--bg-surface-3);
}

/* ---------- 2FA Authentication Component ---------- */
.twofa-info-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: linear-gradient(135deg, rgba(255, 77, 157, 0.08) 0%, rgba(255, 77, 157, 0.03) 100%);
    border: 1px solid rgba(255, 77, 157, 0.22);
    border-radius: var(--r-md);
    padding: 14px 16px;
    margin-bottom: 22px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.55;
}

.twofa-info-icon {
    flex-shrink: 0;
    color: var(--primary);
    margin-top: 1px;
}

.twofa-vk-badge {
    display: inline-block;
    background: rgba(255, 77, 157, 0.15);
    color: var(--primary);
    padding: 1px 7px;
    border-radius: var(--r-xs);
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.02em;
}

.otp-form-group {
    margin-bottom: 22px;
}

.otp-label {
    display: block;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    text-align: center;
}

.otp-inputs {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 8px;
}

.otp-digit {
    width: 48px;
    height: 56px;
    background: var(--bg-surface-2);
    border: 1.5px solid var(--line-strong);
    border-radius: var(--r-md);
    color: var(--text-primary);
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 24px;
    font-weight: 800;
    text-align: center;
    line-height: 56px;
    padding: 0;
    caret-color: var(--primary);
    outline: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.otp-digit:hover {
    border-color: var(--primary-hover);
    background: var(--bg-surface-3);
}

.otp-digit:focus {
    border-color: var(--primary);
    background: var(--bg-surface);
    box-shadow: 0 0 0 3px var(--primary-soft), var(--primary-glow);
    transform: translateY(-2px);
}

.otp-digit.is-filled {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--text-primary);
}

.code-single-input {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 0.28em;
    text-align: center;
    padding: 14px 16px;
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.otp-separator {
    width: 8px;
    height: 2px;
    background: var(--line-strong);
    border-radius: var(--r-full);
    flex-shrink: 0;
    margin: 0 2px;
}

.twofa-secondary-actions {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.twofa-secondary-actions form {
    width: 100%;
}

.btn-resend-code {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--bg-surface-2);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    padding: 10px 16px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-resend-code:hover:not(:disabled) {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

.btn-resend-code:hover:not(:disabled) .icon-refresh {
    transform: rotate(180deg);
}

.btn-resend-code .icon-refresh {
    transition: transform 0.4s ease;
}

.btn-resend-code:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-surface-2);
    border-color: var(--line);
    color: var(--text-tertiary);
}

.link-back-login {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-tertiary);
    font-size: 13px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: var(--r-sm);
    text-decoration: none;
    transition: all 0.2s ease;
}

.link-back-login:hover {
    color: var(--text-primary);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.04);
}

.link-back-login:hover svg {
    transform: translateX(-3px);
}

.link-back-login svg {
    transition: transform 0.2s ease;
}

@media (max-width: 480px) {
    .otp-inputs {
        gap: 6px;
    }
    .otp-digit {
        width: 40px;
        height: 50px;
        font-size: 20px;
        line-height: 50px;
        border-radius: var(--r-sm);
    }
    .otp-separator {
        width: 4px;
        margin: 0 1px;
    }
}

/* ---------- Misc helpers ---------- */
.faq-question .badge {
    flex-shrink: 0;
}

.faq-table-section {
    margin-top: 28px;
}

.faq-table-section h2 {
    font-size: 15px;
    margin-bottom: 14px;
}

/* ---------- Tabs (dept frame) ---------- */
.tabs {
    display: block;
    width: 100%;
}

.tab-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 22px;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-link {
    padding: 10px 18px;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: var(--r-sm) var(--r-sm) 0 0;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 13.5px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    margin-bottom: -1px;
}

.tab-link:hover {
    color: var(--text-primary);
    background: var(--bg-surface-2);
}

.tab-link.active {
    color: var(--primary);
    background: var(--bg-surface);
    border-color: var(--line-strong);
    border-bottom: 2px solid var(--primary);
    box-shadow: 0 -2px 10px rgba(255, 77, 157, 0.1);
}

.tab-panel {
    display: none;
    width: 100%;
}

.tab-panel.active {
    display: block;
    animation: fadeIn 0.35s ease-out;
}

/* ---------- Hidden helper ---------- */
.is-hidden {
    display: none !important;
}

/* ---------- Departments Grid & Cards ---------- */
.departments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 18px;
    margin-top: 1rem;
    align-items: stretch;
}

.department-card {
    background: var(--bg-surface-2);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-lg);
    padding: 24px 26px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 18px;
    height: 100%;
    box-shadow: var(--shadow-sm);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    animation: scaleIn 0.4s ease-out both;
}

.department-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(255, 77, 157, 0.16);
    border-color: var(--primary);
}

.department-card-top {
    display: flex;
    align-items: center;
    gap: 16px;
}

.department-ico {
    width: 48px;
    height: 48px;
    border-radius: var(--r-md);
    background: linear-gradient(135deg, rgba(255, 77, 157, 0.25), rgba(214, 93, 177, 0.15));
    border: 1px solid rgba(255, 77, 157, 0.35);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.department-card-info {
    min-width: 0;
    flex: 1;
}

.department-name {
    font-weight: 800;
    font-size: 17px;
    color: var(--text-primary);
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.department-id {
    font-size: 12.5px;
    color: var(--text-tertiary);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    margin-top: 3px;
}

/* Единая сетка метрик отдела: 5 колонок */
.department-stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    background: var(--bg-surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 12px 10px;
}

.dept-stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 6px 4px;
}

.dept-stat-val {
    font-size: 19px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.25;
    transition: color 0.2s ease;
}

.dept-stat-key {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-tertiary);
    margin-top: 3px;
}

.department-card:hover .dept-stat-val {
    color: var(--primary);
}

/* Действия с карточкой: основная кнопка + 2 кнопки 50/50 */
.department-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.dept-btn-main {
    width: 100%;
    justify-content: center;
    font-weight: 700;
}

.dept-sub-actions {
    display: flex;
    gap: 8px;
    width: 100%;
}

.dept-btn-sub {
    flex: 1;
    justify-content: center;
    text-align: center;
}

/* ---------- Pagination Buttons ---------- */
.pagination-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--r-sm);
    background: var(--bg-surface-2);
    border: 1px solid var(--line);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.pagination-btn:hover:not(.disabled) {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: var(--primary);
    text-decoration: none;
}

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

.pagination-info {
    font-size: 13px;
    color: var(--text-tertiary);
    font-weight: 500;
}

/* ---------- Spinner ---------- */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 77, 157, 0.25);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
    vertical-align: middle;
}

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

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        width: min(280px, 85vw);
        height: 100vh;
        height: 100dvh;
        z-index: 100;
        margin-left: 0 !important;
        box-shadow: var(--shadow-lg);
    }

    .sidebar.is-open {
        transform: translateX(0) !important;
    }

    .top-nav-bar {
        display: flex;
        position: sticky;
        top: 0;
        z-index: 85;
        margin-left: -14px;
        margin-right: -14px;
        margin-top: -14px;
        margin-bottom: 16px;
        border-radius: 0 0 var(--r-md) var(--r-md);
        border-top: none;
        border-left: none;
        border-right: none;
    }

    .main-content {
        padding: 14px 14px 40px;
        max-width: 100%;
    }

    .table-container {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: var(--r-sm);
    }

    table {
        min-width: 580px;
    }

    th, td {
        padding: 9px 12px;
        font-size: 13px;
    }

    .empty-state {
        justify-content: center;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .page-header {
        align-items: flex-start;
    }
}

@media (max-width: 600px) {
    .departments-grid {
        grid-template-columns: 1fr;
    }

    .department-stats-grid {
        grid-template-columns: repeat(5, 1fr);
        padding: 8px 4px;
        gap: 4px;
    }

    .dept-stat-val {
        font-size: 15px;
    }

    .dept-stat-key {
        font-size: 9.5px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }

    .actions {
        width: 100%;
        flex-direction: column;
    }

    .actions .btn {
        width: 100%;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-bar input[type="text"],
    .filter-bar select,
    .filter-bar .btn {
        width: 100%;
        min-width: 0;
    }

    .modal {
        padding: 12px;
    }

    .modal-content {
        padding: 18px 14px;
        max-width: 100%;
        max-height: 90dvh;
        overflow-y: auto;
    }

    .modal-content.modal-ticket-lg {
        padding: 18px 14px;
    }

    .ticket-header-summary {
        grid-template-columns: 1fr;
        padding: 12px 14px;
        gap: 10px;
    }

    .ticket-chat-container {
        padding: 14px 12px;
        max-height: 360px;
        min-height: 180px;
    }

    .chat-bubble {
        max-width: 90%;
        padding: 10px 14px;
        font-size: 13.5px;
    }

    .chat-input-container {
        padding: 12px 14px;
    }

    .ticket-management-row {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .ticket-action-form {
        flex-direction: column;
        align-items: stretch;
    }

    .ticket-action-form select,
    .ticket-action-form .btn {
        width: 100%;
    }

    input[type="text"],
    input[type="password"],
    input[type="number"],
    input[type="datetime-local"],
    select,
    textarea {
        font-size: 16px;
    }
}

/* ---------- Error page ---------- */
.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-page);
    padding: 20px;
}

.error-card {
    background: var(--bg-surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 520px;
    padding: 40px 32px;
    text-align: center;
    animation: scaleIn 0.5s ease-out;
}

.error-code {
    font-size: 96px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 8px;
    animation: pulse 2s ease-in-out infinite;
}

.error-icon {
    font-size: 48px;
    margin-bottom: 16px;
    animation: fadeIn 0.8s ease-out 0.3s both;
}

.error-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 12px;
    animation: fadeIn 0.8s ease-out 0.4s both;
}

.error-message {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.7;
    margin-bottom: 28px;
    animation: fadeIn 0.8s ease-out 0.5s both;
}

.error-support-code {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
    animation: fadeIn 0.8s ease-out 0.55s both;
}

.error-support-code code {
    background: var(--bg-surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    padding: 2px 8px;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 13px;
    color: var(--text-primary);
}

.error-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    animation: fadeIn 0.8s ease-out 0.6s both;
}

.error-actions .btn {
    min-width: 140px;
}

/* ---------- Security Banner (Bootstrap Warning) ---------- */
@keyframes bannerSlideDown {
    from {
        opacity: 0;
        transform: translateY(-16px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes bannerSlideUp {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
        max-height: 120px;
        margin-bottom: 20px;
        padding-top: 14px;
        padding-bottom: 14px;
    }
    to {
        opacity: 0;
        transform: translateY(-10px) scale(0.96);
        max-height: 0;
        margin-bottom: 0;
        padding-top: 0;
        padding-bottom: 0;
        overflow: hidden;
    }
}

.security-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 20px;
    margin-bottom: 24px;
    background: linear-gradient(135deg, rgba(255, 51, 102, 0.16) 0%, rgba(255, 77, 157, 0.08) 100%);
    border: 1px solid rgba(255, 77, 157, 0.4);
    border-radius: var(--r-md, 14px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35), 0 0 20px rgba(255, 77, 157, 0.12);
    color: #ff99be;
    font-size: 13.5px;
    line-height: 1.5;
    animation: bannerSlideDown 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all 0.25s ease;
}

.security-banner.is-hiding {
    animation: bannerSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.security-banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.security-banner-icon {
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
    filter: drop-shadow(0 0 6px rgba(255, 77, 157, 0.6));
    animation: pulse 2.5s ease-in-out infinite;
}

.security-banner-text {
    flex: 1;
    min-width: 0;
    word-break: break-word;
}

.security-banner-text strong {
    color: var(--text-primary);
    font-weight: 700;
}

.security-banner-link {
    color: var(--primary);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.2s ease, text-shadow 0.2s ease;
}

.security-banner-link:hover {
    color: var(--primary-hover);
    text-shadow: 0 0 10px rgba(255, 77, 157, 0.6);
}

.security-banner-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    background: var(--bg-surface-2);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-sm, 8px);
    color: var(--primary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.security-banner-close:hover {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: var(--primary);
    transform: scale(1.08);
}

.security-banner-close:active {
    transform: scale(0.95);
}

@media (max-width: 480px) {
    .error-code {
        font-size: 64px;
    }
    .error-card {
        padding: 32px 20px;
    }
    .error-actions {
        flex-direction: column;
    }
    .error-actions .btn {
        width: 100%;
    }
    .security-banner {
        padding: 12px 14px;
        gap: 10px;
        font-size: 13px;
    }
}

/* ==========================================================================
   Доступность (Accessibility ГОСТ Р 52872-2019 / WCAG 2.1)
   ========================================================================== */

/* Skip Link для клавиатурной навигации */
.skip-link {
    position: fixed;
    top: -100px;
    left: 16px;
    background: var(--primary);
    color: var(--text-inverse) !important;
    padding: 10px 18px;
    border-radius: var(--r-md, 8px);
    font-weight: 700;
    font-size: 14px;
    z-index: 100000;
    text-decoration: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    transition: top 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.skip-link:focus {
    top: 16px;
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

/* Контрастное фокусное кольцо для навигации с клавиатуры */
:focus-visible {
    outline: 2px solid var(--primary, #ff4d9d) !important;
    outline-offset: 2px !important;
}

.required-star {
    color: var(--primary, #ff4d9d);
    font-weight: bold;
    margin-left: 2px;
}

/* ==========================================================================
   Подвал сайта (Footer) и правовая информация
   ========================================================================== */
.site-footer {
    border-top: 1px solid var(--line);
    padding: 16px 24px;
    margin-top: 40px;
    background: transparent;
    font-size: 12.5px;
    color: var(--text-tertiary);
}

.auth-page-wrapper .site-footer {
    margin-top: 0;
    padding: 14px 20px 18px;
    border-top: 1px solid var(--line);
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.footer-copy {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-tertiary);
    letter-spacing: 0.2px;
}

.footer-version-badge {
    display: inline-flex;
    align-items: center;
    padding: 1.5px 7px;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-soft);
    border: 1px solid var(--primary-soft);
    border-radius: 9999px;
    letter-spacing: 0.4px;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 6px 14px;
}

.footer-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    transition: color 0.15s ease, text-shadow 0.15s ease;
}

.footer-link:hover {
    color: var(--primary);
    text-shadow: 0 0 8px rgba(253, 96, 201, 0.35);
    text-decoration: none;
}

.footer-sep {
    color: var(--line-strong);
    font-size: 10px;
    user-select: none;
}

/* Примечание под формой входа */
.login-footer-legal {
    margin-top: 22px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    font-size: 11.5px;
    line-height: 1.55;
    color: var(--text-tertiary);
    text-align: center;
}

.login-footer-legal a {
    color: var(--primary);
    text-decoration: none;
    border-bottom: 1px dashed var(--primary);
    transition: border-color 0.15s ease, color 0.15s ease;
}

.login-footer-legal a:hover {
    color: var(--primary-hover);
    border-bottom: 1px solid var(--primary-hover);
}

@media (max-width: 640px) {
    .footer-container {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    .footer-links {
        justify-content: center;
        gap: 6px 12px;
    }
}

/* ==========================================================================
/* ==========================================================================
   Баннер согласия на cookie (компактный, стеклянный, палитра #fd60c9)
   ========================================================================== */
.cookie-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: min(580px, calc(100% - 32px));
    z-index: 99999;
    background: rgba(10, 10, 14, 0.90);
    backdrop-filter: blur(18px) saturate(180%);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    border: 1px solid rgba(253, 96, 201, 0.4);
    border-radius: 9999px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.8), 0 0 20px rgba(253, 96, 201, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    padding: 8px 12px 8px 16px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    animation: cookieSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes cookieSlideUp {
    from {
        opacity: 0;
        transform: translate(-50%, 20px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0) scale(1);
    }
}

.cookie-banner.is-hiding {
    animation: cookieFadeOut 0.25s ease-in both;
}

@keyframes cookieFadeOut {
    to {
        opacity: 0;
        transform: translate(-50%, 15px) scale(0.97);
    }
}

.cookie-banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.cookie-banner-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(253, 96, 201, 0.14);
    color: #fd60c9;
    flex-shrink: 0;
    box-shadow: 0 0 10px rgba(253, 96, 201, 0.2);
}

.cookie-banner-text {
    font-size: 13px;
    line-height: 1.4;
    color: #f0f2f8;
}

.cookie-link {
    color: #fd60c9;
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 500;
    transition: color 0.15s ease;
}

.cookie-link:hover {
    color: #fe82d5;
}

.cookie-banner-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.btn-cookie-decline {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #e2e8f0;
    border-radius: 9999px;
    padding: 7px 14px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-cookie-decline:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    border-color: rgba(253, 96, 201, 0.4);
    transform: translateY(-1px);
}

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

.btn-cookie-accept {
    background: #fd60c9;
    color: #000000;
    border: 1px solid rgba(253, 96, 201, 0.8);
    border-radius: 9999px;
    padding: 7px 18px;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(253, 96, 201, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-cookie-accept:hover {
    background: #fe82d5;
    border-color: #fe82d5;
    color: #000000;
    box-shadow: 0 4px 16px rgba(253, 96, 201, 0.5);
    transform: translateY(-1px);
}

.btn-cookie-accept:active {
    background: #e04aa8;
    transform: translateY(0);
}

/* Светлая тема */
html[data-theme="light"] .cookie-banner {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(216, 43, 153, 0.35);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08), 0 0 16px rgba(216, 43, 153, 0.15);
}

html[data-theme="light"] .cookie-banner-icon {
    background: rgba(216, 43, 153, 0.12);
    color: #d82b99;
    box-shadow: none;
}

html[data-theme="light"] .cookie-banner-text {
    color: #1e293b;
}

html[data-theme="light"] .cookie-link {
    color: #d82b99;
}

html[data-theme="light"] .cookie-link:hover {
    color: #b81b7e;
}

html[data-theme="light"] .btn-cookie-decline {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #475569;
}

html[data-theme="light"] .btn-cookie-decline:hover {
    background: #e2e8f0;
    color: #0f172a;
    border-color: #94a3b8;
}

html[data-theme="light"] .btn-cookie-accept {
    background: #d82b99;
    border-color: #d82b99;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(216, 43, 153, 0.25);
}

html[data-theme="light"] .btn-cookie-accept:hover {
    background: #b81b7e;
    border-color: #b81b7e;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(216, 43, 153, 0.35);
}

@media (max-width: 580px) {
    .cookie-banner {
        bottom: 12px;
        width: calc(100% - 24px);
        border-radius: 16px;
        flex-direction: column;
        align-items: stretch;
        padding: 12px 14px;
        gap: 12px;
    }
    
    .cookie-banner-actions {
        flex-direction: column;
        width: 100%;
        gap: 8px;
    }

    .btn-cookie-decline,
    .btn-cookie-accept {
        width: 100%;
        text-align: center;
        padding: 9px 16px;
    }
}

/* ==========================================================================
   Модальные окна соглашений и предупреждений (152-ФЗ, блокировка доступа)
   ========================================================================== */
.legal-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: fadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.legal-modal-card {
    background: rgba(14, 14, 18, 0.96);
    border: 1px solid rgba(253, 96, 201, 0.4);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.85), 0 0 24px rgba(253, 96, 201, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    max-width: 520px;
    width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: scaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.cookie-warning-card {
    max-width: 480px;
}

.legal-modal-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--line);
}

.legal-modal-icon-badge {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(253, 96, 201, 0.14);
    color: #fd60c9;
    box-shadow: 0 0 12px rgba(253, 96, 201, 0.25);
}

.legal-modal-icon-badge.warning-badge {
    background: rgba(253, 96, 201, 0.16);
    color: #fd60c9;
}

.legal-modal-icon-badge.danger-badge {
    background: rgba(224, 74, 117, 0.16);
    color: #e04a75;
    box-shadow: 0 0 12px rgba(224, 74, 117, 0.25);
}

.legal-modal-title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

.legal-modal-subtitle {
    font-size: 12.5px;
    color: var(--text-tertiary);
    margin-top: 3px;
}

.legal-modal-body {
    padding: 20px 24px;
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--text-secondary);
}

.legal-modal-body p {
    margin: 0 0 12px;
}

.legal-modal-body p:last-child {
    margin-bottom: 0;
}

.legal-docs-checklist {
    margin: 14px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 12px;
}

.legal-doc-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.legal-doc-item.legal-doc-clickable {
    cursor: pointer;
    user-select: none;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid transparent;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.legal-doc-item.legal-doc-clickable:hover {
    background: rgba(253, 96, 201, 0.07);
    border-color: rgba(253, 96, 201, 0.18);
}

.legal-doc-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.legal-custom-checkbox {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 1.5px solid rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.05);
    color: transparent;
    flex-shrink: 0;
    margin-top: 2px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.legal-custom-checkbox svg {
    transform: scale(0.5);
    transition: transform 0.18s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.legal-doc-checkbox:focus-visible + .legal-custom-checkbox {
    outline: 2px solid #fd60c9;
    outline-offset: 2px;
}

.legal-doc-checkbox:checked + .legal-custom-checkbox {
    background: #fd60c9;
    border-color: #fd60c9;
    color: #000000;
    box-shadow: 0 0 12px rgba(253, 96, 201, 0.45);
}

.legal-doc-checkbox:checked + .legal-custom-checkbox svg {
    transform: scale(1);
    stroke: #000000;
}

.legal-doc-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.legal-doc-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
}

.legal-read-link {
    font-size: 11.5px;
    font-weight: 600;
    color: #fd60c9;
    text-decoration: none;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(253, 96, 201, 0.12);
    border: 1px solid rgba(253, 96, 201, 0.25);
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.legal-read-link:hover {
    background: rgba(253, 96, 201, 0.24);
    color: #fe82d5;
    border-color: rgba(253, 96, 201, 0.5);
    text-decoration: none;
}

.legal-check-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: rgba(253, 96, 201, 0.18);
    color: #fd60c9;
    flex-shrink: 0;
    margin-top: 2px;
}

.legal-check-icon.warning-icon {
    background: rgba(253, 96, 201, 0.15);
    color: #fd60c9;
}

.legal-doc-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.legal-doc-desc {
    font-size: 11.5px;
    color: var(--text-tertiary);
    line-height: 1.35;
}

.legal-note-text {
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-tertiary);
    margin-top: 10px;
}

.legal-blocked-p {
    font-size: 14px;
    line-height: 1.6;
    color: #ffffff;
    font-weight: 500;
}

.legal-blocked-hint {
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--text-tertiary);
    margin-top: 10px;
}

.legal-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px 20px;
    border-top: 1px solid var(--line);
}

.btn-modal-accept {
    background: #fd60c9;
    color: #000000;
    border: none;
    border-radius: 10px;
    padding: 9px 20px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(253, 96, 201, 0.4);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-modal-accept:hover:not(:disabled):not(.is-disabled) {
    background: #fe82d5;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(253, 96, 201, 0.55);
}

.btn-modal-accept:disabled,
.btn-modal-accept.is-disabled {
    opacity: 0.38 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    box-shadow: none !important;
    transform: none !important;
    background: rgba(253, 96, 201, 0.2) !important;
    color: rgba(255, 255, 255, 0.45) !important;
}

.btn-modal-decline {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--line-strong);
    color: var(--text-secondary);
    border-radius: 10px;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-modal-decline:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border-color: rgba(253, 96, 201, 0.4);
}

.legal-blocked-scroll {
    overflow: hidden !important;
}

/* Нижняя фиксированная плашка для страниц правовых документов */
.legal-doc-sticky-bar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: min(680px, calc(100% - 32px));
    z-index: 99999;
    background: rgba(12, 12, 16, 0.94);
    backdrop-filter: blur(18px) saturate(180%);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    border: 1px solid rgba(253, 96, 201, 0.4);
    border-radius: 16px;
    padding: 12px 18px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.8), 0 0 24px rgba(253, 96, 201, 0.2);
    animation: cookieSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.legal-doc-sticky-content {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.legal-doc-sticky-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(253, 96, 201, 0.15);
    color: #fd60c9;
    flex-shrink: 0;
}

.legal-doc-sticky-text {
    font-size: 13.5px;
    font-weight: 500;
    color: #ffffff;
    line-height: 1.35;
}

.legal-doc-sticky-actions {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.legal-doc-sticky-actions button {
    white-space: nowrap;
    padding: 9px 18px;
    font-size: 13.5px;
}

@media (max-width: 640px) {
    .legal-doc-sticky-bar {
        bottom: 14px;
        width: calc(100% - 24px);
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 12px 14px;
        border-radius: 14px;
    }
    .legal-doc-sticky-content {
        align-items: center;
    }
    .legal-doc-sticky-text {
        font-size: 13px;
        text-align: left;
    }
    .legal-doc-sticky-actions button {
        width: 100%;
        text-align: center;
    }
}

/* Светлая тема */
html[data-theme="light"] .legal-modal-card {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(216, 43, 153, 0.35);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15), 0 0 20px rgba(216, 43, 153, 0.15);
}

html[data-theme="light"] .legal-modal-icon-badge {
    background: rgba(216, 43, 153, 0.12);
    color: #d82b99;
    box-shadow: none;
}

html[data-theme="light"] .legal-modal-icon-badge.warning-badge {
    background: rgba(216, 43, 153, 0.12);
    color: #d82b99;
}

html[data-theme="light"] .legal-modal-icon-badge.danger-badge {
    background: rgba(224, 74, 117, 0.12);
    color: #e04a75;
}

html[data-theme="light"] .legal-docs-checklist {
    background: #f8fafc;
    border-color: #e2e8f0;
}

html[data-theme="light"] .legal-doc-item.legal-doc-clickable:hover {
    background: rgba(216, 43, 153, 0.06);
    border-color: rgba(216, 43, 153, 0.2);
}

html[data-theme="light"] .legal-custom-checkbox {
    border-color: #cbd5e1;
    background: #ffffff;
}

html[data-theme="light"] .legal-doc-checkbox:checked + .legal-custom-checkbox {
    background: #d82b99;
    border-color: #d82b99;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(216, 43, 153, 0.35);
}

html[data-theme="light"] .legal-doc-checkbox:checked + .legal-custom-checkbox svg {
    stroke: #ffffff;
}

html[data-theme="light"] .legal-read-link {
    color: #d82b99;
    background: rgba(216, 43, 153, 0.08);
    border-color: rgba(216, 43, 153, 0.22);
}

html[data-theme="light"] .legal-read-link:hover {
    background: rgba(216, 43, 153, 0.16);
    color: #b81b7e;
    border-color: rgba(216, 43, 153, 0.4);
}

html[data-theme="light"] .legal-check-icon {
    background: rgba(216, 43, 153, 0.14);
    color: #d82b99;
}

html[data-theme="light"] .legal-blocked-p {
    color: #0f172a;
}

html[data-theme="light"] .btn-modal-accept {
    background: #d82b99;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(216, 43, 153, 0.3);
}

html[data-theme="light"] .btn-modal-accept:hover:not(:disabled):not(.is-disabled) {
    background: #b81b7e;
    box-shadow: 0 6px 16px rgba(216, 43, 153, 0.45);
}

html[data-theme="light"] .btn-modal-accept:disabled,
html[data-theme="light"] .btn-modal-accept.is-disabled {
    background: rgba(216, 43, 153, 0.18) !important;
    color: rgba(0, 0, 0, 0.35) !important;
}

html[data-theme="light"] .btn-modal-decline {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #334155;
}

html[data-theme="light"] .legal-doc-sticky-bar {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(216, 43, 153, 0.4);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.12), 0 0 20px rgba(216, 43, 153, 0.16);
}

html[data-theme="light"] .legal-doc-sticky-icon {
    background: rgba(216, 43, 153, 0.12);
    color: #d82b99;
}

html[data-theme="light"] .legal-doc-sticky-text {
    color: #0f172a;
}

html[data-theme="light"] .btn-modal-decline:hover {
    background: #e2e8f0;
    color: #0f172a;
}

html[data-theme="light"] .legal-blocked-p {
    color: #09090b;
}

/* Светлая тема для бейджей, тегов и уведомлений */
html[data-theme="light"] .nav-badge-flame,
html[data-theme="light"] .notif-tag-tickets {
    background: rgba(234, 88, 12, 0.12);
    border-color: rgba(234, 88, 12, 0.35);
    color: #c2410c;
}

html[data-theme="light"] .nav-badge-reply,
html[data-theme="light"] .notif-tag-replies {
    background: rgba(37, 99, 235, 0.12);
    border-color: rgba(37, 99, 235, 0.35);
    color: #1d4ed8;
}

html[data-theme="light"] .nav-badge-partner,
html[data-theme="light"] .notif-tag-partner {
    background: rgba(147, 51, 234, 0.12);
    border-color: rgba(147, 51, 234, 0.35);
    color: #7e22ce;
}

html[data-theme="light"] .notifications-item-badge.badge-student_reply {
    background: rgba(184, 27, 126, 0.10);
    border-color: rgba(184, 27, 126, 0.30);
    color: #b81b7e;
}

html[data-theme="light"] .notifications-item-badge.badge-partnership {
    background: rgba(148, 19, 98, 0.10);
    border-color: rgba(148, 19, 98, 0.30);
    color: #941362;
}

html[data-theme="light"] .security-banner {
    background: rgba(253, 96, 201, 0.08);
    border-color: rgba(216, 43, 153, 0.35);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

html[data-theme="light"] .chat-bubble-admin .chat-bubble-header,
html[data-theme="light"] .chat-bubble-admin .chat-bubble-time {
    color: rgba(255, 255, 255, 0.92);
}

/* ---------- Стили журнала действий (Audit Logs) ---------- */
.logs-details {
    color: var(--text-tertiary);
    font-size: 12px;
    margin-top: 3px;
    line-height: 1.4;
}

.logs-duration {
    font-size: 11.5px;
    color: var(--text-tertiary);
    margin-left: 6px;
}

.log-method {
    font-weight: 700;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: var(--r-xs);
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
}

.log-method-get {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.log-method-post {
    background: var(--primary-soft);
    color: var(--primary);
    border: 1px solid var(--primary);
}

.log-method-delete {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.logs-path {
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: 4px;
}

html[data-theme="light"] .log-method-get {
    background: rgba(37, 99, 235, 0.10);
    color: #1d4ed8;
    border-color: rgba(37, 99, 235, 0.25);
}

@media (max-width: 580px) {
    .legal-modal-card {
        border-radius: 16px;
    }

    .legal-modal-header {
        padding: 16px 18px 12px;
    }

    .legal-modal-body {
        padding: 16px 18px;
    }

    .legal-modal-footer {
        padding: 12px 18px 16px;
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .btn-modal-accept,
    .btn-modal-decline {
        width: 100%;
        text-align: center;
        padding: 10px 16px;
    }
}

/* ==========================================================================
   Страницы правовых документов (Legal Pages)
   ========================================================================== */
.legal-page-container {
    max-width: 900px;
    margin: 40px auto 90px;
    padding: 0 20px 40px;
}

.legal-card {
    background: var(--bg-surface);
    border: 1px solid var(--line);
    border-radius: var(--r-xl, 16px);
    box-shadow: var(--shadow-md);
    padding: 40px 48px;
}

.legal-header {
    border-bottom: 1px solid var(--line);
    padding-bottom: 24px;
    margin-bottom: 28px;
}

.legal-header h1 {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-primary);
    margin: 16px 0 8px;
    line-height: 1.3;
}

.legal-subtitle {
    font-size: 14px;
    color: var(--text-tertiary);
    margin: 0 0 8px;
}

.legal-meta {
    font-size: 12px;
    color: var(--primary);
    font-weight: 600;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 6px 12px;
    background: var(--bg-surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-md, 8px);
    transition: all 0.15s ease;
}

.btn-back:hover {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: var(--primary);
}

.legal-nav {
    background: var(--bg-surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-md, 8px);
    padding: 16px 24px;
    margin-bottom: 32px;
    font-size: 13px;
    color: var(--text-secondary);
}

.legal-nav ol {
    margin: 10px 0 0;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.legal-nav a {
    color: var(--text-secondary);
    text-decoration: none;
}

.legal-nav a:hover {
    color: var(--primary);
    text-decoration: underline;
}

.legal-section {
    margin-bottom: 32px;
    font-size: 14px;
    line-height: 1.65;
    color: var(--text-secondary);
}

.legal-section h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 24px 0 12px;
}

.legal-section p {
    margin: 0 0 12px;
}

.legal-section ul {
    margin: 0 0 16px;
    padding-left: 24px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.legal-footer {
    border-top: 1px solid var(--line);
    padding-top: 24px;
    margin-top: 36px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.legal-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.legal-link:hover {
    text-decoration: underline;
}

@media (max-width: 640px) {
    .legal-card {
        padding: 24px 18px;
    }
    .legal-header h1 {
        font-size: 20px;
    }
}

/* ============================================================
   Theme Switcher, Settings Page & Frosted Glass Enhancements
   ============================================================ */

/* Disable glassmorphism utility class */
html.disable-glass .card,
html.disable-glass .stat-card,
html.disable-glass .modal-content,
html.disable-glass .login-card,
html.disable-glass .sidebar,
html.disable-glass .top-nav-bar {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: var(--bg-surface) !important;
    border-color: var(--line) !important;
}

html.disable-glass body::before,
html.disable-glass body::after,
html.disable-glass .auth-page-wrapper::before,
html.disable-glass .auth-page-wrapper::after {
    display: none !important;
}

/* Quick theme toggle button */
.btn-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--r-sm);
    background: var(--bg-surface-2);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.btn-theme-toggle:hover {
    background: var(--primary-soft);
    border-color: var(--primary);
    transform: translateY(-1px);
}

.btn-settings-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--r-sm);
    background: var(--bg-surface-2);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    font-size: 16px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.btn-settings-nav:hover {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: var(--primary);
    text-decoration: none;
    transform: translateY(-1px);
}

.auth-theme-bar {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.auth-theme-toggle {
    box-shadow: var(--shadow-md);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

/* Settings page styles */
.settings-container {
    max-width: 960px;
    margin: 0 auto;
    animation: fadeIn 0.4s ease-out;
}

.settings-section-card {
    margin-bottom: 24px;
    padding: 24px;
}

.theme-picker-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.theme-option-card {
    position: relative;
    cursor: pointer;
    display: block;
}

.theme-option-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.theme-card-body {
    border: 2px solid var(--border-glass);
    border-radius: var(--r-md);
    background: var(--bg-surface-2);
    padding: 16px;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: all 0.22s ease;
    box-shadow: var(--shadow-sm);
}

.theme-option-card:hover .theme-card-body {
    border-color: var(--border-glass-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.theme-option-card input[type="radio"]:checked + .theme-card-body {
    border-color: var(--primary);
    background: var(--bg-surface);
    box-shadow: 0 0 0 1px var(--primary), var(--primary-glow);
}

/* Mini theme previews */
.theme-preview {
    height: 80px;
    border-radius: var(--r-sm);
    margin-bottom: 14px;
    display: flex;
    overflow: hidden;
    border: 1px solid var(--border-glass);
}

.preview-dark {
    background: #08080b;
}
.preview-dark .preview-sidebar {
    width: 28%;
    background: #121217;
    border-right: 1px solid #22222c;
}
.preview-dark .preview-content {
    flex: 1;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.preview-dark .preview-bar {
    height: 8px;
    width: 60%;
    background: #ff4d9d;
    border-radius: 4px;
}
.preview-dark .preview-glass-box {
    flex: 1;
    background: rgba(26, 26, 35, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
}

.preview-light {
    background: #fff5f8;
}
.preview-light .preview-sidebar {
    width: 28%;
    background: #ffffff;
    border-right: 1px solid #fcdde9;
}
.preview-light .preview-content {
    flex: 1;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.preview-light .preview-bar {
    height: 8px;
    width: 60%;
    background: #ff2d87;
    border-radius: 4px;
}
.preview-light .preview-glass-box {
    flex: 1;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid #f7b6d2;
    border-radius: 4px;
}

.preview-system {
    display: flex;
}
.preview-split-dark {
    flex: 1;
    background: #121217;
    border-right: 1px dashed var(--border-glass);
}
.preview-split-light {
    flex: 1;
    background: #fff5f8;
}

.theme-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    font-size: 14.5px;
    margin-bottom: 6px;
}

.theme-badge {
    font-size: 10.5px;
    padding: 2px 7px;
    border-radius: 10px;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
}

.theme-desc {
    color: var(--text-secondary);
    font-size: 12.5px;
    line-height: 1.45;
}

/* Switch toggle */
.settings-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 8px 0;
}

.switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-surface-3);
    border: 1px solid var(--border-glass);
    transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: #ffffff;
    transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

input:checked + .slider {
    background-color: var(--primary);
    box-shadow: var(--primary-glow);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

/* Settings info grid */
.settings-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
}

.settings-info-item {
    background: var(--bg-surface-2);
    border: 1px solid var(--border-glass);
    border-radius: var(--r-md);
    padding: 18px 20px;
}

.settings-info-label {
    font-size: 12.5px;
    color: var(--text-tertiary);
    margin-bottom: 6px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.settings-info-value {
    font-size: 15px;
    color: var(--text-primary);
    line-height: 1.4;
}

@media (max-width: 768px) {
    .theme-picker-grid {
        grid-template-columns: 1fr;
    }
}