/* ===================================
   ระบบรายงานปฏิบัติงานรายวัน
   Design: Refined Modern Thai
   =================================== */

:root {
    --primary: #1e3a5f;
    --primary-light: #2d5282;
    --primary-pale: #ebf0f8;
    --accent: #e8954a;
    --accent-light: #f5b97e;
    --accent-pale: #fef3e8;
    --success: #2d9e6b;
    --success-pale: #e8f5ee;
    --danger: #d94f4f;
    --danger-pale: #fdeaea;
    --warning: #d4941a;
    --warning-pale: #fdf3e0;
    --info: #2980b9;
    --info-pale: #e8f4fc;

    --bg-body: #f0f4f8;
    --bg-card: #ffffff;
    --bg-sidebar: #1a2f4e;
    --bg-sidebar-dark: #132340;

    --text-primary: #1a2633;
    --text-secondary: #5a7184;
    --text-muted: #8fa3b4;
    --text-white: #ffffff;

    --border: #dce6ef;
    --border-light: #edf2f7;

    --sidebar-width: 260px;
    --topbar-height: 64px;

    --shadow-sm: 0 1px 4px rgba(30,58,95,0.08);
    --shadow-md: 0 4px 16px rgba(30,58,95,0.12);
    --shadow-lg: 0 8px 32px rgba(30,58,95,0.16);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --font-main: 'Noto Sans Thai', 'Sarabun', sans-serif;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===================================
   Base
   =================================== */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-main);
    background: var(--bg-body);
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Layout หลัก (มี sidebar) */
body.user-layout,
body.admin-layout {
    display: flex;
}

/* หน้า login ไม่มี sidebar */
body:not(.user-layout):not(.admin-layout) {
    display: block;
    background: #132340;
}

/* ===================================
   Sidebar
   =================================== */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: var(--transition);
    overflow: hidden;
}

.sidebar-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 42px; height: 42px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: white;
    font-size: 20px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(232,149,74,0.4);
}

.logo-title {
    display: block;
    color: white;
    font-weight: 700;
    font-size: 13px;
    line-height: 1.3;
    letter-spacing: 0.3px;
}

.logo-sub {
    display: block;
    color: rgba(255,255,255,0.5);
    font-size: 11px;
    margin-top: 2px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}

.sidebar-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.2);
    flex-shrink: 0;
}

.sidebar-user-name {
    color: white;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.badge-role {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
    margin-top: 3px;
}
.badge-role.superadmin { background: rgba(232,149,74,0.25); color: var(--accent-light); }
.badge-role.admin { background: rgba(41,128,185,0.25); color: #7ec8e3; }
.badge-role.user { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.7); }

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

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

.nav-section-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.3);
    padding: 12px 12px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 2px;
    position: relative;
}

.nav-item:hover {
    background: rgba(255,255,255,0.08);
    color: white;
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(232,149,74,0.2), rgba(232,149,74,0.1));
    color: var(--accent-light);
    border-left: 3px solid var(--accent);
    padding-left: 9px;
}

.nav-item i { font-size: 17px; flex-shrink: 0; width: 20px; text-align: center; }

.nav-divider {
    border-top: 1px solid rgba(255,255,255,0.06);
    margin: 10px 12px;
}

.nav-logout:hover {
    background: rgba(217,79,79,0.15);
    color: #ff8080;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

/* ===================================
   Main Layout
   =================================== */
.main-wrapper {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: var(--transition);
}

/* ===================================
   Topbar
   =================================== */
.topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.topbar-left, .topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-sidebar-toggle {
    background: none;
    border: none;
    width: 38px; height: 38px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 22px;
    transition: var(--transition);
}
.btn-sidebar-toggle:hover { background: var(--bg-body); color: var(--primary); }

.topbar-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.topbar-date {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    background: var(--bg-body);
    padding: 6px 14px;
    border-radius: 20px;
}
.topbar-date i { color: var(--primary); }

.btn-user-menu {
    background: none;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 5px 12px 5px 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}
.btn-user-menu:hover { background: var(--bg-body); border-color: var(--primary); }
.btn-user-menu i.bi-chevron-down { font-size: 11px; color: var(--text-muted); }

.topbar-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
}

/* ===================================
   Page Content
   =================================== */
.page-content {
    flex: 1;
    padding: 24px;
}

/* ===================================
   Flash Messages
   =================================== */
.flash-container {
    padding: 16px 24px 0;
}
.flash-alert {
    border-radius: var(--radius-md);
    border: none;
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
}

/* ===================================
   Cards
   =================================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-light);
    background: transparent;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.card-title i { color: var(--primary); font-size: 18px; }
.card-body { padding: 24px; }

/* ===================================
   Stat Cards (Dashboard)
   =================================== */
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
}
.stat-card.primary::before { background: var(--primary); }
.stat-card.accent::before { background: var(--accent); }
.stat-card.success::before { background: var(--success); }
.stat-card.info::before { background: var(--info); }
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat-icon {
    width: 56px; height: 56px;
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}
.stat-card.primary .stat-icon { background: var(--primary-pale); color: var(--primary); }
.stat-card.accent .stat-icon { background: var(--accent-pale); color: var(--accent); }
.stat-card.success .stat-icon { background: var(--success-pale); color: var(--success); }
.stat-card.info .stat-icon { background: var(--info-pale); color: var(--info); }

.stat-number {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ===================================
   Buttons
   =================================== */
.btn {
    font-family: var(--font-main);
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    font-size: 14px;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}
.btn-primary:hover { background: var(--primary-light); border-color: var(--primary-light); }

.btn-accent {
    background: var(--accent);
    border: none;
    color: white;
    box-shadow: 0 4px 14px rgba(232,149,74,0.35);
}
.btn-accent:hover { background: #d4843b; color: white; box-shadow: 0 6px 18px rgba(232,149,74,0.45); transform: translateY(-1px); }

.btn-success { background: var(--success); border-color: var(--success); color: white; }
.btn-success:hover { background: #25875b; border-color: #25875b; }

.btn-outline-primary {
    border-color: var(--primary);
    color: var(--primary);
}
.btn-outline-primary:hover { background: var(--primary); color: white; }

.btn-icon {
    width: 36px; height: 36px;
    padding: 0;
    justify-content: center;
    border-radius: var(--radius-sm);
}

/* ===================================
   Forms
   =================================== */
.form-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
    margin-bottom: 6px;
}

.form-control, .form-select {
    font-family: var(--font-main);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 14px;
    color: var(--text-primary);
    transition: var(--transition);
    background: var(--bg-card);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30,58,95,0.1);
    outline: none;
}

textarea.form-control { resize: vertical; min-height: 120px; }

.input-group-text {
    background: var(--bg-body);
    border: 1.5px solid var(--border);
    color: var(--text-secondary);
}

/* Password eye toggle */
.password-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-muted);
    z-index: 10;
    transition: color 0.2s;
    font-size: 16px;
}

.password-toggle:hover {
    color: var(--primary);
}

/* Required asterisk */
.required::after {
    content: ' *';
    color: var(--danger);
}

/* ===================================
   Image Upload Zone
   =================================== */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-body);
    position: relative;
}

.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-pale);
}

.upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%; height: 100%;
}

.upload-icon {
    width: 64px; height: 64px;
    background: var(--primary-pale);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px;
    color: var(--primary);
    font-size: 28px;
}

.upload-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.upload-sub {
    font-size: 13px;
    color: var(--text-muted);
}

.upload-req {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--accent-pale);
    color: var(--accent);
    border: 1px solid rgba(232,149,74,0.3);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 12px;
}

/* Image Preview Grid */
.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.preview-item {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    aspect-ratio: 1;
    background: var(--bg-body);
    border: 2px solid var(--border);
}

.preview-item img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.preview-item:hover img { opacity: 0.85; }

.preview-remove {
    position: absolute;
    top: 6px; right: 6px;
    width: 26px; height: 26px;
    background: rgba(217,79,79,0.9);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 13px;
    transition: var(--transition);
}
.preview-remove:hover { background: var(--danger); transform: scale(1.1); }

.preview-num {
    position: absolute;
    bottom: 6px; left: 6px;
    background: rgba(0,0,0,0.6);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
}

.image-counter {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    margin-top: 10px;
}

.counter-bar {
    flex: 1;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.counter-fill {
    height: 100%;
    border-radius: 3px;
    transition: var(--transition);
}

/* ===================================
   Tables
   =================================== */
.table-responsive {
    border-radius: var(--radius-md);
    overflow: hidden;
}

.table {
    font-size: 14px;
    margin: 0;
}

.table thead tr {
    background: var(--primary);
    color: white;
}

.table thead th {
    padding: 14px 16px;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.3px;
    border: none;
    white-space: nowrap;
}

.table tbody tr {
    transition: var(--transition);
    border-bottom: 1px solid var(--border-light);
}

.table tbody tr:hover { background: var(--primary-pale); }

.table tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    border: none;
}

/* ===================================
   Badges
   =================================== */
.badge {
    font-family: var(--font-main);
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
}

/* ===================================
   Report Card
   =================================== */
.report-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.report-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.report-card-date {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.report-card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 4px 0 8px;
    line-height: 1.4;
}

.report-card-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.report-thumb-row {
    display: flex;
    gap: 6px;
    margin-top: 14px;
}

.report-thumb {
    width: 56px; height: 56px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 2px solid var(--border-light);
}

.report-thumb-more {
    width: 56px; height: 56px;
    border-radius: var(--radius-sm);
    background: var(--bg-body);
    border: 2px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
}

/* ===================================
   Login Page
   =================================== */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-sidebar-dark) 0%, var(--bg-sidebar) 50%, #1e3a5f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -30%; right: -20%;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(232,149,74,0.12) 0%, transparent 70%);
    pointer-events: none;
}

.login-page::after {
    content: '';
    position: absolute;
    bottom: -20%; left: -10%;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(41,128,185,0.1) 0%, transparent 70%);
    pointer-events: none;
}

.login-card {
    background: rgba(255,255,255,0.97);
    border-radius: var(--radius-xl);
    padding: 48px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,0.1);
    position: relative;
    z-index: 1;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo-icon {
    width: 72px; height: 72px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: var(--radius-lg);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px;
    color: white;
    font-size: 32px;
    box-shadow: 0 8px 24px rgba(30,58,95,0.35);
}

.login-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.login-sub {
    font-size: 13px;
    color: var(--text-muted);
}

/* ===================================
   User Avatar in table
   =================================== */
.user-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-cell-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
    flex-shrink: 0;
}

.user-cell-name {
    font-weight: 600;
    font-size: 14px;
}

.user-cell-sub {
    font-size: 12px;
    color: var(--text-muted);
}

/* ===================================
   Pagination
   =================================== */
.pagination {
    gap: 4px;
}

.page-link {
    font-family: var(--font-main);
    border-radius: var(--radius-sm) !important;
    border: 1.5px solid var(--border);
    color: var(--text-primary);
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition);
}

.page-link:hover { background: var(--primary-pale); border-color: var(--primary); color: var(--primary); }
.page-item.active .page-link { background: var(--primary); border-color: var(--primary); }

/* ===================================
   Image Gallery (view report)
   =================================== */
.report-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.gallery-item {
    border-radius: var(--radius-md);
    overflow: hidden;
    aspect-ratio: 4/3;
    cursor: pointer;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
}
.gallery-item * { pointer-events: none; }
.gallery-item { pointer-events: auto; }

.gallery-item img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.gallery-item:hover img { transform: scale(1.04); }

.gallery-item-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0);
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
    color: white;
    font-size: 28px;
}

.gallery-item:hover .gallery-item-overlay { background: rgba(0,0,0,0.3); }

/* ===================================
   Lightbox
   =================================== */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.92);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.lightbox.active { display: flex; }

.lightbox-img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.lightbox-close {
    position: absolute;
    top: 20px; right: 20px;
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    width: 44px; height: 44px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 20px;
    transition: var(--transition);
}

.lightbox-close:hover { background: rgba(255,255,255,0.25); }

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    width: 48px; height: 48px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 22px;
    transition: var(--transition);
}
.lightbox-nav:hover { background: rgba(255,255,255,0.25); }
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }

.lightbox-caption {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.6);
    color: white;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 13px;
    text-align: center;
    white-space: nowrap;
}

/* ===================================
   Footer
   =================================== */
.page-footer {
    border-top: 1px solid var(--border-light);
    padding: 16px 24px;
    background: var(--bg-card);
}

.footer-content {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.footer-divider { color: var(--border); }

/* ===================================
   Admin Dashboard
   =================================== */
.dashboard-welcome {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: var(--radius-xl);
    padding: 32px;
    color: white;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.dashboard-welcome::after {
    content: '\F4C2';
    font-family: 'bootstrap-icons';
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 100px;
    opacity: 0.08;
}

.welcome-title {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 6px;
}

.welcome-sub { font-size: 14px; opacity: 0.8; }

/* ===================================
   Filter/Search Bar
   =================================== */
.filter-bar {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 20px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-bar .form-control,
.filter-bar .form-select {
    font-size: 13px;
    padding: 8px 12px;
}

/* ===================================
   Profile Image Upload
   =================================== */
.profile-upload-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.profile-preview {
    width: 120px; height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--border);
    box-shadow: var(--shadow-md);
}

.profile-upload-btn {
    position: relative;
    overflow: hidden;
    display: inline-block;
}

.profile-upload-btn input {
    position: absolute;
    opacity: 0;
    width: 100%; height: 100%;
    cursor: pointer;
}

/* ===================================
   Page Header
   =================================== */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0;
}

.page-header-sub {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ===================================
   Empty State
   =================================== */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 64px;
    opacity: 0.3;
    display: block;
    margin-bottom: 16px;
}

.empty-state-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* ===================================
   Permission Toggle (settings)
   =================================== */
.form-switch .form-check-input {
    width: 44px;
    height: 24px;
    cursor: pointer;
}
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }

/* ===================================
   Responsive
   =================================== */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-overlay.active {
        display: block;
    }
    .main-wrapper {
        margin-left: 0;
    }
}

@media (max-width: 576px) {
    .page-content { padding: 16px; }
    .topbar { padding: 0 16px; }
    .login-card { padding: 32px 24px; }
    .stat-card { padding: 16px; }
    .stat-number { font-size: 24px; }
}

/* ===================================
   Animations
   =================================== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-in {
    animation: fadeInUp 0.4s ease forwards;
}

.animate-in:nth-child(1) { animation-delay: 0.05s; }
.animate-in:nth-child(2) { animation-delay: 0.10s; }
.animate-in:nth-child(3) { animation-delay: 0.15s; }
.animate-in:nth-child(4) { animation-delay: 0.20s; }

/* Loading spinner */
.spinner-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.8);
    z-index: 9998;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
}
.spinner-overlay.active { display: flex; }
