:root {
    --primary-dark: #1E3A8A;
    --primary-main: #4F46E5;
    --primary-light: #818CF8;
    --dark-color: #1F2937;
    --light-color: #F9FAFB;
    --sidebar-bg: #FFFFFF;
    --sidebar-border: #E5E7EB;
    --sidebar-text: #374151;
    --sidebar-hover: #F3F4F6;
    --sidebar-active: #EEF2FF;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 70px;
    --top-bar-height: 70px;
    --border-radius: 8px;
    --box-shadow: 0 1px 3px 0 rgba(0,0,0,0.1),0 1px 2px 0 rgba(0,0,0,0.06);
    --box-shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1),0 4px 6px -2px rgba(0,0,0,0.05);
    --sidebar-shadow: 2px 0 8px rgba(0,0,0,0.05);
}
* { box-sizing: border-box; }
body {
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    overflow-x: hidden;
    background-color: var(--light-color);
    margin: 0;
    padding: 0;
    color: var(--gray-800);
}
.container-fluid { padding-left: 0; padding-right: 0; }
.row { margin-left: 0; margin-right: 0; }

/* Боковая панель */
#sidebar {
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    height: 100vh;
    width: var(--sidebar-width);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: all 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: var(--sidebar-shadow);
    border-right: 1px solid var(--sidebar-border);
}
#sidebar.collapsed { width: var(--sidebar-collapsed-width); }
#sidebar.collapsed .menu-text { display: none; }
#sidebar.collapsed .logo-text { display: none; }
#sidebar.collapsed .nav-link { justify-content: center; padding: 12px 0; }
#sidebar.collapsed .nav-link ion-icon { margin-right: 0; }
#sidebar.collapsed .profile-info { display: none; }
#sidebar.collapsed .user-profile { justify-content: center; padding: 10px !important; }
.sidebar-logo {
    padding: 20px 15px;
    border-bottom: 1px solid var(--sidebar-border);
    overflow: hidden;
}
.sidebar-logo-icon { font-size: 1.8rem; color: var(--primary-main); display: none; }
#sidebar:not(.collapsed) .sidebar-logo-icon { display: none; }
#sidebar.collapsed .sidebar-logo { padding: 20px 0; justify-content: center; }
#sidebar.collapsed .sidebar-logo-icon { display: block; margin: 0 auto; }
.logo-text { font-size: 1.4rem; font-weight: 700; color: var(--primary-main); white-space: nowrap; }
.sidebar-nav { padding: 20px 0; overflow-x: hidden; }
.nav-item { margin-bottom: 2px; }
.nav-link {
    color: var(--sidebar-text);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    white-space: nowrap;
    overflow: hidden;
    font-weight: 500;
}
.nav-link:hover { color: var(--primary-main); background-color: var(--sidebar-hover); border-left: 3px solid var(--primary-light); }
.nav-link.active { color: var(--primary-main); background-color: var(--sidebar-active); border-left: 3px solid var(--primary-main); }
.nav-link ion-icon { margin-right: 15px; font-size: 1.2rem; width: 24px; text-align: center; flex-shrink: 0; color: var(--gray-500); }
.nav-link.active ion-icon { color: var(--primary-main); }

/* Профиль */
.user-profile { padding: 20px 15px; border-top: 1px solid var(--sidebar-border); }
.profile-avatar { color: var(--primary-main); }
.profile-name { font-weight: 600; color: var(--gray-800); font-size: 0.95rem; }
.profile-role { font-size: 0.8rem; color: var(--gray-500); }

/* Offcanvas */
.offcanvas-start { width: 280px; border-right: 1px solid var(--sidebar-border); }
.offcanvas-header { border-bottom: 1px solid var(--sidebar-border); padding: 20px; }
.offcanvas-title { color: var(--primary-main); font-weight: 700; font-size: 1.4rem; }
.offcanvas-body { padding: 0; display: flex; flex-direction: column; }

/* Основной контент */
#main-content {
    margin-left: var(--sidebar-width);
    transition: all 0.3s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    width: calc(100vw - var(--sidebar-width));
    background-color: var(--light-color);
}
#main-content.expanded { margin-left: var(--sidebar-collapsed-width); width: calc(100vw - var(--sidebar-collapsed-width)); }
#main-content.full-width { margin-left: 0; width: 100vw; }

/* Верхняя панель */
.top-bar {
    background-color: white;
    padding: 15px 25px;
    box-shadow: var(--box-shadow);
    border-bottom: 1px solid var(--gray-200);
    z-index: 100;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    width: 100%;
    height: var(--top-bar-height);
}
.page-title h1 { color: var(--dark-color); font-weight: 600; font-size: 1.25rem; }
.page-title small { font-size: 0.85rem; color: var(--gray-500); }
.top-bar-icons { display: flex; align-items: center; justify-content: flex-end; gap: 15px; flex-wrap: wrap; }
.icon-btn {
    background: none; border: none; color: var(--gray-600); font-size: 1.3rem; position: relative;
    padding: 8px; cursor: pointer; transition: color 0.2s, background-color 0.2s; flex-shrink: 0;
    border-radius: 50%; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { color: var(--primary-main); background-color: var(--gray-100); }
.icon-btn .badge { position: absolute; top: 0; right: 0; font-size: 0.6rem; background-color: #dc3545; padding: 3px 6px; }
.dropdown-toggle::after { display: none !important; }
#userMenuButton ion-icon { font-size: 1.4rem; }

/* Рабочая область */
.work-area { padding: 30px; flex-grow: 1; overflow-y: auto; overflow-x: hidden; background-color: var(--light-color); width: 100%; min-height: calc(100vh - var(--top-bar-height) - 70px); }
.empty-state { max-width: 600px; margin: 0 auto; padding-top: 60px; }
.empty-state-content h3 { color: var(--gray-800); font-weight: 600; margin-bottom: 10px; }
.empty-state-content p { line-height: 1.6; color: var(--gray-600); }

/* Футер */
.footer {
    background-color: white;
    padding: 15px 25px;
    border-top: 1px solid var(--gray-200);
    color: var(--gray-600);
    font-size: 0.85rem;
    flex-shrink: 0;
    width: 100%;
}

/* Кнопки */
.btn { border-radius: 6px; font-weight: 500; font-size: 0.875rem; padding: 10px 20px; display: inline-flex; align-items: center; justify-content: center; }
.btn-primary { background-color: var(--primary-main); border-color: var(--primary-main); }
.btn-primary:hover { background-color: var(--primary-dark); border-color: var(--primary-dark); }
.btn-outline-secondary { color: var(--gray-600); border-color: var(--gray-300); }
.btn-outline-secondary:hover { background-color: var(--gray-100); border-color: var(--gray-400); }

/* Таблицы (добавлено из старого custom.css) */
.table { background-color: white; border-radius: 1rem; overflow: hidden; box-shadow: var(--box-shadow); }
.table thead { background-color: var(--gray-100); border-bottom: 1px solid var(--gray-200); }
.table th { font-weight: 600; color: var(--gray-700); border-bottom: none; padding: 1rem 1.5rem; }
.table td { padding: 1rem 1.5rem; vertical-align: middle; border-bottom: 1px solid var(--gray-200); }
.table tbody tr:hover { background-color: var(--gray-100); }

/* Алерты и бейджи */
.alert { border-radius: 1rem; border: none; box-shadow: var(--box-shadow); }
.badge { padding: 0.5em 0.85em; border-radius: 2rem; font-weight: 500; }
.badge.bg-primary { background-color: #eef2ff !important; color: #1e3a8a !important; }
.badge.bg-success { background-color: #d1fae5 !important; color: #065f46 !important; }
.badge.bg-danger { background-color: #fee2e2 !important; color: #991b1b !important; }
.badge.bg-warning { background-color: #fed7aa !important; color: #92400e !important; }
.badge.bg-secondary { background-color: #f1f5f9 !important; color: #475569 !important; }

/* Формы */
.form-control, .form-select { border: 1px solid var(--gray-300); border-radius: 0.75rem; padding: 0.6rem 1rem; transition: border-color 0.15s ease, box-shadow 0.15s ease; }
.form-control:focus, .form-select:focus { border-color: var(--primary-main); box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1); outline: none; }
.form-label { font-weight: 500; color: var(--gray-600); margin-bottom: 0.25rem; }

/* Адаптивность */
@media (max-width: 992px) {
    #sidebar { display: none !important; }
    #main-content { margin-left: 0 !important; width: 100vw !important; }
    .work-area { padding: 20px; }
    .top-bar-icons { gap: 10px; }
}
@media (max-width: 768px) {
    .top-bar { padding: 12px 15px; height: auto; }
    .page-title h1 { font-size: 1.1rem; }
    .page-title small { font-size: 0.8rem; }
    .work-area { padding: 15px; }
    .btn { padding: 8px 16px; font-size: 0.85rem; }
}
@media (max-width: 576px) {
    .top-bar { flex-wrap: wrap; }
    .top-bar-icons { width: 100%; justify-content: space-between; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--gray-200); }
    .work-area { padding: 10px; }
    .footer .row { flex-direction: column; text-align: center; }
}