:root {
    --bg-color: #f4f6f9;
    --card-bg: #ffffff;
    --text-color: #2c3e50;
    --text-muted: #7f8c8d;
    --border-color: #e2e8f0;
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --danger-color: #ef4444;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --shadow: 0 4px 12px rgba(0,0,0,0.06);
    --radius: 10px;
}

[data-theme="dark"] {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --primary-color: #3b82f6;
    --shadow: 0 4px 12px rgba(0,0,0,0.3);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    position: relative;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
}

/* Navbar */
.navbar {
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

.nav-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 65px;
    width: 100%;
}

.logo {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.nav-links {
    display: flex;
    gap: 10px;
}

.nav-btn {
    background: none;
    border: none;
    color: var(--text-color);
    padding: 8px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.nav-btn.active, .nav-btn:hover {
    background-color: rgba(59, 130, 246, 0.12);
    color: var(--primary-color);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.mobile-menu-toggle {
    display: none;
}

/* Оверлей для мобильного меню */
.nav-overlay {
    position: fixed;
    top: 65px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    z-index: 998;
}

/* Кнопки и инпуты */
.btn {
    padding: 9px 18px;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    min-height: 40px;
    justify-content: center;
}

.btn-primary { background: var(--primary-color); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-color); }
.btn-outline:hover { background: rgba(0,0,0,0.05); }
.btn-danger { background: var(--danger-color); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 0.88rem; min-height: 34px; }
.btn-block { width: 100%; justify-content: center; padding: 12px; font-size: 1rem; }
.btn-text { background: none; border: none; cursor: pointer; text-decoration: underline; font-size: 0.9rem; }

.icon-btn {
    background: none;
    border: 1px solid var(--border-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.1rem;
}

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

.nav-username {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.auth-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Карточки */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    width: 100%;
    box-sizing: border-box;
}

.main-content {
    padding: 30px 20px;
    flex: 1;
    width: 100%;
    max-width: 1100px;
    box-sizing: border-box;
}

/* Служебные классы */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger-color); }
.text-success { color: var(--success-color); }
.text-primary { color: var(--primary-color); }
.text-sm { font-size: 0.88rem; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-3 { margin-bottom: 16px; }

/* Тосты */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: calc(100vw - 40px);
}
.toast {
    padding: 12px 20px;
    border-radius: var(--radius);
    color: #fff;
    font-weight: 500;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    animation: fadeIn 0.3s ease;
    word-break: break-word;
}
.toast-success { background-color: var(--success-color); }
.toast-error { background-color: var(--danger-color); }

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

/* Уведомления */
.badge-notif {
    background: var(--danger-color);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    margin-left: 4px;
}

.notifications-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px;
    border-radius: var(--radius);
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    border: 1px solid var(--border-color);
    background: var(--card-bg);
}

/* Цветные темы для разных типов уведомлений */
.notification-item.notif-approved {
    background-color: rgba(16, 185, 129, 0.15);
    border: 1px solid var(--success-color);
}

.notification-item.notif-rejected {
    background-color: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--danger-color);
}

.notif-approved .notif-icon-box {
    color: var(--success-color);
    font-size: 1.25rem;
}

.notif-rejected .notif-icon-box {
    color: var(--danger-color);
    font-size: 1.25rem;
}

.notif-content {
    flex: 1;
    min-width: 0;
}

.notif-message {
    font-size: 0.98rem;
    line-height: 1.4;
    font-weight: 500;
    word-break: break-word;
}

.notif-date {
    font-size: 0.8rem;
    opacity: 0.8;
    margin-top: 6px;
}

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

/* Статистика */
.stats-header-info {
    margin-bottom: 24px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
    margin-bottom: 30px;
    width: 100%;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.stat-card-icon {
    position: absolute;
    top: 18px;
    right: 18px;
    font-size: 2rem;
    opacity: 0.15;
}

.stat-value {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.1;
    margin-top: 8px;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.88rem;
    color: var(--text-muted);
    font-weight: 600;
}

.stat-subtext {
    font-size: 0.8rem;
    margin-top: 6px;
}

.stats-table-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--card-bg);
    -webkit-overflow-scrolling: touch;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.92rem;
    min-width: 580px;
}

.stats-table th, .stats-table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
}

.stats-table th {
    background: var(--bg-color);
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

/* ==========================================
   АДАПТИВНОСТЬ (MEDIA QUERIES)
   ========================================== */

@media (max-width: 1180px) {
    .mobile-menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 65px;
        left: -20px;
        right: -20px;
        background-color: var(--card-bg);
        border-bottom: 2px solid var(--border-color);
        flex-direction: column;
        padding: 16px 20px;
        gap: 10px;
        box-shadow: 0 12px 24px rgba(0,0,0,0.15);
        z-index: 999;
    }

    .nav-links.mobile-open {
        display: flex;
        animation: slideDown 0.2s ease-out forwards;
    }

    .nav-btn {
        width: 100%;
        justify-content: flex-start;
        padding: 12px 16px;
        font-size: 1rem;
        font-weight: 600;
        border-radius: var(--radius);
        background: var(--bg-color);
    }

    .nav-btn i {
        font-size: 1.15rem;
        width: 24px;
    }
}

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

@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    .nav-links {
        left: -16px;
        right: -16px;
    }

    .main-content {
        padding: 20px 16px;
    }

    .card {
        padding: 18px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-value {
        font-size: 1.8rem;
    }

    .notification-item {
        flex-direction: column;
        gap: 10px;
    }

    .notif-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

@media (max-width: 576px) {
    .container {
        padding: 0 12px;
    }

    .nav-links {
        left: -12px;
        right: -12px;
    }

    .logo {
        font-size: 1.15rem;
    }

    .nav-username {
        display: inline-block;
        max-width: 80px;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 0.85rem;
    }

    .nav-actions {
        gap: 6px;
    }

    .btn {
        padding: 8px 14px;
        font-size: 0.9rem;
        min-height: 40px;
    }

    .auth-buttons .btn {
        padding: 6px 12px;
        font-size: 0.88rem;
        min-height: 36px;
    }

    .toast-container {
        left: 12px;
        right: 12px;
        bottom: 12px;
        max-width: none;
    }

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