/* ========================================
   TCE HRM - Global Styles
   Premium HR Software Design System
   ======================================== */

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

:root {
    --primary: #10b981;
    --primary-dark: #059669;
    --primary-light: #d1fae5;
    --sidebar-bg: #0f2544;
    --sidebar-hover: #1a3a6e;
    --sidebar-active: #1d4a8a;
    --header-bg: #ffffff;
    --body-bg: #f0f4f8;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--body-bg);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ======= APP LAYOUT ======= */
.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ======= SIDEBAR ======= */
.sidebar {
    width: 260px;
    min-width: 260px;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    transition: var(--transition);
    position: relative;
    z-index: 100;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.logo-mark {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary), #34d399);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
    color: white;
    letter-spacing: -0.5px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(16,185,129,0.4);
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-name {
    font-size: 16px;
    font-weight: 700;
    color: white;
    line-height: 1.2;
    letter-spacing: -0.3px;
}

.logo-sub {
    font-size: 10px;
    font-weight: 500;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

/* Sidebar Nav */
.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
    min-height: 0;
}

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

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-md);
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-weight: 500;
    font-size: 13.5px;
    transition: var(--transition);
    position: relative;
}

.sidebar-link:hover {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.9);
}

.sidebar-link.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(16,185,129,0.35);
}

.sidebar-link i {
    width: 18px;
    font-size: 15px;
    flex-shrink: 0;
    text-align: center;
}

.sidebar-link .badge-count {
    margin-left: auto;
    background: rgba(255,255,255,0.15);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 9999px;
}

.sidebar-link.active .badge-count {
    background: rgba(255,255,255,0.3);
}

/* Sidebar Bottom User */
.sidebar-user {
    padding: 16px 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 10px;
}

.logout-btn {
    margin-left: auto;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: rgba(255,255,255,.4);
    text-decoration: none;
    transition: all .2s;
    flex-shrink: 0;
}
.logout-btn:hover {
    background: rgba(231,76,60,.2);
    color: #ff8a8a;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), #34d399);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: white;
    flex-shrink: 0;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,0.85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 11px;
    color: rgba(255,255,255,0.35);
}

/* ======= MAIN AREA ======= */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* ======= HEADER ======= */
.top-header {
    height: 64px;
    min-height: 64px;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 28px;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    z-index: 50;
}

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

.header-subtitle {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
    margin-top: 1px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    position: relative;
}

.header-btn:hover {
    background: var(--body-bg);
    color: var(--primary);
    border-color: var(--primary);
}

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

/* ======= PAGE CONTENT ======= */
.page-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 28px;
    min-width: 0;
}

/* ======= STAT CARDS ======= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 18px;
    transition: var(--transition);
    cursor: pointer;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

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

.stat-icon.green { background: #d1fae5; color: #059669; }
.stat-icon.blue { background: #dbeafe; color: #2563eb; }
.stat-icon.amber { background: #fef3c7; color: #d97706; }
.stat-icon.red { background: #fee2e2; color: #dc2626; }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }

.stat-info { flex: 1; min-width: 0; }
.stat-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
    letter-spacing: -0.5px;
}

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

.stat-change {
    font-size: 11px;
    font-weight: 600;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 3px;
}

.stat-change.up { color: #10b981; }
.stat-change.down { color: #ef4444; }

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

.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.card-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.card-body {
    padding: 24px;
}

/* ======= TABLE ======= */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: #f8fafc;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 11px;
    font-weight: 700;
    padding: 12px 18px;
    text-align: left;
    letter-spacing: 0.06em;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 14px 18px;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-primary);
    vertical-align: middle;
    font-size: 13.5px;
}

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

.data-table tbody tr:hover { background: #fafbff; }

/* ======= BADGES ======= */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-code {
    background: #f1f5f9;
    color: #475569;
    font-family: 'Courier New', monospace;
}

.badge-success { background: #d1fae5; color: #059669; }
.badge-warning { background: #fef3c7; color: #d97706; }
.badge-danger { background: #fee2e2; color: #dc2626; }
.badge-info { background: #dbeafe; color: #2563eb; }
.badge-neutral { background: #f1f5f9; color: #64748b; }

/* ======= BUTTONS ======= */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 10px rgba(16,185,129,0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16,185,129,0.35);
}

.btn-outline {
    background: white;
    color: var(--text-secondary);
    border: 1.5px solid var(--border);
}

.btn-outline:hover {
    background: var(--body-bg);
    border-color: var(--text-muted);
}

.btn-icon-sm {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    font-size: 13px;
}

.btn-icon-edit { background: #eff6ff; color: #3b82f6; }
.btn-icon-edit:hover { background: #dbeafe; }
.btn-icon-delete { background: #fef2f2; color: #ef4444; }
.btn-icon-delete:hover { background: #fee2e2; }
.btn-icon-view { background: #f0fdf4; color: #16a34a; }
.btn-icon-view:hover { background: #dcfce7; }

/* ======= FORM ======= */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-primary);
    background: white;
    transition: var(--transition);
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(16,185,129,0.15);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

/* ======= MODAL ======= */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-box {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 760px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    padding: 24px 28px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--body-bg);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-size: 16px;
}

.modal-close:hover { background: #fee2e2; color: #ef4444; }

.modal-body { padding: 24px 28px; }

.modal-footer {
    padding: 0 28px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ======= SEARCH ======= */
.search-bar {
    position: relative;
}

.search-bar i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}

.search-bar input {
    padding-left: 38px;
    width: 260px;
}

/* ======= FILTER TABS ======= */
.filter-tabs {
    display: flex;
    gap: 6px;
    background: var(--body-bg);
    padding: 4px;
    border-radius: var(--radius-sm);
}

.filter-tab {
    padding: 6px 16px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.filter-tab.active {
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* ======= AVATAR ======= */
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
    color: white;
}

.avatar-green { background: linear-gradient(135deg, #10b981, #34d399); }
.avatar-blue { background: linear-gradient(135deg, #3b82f6, #60a5fa); }
.avatar-purple { background: linear-gradient(135deg, #8b5cf6, #a78bfa); }
.avatar-amber { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.avatar-rose { background: linear-gradient(135deg, #f43f5e, #fb7185); }

/* ======= EMPTY STATE ======= */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    font-size: 52px;
    margin-bottom: 16px;
    opacity: 0.25;
}

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

.empty-desc {
    font-size: 13.5px;
    color: var(--text-muted);
}

/* ======= LOADING ======= */
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-center {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    padding: 60px;
    color: var(--text-muted);
    font-size: 13.5px;
}

/* ======= AI CHAT ======= */
.ai-chat-window {
    height: 450px;
    overflow-y: auto;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    background: #fafbff;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.6;
}

.chat-bubble.user {
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}

.chat-bubble.ai {
    background: white;
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    align-self: flex-start;
}

.chat-sender {
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 4px;
    opacity: 0.65;
}

.chat-input-area {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.chat-input-area input {
    flex: 1;
}

/* ======= DASHBOARD CHARTS ======= */
.chart-placeholder {
    height: 200px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 13.5px;
    font-weight: 600;
    border: 1.5px dashed #86efac;
}

/* ======= RESPONSIVE ======= */
@media (max-width: 1200px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ===== MOBILE APP LAYOUT (≤ 768px) ===== */
@media (max-width: 768px) {

    /* --- Ẩn sidebar trên mobile --- */
    .sidebar { display: none !important; }

    /* --- App layout chiếm toàn màn hình --- */
    .app-layout { flex-direction: column; height: 100dvh; overflow: hidden; }

    .main-area { height: 100dvh; overflow: hidden; }

    /* --- Header gọn hơn trên mobile --- */
    .top-header {
        height: 56px;
        min-height: 56px;
        padding: 0 16px;
        gap: 10px;
        position: sticky;
        top: 0;
        z-index: 200;
        box-shadow: 0 2px 12px rgba(0,0,0,.10);
    }

    .header-title { font-size: 14px; font-weight: 700; }
    .header-subtitle { display: none; }

    /* --- Nội dung cuộn thoải mái, chừa chỗ cho bottom bar --- */
    .page-content {
        flex: 1;
        overflow-y: auto;
        padding: 14px 14px;
        padding-bottom: 80px; /* chừa chỗ bottom nav */
        -webkit-overflow-scrolling: touch;
    }

    /* --- Page header nhỏ hơn --- */
    .page-header {
        flex-wrap: wrap;
        gap: 10px;
        margin-bottom: 16px;
    }

    .page-title { font-size: 18px; }
    .page-desc { font-size: 12px; }

    /* --- Stats grid: 2 cột --- */
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
    .stat-card { padding: 14px 12px; gap: 10px; }
    .stat-icon { width: 40px; height: 40px; font-size: 17px; border-radius: 10px; }
    .stat-value { font-size: 18px; }
    .stat-label { font-size: 11px; }

    /* --- Form grid: 1 cột --- */
    .form-grid, .form-grid-2, .grid-2, .grid-3 { grid-template-columns: 1fr; gap: 12px; }

    /* --- Card padding nhỏ hơn --- */
    .card-body { padding: 14px; }
    .card-header { padding: 12px 16px; }

    /* --- Bảng: scroll ngang --- */
    .data-table { font-size: 12px; }
    .data-table th, .data-table td { padding: 10px 10px; }

    /* --- Modal: full screen trên mobile --- */
    .modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .modal-box {
        border-radius: 20px 20px 0 0;
        max-height: 92dvh;
        max-width: 100%;
        animation: slideUpMobile 0.32s cubic-bezier(0.34,1.56,0.64,1);
    }

    @keyframes slideUpMobile {
        from { transform: translateY(100%); opacity: 0.5; }
        to   { transform: translateY(0);    opacity: 1; }
    }

    .modal-header { padding: 20px 20px 0; }
    .modal-body   { padding: 16px 20px; }
    .modal-footer { padding: 0 20px 20px; }

    /* --- Buttons lớn hơn cho ngón tay --- */
    .btn { padding: 11px 18px; font-size: 14px; min-height: 44px; }

    /* --- Footer ẩn trên mobile --- */
    .page-footer { display: none; }
}

/* Mobile header user - hidden on desktop */
.mobile-header-user { display: none; }

/* ===== BOTTOM NAVIGATION BAR (chỉ mobile) ===== */
.mobile-bottom-nav {
    display: none;
}

@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 300;
        height: 62px;
        background: white;
        border-top: 1px solid #e8ecf0;
        box-shadow: 0 -4px 24px rgba(0,0,0,.10);
        align-items: stretch;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .mobile-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        text-decoration: none;
        color: #94a3b8;
        font-size: 10.5px;
        font-weight: 600;
        transition: all 0.2s ease;
        letter-spacing: 0.2px;
        border: none;
        background: none;
        cursor: pointer;
        padding: 6px 4px;
        position: relative;
        -webkit-tap-highlight-color: transparent;
    }

    .mobile-nav-item i {
        font-size: 20px;
        line-height: 1;
        transition: transform 0.2s ease;
    }

    .mobile-nav-item:hover,
    .mobile-nav-item.active {
        color: #667eea;
    }

    .mobile-nav-item.active i {
        transform: scale(1.1);
    }

    /* Dấu chấm active */
    .mobile-nav-item.active::after {
        content: '';
        position: absolute;
        top: 4px;
        width: 28px;
        height: 3px;
        background: linear-gradient(90deg, #667eea, #764ba2);
        border-radius: 0 0 3px 3px;
        top: 0;
    }

    /* Badge đơn chờ duyệt */
    .mobile-nav-badge {
        position: absolute;
        top: 6px;
        right: calc(50% - 14px);
        width: 16px;
        height: 16px;
        background: #ef4444;
        color: white;
        border-radius: 50%;
        font-size: 9px;
        font-weight: 700;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 2px solid white;
    }

    /* Mobile header avatar */
    .mobile-header-user {
        display: flex;
        align-items: center;
        gap: 8px;
        flex: 1;
        min-width: 0;
    }

    .mobile-header-avatar {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 700;
        font-size: 12px;
        color: white;
        flex-shrink: 0;
    }

    .mobile-header-name {
        font-size: 13px;
        font-weight: 700;
        color: #1e293b;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 130px;
    }

    /* Ẩn header desktop dài dòng trên mobile */
    .top-header .header-title { display: none; }
}

/* ===== ESS page: mobile tweaks ===== */
@media (max-width: 768px) {
    /* Tab bar trong trang ESS: ẩn vì đã có bottom nav */
    .ess-tab-row { display: none !important; }

    /* Modal ESS: full screen từ dưới lên */
    .ess-modal {
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        transform: none !important;
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 20px 20px 0 0 !important;
        max-height: 92dvh;
        animation: essSlideUp 0.3s ease !important;
    }

    @keyframes essSlideUp {
        from { transform: translateY(100%) !important; }
        to   { transform: translateY(0) !important; }
    }

    .ess-modal-body {
        max-height: 70dvh !important;
    }

    /* Đơn từ: card lớn, dễ chạm */
    .ess-request-card {
        border-radius: 14px;
        padding: 16px;
        margin-bottom: 10px;
        font-size: 14px;
    }
}


/* ======= SCROLLBAR ======= */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ======= MISC ======= */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.page-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 3px;
}

.separator { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.mb-20 { margin-bottom: 20px; }

/* ======= SEARCHABLE SELECT ======= */
.searchable-select {
    position: relative;
    width: 100%;
}

.searchable-select-trigger {
    position: relative;
    display: flex;
    align-items: center;
}

.searchable-select-input {
    width: 100%;
    padding: 10px 60px 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    color: var(--text-primary);
    background: white;
    transition: var(--transition);
    outline: none;
}

.searchable-select-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.searchable-select-input::placeholder {
    color: var(--text-muted);
}

.searchable-select-arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 11px;
    pointer-events: none;
    transition: transform 0.2s ease;
}

.searchable-select.open .searchable-select-arrow {
    transform: translateY(-50%) rotate(180deg);
}

.searchable-select-clear {
    position: absolute;
    right: 32px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 11px;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.searchable-select-clear:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.searchable-select-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: white;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    max-height: 220px;
    overflow-y: auto;
    z-index: 9999;
    animation: selectDropIn 0.15s ease-out;
}

@keyframes selectDropIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.searchable-select-item {
    padding: 9px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.12s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.searchable-select-item:hover,
.searchable-select-item.highlighted {
    background: var(--primary-light);
}

.searchable-select-item.selected {
    color: var(--primary-dark);
    font-weight: 600;
    background: rgba(16, 185, 129, 0.06);
}

.searchable-select-check {
    color: var(--primary);
    font-size: 11px;
    flex-shrink: 0;
}

.searchable-select-empty {
    padding: 14px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    font-style: italic;
}

.searchable-select-item mark {
    background: rgba(16, 185, 129, 0.25);
    color: var(--primary-dark);
    font-weight: 700;
    padding: 0 1px;
    border-radius: 2px;
}

.searchable-select-dropdown::-webkit-scrollbar {
    width: 5px;
}

.searchable-select-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.searchable-select-dropdown::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

.searchable-select-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}