/* ============================================================
   IMPORT FONT JOSEFIN SANS
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Lexend:wght@300;400;500;600;700&display=swap');

/* ============================================================
   CSS VARIABLES — LIGHT THEME
   Bảng màu: Tím (primary) + Teal (tài chính) + Vàng Gold (highlight)
   ============================================================ */
:root {
    /* ── Tím — màu chủ đạo ── */
    --primary:          #6C63FF;
    --primary-dark:     #4B44CC;
    --primary-light:    #EAE9FF;
    --primary-glow:     rgba(108, 99, 255, 0.22);
    --indigo:           #4F46E5;
    --indigo-dark:      #3730A3;
    --purple:           #7C3AED;
    --violet:           #8B5CF6;

    /* ── Teal — màu tài chính / lương ── */
    --teal:             #0D9488;
    --teal-dark:        #0F766E;
    --teal-light:       #CCFBF1;
    --teal-glow:        rgba(13, 148, 136, 0.22);
    --teal-mid:         #14B8A6;
    --teal-bright:      #6EE7B7;

    /* ── Vàng Gold — cảnh báo / highlight ── */
    --gold:             #F59E0B;
    --gold-dark:        #D97706;
    --gold-light:       #FEF3C7;
    --gold-glow:        rgba(245, 158, 11, 0.22);
    --gold-bright:      #FBBF24;

    /* ── Semantic ── */
    --success:          #10B981;
    --success-light:    #D1FAE5;
    --warning:          #F59E0B;
    --warning-light:    #FEF3C7;
    --danger:           #EF4444;
    --danger-light:     #FEE2E2;
    --info:             #3B82F6;
    --info-light:       #DBEAFE;

    /* ── Surfaces ── */
    --bg-body:          #F4F3FF;
    --bg-sidebar:       #1E1B4B;
    --bg-card:          #FFFFFF;
    --bg-input:         #FFFFFF;
    --bg-hover:         #EEEDFF;
    --bg-hover-teal:    #F0FDFB;
    --bg-table-head:    #F8F7FF;
    --bg-table-alt:     #FDFCFF;

    /* ── Text ── */
    --text-primary:     #1C1845;
    --text-secondary:   #6B7280;
    --text-muted:       #9CA3AF;
    --text-sidebar:     #C7D2FE;
    --text-on-primary:  #FFFFFF;

    /* ── Borders ── */
    --border:           #E5E3FF;
    --border-strong:    #C4C0FF;
    --border-teal:      #99F6E4;

    /* ── Shadows ── */
    --shadow-sm:        0 1px 3px rgba(108,99,255,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:        0 4px 16px rgba(108,99,255,0.12), 0 2px 6px rgba(0,0,0,0.06);
    --shadow-lg:        0 10px 40px rgba(108,99,255,0.16), 0 4px 12px rgba(0,0,0,0.08);
    --shadow-card:      0 2px 12px rgba(108,99,255,0.08);
    --shadow-teal:      0 4px 16px rgba(13,148,136,0.18);
    --shadow-gold:      0 4px 16px rgba(245,158,11,0.18);

    /* ── Layout ── */
    --sidebar-width:    260px;
    --navbar-height:    64px;
    --border-radius:    12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;

    --transition:       all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast:  all 0.15s ease;
}

/* ============================================================
   CSS VARIABLES — DARK THEME
   ============================================================ */
[data-theme="dark"] {
    --bg-body:          #0D0C1A;
    --bg-sidebar:       #1E1B4B;
    --bg-card:          #171530;
    --bg-input:         #171530;
    --bg-hover:         #211F3A;
    --bg-hover-teal:    #0C1F1E;
    --bg-table-head:    #1B1935;
    --bg-table-alt:     #191730;

    --text-primary:     #EDE9FE;
    --text-secondary:   #A5B4FC;
    --text-muted:       #6D6A8A;
    --text-sidebar:     #C4B5FD;

    --border:           #2A2848;
    --border-strong:    #4C4880;
    --border-teal:      #134E4A;

    --teal-light:       #0D2926;
    --gold-light:       #1C1200;
    --primary-light:    #1C1A38;
    --success-light:    #052E1C;
    --danger-light:     #1F0808;
    --info-light:       #0C1A3A;
    --warning-light:    #1C1200;

    --shadow-sm:        0 1px 3px rgba(0,0,0,0.35);
    --shadow-md:        0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg:        0 10px 40px rgba(0,0,0,0.5);
    --shadow-card:      0 2px 12px rgba(0,0,0,0.3);

    --primary-light:    #1E1C3A;
    --success-light:    #052E1C;
    --warning-light:    #1C1400;
    --danger-light:     #1F0808;
    --info-light:       #0C1A3A;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Lexend', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    background-color: var(--bg-body);
    transition:  none;
    overflow-x: hidden;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: var(--transition);
    box-shadow: 4px 0 24px rgba(0,0,0,0.15);
    overflow: hidden;
}

/* ============================================================
   GIỮ NGUYÊN TÊN BIẾN/CLASS CŨ - CHỈ CẬP NHẬT GIAO DIỆN TRÒN 
   ============================================================ */
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.sidebar-logo:hover {
    opacity: 0.85;
}

/* Khung chứa ảnh */
.sidebar-logo-avatar {
    width: 44px;
    height: 44px;
    position: relative;
    flex-shrink: 0;
}

/* Xử lý ảnh thật thành hình tròn hoàn hảo, không bị méo */
.sidebar-logo-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover; /* Giúp ảnh tỷ lệ nào cũng không bị méo khi vào hình tròn */
    border: 2px solid var(--teal-mid, #0D9488);
    box-shadow: 0 2px 6px var(--teal-glow, rgba(13, 148, 136, 0.2));
}

/* Fallback chữ phòng trường hợp ảnh lỗi */
.sidebar-logo-avatar-fallback {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--teal-light);
    color: var(--teal-dark);
    font-weight: 600;
    font-size: 13px;
    display: none;
    align-items: center;
    justify-content: center;
}

.sidebar-logo-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.sidebar-logo-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
}

/* Hiệu ứng glow nhẹ cho logo, tạo chiều sâu và nổi bật hơn trên nền tối của sidebar*/
.sidebar-logo::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(
            circle at top left,
            rgba(20,184,166,0.15),
            transparent 45%
        );
    pointer-events: none;
}

/* AOF — gradient teal */
.logo-aof {
    background: linear-gradient(90deg, #0D9488, #14B8A6, #6EE7B7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* SALARY — trắng nhạt */
.logo-salary {
    color: #E0E7FF;
    font-weight: 600;
    /* letter-spacing: 2px; */
    font-size: 19px;
}


/* Divider dưới tên Logo — Chuyển hẳn sang tone Teal và thêm khoảng cách */
.sidebar-logo-divider {
    height: 1px;
    background: linear-gradient(
    90deg,
    #0D9488 0%,
    #5bb814 50%,
    #eef139  100%
    );
    /* margin: 2px 0 2px 0; /* Thêm margin trên dưới để không bị dính sát vào chữ */
    opacity: 0.6;
    width: 100%;
}

.sidebar-logo-sub {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

/* Nav */
.sidebar-nav {
    flex: 1;
    overflow: hidden;
    padding: 8px 0 0 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

.nav-section-title {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--text-sidebar);
    opacity: 0.45;
    padding: 10px 24px 4px;
    white-space: nowrap;
}

.nav-item { margin: 1px 12px; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--border-radius-sm);
    color: var(--text-sidebar);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    opacity: 0.85;
    white-space: nowrap;
}

.nav-link:hover {
    background: rgba(255,255,255,0.08);
    color: #FFFFFF;
    opacity: 1;
    transform: translateX(3px);
}

.nav-link.active {
    background: linear-gradient(135deg, var(--primary), var(--indigo));
    color: #FFFFFF;
    opacity: 1;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    right: -12px; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 60%;
    background: var(--primary);
    border-radius: 3px 0 0 3px;
}

.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px; height: 22px;
    flex-shrink: 0;
}

.nav-icon svg {
    width: 18px; height: 18px;
    display: block;
    stroke: var(--text-sidebar);
    fill: none;
    stroke-width: 1.75;
    flex-shrink: 0;
    transition: var(--transition);
}

.nav-link:hover .nav-icon svg { stroke: #ffffff; }
.nav-link.active .nav-icon svg { stroke: #ffffff; }

.nav-label { flex: 1; }

.nav-badge {
    margin-left: auto;
    background: var(--primary);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    min-width: 20px;
    text-align: center;
}

/* Sidebar footer */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
    position: relative;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.sidebar-user:hover { background: rgba(255,255,255,0.07); }

.user-avatar {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--purple));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: #FFFFFF;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 11px;
    color: var(--text-sidebar);
    opacity: 0.6;
}

/* ── MAIN CONTENT ── */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: var(--transition);
}

/* ── NAVBAR TOP ── */
.navbar-top {
    height: var(--navbar-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
    transition: background 0.3s, border 0.3s;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

/*breadcrumb-nav đã bỏ nên kcan*/

.page-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.2px;
}

.breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.breadcrumb-nav a {
    color: var(--primary);
    text-decoration: none;
}
.breadcrumb-nav a:hover { text-decoration: underline; }

.navbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    width: 38px; height: 38px;
    border: none;
    border-radius: var(--border-radius-sm);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
    position: relative;
}

/* THÊM MỚI ĐOẠN NÀY ĐỂ ẨN NÚT TRÊN DESKTOP */
#sidebarToggle {
    display: none; 
}

.icon-btn svg {
    width: 20px; height: 20px;
    stroke: currentColor; fill: none;
    stroke-width: 1.75;
}

.icon-btn:hover {
    background: var(--bg-hover);
    color: var(--primary);
}

/* Navbar search */
.navbar-search {
    position: relative;
    display: flex;
    align-items: center;
}

.navbar-search input {
    width: 220px;
    padding: 8px 14px 8px 36px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--bg-body);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: var(--transition);
}

.navbar-search input:focus {
    width: 280px;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: var(--bg-card);
}

.navbar-search input::placeholder { color: var(--text-muted); }

.navbar-search-icon {
    position: absolute;
    left: 11px;
    color: var(--text-muted);
    pointer-events: none;
    display: flex; align-items: center;
}

.navbar-search-icon svg {
    width: 15px; height: 15px;
    stroke: currentColor; fill: none;
    stroke-width: 2;
}

/* Theme toggle */
.theme-toggle {
    width: 52px; height: 28px;
    background: var(--border);
    border-radius: 20px;
    border: none;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
    flex-shrink: 0;
}

.theme-toggle::after {
    content: '☀️';
    position: absolute;
    left: 3px; top: 3px;
    width: 22px; height: 22px;
    background: white;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px;
    transition: var(--transition);
    line-height: 22px;
    text-align: center;
}

[data-theme="dark"] .theme-toggle { background: var(--primary); }
[data-theme="dark"] .theme-toggle::after {
    content: '🌙';
    transform: translateX(24px);
}

/* Notification badge */
.notif-badge {
    position: absolute;
    top: 6px; right: 6px;
    width: 8px; height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--bg-card);
}

/* Dropdown */
.dropdown { position: relative; }

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    z-index: 500;
    display: none;
    overflow: hidden;
    animation: fadeInUp 0.2s ease;
}

.dropdown-menu.show { display: block; }

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 14px;
    color: var(--text-primary);
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition-fast);
    border: none;
    background: none;
    width: 100%;
    font-family: inherit;
    font-weight: 500;
}

.dropdown-item svg {
    width: 15px; height: 15px;
    stroke: currentColor; fill: none;
    stroke-width: 1.75; flex-shrink: 0;
}

.dropdown-item:hover { background: var(--bg-hover); color: var(--primary); }
.dropdown-item.danger:hover { background: var(--danger-light); color: var(--danger); }

.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ── PAGE BODY ── */
.page-body {
    flex: 1;
    padding: 28px;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

.page-header-left h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.2px;
    line-height: 1.2;
}

.page-header-left p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.page-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    transition: var(--transition);
    overflow: hidden;
}

.card:hover { box-shadow: var(--shadow-md); }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px 14px;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title svg {
    width: 17px; height: 17px;
    stroke: var(--primary); fill: none;
    stroke-width: 2;
}

.card-body { padding: 20px 22px; }

/* Stat Cards */
.stat-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border);
    padding: 22px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: var(--transition);
    cursor: default;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.stat-card.purple::before { background: linear-gradient(90deg, var(--primary), var(--purple)); }
.stat-card.indigo::before { background: linear-gradient(90deg, var(--indigo), var(--primary)); }
.stat-card.green::before  { background: linear-gradient(90deg, var(--success), #059669); }
.stat-card.orange::before { background: linear-gradient(90deg, var(--warning), #D97706); }

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 52px; height: 52px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 24px; height: 24px;
    fill: none; stroke-width: 1.75;
}

.stat-icon.purple { background: var(--primary-light); }
.stat-icon.purple svg { stroke: var(--primary); }
.stat-icon.indigo { background: #EEF2FF; }
.stat-icon.indigo svg { stroke: var(--indigo); }
.stat-icon.green  { background: var(--success-light); }
.stat-icon.green svg  { stroke: var(--success); }
.stat-icon.orange { background: var(--warning-light); }
.stat-icon.orange svg { stroke: var(--warning); }

[data-theme="dark"] .stat-icon.indigo { background: #1E1C3A; }

.stat-info { flex: 1; }

.stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
    letter-spacing: 0.2px;
}

.stat-change {
    font-size: 12px;
    font-weight: 600;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 3px;
}

.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--border-radius);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th {
    background: var(--bg-table-head);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table td {
    padding: 13px 16px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    transition: background 0.15s;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:nth-child(even) td { background: var(--bg-table-alt); }
.table tbody tr:hover td { background: var(--bg-hover); }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success { background: var(--success-light); color: #065F46; }
.badge-warning { background: var(--warning-light); color: #92400E; }
.badge-danger  { background: var(--danger-light);  color: #991B1B; }
.badge-info    { background: var(--info-light);    color: #1E40AF; }
.badge-purple  { background: var(--primary-light); color: var(--primary-dark); }

[data-theme="dark"] .badge-success { color: #6EE7B7; }
[data-theme="dark"] .badge-warning { color: #FCD34D; }
[data-theme="dark"] .badge-danger  { color: #FCA5A5; }
[data-theme="dark"] .badge-info    { color: #93C5FD; }
[data-theme="dark"] .badge-purple  { color: #C4B5FD; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: var(--border-radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
}

.btn svg {
    width: 16px; height: 16px;
    stroke: currentColor; fill: none;
    stroke-width: 2; flex-shrink: 0;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--indigo));
    color: white;
    border-color: var(--primary);
    box-shadow: 0 2px 8px var(--primary-glow);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--primary-glow);
    color: white;
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--border-strong);
}
.btn-outline:hover { background: var(--primary-light); border-color: var(--primary); }

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
}
.btn-success:hover { transform: translateY(-1px); color: white; }

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #DC2626);
    color: white;
}
.btn-danger:hover { transform: translateY(-1px); color: white; }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-sm { padding: 6px 13px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-icon { padding: 9px; width: 38px; height: 38px; justify-content: center; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 18px; }

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 7px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control { cursor: pointer; }

/* ============================================================
   AVATAR
   ============================================================ */
.avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--purple));
    color: white;
    display: inline-flex;
    align-items: center; justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    letter-spacing: 0.5px;
}

.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 48px; height: 48px; font-size: 18px; }

/* ============================================================
   GRID
   ============================================================ */
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }

@media (max-width: 1200px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px)  { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }

/* ============================================================
   UTILITIES
   ============================================================ */
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 20px; }
.mt-4 { margin-top: 28px; }
.mb-2 { margin-bottom: 12px; }
.mb-3 { margin-bottom: 20px; }
.mb-4 { margin-bottom: 28px; }
.gap-2 { gap: 10px; }
.gap-3 { gap: 16px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.text-muted { color: var(--text-muted); font-size: 13px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.w-100 { width: 100%; }

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes spin { to { transform: rotate(360deg); } }

.fade-in-up { animation: fadeInUp 0.4s ease both; }
.fade-in    { animation: fadeIn 0.3s ease both; }
.delay-1 { animation-delay: 0.05s; }
.delay-2 { animation-delay: 0.10s; }
.delay-3 { animation-delay: 0.15s; }
.delay-4 { animation-delay: 0.20s; }

/* ============================================================
   TOAST
   ============================================================ */
.toast-container {
    position: fixed;
    bottom: 24px; right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--primary);
    min-width: 280px; max-width: 360px;
    animation: fadeInUp 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.toast.success { border-color: var(--success); }
.toast.error   { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }

/* ============================================================
   SPINNER
   ============================================================ */
.spinner {
    width: 20px; height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 56px; height: 56px;
    stroke: var(--border-strong); fill: none;
    margin-bottom: 16px; opacity: 0.6;
}

.empty-state-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state-text { font-size: 14px; }

/* ============================================================
   MOBILE
   ============================================================ */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.show { display: block; }

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .navbar-top { padding: 0 16px; }
    .page-body  { padding: 16px; }

    .navbar-search input { width: 160px; }
    .navbar-search input:focus { width: 200px; }
}

@media (max-width: 480px) {
    .page-title { font-size: 15px; }
    .page-header { flex-direction: column; }
    .navbar-search { display: none; }
}

/* ============================================================
   ALERT AUTO-DISMISS
   ============================================================ */
.alert-auto-dismiss {
    margin: 16px 28px 0;
    padding: 12px 18px;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-auto-dismiss svg {
    width: 16px; height: 16px;
    stroke: currentColor; fill: none;
    stroke-width: 2; flex-shrink: 0;
}
/* ============================================================
   TEAL & GOLD — Stat card variants + Badge + Button
   ============================================================ */

/* Stat card teal */
.stat-card.teal::before  { background: linear-gradient(90deg, var(--teal), var(--teal-mid)); }
.stat-icon.teal          { background: var(--teal-light); }
.stat-icon.teal svg      { stroke: var(--teal); }

/* Stat card gold */
.stat-card.gold::before  { background: linear-gradient(90deg, var(--gold), var(--gold-bright)); }
.stat-icon.gold          { background: var(--gold-light); }
.stat-icon.gold svg      { stroke: var(--gold-dark); }

/* Badge teal */
.badge-teal {
    background: var(--teal-light);
    color: var(--teal-dark);
}
[data-theme="dark"] .badge-teal { color: var(--teal-bright); }

/* Badge gold */
.badge-gold {
    background: var(--gold-light);
    color: var(--gold-dark);
}
[data-theme="dark"] .badge-gold { color: var(--gold-bright); }

/* Button teal */
.btn-teal {
    background: linear-gradient(135deg, var(--teal), var(--teal-dark));
    color: white;
    box-shadow: 0 2px 8px var(--teal-glow);
}
.btn-teal:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-teal);
    color: white;
}

/* Button gold */
.btn-gold {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: white;
    box-shadow: 0 2px 8px var(--gold-glow);
}
.btn-gold:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-gold);
    color: white;
}

/* Text accent colors */
.text-teal  { color: var(--teal); }
.text-gold  { color: var(--gold-dark); }
.text-primary-color { color: var(--primary); }

/* Amount / currency — dùng teal cho số tiền */
.amount {
    color: var(--teal-dark);
    font-weight: 700;
}
[data-theme="dark"] .amount { color: var(--teal-bright); }

/* Highlight row teal khi hover bảng lương */
.table tbody tr.highlight-teal td { background: var(--teal-light) !important; }
[data-theme="dark"] .table tbody tr.highlight-teal td { background: var(--teal-light) !important; }

/* Card accent border variants */
.card.accent-teal { border-top: 3px solid var(--teal); }
.card.accent-gold { border-top: 3px solid var(--gold); }
.card.accent-purple { border-top: 3px solid var(--primary); }

/* Gradient text utility */
.gradient-teal {
    background: linear-gradient(90deg, var(--teal), var(--teal-mid), var(--teal-bright));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gradient-gold {
    background: linear-gradient(90deg, var(--gold-dark), var(--gold), var(--gold-bright));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Nav active teal variant (dùng cho trang lương) */
.nav-link.active-teal {
    background: linear-gradient(135deg, var(--teal), var(--teal-dark));
    color: #FFFFFF;
    box-shadow: 0 4px 12px var(--teal-glow);
}

/* Divider gradient 3 màu */
.divider-brand {
    height: 1px;
    background: linear-gradient(90deg, var(--primary), var(--teal), var(--gold));
    opacity: 0.4;
    border: none;
    margin: 16px 0;
}

/* ============================================================
   XỬ LÝ ĐÁP ỨNG (RESPONSIVE) CHO MÀN HÌNH DI ĐỘNG
   ============================================================ */
@media (max-width: 768px) {
    /* Hiện lại nút bấm mở Menu trên điện thoại */
    #sidebarToggle {
        display: flex !important;
    }
}

/* Đồng bộ transition theme cho tất cả elements */
html[data-theme] *,
html[data-theme] *::before,
html[data-theme] *::after {
    transition:
        background-color 0.3s ease,
        border-color 0.3s ease,
        color 0.3s ease,
        box-shadow 0.3s ease !important;
}