/* ============================================================================
   ARMARP.RU - Личный Кабинет
   Главный файл стилей
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ============================================================================
   BASE - Переменные, сброс, основные стили
   ============================================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

:root {
    /* ----- Цвета фона ----- */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a24;
    --bg-card-hover: #22222e;
    --bg-tertiary: #2a2a3a;

    /* ----- Акцентные цвета ----- */
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.3);

    /* ----- Статусные цвета ----- */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    /* ----- Текст ----- */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* ----- Границы ----- */
    --border: #2a2a3a;

    /* ----- Градиенты ----- */
    --gradient-1: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --gradient-2: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);

    /* ----- Mobile viewport height (fallback) ----- */
    --vh-full: 100vh;
    /* visualViewport height for keyboard handling (set by JS) */
    --vv-height: 100vh;
}
@supports (height: 100dvh) {
    :root {
        --vh-full: 100dvh;
        --vv-height: 100dvh;
    }
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: var(--vh-full);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
}

/* ----- Глобальные скроллбары ----- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #3a3a4a;
}

/* ----- Twemoji эмодзи ----- */
img.emoji {
    height: 1.2em;
    width: 1.2em;
    margin: 0 0.05em 0 0.1em;
    vertical-align: -0.2em;
}
.emoji-picker span img.emoji {
    height: 1.4em;
    width: 1.4em;
}

/* ----- Защита изображений ----- */
img {
    -webkit-user-drag: none;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}
/* Отключаем клики только на защищённых изображениях */
.img-no-click {
    pointer-events: none;
}
.img-protected {
    position: relative;
    display: inline-block;
    overflow: hidden;
}
.img-protected::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    pointer-events: auto;
}

/* ----- Анимированный фон ----- */
.bg-animated {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
        var(--bg-primary);
}


/* ============================================================================
   LAYOUT - Sidebar, Topbar, Main, Container
   ============================================================================ */

/* ----- Container ----- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ----- Sidebar (боковая панель) ----- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 240px;
    height: 100vh;
    height: 100dvh;
    background: rgb(18, 18, 26);
    border-right: 1px solid var(--border);
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.sidebar-logo {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    text-align: center;
}
.sidebar-logo a {
    display: block;
    text-decoration: none;
}
.sidebar-logo img {
    max-width: 100%;
    height: auto;
    max-height: 60px;
    object-fit: contain;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 10px 14px;
    border-radius: 10px;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}
.nav-link svg { flex-shrink: 0; }
.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}
.nav-link.active {
    background: var(--accent);
    color: white;
}

/* Выделенный пункт меню (Правила) */
.nav-link-highlight {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(249, 115, 22, 0.15) 100%);
    border: 1px solid rgba(239, 68, 68, 0.3);
    position: relative;
}
.nav-link-highlight::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: linear-gradient(180deg, #ef4444, #f97316);
    border-radius: 0 2px 2px 0;
}
.nav-link-highlight:hover {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.25) 0%, rgba(249, 115, 22, 0.25) 100%);
    border-color: rgba(239, 68, 68, 0.5);
}
.nav-link-highlight.active {
    background: linear-gradient(135deg, #ef4444 0%, #f97316 100%);
    border-color: transparent;
}
.nav-link-highlight.active::before {
    display: none;
}

.nav-section {
    margin-top: 16px;
    padding: 8px 12px;
    font-size: 11px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ----- Topbar (верхняя панель) ----- */
.topbar {
    position: fixed;
    top: 16px;
    right: 32px;
    z-index: 100;
    display: flex;
    align-items: center;
}
.topbar-actions {
    display: flex;
    gap: 6px;
}
.topbar-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    position: relative;
}
.topbar-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--accent);
}

/* ----- Main content ----- */
.main {
    margin-left: 240px;
    padding: 32px 0;
    flex: 1;
}

/* ----- Mobile sidebar toggle ----- */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 200;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    padding: 8px 10px;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.2s;
}
.sidebar-toggle:hover {
    background: var(--bg-secondary);
    border-color: var(--accent);
}
.sidebar-toggle:active {
    transform: scale(0.95);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 90;
    backdrop-filter: blur(2px);
}



/* ============================================================================
   COMPONENTS - Cards, Stats, Grids
   ============================================================================ */

/* ----- Cards ----- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.card-title {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}
.card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}
.card-icon.blue { background: linear-gradient(135deg, #0ea5e9, #6366f1); }
.card-icon.green { background: linear-gradient(135deg, #10b981, #059669); }
.card-icon.purple { background: linear-gradient(135deg, #8b5cf6, #6366f1); }
.card-icon.orange { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.card-icon.red { background: linear-gradient(135deg, #ef4444, #dc2626); }

/* ----- Stats Grid ----- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    overflow: hidden;
}
.stat-value {
    font-size: 32px;
    font-weight: 700;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.2;
}
.stat-label {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

/* ----- Grid layouts ----- */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

/* ----- Empty state ----- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
}
.empty-state-icon svg {
    width: 48px;
    height: 48px;
}
.icon-inline {
    display: inline-flex;
    vertical-align: middle;
}


/* ============================================================================
   BUTTONS - Кнопки
   ============================================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-decoration: none;
}
.btn-primary {
    background: var(--gradient-1);
    color: white;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px var(--accent-glow);
}
.btn-secondary {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
}
.btn-secondary:hover {
    border-color: var(--accent);
}
.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}
.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(239, 68, 68, 0.3);
}
.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}
.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.3);
}
.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}


/* ============================================================================
   FORMS - Формы и поля ввода
   ============================================================================ */

.form-group {
    margin-bottom: 20px;
}
.form-label {
    display: block;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}
.form-input,
.form-select,
input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
select,
textarea {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 16px;
    transition: all 0.2s;
    font-family: inherit;
    cursor: pointer;
}
.form-input:focus,
.form-select:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-input::placeholder,
input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}


/* ============================================================================
   TABLES - Таблицы
   ============================================================================ */

.table-wrapper,
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
th {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
tr:hover td {
    background: var(--bg-card-hover);
}


/* ============================================================================
   BADGES - Бейджи и статусы
   ============================================================================ */

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}
.badge-success { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.badge-danger { background: rgba(239, 68, 68, 0.2); color: var(--danger); }
.badge-info { background: rgba(99, 102, 241, 0.2); color: var(--accent); }
.badge-primary { background: rgba(13, 110, 253, 0.2); color: #6ea8fe; }
.badge-secondary { background: rgba(108, 117, 125, 0.2); color: #adb5bd; }

/* Роли */
.badge-admin { background: #ef4444; color: white; }
.badge-police { background: #0d6efd; color: white; }
.badge-medic { background: #be185d; color: white; }
.badge-gang { background: #ffc107; color: black; }
.badge-gang-leader { background: #fd7e14; color: white; }
.badge-civil { background: #6c757d; color: white; }


/* ============================================================================
   LOGIN PAGE - Страница входа
   ============================================================================ */

.login-container {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.login-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.login-logo {
    text-align: center;
    margin-bottom: 32px;
}
.login-logo img {
    max-width: 100%;
    max-height: 80px;
    height: auto;
    width: auto;
    object-fit: contain;
}
.login-logo h1 {
    font-size: 28px;
    font-weight: 700;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.login-logo p {
    color: var(--text-secondary);
    margin-top: 8px;
}
.login-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
}
.login-hint {
    text-align: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 13px;
}
.login-hint code {
    background: var(--bg-secondary);
    padding: 2px 8px;
    border-radius: 4px;
    color: var(--accent);
}

.uid-help {
    margin-top: 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    background: rgba(255,255,255,0.02);
}

.uid-help-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: color 0.2s;
}

.uid-help-toggle:hover {
    color: var(--text-primary);
}

.uid-help-chevron {
    margin-left: auto;
    transition: transform 0.2s;
}

.uid-help.open .uid-help-chevron {
    transform: rotate(180deg);
}

.uid-help-content {
    display: none;
    padding: 0 16px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.uid-help.open .uid-help-content {
    display: block;
}

.uid-help-content p {
    margin: 0 0 10px;
}

.uid-help-content ol,
.uid-help-content ul {
    margin: 0 0 8px;
    padding-left: 20px;
}

.uid-help-content li {
    margin-bottom: 4px;
}

.uid-help-content strong {
    color: var(--text-primary);
}

.privacy-consent {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

.privacy-consent input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 1px;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
}

.privacy-consent a {
    color: var(--accent);
    text-decoration: none;
}

.privacy-consent a:hover {
    text-decoration: underline;
}


/* ============================================================================
   NOTIFICATIONS - Уведомления (dropdown)
   ============================================================================ */

.notif-wrapper {
    position: relative;
    flex: 1;
}
.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    pointer-events: none;
}
.notif-dropdown {
    position: absolute;
    top: 46px;
    right: 0;
    width: 360px;
    max-height: 480px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    display: none;
    z-index: 10001;
    overflow: hidden;
}
.notif-dropdown.show {
    display: block;
}
.notif-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}
.notif-mark-all {
    background: transparent;
    border: none;
    color: var(--accent);
    font-size: 12px;
    cursor: pointer;
}
.notif-mark-all:hover {
    text-decoration: underline;
}
.notif-list {
    max-height: 400px;
    overflow-y: auto;
}
.notif-item {
    display: block;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    transition: background 0.2s;
    cursor: pointer;
}
.notif-item:hover {
    background: var(--bg-card-hover);
}
.notif-item.unread {
    background: rgba(99, 102, 241, 0.1);
}
.notif-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.notif-item-title {
    font-weight: 600;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.notif-item-time {
    font-size: 11px;
    color: var(--text-muted);
}
.notif-item-message {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}
.notif-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-muted);
}


/* ============================================================================
   TOAST - Всплывающие уведомления
   ============================================================================ */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
    pointer-events: none;
}
.toast {
    background: linear-gradient(135deg, rgba(30, 32, 40, 0.98), rgba(20, 22, 28, 0.98));
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: 12px;
    padding: 16px 48px 16px 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(99, 102, 241, 0.1);
    animation: toastSlideIn 0.3s ease;
    position: relative;
    pointer-events: auto;
    backdrop-filter: blur(10px);
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--accent); }
.toast.warning { border-left-color: var(--warning); }
.toast.mention {
    border-left-color: #f59e0b;
    background: linear-gradient(135deg, rgba(40, 35, 25, 0.98), rgba(30, 25, 18, 0.98));
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(245, 158, 11, 0.15);
}
.toast.mention:hover {
    transform: translateX(-5px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(245, 158, 11, 0.25);
}
.toast.mention .toast-title {
    display: flex;
    align-items: center;
    color: #f59e0b;
}
.toast.mention .toast-title svg {
    color: #f59e0b;
    flex-shrink: 0;
}
.toast-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.toast-message {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}
.toast-amount {
    font-weight: 700;
    color: var(--success);
    font-size: 15px;
}
.toast-amount.negative { color: var(--danger); }
.toast-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 4px;
    opacity: 0.6;
    transition: opacity 0.2s;
}
.toast-close:hover { opacity: 1; }
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--accent);
    border-radius: 0 0 0 12px;
    animation: toastProgress 15s linear forwards;
}
.toast.success .toast-progress { background: var(--success); }
.toast.error .toast-progress { background: var(--danger); }
.toast.warning .toast-progress { background: var(--warning); }

@keyframes toastSlideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes toastSlideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}
@keyframes toastProgress {
    from { width: 100%; }
    to { width: 0%; }
}


/* Old donate section removed - styles consolidated in PAGE: Donate section below */


/* ============================================================================
   FOOTER - Подвал
   ============================================================================ */

.lk-footer {
    margin-top: auto;
    margin-left: 240px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    text-align: center;
    flex-shrink: 0;
}
.lk-footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}
.lk-footer a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s;
}
.lk-footer a:hover {
    color: var(--accent);
}
.lk-footer-copy {
    color: var(--text-muted);
    font-size: 12px;
}


/* ============================================================================
   COOKIE CONSENT - Баннер согласия
   ============================================================================ */

.cookie-consent {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, rgba(30, 32, 40, 0.98), rgba(20, 22, 28, 0.98));
    border-top: 1px solid var(--border);
    padding: 20px;
    z-index: 100000;
    backdrop-filter: blur(10px);
    display: none;
    animation: slideUp 0.3s ease;
}
.cookie-consent.show { display: block; }
@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.cookie-consent-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}
.cookie-consent-text { flex: 1; min-width: 280px; }
.cookie-consent-text h4 {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px 0;
}
.cookie-consent-text p {
    color: var(--text-secondary);
    font-size: 13px;
    margin: 0;
    line-height: 1.5;
}
.cookie-consent-text a { color: var(--accent); text-decoration: none; cursor: pointer; }
.cookie-consent-text a:hover { text-decoration: underline; }
.cookie-consent-buttons { display: flex; gap: 12px; flex-shrink: 0; }
.cookie-btn {
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}
.cookie-btn-accept { background: linear-gradient(135deg, #10b981, #059669); color: white; }
.cookie-btn-accept:hover { background: linear-gradient(135deg, #059669, #047857); transform: translateY(-1px); }
.cookie-btn-decline { background: var(--bg-secondary); color: var(--text-secondary); border: 1px solid var(--border); }
.cookie-btn-decline:hover { background: var(--bg-tertiary); color: var(--text-primary); }


/* ============================================================================
   MODALS - Модальные окна
   ============================================================================ */

.privacy-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 100001;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.privacy-modal-overlay.show { display: flex; }
.privacy-modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    max-width: 700px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalFadeIn 0.3s ease;
}
@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
.privacy-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.privacy-modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: var(--text-primary);
}
.privacy-modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    transition: color 0.2s;
}
.privacy-modal-close:hover { color: var(--text-primary); }
.privacy-modal-body {
    padding: 24px;
    overflow-y: auto;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.7;
}
.privacy-modal-body h3 {
    color: var(--text-primary);
    font-size: 16px;
    margin: 24px 0 12px 0;
}
.privacy-modal-body h3:first-child { margin-top: 0; }
.privacy-modal-body p { margin: 0 0 12px 0; }
.privacy-modal-body ul { padding-left: 20px; margin: 12px 0; }
.privacy-modal-body li { margin: 6px 0; }
.privacy-modal-body .highlight {
    background: rgba(99, 102, 241, 0.1);
    border-left: 3px solid var(--accent);
    padding: 12px 16px;
    border-radius: 0 8px 8px 0;
    margin: 16px 0;
}
.privacy-modal-body .privacy-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 13px;
}
.privacy-modal-body .privacy-table th,
.privacy-modal-body .privacy-table td {
    padding: 10px 12px;
    text-align: left;
    border: 1px solid var(--border);
}
.privacy-modal-body .privacy-table th {
    background: rgba(99, 102, 241, 0.1);
    font-weight: 600;
    color: var(--text-primary);
}
.privacy-modal-body .privacy-table td {
    background: var(--bg-secondary);
}
.privacy-modal-body .privacy-table tr:hover td {
    background: rgba(99, 102, 241, 0.05);
}
.privacy-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    text-align: center;
}


/* ============================================================================
   PROFILE SETTINGS MODAL - Настройки профиля
   ============================================================================ */

.profile-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 100001;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.profile-modal-overlay.show { display: flex; }

.profile-modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    max-width: 480px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalFadeIn 0.3s ease;
}

.profile-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.profile-modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: var(--text-primary);
}
.profile-modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    transition: color 0.2s;
}
.profile-modal-close:hover { color: var(--text-primary); }

.profile-modal-body {
    padding: 24px;
    overflow-y: auto;
}

.profile-section {
    margin-bottom: 32px;
}
.profile-section:last-child {
    margin-bottom: 0;
}
.profile-section h3 {
    color: var(--text-primary);
    font-size: 16px;
    margin: 0 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

/* ----- Avatar Upload ----- */
.avatar-upload-area {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.avatar-preview {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--bg-secondary);
    border: 3px solid var(--border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.avatar-placeholder {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}

.avatar-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.avatar-controls .btn {
    padding: 8px 16px;
    font-size: 13px;
}
.avatar-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
}

.avatar-status, .password-status {
    margin-top: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    display: none;
}
.avatar-status:not(:empty), .password-status:not(:empty) {
    display: block;
}
.avatar-status.success, .password-status.success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.avatar-status.error, .password-status.error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.avatar-status.loading, .password-status.loading {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

/* ----- Password Form ----- */
.profile-section .form-group {
    margin-bottom: 16px;
}
.profile-section .form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}
.profile-section .form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.profile-section .form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.profile-section .form-hint {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-muted);
}

/* ----- Permissions List ----- */
.permissions-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.permission-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.permission-row:last-child {
    border-bottom: none;
}

.permission-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.permission-label {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.permission-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
    transition: color 0.2s;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: #3a3a3c;
    border-radius: 24px;
    transition: background 0.2s;
}

.toggle-slider::before {
    content: "";
    position: absolute;
    left: 3px;
    top: 3px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* btn-sm and btn-danger defined in BUTTONS section above */

/* ----- Profile modal — tablet (< 768px) ----- */
@media (max-width: 768px) {
    .profile-modal {
        max-height: 90vh;
        max-height: 90dvh;
    }
    .profile-modal-overlay {
        padding: 12px;
    }
    .profile-modal-header {
        padding: 16px 20px;
    }
    .profile-modal-body {
        padding: 20px;
    }
    .profile-modal-close {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .profile-section .form-control {
        font-size: 16px; /* Prevent iOS zoom */
        padding: 12px 14px;
    }
    .permission-row {
        gap: 8px;
    }
    .permission-label {
        font-size: 13px;
    }
}

/* ----- Profile modal — phone (< 480px) ----- */
@media (max-width: 480px) {
    .profile-modal-overlay {
        padding: 0;
        align-items: stretch;
    }
    .profile-modal {
        max-width: 100%;
        max-height: 100vh;
        max-height: 100dvh;
        border-radius: 0;
        height: 100%;
    }
    .profile-modal-header {
        padding: 14px 16px;
        padding-top: max(14px, env(safe-area-inset-top));
    }
    .profile-modal-header h2 {
        font-size: 18px;
    }
    .profile-modal-body {
        padding: 16px;
    }
    .profile-section {
        margin-bottom: 24px;
    }
    .avatar-upload-area {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .avatar-preview {
        width: 80px;
        height: 80px;
    }
    .avatar-placeholder {
        font-size: 28px;
    }
    .avatar-controls {
        align-items: center;
    }
    .avatar-controls .btn {
        min-height: 44px;
        padding: 10px 20px;
    }
    .permission-info {
        gap: 8px;
    }
    .permission-hint {
        font-size: 11px;
    }
}


/* ============================================================================
   CHAT - Стили чата (страница /lk)
   ============================================================================ */

.chat-container {
    display: flex;
    flex-direction: column;
    height: 500px;
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
}
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.chat-message {
    padding: 8px 12px;
    background: var(--bg-card);
    border-radius: 8px;
    max-width: 85%;
}
.chat-message.own {
    align-self: flex-end;
    background: var(--accent);
}
.chat-message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.chat-message-author {
    font-weight: 600;
    font-size: 13px;
}
.chat-message-time {
    font-size: 11px;
    color: var(--text-muted);
}
.chat-message-text {
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}
/* Chat input - unified style like DM */
.chat-input-container {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
}
.chat-input-wrapper {
    display: flex;
    gap: 4px;
    align-items: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 4px 8px;
    transition: all 0.2s;
}
.chat-input-wrapper:focus-within {
    border-color: var(--border);
}
.chat-input {
    flex: 1;
    padding: 8px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    min-width: 0;
}
.chat-input:focus {
    outline: none;
    border-color: transparent;
    box-shadow: none;
}
.chat-send-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
    flex-shrink: 0;
}
.chat-send-btn:hover {
    color: var(--text-primary);
    background: var(--bg-darker);
}
.chat-send-btn svg {
    width: 20px;
    height: 20px;
}


/* ============================================================================
   ADMIN PAGES - Стили для страниц администрирования
   ============================================================================ */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.page-header h1 {
    margin: 0;
    font-size: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.py-4 { padding-top: 1.5rem; padding-bottom: 1.5rem; }

.alert {
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 14px;
}
.alert-danger,
.alert-error {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.alert-success {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.alert-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* ============================================================================
   RESPONSIVE - Admin pages
   ============================================================================ */

@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }
    .page-header h1 { font-size: 18px; }
}

/* ----- Безопасные отступы (notch, home indicator) ----- */
@media (max-width: 900px) {
    @supports (padding: max(0px)) {
        body {
            padding-top: env(safe-area-inset-top);
            padding-left: max(0px, env(safe-area-inset-left));
            padding-right: max(0px, env(safe-area-inset-right));
            padding-bottom: max(0px, env(safe-area-inset-bottom));
        }
        .toast-container {
            bottom: max(70px, calc(env(safe-area-inset-bottom) + 10px));
        }
        .cookie-consent {
            padding-bottom: max(20px, env(safe-area-inset-bottom));
        }
        .sidebar {
            padding-bottom: max(16px, env(safe-area-inset-bottom));
        }
        .sidebar-toggle {
            top: max(12px, env(safe-area-inset-top, 12px));
            left: max(12px, env(safe-area-inset-left, 12px));
        }
        .topbar {
            top: max(12px, env(safe-area-inset-top, 12px));
            right: max(12px, env(safe-area-inset-right, 12px));
        }
    }
}

/* ----- iOS zoom prevention & touch targets ----- */
@media (max-width: 768px) {
    input, textarea, select {
        font-size: 16px !important;
    }
    button, .btn, [onclick] {
        min-height: 44px;
    }
}

/* ============================================================================
   ADMIN - Important rules badge & highlight
   ============================================================================ */

.badge-important {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.15) 0%, rgba(234, 88, 12, 0.1) 100%);
    border: 1px solid rgba(249, 115, 22, 0.3);
    color: #f97316;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

tr.row-important {
    background: linear-gradient(90deg, rgba(249, 115, 22, 0.08) 0%, transparent 100%);
}

tr.row-important:hover {
    background: linear-gradient(90deg, rgba(249, 115, 22, 0.12) 0%, var(--bg-tertiary) 100%);
}

/* Public rules page - important rule highlight */
.rule-item-important {
    background: linear-gradient(90deg, rgba(249, 115, 22, 0.1) 0%, var(--bg-secondary) 100%);
    border-color: rgba(249, 115, 22, 0.3);
}

.rule-item-important:hover {
    background: linear-gradient(90deg, rgba(249, 115, 22, 0.15) 0%, var(--bg-card-hover) 100%);
    border-color: rgba(249, 115, 22, 0.5);
}


/* ============================================================================
   RESPONSIVE - Мобильная адаптация
   ============================================================================ */

/* ----- Планшеты и большие телефоны (< 1024px) ----- */
@media (max-width: 1024px) {
    .container {
        padding: 0 16px;
    }
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 12px;
    }
    .grid-2 {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .donate-hero h1 {
        font-size: 32px;
    }
    .donate-hero p {
        font-size: 16px;
    }
}

/* ----- Мобильные устройства (< 900px) ----- */
@media (max-width: 900px) {
    /* Показываем кнопку меню */
    .sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        font-size: 22px;
    }

    /* Скрываем сайдбар по умолчанию */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: none;
    }

    /* Показываем сайдбар при открытии */
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
    }

    /* Показываем оверлей при открытом сайдбаре */
    .sidebar-overlay {
        display: block;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }
    .sidebar-overlay.open {
        opacity: 1;
        visibility: visible;
    }

    /* Убираем отступ слева у контента */
    .main {
        margin-left: 0;
        padding: 80px 0 32px 0;
    }

    /* Перемещаем topbar */
    .topbar {
        top: 12px;
        right: 12px;
    }

    /* Убираем отступ у футера */
    .lk-footer {
        margin-left: 0;
    }

    /* Адаптируем карточки */
    .card {
        padding: 16px;
        border-radius: 12px;
    }
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .card-title {
        font-size: 16px;
    }

    /* Адаптируем статистику */
    .stat-card {
        padding: 16px;
    }
    .stat-value {
        font-size: 24px;
    }
    .stat-label {
        font-size: 12px;
    }

    /* Адаптируем таблицы */
    th, td {
        padding: 10px 12px;
        font-size: 13px;
    }
    th {
        font-size: 11px;
    }

    /* Таблицы внутри карточек (Персонаж, Участники банды) */
    .card table {
        display: block;
        width: 100%;
    }
    .card table thead {
        display: none;
    }
    .card table tbody {
        display: block;
    }
    .card table tr {
        display: flex;
        flex-direction: column;
        padding: 12px 0;
        border-bottom: 1px solid var(--border);
    }
    .card table tr:last-child {
        border-bottom: none;
    }
    .card table td {
        display: block;
        padding: 4px 0;
        border: none;
        text-align: left;
    }
    .card table td:first-child {
        font-size: 12px;
        color: var(--text-muted);
        margin-bottom: 2px;
    }
    .card table td:last-child {
        font-size: 14px;
    }

    /* Статистика банды - компактнее */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    /* Таблицы со скроллом (не вертикальные карточки) */
    .table-responsive table,
    .table-scroll table {
        display: table;
        min-width: 400px;
    }
    .table-responsive table thead,
    .table-scroll table thead {
        display: table-header-group;
    }
    .table-responsive table tbody,
    .table-scroll table tbody {
        display: table-row-group;
    }
    .table-responsive table tr,
    .table-scroll table tr {
        display: table-row;
        flex-direction: unset;
        padding: 0;
        border-bottom: none;
    }
    .table-responsive table td,
    .table-scroll table td,
    .table-responsive table th,
    .table-scroll table th {
        display: table-cell;
        border-bottom: 1px solid var(--border);
    }

    /* Уведомления dropdown */
    .notif-dropdown {
        position: fixed;
        top: 60px;
        right: 12px;
        left: 12px;
        width: auto;
        max-height: calc(100vh - 80px);
        max-height: calc(100dvh - 80px);
    }

    /* Донат карточки */
    .donate-grid {
        grid-template-columns: 1fr;
    }
    .donate-hero {
        padding: 40px 16px;
    }
    .donate-hero h1 {
        font-size: 28px;
    }

    /* Чат */
    .chat-container {
        height: 400px;
    }
    .chat-input-container {
        flex-direction: column;
    }
    .chat-send-btn {
        width: 100%;
    }

    /* Кнопки */
    .btn {
        padding: 10px 18px;
        font-size: 13px;
    }

    /* Cookie consent */
    .cookie-consent-inner {
        flex-direction: column;
        text-align: center;
    }
    .cookie-consent-buttons {
        width: 100%;
        justify-content: center;
    }
}

/* ----- Маленькие телефоны (< 480px) ----- */
@media (max-width: 480px) {
    .container {
        padding: 0 12px;
    }

    .sidebar-toggle {
        top: 10px;
        left: 10px;
    }

    .topbar {
        top: 10px;
        right: 10px;
    }
    .topbar-actions {
        gap: 4px;
    }
    .topbar-btn {
        width: 38px;
        height: 38px;
        border-radius: 10px;
        min-width: 38px;
        min-height: 38px;
    }

    .main {
        padding: 64px 0 24px 0;
    }

    .card {
        padding: 14px;
        margin-bottom: 16px;
    }
    .card-header {
        margin-bottom: 14px;
        padding-bottom: 12px;
    }
    .card-title {
        font-size: 15px;
    }
    .card-icon {
        width: 34px;
        height: 34px;
        font-size: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .stat-card {
        padding: 12px;
    }
    .stat-value {
        font-size: 18px;
    }
    .stat-label {
        font-size: 11px;
    }

    /* Таблицы внутри карточек - вертикальный список */
    .card table {
        min-width: unset;
    }
    .card table td:first-child {
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.3px;
    }

    /* Таблицы с горизонтальным скроллом */
    .table-responsive table {
        min-width: 400px;
    }
    th, td {
        padding: 8px 10px;
        font-size: 12px;
    }

    /* Бейджи */
    .badge {
        padding: 3px 8px;
        font-size: 11px;
    }

    /* Формы */
    .form-input,
    .form-select,
    input[type="text"],
    input[type="password"],
    input[type="number"],
    input[type="email"],
    select,
    textarea {
        padding: 12px 14px;
        font-size: 16px; /* Предотвращает зум на iOS */
    }

    /* Логин */
    .login-box {
        padding: 24px 20px;
    }
    .login-logo h1 {
        font-size: 24px;
    }

    /* Empty state */
    .empty-state {
        padding: 40px 16px;
    }
    .empty-state-icon {
        font-size: 40px;
    }
    .empty-state-icon svg {
        width: 40px;
        height: 40px;
    }

    /* Page header */
    .page-header h1 {
        font-size: 16px;
    }

    /* Алерты */
    .alert {
        padding: 12px 16px;
        font-size: 13px;
    }

    /* Toast на мобильном */
    .toast-container {
        top: auto;
        bottom: 20px;
        right: 12px;
        left: 12px;
        max-width: none;
    }
    .toast {
        padding: 14px 40px 14px 16px;
    }

    /* Лицензии */
    .licenses-row {
        gap: 6px;
    }
    .badge-license {
        font-size: 10px;
        padding: 3px 8px;
    }

    /* Новости виджет */
    .news-widget-container {
        gap: 10px;
    }
    .news-w-all-link {
        font-size: 12px;
    }
}

/* ----- Скрытие элементов на мобильном ----- */
@media (max-width: 900px) {
    .hide-mobile {
        display: none !important;
    }
}

/* ----- Показ элементов только на мобильном ----- */
.show-mobile {
    display: none !important;
}
@media (max-width: 900px) {
    .show-mobile {
        display: block !important;
    }
}

/* ----- Landscape mode на телефонах ----- */
@media (max-width: 900px) and (orientation: landscape) {
    .sidebar {
        width: 280px;
    }
    .main {
        padding-top: 60px;
    }
    .chat-container {
        height: 300px;
    }
}

/* ----- Улучшения доступности и UX ----- */
@media (max-width: 900px) {
    /* Плавное появление кнопки меню */
    .sidebar-toggle {
        animation: fadeIn 0.3s ease;
    }

    /* Улучшение навигации — увеличенные тач-таргеты */
    .nav-link {
        padding: 12px 14px;
        font-size: 15px;
        min-height: 44px;
    }

    /* Секции навигации (МВД, Админ) */
    .nav-section {
        margin-top: 12px;
        padding: 10px 14px;
        font-size: 11px;
    }

    /* Сайдбар - увеличиваем лого для мобильного */
    .sidebar-logo {
        padding: 12px 20px 16px;
    }
    .sidebar-logo img {
        max-height: 50px;
    }

    /* Sidebar — safe area для iPhone home indicator */
    .sidebar {
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }

}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ----- Touch-friendly improvements ----- */
@media (hover: none) and (pointer: coarse) {
    /* Увеличиваем область нажатия на сенсорных устройствах */
    .btn {
        min-height: 44px;
    }
    .nav-link {
        min-height: 44px;
    }
    .topbar-btn {
        min-width: 44px;
        min-height: 44px;
    }

    /* Убираем hover эффекты на touch */
    .nav-link:hover {
        background: transparent;
        color: var(--text-secondary);
    }
    .nav-link.active:hover {
        background: var(--accent);
        color: white;
    }
}

/* ----- Print styles (скрываем навигацию при печати) ----- */
@media print {
    .sidebar,
    .sidebar-toggle,
    .sidebar-overlay,
    .topbar,
    .lk-footer,
    .cookie-consent,
    .toast-container {
        display: none !important;
    }
    .main {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    body {
        background: white;
        color: black;
    }
}

/* ============================================================================
   СТРАНИЦА СООБЩЕНИЙ (DM)
   ============================================================================ */

.messages-container {
    display: flex;
    height: calc(100vh - 180px);
    height: calc(100dvh - 180px);
    min-height: 500px;
    background: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border);
}

/* ===== Sidebar с диалогами ===== */
.dm-sidebar {
    width: 320px;
    min-width: 280px;
    background: var(--bg-darker);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.dm-sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.dm-sidebar-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.dm-search {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.dm-search-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.dm-search-input:focus {
    outline: none;
    border-color: var(--border);
    box-shadow: none;
}

.dm-search-input::placeholder {
    color: var(--text-muted);
}

.dm-conversations {
    flex: 1;
    overflow-y: auto;
}

.dm-conv-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid var(--border);
}

.dm-conv-item:hover {
    background: var(--bg-secondary);
}

.dm-conv-item.active {
    background: rgba(99, 102, 241, 0.15);
    border-left: 3px solid var(--accent);
}

.dm-conv-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    flex-shrink: 0;
    position: relative;
}

.dm-conv-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* Индикатор онлайн на аватаре в списке диалогов */
.dm-online-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #6b7280;
    border: 2px solid var(--bg-card);
    transition: background 0.2s;
}

.dm-online-dot.online {
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}

/* Индикатор онлайн в хедере чата */
.dm-header-online-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #6b7280;
    border: 2px solid var(--bg-card);
    transition: background 0.2s;
}

.dm-header-online-dot.online {
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}

.dm-conv-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.dm-conv-name {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dm-conv-preview {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dm-conv-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.dm-conv-time {
    font-size: 11px;
    color: var(--text-muted);
}

.dm-conv-unread {
    background: var(--accent);
    color: white;
    font-size: 11px;
    font-weight: 600;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}

/* ===== Панель чата ===== */
.dm-chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.dm-chat-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
}

.dm-chat-header-info {
    flex: 1;
}

.dm-chat-partner-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.dm-chat-status {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.dm-chat-status.online {
    color: #22c55e;
}

.dm-chat-status.hidden {
    display: none;
}

.dm-chat-typing {
    font-size: 12px;
    color: var(--accent);
    margin-top: 2px;
    display: none;
}

.dm-chat-typing.show {
    display: block;
}

.dm-chat-actions {
    display: flex;
    gap: 8px;
    position: relative;
}

.dm-chat-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: var(--bg-secondary);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.dm-chat-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Dropdown меню действий */
.dm-actions-dropdown {
    position: absolute;
    top: 44px;
    right: 0;
    width: 220px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    display: none;
    z-index: 100;
    overflow: hidden;
}

.dm-actions-dropdown.show {
    display: block;
}

.dm-actions-header {
    padding: 12px 16px;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dm-action-item {
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.15s;
    text-align: left;
}

.dm-action-item:hover {
    background: var(--bg-secondary);
}

.dm-action-item svg {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}

.dm-action-item.dm-action-danger {
    color: var(--danger);
}

.dm-action-item.dm-action-danger svg {
    color: var(--danger);
}

.dm-action-item.dm-action-success {
    color: var(--success);
}

.dm-action-item.dm-action-success svg {
    color: var(--success);
}

.dm-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: #0d0d14;
    background-image: radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.03) 0%, transparent 50%),
                      radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.03) 0%, transparent 50%);
}

/* ===== Message Animations ===== */
@keyframes dmMsgIn {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes dmMsgSend {
    0%   { opacity: 0; transform: translateX(20px) scale(0.95); }
    60%  { transform: translateX(-2px) scale(1.01); }
    100% { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes dmChatFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.dm-messages.chat-switching {
    animation: dmChatFadeIn 0.25s ease;
}

/* ===== VK-style Messages ===== */
.dm-msg {
    display: flex;
    gap: 10px;
    max-width: 70%;
    position: relative;
    padding: 2px 0;
    transition: opacity 0.1s;
}

.dm-msg.msg-anim-in {
    animation: dmMsgIn 0.3s ease both;
}

.dm-msg.own.msg-anim-send {
    animation: dmMsgSend 0.35s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

.dm-msg:hover {
    cursor: pointer;
}

.dm-msg:active {
    opacity: 0.85;
}

.dm-msg.own {
}

/* Аватар у сообщений */
.dm-msg-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
    align-self: flex-end;
}

/* Скрытый аватар (для группировки) - занимает место но невидим */
.dm-msg.grouped .dm-msg-avatar {
    visibility: hidden;
}

/* Меньший отступ для группированных сообщений */
.dm-msg.grouped {
    margin-top: -4px;
}

.dm-msg-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* Входящие сообщения - светлый фон */
.dm-msg-content {
    background: #232324;
    padding: 10px 14px;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    position: relative;
    min-width: 80px;
}

/* Свои сообщения - чуть светлее */
.dm-msg.own .dm-msg-content {
    background: #2a2a3a;
    color: var(--text-primary);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
}

/* VK-style Reply */
.dm-msg-reply {
    font-size: 13px;
    padding: 6px 10px;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    margin-bottom: 8px;
    border-left: 2px solid #5181b8;
    cursor: pointer;
}

.dm-msg-reply:hover {
    background: rgba(0,0,0,0.3);
}

.dm-msg-reply-name {
    font-weight: 600;
    margin-bottom: 2px;
    color: #5181b8;
}

.dm-msg-reply-text {
    opacity: 0.85;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
}

.dm-msg-text {
    font-size: 14px;
    word-break: break-word;
    white-space: pre-wrap;
    line-height: 1.4;
    color: var(--text-primary);
}

/* Footer с временем и галочкой - ВК стиль */
.dm-msg-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 4px;
    float: right;
    margin-left: 12px;
}

.dm-msg-time {
    font-size: 12px;
    color: #71757a;
}

/* Галочка прочитанности */
.dm-msg-status {
    display: inline-flex;
    align-items: center;
    margin-left: 3px;
    vertical-align: middle;
    line-height: 1;
}
.dm-msg-status svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: #71757a;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke 0.2s ease;
}
.dm-msg-status.read svg {
    stroke: #5b9bd5;
}

/* Кнопка удаления скрыта, появляется в контекстном меню */
.dm-msg-delete {
    display: none;
}

/* ===== VK-style контекстное меню ===== */
.dm-context-menu {
    position: fixed;
    background: #2a2a2c;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.4);
    z-index: 10000;
    min-width: 200px;
    overflow: hidden;
    animation: contextMenuIn 0.15s ease;
}

@keyframes contextMenuIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Панель реакций */
.dm-reactions-bar {
    display: flex;
    gap: 2px;
    padding: 8px 12px;
    border-bottom: 1px solid #3a3a3c;
    justify-content: center;
}

.dm-reaction-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s, background 0.15s;
    animation: reactionBtnIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}
.dm-reaction-btn .lottie-reaction-menu {
    width: 24px;
    height: 24px;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}
.dm-reaction-btn:nth-child(1) { animation-delay: 0s; }
.dm-reaction-btn:nth-child(2) { animation-delay: 0.03s; }
.dm-reaction-btn:nth-child(3) { animation-delay: 0.06s; }
.dm-reaction-btn:nth-child(4) { animation-delay: 0.09s; }
.dm-reaction-btn:nth-child(5) { animation-delay: 0.12s; }
.dm-reaction-btn:nth-child(6) { animation-delay: 0.15s; }
.dm-reaction-btn:nth-child(7) { animation-delay: 0.18s; }
.dm-reaction-btn:nth-child(8) { animation-delay: 0.21s; }

@keyframes reactionBtnIn {
    from {
        opacity: 0;
        transform: scale(0) translateY(8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.dm-reaction-btn:hover {
    background: #3a3a3c;
    transform: scale(1.25);
}

.dm-reaction-btn:active {
    transform: scale(0.85);
    transition: transform 0.08s;
}

/* Пункты меню */
.dm-context-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.dm-context-item:hover {
    background: #3a3a3c;
}

.dm-context-item svg {
    width: 20px;
    height: 20px;
    color: #8a8a8e;
}

.dm-context-item.danger {
    color: #e64646;
}

.dm-context-item.danger svg {
    color: #e64646;
}

.dm-context-sep {
    height: 1px;
    background: #3a3a3c;
    margin: 4px 0;
}

/* ===== Сообщения о звонках ===== */
.dm-msg-call {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin: 8px auto;
    max-width: 280px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.dm-msg-call-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dm-msg-call.call-answered .dm-msg-call-icon {
    background: rgba(40, 167, 69, 0.15);
    color: #28a745;
}

.dm-msg-call.call-missed .dm-msg-call-icon {
    background: rgba(220, 53, 69, 0.15);
    color: #dc3545;
}

.dm-msg-call.call-rejected .dm-msg-call-icon {
    background: rgba(255, 193, 7, 0.15);
    color: #ffc107;
}

.dm-msg-call-info {
    flex: 1;
    min-width: 0;
}

.dm-msg-call-text {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
}

.dm-msg-call-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ===== Форма ввода ===== */
.dm-input-form {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
}

.dm-reply-preview {
    display: none;
    background: var(--bg-secondary);
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 13px;
    align-items: center;
    gap: 10px;
}

.dm-reply-preview.show {
    display: flex;
}

.dm-reply-preview-content {
    flex: 1;
    min-width: 0;
}

.dm-reply-preview-name {
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 2px;
}

.dm-reply-preview-text {
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dm-reply-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 18px;
}

.dm-input-wrapper {
    display: flex;
    gap: 4px;
    align-items: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 4px 8px;
    transition: all 0.2s;
}

.dm-input-wrapper:focus-within {
    border-color: var(--border);
}

.dm-input {
    flex: 1;
    padding: 8px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    resize: none;
    max-height: 120px;
    outline: none;
    min-width: 0;
    overflow-y: hidden;
}

.dm-input:focus {
    outline: none;
    border-color: transparent;
    box-shadow: none;
}

.dm-input-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.dm-input-btn:hover {
    color: var(--text-primary);
    background: var(--bg-darker);
}

.dm-input-btn svg {
    width: 20px;
    height: 20px;
}

.dm-send-btn {
    color: var(--accent);
}

.dm-send-btn:hover {
    color: var(--accent-hover);
    background: rgba(139, 92, 246, 0.1);
}

/* ===== Emoji picker DM ===== */
.dm-emoji-picker-wrapper {
    position: relative;
    flex-shrink: 0;
}

.dm-emoji-picker {
    position: absolute;
    bottom: 50px;
    left: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    display: none;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
    z-index: 100;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.dm-emoji-picker.show {
    display: grid;
}

.dm-emoji-picker span {
    font-size: 22px;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    text-align: center;
    transition: background 0.15s;
}

.dm-emoji-picker span:hover {
    background: var(--bg-secondary);
}

/* ===== Image preview (перед отправкой) ===== */
.dm-image-preview {
    display: none;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    position: relative;
}

.dm-image-preview.show {
    display: block;
}

.dm-image-preview img {
    max-width: 200px;
    max-height: 150px;
    border-radius: 8px;
    object-fit: contain;
}

.dm-image-preview-close {
    position: absolute;
    top: 4px;
    right: 8px;
    width: 24px;
    height: 24px;
    border: none;
    background: var(--bg-darker);
    color: var(--text-primary);
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dm-image-preview-close:hover {
    background: var(--danger);
    color: white;
}

/* ===== Message image ===== */
.dm-msg-image {
    margin-bottom: 8px;
}

.dm-msg-image img {
    max-width: 300px;
    max-height: 300px;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.dm-msg-image img:hover {
    opacity: 0.9;
}

/* ===== Unified Chat Styles (for complaints/support pages) ===== */
/* Avatar letter inside dm-msg-avatar */
.dm-msg-avatar-letter {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: white;
}

.dm-msg-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* Header with name and time for unified chat */
.dm-msg-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.dm-msg-name {
    font-weight: 600;
    font-size: 13px;
    color: #9ca3af;
}

/* Admin messages styling */
.dm-msg.admin {
    padding-left: 4px;
}

.dm-msg.admin .dm-msg-avatar,
.dm-msg.admin .dm-msg-avatar-letter {
    background: #ef4444;
}

.dm-msg.admin .dm-msg-name {
    color: #ef4444;
}

.dm-msg.admin .dm-msg-content {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.08));
    border-left: 3px solid #ef4444;
    border-radius: 4px 18px 18px 4px;
}

/* Closed chat indicator */
.dm-chat-closed {
    padding: 16px 20px;
    text-align: center;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    font-size: 14px;
}

/* Page-specific dm-messages container */
.page-chat .dm-messages {
    max-height: 400px;
    min-height: 200px;
}

/* DM action buttons (reply, delete) */
.dm-msg-actions {
    display: flex;
    gap: 4px;
    margin-top: 4px;
    align-items: center;
}
.dm-msg-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    padding: 2px 6px;
    border-radius: 6px;
    color: var(--text-muted);
    transition: all 0.15s;
    opacity: 0;
}
.dm-msg:hover .dm-msg-action-btn { opacity: 1; }
.dm-msg-action-btn:hover { background: var(--bg-darker); color: var(--text-primary); }
.dm-msg-delete-btn:hover { color: #ef4444; }

/* ===== VK-style Link Preview ===== */
.dm-link-preview {
    display: flex;
    gap: 12px;
    background: #1a1a1b;
    border-radius: 12px;
    overflow: hidden;
    margin-top: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.dm-link-preview:hover {
    background: #222223;
}

.dm-link-preview-image {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    background: #2a2a2c;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dm-link-preview-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dm-link-preview-image svg {
    width: 24px;
    height: 24px;
    color: #71757a;
}

.dm-link-preview-info {
    flex: 1;
    padding: 8px 12px 8px 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.dm-link-preview-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.dm-link-preview-domain {
    font-size: 12px;
    color: #71757a;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dm-link-preview-domain img {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

/* ===== Дата-разделитель ===== */
.dm-date-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 0;
}

.dm-date-separator span {
    background: #2a2a2c;
    color: #8a8a8e;
    font-size: 13px;
    padding: 6px 16px;
    border-radius: 16px;
}

/* ===== Image modal (lightbox) ===== */
.dm-image-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.dm-image-modal.show {
    display: flex;
}

.dm-image-modal img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    cursor: default;
}

.dm-image-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    font-size: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.dm-image-modal-close:hover {
    background: rgba(255,255,255,0.2);
}

/* ===== Пустой чат ===== */
.dm-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-align: center;
    padding: 40px;
}

.dm-empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.dm-empty-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.dm-empty-text {
    font-size: 14px;
    max-width: 300px;
}

/* ===== Tabs внизу сайдбара ===== */
.dm-sidebar-tabs {
    display: flex;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
    padding: 8px;
}

.dm-tab {
    flex: 1;
    padding: 12px 10px;
    background: none;
    border: none;
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.dm-tab:hover {
    background: var(--bg-secondary);
    border-radius: 10px;
}

.dm-tab.active {
    color: var(--accent);
    background: rgba(99, 102, 241, 0.15);
    border-radius: 10px;
}

.dm-tab svg {
    width: 20px;
    height: 20px;
}

/* ===== Модальные окна ===== */
.dm-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.dm-modal-overlay.show {
    display: flex;
}

.dm-modal {
    background: var(--bg-card);
    border-radius: 16px;
    max-width: 480px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.dm-modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dm-modal-title {
    font-size: 18px;
    font-weight: 600;
}

.dm-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
}

.dm-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.dm-user-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dm-user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 12px;
}

.dm-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.dm-user-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.dm-user-info {
    flex: 1;
}

.dm-user-name {
    font-weight: 500;
    color: var(--text-primary);
}

.dm-user-actions {
    display: flex;
    gap: 8px;
}

.dm-user-actions .btn {
    padding: 6px 12px;
    font-size: 12px;
}

/* ===== Настройки приватности ===== */
.dm-privacy-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dm-privacy-option {
    display: flex;
    align-items: center;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.dm-privacy-option:hover {
    background: var(--bg-hover);
}

.dm-privacy-option.selected {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.1);
}

.dm-privacy-radio {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 50%;
    margin-right: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dm-privacy-option.selected .dm-privacy-radio {
    border-color: var(--accent);
}

.dm-privacy-option.selected .dm-privacy-radio::after {
    content: '';
    width: 10px;
    height: 10px;
    background: var(--accent);
    border-radius: 50%;
}

.dm-privacy-text {
    flex: 1;
}

.dm-privacy-label {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.dm-privacy-desc {
    font-size: 13px;
    color: var(--text-muted);
}

/* ===== Sidebar Panels ===== */
.dm-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.dm-panel .dm-search {
    flex-shrink: 0;
}

.dm-panel .dm-conversations,
.dm-panel .dm-user-list {
    flex: 1;
    overflow-y: auto;
}

/* ===== Friends Tabs ===== */
/* ===== Friends Tabs ===== */
.dm-friends-tabs {
    display: flex;
    gap: 4px;
    padding: 12px 12px 12px;
    margin-top: 4px;
    flex-shrink: 0;
}

.dm-friends-tab {
    flex: 1;
    padding: 8px 6px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    position: relative;
}

.dm-friends-tab svg {
    flex-shrink: 0;
}

.dm-friends-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.dm-friends-tab.active {
    background: var(--accent);
    color: white;
}

.dm-friends-badge {
    font-size: 10px;
    font-weight: 700;
    background: var(--danger);
    color: white;
    padding: 1px 5px;
    border-radius: 8px;
    min-width: 16px;
    text-align: center;
    line-height: 14px;
}

.dm-friends-tab.active .dm-friends-badge {
    background: rgba(255, 255, 255, 0.3);
}

/* ===== Friend Cards ===== */
.dm-friend-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    transition: background 0.15s;
}

.dm-friend-card:hover {
    background: var(--bg-secondary);
}

.dm-friend-info {
    flex: 1;
    min-width: 0;
}

.dm-friend-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dm-friend-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.dm-friend-action {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.dm-friend-action:hover {
    transform: scale(1.1);
}

.dm-friend-action-msg {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent);
}

.dm-friend-action-msg:hover {
    background: var(--accent);
    color: white;
}

.dm-friend-action-accept {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.dm-friend-action-accept:hover {
    background: var(--success);
    color: white;
}

.dm-friend-action-del,
.dm-friend-action-cancel {
    background: rgba(239, 68, 68, 0.1);
    color: var(--text-muted);
}

.dm-friend-action-del:hover {
    background: var(--danger);
    color: white;
}

.dm-friend-action-cancel:hover {
    background: var(--danger);
    color: white;
}

/* ===== Friends Empty State ===== */
.dm-friends-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

/* ===== Settings Panel ===== */
.dm-settings-content {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

.dm-settings-title {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.dm-settings-content .dm-privacy-options {
    margin-bottom: 0;
}

.dm-settings-content .dm-user-list {
    max-height: none;
    overflow: visible;
}

/* ===== Search results ===== */
.dm-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-top: 4px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.dm-search-results.show {
    display: block;
}

.dm-search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s;
}

.dm-search-result-item:hover {
    background: var(--bg-secondary);
}

/* ===== Голосовые звонки ===== */
.dm-call-btn {
    color: var(--success) !important;
}

.dm-call-btn:hover {
    background: rgba(34, 197, 94, 0.15) !important;
}

.call-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 100002;
    display: none;
    align-items: center;
    justify-content: center;
}

.call-modal-overlay.show {
    display: flex;
}

.call-modal {
    text-align: center;
    color: white;
    padding: 40px;
}

.call-modal-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: 600;
    margin: 0 auto 24px;
    overflow: hidden;
}

.call-modal-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.call-modal-name {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
}

.call-modal-status {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 40px;
}

.call-modal-actions {
    display: flex;
    justify-content: center;
    gap: 40px;
}

.call-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.call-btn:hover {
    transform: scale(1.1);
}

.call-btn-accept {
    background: #22c55e;
    color: white;
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.4);
}

.call-btn-reject {
    background: #ef4444;
    color: white;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
}

/* Активный звонок */
.call-active-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #1e1b4b 100%);
    z-index: 100002;
    display: none;
    align-items: center;
    justify-content: center;
}

.call-active-overlay.show {
    display: flex;
}

.call-active {
    text-align: center;
    color: white;
    position: relative;
    padding: 60px 80px;
}

.call-active-avatar {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 56px;
    font-weight: 600;
    margin: 0 auto 24px;
    overflow: hidden;
    box-shadow: 0 0 60px rgba(99, 102, 241, 0.4);
    animation: callGlow 2s ease-in-out infinite;
}

@keyframes callGlow {
    0%, 100% { box-shadow: 0 0 40px rgba(99, 102, 241, 0.3); }
    50% { box-shadow: 0 0 80px rgba(99, 102, 241, 0.6); }
}

.call-active-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.call-active-name {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 8px;
}

.call-active-timer {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.8);
    font-family: monospace;
    margin-bottom: 60px;
}

.call-active-actions {
    display: flex;
    justify-content: center;
    gap: 24px;
}

.call-action-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.call-action-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.call-action-btn.muted {
    background: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.call-end-btn {
    background: #ef4444 !important;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
}

.call-end-btn:hover {
    background: #dc2626 !important;
}

/* Кнопка сворачивания */
.call-minimize-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.call-minimize-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ===== Свёрнутый звонок ===== */
.call-minimized {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 16px;
    padding: 12px 16px;
    display: none;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10001;
    min-width: 280px;
    animation: callSlideUp 0.3s ease;
}

@keyframes callSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.call-minimized.show {
    display: flex;
}

.call-minimized-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
    overflow: hidden;
}

.call-minimized-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.call-minimized-info {
    flex: 1;
    min-width: 0;
}

.call-minimized-name {
    color: white;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.call-minimized-timer {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    font-family: monospace;
}

.call-minimized-actions {
    display: flex;
    gap: 8px;
}

.call-mini-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.call-mini-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.call-mini-btn.muted {
    background: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.call-mini-end {
    background: #ef4444 !important;
}

.call-mini-end:hover {
    background: #dc2626 !important;
}

/* ===== Mobile ===== */
.dm-back-btn {
    display: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

/* ============================================================================
   SPA Router - Загрузка и переходы
   ============================================================================ */

/* Индикатор загрузки сверху страницы */
.spa-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 99999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.spa-loader.active {
    opacity: 1;
}

.spa-loader-bar {
    height: 100%;
    width: 30%;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover), var(--accent));
    border-radius: 0 2px 2px 0;
    animation: spaLoaderAnim 1s ease-in-out infinite;
}

@keyframes spaLoaderAnim {
    0% {
        width: 0%;
        margin-left: 0%;
    }
    50% {
        width: 50%;
        margin-left: 25%;
    }
    100% {
        width: 0%;
        margin-left: 100%;
    }
}

/* Плавное появление контента */
#spa-content {
    animation: spaFadeIn 0.2s ease;
}

@keyframes spaFadeIn {
    from {
        opacity: 0.7;
    }
    to {
        opacity: 1;
    }
}

/* ============================================================================
   Глобальный виджет звонка (PIP - Picture in Picture)
   ============================================================================ */

.call-widget {
    position: fixed;
    z-index: 10000;
    transition: all 0.3s ease;
}

/* Развёрнутый режим - на весь экран */
.call-widget.fullscreen {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, #0a0a1a 0%, #1a1a2e 50%, #0a0a1a 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 40px 20px;
}

.call-widget.fullscreen .call-widget-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 0;
    background: none;
}

.call-widget.fullscreen .call-widget-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: 600;
    color: white;
    box-shadow: 0 0 40px rgba(99, 102, 241, 0.3);
    animation: callPulse 2s ease-in-out infinite;
}

.call-widget.fullscreen .call-widget-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.call-widget.fullscreen .call-widget-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.call-widget.fullscreen .call-widget-name {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

.call-widget.fullscreen .call-widget-status {
    font-size: 16px;
    color: var(--success);
}

.call-widget.fullscreen .call-widget-timer {
    font-size: 40px;
    font-weight: 300;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: 2px;
    margin-top: 16px;
}

.call-widget.fullscreen .call-widget-actions {
    display: flex;
    gap: 24px;
    padding: 0;
    margin-top: 40px;
    justify-content: center;
    background: none;
}

.call-widget.fullscreen .call-widget-btn {
    width: 64px;
    height: 64px;
}

.call-widget.fullscreen .call-widget-btn svg {
    width: 28px;
    height: 28px;
}

/* Свёрнутый режим - маленькое окно */
.call-widget.minimized {
    bottom: 20px;
    right: 20px;
    width: 320px;
    background: #1a1a24;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    border: 1px solid var(--border);
}

.call-widget.minimized .call-widget-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #232324;
    cursor: move;
}

.call-widget.minimized .call-widget-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    color: white;
}

.call-widget.minimized .call-widget-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.call-widget.minimized .call-widget-info {
    flex: 1;
    min-width: 0;
}

.call-widget.minimized .call-widget-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.call-widget.minimized .call-widget-status {
    font-size: 12px;
    color: var(--success);
}

.call-widget.minimized .call-widget-timer {
    font-size: 12px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.call-widget.minimized .call-widget-actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    justify-content: center;
    background: #1a1a24;
}

.call-widget-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.call-widget-btn svg {
    width: 20px;
    height: 20px;
}

.call-widget-btn.mute {
    background: #3a3a3c;
    color: white;
}

.call-widget-btn.mute.active {
    background: var(--danger);
}

.call-widget-btn.end {
    background: var(--danger);
    color: white;
}

.call-widget-btn.end:hover {
    background: #dc2626;
}

.call-widget-btn.expand {
    background: #3a3a3c;
    color: white;
}

.call-widget-btn:hover {
    transform: scale(1.05);
}

/* Входящий звонок - модальное окно */
.call-incoming-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10001;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
}

.call-incoming-modal.show {
    display: flex;
}

.call-incoming-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: 600;
    color: white;
    animation: callPulse 2s ease-in-out infinite;
}

.call-incoming-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

@keyframes callPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.5);
    }
    50% {
        box-shadow: 0 0 0 20px rgba(99, 102, 241, 0);
    }
}

.call-incoming-name {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

.call-incoming-status {
    font-size: 16px;
    color: var(--text-muted);
}

.call-incoming-actions {
    display: flex;
    gap: 32px;
    margin-top: 24px;
}

.call-incoming-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.call-incoming-btn svg {
    width: 28px;
    height: 28px;
}

.call-incoming-btn.reject {
    background: var(--danger);
    color: white;
}

.call-incoming-btn.accept {
    background: var(--success);
    color: white;
}

.call-incoming-btn:hover {
    transform: scale(1.1);
}


/* ============================================================================
   PAGE: Garage - Страница гаража (транспорт)
   ============================================================================ */

.property-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 20px;
}
.property-card {
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
}
.property-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.property-img {
    width: 100%;
    height: 160px;
    object-fit: cover;
}
.property-img-placeholder {
    width: 100%;
    height: 160px;
    background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-card) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: var(--text-muted);
}
.property-info {
    padding: 16px;
}
.property-name {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}
.property-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.property-price {
    font-weight: 600;
    color: var(--accent);
}
.btn-sell,
.btn-sell-property {
    width: 100%;
    padding: 12px 16px;
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.2s;
    font-family: inherit;
}
.btn-sell { margin-top: 12px; }
.btn-sell:hover,
.btn-sell-property:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-2px);
}


/* ============================================================================
   SHARED: Modal Overlay - Модальные окна продажи
   ============================================================================ */

.sell-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}
.sell-modal-overlay.active {
    display: flex;
}
.sell-modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 32px;
    max-width: 420px;
    width: 90%;
    text-align: center;
    animation: modalAppear 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
@keyframes modalAppear {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}
.sell-modal-icon {
    font-size: 48px;
    margin-bottom: 16px;
}
.sell-modal h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}
.sell-modal p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.6;
}
.sell-modal-price {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 24px;
}
.sell-modal-buttons {
    display: flex;
    gap: 12px;
}
.sell-modal-buttons button {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
}
.btn-modal-cancel {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border) !important;
}
.btn-modal-cancel:hover {
    background: var(--bg-darker);
    color: var(--text-primary);
}
.btn-modal-confirm {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}
.btn-modal-confirm:hover {
    background: linear-gradient(135deg, #059669, #047857);
}


/* ============================================================================
   PAGE: Marketplace - Торговая площадка (список)
   ============================================================================ */

.marketplace-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}
.categories {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 12px;
}
.category-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}
.category-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}
.category-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}
.category-btn .count {
    background: rgba(255,255,255,0.2);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
}
.category-btn.active .count {
    background: rgba(255,255,255,0.3);
}
.listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}
.listing-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s;
}
.listing-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 10px 30px var(--accent-glow);
}
.listing-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}
.listing-img-placeholder {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-card) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: var(--text-muted);
}
.listing-content {
    padding: 20px;
}
.listing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.listing-type {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.listing-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}
.listing-desc {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 12px;
    line-height: 1.5;
}
.listing-price {
    font-size: 24px;
    font-weight: 700;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
}
.listing-seller, .listing-date {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 4px;
}
.listing-actions {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.info-box {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    border: 1px solid var(--accent);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}
.info-box h4 {
    color: var(--accent);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.info-box ul {
    list-style: none;
    color: var(--text-secondary);
}
.info-box li {
    padding: 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}


/* ============================================================================
   PAGE: Marketplace Create - Создание объявления
   ============================================================================ */

.create-form {
    max-width: 600px;
    margin: 0 auto;
}
.form-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
}
.form-section h3 {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.days-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
.day-option input {
    display: none;
}
.day-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 16px;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}
.day-option input:checked + .day-card {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.1);
}
.day-card:hover {
    border-color: var(--accent);
}
.day-num {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
}
.day-label {
    color: var(--text-muted);
    font-size: 14px;
}
.day-price {
    margin-top: 8px;
    font-weight: 600;
    color: var(--accent);
}
.popular-badge {
    position: absolute;
    top: -10px;
    background: var(--gradient-1);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.summary-section {
    background: var(--bg-secondary);
}
.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
}
.summary-row:not(:last-child) {
    border-bottom: 1px solid var(--border);
}
textarea.form-input {
    resize: vertical;
    min-height: 80px;
}


/* ============================================================================
   PAGE: Marketplace View - Просмотр объявления
   ============================================================================ */

.view-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
    max-width: 700px;
    margin: 0 auto;
}
.view-image {
    width: 100%;
    height: 280px;
    object-fit: cover;
}
.view-image-placeholder {
    width: 100%;
    height: 280px;
    background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 72px;
    color: var(--text-muted);
}
.view-card-content {
    padding: 32px;
}
.view-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}
.view-type {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.view-title {
    font-size: 28px;
    font-weight: 700;
    margin: 12px 0;
}
.view-price {
    font-size: 36px;
    font-weight: 700;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.view-section {
    margin-bottom: 24px;
}
.view-section h3 {
    color: var(--text-muted);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}
.view-info {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
.view-info-item {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: 10px;
}
.view-info-label {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 4px;
}
.view-info-value {
    font-weight: 600;
    font-size: 16px;
}
.view-actions {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}
.buy-section {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(139, 92, 246, 0.05));
    border-radius: 16px;
    padding: 24px;
}
.balance-info {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
}
.balance-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
}
.btn-lg {
    padding: 16px 32px;
    font-size: 16px;
}


/* ============================================================================
   PAGE: Marketplace Success - Успешная покупка
   ============================================================================ */

.success-container {
    max-width: 500px;
    margin: 0 auto;
    text-align: center;
    padding: 60px 20px;
}
.success-icon {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, var(--success), #059669);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 32px;
    font-size: 48px;
    color: white;
    animation: scaleIn 0.5s ease;
}
@keyframes scaleIn {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}
.success-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--success);
}
.success-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    margin: 32px 0;
}
.success-item-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
}
.success-item-placeholder {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: var(--text-muted);
}
.success-item-content {
    padding: 24px;
}
.success-item-name {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}
.success-item-price {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
}
.success-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 32px;
}


/* ============================================================================
   PAGE: Support - Техподдержка (список тикетов)
   ============================================================================ */

.tickets-header, .complaints-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}
.tickets-list, .complaints-list {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.ticket-item-link, .complaint-item-link {
    text-decoration: none;
    color: inherit;
}
.ticket-item, .complaint-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 20px;
    transition: all 0.2s;
    cursor: pointer;
}
.ticket-item:hover, .complaint-item:hover {
    border-color: var(--accent);
    transform: translateX(4px);
}
.ticket-header, .complaint-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}
.ticket-number, .complaint-number {
    font-weight: 700;
    color: var(--accent);
    font-size: 15px;
}
.ticket-date, .complaint-date {
    color: var(--text-muted);
    font-size: 13px;
    margin-left: auto;
}
.ticket-subject, .complaint-type {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.ticket-desc, .complaint-desc {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
}

@media (max-width: 768px) {
    .tickets-header, .complaints-header {
        flex-direction: column;
        gap: 12px;
        padding: 16px;
        align-items: stretch;
    }
    .tickets-header .btn, .complaints-header .btn {
        width: 100%;
        justify-content: center;
    }
    .tickets-list, .complaints-list { padding: 12px; gap: 10px; }
    .ticket-item, .complaint-item { padding: 14px; }
    .ticket-header, .complaint-header { flex-wrap: wrap; gap: 8px; }
    .ticket-number, .complaint-number { font-size: 14px; }
    .ticket-date, .complaint-date { font-size: 11px; width: 100%; margin-left: 0; margin-top: 4px; }
    .ticket-subject, .complaint-type { font-size: 13px; }
    .ticket-desc, .complaint-desc { font-size: 12px; }
}
@media (max-width: 480px) {
    .tickets-header, .complaints-header { padding: 12px; }
    .tickets-list, .complaints-list { padding: 8px; }
    .ticket-item, .complaint-item { padding: 12px; border-radius: 10px; }
    .ticket-item:hover, .complaint-item:hover { transform: none; }
}


/* ============================================================================
   PAGE: Support New - Создание тикета
   ============================================================================ */

.form-container { padding: 24px; }
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 14px;
}
.form-group label .required { color: var(--danger); }
.form-textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.2s;
    resize: vertical;
    min-height: 150px;
}
.form-textarea:focus {
    outline: none;
    border-color: var(--accent);
}
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.btn-row { display: flex; gap: 12px; margin-top: 24px; }
.btn-row .btn { flex: 1; }

@media (max-width: 768px) {
    .form-container { padding: 16px; }
    .form-textarea { padding: 12px 14px; font-size: 16px; }
    .btn-row { flex-direction: column; gap: 10px; }
}


/* ============================================================================
   PAGE: Support View - Просмотр тикета
   ============================================================================ */

.ticket-container, .complaint-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
@media (max-width: 900px) {
    .ticket-container, .complaint-container { grid-template-columns: 1fr; }
}
.ticket-details, .complaint-details { padding: 20px; }
.ticket-info, .complaint-info {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}
.info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--text-muted); }
.ticket-description, .complaint-description {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 16px;
    white-space: pre-wrap;
    line-height: 1.6;
}

.chat-section {
    display: flex;
    flex-direction: column;
    height: 600px;
    border-left: 1px solid var(--border);
}
.chat-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}
.page-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--bg-darker);
    border-radius: 8px;
    margin: 12px;
}
.chat-msg {
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: 10px;
}
.chat-msg.admin {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.08));
}
.chat-msg-row { display: flex; align-items: flex-start; gap: 10px; }
.chat-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px; color: white;
    background: #4b5563; flex-shrink: 0; text-transform: uppercase;
}
.chat-avatar-img {
    width: 36px; height: 36px; border-radius: 50%;
    object-fit: cover; flex-shrink: 0;
}
.chat-msg.admin .chat-avatar { background: #ef4444; }
.chat-msg-body { flex: 1; min-width: 0; }
.chat-msg-header { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.chat-nick { font-weight: 600; font-size: 13px; color: #9ca3af; }
.chat-msg.admin .chat-nick { color: #ef4444; }
.chat-time { color: var(--text-muted); font-size: 11px; }
.chat-msg-text { color: var(--text-primary); word-break: break-word; line-height: 1.4; font-size: 14px; }
.chat-msg-image {
    max-width: 300px; max-height: 200px; border-radius: 8px;
    margin-top: 8px; cursor: pointer; transition: opacity 0.2s;
}
.chat-msg-image:hover { opacity: 0.9; }
.chat-empty { text-align: center; padding: 40px; color: var(--text-muted); }
/* Page chat input - unified style like DM */
.chat-input-form { padding: 12px 16px; border-top: 1px solid var(--border); }
.page-chat-input {
    flex: 1;
    padding: 8px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    min-width: 0;
}
.page-chat-input:focus { outline: none; border-color: transparent; box-shadow: none; }
.image-toggle-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    flex-shrink: 0;
}
.image-toggle-btn:hover { color: var(--text-primary); background: var(--bg-darker); }
.page-chat-send-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    flex-shrink: 0;
}
.page-chat-send-btn:hover { color: var(--text-primary); background: var(--bg-darker); }
.page-chat-send-btn svg, .image-toggle-btn svg { width: 20px; height: 20px; }
.image-preview-bar {
    display: flex; align-items: center; gap: 8px; padding: 8px 12px;
    background: rgba(99, 102, 241, 0.1); border-radius: 8px; margin-top: 8px;
}
.image-remove-btn {
    background: rgba(239, 68, 68, 0.2); border: none; color: #ef4444;
    width: 24px; height: 24px; border-radius: 50%; cursor: pointer;
    font-size: 16px; display: flex; align-items: center; justify-content: center;
}
.image-remove-btn:hover { background: rgba(239, 68, 68, 0.3); }
.chat-closed {
    padding: 16px 20px; border-top: 1px solid var(--border);
    text-align: center; color: var(--text-muted);
}
.lightbox {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.9); z-index: 1000;
    align-items: center; justify-content: center;
}
.lightbox.active { display: flex; }
.lightbox img { max-width: 90%; max-height: 90%; border-radius: 8px; }
.lightbox-close { position: absolute; top: max(20px, env(safe-area-inset-top, 20px)); right: max(20px, env(safe-area-inset-right, 20px)); color: white; font-size: 32px; cursor: pointer; min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; }

@media (max-width: 768px) {
    .ticket-container, .complaint-container { grid-template-columns: 1fr; }
    .ticket-details, .complaint-details { padding: 16px; }
    .ticket-info, .complaint-info { padding: 12px; }
    .info-row { flex-direction: column; gap: 4px; padding: 10px 0; }
    .ticket-description, .complaint-description { padding: 12px; font-size: 14px; }
    .chat-section { height: auto; min-height: 350px; border-left: none; border-top: 1px solid var(--border); }
    .chat-header { padding: 12px 16px; }
    .page-chat-messages { margin: 8px; padding: 12px; min-height: 200px; max-height: 300px; }
    .chat-msg { padding: 8px 10px; }
    .chat-avatar, .chat-avatar-img { width: 32px; height: 32px; font-size: 12px; }
    .chat-nick { font-size: 12px; }
    .chat-msg-text { font-size: 13px; }
    .chat-msg-image { max-width: 200px; max-height: 150px; }
    .chat-input-form { padding: 10px 12px; }
    .page-chat-input { font-size: 16px; padding: 8px; }
}
@media (max-width: 480px) {
    .ticket-details, .complaint-details { padding: 12px; }
    .page-chat-messages { margin: 4px; padding: 8px; }
    .chat-avatar, .chat-avatar-img { width: 28px; height: 28px; font-size: 11px; }
    .image-toggle-btn { display: none; }
}


/* ============================================================================
   PAGE: News List - Лента новостей
   ============================================================================ */

.news-feed {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px 0;
}
.news-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: row;
}
.news-card:hover {
    border-color: var(--accent);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.12);
}
.news-card-image {
    width: 280px;
    min-height: 200px;
    background-size: cover;
    background-position: center;
    background-color: var(--bg-secondary);
    flex-shrink: 0;
}
.news-card-content {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
    user-select: none;
    min-width: 0;
}
.news-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.pinned-badge {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 600;
}
.news-date {
    color: var(--text-muted);
    font-size: 13px;
}
.news-card-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 12px 0;
    color: var(--text-primary);
    line-height: 1.3;
}
.news-card-desc {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.news-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.news-views {
    color: var(--text-muted);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.news-read-more {
    color: var(--accent);
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

@media (max-width: 768px) {
    .news-card {
        flex-direction: column;
    }
    .news-card-image {
        width: 100%;
        min-height: 180px;
        height: 180px;
    }
    .news-card-content {
        padding: 16px;
    }
    .news-card-title {
        font-size: 18px;
    }
    .news-card-desc {
        -webkit-line-clamp: 2;
    }
}


/* ============================================================================
   PAGE: News Detail - Просмотр новости
   ============================================================================ */

.news-article {
    max-width: 800px;
    margin: 0 auto;
}
.news-hero-image {
    height: 300px;
    background-size: cover;
    background-position: center;
    border-radius: 16px;
    margin-bottom: 24px;
}
.news-header {
    margin-bottom: 24px;
}
.news-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}
.news-title {
    font-size: 32px;
    font-weight: 800;
    margin: 0 0 12px 0;
    line-height: 1.2;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.news-short-desc {
    font-size: 18px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.news-content {
    color: var(--text-primary);
    line-height: 1.8;
    font-size: 16px;
}
.news-content h1, .news-content h2, .news-content h3 {
    margin-top: 32px;
    margin-bottom: 16px;
    color: var(--text-primary);
}
.news-content p {
    margin-bottom: 16px;
}
.news-content ul, .news-content ol {
    margin-bottom: 16px;
    padding-left: 24px;
}
.news-content li {
    margin-bottom: 8px;
}
.news-content blockquote {
    border-left: 4px solid var(--accent);
    padding-left: 16px;
    margin: 24px 0;
    color: var(--text-secondary);
    font-style: italic;
}
.news-content img {
    max-width: 100%;
    border-radius: 12px;
    margin: 16px 0;
}
.news-content code {
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}
.news-content pre {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
}
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    text-decoration: none;
    margin-bottom: 20px;
    font-size: 14px;
    transition: color 0.2s;
}
.back-link:hover {
    color: var(--accent);
}

@media (max-width: 768px) {
    .news-hero-image {
        height: 200px;
        border-radius: 12px;
    }
    .news-title {
        font-size: 24px;
    }
    .news-short-desc {
        font-size: 16px;
    }
    .news-content {
        font-size: 15px;
    }
}


/* ============================================================================
   PAGE: Rules List - Список правил
   ============================================================================ */

.rules-section {
    margin-bottom: 16px;
}
.rules-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    margin-bottom: 8px;
}
.rules-section-title {
    font-weight: 600;
    font-size: 16px;
    color: var(--text-primary);
    flex: 1;
}
.rules-count {
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
}
.rule-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 8px;
    text-decoration: none;
    transition: all 0.2s;
}
.rule-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
}
.rule-item-content {
    flex: 1;
    min-width: 0;
}
.rule-item-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}
.rule-item-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.rule-item-date {
    font-size: 12px;
    color: var(--text-muted);
}
.rule-item-arrow {
    color: var(--accent);
    opacity: 0;
    transition: opacity 0.2s;
}
.rule-item:hover .rule-item-arrow {
    opacity: 1;
}

@media (max-width: 768px) {
    .rule-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .rule-item-meta {
        width: 100%;
        justify-content: space-between;
    }
}


/* ============================================================================
   PAGE: Rule Detail - Просмотр правила
   ============================================================================ */

.rule-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.rule-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
}
.rule-category-badge {
    background: var(--accent);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.rule-body {
    line-height: 1.8;
    color: var(--text-primary);
}
.rule-body h1, .rule-body h2, .rule-body h3, .rule-body h4 {
    margin: 24px 0 12px 0;
    line-height: 1.4;
}
.rule-body h1 {
    font-size: 1.5rem;
    color: #ef4444;
    letter-spacing: 0.04em;
    border-bottom: 2px solid #ef4444;
    padding-bottom: 8px;
}
.rule-body h2 {
    font-size: 1.25rem;
    color: #f87171;
}
.rule-body h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
}
.rule-body h4 {
    font-size: 1rem;
    color: var(--text-secondary);
}
.rule-body p {
    margin: 0 0 16px 0;
}
.rule-body ul, .rule-body ol {
    margin: 0 0 16px 0;
    padding-left: 24px;
}
.rule-body li {
    margin-bottom: 8px;
}
.rule-body blockquote {
    margin: 16px 0;
    padding: 12px 20px;
    border-left: 4px solid var(--accent);
    background: var(--bg-secondary);
    border-radius: 0 8px 8px 0;
    color: var(--text-secondary);
}
.rule-body blockquote p {
    margin: 0;
}
.rule-body pre {
    margin: 16px 0;
    padding: 16px;
    background: #0d1117;
    border-radius: 8px;
    overflow-x: auto;
}
.rule-body code {
    background: rgba(255,255,255,0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    font-size: 0.9em;
}
.rule-body pre code {
    background: none;
    padding: 0;
}
.rule-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
}
.rule-body th, .rule-body td {
    border: 1px solid var(--border);
    padding: 10px 14px;
    text-align: left;
}
.rule-body th {
    background: var(--bg-secondary);
    font-weight: 600;
}
.rule-body a {
    color: var(--accent);
    text-decoration: none;
}
.rule-body a:hover {
    text-decoration: underline;
}
.rule-body strong {
    color: var(--text-primary);
    font-weight: 600;
}
.rule-body hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 24px 0;
}
.rule-body del {
    color: var(--text-muted);
    text-decoration: line-through;
}
.rule-body img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    margin: 12px 0;
}


/* Complaints list styles merged with tickets-list in PAGE: Support section above */


/* ============================================================================
   PAGE: Complaint New - Создание жалобы
   ============================================================================ */

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}
.photo-upload {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
}
.photo-upload:hover {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.05);
}
.photo-upload.dragover {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.1);
}
.photo-preview {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
}
.photo-preview-item {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
}
.photo-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.photo-preview-item .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: rgba(239, 68, 68, 0.9);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 768px) {
    .form-select {
        padding: 12px 14px;
        font-size: 16px;
    }
    .photo-upload {
        padding: 20px 16px;
    }
    .photo-preview-item {
        width: 80px;
        height: 80px;
    }
}


/* Complaint View - shared styles merged with Support View above.
   Only complaint-specific photo styles below. */

.complaint-photos {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.complaint-photo {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}
.complaint-photo:hover {
    transform: scale(1.05);
}

@media (max-width: 768px) {
    .complaint-photos { gap: 8px; }
    .complaint-photo { width: 80px; height: 80px; }
}
@media (max-width: 480px) {
    .complaint-photo { width: 70px; height: 70px; }
}


/* ============================================================================
   PAGE: Fines - Штрафы
   ============================================================================ */

.fines-table-wrap, .mvd-table-wrap { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.fines-table, .mvd-table { width: 100%; border-collapse: collapse; }
.fines-table th, .mvd-table th { padding: 12px 16px; text-align: left; font-size: 12px; text-transform: uppercase; color: var(--text-muted); border-bottom: 1px solid var(--border); background: var(--bg-secondary); font-weight: 600; letter-spacing: 0.5px; }
.fines-table td, .mvd-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 14px; }
.fines-table tr:last-child td, .mvd-table tr:last-child td { border-bottom: none; }
.fines-table tr:hover td, .mvd-table tr:hover td { background: var(--bg-card-hover); }
.btn-pay-fine { padding: 6px 16px; border-radius: 8px; font-weight: 600; font-size: 13px; cursor: pointer; border: none; background: var(--accent); color: white; transition: all 0.2s; }
.btn-pay-fine:hover { background: var(--accent-hover); }
.btn-pay-fine:disabled { opacity: 0.5; cursor: not-allowed; }


/* ============================================================================
   PAGE: Main - Главная страница ЛК
   ============================================================================ */

.badge-license {
    display: inline-block;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: white;
    font-size: 11px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 6px;
    margin: 2px 4px 2px 0;
}
.licenses-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.no-licenses {
    color: var(--text-muted);
    font-size: 13px;
}

/* News Widget */
.news-widget-card {
    overflow: hidden;
}
.news-widget-card .card-header {
    border-bottom: none;
    padding-bottom: 12px;
    margin-bottom: 0;
}
.news-w-all-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: opacity 0.2s;
}
.news-w-all-link:hover { opacity: 0.8; }
.news-widget-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.news-w-featured {
    display: block;
    text-decoration: none;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-secondary);
    transition: all 0.2s;
}
.news-w-featured:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.news-w-featured-img {
    height: 160px;
    background-size: cover;
    background-position: center;
    position: relative;
}
.news-w-pinned {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--accent);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}
.news-w-featured-content .news-w-pinned {
    position: static;
    margin-bottom: 8px;
}
.news-w-featured-content {
    padding: 14px;
}
.news-w-featured-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 6px 0;
    line-height: 1.3;
}
.news-w-featured-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 8px 0;
    line-height: 1.4;
}
.news-w-date {
    font-size: 12px;
    color: var(--text-muted);
}
.news-w-item {
    display: flex;
    gap: 12px;
    text-decoration: none;
    padding: 10px;
    margin: 0 -10px;
    border-radius: 10px;
    transition: background 0.2s;
}
.news-w-item:hover {
    background: var(--bg-secondary);
}
.news-w-item-img {
    width: 70px;
    height: 50px;
    border-radius: 8px;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}
.news-w-item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.news-w-item-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0 0 4px 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.news-w-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-muted);
    gap: 12px;
}
.news-w-empty svg { opacity: 0.4; }

@media (max-width: 480px) {
    .news-w-featured-img { height: 120px; }
    .news-w-featured-content { padding: 12px; }
    .news-w-featured-title { font-size: 14px; }
    .news-w-item-img { width: 60px; height: 44px; }
}

/* Chat wrapper on main page */
.chat-wrapper {
    display: flex;
    height: 380px;
    gap: 0;
}
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.chat-users-sidebar {
    width: 180px;
    background: var(--bg-darker);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}
@media (max-width: 768px) {
    .chat-wrapper {
        flex-direction: column;
        height: auto;
        min-height: 400px;
    }
    .chat-main {
        min-height: 320px;
        order: 1;
    }
    .chat-users-sidebar {
        width: 100%;
        max-height: 120px;
        border-left: none;
        border-top: 1px solid var(--border);
        order: 2;
    }
}
@media (max-width: 480px) {
    .chat-wrapper {
        min-height: 320px;
    }
    .chat-users-sidebar {
        display: none;
    }
}

/* Chat users sidebar */
.users-header {
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.users-count {
    font-size: 11px;
    color: #22c55e;
    font-weight: 500;
}
.users-search {
    padding: 8px;
    border-bottom: 1px solid var(--border);
}
.users-search input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 12px;
}
.users-search input:focus {
    outline: none;
    border-color: var(--accent);
}
.users-search input::placeholder {
    color: var(--text-muted);
}
.users-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}
.users-list::-webkit-scrollbar { width: 4px; }
.users-list::-webkit-scrollbar-track { background: transparent; }
.users-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.users-loading { color: var(--text-muted); font-size: 12px; text-align: center; padding: 12px; }
.user-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 13px;
}
.user-item:hover { background: var(--bg-secondary); }
.user-item .user-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.user-item .user-status.online { background: #22c55e; box-shadow: 0 0 6px rgba(34, 197, 94, 0.5); }
.user-item .user-status.offline { background: #6b7280; }
.user-item .user-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-item .user-name.admin { color: #ef4444; font-weight: 600; }
.user-item .admin-badge {
    font-size: 9px;
    background: #ef4444;
    color: white;
    padding: 1px 4px;
    border-radius: 3px;
    flex-shrink: 0;
}
.users-section-label {
    font-size: 10px;
    color: var(--text-muted);
    padding: 8px 8px 4px;
    text-transform: uppercase;
    font-weight: 600;
}

/* Main page chat messages */
.main-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--bg-darker);
    border-radius: 8px;
    margin: 0 16px;
    scroll-behavior: smooth;
}
.main-chat-messages::-webkit-scrollbar { width: 6px; }
.main-chat-messages::-webkit-scrollbar-track { background: transparent; }
.main-chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.chat-msg.own {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(139, 92, 246, 0.08));
}
.chat-msg.highlight {
    animation: highlightPulse 1.5s ease;
}
.chat-mention {
    background: rgba(139, 92, 246, 0.2);
    color: var(--accent);
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}
.chat-mention:hover {
    background: rgba(139, 92, 246, 0.35);
}
.chat-msg.mentioned {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.12), rgba(139, 92, 246, 0.05));
    border-left: 3px solid var(--accent);
}

/* Mention dropdown */
.mention-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
    margin-bottom: 8px;
    display: none;
    z-index: 100;
}
.mention-dropdown.active {
    display: block;
}
.mention-dropdown::-webkit-scrollbar { width: 6px; }
.mention-dropdown::-webkit-scrollbar-track { background: transparent; }
.mention-dropdown::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.mention-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s;
}
.mention-item:hover, .mention-item.selected {
    background: var(--bg-tertiary);
}
.mention-item .mention-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
    color: white;
    background: #4b5563;
    flex-shrink: 0;
}
.mention-item .mention-info {
    flex: 1;
    min-width: 0;
}
.mention-item .mention-name {
    font-weight: 500;
    font-size: 14px;
    color: var(--text-primary);
}
.mention-item .mention-role {
    font-size: 11px;
    color: var(--text-muted);
}
.mention-item .mention-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.mention-item .mention-status.online {
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}
.mention-item .mention-status.offline {
    background: #6b7280;
}
.mention-header {
    padding: 8px 14px 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.mention-empty {
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* Chat action buttons */
.chat-msg-actions {
    display: flex;
    gap: 4px;
    margin-top: 4px;
    align-items: center;
}
.chat-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    padding: 2px 6px;
    border-radius: 6px;
    color: var(--text-muted);
    transition: all 0.15s;
    opacity: 0;
}
.chat-msg:hover .chat-action-btn { opacity: 1; }
.chat-action-btn:hover { background: var(--bg-darker); color: var(--text-primary); }
.chat-delete-btn:hover { color: #ef4444; }

/* Reply preview */
.chat-reply-preview {
    padding: 4px 10px;
    margin-bottom: 6px;
    border-left: 3px solid var(--accent);
    background: rgba(139, 92, 246, 0.08);
    border-radius: 0 6px 6px 0;
    font-size: 12px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: background 0.15s;
}
.chat-reply-preview:hover { background: rgba(139, 92, 246, 0.15); }
.reply-author { font-weight: 600; color: var(--accent); margin-right: 6px; }
.reply-text { opacity: 0.7; }
.chat-reply-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: rgba(139, 92, 246, 0.1);
    border-left: 3px solid var(--accent);
    margin: 0 16px;
    border-radius: 0 6px 6px 0;
    font-size: 13px;
    color: var(--text-secondary);
}
.reply-cancel-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 2px 6px;
    border-radius: 4px;
}
.reply-cancel-btn:hover { color: var(--text-primary); background: var(--bg-secondary); }

/* Typing indicator */
.chat-typing {
    padding: 0 16px;
    height: 24px;
    display: flex;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
}
.chat-typing:empty { display: none; }
.typing-dots {
    display: inline-flex;
    gap: 3px;
    margin-left: 4px;
}
.typing-dots span {
    width: 4px; height: 4px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

/* Chat input area - unified style like DM */
.main-chat-input-form {
    padding: 12px 16px;
}
.main-chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 4px 8px;
    transition: all 0.2s;
}
.main-chat-input-wrapper:focus-within {
    border-color: var(--border);
}
.main-chat-input {
    flex: 1;
    padding: 8px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    min-width: 0;
}
.main-chat-input:focus {
    outline: none;
    border-color: transparent;
    box-shadow: none;
}
.main-chat-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.main-chat-send-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    flex-shrink: 0;
}
.main-chat-send-btn:hover:not(:disabled) {
    color: var(--text-primary);
    background: var(--bg-darker);
}
.main-chat-send-btn svg {
    width: 20px;
    height: 20px;
}
.main-chat-send-btn:active:not(:disabled) { transform: scale(0.9); }
.main-chat-send-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* Emoji picker */
.emoji-picker-wrapper { position: relative; flex-shrink: 0; }
.emoji-toggle-btn {
    background: none; border: none;
    color: white; cursor: pointer;
    padding: 4px; border-radius: 8px;
    transition: opacity 0.15s;
    display: flex; align-items: center; justify-content: center;
    width: 34px; height: 34px;
    opacity: 0.7;
}
.emoji-toggle-btn:hover { opacity: 1; }
.emoji-picker {
    position: absolute; bottom: 50px; left: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    display: grid; grid-template-columns: repeat(6, 1fr);
    gap: 4px; z-index: 100;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.emoji-picker span {
    font-size: 20px; cursor: pointer;
    padding: 4px; border-radius: 6px;
    text-align: center;
    transition: background 0.1s;
}
.emoji-picker span:hover { background: var(--bg-darker); }

/* Player popup */
.player-popup {
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    min-width: 260px;
    z-index: 1000;
    box-shadow: 0 16px 48px rgba(0,0,0,0.5);
    text-align: center;
}
.player-popup .popup-close {
    position: absolute; top: 8px; right: 12px;
    cursor: pointer; font-size: 18px;
    color: var(--text-muted);
}
.player-popup .popup-close:hover { color: var(--text-primary); }
.popup-name { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.popup-cid { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
.popup-roles { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.popup-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 999;
}

/* Chat animations */
@keyframes messageIn {
    from { opacity: 0; transform: translateY(15px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}
@keyframes highlightPulse {
    0% { background: rgba(139, 92, 246, 0.3); }
    100% { background: var(--bg-secondary); }
}

@media (hover: none) and (pointer: coarse) {
    .chat-action-btn { opacity: 1; padding: 6px 10px; }
    .user-item { padding: 8px; }
    .emoji-picker span { padding: 6px; }
}


/* ============================================================================
   PAGE: Donate - Страница поддержки проекта
   ============================================================================ */

.donate-hero {
    text-align: center;
    padding: 60px 20px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    border-radius: 24px;
    margin-bottom: 32px;
}
.donate-hero h1 {
    font-size: 36px;
    margin-bottom: 16px;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.donate-hero p {
    color: var(--text-secondary);
    font-size: 18px;
    max-width: 600px;
    margin: 0 auto 32px;
    line-height: 1.7;
}
.donate-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 18px 40px;
    font-size: 18px;
    font-weight: 600;
    background: var(--gradient-1);
    color: white;
    border: none;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s;
    box-shadow: 0 8px 30px var(--accent-glow);
}
.donate-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 40px var(--accent-glow);
}
.donate-btn i {
    font-size: 24px;
}
.disclaimer {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    margin-top: 40px;
}
.disclaimer h3 {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.disclaimer h3 i {
    color: var(--accent);
}
.disclaimer ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.disclaimer li {
    padding: 10px 0;
    color: var(--text-secondary);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    line-height: 1.6;
}
.disclaimer li i {
    color: var(--success);
    margin-top: 4px;
    flex-shrink: 0;
}
.disclaimer-footer {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 14px;
    text-align: center;
}
.payment-methods {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-top: 32px;
}
.payment-methods-label {
    color: var(--text-muted);
    font-size: 14px;
}
.payment-icons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
}
.payment-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    gap: 8px;
}
.payment-icon i {
    font-size: 18px;
}
.payment-regions {
    display: flex;
    gap: 24px;
    margin-top: 8px;
}
.payment-region {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 13px;
}
.payment-region i {
    color: var(--success);
}
.payment-note {
    margin-top: 16px;
    padding: 12px 20px;
    background: rgba(var(--warning-rgb, 255, 193, 7), 0.1);
    border: 1px solid rgba(var(--warning-rgb, 255, 193, 7), 0.3);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.payment-note i {
    color: var(--warning, #ffc107);
    flex-shrink: 0;
}


/* ============================================================================
   PAGE: Login - Страница входа (капча)
   ============================================================================ */

.captcha-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 20px;
    text-align: center;
}
.captcha-question {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 12px;
    font-family: monospace;
}
.captcha-input {
    width: 120px;
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    margin: 0 auto;
    display: block;
}
.captcha-label {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 8px;
}


/* ============================================================================
   ADMIN: Rules - Управление правилами
   ============================================================================ */

.badge-cat {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    color: white;
}
.badge-cat.blue { background: var(--accent); }
.badge-cat.red { background: #ef4444; }
.badge-cat.orange { background: #f97316; }
.badge-cat.green { background: #22c55e; }

.actions-cell {
    display: flex;
    gap: 6px;
}
.action-btn {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.action-btn:hover { border-color: var(--accent); color: var(--accent); }
.action-btn.danger:hover { border-color: var(--danger); color: var(--danger); }
.action-btn.success:hover { border-color: #22c55e; color: #22c55e; }

/* Admin form styles */
.admin-form-container { max-width: 900px; margin: 0 auto; }
.form-row .form-group { flex: 1; }

.checkbox-group { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.checkbox-group input { width: 18px; height: 18px; }

.danger-zone {
    margin-top: 32px;
    padding: 20px;
    border: 1px solid var(--danger);
    border-radius: 12px;
    background: rgba(239, 68, 68, 0.05);
}
.danger-zone h4 { color: var(--danger); margin: 0 0 12px 0; }

/* Markdown editor toolbar */
.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    flex-wrap: wrap;
}
.toolbar-btn {
    background: none;
    border: 1px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
}
.toolbar-btn:hover {
    background: var(--bg-darker);
    color: var(--text-primary);
    border-color: var(--border);
}
.toolbar-btn:active {
    transform: scale(0.95);
}
.toolbar-sep {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 4px;
}
.editor-toolbar + .form-textarea {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

/* Preview panel */
.preview-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    max-height: 500px;
    overflow-y: auto;
    margin-top: 16px;
}
.preview-panel h1, .preview-panel h2, .preview-panel h3 {
    margin-top: 16px;
    margin-bottom: 8px;
}
.preview-panel h1 { font-size: 1.5rem; }
.preview-panel h2 { font-size: 1.25rem; }
.preview-panel h3 { font-size: 1.1rem; }
.preview-panel blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 16px;
    color: var(--text-muted);
    margin: 16px 0;
}
.preview-panel pre {
    background: #0d1117;
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
}
.preview-panel code {
    background: rgba(255,255,255,0.1);
    padding: 2px 6px;
    border-radius: 4px;
}
.preview-panel pre code { background: none; padding: 0; }
.preview-panel img { max-width: 100%; height: auto; border-radius: 8px; }
.preview-panel table { width: 100%; border-collapse: collapse; }
.preview-panel th, .preview-panel td { border: 1px solid var(--border); padding: 8px; }
.preview-panel th { background: var(--bg-secondary); font-weight: 600; }
.preview-panel del { color: var(--text-muted); text-decoration: line-through; }
.preview-panel a { color: var(--accent); text-decoration: none; }
.preview-panel a:hover { text-decoration: underline; }
.preview-panel hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.preview-panel ul, .preview-panel ol { padding-left: 24px; margin: 12px 0; }
.preview-panel li { margin-bottom: 6px; }

/* Image upload */
.image-upload-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.upload-status {
    font-size: 13px;
    color: var(--text-muted);
}
.upload-status.success { color: #22c55e; }
.upload-status.error { color: var(--danger); }
.content-img-uploading {
    color: var(--accent);
    font-size: 13px;
    margin-top: 6px;
}

@media (max-width: 768px) {
    .editor-toolbar { gap: 2px; padding: 6px 8px; }
    .toolbar-btn { padding: 5px 7px; font-size: 13px; }
    .toolbar-sep { margin: 0 2px; height: 16px; }
}


/* ============================================================================
   ADMIN: News - Управление новостями
   ============================================================================ */

.image-upload-area {
    border: 2px dashed var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    overflow: hidden;
}
.image-upload-area:hover, .image-upload-area.dragover {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.05);
}
.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-muted);
    gap: 12px;
}
.upload-placeholder svg { opacity: 0.5; }
.upload-placeholder span { font-size: 14px; }
.upload-hint { font-size: 12px !important; opacity: 0.7; }
.upload-preview {
    position: relative;
    width: 100%;
    max-height: 300px;
    overflow: hidden;
}
.upload-preview img {
    width: 100%;
    height: auto;
    max-height: 300px;
    object-fit: cover;
    display: block;
}
.remove-image-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.remove-image-btn:hover { background: var(--danger); }


/* ============================================================================
   ADMIN: Filter bars (Complaints, Support)
   ============================================================================ */

.filters-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.filter-btn {
    padding: 8px 16px;
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s;
}
.filter-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.filter-btn.active { background: var(--accent); color: white; }
.filter-btn.secondary { border-left: 3px solid #6b7280; }
.filter-btn.warning { border-left: 3px solid #f59e0b; }
.filter-btn.success { border-left: 3px solid #22c55e; }
.filter-btn.danger { border-left: 3px solid #ef4444; }

.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}
.status-badge.secondary { background: rgba(107,114,128,0.2); color: #9ca3af; }
.status-badge.warning { background: rgba(245,158,11,0.2); color: #f59e0b; }
.status-badge.success { background: rgba(34,197,94,0.2); color: #22c55e; }
.status-badge.danger { background: rgba(239,68,68,0.2); color: #ef4444; }

@media (max-width: 768px) {
    .filters-bar { gap: 6px; }
    .filter-btn { padding: 6px 10px; font-size: 12px; }
}
@media (max-width: 480px) {
    .filters-bar { flex-direction: column; }
    .filter-btn { width: 100%; text-align: center; }
}


/* ============================================================================
   ADMIN: Complaint/Support Detail - Просмотр тикета (админ)
   ============================================================================ */

.admin-grid {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 20px;
}
@media (max-width: 1000px) { .admin-grid { grid-template-columns: 1fr; } }

.admin-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.uid-text { font-family: monospace; font-size: 12px; word-break: break-all; }
.video-link { color: var(--accent); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.video-link:hover { text-decoration: underline; }
.description-text { color: var(--text-secondary); line-height: 1.6; white-space: pre-wrap; word-break: break-word; max-height: 200px; overflow-y: auto; }
.photos-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.photo-thumb { width: 100px; height: 100px; object-fit: cover; border-radius: 8px; cursor: pointer; transition: transform 0.2s; border: 1px solid var(--border); }
.photo-thumb:hover { transform: scale(1.05); }
.status-select {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 13px;
    cursor: pointer;
}
.status-select option {
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 8px;
}

/* Admin chat messages */
.admin-chat-messages { flex: 1; overflow-y: auto; max-height: 400px; display: flex; flex-direction: column; gap: 8px; padding: 8px 0; }

@media (max-width: 768px) {
    .admin-grid { gap: 16px; }
    .admin-sidebar { gap: 12px; }
    .description-text { font-size: 13px; max-height: 150px; }
    .photo-thumb { width: 80px; height: 80px; }
    .admin-chat-messages { max-height: 300px; }
}
@media (max-width: 480px) {
    .photo-thumb { width: 70px; height: 70px; }
    .admin-chat-messages { max-height: 250px; }
}


/* ============================================================================
   MVD: Общие стили панели МВД
   ============================================================================ */

.mvd-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.mvd-stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.mvd-stat-card .stat-value { font-size: 28px; font-weight: 700; color: var(--text-primary); }
.mvd-stat-card .stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* mvd-table styles merged with fines-table in PAGE: Fines section */

.mvd-table .badge-police { background: rgba(59,130,246,0.15); color: #3b82f6; }
.badge-muted { background: rgba(100,116,139,0.15); color: #64748b; }

.mvd-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.mvd-header h1 { font-size: 24px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.mvd-header h1 svg { color: #3b82f6; }

.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.mvd-filters { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.mvd-filters select, .mvd-filters input { background: var(--bg-card); border: 1px solid var(--border); color: var(--text-primary); padding: 8px 14px; border-radius: 8px; font-size: 14px; font-family: inherit; }
.mvd-filters select:focus, .mvd-filters input:focus { outline: none; border-color: var(--accent); }

.modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); z-index: 10000; align-items: center; justify-content: center; }
.modal-overlay.show { display: flex; }
.modal-box { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 28px; width: 480px; max-width: 95vw; max-height: 90vh; overflow-y: auto; }
.modal-box h2 { font-size: 20px; margin-bottom: 20px; display: flex; align-items: center; gap: 8px; }
.modal-box label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; margin-top: 14px; }
.modal-box input, .modal-box textarea, .modal-box select { width: 100%; background: var(--bg-secondary); border: 1px solid var(--border); color: var(--text-primary); padding: 10px 14px; border-radius: 8px; font-size: 14px; font-family: inherit; }
.modal-box input:focus, .modal-box textarea:focus, .modal-box select:focus { outline: none; border-color: var(--accent); }
.modal-box textarea { min-height: 80px; resize: vertical; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }

.case-detail-grid { display: grid; grid-template-columns: 1fr 300px; gap: 24px; }
@media (max-width: 900px) { .case-detail-grid { grid-template-columns: 1fr; } }
.case-info-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.case-info-card h3 { font-size: 16px; margin-bottom: 12px; color: var(--text-primary); }
.case-info-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; gap: 12px; }
.case-info-row:last-child { border-bottom: none; }
.case-info-label { color: var(--text-muted); flex-shrink: 0; }
.case-info-row > span:last-child { text-align: right; word-break: break-word; }

.timeline { margin-top: 16px; }
.timeline-item { position: relative; padding: 16px 20px; padding-left: 32px; border-left: 2px solid var(--border); }
.timeline-item::before { content: ''; position: absolute; left: -5px; top: 22px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.timeline-item .tl-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.timeline-item .tl-author { font-weight: 600; color: var(--text-primary); }
.timeline-item .tl-content { font-size: 14px; color: var(--text-secondary); line-height: 1.5; white-space: pre-wrap; }

.note-form { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-top: 16px; }
.note-form textarea { width: 100%; background: var(--bg-secondary); border: 1px solid var(--border); color: var(--text-primary); padding: 10px 14px; border-radius: 8px; font-size: 14px; font-family: inherit; min-height: 80px; resize: vertical; }
.note-form textarea:focus { outline: none; border-color: var(--accent); }

.page-nav { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.page-nav a { padding: 8px 16px; border-radius: 8px; font-size: 14px; font-weight: 500; text-decoration: none; color: var(--text-secondary); background: var(--bg-card); border: 1px solid var(--border); transition: all 0.2s; display: flex; align-items: center; gap: 6px; }
.page-nav a:hover { border-color: var(--accent); color: var(--accent); }
.page-nav a.active { background: var(--accent); color: white; border-color: var(--accent); }

/* alert-error merged with alert-danger in ALERTS section above */


/* ============================================================================
   COMPONENT: Header Cropper Modal
   ============================================================================ */

#cropperModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.9);
    z-index: 100002;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.cropper-container-modal {
    background: var(--bg-card, #1a1a2e);
    border-radius: 16px;
    max-width: 500px;
    width: 100%;
    overflow: hidden;
}
.cropper-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border, #2d2d44);
}
.cropper-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--text-primary, #fff);
}
.cropper-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-muted, #888);
    cursor: pointer;
    line-height: 1;
}
.cropper-close:hover {
    color: var(--text-primary, #fff);
}
.cropper-body {
    padding: 20px;
}
.cropper-image-container {
    width: 100%;
    max-height: 400px;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}
.cropper-image-container img {
    display: block;
    max-width: 100%;
}
.cropper-hint {
    text-align: center;
    color: var(--text-muted, #888);
    font-size: 13px;
    margin-top: 12px;
}
.cropper-buttons {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--border, #2d2d44);
}
.cropper-buttons .btn {
    flex: 1;
}
@media (max-width: 480px) {
    .cropper-container-modal {
        max-width: 100%;
        border-radius: 12px;
    }
    .cropper-image-container {
        max-height: 300px;
    }
}

/* ================================================
   DELETE CONFIRMATION MODAL (Telegram-style)
   ================================================ */
.dm-delete-modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.55);
    z-index: 10001;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease;
}
.dm-delete-modal-overlay.show {
    display: flex;
}
.dm-delete-modal {
    background: #2a2a2c;
    border-radius: 14px;
    padding: 20px 24px;
    min-width: 300px;
    max-width: 380px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
    animation: contextMenuIn 0.15s ease;
}
.dm-delete-modal-title {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 8px;
}
.dm-delete-modal-text {
    font-size: 14px;
    color: #999;
    margin-bottom: 16px;
    line-height: 1.4;
}
.dm-delete-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    cursor: pointer;
    font-size: 14px;
    color: #ccc;
}
.dm-delete-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent, #6c5ce7);
    cursor: pointer;
}
.dm-delete-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}
.dm-delete-btn-cancel {
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    background: #3a3a3c;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s;
}
.dm-delete-btn-cancel:hover {
    background: #4a4a4c;
}
.dm-delete-btn-confirm {
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    background: #e74c3c;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.dm-delete-btn-confirm:hover {
    background: #c0392b;
}

/* ================================================
   EDIT PREVIEW (above input, like reply preview)
   ================================================ */
.dm-edit-preview {
    display: none;
    background: var(--bg-secondary);
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 13px;
    align-items: center;
    gap: 10px;
    border-left: 3px solid var(--accent, #6c5ce7);
}
.dm-edit-preview.show {
    display: flex;
}
.dm-edit-preview-content {
    flex: 1;
    min-width: 0;
}
.dm-edit-preview-title {
    font-weight: 600;
    color: var(--accent, #6c5ce7);
    margin-bottom: 2px;
}
.dm-edit-preview-text {
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dm-edit-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 18px;
}

/* ================================================
   EDITED BADGE ("ред.")
   ================================================ */
.dm-msg-edited {
    font-size: 11px;
    color: #888;
    margin-left: 4px;
    font-style: italic;
}

/* ================================================
   FORWARDED MESSAGE HEADER
   ================================================ */
.dm-msg-forward {
    font-size: 12px;
    color: var(--accent, #6c5ce7);
    margin-bottom: 4px;
    padding-left: 8px;
    border-left: 2px solid var(--accent, #6c5ce7);
    line-height: 1.3;
}

/* ================================================
   FORWARD MODAL (conversation picker)
   ================================================ */
.dm-forward-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.55);
    z-index: 10001;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease;
}
.dm-forward-overlay.show {
    display: flex;
}
.dm-forward-modal {
    background: #2a2a2c;
    border-radius: 14px;
    width: 360px;
    max-width: 90vw;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
    animation: contextMenuIn 0.15s ease;
    overflow: hidden;
}
.dm-forward-modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #3a3a3c;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.dm-forward-modal-header h3 {
    margin: 0;
    font-size: 16px;
    color: #fff;
}
.dm-forward-close {
    background: none;
    border: none;
    color: #999;
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
}
.dm-forward-close:hover {
    color: #fff;
}
.dm-forward-list {
    overflow-y: auto;
    flex: 1;
    padding: 8px 0;
}
.dm-forward-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    cursor: pointer;
    transition: background 0.15s;
}
.dm-forward-item:hover {
    background: #3a3a3c;
}
.dm-forward-item .dm-conv-avatar {
    width: 40px;
    height: 40px;
    font-size: 16px;
}
.dm-forward-item-name {
    font-size: 14px;
    color: #fff;
    flex: 1;
}
.dm-forward-empty {
    text-align: center;
    color: #888;
    padding: 30px 20px;
    font-size: 14px;
}

/* ================================================
   RESTORE TOAST (with progress bar)
   ================================================ */
.restore-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #2a2a2c;
    border-radius: 10px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    z-index: 10002;
    animation: contextMenuIn 0.2s ease;
    min-width: 280px;
    overflow: hidden;
}
.restore-toast-text {
    color: #ccc;
    font-size: 14px;
    flex: 1;
}
.restore-toast-btn {
    background: none;
    border: none;
    color: var(--accent, #6c5ce7);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s;
}
.restore-toast-btn:hover {
    background: rgba(108, 92, 231, 0.15);
}
.restore-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--accent, #6c5ce7);
    animation: restoreCountdown 15s linear forwards;
    border-radius: 0 0 10px 10px;
}
@keyframes restoreCountdown {
    from { width: 100%; }
    to { width: 0%; }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ================================================
   MESSAGE REACTIONS
   ================================================ */
.dm-msg-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}
.dm-reaction {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
    user-select: none;
}

.dm-reaction:hover {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.2);
    transform: scale(1.1);
}
.dm-reaction:active {
    transform: scale(0.9);
    transition: transform 0.08s;
}
.dm-reaction.mine {
    background: rgba(108, 92, 231, 0.25);
    border-color: var(--accent, #6c5ce7);
}
.dm-reaction.mine:hover {
    background: rgba(108, 92, 231, 0.35);
}

.dm-reaction-emoji {
    font-size: 15px;
    line-height: 1;
}
.dm-reaction .lottie-reaction-badge {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    pointer-events: none;
    font-size: 14px;
    line-height: 1;
}
/* Hide fallback emoji when lottie SVG is loaded */
.dm-reaction .lottie-reaction-badge svg ~ * {
    display: none;
}
.dm-reaction .lottie-reaction-badge svg {
    position: absolute;
    width: 100%;
    height: 100%;
}
.dm-reaction .lottie-reaction-badge:has(svg) {
    position: relative;
    color: transparent;
}
.dm-reaction-count {
    font-size: 12px;
    color: #aaa;
    font-weight: 500;
    display: inline-block;
}

.dm-reaction.mine .dm-reaction-count {
    color: var(--accent, #6c5ce7);
}


/* ============================================================================
   COMPONENT: Restricted Access Block - Блок ограничения доступа
   ============================================================================ */

.restricted-access-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 24px;
    min-height: 400px;
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border);
    margin: 20px;
}

.restricted-access-icon {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.05));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    color: var(--danger);
    border: 2px solid rgba(239, 68, 68, 0.2);
}

.restricted-access-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--danger);
    margin: 0 0 12px 0;
}

.restricted-access-desc {
    color: var(--text-secondary);
    font-size: 16px;
    margin: 0 0 32px 0;
    max-width: 450px;
    line-height: 1.6;
}

.restricted-access-info {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px 24px;
    width: 100%;
    max-width: 400px;
    margin-bottom: 24px;
}

.restricted-access-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.restricted-access-row:last-child {
    border-bottom: none;
}

.restricted-access-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 14px;
}

.restricted-access-value {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 14px;
}

.restricted-reason {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 12px;
    padding: 16px 20px;
    width: 100%;
    max-width: 400px;
    margin-bottom: 24px;
    text-align: left;
}

.restricted-reason-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--danger);
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
}

.restricted-reason-text {
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
}

.restricted-access-help {
    margin-bottom: 24px;
}

.restricted-access-help p {
    color: var(--text-muted);
    font-size: 13px;
    margin: 0;
}

/* Вариант для встраивания в контейнер без фона (внутри card) */
.restricted-access-block.inline {
    background: transparent;
    border: none;
    margin: 0;
    padding: 40px 20px;
}

/* Блок ограничения для чата (компактный) */
.chat-restricted-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 24px;
    background: rgba(239, 68, 68, 0.1);
    border-top: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--danger);
    font-size: 14px;
}

.chat-restricted-notice svg {
    flex-shrink: 0;
}


/* ============================================================================
   MOBILE ADAPTIVE DESIGN - Комплексная мобильная адаптация
   ============================================================================ */

/* ===== Sidebar overlay polish ===== */
@media (max-width: 900px) {
    .sidebar-overlay {
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
    }
}

/* ===== Messages page — critical mobile fixes ===== */
/* ============================================================================
   МОБИЛЬНАЯ АДАПТАЦИЯ СООБЩЕНИЙ (как в Telegram/WhatsApp)

   Структура:
   - .messages-container (fixed fullscreen)
     - .dm-sidebar (absolute fullscreen, visible by default)
       - .dm-panel (flex:1)
         - .dm-search
         - .dm-conversations/.dm-user-list/.dm-settings-content (flex:1, overflow-y:auto)
       - .dm-sidebar-tabs (flex-shrink:0)
     - .dm-chat-panel (absolute fullscreen, hidden by default via .hidden-mobile)
       - #dmEmptyState / #dmChatContent
         - .dm-chat-header
         - .dm-messages (flex:1, overflow-y:auto)
         - .dm-input-form (flex-shrink:0, NOT fixed!)
   ============================================================================ */
@media (max-width: 768px) {
    /* === КОНТЕЙНЕР — полноэкранный === */
    .messages-container {
        position: fixed;
        top: 56px; /* высота header */
        left: 0;
        right: 0;
        bottom: 0;
        height: auto;
        min-height: 0;
        border-radius: 0;
        border: none;
        margin: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    /* === SIDEBAR (список чатов) — полный экран === */
    .dm-sidebar {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        border-right: none;
        z-index: 10;
        background: var(--bg-card);
        overflow: hidden;
        /* iOS scroll fix */
        -webkit-overflow-scrolling: touch;
    }

    .dm-sidebar.hidden-mobile {
        display: none !important;
    }

    /* Панели внутри sidebar (Чаты/Друзья/Настройки) */
    .dm-panel {
        flex: 1 1 0%;
        display: flex;
        flex-direction: column;
        min-height: 0;
        height: 0; /* Force flex sizing */
        overflow: hidden;
    }

    /* Поиск внутри панели */
    .dm-search {
        flex: 0 0 auto;
    }

    /* Список диалогов — скроллится */
    .dm-conversations {
        flex: 1 1 0%;
        height: 0; /* Force flex sizing */
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
        touch-action: pan-y;
    }

    /* Список друзей — скроллится */
    .dm-user-list {
        flex: 1 1 0%;
        height: 0; /* Force flex sizing */
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
        touch-action: pan-y;
    }

    /* Настройки — скроллится */
    .dm-settings-content {
        flex: 1 1 0%;
        height: 0; /* Force flex sizing */
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
        touch-action: pan-y;
        padding: 16px;
    }

    /* Табы друзей */
    .dm-friends-tabs {
        flex: 0 0 auto;
    }

    /* Табы внизу sidebar — фиксированы */
    .dm-sidebar-tabs {
        flex: 0 0 auto;
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }

    /* === ПАНЕЛЬ ЧАТА === */
    /* По умолчанию скрыта через класс .hidden-mobile в HTML */
    .dm-chat-panel {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        z-index: 20;
        background: var(--bg-card);
        overflow: hidden;
    }

    .dm-chat-panel.hidden-mobile {
        display: none !important;
    }

    /* Empty state внутри chat panel */
    .dm-chat-panel .dm-empty {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    /* Контейнер контента чата (когда чат открыт) */
    #dmChatContent {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-height: 0;
        overflow: hidden;
    }

    /* Заголовок чата */
    .dm-chat-header {
        flex-shrink: 0;
    }

    /* Сообщения — flex:1, скроллятся */
    .dm-chat-panel .dm-messages {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        padding: 12px;
        min-height: 0;
    }

    /* Форма ввода — НЕ fixed, а внизу flex-контейнера */
    .dm-chat-panel .dm-input-form {
        flex-shrink: 0;
        position: relative;
        padding: 10px 12px;
        padding-bottom: max(10px, env(safe-area-inset-bottom));
        background: var(--bg-card);
        border-top: 1px solid var(--border);
        z-index: 5;
    }

    /* Кнопка назад — видна на мобильном */
    .dm-back-btn {
        display: flex !important;
    }

    /* === EMOJI PICKER — над input === */
    .dm-emoji-picker {
        position: fixed;
        bottom: 70px;
        left: 8px;
        right: 8px;
        width: auto;
        max-height: 35vh;
        overflow-y: auto;
        max-width: none;
        z-index: 100;
        border-radius: 12px;
    }

    /* === КОНТЕКСТНОЕ МЕНЮ — bottom sheet === */
    .dm-context-menu {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        border-radius: 16px 16px 0 0;
        padding-bottom: max(16px, env(safe-area-inset-bottom));
        min-width: 0;
        width: 100%;
        z-index: 10000; /* Must be higher than overlay (9998) */
        animation: contextMenuSlideUp 0.2s ease;
    }

    .dm-reactions-bar {
        justify-content: space-around;
    }

    /* === СТИЛИ СООБЩЕНИЙ === */
    .dm-msg {
        max-width: 85%;
        -webkit-user-select: none;
        user-select: none;
        -webkit-touch-callout: none;
    }

    .dm-msg-text {
        -webkit-user-select: text;
        user-select: text;
    }

    .dm-msg-reactions {
        clear: both;
    }

    /* === МОДАЛКИ === */
    .dm-delete-modal-overlay,
    .dm-forward-overlay {
        z-index: 10001;
    }

    .dm-delete-modal,
    .dm-forward-modal {
        max-width: calc(100vw - 24px);
        margin: 0 12px;
    }

    /* === EMOJI PICKER SIZE === */
    .dm-emoji-picker span {
        font-size: 24px;
        padding: 8px;
    }

    /* === IMAGE PREVIEW === */
    .dm-image-preview img {
        max-width: 150px;
        max-height: 100px;
    }

    /* === MESSAGE IMAGES === */
    .dm-msg-image img {
        max-width: 200px;
        max-height: 200px;
    }

    /* === INPUT BUTTONS SIZE === */
    .dm-input-btn {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
    }

    .dm-input-btn svg {
        width: 22px;
        height: 22px;
    }

    /* Image modal - mobile friendly */
    .dm-image-modal img {
        max-width: 95vw;
        max-height: 80vh;
    }

    .dm-image-modal-close {
        top: max(12px, env(safe-area-inset-top, 12px));
        right: 12px;
    }
}

@keyframes contextMenuSlideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Messages — smaller elements on small phones */
@media (max-width: 480px) {
    .dm-msg-avatar { width: 32px; height: 32px; font-size: 13px; }
    .dm-msg-name { font-size: 12px; }
    .dm-msg-text { font-size: 14px; }
    .dm-msg-time { font-size: 10px; }
    .dm-msg-image img { max-width: 200px; max-height: 200px; }
    .dm-msg-reply-text { max-width: 180px; }
    .dm-conv-avatar { width: 40px; height: 40px; font-size: 14px; }
    .dm-conv-name { font-size: 14px; }
    .dm-conv-preview { font-size: 12px; }
    .dm-sidebar-title { font-size: 16px; }
}

/* ===== Main page (stats + chat + news) ===== */
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .stat-card {
        padding: 12px;
    }
}

@media (max-width: 768px) {
    /* Chat widget on main page */
    .chat-container {
        min-height: 50vh;
        max-height: 70vh;
        min-height: 50dvh;
        max-height: 70dvh;
    }
    /* Main page chat - prepare for iOS keyboard */
    .page-chat {
        position: relative;
    }
    .page-chat .dm-messages {
        padding-bottom: 10px;
    }
    .page-chat .dm-input-form {
        /* Will be positioned via JS on mobile */
    }
    /* Support/Complaint chat input — sticky */
    .chat-input-form {
        position: sticky;
        bottom: 0;
        background: var(--bg-card);
        z-index: 5;
    }
}

/* ===== Complaints & Support — player side ===== */
@media (max-width: 768px) {
    .ticket-container,
    .complaint-container {
        grid-template-columns: 1fr;
    }
    .ticket-info,
    .complaint-info {
        width: 100%;
        max-height: 30vh;
        overflow-y: auto;
    }
    .chat-section {
        flex: 1;
        min-height: 50vh;
    }
}

/* ===== Complaints & Support — admin side ===== */
@media (max-width: 768px) {
    .admin-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== MVD panel ===== */
@media (max-width: 768px) {
    .mvd-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .fines-table-wrap,
    .mvd-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .fines-table,
    .mvd-table {
        min-width: 600px;
    }
    .fines-table td,
    .mvd-table td {
        padding: 8px 10px;
        font-size: 13px;
    }
    .mvd-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .mvd-header h1 {
        font-size: 18px;
    }
    .mvd-filters {
        flex-direction: column;
        align-items: stretch;
    }
    .mvd-filters select,
    .mvd-filters input {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .mvd-stats {
        grid-template-columns: 1fr;
    }
}

/* MVD case detail */
@media (max-width: 768px) {
    .case-detail-grid {
        grid-template-columns: 1fr;
    }
    .case-info-card {
        order: -1;
    }
}

/* MVD modals */
@media (max-width: 768px) {
    .modal-box {
        width: calc(100vw - 24px);
        max-height: calc(var(--vh-full) - 48px);
        overflow-y: auto;
        margin: 12px;
        padding: 20px;
    }
    .modal-actions {
        flex-direction: column;
    }
    .modal-actions .btn {
        width: 100%;
    }
}

/* ===== Admin tables ===== */
@media (max-width: 768px) {
    .table-wrapper,
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ===== Admin news editor ===== */
@media (max-width: 768px) {
    .image-upload-area {
        min-height: 120px;
    }
}

/* ===== Admin permissions ===== */
@media (max-width: 480px) {
    .permission-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* ===== Garage / Property ===== */
@media (max-width: 480px) {
    .property-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 12px;
    }
    .property-card {
        padding: 0;
    }
    .property-info {
        padding: 12px;
    }
}

/* ===== Marketplace ===== */
@media (max-width: 768px) {
    .categories {
        padding: 12px;
        gap: 6px;
    }
    .category-btn {
        padding: 8px 12px;
        font-size: 13px;
    }
    .listings-grid {
        grid-template-columns: 1fr;
    }
    .marketplace-header {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ===== Transfers (grid-2) ===== */
@media (max-width: 768px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }
}

/* ===== Login ===== */
@media (max-width: 480px) {
    .login-box {
        padding: 20px 16px;
        margin: 12px;
    }
    .login-container {
        padding: 12px;
    }
}

/* ===== Call widget — mobile ===== */
@media (max-width: 768px) {
    #globalCallWidget {
        width: calc(100vw - 24px);
        left: 12px;
        right: 12px;
    }
    .call-widget.minimized {
        width: calc(100vw - 24px);
        left: 12px;
        right: 12px;
        bottom: max(12px, env(safe-area-inset-bottom));
    }
    /* Входящий звонок — safe area */
    .call-incoming-modal {
        padding: max(20px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
    }
    .call-incoming-avatar {
        width: 100px;
        height: 100px;
        font-size: 40px;
    }
    .call-incoming-name {
        font-size: 20px;
    }
    .call-incoming-status {
        font-size: 14px;
    }
    .call-incoming-actions {
        gap: 24px;
    }
    .call-incoming-btn {
        width: 56px;
        height: 56px;
    }
    .call-incoming-btn svg {
        width: 24px;
        height: 24px;
    }
    /* Fullscreen call — mobile padding */
    .call-widget.fullscreen {
        padding: max(20px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
    }
    .call-widget.fullscreen .call-widget-avatar {
        width: 100px;
        height: 100px;
        font-size: 40px;
    }
    .call-widget.fullscreen .call-widget-name {
        font-size: 20px;
    }
    .call-widget.fullscreen .call-widget-timer {
        font-size: 32px;
    }
    .call-widget.fullscreen .call-widget-btn {
        width: 56px;
        height: 56px;
    }
    .call-widget.fullscreen .call-widget-actions {
        gap: 12px;
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* Call widget — very small screens */
@media (max-width: 375px) {
    .call-incoming-avatar {
        width: 80px;
        height: 80px;
        font-size: 32px;
    }
    .call-incoming-name {
        font-size: 18px;
    }
    .call-incoming-actions {
        gap: 20px;
    }
    .call-incoming-btn {
        width: 52px;
        height: 52px;
    }
    .call-widget.fullscreen .call-widget-avatar {
        width: 80px;
        height: 80px;
        font-size: 32px;
    }
    .call-widget.fullscreen .call-widget-timer {
        font-size: 28px;
    }
    .call-widget.fullscreen .call-widget-btn {
        width: 48px;
        height: 48px;
    }
    .call-widget.fullscreen .call-widget-btn svg {
        width: 22px;
        height: 22px;
    }
}

/* ===== Sell modal — mobile ===== */
@media (max-width: 480px) {
    .sell-modal {
        padding: 24px 16px;
        width: calc(100vw - 24px);
    }
    .sell-modal h3 {
        font-size: 18px;
    }
    .sell-modal-price {
        font-size: 20px;
    }
    .sell-modal-buttons {
        flex-direction: column;
    }
}

/* ===== Privacy/Agreement modals — mobile ===== */
@media (max-width: 480px) {
    .privacy-modal {
        max-width: 100%;
        max-height: calc(var(--vh-full) - 24px);
        border-radius: 12px;
    }
    .privacy-modal-header {
        padding: 16px;
    }
    .privacy-modal-header h2 {
        font-size: 18px;
    }
    .privacy-modal-body {
        padding: 16px;
        font-size: 13px;
    }
}

/* ===== Notification dropdown — mobile ===== */
@media (max-width: 768px) {
    .notif-dropdown {
        border-radius: 12px;
    }
    .notif-header-row {
        padding: 14px 16px;
    }
    .notif-mark-all {
        font-size: 13px;
        min-height: 36px;
        display: flex;
        align-items: center;
    }
    .notif-item {
        padding: 14px 16px;
    }
    .notif-item-title {
        font-size: 14px;
    }
    .notif-item-message {
        font-size: 14px;
    }
    .notif-list {
        -webkit-overflow-scrolling: touch;
    }
}
@media (max-width: 480px) {
    .notif-dropdown {
        top: 56px;
        right: 8px;
        left: 8px;
        max-height: calc(var(--vh-full) - 80px);
        border-radius: 12px;
    }
    .notif-header-row {
        padding: 12px 14px;
        font-size: 15px;
    }
    .notif-item {
        padding: 14px;
    }
    .notif-item-title {
        font-size: 14px;
    }
    .notif-item-time {
        font-size: 11px;
    }
    .notif-item-message {
        font-size: 13px;
        line-height: 1.5;
    }
    .notif-empty {
        padding: 40px 16px;
        font-size: 14px;
    }
}

/* ===== Toast — mobile positioning ===== */
@media (max-width: 480px) {
    .toast-container {
        top: auto;
        bottom: max(20px, env(safe-area-inset-bottom, 20px));
        right: 8px;
        left: 8px;
        max-width: none;
    }
}

/* ===== Donate page — mobile ===== */
@media (max-width: 480px) {
    .donate-hero {
        padding: 32px 16px;
    }
    .donate-hero h1 {
        font-size: 24px;
    }
    .donate-hero p {
        font-size: 14px;
    }
    .donate-btn {
        padding: 14px 28px;
        font-size: 16px;
    }
    .disclaimer {
        padding: 20px 16px;
    }
    .payment-icons {
        gap: 8px;
    }
    .payment-icon {
        padding: 10px 14px;
        font-size: 13px;
    }
}

/* ===== News article — mobile ===== */
@media (max-width: 480px) {
    .news-title {
        font-size: 22px;
    }
    .news-hero-image {
        height: 160px;
        border-radius: 10px;
    }
}

/* ===== Marketplace view — mobile ===== */
@media (max-width: 480px) {
    .view-card-content {
        padding: 20px 16px;
    }
    .view-header {
        flex-direction: column;
        gap: 12px;
    }
    .view-title {
        font-size: 22px;
    }
    .view-price {
        font-size: 28px;
    }
    .view-info {
        grid-template-columns: 1fr;
    }
}

/* ===== Restricted access block — mobile ===== */
@media (max-width: 480px) {
    .restricted-access-block {
        padding: 40px 16px;
        margin: 12px;
    }
    .restricted-access-title {
        font-size: 22px;
    }
    .restricted-access-desc {
        font-size: 14px;
    }
}

/* ===== Footer — mobile ===== */
@media (max-width: 480px) {
    .lk-footer {
        padding: 12px 16px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
    .lk-footer-inner {
        flex-direction: column;
        gap: 8px;
    }
}

/* ===== Landscape mode improvements ===== */
@media (max-width: 900px) and (orientation: landscape) {
    .messages-container {
        height: calc(var(--vv-height, var(--vh-full)) - 60px);
    }
    .dm-input-form {
        padding: 8px 12px;
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }
    .call-widget.fullscreen {
        padding: 16px;
        flex-direction: row;
        gap: 32px;
    }
    .call-widget.fullscreen .call-widget-avatar {
        width: 80px;
        height: 80px;
        font-size: 32px;
    }
    .call-widget.fullscreen .call-widget-timer {
        font-size: 28px;
        margin-top: 8px;
    }
    .call-widget.fullscreen .call-widget-actions {
        margin-top: 16px;
    }
}

/* ===== Very small screens (≤ 375px) ===== */
@media (max-width: 375px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .stat-value {
        font-size: 16px;
    }
    .container {
        padding: 0 8px;
    }
    .main {
        padding-left: 0;
        padding-right: 0;
    }
}

/* ===== Fines table — mobile improvements ===== */
@media (max-width: 768px) {
    .fines-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -12px;
        padding: 0 12px;
    }
    .fines-table {
        min-width: 580px;
    }
    .fines-table td,
    .fines-table th {
        padding: 10px 8px;
        font-size: 13px;
        white-space: nowrap;
    }
    .btn-pay-fine {
        padding: 6px 14px;
        font-size: 13px;
        min-height: 36px;
    }
}

/* ===== Lightbox — mobile ===== */
@media (max-width: 768px) {
    .lightbox img {
        max-width: 95%;
        max-height: 85vh;
        max-height: 85dvh;
    }
}

/* ===== Server Restart Notice ===== */
.server-restart-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    margin-bottom: 20px;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.server-restart-notice svg {
    color: #3b82f6;
    flex-shrink: 0;
}

.server-restart-notice strong {
    color: var(--text-primary);
}

/* ============================================
   Mods Page (LK)
   ============================================ */

.lk-mods-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 10px;
    flex-wrap: wrap;
}

.lk-mods-select-all {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    user-select: none;
}

.lk-mods-select-all input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

.lk-mods-count {
    font-size: 13px;
    color: var(--text-secondary);
    margin-left: auto;
    margin-right: 8px;
}

.lk-mods-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lk-mod-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: border-color 0.2s;
}

.lk-mod-card:hover {
    border-color: var(--accent);
}

.lk-mod-checkbox-wrap {
    flex-shrink: 0;
    cursor: pointer;
}

.lk-mod-checkbox {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

.lk-mod-info {
    flex: 1;
    min-width: 0;
}

.lk-mod-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    word-break: break-all;
}

.lk-mod-meta {
    display: flex;
    gap: 16px;
    margin-top: 2px;
    font-size: 12px;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.lk-mod-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.lk-mod-dl {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.lk-mods-install-hint {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    padding: 14px 16px;
    background: rgba(59, 130, 246, 0.06);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: 10px;
}

.lk-mods-install-hint-icon {
    flex-shrink: 0;
    color: #3b82f6;
    margin-top: 1px;
}

.lk-mods-install-hint-text {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.6;
}

.lk-mods-install-hint-text strong {
    display: block;
    margin-bottom: 4px;
}

.lk-mods-install-hint-text p {
    margin: 3px 0;
    color: var(--text-secondary);
}

.lk-mods-install-hint-text code {
    display: inline-block;
    background: var(--bg-tertiary);
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 12px;
    color: #f59e0b;
    word-break: break-all;
    margin: 3px 0;
}

@media (max-width: 600px) {
    .lk-mods-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .lk-mods-count {
        margin-left: 0;
    }

    .lk-mod-meta {
        flex-direction: column;
        gap: 2px;
    }
}

/* ============================================================================
   SKILLS WIDGET - Виджет навыков на главной
   ============================================================================ */

.skills-card {
    margin-top: 32px;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 0;
}

.skill-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: background 0.15s, border-color 0.15s;
}

.skill-item:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.08);
}

.skill-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.skill-icon svg {
    width: 22px;
    height: 22px;
}

.skill-info {
    flex: 1;
    min-width: 0;
}

.skill-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.skill-level {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.skill-progress {
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

.skill-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
    min-width: 0;
}

.skill-xp-text {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

@media (max-width: 900px) {
    .skills-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .skills-grid {
        grid-template-columns: 1fr;
    }
}
