:root {
    --sidebar-width: 260px;
    --sidebar-bg: #1a472a;
    --sidebar-hover: #2d6a4f;
    --sidebar-active: #40916c;
    --sidebar-text: #d4edda;
    --sidebar-width-collapsed: 0px;
    --topbar-height: 60px;
    --primary-color: #1a472a;
    --secondary-color: #2d6a4f;
    --accent-color: #40916c;
    --bg-light: #f0f4f8;
    --card-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: var(--bg-light); overflow-x: hidden; }

.wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: all 0.3s ease;
}

.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-track { background: var(--sidebar-bg); }
.sidebar::-webkit-scrollbar-thumb { background: var(--sidebar-active); border-radius: 5px; }

.sidebar-header {
    padding: 1.2rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}

.sidebar-header a {
    color: white;
    font-size: 1.4rem;
    font-weight: 700;
}

.sidebar-header small { font-size: 0.7rem; opacity: 0.7; }

.sidebar-menu { padding: 0.5rem 0; }

.sidebar-menu .nav-item { margin: 2px 0; }

.sidebar-menu .nav-link {
    color: var(--sidebar-text);
    padding: 0.65rem 1rem;
    display: flex;
    align-items: center;
    border-left: 3px solid transparent;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.sidebar-menu .nav-link i {
    font-size: 1.1rem;
    width: 24px;
    margin-right: 0.5rem;
    text-align: center;
}

.sidebar-menu .nav-link:hover {
    background: var(--sidebar-hover);
    border-left-color: white;
    color: white;
}

.sidebar-menu .nav-link.active {
    background: var(--sidebar-active);
    border-left-color: white;
    color: white;
    font-weight: 600;
}

.nav-divider {
    padding: 0.5rem 1rem 0.25rem;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.5;
    color: var(--sidebar-text);
    list-style: none;
}

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: all 0.3s ease;
}

.topbar {
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    height: var(--topbar-height);
    position: sticky;
    top: 0;
    z-index: 999;
}

.topbar .sidebar-toggle {
    color: var(--primary-color);
    font-size: 1.5rem;
    padding: 0;
    margin-right: 1rem;
}

.topbar-title {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.95rem;
}

.sidebar-toggle:focus { box-shadow: none; }

.notification-badge {
    font-size: 0.6rem;
    padding: 2px 5px;
    position: absolute;
    top: 0;
    right: 0;
}

.notification-dropdown { width: 300px; }

.user-avatar { background: var(--primary-color); }

.content-wrapper {
    flex: 1;
    padding: 1.5rem;
}

.footer {
    background: white;
    padding: 0.8rem 1.5rem;
    border-top: 1px solid #e9ecef;
    margin-top: auto;
}

.stat-card {
    border-radius: 10px;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.1) !important;
}

.stat-icon { width: 50px; height: 50px; display: flex; align-items: center; justify-content: center; }

.bg-purple-subtle { background-color: #e8daef; }
.text-purple { color: #6c3483; }

.card { border-radius: 10px; }
.table > thead { background: #f8f9fa; }

.dataTables_wrapper .dataTables_filter input { border: 1px solid #ced4da; border-radius: 6px; padding: 0.3rem 0.5rem; }
.dataTables_wrapper .dataTables_length select { border: 1px solid #ced4da; border-radius: 6px; padding: 0.3rem; }

@media (max-width: 768px) {
    .sidebar { margin-left: calc(-1 * var(--sidebar-width)); }
    .sidebar.show { margin-left: 0; }
    .main-content { margin-left: 0; }
    .content-wrapper { padding: 1rem; }
}

@media print {
    .sidebar, .topbar, .footer, .btn, form { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .content-wrapper { padding: 0 !important; }
    .card { box-shadow: none !important; border: none !important; }
    .card-body { padding: 0 !important; }
    table { font-size: 8pt !important; }
    .badge { font-size: 7pt !important; padding: 1px 3px !important; }
}

[dir="rtl"] .sidebar { right: 0; left: auto; }
[dir="rtl"] .main-content { margin-right: var(--sidebar-width); margin-left: 0; }
[dir="rtl"] .sidebar-menu .nav-link i { margin-right: 0; margin-left: 0.5rem; }

body.dark-mode {
    --bg-light: #1a1d23;
    --card-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

body.dark-mode .card,
body.dark-mode .topbar,
body.dark-mode .footer { background: #282c34; color: #e0e0e0; }
body.dark-mode .table { color: #e0e0e0; }
body.dark-mode .table-light { background: #333840; color: #e0e0e0; }

.access-denied-icon i { display: inline-block; animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }
