/* ============================================
   ERP Mailisa 2026 - Design System
   Light Theme + Modern Clean + Micro-animations
   ============================================ */

/* === Google Fonts === */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* === CSS Variables === */
:root {
    /* Primary Colors */
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.15);

    /* Accent Colors */
    --accent-cyan: #0891b2;
    --accent-emerald: #059669;
    --accent-amber: #d97706;
    --accent-rose: #e11d48;
    --accent-violet: #7c3aed;

    /* Background */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;

    /* Glass Effect */
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(0, 0, 0, 0.08);
    --glass-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);

    /* Text */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-accent: #6366f1;

    /* Borders */
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;

    /* Sidebar */
    --sidebar-width: 280px;
    --sidebar-collapsed: 72px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.08);
}

/* === Reset & Base === */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
}

/* === Scrollbar === */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* === Login Background === */
.bg-animated {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    background: linear-gradient(135deg, #eef2ff 0%, #f0f9ff 50%, #faf5ff 100%);
}

.bg-animated::before,
.bg-animated::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 15s ease-in-out infinite;
}

.bg-animated::before {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15), transparent);
    top: -100px;
    right: -100px;
}

.bg-animated::after {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(34, 211, 238, 0.1), transparent);
    bottom: -100px;
    left: -100px;
    animation-delay: -7s;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(30px, -30px) scale(1.05);
    }

    66% {
        transform: translate(-20px, 20px) scale(0.95);
    }
}

/* === LOGIN PAGE === */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    animation: slideUp 0.6s ease-out;
}

.login-card .logo {
    text-align: center;
    margin-bottom: 36px;
}

.login-card .logo-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary), #06b6d4);
    border-radius: var(--radius-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
    margin-bottom: 16px;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.25);
}

.login-card .logo h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.login-card .logo p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === Form Elements === */
.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-group .input-wrapper {
    position: relative;
}

.form-group .input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1rem;
    transition: color var(--transition-fast);
    pointer-events: none;
}

.form-control {
    width: 100%;
    padding: 12px 14px 12px 44px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all var(--transition-fast);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: #fff;
}

.form-control:focus+.input-icon,
.form-control:focus~.input-icon {
    color: var(--primary);
}

.form-control-no-icon {
    padding-left: 14px;
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    padding-left: 14px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 12L2 6h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-color: var(--bg-tertiary);
}

/* Checkbox / Toggle */
.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
    color: white;
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.btn-success {
    background: linear-gradient(135deg, #059669, #047857);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #e11d48, #be123c);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(225, 29, 72, 0.25);
    color: white;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 12px;
}

.btn-ghost:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

.btn i {
    font-size: 0.9em;
}

/* Loading state */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* === Flash Messages === */
.flash-message {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: fadeIn 0.3s ease-out;
    border: 1px solid transparent;
}

.flash-success {
    background: #f0fdf4;
    color: #15803d;
    border-color: #bbf7d0;
}

.flash-error {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === DASHBOARD LAYOUT === */
.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: width var(--transition-base), transform var(--transition-base);
    box-shadow: 1px 0 8px rgba(0, 0, 0, 0.04);
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 14px;
}

.sidebar-logo {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary), #06b6d4);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.sidebar-brand {
    overflow: hidden;
}

.sidebar-brand h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.sidebar-brand small {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    padding: 0 12px;
    margin-bottom: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    margin-bottom: 2px;
    position: relative;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
    transition: height var(--transition-fast);
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background: #eef2ff;
    color: var(--primary);
}

.nav-item.active::before {
    height: 60%;
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 1.05rem;
    flex-shrink: 0;
}

.nav-item span {
    white-space: nowrap;
    overflow: hidden;
}

.nav-item-sub {
    padding-left: 28px;
    font-size: 0.86rem;
}

.nav-item-sub i {
    font-size: 0.82rem;
    width: 18px;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid var(--border-color);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.sidebar-user:hover {
    background: var(--bg-tertiary);
}

.sidebar-user .avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent-violet));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: white;
    flex-shrink: 0;
}

.sidebar-user .user-info {
    overflow: hidden;
    flex: 1;
}

.sidebar-user .user-info .name {
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.sidebar-user .user-info .role {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: capitalize;
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition-base);
}

/* Topbar */
.topbar {
    height: 64px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-left h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.topbar.topbar--title-centered {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    justify-content: unset;
}

.topbar.topbar--title-centered .topbar-left {
    grid-column: 1;
    justify-self: start;
    min-width: 0;
}

.topbar.topbar--title-centered .topbar-page-title {
    grid-column: 2;
    margin: 0;
    font-size: 1.48rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: center;
    color: var(--text-primary);
    white-space: nowrap;
    line-height: 1.2;
}

.topbar.topbar--title-centered .topbar-right {
    grid-column: 3;
    justify-self: end;
}

@media (max-width: 768px) {
    .topbar.topbar--title-centered {
        grid-template-columns: auto 1fr auto;
        padding: 0 16px;
    }

    .topbar.topbar--title-centered .topbar-page-title {
        font-size: 0.92rem;
        white-space: normal;
        line-height: 1.25;
        max-width: 100%;
    }
}

.sidebar-toggle {
    display: none;
    width: 38px;
    height: 38px;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.1rem;
    transition: background var(--transition-fast);
}

.sidebar-toggle:hover {
    background: var(--border-color);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-logout {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn-logout:hover {
    background: #fee2e2;
    color: #b91c1c;
    transform: translateY(-1px);
}

/* Page Content */
.page-content {
    padding: 32px;
}

/* === Stats Cards === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-hover);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0.12;
}

.stat-card.cyan::after {
    background: #06b6d4;
}

.stat-card.emerald::after {
    background: #059669;
}

.stat-card.amber::after {
    background: #d97706;
}

.stat-card.rose::after {
    background: #e11d48;
}

.stat-card.violet::after {
    background: #7c3aed;
}

.stat-card.primary::after {
    background: var(--primary);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin-bottom: 16px;
}

.stat-card.cyan .stat-icon {
    background: #ecfeff;
    color: #0891b2;
}

.stat-card.emerald .stat-icon {
    background: #ecfdf5;
    color: #059669;
}

.stat-card.amber .stat-icon {
    background: #fffbeb;
    color: #d97706;
}

.stat-card.rose .stat-icon {
    background: #fff1f2;
    color: #e11d48;
}

.stat-card.violet .stat-icon {
    background: #f5f3ff;
    color: #7c3aed;
}

.stat-card.primary .stat-icon {
    background: #eef2ff;
    color: var(--primary);
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.stat-card .stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* === Data Table === */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 12px;
}

.table-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-box {
    position: relative;
}

.search-box input {
    padding: 9px 14px 9px 38px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    width: 240px;
    transition: all var(--transition-fast);
    outline: none;
}

.search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    width: 280px;
    background: #fff;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    padding: 14px 20px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

tbody td {
    padding: 14px 20px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

tbody tr {
    transition: background var(--transition-fast);
}

tbody tr:hover {
    background: var(--bg-tertiary);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* User row info */
.user-info-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info-cell .avatar-sm {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: white;
    flex-shrink: 0;
}

.avatar-admin {
    background: linear-gradient(135deg, #e11d48, #f43f5e);
}

.avatar-giam_doc {
    background: linear-gradient(135deg, #d97706, #f59e0b);
}

.avatar-quan_ly {
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
}

.avatar-ke_toan {
    background: linear-gradient(135deg, #059669, #34d399);
}

.avatar-thu_ngan {
    background: linear-gradient(135deg, #0891b2, #22d3ee);
}

.avatar-tu_van {
    background: linear-gradient(135deg, #6366f1, #818cf8);
}

.avatar-kho {
    background: linear-gradient(135deg, #78716c, #a8a29e);
}

.user-info-cell .user-name {
    font-weight: 600;
    color: var(--text-primary);
}

.user-info-cell .user-email {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-admin {
    background: #fff1f2;
    color: #e11d48;
    border: 1px solid #fecdd3;
}

.badge-giam_doc {
    background: #fffbeb;
    color: #d97706;
    border: 1px solid #fde68a;
}

.badge-quan_ly {
    background: #f5f3ff;
    color: #7c3aed;
    border: 1px solid #ddd6fe;
}

.badge-ke_toan {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

.badge-thu_ngan {
    background: #ecfeff;
    color: #0891b2;
    border: 1px solid #a5f3fc;
}

.badge-tu_van {
    background: #eef2ff;
    color: #6366f1;
    border: 1px solid #c7d2fe;
}

.badge-kho {
    background: #f5f5f4;
    color: #57534e;
    border: 1px solid #d6d3d1;
}

.badge-active {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.badge-inactive {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.badge-info {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

.badge-warning {
    background: #fffbeb;
    color: #d97706;
    border: 1px solid #fde68a;
}

/* Action buttons in table */
.action-btns {
    display: flex;
    gap: 6px;
}

.action-btn {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.action-btn-edit {
    background: #eef2ff;
    color: var(--primary);
}

.action-btn-edit:hover {
    background: #e0e7ff;
    transform: translateY(-2px);
}

.action-btn-delete {
    background: #fef2f2;
    color: #dc2626;
}

.action-btn-delete:hover {
    background: #fee2e2;
    transform: translateY(-2px);
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.pagination a {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.pagination a:hover {
    background: #eef2ff;
    color: var(--primary);
    border-color: var(--primary);
}

.pagination .active {
    background: var(--primary);
    color: white;
    border: 1px solid var(--primary);
}

/* === Form Page/Card === */
.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 640px;
    box-shadow: var(--shadow-sm);
}

.form-card h2 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.form-card .subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 28px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state p {
    font-size: 1rem;
}

/* === Confirm Dialog === */
.confirm-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.confirm-overlay.show {
    display: flex;
}

.confirm-dialog {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 420px;
    width: 90%;
    text-align: center;
    animation: slideUp 0.3s ease-out;
    box-shadow: var(--shadow-lg);
}

.confirm-dialog .icon-warning {
    width: 56px;
    height: 56px;
    background: #fef2f2;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #dc2626;
    margin-bottom: 16px;
}

.confirm-dialog h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.confirm-dialog p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.confirm-dialog .actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* === Responsive === */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: flex;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .page-content {
        padding: 20px 16px;
    }

    .topbar {
        padding: 0 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .table-header {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box input,
    .search-box input:focus {
        width: 100%;
    }

    .login-card {
        padding: 32px 24px;
    }

    /* Make table scrollable on mobile */
    .table-scroll {
        overflow-x: auto;
    }
}

/* === Mobile Sidebar Overlay === */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 99;
}

.sidebar-overlay.show {
    display: block;
}

/* === Collapsible Sidebar (Desktop) === */
.sidebar-collapse-btn {
    display: none;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
    margin-left: auto;
    flex-shrink: 0;
}

.sidebar-collapse-btn:hover {
    background: var(--border-color);
    color: var(--primary);
}

@media (min-width: 1025px) {
    .sidebar-collapse-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .sidebar.collapsed {
        width: var(--sidebar-collapsed);
    }

    .sidebar.collapsed .sidebar-brand,
    .sidebar.collapsed .nav-section-title,
    .sidebar.collapsed .nav-item span,
    .sidebar.collapsed .sidebar-user .user-info {
        display: none;
    }

    .sidebar.collapsed .sidebar-header {
        padding: 20px 15px;
        justify-content: center;
    }

    .sidebar.collapsed .sidebar-logo {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }

    .sidebar.collapsed .nav-item {
        padding: 11px 0;
        justify-content: center;
    }

    .sidebar.collapsed .nav-item i {
        width: auto;
        font-size: 1.15rem;
    }

    .sidebar.collapsed .nav-item::before {
        display: none;
    }

    .sidebar.collapsed .sidebar-user {
        justify-content: center;
    }

    .sidebar.collapsed .sidebar-user .avatar {
        width: 36px;
        height: 36px;
        font-size: 0.8rem;
    }

    .sidebar.collapsed .sidebar-collapse-btn {
        width: 100%;
        border-radius: var(--radius-sm);
        margin-bottom: 8px;
    }

    .sidebar.collapsed+.main-content,
    .sidebar.collapsed~.main-content {
        margin-left: var(--sidebar-collapsed);
    }

    /* Tooltip on hover when collapsed */
    .sidebar.collapsed .nav-item {
        position: relative;
    }

    .sidebar.collapsed .nav-item:hover::after {
        content: attr(data-tooltip);
        position: absolute;
        left: calc(100% + 8px);
        top: 50%;
        transform: translateY(-50%);
        background: var(--text-primary);
        color: white;
        padding: 4px 12px;
        border-radius: 6px;
        font-size: 0.8rem;
        white-space: nowrap;
        z-index: 200;
        pointer-events: none;
        box-shadow: var(--shadow-md);
    }
}

/* === Order Form Styles === */
.order-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.order-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 24px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.order-section-header i {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: white;
}

.order-section-header .icon-customer {
    background: var(--primary);
}

.order-section-header .icon-product {
    background: var(--accent-emerald);
}

.order-section-header .icon-payment {
    background: var(--accent-amber);
}

.order-section-header .icon-note {
    background: var(--accent-cyan);
}

.order-section-header .icon-employee {
    background: var(--accent-violet);
}

.order-section-body {
    padding: 20px 24px;
}

.order-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.order-form-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.order-form-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.order-form-grid-5 {
    grid-template-columns: repeat(5, 1fr);
}

/* Items Table */
.items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.items-table thead th {
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-primary);
    text-align: left;
    white-space: nowrap;
}

.items-table tbody td {
    padding: 8px 6px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.items-table tbody tr:last-child td {
    border-bottom: none;
}

.items-table input,
.items-table select {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.85rem;
    background: #fff;
    color: var(--text-primary);
    transition: border-color var(--transition-fast);
    outline: none;
}

.items-table input:focus,
.items-table select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.items-table .input-currency {
    text-align: right;
    font-weight: 600;
}

.items-table .col-narrow {
    width: 70px;
}

.items-table .col-medium {
    width: 120px;
}

.items-table .col-action {
    width: 44px;
    text-align: center;
}

.btn-remove-row {
    width: 32px;
    height: 32px;
    border: none;
    background: #fef2f2;
    color: #dc2626;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-remove-row:hover {
    background: #fee2e2;
    transform: scale(1.1);
}

.btn-add-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    margin-top: 12px;
    background: var(--bg-tertiary);
    border: 1px dashed var(--border-hover);
    border-radius: var(--radius-md);
    color: var(--primary);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.btn-add-row:hover {
    background: #eef2ff;
    border-color: var(--primary);
}

/* Payment Summary */
.payment-summary {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.payment-total {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 1.1rem;
}

.payment-total small {
    font-weight: 400;
    font-size: 0.75rem;
    opacity: 0.8;
}

/* Checkbox group */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding-top: 4px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all var(--transition-fast);
}

.checkbox-group label:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.checkbox-group input[type="checkbox"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
}

/* Order actions bar */
.order-actions-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 0;
    flex-wrap: wrap;
}

/* Search inline */
.search-inline {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.search-inline .form-group {
    margin-bottom: 0;
}

@media (max-width: 768px) {

    .order-form-grid-3,
    .order-form-grid-4,
    .order-form-grid-5 {
        grid-template-columns: 1fr 1fr;
    }

    .items-table {
        font-size: 0.78rem;
    }
}

@media (max-width: 480px) {

    .order-form-grid-3,
    .order-form-grid-4,
    .order-form-grid-5 {
        grid-template-columns: 1fr;
    }
}

/* ==============================
   IMAGE UPLOAD
============================== */
.image-drop-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 32px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    background: #f8fafc;
}

.image-drop-zone:hover {
    border-color: var(--primary);
    background: #f0f4ff;
}

.image-drop-zone.drag-over {
    border-color: var(--primary);
    background: #ede9fe;
    transform: scale(1.01);
}

.drop-zone-content i {
    font-size: 2.2rem;
    color: #94a3b8;
    margin-bottom: 8px;
    display: block;
}

.drop-zone-content p {
    margin: 0 0 4px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.drop-zone-content small {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.drop-zone-link {
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}

/* Image Gallery Grid */
.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.image-card {
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: #fff;
    transition: box-shadow 0.2s, transform 0.2s;
}

.image-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.image-card-img {
    width: 100%;
    height: 130px;
    background-size: cover;
    background-position: center;
    cursor: pointer;
    transition: opacity 0.2s;
}

.image-card-img:hover {
    opacity: 0.85;
}

.image-card-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    gap: 4px;
}

.image-card-name {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.image-card-delete {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 4px;
    border-radius: 4px;
    opacity: 0.5;
    transition: opacity 0.2s, background 0.2s;
}

.image-card-delete:hover {
    opacity: 1;
    background: #fef2f2;
}

/* Lightbox */
.image-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    cursor: pointer;
    animation: fadeIn 0.2s;
}

.image-lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 2.5rem;
    color: #fff;
    cursor: pointer;
    line-height: 1;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ==============================
   SOURCE CHIP CHECKBOXES
============================== */
.source-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.source-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    border: 1.5px solid #e2e8f0;
    background: #fff;
    color: #64748b;
    transition: all 0.2s ease;
    user-select: none;
}

.source-chip:hover {
    border-color: var(--chip-color, #94a3b8);
    background: color-mix(in srgb, var(--chip-color, #94a3b8) 8%, white);
}

.source-chip input[type="checkbox"] {
    display: none;
}

.source-chip i {
    font-size: 0.9rem;
    transition: color 0.2s;
}

.source-chip:has(input:checked) {
    background: var(--chip-color, var(--primary));
    border-color: var(--chip-color, var(--primary));
    color: #fff;
    box-shadow: 0 2px 8px color-mix(in srgb, var(--chip-color, var(--primary)) 35%, transparent);
    transform: scale(1.03);
}

.source-chip:has(input:checked) i {
    color: #fff;
}

/* === Điều Tour - Inline inputs === */
.bxt-inline-input {
    border: 1px solid transparent;
    background: transparent;
    text-align: center;
    font-family: inherit;
    font-size: 0.78rem;
    padding: 2px 4px;
    border-radius: 4px;
    transition: all 0.15s;
    color: var(--text-primary);
}
.bxt-inline-input:hover {
    border-color: var(--border-color);
    background: #f8fafc;
}
.bxt-inline-input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 2px var(--primary-glow);
}