:root {
    --primary: #15803d;
    --primary-dark: #0f5132;
    --primary-light: #22c55e;
    --accent: #d97706;
    --accent-hover: #b45309;
    --dark: #0f172a;
    --sidebar-bg: #0f281e;
    --sidebar-hover: #1a4333;
    --bg-main: #f8fafc;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --radius: 10px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.07);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.08);
}

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

html, body {
    overflow-x: hidden;
    max-width: 100vw;
    width: 100%;
}

body {
    background: var(--bg-main);
    color: var(--text-main);
    font-family: 'Be Vietnam Pro', system-ui, -apple-system, sans-serif;
    font-size: 14.5px;
    line-height: 1.5;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-dark);
}

/* ADMIN SHELL */
.admin-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 100vh;
    max-width: 100vw;
    overflow-x: hidden;
}

/* SIDEBAR */
.sidebar {
    background: var(--sidebar-bg);
    color: #e2e8f0;
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: sticky;
    top: 0;
    height: 100%;
    overflow-y: auto;
}

.sidebar-header-bar {
    display: block;
}

.admin-mobile-toggle {
    display: none;
}

.sidebar-menu-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1;
}

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

.admin-brand-logo {
    width: 44px;
    height: 44px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px;
    border-radius: 8px;
}

.sidebar-brand h2 {
    font-family: 'Montserrat', sans-serif;
    font-size: 16px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 0.5px;
}

.sidebar-brand small {
    font-size: 10px;
    color: #86efac;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    display: block;
}

.admin-nav {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.admin-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #cbd5e1;
    padding: 11px 14px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
    position: relative;
}

.admin-nav a .nav-icon {
    font-size: 16px;
}

.admin-nav a:hover {
    background: var(--sidebar-hover);
    color: #ffffff;
}

.admin-nav a.active {
    background: var(--primary);
    color: #ffffff;
    font-weight: 700;
}

.nav-badge {
    margin-left: auto;
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    animation: pulse-badge 1.8s infinite;
}

@keyframes pulse-badge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.nav-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 12px 0;
}

.nav-link-storefront {
    color: #93c5fd !important;
}

.nav-link-storefront:hover {
    background: rgba(59, 130, 246, 0.15) !important;
}

.sidebar-user-footer {
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.user-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    flex-shrink: 0;
}

.user-meta strong {
    display: block;
    color: #ffffff;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-meta small {
    display: block;
    color: #94a3b8;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-logout {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: #ef4444;
    color: white;
}

/* MAIN CONTENT */
.admin-main {
    padding: 30px 40px;
    min-width: 0;
    max-width: 1560px;
    width: 100%;
}

/* TOOLBAR */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 28px;
}

.toolbar h1 {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.2;
}

.toolbar p.muted {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

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

.back-link {
    display: inline-block;
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 6px;
}

.back-link:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* BUTTONS */
button, .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    background: var(--primary);
    color: white;
    border: 0;
    border-radius: 8px;
    padding: 10px 18px;
    font: inherit;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s;
    text-decoration: none;
}

button:hover, .button:hover {
    background: var(--primary-dark);
    color: white;
}

.button-accent {
    background: var(--accent);
}

.button-accent:hover {
    background: var(--accent-hover);
}

.button-secondary {
    background: #e2e8f0;
    color: #334155;
}

.button-secondary:hover {
    background: #cbd5e1;
    color: #0f172a;
}

.button-print {
    background: #0284c7;
}

.button-print:hover {
    background: #0369a1;
}

.button-lg {
    padding: 12px 24px;
    font-size: 15px;
}

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

.stat-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 22px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
}

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

.stat-icon {
    font-size: 28px;
    background: #f1f5f9;
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
}

.stat-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.stat-number {
    display: block;
    font-size: 24px;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.1;
    margin-bottom: 6px;
}

.stat-sub {
    display: block;
    font-size: 11.5px;
    color: var(--text-muted);
}

.stat-card-revenue .stat-number {
    color: var(--primary);
}

/* STATUS TABS */
.status-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 24px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.tab-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-muted);
    border-radius: 8px 8px 0 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.tab-item:hover {
    color: var(--primary);
}

.tab-item.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: white;
}

.tab-count {
    background: #e2e8f0;
    color: #475569;
    font-size: 11.5px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 12px;
}

.count-new {
    background: #fef3c7;
    color: #b45309;
}

.count-success {
    background: #dcfce7;
    color: #15803d;
}

.count-fixed {
    background: #e0e7ff;
    color: #3730a3;
}

.count-retail {
    background: #f1f5f9;
    color: #334155;
}

/* FILTER BAR */
.filter-bar {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.filter-form {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-field {
    flex: 1;
    min-width: 200px;
}

.btn-reset {
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: underline;
    margin-left: 6px;
}

/* DASHBOARD SECTIONS */
.dashboard-section {
    margin-bottom: 28px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.section-title-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.section-title-bar h2 {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-main);
}

.view-all-link {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}

.view-all-link:hover {
    text-decoration: underline;
}

/* PANELS */
.panel {
    background: white;
    padding: 24px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.panel-header h3 {
    font-size: 17px;
    font-weight: 700;
}

/* TABLES */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
    display: block;
    box-sizing: border-box;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #ffffff;
}

.table-responsive::-webkit-scrollbar {
    height: 6px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.admin-table {
    width: 100%;
    min-width: 620px;
    border-collapse: collapse;
    font-size: 13.5px;
}

.admin-table th, 
.admin-table td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.admin-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-table tbody tr:hover {
    background-color: #f8fafc;
}

.table-thumb {
    width: 44px;
    height: 44px;
    object-fit: contain;
    background: #f1f5f9;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

/* BADGES */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-sku {
    font-family: monospace;
    font-size: 12px;
    background: #f1f5f9;
    color: #0f172a;
    padding: 2px 7px;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    font-weight: 600;
}

.badge-retail {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
}

.badge-fixed {
    background: #ede9fe;
    color: #6b21a8;
    border: 1px solid #ddd6fe;
}

.badge-status-new {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.badge-status-received {
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

.badge-status-processing {
    background: #ffedd5;
    color: #c2410c;
    border: 1px solid #fed7aa;
}

.badge-status-completed {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.badge-status-cancelled {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.badge-success {
    background: #dcfce7;
    color: #15803d;
}

.badge-secondary {
    background: #e2e8f0;
    color: #475569;
}

/* ACTION BUTTONS */
.action-buttons {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
}

.btn-action-sm {
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.18s;
}

.btn-view {
    background: #f0fdf4;
    color: #15803d;
    border-color: #bbf7d0;
}

.btn-view:hover {
    background: #15803d;
    color: white;
}

.btn-print {
    background: #f0f9ff;
    color: #0284c7;
    border-color: #bae6fd;
}

.btn-print:hover {
    background: #0284c7;
    color: white;
}

.btn-edit {
    background: #fefce8;
    color: #a16207;
    border-color: #fef08a;
}

.btn-edit:hover {
    background: #a16207;
    color: white;
}

.btn-delete {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fecaca;
}

.btn-delete:hover {
    background: #b91c1c;
    color: white;
}

/* ORDER DETAIL GRID */
.order-detail-grid {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 24px;
    align-items: flex-start;
}

.customer-info-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 13.5px;
}

.info-label {
    color: var(--text-muted);
}

.customer-note-box {
    background: #f8fafc;
    border: 1px dashed var(--border-color);
    padding: 12px;
    border-radius: 8px;
    margin-top: 10px;
}

.customer-note-box label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.customer-note-box p {
    font-style: italic;
    color: #334155;
    font-size: 13px;
}

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

.form-label {
    display: block;
    font-weight: 600;
    font-size: 13.5px;
    margin-bottom: 6px;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: white;
    font: inherit;
    font-size: 14px;
    color: var(--text-main);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.12);
}

.form-error {
    display: block;
    color: #dc2626;
    font-size: 12px;
    margin-top: 4px;
}

.form-hint {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 4px;
}

.radio-inline-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.radio-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.grid-2-cols {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 32px;
}

.form-section-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color);
}

.add-item-bar {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    background: #f8fafc;
    padding: 14px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.btn-remove-sm {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 20px;
    cursor: pointer;
    padding: 0 6px;
    line-height: 1;
}

.btn-remove-sm:hover {
    color: #b91c1c;
}

/* CUSTOMER PROFILE */
.customer-show-grid {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 24px;
}

.profile-info-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* UTILITIES */
.text-accent { color: var(--accent) !important; }
.text-danger { color: #dc2626 !important; }
.text-muted { color: var(--text-muted) !important; }
.font-bold { font-weight: 700 !important; }
.w-100 { width: 100% !important; }
.mt-2 { margin-top: 8px !important; }
.mt-3 { margin-top: 12px !important; }
.mt-4 { margin-top: 16px !important; }
.mb-3 { margin-bottom: 12px !important; }
.p-4 { padding: 16px !important; }
.text-center { text-align: center !important; }

/* BADGES PAYMENT */
.badge-payment-paid {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #86efac;
}

.badge-payment-partial {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fcd34d;
}

.badge-payment-unpaid {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #cbd5e1;
}

/* AUTH PAGES (LOGIN / SETUP) */
.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f281e 0%, #0f172a 100%);
    padding: 24px;
}

.auth-card {
    background: #ffffff;
    width: 100%;
    max-width: 440px;
    border-radius: 16px;
    padding: 36px 32px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-header {
    text-align: center;
    margin-bottom: 24px;
}

.auth-back {
    display: inline-block;
    font-size: 13px;
    color: #64748b;
    margin-bottom: 16px;
    text-decoration: none;
}

.auth-back:hover {
    color: var(--primary);
    text-decoration: underline;
}

.auth-logo img {
    height: 58px;
    object-fit: contain;
    margin-bottom: 12px;
}

.auth-header h1 {
    font-size: 22px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 6px;
}

.auth-sub {
    font-size: 13px;
    color: #64748b;
    line-height: 1.5;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.btn-auth {
    padding: 13px;
    font-size: 15px;
    font-weight: 700;
    margin-top: 8px;
    border-radius: 8px;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #f1f5f9;
}

/* RESPONSIVE */
@media (max-width: 1100px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .order-detail-grid,
    .customer-show-grid,
    .grid-2-cols {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 992px) {
    .admin-shell {
        display: block;
        width: 100%;
        min-height: 100vh;
    }

    .sidebar {
        position: sticky;
        top: 0;
        z-index: 1000;
        height: auto !important;
        width: 100%;
        padding: 0;
        background: var(--sidebar-bg);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
        box-sizing: border-box;
        overflow: visible !important;
    }

    .sidebar-header-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 16px;
        background: var(--sidebar-bg);
        box-sizing: border-box;
    }

    .sidebar-brand {
        padding-bottom: 0;
        border-bottom: none;
        gap: 10px;
    }

    .admin-brand-logo {
        width: 38px;
        height: 38px;
    }

    .sidebar-brand h2 {
        font-size: 15px;
    }

    .sidebar-brand small {
        font-size: 9px;
    }

    /* Nút burger mobile cho admin */
    .admin-mobile-toggle {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 5px;
        width: 42px;
        height: 42px;
        padding: 0;
        border: 1px solid rgba(255, 255, 255, 0.18);
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.08);
        cursor: pointer;
        transition: background-color 0.2s, border-color 0.2s;
        flex-shrink: 0;
    }

    .admin-mobile-toggle:hover {
        background: rgba(255, 255, 255, 0.15);
        border-color: rgba(255, 255, 255, 0.3);
    }

    .admin-mobile-toggle span {
        display: block;
        width: 20px;
        height: 2px;
        border-radius: 2px;
        background: #ffffff;
        transition: transform 0.25s ease, opacity 0.25s ease;
    }

    .admin-mobile-toggle[aria-expanded="true"] span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .admin-mobile-toggle[aria-expanded="true"] span:nth-child(2) {
        opacity: 0;
    }

    .admin-mobile-toggle[aria-expanded="true"] span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    /* Menu dropdown nổi sang trọng dạng thẻ bo góc như bên trang client */
    .sidebar-menu-wrapper {
        display: none !important;
    }

    .sidebar-menu-wrapper.is-open {
        display: flex !important;
        flex-direction: column;
        position: absolute;
        top: calc(100% + 8px);
        left: 12px;
        right: 12px;
        background: #0f281e;
        border: 1px solid rgba(255, 255, 255, 0.16);
        border-radius: 16px;
        max-height: calc(100vh - 90px);
        max-height: calc(100dvh - 90px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        padding: 14px;
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
        z-index: 10000;
        box-sizing: border-box;
        animation: adminMenuSlide 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    }

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

    .admin-nav {
        margin-top: 0;
        gap: 6px;
    }

    .admin-nav a {
        min-height: 46px;
        padding: 12px 14px;
        font-size: 14px;
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.04);
        border: 1px solid rgba(255, 255, 255, 0.05);
        color: #e2e8f0;
    }

    .admin-nav a:hover,
    .admin-nav a.active {
        background: var(--primary);
        border-color: var(--primary);
        color: #ffffff;
        font-weight: 700;
    }

    .sidebar-user-footer {
        margin-top: 14px;
        padding-top: 14px;
        border-top: 1px solid rgba(255, 255, 255, 0.12);
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }

    .admin-main {
        width: 100%;
        max-width: 100vw;
        padding: 16px 14px 40px;
        min-width: 0;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 18px;
        width: 100%;
        box-sizing: border-box;
    }

    .toolbar h1 {
        font-size: 21px;
        line-height: 1.3;
        word-break: break-word;
    }

    .toolbar-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
        box-sizing: border-box;
    }

    .toolbar-actions .button {
        flex: 1 1 auto;
        min-height: 42px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        box-sizing: border-box;
    }

    .filter-bar .filter-form {
        flex-direction: column;
        align-items: stretch !important;
        gap: 10px !important;
    }

    .filter-field {
        width: 100% !important;
        min-width: 0 !important;
    }

    .filter-field .form-control {
        width: 100%;
        min-height: 42px;
        box-sizing: border-box;
    }

    .filter-bar .button {
        width: 100%;
        min-height: 42px;
        display: flex;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
    }

    .panel,
    .card {
        padding: 16px 14px;
        border-radius: 12px;
        margin-bottom: 18px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }

    .table-responsive {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        background: #ffffff;
        box-sizing: border-box;
        display: block;
    }

    .admin-table {
        width: 100%;
        min-width: 600px;
    }

    .admin-table th,
    .admin-table td {
        padding: 10px 8px;
        font-size: 13px;
        white-space: nowrap;
    }

    .status-tabs {
        display: flex;
        gap: 6px;
        border-bottom: 2px solid var(--border-color);
        margin-bottom: 18px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        padding-bottom: 4px;
        scrollbar-width: thin;
    }

    .tab-item {
        padding: 8px 12px;
        font-size: 13px;
        white-space: nowrap;
    }
}

/* Tối ưu chi tiết cho màn hình điện thoại nhỏ (<= 640px) */
@media (max-width: 640px) {
    .sidebar-header-bar {
        padding: 10px 14px;
    }

    .sidebar-brand h2 {
        font-size: 14px;
    }

    .sidebar-brand small {
        font-size: 8.5px;
    }

    .admin-main {
        padding: 14px 12px 36px;
    }

    .toolbar h1 {
        font-size: 19px;
    }

    /* Trên mobile hẹp: xếp chồng 2 nút hành động để tuyệt đối không bị cụt chữ hay tràn viền */
    .toolbar-actions {
        flex-direction: column !important;
        gap: 8px !important;
        width: 100% !important;
    }

    .toolbar-actions .button {
        width: 100% !important;
        min-height: 44px;
        font-size: 14px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        margin-bottom: 18px;
        width: 100%;
        box-sizing: border-box;
    }

    .stat-card {
        padding: 14px;
        border-radius: 12px;
        width: 100%;
        box-sizing: border-box;
    }

    .stat-icon {
        width: 42px;
        height: 42px;
        font-size: 22px;
    }

    .stat-number {
        font-size: 20px;
    }

    .stat-label {
        font-size: 12px;
    }

    .panel,
    .card {
        padding: 12px 10px;
    }

    .card-header h2 {
        font-size: 16px;
    }

    .section-title-bar h2 {
        font-size: 16px;
    }

    .form-grid,
    .grid-2-cols {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}
