:root {
    --primary: #1a3a5c;
    --primary-light: #2c5282;
    --primary-dark: #0f2440;
    --accent: #c9a84c;
    --accent-hover: #b8943a;
    --sidebar-width: 250px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-size: 14px;
    min-height: 100vh;
    background: #f5f7fa;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

@media (min-width: 768px) {
    html { font-size: 16px; }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

/* ===== SIDEBAR ===== */
#wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: #fff;
    color: #1e293b;
    transition: margin-left 0.3s ease;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 40px rgba(0,0,0,0.08);
}

.sidebar.toggled {
    margin-left: calc(-1 * var(--sidebar-width));
}

.sidebar-brand {
    padding: 20px 20px 10px;
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.sidebar-brand i {
    font-size: 24px;
    color: #3b82f6;
}

.sidebar-brand-sub {
    font-size: 12px;
    font-weight: 400;
    color: #94a3b8;
    display: block;
    margin-top: -2px;
}

.sidebar-divider {
    border-color: #f1f5f9;
    margin: 10px 15px;
    flex-shrink: 0;
}

.sidebar .nav-link {
    color: #64748b;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    text-decoration: none;
    font-size: 14px;
}

.sidebar .nav-link i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.sidebar .nav-link:hover {
    color: #1e293b;
    background: #f1f5f9;
    border-left-color: #3b82f6;
}

.sidebar .nav-link.active {
    color: #1e40af;
    background: #eff6ff;
    border-left-color: #3b82f6;
    font-weight: 600;
}

.sidebar-user {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}

.sidebar-user img {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: cover;
}

.sidebar-user .user-name {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

.sidebar-user .user-role {
    font-size: 12px;
    color: #94a3b8;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 4px; }

#page-content-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

#page-content-wrapper.expanded {
    margin-left: 0;
}

#menu-toggle {
    border: none;
    background: transparent;
    font-size: 20px;
    color: var(--primary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

#menu-toggle:hover {
    background: #f3f4f6;
}

/* ===== LOGIN PAGE ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 440px;
    animation: loginFadeIn 0.6s ease-out;
}

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

.login-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.login-header {
    text-align: center;
    padding: 40px 30px 20px;
}

.login-logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: #fff;
    box-shadow: 0 8px 24px rgba(26, 58, 92, 0.3);
}

.login-header h2 {
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
    font-size: 24px;
}

.login-header p {
    color: #6b7280;
    font-size: 14px;
    margin: 0;
}

.login-body {
    padding: 0 30px 20px;
}

.login-body .form-label {
    font-weight: 600;
    color: #444;
    font-size: 13px;
}

.login-body .input-group-text {
    background: #f8f9fa;
    border-right: none;
    color: var(--primary);
}

.login-body .form-control {
    border-left: none;
    padding: 10px 12px;
}

.login-body .form-control:focus {
    box-shadow: none;
    border-color: var(--primary-light);
}

.login-body .input-group:focus-within .input-group-text {
    border-color: var(--primary-light);
}

.login-body .form-check-label {
    font-size: 13px;
    color: #6b7280;
}

.login-body .forgot-link {
    font-size: 13px;
    color: var(--primary-light);
    text-decoration: none;
}

.login-body .forgot-link:hover {
    text-decoration: underline;
}

.btn-login {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    padding: 12px;
    font-weight: 600;
    font-size: 16px;
    border: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
    width: 100%;
}

.btn-login:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 58, 92, 0.3);
}

.login-footer {
    text-align: center;
    padding: 15px 30px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
    font-size: 13px;
    color: #888;
}

/* ===== DASHBOARD ===== */
.page-content {
    padding: 28px;
    width: 100%;
}

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

.page-title {
    font-family: 'Inter', sans-serif;
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
    margin: 0;
}

@media (max-width: 768px) {
    .page-title { font-size: 24px; }
}

.breadcrumb-custom {
    font-size: 13px;
    color: #6b7280;
    margin: -4px 0 0;
    padding: 0;
    list-style: none;
    display: flex;
    gap: 0;
}

.breadcrumb-custom li + li::before {
    content: '/';
    margin: 0 6px;
    color: #9ca3af;
}

.breadcrumb-custom a {
    color: var(--primary-light);
    text-decoration: none;
}

.breadcrumb-custom a:hover { text-decoration: underline; }
.breadcrumb-custom .current { color: #6b7280; }

.page-actions {
    display: flex;
    gap: 10px;
}

.btn-add {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    padding: 10px 20px;
    border-radius: 10px;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.btn-add:hover {
    background: var(--primary-light);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 58, 92, 0.25);
}

/* ===== STAT CARDS ===== */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    font-weight: 600;
    padding: 14px 20px;
}

.card-body { padding: 20px; }

.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 16px;
}

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

.stat-card .stat-label {
    font-size: 13px;
    color: #6b7280;
    margin-top: 4px;
    display: block;
}

.stat-card .stat-trend {
    font-size: 12px;
    font-weight: 600;
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-trend.up { color: #059669; }
.stat-trend.down { color: #dc2626; }
.stat-trend.neutral { color: #6b7280; }

/* Stat card color variants */
.stat-blue .stat-icon { background: #eef2ff; color: var(--primary-light); }
.stat-green .stat-icon { background: #ecfdf5; color: #059669; }
.stat-amber .stat-icon { background: #fffbeb; color: #d97706; }
.stat-red .stat-icon { background: #fef2f2; color: #dc2626; }
.stat-purple .stat-icon { background: #f5f3ff; color: #7c3aed; }

/* ===== TABLE ===== */
.table-modern {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.table-modern thead th {
    background: #f9fafb;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #6b7280;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

.table-modern tbody tr { transition: background 0.15s; }
.table-modern tbody tr:hover { background: #f9fafb; }

.table-modern tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
    color: #374151;
}

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

.table-modern .name-cell {
    font-weight: 500;
    color: #111827;
}

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

.table-user img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
}

/* ===== BADGES ===== */
.badge {
    font-weight: 500;
    padding: 6px 12px;
}

.badge-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    display: inline-block;
}

.badge-status.active { background: #ecfdf5; color: #059669; }
.badge-status.pending { background: #fffbeb; color: #d97706; }
.badge-status.cancelled { background: #fef2f2; color: #dc2626; }
.badge-status.confirmed { background: #eef2ff; color: var(--primary-light); }

/* ===== ACTIVITY LIST ===== */
.activity-list { display: flex; flex-direction: column; gap: 0; }

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid #f9fafb;
}

.activity-item:last-child { border-bottom: none; padding-bottom: 0; }

.activity-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.activity-content p { font-size: 13px; color: #374151; margin: 0; }
.activity-time { font-size: 12px; color: #9ca3af; }

/* ===== DEPARTMENT LIST ===== */
.dept-list { display: flex; flex-direction: column; gap: 16px; }

.dept-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.dept-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dept-name { font-size: 13px; font-weight: 500; color: #374151; }

.dept-stats { display: flex; align-items: center; gap: 10px; }
.dept-count { font-size: 14px; font-weight: 600; color: #111827; }
.dept-percent { font-size: 12px; color: #9ca3af; }

/* ===== CHART BARS ===== */
.chart-container { padding: 8px 0; }

.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 200px;
}

.chart-bar {
    flex: 1;
    background: linear-gradient(to top, var(--primary), var(--primary-light));
    border-radius: 4px 4px 0 0;
    transition: height 0.3s;
    min-height: 8px;
    opacity: 0.85;
}

.chart-bar:hover { opacity: 1; }

.chart-months {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 11px;
    color: #9ca3af;
}

/* ===== TOPBAR ===== */
.topbar {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 64px;
    position: sticky;
    top: 0;
    z-index: 999;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-btn {
    width: 38px;
    height: 38px;
    border: none;
    background: transparent;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    font-size: 18px;
    cursor: pointer;
    position: relative;
    transition: background 0.2s;
}

.topbar-btn:hover { background: #f3f4f6; color: var(--primary); }

.notif-dot {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 7px;
    height: 7px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid #fff;
}

.notif-count {
    position: absolute;
    top: 3px;
    right: 3px;
    font-size: 9px;
    font-weight: 700;
    color: #fff;
    background: #ef4444;
    min-width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 2px solid #fff;
}

.topbar-divider {
    width: 1px;
    height: 24px;
    background: #e5e7eb;
    margin: 0 4px;
}

.profile-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 4px 4px;
    border: none;
    background: transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
}

.profile-btn:hover { background: #f3f4f6; }

.profile-btn img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
}

.profile-btn .p-name {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
}

.profile-btn .p-role {
    font-size: 11px;
    color: #9ca3af;
    display: block;
    margin-top: -1px;
}

.profile-btn .p-arrow {
    font-size: 11px;
    color: #9ca3af;
}

.dropdown-menu {
    border: none;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    border-radius: 12px;
    padding: 6px;
    min-width: 200px;
}

.dropdown-item {
    padding: 9px 14px;
    border-radius: 8px;
    font-size: 13px;
    transition: background 0.15s;
}

.dropdown-item:hover { background: #f3f4f6; }
.dropdown-item.text-danger:hover { background: #fef2f2; }
.dropdown-divider { margin: 4px 0; }

/* ===== CARD ACTIONS ===== */
.card-actions {
    display: flex;
    gap: 6px;
}

.card-actions .badge {
    font-size: 12px;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.card-actions .badge:hover { transform: translateY(-1px); }
.card-actions .badge.bg-primary { background: var(--primary) !important; }

/* ===== RESPONSIVE ===== */
@media (max-width: 991.98px) {
    .sidebar {
        margin-left: calc(-1 * var(--sidebar-width));
    }
    .sidebar.toggled {
        margin-left: 0;
    }
    #page-content-wrapper {
        margin-left: 0 !important;
    }
    .stat-card .stat-value { font-size: 24px; }
}

@media (max-width: 767.98px) {
    .page-content { padding: 20px 16px; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .topbar { padding: 0 16px; }
}

/* ===== CARD LINK ===== */
.card-link {
    font-size: 13px;
    color: var(--primary-light);
    text-decoration: none;
    font-weight: 500;
}

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

/* ===== REALTIME VALIDATION ===== */
.validation-summary {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 13px;
    color: #dc2626;
    margin-bottom: 20px;
}

.text-danger {
    font-size: 12px;
    margin-top: 4px;
    display: block;
}
