/* Modern Inventory Management System - Style V2 */
:root {
    /* Colors */
    --primary: #4A90E2;
    --primary-dark: #357ABD;
    --primary-light: #6BA3E8;
    --success: #27AE60;
    --success-light: #2ECC71;
    --danger: #E74C3C;
    --danger-light: #EC7063;
    --warning: #F39C12;
    --warning-light: #F5B041;
    --info: #3498DB;
    --dark: #2C3E50;
    --dark-light: #34495E;
    --gray: #95A5A6;
    --gray-light: #BDC3C7;
    --gray-lighter: #ECF0F1;
    --white: #FFFFFF;
    
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    
    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 16px rgba(0,0,0,0.1);
    
    /* Sidebar */
    --sidebar-width: 180px;
    --sidebar-collapsed-width: 60px;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #F5F7FA;
    color: var(--dark);
    line-height: 1.6;
    overflow-x: hidden;
}

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

.sidebar-overlay.show {
    display: block;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--white);
    box-shadow: var(--shadow-md);
    z-index: 1000;
    transition: all 0.3s ease;
}

.sidebar-header {
    padding: var(--spacing-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--gray-lighter);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 16px;
    font-weight: bold;
    color: var(--primary);
}

.logo i {
    font-size: 24px;
}

.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--dark);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.sidebar-toggle:hover {
    background: var(--gray-lighter);
    color: var(--primary);
}

.sidebar-nav {
    padding: var(--spacing-md) 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-md);
    color: var(--dark);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: var(--gray-lighter);
    color: var(--primary);
}

.nav-item.active {
    background: rgba(74, 144, 226, 0.1);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
}

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

.nav-item .nav-text,
.logo .logo-text,
.sidebar-section-title .section-title-text {
    transition: opacity 0.2s;
}

/* Sidebar Collapsed State */
.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .logo-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar.collapsed .nav-text {
    font-size: 10px;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    max-width: none;
    display: inline-block;
    opacity: 1;
    width: auto;
    margin-left: 4px;
}

.sidebar.collapsed .section-title-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar.collapsed .logo {
    justify-content: center;
}

.sidebar.collapsed .sidebar-header {
    padding: var(--spacing-lg) var(--spacing-sm);
    justify-content: center;
}

.sidebar.collapsed .nav-item {
    justify-content: flex-start;
    padding: var(--spacing-md) var(--spacing-xs);
    position: relative;
    flex-direction: row;
    gap: 4px;
}

.sidebar.collapsed .nav-item i {
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.sidebar.collapsed .nav-item:hover {
    background: var(--gray-lighter);
}

.sidebar.collapsed .nav-item:hover .nav-text {
    background: var(--white);
    padding: 4px 8px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 1001;
    position: absolute;
    left: calc(100% + 8px);
    white-space: nowrap;
    min-width: max-content;
}

.sidebar.collapsed .sidebar-toggle i {
    transform: rotate(180deg);
}

.sidebar.collapsed .sidebar-divider {
    margin: var(--spacing-sm) var(--spacing-sm);
}

.sidebar.collapsed .sidebar-section-title {
    display: none;
}

/* Sidebar Divider and Section Title */
.sidebar-divider {
    height: 1px;
    background: var(--gray-lighter);
    margin: var(--spacing-md) var(--spacing-md);
}

.sidebar-section-title {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 11px;
    font-weight: 600;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Nav Action Buttons */
.nav-item.nav-action {
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
}

.nav-item.nav-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding-top: var(--spacing-md);
    transition: margin-left 0.3s ease;
    position: relative;
    z-index: 1;
}

.sidebar.collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

/* Topbar */
.topbar {
    background: var(--white);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-left {
    display: flex;
    align-items: center;
}

.mobile-menu-btn {
    display: none;
    margin-right: var(--spacing-md);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: none;
    background: var(--gray-lighter);
    color: var(--dark);
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.mobile-menu-btn i {
    font-size: 18px;
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--dark);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex: 1;
    justify-content: center;
    margin: 0 var(--spacing-md);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box i {
    position: absolute;
    left: 12px;
    color: var(--gray);
}

.search-box input {
    padding: 10px 12px 10px 40px;
    border: 1px solid var(--gray-lighter);
    border-radius: var(--radius-md);
    width: 300px;
    font-size: 14px;
}

.btn-icon {
    position: relative;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--gray-lighter);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dark);
}

.btn-icon .badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    transition: background 0.2s;
}

.user-menu:hover {
    background: var(--gray-lighter);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

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

/* Page Content */
.page-content {
    padding: var(--spacing-md);
    position: relative;
    z-index: 1;
}

.page {
    display: none;
    position: relative;
    z-index: 1;
}

.page.active {
    display: block;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--gray-lighter);
}

.page-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--dark);
    margin: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

/* History filter actions in header - optimized for compact display */
.header-actions.history-filter-actions {
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
}

.header-actions.history-filter-actions .history-date-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-right: 12px;
    padding-right: 12px;
    border-right: 1px solid #e0e0e0;
}

.header-actions.history-filter-actions .history-date-nav .btn-sm {
    padding: 5px 10px;
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
}

.header-actions.history-filter-actions .form-control-sm {
    max-width: 130px;
    min-width: 120px;
    padding: 6px 8px;
    font-size: 12px;
    flex-shrink: 1;
}

.header-actions.history-filter-actions .filter-separator {
    margin: 0 4px;
    white-space: nowrap;
    font-size: 12px;
    flex-shrink: 0;
}

.header-actions.history-filter-actions .btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Statistics Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.stat-card {
    background: var(--white);
    padding: var(--spacing-md);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.stat-card.stat-primary .stat-icon {
    background: rgba(74, 144, 226, 0.1);
    color: var(--primary);
}

.stat-card.stat-success .stat-icon {
    background: rgba(39, 174, 96, 0.1);
    color: var(--success);
}

.stat-card.stat-warning .stat-icon {
    background: rgba(243, 156, 18, 0.1);
    color: var(--warning);
}

.stat-card.stat-danger .stat-icon {
    background: rgba(231, 76, 60, 0.1);
    color: var(--danger);
}

.stat-card.stat-info .stat-icon {
    background: rgba(52, 152, 219, 0.1);
    color: var(--info);
}

.stat-card.stat-secondary .stat-icon {
    background: rgba(149, 165, 166, 0.1);
    color: var(--gray);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-info {
    flex: 1;
}

.stat-label {
    font-size: 14px;
    color: var(--gray);
    margin-bottom: var(--spacing-xs);
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: var(--spacing-xs);
}

.stat-change {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.stat-change.positive {
    color: var(--success);
}

.stat-change.negative {
    color: var(--danger);
}

/* Charts */
.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.chart-card {
    background: var(--white);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--gray-lighter);
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--dark);
    margin: 0;
}

.chart-container {
    position: relative;
    height: 300px;
}

/* Dashboard Row */
.dashboard-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--spacing-md);
}

.quick-action-btn {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    border: 2px solid var(--gray-lighter);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--dark);
    transition: all 0.2s;
    cursor: pointer;
}

.quick-action-btn:hover {
    border-color: var(--primary);
    background: rgba(74, 144, 226, 0.05);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.quick-action-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    flex-shrink: 0;
}

.quick-action-icon.success {
    background: var(--success);
}

.quick-action-icon.danger {
    background: var(--danger);
}

.quick-action-icon.primary {
    background: var(--primary);
}

.quick-action-icon.warning {
    background: var(--warning);
}

.quick-action-icon.info {
    background: var(--info);
}

.quick-action-icon.secondary {
    background: var(--gray);
}

.quick-action-text {
    flex: 1;
}

.quick-action-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: var(--spacing-xs);
}

.quick-action-desc {
    font-size: 12px;
    color: var(--gray);
}

/* Card */
.card {
    background: var(--white);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.card-body {
    padding-top: var(--spacing-md);
}

/* Activity Card */
.activity-card {
    background: var(--white);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.activity-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    transition: background 0.2s;
}

.activity-item:hover {
    background: var(--gray-lighter);
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.activity-icon.success {
    background: var(--success);
}

.activity-icon.danger {
    background: var(--danger);
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-weight: 500;
    color: var(--dark);
    margin-bottom: var(--spacing-xs);
}

.activity-meta {
    font-size: 12px;
    color: var(--gray);
}

.activity-amount {
    font-weight: 600;
    font-size: 18px;
}

/* Forms */
.form-card {
    background: var(--white);
    padding: var(--spacing-xl);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.form-group {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}

.form-row .form-group {
    margin-bottom: 0;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    color: var(--dark);
    font-size: 13px;
    order: -1;
}

.required {
    color: var(--danger);
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.15s;
    background: #fff;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.15);
    transform: translateY(-1px);
    transition: all 0.2s ease;
}

.form-control.field-error {
    border-color: var(--danger);
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.15);
}

.form-control.field-error:focus {
    border-color: var(--danger);
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.25);
}

.form-control.field-valid {
    border-color: var(--success);
}

.form-control.field-valid:focus {
    border-color: var(--success);
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.15);
}

.form-control:read-only {
    background: var(--gray-lighter);
    cursor: not-allowed;
}

.form-control-sm {
    padding: 8px 10px;
    font-size: 13px;
}

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

select.form-control {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    padding-right: 35px;
    appearance: none;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
    position: relative;
    z-index: 10;
    pointer-events: auto;
}

.btn:hover {
    opacity: 0.9;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--gray);
    color: white;
}

.btn-secondary:hover {
    background: var(--dark-light);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
}

.btn-link:hover {
    text-decoration: underline;
}

/* Tables */
.table-card {
    background: var(--white);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-top: var(--spacing-lg);
    width: 100%;
    overflow: hidden;
}

.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-lg);
}

.table-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--dark);
    margin: 0;
}

.table-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

/* History filter actions - optimized for single line display */
.history-filter-actions {
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
}

.history-filter-actions .history-date-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-right: 12px;
    padding-right: 12px;
    border-right: 1px solid #e0e0e0;
}

.history-filter-actions .history-date-nav .btn-sm {
    padding: 5px 10px;
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
}

.history-filter-actions .form-control-sm {
    max-width: 130px;
    min-width: 120px;
    padding: 6px 8px;
    font-size: 12px;
    flex-shrink: 1;
}

.history-filter-actions .filter-separator {
    margin: 0 4px;
    white-space: nowrap;
    font-size: 12px;
    flex-shrink: 0;
}

.history-filter-actions .btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Warehouse Selector */
/* Warehouse Controls Row - All in one line */
.warehouse-controls-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    background: var(--white);
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
}

.warehouse-stats-inline {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    flex: 1;
    justify-content: flex-end;
    min-width: 350px;
}

.stat-inline-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 100px;
    padding: var(--spacing-xs);
}

.stat-inline-label {
    font-size: 12px;
    color: var(--gray);
    margin-bottom: var(--spacing-xs);
    text-align: center;
    font-weight: 500;
}

.stat-inline-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--dark);
}

.stat-inline-value.text-success {
    color: var(--success);
}

.stat-inline-value.text-danger {
    color: var(--danger);
}

/* Legacy styles for backward compatibility */
.warehouse-selector-card {
    background: var(--white);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-lg);
}

.warehouse-selector-row {
    display: flex;
    align-items: flex-end;
    gap: var(--spacing-lg);
    flex-wrap: wrap;
}

.warehouse-selector-group {
    flex: 0 0 auto;
    min-width: 200px;
}

.warehouse-selector-group label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
    font-weight: 500;
    color: var(--dark);
}

.warehouse-select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--gray-lighter);
    border-radius: var(--radius-md);
    font-size: 14px;
    transition: border-color 0.2s;
    background: var(--white);
}

.warehouse-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.warehouse-actions {
    display: flex;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.warehouse-actions .btn {
    min-width: 140px;
}

.warehouse-filter {
    padding: 8px 12px;
    border: 2px solid var(--gray-lighter);
    border-radius: var(--radius-md);
    font-size: 14px;
    background: var(--white);
    cursor: pointer;
    transition: border-color 0.2s;
}

.warehouse-filter:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

/* Tabs */
.tabs-container {
    margin-bottom: var(--spacing-lg);
}

.tabs {
    display: flex;
    gap: var(--spacing-sm);
    border-bottom: 2px solid var(--gray-lighter);
    margin-bottom: var(--spacing-lg);
}

.tab-btn {
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--gray);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.tab-btn:hover {
    color: var(--primary);
    background: rgba(74, 144, 226, 0.05);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: rgba(74, 144, 226, 0.05);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.table-responsive {
    overflow-x: auto;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.data-table thead {
    background: var(--gray-lighter);
}

.data-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    color: var(--dark);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
    vertical-align: top;
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid var(--gray-lighter);
    font-size: 14px;
    white-space: normal;
    word-wrap: break-word;
    vertical-align: top;
}

/* Ensure action buttons are visible in customer table */
.data-table td.customer-actions {
    white-space: nowrap;
    overflow: visible;
    max-width: none;
}

.data-table tbody tr:hover {
    background: var(--gray-lighter);
}

.text-center {
    text-align: center;
}

/* Inventory Table - Use same style as history table */
/* Removed specific styles to use .data-table common styles */

/* Editable cells - Clean & Fast */
.editable-inventory {
    cursor: text;
    position: relative;
    transition: all 0.2s ease;
    border-radius: 3px;
    outline: none;
}

.editable-inventory:hover {
    background-color: #f0f7ff;
}

.editable-inventory:focus,
.editable-inventory.editing {
    background-color: #fff;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
    outline: none;
    border-radius: 3px;
}

.editable-inventory.saving {
    background-color: #fff9e6;
}

.editable-inventory.saved {
    background-color: #e8f5e9;
    animation: savedFlash 0.5s ease;
}

@keyframes savedFlash {
    0% { background-color: #c8e6c9; }
    100% { background-color: #e8f5e9; }
}

/* Delete button - Simple icon */
.btn-icon {
    background: none;
    border: none;
    padding: 6px 8px;
    cursor: pointer;
    color: var(--gray);
    border-radius: 3px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background-color: #fee;
    color: var(--danger);
}

.btn-icon.btn-delete:hover {
    background-color: #fee;
    color: var(--danger);
}

.btn-icon i {
    font-size: 14px;
}

/* Category dropdown */
.category-dropdown {
    background: white;
    border: 1px solid var(--gray-light);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 10000;
    position: fixed;
}

/* Smooth scrollbar for dropdown */
.category-dropdown::-webkit-scrollbar {
    width: 6px;
}

.category-dropdown::-webkit-scrollbar-track {
    background: var(--gray-lighter);
    border-radius: 3px;
}

.category-dropdown::-webkit-scrollbar-thumb {
    background: var(--gray-light);
    border-radius: 3px;
}

.category-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--gray);
}

.category-dropdown-item {
    padding: 10px 12px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    font-size: 13px;
    white-space: nowrap;
    border-bottom: 1px solid var(--gray-lighter);
}

.category-dropdown-item:last-child {
    border-bottom: none;
}

.category-dropdown-item:hover {
    background-color: #f0f7ff;
}

.category-dropdown-item.selected {
    background-color: #e3f2fd;
    font-weight: 500;
    color: var(--primary);
}

.text-muted {
    color: var(--gray);
    font-style: italic;
}

.editable-inventory-select:hover {
    background-color: #f0f7ff;
}

.editable-inventory-select.editing {
    background-color: #fff;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

/* Report Page Styles */
.report-filters {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: var(--white);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-lg);
}

.report-filters-header {
    margin-bottom: 10px;
    display: none;
}

.report-filters-header .filter-chevron {
    transition: transform 0.2s;
}

.report-filters--collapsed .report-filters-header .filter-chevron {
    transform: rotate(-90deg);
}

.report-filters--collapsed .report-filters-body {
    display: none !important;
}

/* Desktop: luôn hiện bộ lọc (header ẩn) */
@media (min-width: 769px) {
    .report-filters--collapsed .report-filters-body {
        display: flex !important;
    }
}

.report-filters-body {
    display: flex;
    align-items: flex-end;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.filter-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--dark);
}

.filter-group .form-control {
    min-width: 150px;
}

.report-card {
    background: var(--white);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-lg);
}

.report-header {
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 2px solid var(--gray-lighter);
}

.report-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--dark);
    margin: 0;
}

.report-content {
    margin-top: var(--spacing-md);
}

#salesByBrandTable .total-row,
.sales-by-sale-table .total-row {
    background-color: #f8f9fa;
    font-weight: 600;
    border-top: 2px solid var(--gray-light);
}

#salesByBrandTable .total-row td,
.sales-by-sale-table .total-row td {
    padding: 12px;
    font-size: 14px;
}

.text-right {
    text-align: right;
}

/* Report Tabs */
.report-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: var(--spacing-lg);
    border-bottom: 2px solid var(--gray-lighter);
    flex-wrap: wrap;
}

.report-tab {
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-dark);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.report-tab:hover {
    color: var(--primary);
    background: rgba(74, 144, 226, 0.05);
}

.report-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: rgba(74, 144, 226, 0.05);
}

.report-tab i {
    font-size: 16px;
}

.report-tab-content {
    display: none;
}

.report-tab-content.active {
    display: block;
}

/* Overview Section */
.overview-section {
    margin-bottom: var(--spacing-xl);
}

.overview-section-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid var(--primary);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.overview-section-title::before {
    content: '';
    width: 4px;
    height: 24px;
    background: var(--primary);
    border-radius: 2px;
}

/* Overview Tables Grid */
.overview-tables-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.overview-tables-grid .report-card {
    margin-bottom: 0;
}

.overview-tables-grid .report-content {
    padding: var(--spacing-md);
    min-height: auto;
}

.overview-tables-grid .data-table {
    font-size: 13px;
}

.overview-tables-grid .data-table th {
    padding: 10px 8px;
    font-size: 12px;
    white-space: nowrap;
}

.overview-tables-grid .data-table td {
    padding: 10px 8px;
    font-size: 13px;
}

/* Report Summary Cards */
.report-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.summary-card {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    transition: transform 0.2s, box-shadow 0.2s;
}

/* Overview charts - Full width, one per row */
.report-overview-charts {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xl);
    margin-top: var(--spacing-lg);
}

.report-overview-charts .report-card {
    width: 100%;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 4px 16px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
    overflow: hidden;
    will-change: box-shadow, border-color;
}

.report-overview-charts .report-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1), 0 8px 24px rgba(0, 0, 0, 0.06);
    border-color: rgba(74, 144, 226, 0.2);
}

.report-overview-charts .report-header {
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.05) 0%, rgba(74, 144, 226, 0.02) 100%);
    padding: var(--spacing-md) var(--spacing-lg);
    margin: 0;
    border-bottom: 2px solid rgba(74, 144, 226, 0.1);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.report-overview-charts .report-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--dark);
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.report-overview-charts .report-header h3::before {
    content: '';
    width: 4px;
    height: 24px;
    background: linear-gradient(135deg, var(--primary) 0%, #5ba0f5 100%);
    border-radius: 2px;
    display: inline-block;
}

.report-overview-charts .report-content {
    padding: var(--spacing-lg);
    margin: 0;
    min-height: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
}

.report-overview-charts canvas {
    width: 100% !important;
    max-height: 400px !important;
    height: auto !important;
}

/* Report tables with brand breakdown */
.report-card .data-table small.text-muted {
    font-size: 11px;
}

.summary-card {
    will-change: box-shadow;
}

.summary-card:hover {
    box-shadow: var(--shadow-md);
}

.summary-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    flex-shrink: 0;
}

.summary-content {
    flex: 1;
}

.summary-label {
    font-size: 13px;
    color: var(--gray-dark);
    margin-bottom: 4px;
}

.summary-value {
    font-size: 24px;
    font-weight: 600;
    color: var(--dark);
}

/* Badge */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-primary {
    background: rgba(74, 144, 226, 0.1);
    color: var(--primary);
}

.badge-success {
    background: rgba(39, 174, 96, 0.1);
    color: var(--success);
}

.badge-danger {
    background: rgba(231, 76, 60, 0.1);
    color: var(--danger);
}

/* Autocomplete */
.autocomplete-wrapper {
    position: relative;
}

.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--gray-lighter);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: var(--shadow-lg);
}

.autocomplete-list.show {
    display: block;
}

.autocomplete-item {
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background: var(--primary);
    color: white;
}

/* Radio Group */
.radio-group {
    display: flex;
    gap: var(--spacing-lg);
    margin-top: var(--spacing-sm);
}

.radio-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
}

.radio-label input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-light);
    border-radius: 50%;
    position: relative;
    transition: all 0.2s;
}

.radio-label input[type="radio"]:checked + .radio-custom {
    border-color: var(--primary);
}

.radio-label input[type="radio"]:checked + .radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
}

.radio-success.radio-custom {
    border-color: var(--success);
}

.radio-label input[type="radio"]:checked + .radio-success {
    border-color: var(--success);
}

.radio-label input[type="radio"]:checked + .radio-success::after {
    background: var(--success);
}

.radio-danger.radio-custom {
    border-color: var(--danger);
}

.radio-label input[type="radio"]:checked + .radio-danger {
    border-color: var(--danger);
}

.radio-label input[type="radio"]:checked + .radio-danger::after {
    background: var(--danger);
}

.radio-text {
    font-weight: 500;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideDown 0.3s;
    margin: 0;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 18px;
    color: var(--dark);
    margin: 0;
    font-weight: 600;
}

.close {
    font-size: 28px;
    font-weight: bold;
    color: var(--gray);
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: var(--dark);
}

.modal-body {
    padding: 20px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.modal-body .form-group {
    margin-bottom: 12px;
}

.modal-body .form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}

.modal-body .form-row .form-group {
    margin-bottom: 0;
    flex: 1;
    min-width: 0;
}

.modal-body .form-row .form-group[style*="flex: 0 0"] {
    flex-shrink: 0;
}

.modal-body .form-text {
    margin-top: 4px;
    font-size: 11px;
    line-height: 1.4;
    color: #666;
}

/* Compact table in modals */
.modal-body .data-table {
    font-size: 13px;
    table-layout: fixed;
    width: 100%;
}

.modal-body .data-table th {
    padding: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal-body .data-table td {
    padding: 8px;
    vertical-align: middle;
}

.modal-body .data-table th {
    font-size: 12px;
    font-weight: 600;
    background: #f5f5f5;
}

/* Đảm bảo input trong table có thể nhìn thấy */
.modal-body .data-table input[type="number"],
.modal-body .data-table input[type="text"] {
    width: 100%;
    min-width: 0;
    padding: 6px 8px;
    font-size: 13px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: #f9f9f9;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 16px 24px;
    background: var(--dark);
    color: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 3000;
    display: none;
    animation: slideInRight 0.3s;
    min-width: 300px;
}

.toast.show {
    display: block;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

.toast.warning {
    background: var(--warning);
}

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

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

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Filters Card */
.filters-card {
    background: var(--white);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-md);
}

.filters-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--spacing-md);
    align-items: end;
}

.filter-card {
    background: var(--white);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-lg);
}

/* Trang công việc: thu gọn bộ lọc */
.filter-card--collapsed .filter-card-header .filter-chevron {
    transform: rotate(-90deg);
}
.filter-card--collapsed #congViecFilterBody {
    display: none !important;
}
#page-cong-viec .filter-card-header {
    margin-bottom: 0;
}
#page-cong-viec .filter-card--collapsed .filter-card-header {
    margin-bottom: 0;
}

.filter-body {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.filter-single-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 8px;
    padding-bottom: 4px;
    overflow-x: auto;
}

.filter-single-row .form-group {
    margin-bottom: 0;
    min-width: 0;
    flex: 0 1 auto;
    flex-shrink: 1;
}

.filter-single-row .form-group label {
    margin-bottom: 4px;
    font-size: 11px;
    white-space: nowrap;
    display: block;
    font-weight: 500;
    color: var(--dark);
}

.filter-single-row .form-group input,
.filter-single-row .form-group select {
    min-width: 100px;
    max-width: 150px;
    width: 100%;
    font-size: 12px;
    padding: 6px 8px;
    height: auto;
    min-height: 34px;
}

.filter-single-row .autocomplete-wrapper {
    position: relative;
    min-width: 100px;
    max-width: 150px;
    width: 100%;
}

.filter-single-row .autocomplete-wrapper input {
    font-size: 12px;
    padding: 6px 8px;
    height: auto;
    min-height: 34px;
}

/* Override inline flex styles for better responsive */
.filter-single-row .form-group[style*="flex: 1"] {
    min-width: 100px;
    max-width: 150px;
    flex: 0 1 auto !important;
}

.filter-single-row .form-group[style*="flex: 0 0 auto"] {
    flex: 0 0 auto !important;
    min-width: auto;
}

.filter-single-row .form-group[style*="flex: 0 0 auto"] > div {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
}

.filter-single-row .btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    height: auto;
    min-height: 34px;
    white-space: nowrap;
    flex: 0 0 auto;
    min-width: auto;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-size: 12px;
    font-weight: 500;
    margin-bottom: var(--spacing-xs);
    color: var(--gray);
}

/* Mini Statistics */
/* Warehouse Controls Row - All in one line */
.warehouse-controls-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    background: var(--white);
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
}

.warehouse-stats-inline {
    display: flex;
    align-items: center;
    gap: var(--spacing-xl);
    flex: 1;
    justify-content: flex-end;
}

.stat-inline-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 120px;
}

.stat-inline-label {
    font-size: 12px;
    color: var(--gray);
    margin-bottom: var(--spacing-xs);
    text-align: center;
}

.stat-inline-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--dark);
}

.stat-inline-value.text-success {
    color: var(--success);
}

.stat-inline-value.text-danger {
    color: var(--danger);
}

/* Legacy stats-mini for backward compatibility */
.stats-mini {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.stat-mini {
    background: var(--white);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.stat-mini-label {
    font-size: 12px;
    color: var(--gray);
    margin-bottom: var(--spacing-xs);
}

.stat-mini-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--dark);
}

.stat-mini-value.text-success {
    color: var(--success);
}

.stat-mini-value.text-danger {
    color: var(--danger);
}

/* Modal Large */
.modal-large {
    max-width: 1100px;
}

/* Modal Công Việc - Thu gọn form, mỗi ô một dòng */
#congViecModal .modal-header {
    padding: 10px 14px;
}
#congViecModal .modal-header h2 {
    font-size: 16px;
}
#congViecModal .modal-body {
    padding: 12px 14px;
}
#congViecModal .modal-footer {
    padding: 10px 14px;
}
#congViecModal .form-row {
    margin-bottom: 6px;
    gap: 8px;
}
#congViecModal .form-row .form-group {
    margin-bottom: 0;
}
#congViecModal .form-group {
    margin-bottom: 6px;
}
#congViecModal .form-group:last-child {
    margin-bottom: 0;
}
#congViecModal .form-group label {
    margin-bottom: 2px;
    font-size: 12px;
    font-weight: 500;
}
#congViecModal .form-control {
    padding: 5px 8px;
    font-size: 13px;
    min-height: 32px;
    height: auto;
    line-height: 1.35;
}
#congViecModal select.form-control {
    padding: 5px 8px;
    min-height: 32px;
}
#congViecModal textarea.form-control {
    padding: 5px 8px;
    font-size: 13px;
    line-height: 1.35;
    min-height: 52px;
}
#congViecModal #tho_lap_group {
    min-height: 32px !important;
    padding: 4px 8px !important;
    gap: 8px !important;
}
#congViecModal #tho_lap_group label {
    margin-bottom: 0;
    font-size: 12px;
}
#congViecModal .form-row .form-row {
    margin-bottom: 6px;
}
#congViecModal .form-group .table-responsive {
    max-height: 180px;
}
#congViecModal #sanPhamCVTable th,
#congViecModal #sanPhamCVTable td {
    padding: 4px 6px;
    font-size: 12px;
}
#congViecModal .form-group div[style*="justify-content: space-between"] {
    padding: 6px 10px;
    font-size: 12px;
}
#congViecModal .form-group div[style*="justify-content: space-between"] .form-control {
    padding: 4px 8px;
    font-size: 13px;
    min-height: 30px;
}
#congViecModal label[for="phi_ship_mien_phi_khach"] {
    font-size: 12px;
}
#congViecModal .btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

/* Modal Công Việc - Responsive */
@media (max-width: 768px) {
    #congViecModal .modal-content {
        width: 98%;
        max-width: 98%;
        max-height: 95vh;
        margin: 8px auto;
        display: flex;
        flex-direction: column;
    }
    #congViecModal .modal-header {
        padding: 10px 12px;
        flex-shrink: 0;
    }
    #congViecModal .modal-header h2 {
        font-size: 15px;
        flex: 1;
        min-width: 0;
        padding-right: 8px;
    }
    #congViecModal .modal-header .close {
        font-size: 24px;
        flex-shrink: 0;
    }
    #congViecModal .modal-body {
        padding: 12px;
        max-height: calc(100vh - 140px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        flex: 1;
        min-height: 0;
    }
    #congViecModal .modal-footer {
        padding: 10px 12px;
        flex-wrap: wrap;
        gap: 8px;
        flex-shrink: 0;
    }
    #congViecModal .modal-footer .btn {
        min-width: 0;
        flex: 1;
    }
    /* Form rows: gom nhiều ô một dòng như desktop, thu gọn */
    #congViecModal .form-row {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
        margin-bottom: 6px;
    }
    #congViecModal .form-row .form-group {
        flex: 1 1 calc(50% - 6px) !important;
        min-width: 0 !important;
        max-width: none !important;
    }
    /* Hàng 1: Ngày, Loại CV, Loại khách (3 ô) | Số ĐT, Tên khách (2 ô) */
    #congViecModal #formCongViec > .form-row:first-child .form-group:nth-child(1),
    #congViecModal #formCongViec > .form-row:first-child .form-group:nth-child(2),
    #congViecModal #formCongViec > .form-row:first-child .form-group:nth-child(3) {
        flex: 1 1 calc(33.333% - 6px) !important;
    }
    #congViecModal #formCongViec > .form-row:first-child .form-group:nth-child(4) {
        flex: 0 1 calc(40% - 6px) !important;
    }
    #congViecModal #formCongViec > .form-row:first-child .form-group:nth-child(5) {
        flex: 1 1 calc(60% - 6px) !important;
    }
    /* Tỉnh/TP, Quận/Huyện - 2 ô một dòng */
    #congViecModal #khachLeInfoRow .form-group,
    #congViecModal #khachLeInfoRow2 .form-group {
        flex: 1 1 calc(50% - 6px) !important;
    }
    /* Địa chỉ đầy đủ - 1 ô full */
    #congViecModal #khachLeInfoRow3 .form-group {
        flex: 1 1 100% !important;
    }
    /* Công nợ: 4 ô - 2x2 */
    #congViecModal #congNoFields .form-group {
        flex: 1 1 calc(50% - 6px) !important;
    }
    /* Sale + Kỹ thuật - mặc định 2 ô một dòng (flex 50%) */
    /* Nested: Phương thức, Phí ship, Checkbox - 3 ô gom */
    #congViecModal #loaiCongViecOptions .form-group {
        flex: 1 1 calc(33.333% - 6px) !important;
        min-width: 90px;
    }
    #congViecModal #loaiCongViecOptions .form-group[style*="margin-left"] {
        margin-left: 0 !important;
        flex: 1 1 100% !important; /* Checkbox full dòng */
    }
    /* Radio "Mua trực tiếp / Cho khách khác" - một dòng */
    #congViecModal #daiLyOptionsRow > .form-group > div {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
    }
    #congViecModal .form-row .form-row {
        margin-bottom: 6px;
        margin-left: 0;
        flex: 1 1 100%;
    }
    /* Bảng sản phẩm: scroll ngang, chữ nhỏ */
    #congViecModal .form-group .table-responsive {
        max-height: 160px;
        overflow-x: auto;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -4px;
    }
    #congViecModal #sanPhamCVTable {
        font-size: 11px;
        min-width: 700px;
    }
    #congViecModal #sanPhamCVTable th,
    #congViecModal #sanPhamCVTable td {
        padding: 4px 6px;
    }
    /* Hàng Số Tiền + Tổng: một dòng, thu gọn */
    #congViecModal .form-group div[style*="justify-content: space-between"] {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        align-items: center;
    }
    #congViecModal .form-group div[style*="justify-content: space-between"] .form-control {
        width: 120px !important;
        max-width: none;
    }
    /* Label checkbox "Miễn phí ship" không bị cắt */
    #congViecModal label[for="phi_ship_mien_phi_khach"] {
        flex-wrap: wrap;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    #congViecModal.modal {
        align-items: flex-start;
        padding: 0;
    }
    #congViecModal .modal-content {
        width: 100%;
        max-width: 100%;
        margin: 0;
        max-height: 100vh;
        border-radius: 0;
    }
    #congViecModal .modal-body {
        max-height: calc(100vh - 120px);
        padding: 10px;
    }
    #congViecModal .modal-header h2 {
        font-size: 14px;
    }
    /* Màn rất nhỏ: 2 ô một dòng */
    #congViecModal #formCongViec > .form-row:first-child .form-group:nth-child(1),
    #congViecModal #formCongViec > .form-row:first-child .form-group:nth-child(2),
    #congViecModal #formCongViec > .form-row:first-child .form-group:nth-child(3) {
        flex: 1 1 calc(50% - 6px) !important;
    }
    #congViecModal #loaiCongViecOptions .form-group {
        flex: 1 1 calc(50% - 6px) !important;
        min-width: 0;
    }
    #congViecModal #sanPhamCVTable {
        font-size: 10px;
        min-width: 600px;
    }
    #congViecModal .btn-sm {
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* Badge Variants */
.badge-info {
    background: rgba(52, 152, 219, 0.1);
    color: var(--info);
}

.badge-warning {
    background: rgba(243, 156, 18, 0.1);
    color: var(--warning);
}

/* Search Box Inline */
.search-box-inline {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box-inline i {
    position: absolute;
    left: 12px;
    color: var(--gray);
}

.search-box-inline input {
    padding: 10px 12px 10px 40px;
    border: 1px solid var(--gray-lighter);
    border-radius: var(--radius-md);
    width: 300px;
    font-size: 14px;
}

/* Button Small */
.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* Table Improvements */
.data-table th {
    white-space: nowrap;
}

.data-table td {
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Report Tables - Specific Column Widths */
#salesByBrandTable th:nth-child(1),
#salesByCategoryTable th:nth-child(1) { width: 25%; }
#salesByBrandTable th:nth-child(2),
#salesByCategoryTable th:nth-child(2) { width: 15%; text-align: right; }
#salesByBrandTable th:nth-child(3),
#salesByCategoryTable th:nth-child(3) { width: 15%; text-align: right; }
#salesByBrandTable th:nth-child(4),
#salesByCategoryTable th:nth-child(4) { width: 15%; text-align: right; }
#salesByBrandTable th:nth-child(5),
#salesByCategoryTable th:nth-child(5) { width: 30%; text-align: right; }

#salesByProductTable th:nth-child(1) { width: 5%; text-align: right; }
#salesByProductTable th:nth-child(2) { width: 25%; }
#salesByProductTable th:nth-child(3) { width: 15%; }
#salesByProductTable th:nth-child(4) { width: 10%; }
#salesByProductTable th:nth-child(5) { width: 12%; text-align: right; }
#salesByProductTable th:nth-child(6) { width: 10%; text-align: right; }
#salesByProductTable th:nth-child(7) { width: 23%; text-align: right; }

#salesByCustomerTable th:nth-child(1) { width: 5%; text-align: right; }
#salesByCustomerTable th:nth-child(2) { width: 35%; }
#salesByCustomerTable th:nth-child(3) { width: 20%; }
#salesByCustomerTable th:nth-child(4) { width: 15%; text-align: right; }
#salesByCustomerTable th:nth-child(5) { width: 25%; text-align: right; }

/* Work Management Table - Fix overlapping columns, font nhỏ để hiển thị nhiều thông tin */
#congViecTable {
    table-layout: auto;
    width: 100%;
    min-width: 100%;
    font-size: 0.8rem;
}

#congViecTable th,
#congViecTable td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 4px 6px;
}

/* Hàng dữ liệu: giới hạn chiều cao, không để wrap làm hàng quá cao */
#congViecTable tbody tr.work-main-row td {
    max-height: 2.6em;
    line-height: 1.25;
    vertical-align: middle;
}

#congViecTable th:nth-child(1),
#congViecTable td:nth-child(1) { 
    width: 70px;
    min-width: 70px;
    max-width: 70px;
    white-space: pre-line;
    text-align: center;
    font-size: 0.9em;
    max-height: 2.8em;
    overflow: hidden;
    line-height: 1.2;
} /* Ngày */

#congViecTable th:nth-child(2),
#congViecTable td:nth-child(2) { 
    width: 100px;
    min-width: 100px;
    max-width: 100px;
} /* Loại */

#congViecTable th:nth-child(3),
#congViecTable td:nth-child(3) { 
    width: 120px;
    min-width: 120px;
    position: sticky;
    left: 170px; /* 70px (Ngày) + 100px (Loại) */
    background-color: var(--white);
    z-index: 5;
    box-shadow: 2px 0 4px rgba(0,0,0,0.1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
} /* Tên Khách - không luồn/wrap */

/* Đảm bảo header của cột Tên Khách có background đúng */
#congViecTable thead th:nth-child(3) {
    background-color: var(--gray-lighter) !important;
    z-index: 6;
}

#congViecTable th:nth-child(4),
#congViecTable td:nth-child(4) { 
    width: 100px;
    min-width: 100px;
} /* Tên Đại Lý */

#congViecTable th:nth-child(5),
#congViecTable td:nth-child(5) { 
    width: 100px;
    min-width: 100px;
} /* Số ĐT */

#congViecTable th:nth-child(6),
#congViecTable td:nth-child(6) { 
    width: 200px;
    min-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
} /* Địa Chỉ - không wrap, ellipsis */

#congViecTable th:nth-child(7),
#congViecTable td:nth-child(7) { 
    width: 200px;
    min-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
} /* Sản Phẩm - không wrap, ellipsis */

#congViecTable th:nth-child(8),
#congViecTable td:nth-child(8) { 
    width: 100px;
    min-width: 100px;
    max-width: 100px;
} /* Tổng Tiền */

#congViecTable th:nth-child(9),
#congViecTable td:nth-child(9) { 
    width: 100px;
    min-width: 100px;
    max-width: 100px;
} /* Đã Trả */

#congViecTable th:nth-child(10),
#congViecTable td:nth-child(10) { 
    width: 100px;
    min-width: 100px;
    max-width: 100px;
} /* Công Nợ */

#congViecTable th:nth-child(11),
#congViecTable td:nth-child(11) { 
    width: 100px;
    min-width: 100px;
    max-width: 100px;
} /* Phí Ship */

#congViecTable th:nth-child(12),
#congViecTable td:nth-child(12) { 
    width: 80px;
    min-width: 80px;
    max-width: 80px;
} /* Sale */

#congViecTable th:nth-child(13),
#congViecTable td:nth-child(13) { 
    width: 100px;
    min-width: 100px;
    max-width: 100px;
} /* Kỹ thuật */

#congViecTable th:nth-child(14),
#congViecTable td:nth-child(14) { 
    width: 150px;
    min-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
} /* Ghi Chú - không wrap */

#congViecTable th:nth-child(15),
#congViecTable td:nth-child(15) { 
    width: 200px;
    min-width: 200px;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
} /* Nội Dung - không wrap */

#congViecTable th:nth-child(16),
#congViecTable td:nth-child(16) { 
    width: 100px;
    min-width: 100px;
    max-width: 100px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
} /* Người Tạo - không wrap */

/* Cột Thao Tác - cột cuối cùng (17 nếu admin, 15 nếu không phải admin) */
#congViecTable th:last-child,
#congViecTable td:last-child,
#congViecTable th.thao-tac-column,
#congViecTable td.thao-tac-column { 
    width: auto !important;
    min-width: 150px !important;
    max-width: none !important;
    white-space: normal !important;
    position: sticky !important;
    right: 0 !important;
    background-color: var(--white) !important;
    z-index: 10 !important;
    box-shadow: -2px 0 4px rgba(0,0,0,0.1) !important;
    padding: 8px !important;
    text-align: center !important;
    display: table-cell !important;
    visibility: visible !important;
    opacity: 1 !important;
} /* Thao Tác */

/* Ẩn cột Thao tác khi bấm nút (chỉ header + ô thao tác của hàng dữ liệu, không ẩn hàng chi tiết mở rộng) */
#congViecTable.hide-thao-tac th:last-child,
#congViecTable.hide-thao-tac tbody tr.work-main-row td:last-child,
#congViecTable.hide-thao-tac th.thao-tac-column,
#congViecTable.hide-thao-tac tbody tr.work-main-row td.thao-tac-column {
    display: none !important;
}

/* Style for action buttons container in work table - 2 rows layout */
#congViecTable td:last-child > div {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 3px;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    max-height: 70px; /* Giới hạn chiều cao để chỉ hiển thị 2 hàng */
    overflow: hidden;
}

#congViecTable td:last-child .btn-sm {
    padding: 4px 6px;
    font-size: 11px;
    min-width: auto;
    width: auto;
    max-width: calc(50% - 2px); /* Mỗi nút chiếm tối đa 50% trừ gap */
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

/* Product detail rows should span full width and not affect column widths */
#congViecTable tr.product-detail-row {
    position: relative;
    z-index: 20;
}

#congViecTable tr.product-detail-row td {
    white-space: normal;
    overflow: visible;
    position: relative;
    z-index: 20;
    padding: 12px !important;
    background-color: #f8f9fa !important;
    border-top: 2px solid #dee2e6 !important;
}

/* Override any column width restrictions for product detail row */
#congViecTable tr.product-detail-row td[colspan="17"],
#congViecTable tr.product-detail-row td[colspan="15"] {
    width: 100% !important;
    max-width: none !important;
    min-width: 100% !important;
}

/* Ensure table-responsive wrapper allows horizontal scroll */
.table-card .table-responsive {
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch;
    width: 100% !important;
    position: relative !important;
    max-width: 100% !important;
}

/* Bảng: tối thiểu bằng nội dung (scroll ngang khi hẹp), rộng 100% khi container rộng (không dư khoảng trống) */
#congViecTable {
    min-width: max-content;
    width: 100%;
}

/* Ensure sticky column works in table-responsive - chỉ áp dụng cho cột cuối cùng (Thao Tác) */
.table-responsive #congViecTable th:last-child,
.table-responsive #congViecTable td:last-child {
    position: sticky !important;
    right: 0 !important;
    background-color: var(--white) !important;
    z-index: 10 !important;
    box-shadow: -2px 0 4px rgba(0,0,0,0.1) !important;
    display: table-cell !important;
    visibility: visible !important;
}

/* Ensure sticky column works for Tên Khách in table-responsive */
.table-responsive #congViecTable th:nth-child(3),
.table-responsive #congViecTable td:nth-child(3) {
    position: sticky !important;
    left: 170px !important; /* 70px (Ngày) + 100px (Loại) */
    background-color: var(--white) !important;
    z-index: 5 !important;
    box-shadow: 2px 0 4px rgba(0,0,0,0.1) !important;
}

/* Ensure header sticky column has higher z-index */
.table-responsive #congViecTable thead th:last-child {
    z-index: 11 !important;
    display: table-cell !important;
    visibility: visible !important;
}

.table-responsive #congViecTable thead th:nth-child(3) {
    z-index: 6 !important;
    background-color: var(--gray-lighter) !important;
    position: sticky !important;
    left: 170px !important;
    box-shadow: 2px 0 4px rgba(0,0,0,0.1) !important;
}

#salesByInstallerTable th:nth-child(1) { width: 30%; }
#salesByInstallerTable th:nth-child(2) { width: 20%; text-align: right; }
#salesByInstallerTable th:nth-child(3) { width: 50%; text-align: right; }

/* Sales by Sale Table - 5 columns (không có cột Tên Sale vì mỗi bảng là một sale) */
.sales-by-sale-table th:nth-child(1) { width: 12%; } /* Ngày */
.sales-by-sale-table th:nth-child(2) { width: 18%; } /* Loại Công Việc */
.sales-by-sale-table th:nth-child(3) { width: 12%; text-align: right; } /* Số Lượng */
.sales-by-sale-table th:nth-child(4) { width: 40%; } /* Tên Sản Phẩm */
.sales-by-sale-table th:nth-child(5) { width: 18%; text-align: right; } /* Tổng Tiền */

.sales-by-sale-table td:nth-child(3),
.sales-by-sale-table td:nth-child(5) {
    text-align: right;
    }
    
.sale-table-container {
    margin-bottom: 30px;
    }
    
.sale-table-container h4 {
    margin-bottom: 15px;
    padding: 10px 15px;
    background: #f8f9fa;
    border-left: 4px solid var(--primary);
    border-radius: 4px;
        font-size: 16px;
    color: var(--dark);
    }
    
#revenueTable th:nth-child(1) { width: 15%; }
#revenueTable th:nth-child(2) { width: 12%; text-align: right; }
#revenueTable th:nth-child(3) { width: 25%; text-align: right; }
#revenueTable th:nth-child(4) { width: 24%; text-align: right; }
#revenueTable th:nth-child(5) { width: 24%; text-align: right; }

/* Form Improvements */
.form-control-sm {
    padding: 8px 12px;
    font-size: 13px;
    }

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    .topbar {
        flex-direction: column;
        gap: var(--spacing-md);
        align-items: flex-start;
    }
    
    .mobile-menu-btn {
        display: flex;
    }
    
    .search-box input {
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .charts-row {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .modal-body .form-row {
        flex-direction: column;
    }
    
    .modal-body .form-row .form-group {
        flex: 1 1 100% !important;
        width: 100%;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-md);
    }
    
    .filters-row {
        grid-template-columns: 1fr;
    }
    
    .stats-mini {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .search-box-inline input {
        width: 100%;
    }
    
    .modal-large {
        width: 95%;
        max-width: 95%;
    }

    /* Dashboard (Báo cáo) - Responsive */
    #page-bao-cao .report-filters-header {
        display: block;
    }
    #page-bao-cao .report-filters {
        padding: 10px 12px;
    }
    #page-bao-cao .report-filters-body {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
    }
    #page-bao-cao .report-filters .filter-group {
        flex: 1 1 calc(50% - 6px);
        min-width: 120px;
    }
    #page-bao-cao .report-filters .filter-group .form-control {
        min-width: 0;
        width: 100%;
    }
    #page-bao-cao .report-filters .filter-group:last-child {
        flex: 1 1 100%;
    }
    #page-bao-cao .report-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
        margin-bottom: var(--spacing-md);
    }
    #page-bao-cao .report-tab {
        padding: 8px 12px;
        font-size: 12px;
        white-space: nowrap;
        flex-shrink: 0;
    }
    #page-bao-cao .report-tab i {
        font-size: 14px;
    }
    #page-bao-cao .report-summary-cards {
        gap: var(--spacing-sm);
    }
    #page-bao-cao .summary-card {
        padding: var(--spacing-md);
    }
    #page-bao-cao .overview-tables-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }
    #page-bao-cao .overview-section-title {
        font-size: 16px;
    }
    #page-bao-cao .overview-section {
        margin-bottom: var(--spacing-lg);
    }
    #page-bao-cao .report-card {
        padding: var(--spacing-md);
        margin-bottom: var(--spacing-md);
    }
    #page-bao-cao .report-header {
        margin-bottom: var(--spacing-md);
        padding-bottom: var(--spacing-sm);
    }
    #page-bao-cao .report-card .data-table {
        font-size: 12px;
    }
    #page-bao-cao .report-card .data-table th {
        padding: 8px 6px;
        font-size: 11px;
    }
    #page-bao-cao .report-card .data-table td {
        padding: 8px 6px;
    }
    
    .filter-single-row {
        flex-wrap: wrap;
        gap: var(--spacing-sm);
    }
    
    .filter-single-row .form-group {
        flex: 1 1 calc(50% - var(--spacing-sm));
        min-width: 140px;
    }
    
    .filter-single-row .form-group input,
    .filter-single-row .form-group select {
        min-width: 100%;
        max-width: 100%;
    }
    
    .filter-single-row .autocomplete-wrapper {
        min-width: 100%;
        max-width: 100%;
    }
}


/* Export Menu Styles */
.export-menu-wrapper {
    position: relative;
    display: inline-block;
}

.export-menu {
    position: absolute;
    right: 0;
    top: 100%;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 1000;
    min-width: 180px;
    margin-top: 4px;
}

.export-menu-item {
    display: block;
    padding: 8px 12px;
    text-decoration: none;
    color: #333;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s;
}

.export-menu-item:last-child {
    border-bottom: none;
}

.export-menu-item:hover {
    background-color: #f5f5f5;
    color: #4A90E2;
}

.export-menu-item i {
    margin-right: 8px;
    width: 16px;
}

/* Customer table improvements */
#customerTable th:nth-child(1) { width: 60px; }
#customerTable th:nth-child(2) { width: 18%; min-width: 160px; }
#customerTable th:nth-child(3) { width: 12%; min-width: 120px; }
#customerTable th:nth-child(4) { width: 30%; min-width: 220px; }
#customerTable th:nth-child(5) { width: 10%; min-width: 100px; }
#customerTable th:nth-child(6) { width: 15%; min-width: 150px; }
#customerTable th:nth-child(7) { width: 12%; min-width: 120px; }

.customer-address {
    max-width: 100%;
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}
.customer-address.expandable {
    cursor: pointer;
}
.customer-address.expanded {
    white-space: normal;
}

/* Topbar UI/UX improvements */
.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 20px;
    background: #ffffff;
    border-bottom: 1px solid #eef1f6;
    box-shadow: 0 6px 18px rgba(0,0,0,0.05);
}
.topbar .page-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #1f2d3d;
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.topbar .search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f3f6fb;
    border: 1px solid #e3e7ed;
    border-radius: 10px;
    padding: 8px 10px;
    min-width: 220px;
}
.topbar .search-box input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    font-size: 14px;
}
.user-menu {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 1px solid #e3e7ed;
    border-radius: 12px;
    background: #fff;
}
.user-menu .user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}
.notification-container {
    position: relative;
}
.notification-panel {
    position: absolute;
    right: 0;
    top: 46px;
    width: 320px;
    max-height: 420px;
    overflow: auto;
    background: #fff;
    border: 1px solid #e3e7ed;
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.12);
    padding: 10px;
}
.notif-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    font-weight: 700;
}
.notif-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.notif-item {
    padding: 10px;
    border-radius: 10px;
    border: 1px solid #eef1f6;
    background: #f9fbff;
}
.notif-item.unread {
    border-color: #3b82f6;
    background: #e9f1ff;
}
.notif-title {
    font-weight: 700;
    margin-bottom: 4px;
}
.notif-message {
    font-size: 13px;
    color: #4b5563;
}
.notif-time {
    font-size: 12px;
    color: #6b7280;
}

/* Customer orders table */
#customerOrdersTable th:nth-child(1) { width: 40px; text-align: center; }
#customerOrdersTable th:nth-child(2) { width: 70px; }
#customerOrdersTable th:nth-child(3) { width: 110px; }
#customerOrdersTable th:nth-child(4) { width: 32%; min-width: 240px; }
#customerOrdersTable th:nth-child(5) { width: 110px; }
#customerOrdersTable th:nth-child(6) { width: 130px; }
#customerOrdersTable th:nth-child(7) { width: 120px; }
#customerOrdersTable th:nth-child(8) { width: 110px; }
#customerOrdersTable td:first-child { text-align: center; }
.order-note {
    max-width: 100%;
    display: inline-block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.order-note.expandable {
    cursor: pointer;
}
.order-congno.badge-success {
    background: rgba(46, 204, 113, 0.15);
    color: #27AE60;
}
.order-congno.badge-warning {
    background: rgba(243, 156, 18, 0.15);
    color: #F39C12;
}
.order-congno.badge-danger {
    background: rgba(231, 76, 60, 0.15);
    color: #E74C3C;
}

/* Customer orders modal refinements */
#customerOrdersModal .modal-content {
    max-width: 900px;
}

/* Compact customer filter bar layout */
#page-khach-hang .filter-card .filter-body {
    flex-wrap: wrap;
}
#page-khach-hang .filter-card .stats-mini {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}
#page-khach-hang .filter-card .stat-mini {
    background: transparent;
    box-shadow: none;
    padding: 0;
    text-align: left;
    min-width: 70px;
}
#page-khach-hang .filter-card .stat-mini-label {
    font-size: 11px;
    margin-bottom: 2px;
}
#page-khach-hang .filter-card .stat-mini-value {
    font-size: 16px;
    font-weight: 700;
}
#customerOrdersModal .modal-body {
    padding-top: 8px;
}
#customerOrdersModal .table-responsive {
    border: 1px solid #eef1f6;
    border-radius: 8px;
    max-height: 320px;
    overflow-y: auto;
}
#customerOrdersModal .data-table {
    font-size: 13px;
}
#customerOrdersModal .data-table thead th {
    background: #f7f8fb;
}
#customerOrdersModal .data-table tbody tr:nth-child(even) {
    background: #fbfcfe;
}
#customerOrdersModal .data-table tbody tr:hover {
    background: #f2f6ff;
}
#customerOrdersModal .modal-footer {
    display: flex;
    align-items: center;
    gap: 10px;
}
#customerOrdersModal .modal-footer .btn {
    min-width: 120px;
}
#customerOrdersModal .order-select {
    width: 16px;
    height: 16px;
}

/* Customer addresses table */
#customerAddressesTable th:nth-child(1) { width: 60px; }
#customerAddressesTable th:nth-child(2) { width: 65%; min-width: 240px; }
#customerAddressesTable th:nth-child(3) { width: 100px; }
#customerAddressesTable th:nth-child(4) { width: 140px; }
.addr-text {
    max-width: 100%;
    display: inline-block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.addr-text.expandable {
    cursor: pointer;
}
/* Login Page Styles */
.login-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: none; /* Controlled by JS */
    align-items: center;
    justify-content: center;
    background: #f0f2f5;
    z-index: 9999;
    overflow: hidden;
}

.login-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    overflow: hidden;
}

.login-background .shape {
    position: absolute;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    backdrop-filter: blur(10px);
}

.shape-1 { width: 300px; height: 300px; top: -50px; left: -50px; background: linear-gradient(45deg, #4facfe 0%, #00f2fe 100%); opacity: 0.1; }
.shape-2 { width: 400px; height: 400px; bottom: -100px; right: -100px; background: linear-gradient(45deg, #43e97b 0%, #38f9d7 100%); opacity: 0.1; }
.shape-3 { width: 150px; height: 150px; top: 20%; right: 10%; background: #fff; opacity: 0.3; }

.login-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    width: 100%;
    max-width: 420px;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.8);
    position: relative;
    z-index: 10;
    animation: slideUp 0.5s ease-out;
}

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

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

.login-logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    box-shadow: 0 10px 20px rgba(74, 144, 226, 0.3);
    color: white;
    font-size: 28px;
    transform: rotate(-5deg);
}

.login-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: #2C3E50;
    margin: 0 0 8px;
}

.login-header p {
    color: #7F8C8D;
    margin: 0;
    font-size: 15px;
}

/* Floating Label Inputs */
.form-group.floating-label {
    position: relative;
    margin-bottom: 20px;
}

.form-group.floating-label .form-control {
    height: 50px;
    padding: 20px 16px 6px;
    border: 2px solid #e1e4e8;
    border-radius: 12px;
    background: #f8f9fa;
    transition: all 0.2s;
    font-size: 15px;
    font-weight: 500;
}

.form-group.floating-label .form-control:focus {
    border-color: #4A90E2;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(74, 144, 226, 0.1);
}

.form-group.floating-label label {
    position: absolute;
    top: 15px;
    left: 16px;
    color: #95a5a6;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s;
    pointer-events: none;
    margin: 0;
    padding: 0 4px;
    background: transparent;
}

.form-group.floating-label .form-control:focus ~ label,
.form-group.floating-label .form-control:not(:placeholder-shown) ~ label {
    top: 8px;
    left: 12px;
    font-size: 11px;
    color: #4A90E2;
    font-weight: 600;
}

.login-error {
    background: #fbecec;
    color: #e74c3c;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 20px;
    display: none;
    border-left: 4px solid #e74c3c;
    animation: shake 0.3s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.btn-block {
    width: 100%;
    display: flex;
    justify-content: center;
}

.btn-lg {
    height: 50px;
    font-size: 16px;
    border-radius: 12px;
    background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
    box-shadow: 0 10px 20px rgba(74, 144, 226, 0.3);
    border: none;
    transition: all 0.3s;
}

.btn-lg:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(74, 144, 226, 0.4);
    opacity: 1;
}

.btn-lg:active {
    transform: translateY(0);
}

.btn-lg i {
    margin-left: 8px;
    transition: transform 0.3s;
}

.btn-lg:hover i {
    transform: translateX(4px);
}

/* Specific fixes for Cong Viec page - Filter and Pagination */
#page-cong-viec .filter-card {
    overflow: visible;
}

#page-cong-viec .filter-single-row {
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
}

#page-cong-viec .filter-single-row .form-group {
    flex: 0 1 auto;
    min-width: 100px;
    max-width: 150px;
}

#page-cong-viec .filter-single-row .form-group input,
#page-cong-viec .filter-single-row .form-group select {
    min-width: 100px;
    max-width: 150px;
    font-size: 12px;
    padding: 6px 8px;
    min-height: 34px;
}

#page-cong-viec .filter-single-row .autocomplete-wrapper {
    min-width: 100px;
    max-width: 150px;
}

#page-cong-viec .filter-single-row .autocomplete-wrapper input {
    font-size: 12px;
    padding: 6px 8px;
    min-height: 34px;
}

#page-cong-viec .filter-single-row .btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    min-height: 34px;
    flex: 0 0 auto;
    min-width: auto;
}

#page-cong-viec .pagination-controls {
    overflow: visible;
}

/* Thu gọn hàng ngày trước / ngày sau / tuần / tháng - một dòng, nút nhỏ */
#page-cong-viec .cong-viec-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    border-bottom: 1px solid #e0e0e0;
    flex-wrap: wrap;
    gap: 8px;
}

#page-cong-viec .pagination-controls-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
}

#page-cong-viec .date-nav-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

#page-cong-viec .date-nav-group .btn-compact {
    padding: 4px 8px;
    font-size: 11px;
    min-height: 28px;
    white-space: nowrap;
}

#page-cong-viec .date-nav-group .current-date-display {
    font-weight: 600;
    font-size: 12px;
    min-width: 100px;
    max-width: 140px;
    text-align: center;
    padding: 0 4px;
}

#page-cong-viec .date-nav-group .btn-text-short {
    display: none;
}

/* Hàng thống kê + Trang X/Y: một dòng gọn, không tạo khoảng trống */
#page-cong-viec .cong-viec-pagination-stats {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 11px;
    min-width: 0;
}

#page-cong-viec .cong-viec-page-info {
    color: #666;
    flex-shrink: 0;
}

#page-cong-viec .cong-viec-stats-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    align-items: center;
}

#page-cong-viec .cong-viec-stats-inner span {
    white-space: nowrap;
}

#page-cong-viec .cong-viec-stats-inner .text-muted {
    color: #666;
}

/* Giảm khoảng trống giữa thanh điều khiển và bảng */
#page-cong-viec .table-card .table-responsive {
    padding-top: 0;
}

/* Mobile: chữ ngắn (Trước/Sau/Tuần/Tháng), vẫn một hàng */
@media (max-width: 576px) {
    #page-cong-viec .date-nav-group .btn-text-full {
        display: none;
    }
    #page-cong-viec .date-nav-group .btn-text-short {
        display: inline;
    }
    #page-cong-viec .date-nav-group .current-date-display {
        min-width: 80px;
        max-width: 110px;
        font-size: 11px;
    }
}

/* Fix pagination controls responsive - không bắt nút date full width nữa */
@media (max-width: 768px) {
    #page-cong-viec .pagination-controls {
        flex-direction: row !important;
        align-items: center !important;
        gap: 8px !important;
        padding: 6px 10px !important;
    }
    
    #page-cong-viec .pagination-controls > div:first-child {
        width: auto !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 6px !important;
    }
    
    #page-cong-viec .pagination-controls > div:last-child {
        width: 100% !important;
        min-width: 0 !important;
    }
    
    #page-cong-viec .cong-viec-pagination-stats {
        font-size: 10px;
        gap: 6px 10px;
    }
    
    #page-cong-viec .cong-viec-stats-inner {
        gap: 4px 8px;
    }
    
    #page-cong-viec .pagination-controls .date-nav-group .btn-sm {
        width: auto !important;
        min-width: 0 !important;
        min-height: 28px !important;
    }
    
    #page-cong-viec .pagination-controls #currentDateDisplay {
        width: auto !important;
        min-width: 80px !important;
        margin: 0 !important;
    }
    
    #page-cong-viec .table-card {
        padding: 8px 10px;
    }
    
    /* Mobile: tắt sticky cột Tên Khách và Thao tác, cuộn bảng bình thường */
    #page-cong-viec #congViecTable th:nth-child(3),
    #page-cong-viec #congViecTable td:nth-child(3),
    #page-cong-viec #congViecTable thead th:nth-child(3),
    #page-cong-viec .table-responsive #congViecTable th:nth-child(3),
    #page-cong-viec .table-responsive #congViecTable td:nth-child(3),
    #page-cong-viec .table-responsive #congViecTable thead th:nth-child(3) {
        position: static !important;
        left: auto !important;
        right: auto !important;
        box-shadow: none !important;
        z-index: auto !important;
    }
    #page-cong-viec #congViecTable th:last-child,
    #page-cong-viec #congViecTable td:last-child,
    #page-cong-viec #congViecTable th.thao-tac-column,
    #page-cong-viec #congViecTable td.thao-tac-column,
    #page-cong-viec .table-responsive #congViecTable th:last-child,
    #page-cong-viec .table-responsive #congViecTable td:last-child,
    #page-cong-viec .table-responsive #congViecTable thead th:last-child {
        position: static !important;
        left: auto !important;
        right: auto !important;
        box-shadow: none !important;
        z-index: auto !important;
    }
    
    #page-cong-viec .filter-single-row {
        flex-wrap: wrap;
        gap: var(--spacing-sm);
    }
    
    #page-cong-viec .filter-single-row .form-group {
        flex: 1 1 calc(50% - var(--spacing-sm)) !important;
        min-width: 140px !important;
        max-width: none !important;
    }
    
    #page-cong-viec .filter-single-row .form-group input,
    #page-cong-viec .filter-single-row .form-group select {
        min-width: 100% !important;
        max-width: 100% !important;
    }
    
    #page-cong-viec .filter-single-row .autocomplete-wrapper {
        min-width: 100% !important;
        max-width: 100% !important;
    }
    
    #page-cong-viec .filter-single-row .form-group[style*="flex: 0 0 auto"] {
        flex: 1 1 100% !important;
        width: 100% !important;
    }
    
    #page-cong-viec .filter-single-row .form-group[style*="flex: 0 0 auto"] > div {
        flex-direction: row;
        width: 100%;
        gap: var(--spacing-sm);
    }
    
    #page-cong-viec .filter-single-row .btn-sm {
        flex: 1 1 auto;
        min-width: 0;
    }
}

/* Tablet responsive for filter bar */
@media (min-width: 481px) and (max-width: 1024px) {
    #page-cong-viec .filter-single-row {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    #page-cong-viec .filter-single-row .form-group {
        flex: 0 1 auto !important;
        min-width: 120px !important;
        max-width: 140px !important;
    }
    
    #page-cong-viec .filter-single-row .form-group input,
    #page-cong-viec .filter-single-row .form-group select {
        min-width: 100% !important;
        max-width: 100% !important;
    }
    
    #page-cong-viec .filter-single-row .autocomplete-wrapper {
        min-width: 100% !important;
        max-width: 100% !important;
    }
}

/* Extra small mobile */
@media (max-width: 480px) {
    #page-cong-viec .filter-single-row .form-group {
        flex: 1 1 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
    }
    #page-bao-cao .report-filters .filter-group {
        flex: 1 1 100% !important;
    }
    #page-bao-cao .report-tab {
        padding: 6px 10px;
        font-size: 11px;
    }
}