/* ==========================================================================
   CSS Variables, Root & Theme
   ========================================================================== */
:root {
    --bg-body: #0f0f1a;
    --bg-sidebar: #13122a;
    --bg-card: rgba(19, 18, 42, 0.7);
    --bg-input: rgba(255, 255, 255, 0.04);
    --bg-hover: rgba(255, 255, 255, 0.05);
    --border-color: rgba(255, 255, 255, 0.08);
    --color-primary: #f97316;
    --color-primary-hover: #ea580c;
    --color-success: #10b981;
    --color-danger: #ef4444;
    --color-warning: #f59e0b;
    --color-info: #3b82f6;
    --text-main: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 72px;
    --header-height: 64px;
}

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

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   Scrollbar
   ========================================================================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.25); }

/* ==========================================================================
   Base Layout
   ========================================================================== */
.app-container {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* ==========================================================================
   SIDEBAR STYLES
   ========================================================================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform var(--transition-normal), width var(--transition-normal);
    overflow-y: auto;
    overflow-x: hidden;
}

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

.logo-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 28px;
    line-height: 1;
}

.logo-text h2 {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.logo-text span {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
}

.sidebar-collapse-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast);
}

.sidebar-collapse-btn:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.sidebar-collapse-btn svg {
    transition: transform var(--transition-normal);
    transform: rotate(0deg);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .sidebar-filter-section,
.sidebar.collapsed .sidebar-user-details,
.sidebar.collapsed .creator-info,
.sidebar.collapsed .sidebar-nav .nav-item a span {
    display: none;
}

.sidebar.collapsed .sidebar-header,
.sidebar.collapsed .sidebar-footer {
    padding-left: 10px;
    padding-right: 10px;
}

.sidebar.collapsed .sidebar-nav .nav-item a {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

.sidebar.collapsed .sidebar-user-info {
    justify-content: center;
}

.sidebar.collapsed .sidebar-collapse-btn svg {
    transform: rotate(180deg);
}

/* Sidebar Filter Section */
.sidebar-filter-section {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.filter-group label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.filter-group label i {
    width: 14px;
    height: 14px;
}

.date-picker-row {
    display: flex;
    gap: 10px;
    min-width: 0;
}

.date-picker-row > div {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.date-picker-row label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
}

#custom-date-container .date-picker-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

#custom-date-container input[type="date"] {
    width: 100%;
    min-width: 0;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 8px 0;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
}

.nav-item a:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.nav-item.active a {
    background: rgba(249, 115, 22, 0.08);
    color: var(--color-primary);
    border-left-color: var(--color-primary);
}

.nav-item i {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Sidebar Footer */
.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding: 16px 20px;
}

.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border-color);
}

.sidebar-user-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-user-email {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
}

.sidebar-logout-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 0;
    transition: color var(--transition-fast);
}

.sidebar-logout-btn:hover {
    color: var(--color-danger);
}

.creator-info p {
    font-size: 11px;
    color: var(--text-muted);
    margin: 0;
}

.creator-info small {
    font-size: 10px;
    color: var(--text-muted);
    opacity: 0.7;
}

.hamburger-menu {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 4px;
}

/* ==========================================================================
   Main Content Area
   ========================================================================== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 24px 28px;
    transition: margin-left var(--transition-normal);
    min-width: 0;
}

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

.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
}

.header-title h1 {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

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

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: none;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    line-height: 1.4;
}

.btn i {
    width: 16px;
    height: 16px;
}

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

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

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

.btn-outline:hover {
    background: var(--bg-hover);
    color: var(--text-main);
    border-color: rgba(255, 255, 255, 0.2);
}

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

.btn-danger:hover {
    background: #dc2626;
}

.btn-warning {
    background: var(--color-warning);
    color: #000;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-large {
    padding: 10px 24px;
    font-size: 14px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-xs {
    padding: 4px 10px;
    font-size: 11px;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==========================================================================
   FORMS & INPUTS
   ========================================================================== */
.custom-input, .custom-select, .form-control {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 13px;
    padding: 8px 12px;
    font-family: inherit;
    transition: border-color var(--transition-fast);
    width: 100%;
    outline: none;
}

.custom-input:focus, .custom-select:focus, .form-control:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.1);
}

.custom-input::placeholder, .form-control::placeholder {
    color: var(--text-muted);
    font-size: 13px;
}

.custom-select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}

.custom-select option {
    background: #1e1e3a;
    color: var(--text-main);
}

.width-auto {
    width: auto;
    min-width: 140px;
}

.search-input {
    padding: 8px 12px 8px 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 12px center;
    background-size: 16px;
}

.custom-textarea {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 13px;
    padding: 10px 12px;
    font-family: inherit;
    width: 100%;
    outline: none;
    resize: vertical;
    transition: border-color var(--transition-fast);
}

.custom-textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.1);
}

.form-group {
    margin-bottom: 14px;
}

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

.form-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.5;
}

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

.flex-row-gap-xs {
    display: flex;
    gap: 4px;
    align-items: center;
}

.flex-1 {
    flex: 1;
}

.flex-between-center {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ==========================================================================
   DATA BLOCKS / TABLES
   ========================================================================== */
.data-block-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}

.block-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

.block-title-group h3 {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

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

.block-badge {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.alert-badge {
    background: rgba(239, 68, 68, 0.12);
    color: var(--color-danger);
    border-color: rgba(239, 68, 68, 0.2);
}

.badge-completed {
    background: rgba(16, 185, 129, 0.12);
    color: var(--color-success);
    border-color: rgba(16, 185, 129, 0.2);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.12);
    color: var(--color-warning);
    border-color: rgba(245, 158, 11, 0.2);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.12);
    color: var(--color-danger);
    border-color: rgba(239, 68, 68, 0.2);
}

.badge-mall {
    background: rgba(59, 130, 246, 0.12);
    color: var(--color-info);
    border-color: rgba(59, 130, 246, 0.2);
}

.badge-thuong {
    background: rgba(148, 163, 184, 0.12);
    color: var(--text-secondary);
    border-color: rgba(148, 163, 184, 0.2);
}

.api-status-box {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
    padding: 10px 12px;
}

.api-status-ready {
    border-color: rgba(0, 198, 141, 0.32);
    background: rgba(0, 198, 141, 0.08);
    color: #baf7e6;
}

.api-status-warning {
    border-color: rgba(255, 122, 24, 0.35);
    background: rgba(255, 122, 24, 0.08);
    color: #ffd2b5;
}

.import-validator-panel {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-card);
    margin-top: 12px;
    padding: 14px;
}

.import-validator-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.import-validator-header h4 {
    margin: 0;
    color: var(--text-main);
    font-size: 15px;
}

.import-validator-header p {
    margin: 4px 0 0 0;
    color: var(--text-secondary);
    font-size: 12px;
}

.import-validator-badge {
    border-radius: 999px;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
    padding: 6px 10px;
    white-space: nowrap;
}

.import-validator-badge.is-ok {
    border-color: rgba(0, 198, 141, 0.35);
    color: #00c68d;
}

.import-validator-badge.is-warn {
    border-color: rgba(245, 158, 11, 0.4);
    color: var(--color-warning);
}

.import-validator-badge.is-error {
    border-color: rgba(239, 68, 68, 0.4);
    color: var(--color-danger);
}

.import-validator-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.import-validator-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.025);
    padding: 10px;
    min-height: 112px;
}

.import-validator-card.ok {
    border-color: rgba(0, 198, 141, 0.22);
}

.import-validator-card.warn {
    border-color: rgba(245, 158, 11, 0.28);
}

.import-validator-card.error {
    border-color: rgba(239, 68, 68, 0.28);
}

.import-validator-card-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: var(--text-main);
    font-size: 13px;
    font-weight: 700;
}

.import-validator-card-title strong {
    color: var(--text-secondary);
    font-size: 11px;
    text-transform: uppercase;
}

.import-validator-card.ok .import-validator-card-title strong {
    color: #00c68d;
}

.import-validator-card.warn .import-validator-card-title strong {
    color: var(--color-warning);
}

.import-validator-card.error .import-validator-card-title strong {
    color: var(--color-danger);
}

.import-validator-card p,
.import-validator-card small {
    display: block;
    margin: 6px 0 0 0;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.45;
}

.import-validator-card ul {
    margin: 8px 0 0 16px;
    padding: 0;
    color: var(--text-secondary);
    font-size: 12px;
}

@media (max-width: 1200px) {
    .import-validator-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .import-validator-header {
        flex-direction: column;
    }

    .import-validator-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   TABLES
   ========================================================================== */
.table-scrollable {
    overflow-x: auto;
    overflow-y: auto;
    margin: -8px 0;
    /* Luôn hiển thị thanh cuộn ngang trên desktop */
    scrollbar-width: thin;
}

/* Luôn hiển thị thanh cuộn ngang của orders table */
#orders-table-wrapper .table-scrollable {
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(100vh - 360px);
    min-height: 360px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 8px;
    background: rgba(7, 11, 24, 0.42);
    margin: 0;
}

#orders-table-wrapper .table-scrollable::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

#orders-table-wrapper .table-scrollable::-webkit-scrollbar-track {
    background: #0a1222;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 8px;
}

#orders-table-wrapper .table-scrollable::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.35);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 8px;
    min-height: 40px;
}

#orders-table-wrapper .table-scrollable::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.5);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

#orders-main-table {
    min-width: 1960px;
    table-layout: fixed;
}

#orders-main-table.fit-to-wrapper {
    min-width: 100%;
    width: 100%;
    table-layout: fixed;
}

#orders-main-table.fit-to-wrapper th[data-col],
#orders-main-table.fit-to-wrapper td[data-col] {
    min-width: 0 !important;
    width: auto !important;
    max-width: none !important;
}

#orders-main-table.fit-to-wrapper th[data-col="orderStatus"],
#orders-main-table.fit-to-wrapper td[data-col="orderStatus"] {
    width: 132px !important;
    min-width: 132px !important;
    max-width: 132px !important;
}

#orders-main-table th[data-col="orderId"],
#orders-main-table td[data-col="orderId"] {
    width: 148px;
    min-width: 148px;
    max-width: 148px;
}

#orders-main-table th[data-col="orderDate"],
#orders-main-table td[data-col="orderDate"] {
    width: 96px;
    min-width: 96px;
    max-width: 96px;
}

#orders-main-table th[data-col="status"],
#orders-main-table td[data-col="status"] {
    width: 112px;
    min-width: 112px;
    max-width: 112px;
}

#orders-main-table th[data-col="packageId"],
#orders-main-table td[data-col="packageId"],
#orders-main-table th[data-col="trackingCode"],
#orders-main-table td[data-col="trackingCode"] {
    width: 210px;
    min-width: 210px;
}

#orders-main-table th[data-col="sku"],
#orders-main-table td[data-col="sku"] {
    width: 180px;
    min-width: 180px;
}

#orders-main-table th[data-col="carrier"],
#orders-main-table td[data-col="carrier"] {
    width: 108px;
    min-width: 108px;
    max-width: 108px;
}

#orders-main-table th[data-col="deliveryTime"],
#orders-main-table td[data-col="deliveryTime"] {
    width: 96px;
    min-width: 96px;
    max-width: 96px;
}

#orders-main-table th[data-col="orderStatus"],
#orders-main-table td[data-col="orderStatus"] {
    width: 132px;
    min-width: 132px;
    max-width: 132px;
}

#orders-main-table th[data-col="originalPrice"],
#orders-main-table td[data-col="originalPrice"],
#orders-main-table th[data-col="sellerDiscountItem"],
#orders-main-table td[data-col="sellerDiscountItem"],
#orders-main-table th[data-col="price"],
#orders-main-table td[data-col="price"],
#orders-main-table th[data-col="orderTotalValue"],
#orders-main-table td[data-col="orderTotalValue"],
#orders-main-table th[data-col="shopeeVoucher"],
#orders-main-table td[data-col="shopeeVoucher"],
#orders-main-table th[data-col="shopeeCoin"],
#orders-main-table td[data-col="shopeeCoin"],
#orders-main-table th[data-col="shippingEstimated"],
#orders-main-table td[data-col="shippingEstimated"],
#orders-main-table th[data-col="shippingBuyerPaid"],
#orders-main-table td[data-col="shippingBuyerPaid"],
#orders-main-table th[data-col="shippingShopeeSponsored"],
#orders-main-table td[data-col="shippingShopeeSponsored"],
#orders-main-table th[data-col="shippingReturnFee"],
#orders-main-table td[data-col="shippingReturnFee"],
#orders-main-table th[data-col="buyerPaidTotal"],
#orders-main-table td[data-col="buyerPaidTotal"],
#orders-main-table th[data-col="fixedFee"],
#orders-main-table td[data-col="fixedFee"],
#orders-main-table th[data-col="serviceFee"],
#orders-main-table td[data-col="serviceFee"],
#orders-main-table th[data-col="paymentFee"],
#orders-main-table td[data-col="paymentFee"],
#orders-main-table th[data-col="cogs"],
#orders-main-table td[data-col="cogs"],
#orders-main-table th[data-col="adsFee"],
#orders-main-table td[data-col="adsFee"],
#orders-main-table th[data-col="affiliateFee"],
#orders-main-table td[data-col="affiliateFee"],
#orders-main-table th[data-col="netProfit"],
#orders-main-table td[data-col="netProfit"] {
    width: 92px;
    min-width: 92px;
}

.data-table thead th {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #0d1729;
    padding: 9px 10px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #9fbee1;
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    text-align: left;
    white-space: nowrap;
}

#orders-main-table thead tr.orders-filter-row th {
    top: 32px;
    z-index: 6;
    padding: 6px 6px;
    background: #0b1424;
}

#orders-main-table thead tr.orders-filter-row th.sticky-col-left {
    z-index: 11;
}

.orders-col-filter {
    width: 100%;
    min-width: 0;
    height: 26px;
    padding: 4px 6px;
    border-radius: 6px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-main);
    font-size: 11px;
    font-weight: 400;
    outline: none;
    appearance: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color-scheme: dark;
}

.orders-col-filter::placeholder {
    color: var(--text-muted);
}

.orders-col-filter:focus {
    border-color: rgba(59, 130, 246, 0.55);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.orders-col-filter option {
    background: #0b1424;
    color: #dbe7ff;
}

.data-table thead th.text-right {
    text-align: right;
}

/* Bỏ border-right cho cột cuối */
.data-table thead th:last-child,
.data-table tbody td:last-child {
    border-right: none;
}

.data-table tbody td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
    color: var(--text-main);
    white-space: nowrap;
}

#orders-main-table tbody td {
    font-size: 12px;
    font-weight: 400;
}

#orders-main-table td[data-col="status"],
#orders-main-table td[data-col="trackingCode"],
#orders-main-table td[data-col="carrier"],
#orders-main-table td[data-col="deliveryTime"] {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#orders-main-table td[data-col="buyerUsername"],
#orders-main-table td[data-col="shop"],
#orders-main-table td[data-col="originalPrice"],
#orders-main-table td[data-col="sellerDiscountItem"],
#orders-main-table td[data-col="price"],
#orders-main-table td[data-col="cogs"] {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#orders-main-table tbody tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.012);
}

#orders-main-table tbody tr:hover td {
    background: rgba(249, 78, 48, 0.07);
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

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

/* ==========================================================================
   STICKY COLUMNS (Freeze Panes) - Cho bảng orders
   ========================================================================== */
/* Cột đầu (Mã đơn) - sticky bên trái */
.data-table .sticky-col-left {
    position: sticky;
    left: 0;
    z-index: 8;
    background: #10233d;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Cột thứ 2 (Ngày đặt) - sticky cạnh cột đầu */
/* Sticky header cho các sticky columns phải có z-index cao hơn */
.data-table thead th.sticky-col-left {
    z-index: 12;
    background: #0d1729;
}

/* Đổ bóng phân cách giữa cột sticky và cột động */
.data-table .sticky-col-left::after {
    content: '';
    position: absolute;
    top: 0;
    right: -6px;
    width: 6px;
    height: 100%;
    background: linear-gradient(to right, rgba(0,0,0,0.3), transparent);
    pointer-events: none;
}

/* Đảm bảo các cột sticky không bị gridline chồng lấn */
.data-table .sticky-col-left {
    border-right-color: transparent;
}

#orders-main-table tbody tr:nth-child(even) td.sticky-col-left {
    background: #112743;
}

#orders-main-table tbody tr:hover td.sticky-col-left {
    background: #14345a;
}

#orders-main-table td.sticky-col-left strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

.order-status-default {
    color: var(--text-main);
}

.order-status-success {
    color: #22c55e;
    font-weight: 600;
}

.order-status-shipping {
    color: #38bdf8;
    font-weight: 600;
}

.order-status-cancel {
    color: #f87171;
    font-weight: 600;
}

.order-item-cell {
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-width: 240px;
    white-space: normal;
}

.order-item-cell + .order-item-cell {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.order-item-cell strong {
    color: var(--text-main);
    font-size: 12px;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.order-item-cell span {
    color: var(--text-secondary);
    font-size: 11px;
    line-height: 1.35;
}

.shop-bulk-action-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 12px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
}

.shop-bulk-action-bar span {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
}

.bulk-action-buttons {
    display: flex;
    gap: 8px;
}

.shop-bulk-action-bar .btn {
    white-space: nowrap;
}


/* ==========================================================================
   PRODUCT THUMBNAIL
   ========================================================================== */
.prod-thumb {
    width: 110px;
    height: 110px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    background: rgba(255, 255, 255, 0.03);
    display: block;
    transition: transform 0.16s ease, filter 0.16s ease;
}

.prod-thumb-wrap {
    position: relative;
    width: 110px;
    height: 110px;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(9, 12, 28, 0.8);
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.12);
}

.btn-prod-inline-upload {
    position: absolute;
    left: 6px;
    right: 6px;
    bottom: 6px;
    height: 26px;
    border-radius: 6px;
    border: 1px solid rgba(249, 115, 22, 0.55);
    background: rgba(11, 18, 32, 0.88);
    color: #ffd9be;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0 8px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.16s ease, transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
    pointer-events: none;
}

.btn-prod-inline-upload i {
    width: 12px;
    height: 12px;
}

.btn-prod-inline-upload:hover {
    border-color: rgba(249, 115, 22, 0.95);
    background: rgba(20, 31, 52, 0.98);
    color: #fff;
}

.prod-thumb-wrap:hover .btn-prod-inline-upload,
.prod-thumb-wrap:focus-within .btn-prod-inline-upload {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.prod-thumb-wrap:hover .prod-thumb {
    transform: scale(1.02);
    filter: brightness(0.9);
}

/* Return restock tiny thumbnail */
#return-restock-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
}

#return-restock-table thead th {
    background: rgba(12, 28, 52, 0.95);
    color: #8ec5ff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    height: 46px;
    padding: 8px 6px;
    text-align: center;
    vertical-align: middle;
    line-height: 1.2;
    border-bottom: 1px solid rgba(59, 130, 246, 0.22);
}

#return-restock-table tbody tr {
    height: 104px;
    transition: background-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

#return-restock-table tbody tr:nth-child(odd) {
    background: rgba(8, 19, 38, 0.42);
}

#return-restock-table tbody tr:nth-child(even) {
    background: rgba(10, 24, 46, 0.62);
}

#return-restock-table tbody tr:hover {
    background: rgba(20, 42, 76, 0.82);
    box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.35);
    transform: translateY(-1px);
}

#return-restock-table tbody td {
    height: 104px;
    padding: 10px 6px;
    vertical-align: middle;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

#return-restock-table th:first-child,
#return-restock-table td:first-child {
    width: 82px;
    text-align: center;
    padding-left: 6px;
    padding-right: 6px;
}

#return-restock-table th:nth-child(2),
#return-restock-table td:nth-child(2) {
    width: calc(100% - 210px);
    min-width: 0;
    text-align: left;
}

.return-thumb {
    width: 68px;
    height: 68px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(255, 255, 255, 0.04);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1;
}

.return-thumb-fallback {
    background: rgba(15, 23, 42, 0.65);
}

.return-order-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    min-width: 0;
    max-width: 100%;
    line-height: 1.25;
}

.return-order-id {
    font-weight: 700;
    color: #f8fbff;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.return-order-meta {
    font-size: 12px;
    color: #b6c7e3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.return-order-sku {
    font-size: 12px;
    color: #ffb36a;
    font-family: 'JetBrains Mono', monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#return-restock-table th:nth-child(3),
#return-restock-table td:nth-child(3) {
    width: 40px;
    text-align: center;
    white-space: nowrap;
}

#return-restock-table th:nth-child(4),
#return-restock-table td:nth-child(4) {
    width: 88px;
    text-align: center;
    white-space: nowrap;
    padding-left: 8px;
    padding-right: 8px;
}

#return-restock-table td:nth-child(4) label {
    width: 100%;
    font-size: 11px;
    color: #d8e8ff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

#return-restock-table td:nth-child(4) input[type="checkbox"] {
    accent-color: #22c55e;
    transform: scale(1.05);
}

/* Table row adjustment for product images */
#products-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 1080px;
}

#products-table thead th {
    background: rgba(12, 28, 52, 0.95);
    color: #8ec5ff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    padding: 10px 8px;
    border-bottom: 1px solid rgba(59, 130, 246, 0.22);
    text-align: center;
    vertical-align: middle;
    white-space: normal;
    line-height: 1.2;
    min-height: 46px;
    height: 46px;
}

/* Header color grouping for quick scanning */
#products-table thead th:nth-child(1),
#products-table thead th:nth-child(2),
#products-table thead th:nth-child(3),
#products-table thead th:nth-child(4) {
    background: rgba(20, 44, 79, 0.96); /* Nhóm nhận diện */
    color: #9fd3ff;
}

#products-table thead th:nth-child(5) {
    background: rgba(60, 35, 10, 0.92); /* Nhóm tài chính */
    color: #ffca8a;
}

#products-table thead th:nth-child(6),
#products-table thead th:nth-child(7),
#products-table thead th:nth-child(8),
#products-table thead th:nth-child(9) {
    background: rgba(18, 62, 49, 0.92); /* Nhóm tồn kho */
    color: #a9f5d7;
}

#products-table thead th:nth-child(10) {
    background: rgba(56, 30, 76, 0.92); /* Nhóm thao tác */
    color: #d9b8ff;
}

#products-table tbody tr {
    transition: background-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

#products-table tbody tr:nth-child(odd) {
    background: rgba(8, 19, 38, 0.42);
}

#products-table tbody tr:nth-child(even) {
    background: rgba(10, 24, 46, 0.62);
}

#products-table tbody tr:hover {
    background: rgba(20, 42, 76, 0.82);
    box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.35);
    transform: translateY(-1px);
}

#products-table thead th:first-child,
#products-table tbody td:first-child {
    width: 46px;
    padding: 8px 8px;
    text-align: center;
}

#products-table thead th:nth-child(2),
#products-table tbody td:nth-child(2) {
    width: 130px;
    padding: 8px 12px;
}

#products-table thead th:nth-child(3),
#products-table tbody td:nth-child(3) {
    width: 110px;
}

#products-table thead th:nth-child(4),
#products-table tbody td:nth-child(4) {
    width: 230px;
}

#products-table thead th:nth-child(5),
#products-table tbody td:nth-child(5) {
    width: 130px;
}

#products-table thead th:nth-child(6),
#products-table tbody td:nth-child(6),
#products-table thead th:nth-child(7),
#products-table tbody td:nth-child(7),
#products-table thead th:nth-child(8),
#products-table tbody td:nth-child(8),
#products-table thead th:nth-child(9),
#products-table tbody td:nth-child(9) {
    width: 86px;
    text-align: center;
}

#products-table thead th:nth-child(10),
#products-table tbody td:nth-child(10) {
    width: 88px;
    text-align: center;
}

#products-table tbody td {
    padding: 10px 12px;
    vertical-align: middle;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#products-table thead tr {
    height: 46px;
}

#products-table td code {
    color: #ffb36a;
    font-weight: 700;
}

#products-table tbody td:nth-child(4) {
    color: #f8fbff;
    font-weight: 600;
}

#products-table tbody td:nth-child(5),
#products-table tbody td:nth-child(5) strong {
    color: #ffffff;
    font-weight: 800;
}

#products-table tbody td:nth-child(6) {
    color: #00c68d;
    font-weight: 700;
}

/* Neutralize old multi-color grouping; keep unified header/body */
#products-table thead th:nth-child(1),
#products-table thead th:nth-child(2),
#products-table thead th:nth-child(3),
#products-table thead th:nth-child(4),
#products-table thead th:nth-child(5),
#products-table thead th:nth-child(6),
#products-table thead th:nth-child(7),
#products-table thead th:nth-child(8),
#products-table thead th:nth-child(9),
#products-table thead th:nth-child(10) {
    background: rgba(12, 28, 52, 0.95);
    color: #8ec5ff;
}

#products-table tbody td:nth-child(5),
#products-table tbody td:nth-child(6),
#products-table tbody td:nth-child(7),
#products-table tbody td:nth-child(8),
#products-table tbody td:nth-child(9),
#products-table tbody td:nth-child(10) {
    color: inherit;
    font-weight: inherit;
}

/* Body emphasis by column group */
#products-table tbody td:nth-child(5) {
    color: #ffd7a7;
    font-weight: 700;
}

#products-table tbody td:nth-child(6),
#products-table tbody td:nth-child(7),
#products-table tbody td:nth-child(8),
#products-table tbody td:nth-child(9) {
    color: #b8f3df;
    font-weight: 600;
}

#products-table tbody td:nth-child(10) {
    color: #d7c2f5;
}

/* Status-driven colors only */
.stock-cell--good { color: #22c55e !important; font-weight: 700 !important; }
.stock-cell--bad { color: #ef4444 !important; font-weight: 700 !important; }
.stock-cell--zero { color: #ffffff !important; font-weight: 700 !important; }
.stock-cell--warn { color: #3b82f6 !important; font-weight: 700 !important; }
.stock-cell--info { color: #60a5fa !important; font-weight: 700 !important; }
.stock-cell--muted { color: #ffffff !important; }

.product-bulk-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.product-bulk-count {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    margin-right: 4px;
}

.prod-row-check,
#products-select-all {
    width: 16px;
    height: 16px;
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid rgba(148, 163, 184, 0.45);
    background: rgba(255, 255, 255, 0.04);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: all 0.15s ease;
}

.prod-row-check:hover,
#products-select-all:hover {
    border-color: rgba(249, 115, 22, 0.75);
}

.prod-row-check:checked,
#products-select-all:checked {
    background: #f97316;
    border-color: #f97316;
}

.prod-row-check:checked::after,
#products-select-all:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid #0b1220;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.prod-row-check:focus-visible,
#products-select-all:focus-visible {
    outline: 2px solid rgba(249, 115, 22, 0.35);
    outline-offset: 1px;
}

#tab-products .col-8 .data-block-container {
    height: calc(100vh - 142px);
    min-height: 600px;
    display: flex;
    flex-direction: column;
}

/* Products page: left area 2/3, right area 1/3 */
#tab-products > .two-column-layout {
    grid-template-columns: 2fr 1fr;
}

#tab-products > .two-column-layout > .col-8,
#tab-products > .two-column-layout > .col-4 {
    min-width: 0;
}

#tab-products .col-8 .data-block-container .block-header {
    flex-shrink: 0;
}

#tab-products .products-table-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: auto;
    margin: 0;
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 6px;
}

#tab-products .col-4 > .data-block-container:first-child {
    height: calc(100vh - 142px);
    min-height: 600px;
    display: flex;
    flex-direction: column;
}

#tab-products .return-restock-scroll {
    flex: 1;
    width: 100%;
    min-height: 0;
    overflow-y: auto;
    overflow-x: auto;
    margin: 0;
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 6px;
}

.product-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.products-inventory-toolbar,
.products-list-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.products-inventory-toolbar {
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

.products-inventory-filter {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.products-inventory-filter label {
    white-space: nowrap;
    font-size: 13px;
    font-weight: 600;
}

#inventory-tracking-start {
    width: 160px;
}

.products-list-toolbar {
    margin-bottom: 14px;
}

.products-list-toolbar h3 {
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
    white-space: nowrap;
}

.products-list-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
}

.products-search-input {
    width: min(320px, 100%);
    min-width: 220px;
}

.products-inventory-toolbar .btn,
.products-list-controls .btn,
.products-inventory-toolbar .custom-input,
.products-list-controls .custom-input {
    min-height: 36px;
}

.products-bulk-toolbar {
    justify-content: flex-end;
    padding: 10px 0 12px;
    margin-top: -4px;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
}

.product-tool-popup {
    display: none;
    position: fixed;
    z-index: 10002;
    top: 50%;
    left: 50%;
    width: min(560px, calc(100vw - 32px));
    max-height: min(760px, calc(100vh - 32px));
    overflow-y: auto;
    transform: translate(-50%, -50%);
    margin: 0;
    border-color: rgba(59, 130, 246, 0.34);
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.58);
}

.product-tool-popup.show {
    display: block;
    animation: productToolPopupIn 0.18s ease-out;
}

.product-tool-popup .collapsible-panel {
    max-height: none;
    opacity: 1;
    overflow: visible;
    margin-top: 12px;
}

.product-tool-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10001;
    background: rgba(4, 8, 18, 0.72);
    backdrop-filter: blur(3px);
}

.product-tool-backdrop.show {
    display: block;
}

@keyframes productToolPopupIn {
    from { opacity: 0; transform: translate(-50%, -48%) scale(0.98); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@media (max-width: 1180px) {
    .products-list-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .products-list-controls {
        width: 100%;
        justify-content: flex-start;
    }

    .products-search-input {
        flex: 1 1 100%;
        width: 100%;
        min-width: 100%;
    }
}

@media (max-width: 640px) {
    .products-inventory-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .products-inventory-filter {
        align-items: stretch;
        flex-direction: column;
        gap: 6px;
    }

    #inventory-tracking-start,
    #btn-inventory-rebuild {
        width: 100%;
    }

    .products-list-controls .btn {
        flex: 1 1 calc(50% - 8px);
    }

    .products-bulk-toolbar {
        justify-content: flex-start;
    }
}


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

.searchable-select-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 240px;
    overflow-y: auto;
    background: #1a1a3e;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    z-index: 1000;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.searchable-select-item {
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-main);
    cursor: pointer;
    transition: background 0.1s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.searchable-select-item:hover {
    background: rgba(249, 115, 22, 0.2);
    color: #fff;
}

.searchable-select-item.text-muted {
    color: var(--text-muted);
    cursor: default;
}

/* ==========================================================================
   TABLE SEARCH FILTERS
   ========================================================================== */
.table-search-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ==========================================================================
   METRICS GRID
   ========================================================================== */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    transition: border-color var(--transition-fast), transform var(--transition-fast);
}

.metric-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
}

.metric-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.metric-icon i {
    width: 20px;
    height: 20px;
}

.card-revenue .metric-icon { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.card-fees .metric-icon { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.card-cogs .metric-icon { background: rgba(249, 115, 22, 0.1); color: #f97316; }
.card-ads .metric-icon { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.card-affiliate .metric-icon { background: rgba(96, 165, 250, 0.1); color: #60a5fa; }
.card-expenses .metric-icon { background: rgba(148, 163, 184, 0.1); color: #94a3b8; }
.card-profit .metric-icon { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }

.metric-details {
    flex: 1;
    min-width: 0;
}

.metric-details h3 {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin: 0 0 4px 0;
}

.metric-value {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
    margin: 0 0 2px 0;
}

.metric-subtext {
    font-size: 11px;
    color: var(--text-muted);
}

.text-success { color: var(--color-success) !important; }
.text-danger { color: var(--color-danger) !important; }
.text-warning { color: var(--color-warning) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }

.dashboard-decision-grid {
    display: grid;
    grid-template-columns: 1.1fr 1fr 1.2fr;
    gap: 16px;
    margin: 0 0 20px;
}

.decision-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    min-height: 156px;
}

.decision-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.decision-card-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}

.decision-card-header p {
    margin: 4px 0 0;
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.45;
}

.decision-card-header > i {
    width: 34px;
    height: 34px;
    padding: 8px;
    border-radius: 10px;
    background: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
    flex-shrink: 0;
}

.decision-list {
    display: grid;
    gap: 8px;
}

.decision-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

.decision-row strong,
.ratio-grid strong {
    font-size: 13px;
    font-weight: 800;
    color: #fff;
}

.ratio-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.ratio-grid > div {
    border: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.025);
    border-radius: 8px;
    padding: 10px;
}

.ratio-grid span {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
    color: var(--text-muted);
}

.action-alert-list {
    display: grid;
    gap: 8px;
    max-height: 104px;
    overflow: auto;
    padding-right: 2px;
}

.action-alert-item {
    border-left: 3px solid rgba(148, 163, 184, 0.5);
    background: rgba(255,255,255,0.025);
    border-radius: 7px;
    padding: 8px 10px;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.35;
}

.is-good,
.action-alert-item.is-ok { color: #00c68d !important; }
.is-bad,
.action-alert-item.is-bad { color: var(--color-danger) !important; }
.is-info,
.action-alert-item.is-info { color: #60a5fa !important; }
.is-flat,
.action-alert-item.is-warn { color: var(--color-warning) !important; }

/* ==========================================================================
   CHARTS
   ========================================================================== */
.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.chart-header {
    margin-bottom: 16px;
}

.chart-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
}

.chart-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

.chart-wrapper {
    position: relative;
    height: 280px;
}

.large-chart .chart-wrapper { height: 320px; }
.small-chart .chart-wrapper { height: 280px; }

.ads-dashboard-section {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(8, 13, 26, 0.98));
    border: 1px solid rgba(245, 158, 11, 0.22);
    border-radius: var(--radius-lg);
    padding: 18px;
    margin: 4px 0 18px;
}

.ads-dashboard-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.ads-dashboard-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}

.ads-dashboard-header p {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--text-muted);
}

.ads-source-badge {
    flex-shrink: 0;
    border: 1px solid rgba(245, 158, 11, 0.28);
    background: rgba(245, 158, 11, 0.1);
    color: #fbbf24;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.ads-source-badge.is-active {
    border-color: rgba(0, 198, 141, 0.3);
    background: rgba(0, 198, 141, 0.1);
    color: #00c68d;
}

.ads-source-badge.is-empty {
    border-color: rgba(148, 163, 184, 0.2);
    background: rgba(148, 163, 184, 0.08);
    color: var(--text-muted);
}

.ads-kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.ads-kpi-card {
    min-width: 0;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 8px;
    padding: 10px 12px;
}

.ads-kpi-card span {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.ads-kpi-card strong {
    display: block;
    color: #f8fbff;
    font-size: 16px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ads-chart-wrapper {
    height: 260px;
    background: rgba(2, 6, 23, 0.25);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 8px;
    padding: 10px;
}

@media (max-width: 1180px) {
    .ads-kpi-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .ads-dashboard-header {
        flex-direction: column;
        align-items: stretch;
    }

    .ads-source-badge {
        width: fit-content;
    }

    .ads-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 460px) {
    .ads-kpi-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   TWO COLUMN LAYOUT
   ========================================================================== */
.two-column-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.col-4 { grid-column: span 1; }
.col-6 { grid-column: span 1; }
.col-8 { grid-column: span 1; }

.margin-top-sm { margin-top: 8px; }
.margin-top-md { margin-top: 16px; }
.margin-top-lg { margin-top: 24px; }
.margin-bottom-md { margin-bottom: 16px; }
.margin-bottom-sm { margin-bottom: 8px; }

/* ==========================================================================
   PAGINATION
   ========================================================================== */
.table-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 12px 0 12px;
    border-top: 0;
    margin-top: 10px;
    gap: 12px;
    flex-wrap: wrap;
}

.pagination-info {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
}

.rows-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-width-70 { width: 70px; }
.input-width-80 { width: 80px; }
.input-sm-padding { padding: 6px 10px; font-size: 12px; }

.text-size-sm-secondary { font-size: 12px; color: var(--text-secondary); }
.text-size-xs { font-size: 11px; }

.pagination-buttons {
    display: flex;
    gap: 8px;
}

.pagination-buttons .btn {
    padding: 8px 12px;
    font-size: 12px;
}

/* ==========================================================================
   EMPTY STATE
   ========================================================================== */
.empty-state-container {
    text-align: center;
    padding: 40px 20px;
    max-width: 480px;
    margin: 0 auto;
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(148, 163, 184, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: var(--text-secondary);
}

.empty-state-title {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 8px;
}

.empty-state-description {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
    line-height: 1.6;
}

.empty-state-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Onboarding Steps */
.onboarding-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 32px;
    text-align: left;
}

.onboarding-step-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
}

.onboarding-step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.onboarding-step-title {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 6px;
}

.onboarding-step-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ==========================================================================
   IMPORT CARD
   ========================================================================== */
.import-section-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    align-items: stretch;
}

.import-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    min-height: 240px;
}

.import-card-icon {
    margin-bottom: 8px;
}

.import-card-icon i {
    width: 22px;
    height: 22px;
}

.import-card h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
}

.import-card-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 10px;
    line-height: 1.4;
    min-height: 62px;
    overflow: hidden;
}

.file-input-wrapper {
    position: relative;
    margin-top: auto;
}

.import-card .btn-file-picker {
    width: 100%;
    justify-content: center;
    border-color: #f97316;
    background: #f97316;
    color: #fff;
    font-weight: 600;
    white-space: normal;
    text-align: center;
    line-height: 1.3;
    min-height: 38px;
    padding: 8px 10px;
}

.import-card .btn-file-picker:hover {
    background: #ea580c;
    border-color: #ea580c;
    color: #fff;
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-status-info {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
}

.action-bar-processing {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.processing-hint {
    font-size: 12px;
    color: var(--text-secondary);
    flex: 1;
}

.color-primary { color: var(--color-primary); }

/* ==========================================================================
   STANDARD FORM
   ========================================================================== */
.standard-form {
    width: 100%;
}

/* ==========================================================================
   COLLAPSIBLE PANEL
   ========================================================================== */
.collapsible-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    padding: 0;
}

.collapsible-panel.expanded {
    max-height: 2000px;
    padding: 12px 0 0 0;
}

/* ==========================================================================
   SHOP FORM
   ========================================================================== */
.shop-form-container {
    width: 100%;
}

.shop-form-header {
    cursor: pointer;
    padding: 8px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.shop-form-title {
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.shop-lookup-section {
    background: rgba(59, 130, 246, 0.04);
    border: 1px dashed rgba(59, 130, 246, 0.2);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 14px;
}

.shop-lookup-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-info);
    display: block;
    margin-bottom: 8px;
}

.shop-fee-group {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 14px;
}

.shop-fee-group-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.fee-toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    padding: 6px 0;
}

.text-font-sm { font-size: 13px; font-weight: 500; }
.text-font-xs { font-size: 11px; color: var(--text-muted); }

.shop-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.shop-list-group {
    margin-top: 20px;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 38px;
    height: 22px;
    display: inline-block;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-thumb {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 22px;
    transition: var(--transition-fast);
}

.toggle-thumb:before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: var(--transition-fast);
}

.toggle-switch input:checked + .toggle-thumb {
    background: var(--color-primary);
}

.toggle-switch input:checked + .toggle-thumb:before {
    transform: translateX(16px);
}

/* ==========================================================================
   DROPDOWN
   ========================================================================== */
.dropdown-wrapper {
    position: relative;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 50;
    background: #1a1a3e;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    min-width: 200px;
}

.dropdown-menu.show {
    display: block;
}

.p-3 { padding: 16px; }
.p-2 { padding: 12px; }

.action-dropdown {
    position: relative;
    display: inline-block;
}

.btn-trigger {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast);
}

.btn-trigger:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
}

.action-dropdown-menu {
    display: none;
    position: fixed;
    z-index: 9999;
    background: #1a1a3e;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 4px;
    min-width: 140px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.action-dropdown-menu.show {
    display: block;
}

.action-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 13px;
    cursor: pointer;
    border-radius: 4px;
    transition: background var(--transition-fast);
    text-align: left;
}

.action-dropdown-item:hover {
    background: rgba(249, 115, 22, 0.12);
    color: var(--color-primary);
}

.action-dropdown-item i {
    width: 14px;
    height: 14px;
}

/* ==========================================================================
   MODAL
   ========================================================================== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 420px;
    padding: 24px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.modal-icon i {
    width: 22px;
    height: 22px;
    color: var(--color-warning);
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.modal-body {
    margin-bottom: 20px;
}

.modal-body p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.import-history-modal-content {
    max-width: 1100px;
    width: min(1100px, 92vw);
}

.import-history-table-wrap {
    max-height: 58vh;
    overflow: auto;
}

.import-history-close-btn {
    margin-left: auto;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
}

.import-history-close-btn:hover {
    color: var(--text-main);
    background: var(--bg-hover);
}

/* ==========================================================================
   AUTH OVERLAY
   ========================================================================== */
.auth-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-body);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-container {
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 36px 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

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

.auth-logo-icon {
    font-size: 40px;
}

.auth-logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    margin: 8px 0 4px 0;
}

.auth-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.auth-tab {
    flex: 1;
    background: none;
    border: none;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast);
}

.auth-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

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

.auth-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-main);
}

.auth-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition-fast);
}

.auth-input:focus {
    border-color: var(--color-primary);
}

.auth-submit-btn {
    width: 100%;
    padding: 12px;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background var(--transition-fast);
}

.auth-submit-btn:hover {
    background: var(--color-primary-hover);
}

.auth-error-msg {
    color: var(--color-danger);
    font-size: 13px;
    text-align: center;
}

.auth-hint {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.hidden { display: none !important; }

.shop-required-overlay {
    position: fixed;
    inset: 0;
    z-index: 99990;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(5, 8, 18, 0.78);
    backdrop-filter: blur(10px);
}

.shop-required-panel {
    width: min(480px, 100%);
    border: 1px solid rgba(249, 78, 48, 0.35);
    border-radius: 10px;
    background: #111322;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.48);
    padding: 28px;
    text-align: center;
}

.shop-required-icon {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    margin: 0 auto 16px auto;
    border-radius: 10px;
    color: var(--color-primary);
    background: rgba(249, 78, 48, 0.12);
    border: 1px solid rgba(249, 78, 48, 0.2);
}

.shop-required-panel h2 {
    margin: 0 0 10px 0;
    font-size: 20px;
    color: var(--text-main);
}

.shop-required-panel p {
    margin: 0 0 20px 0;
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 13px;
}

/* ==========================================================================
   TOAST
   ========================================================================== */
.toast-container {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    width: min(420px, calc(100vw - 32px));
}

.toast {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: relative;
    overflow: hidden;
    width: 100%;
    background: rgba(18, 20, 38, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 12px 12px 14px 14px;
    font-size: 13px;
    color: var(--text-main);
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    backdrop-filter: blur(16px);
    pointer-events: auto;
    opacity: 0;
    transform: translate3d(24px, -6px, 0) scale(0.98);
    transition: opacity 180ms ease, transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
    will-change: opacity, transform;
}

.toast.show {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
}

.toast.hide {
    opacity: 0;
    transform: translate3d(18px, -4px, 0) scale(0.98);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.toast-message {
    line-height: 1.35;
    overflow-wrap: anywhere;
    font-weight: 700;
}

.toast.success { border-left: 3px solid var(--color-success); }
.toast.error { border-left: 3px solid var(--color-danger); }
.toast.warning { border-left: 3px solid var(--color-warning); }
.toast.info { border-left: 3px solid var(--color-info); }

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.toast.success .toast-icon { color: var(--color-success); }
.toast.error .toast-icon { color: var(--color-danger); }
.toast.warning .toast-icon { color: var(--color-warning); }
.toast.info .toast-icon { color: var(--color-info); }

.toast-close-btn {
    display: grid;
    place-items: center;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 7px;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.06);
    cursor: pointer;
    transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.toast-close-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.13);
}

.toast-close-btn:active {
    transform: scale(0.94);
}

.toast-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: currentColor;
    opacity: 0.65;
    transform-origin: left center;
    animation: toastProgress var(--toast-duration, 4000ms) linear forwards;
}

.toast.success .toast-progress { color: var(--color-success); }
.toast.error .toast-progress { color: var(--color-danger); }
.toast.warning .toast-progress { color: var(--color-warning); }
.toast.info .toast-progress { color: var(--color-info); }

@keyframes toastProgress {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

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

/* ==========================================================================
   SHIMMER / SKELETON LOADING
   ========================================================================== */
.shimmer-metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.shimmer-metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.shimmer-metric-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.shimmer-line {
    border-radius: 4px;
    background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.shimmer-line-sm { height: 12px; width: 60%; }
.shimmer-line-xl { height: 22px; width: 90%; }

.shimmer-cell {
    height: 14px;
    border-radius: 4px;
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ==========================================================================
   MOBILE BOTTOM NAV
   ========================================================================== */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-sidebar);
    border-top: 1px solid var(--border-color);
    z-index: 100;
    justify-content: space-around;
    padding: 6px 0 env(safe-area-inset-bottom, 6px);
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 12px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 10px;
    transition: color var(--transition-fast);
}

.mobile-nav-item.active {
    color: var(--color-primary);
}

.mobile-nav-item i {
    width: 20px;
    height: 20px;
}

/* ==========================================================================
   CHECKBOX WRAPPER (Column Toggler)
   ========================================================================== */
.checkbox-wrapper {
    padding: 2px 0;
}

/* ==========================================================================
   ORDERS TOOLBAR
   ========================================================================== */
.orders-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.orders-title-group {
    min-width: 240px;
}

.orders-toolbar-title {
    font-size: 16px;
    font-weight: 800;
    color: #fff;
    margin: 0;
    white-space: nowrap;
    flex-shrink: 0;
}

.orders-toolbar-subtitle {
    margin: 5px 0 0 0;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.45;
}

.orders-toolbar-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.orders-toolbar-search {
    flex: 1;
    min-width: 260px;
    max-width: 420px;
}

.orders-toolbar-search .search-input {
    width: 100%;
}

.orders-status-select {
    width: 180px;
    flex-shrink: 0;
}

.orders-summary-strip {
    display: grid;
    grid-template-columns: repeat(5, minmax(128px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.orders-summary-chip {
    min-height: 58px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.075);
}

.orders-summary-chip .summary-label {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.orders-summary-chip strong {
    color: var(--text-main);
    font-size: 16px;
    line-height: 1;
}

.orders-summary-chip.warning {
    background: rgba(245, 158, 11, 0.07);
    border-color: rgba(245, 158, 11, 0.16);
}

.orders-summary-chip.danger {
    background: rgba(239, 68, 68, 0.07);
    border-color: rgba(239, 68, 68, 0.16);
}

#tab-orders > .data-block-container.margin-top-lg {
    padding: 18px;
    background: rgba(14, 18, 34, 0.78);
}

/* Column toggle dropdown - detached from wrapper */
.orders-col-toggle-menu {
    display: none;
    position: fixed;
    z-index: 9999;
    background: #1a1a3e;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    min-width: 300px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 16px;
}

.orders-col-toggle-menu.show {
    display: block;
}

/* ==========================================================================
   TAB PANEL
   ========================================================================== */
.tab-panel {
    display: none;
}

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

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1024px) {
    .charts-row {
        grid-template-columns: 1fr;
    }
    .dashboard-decision-grid {
        grid-template-columns: 1fr;
    }
    .import-section-grid {
        grid-template-columns: 1fr 1fr;
    }
    .two-column-layout {
        grid-template-columns: 1fr;
    }
    .onboarding-steps {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .main-content {
        margin-left: 0;
        padding: 16px;
        padding-bottom: 72px;
    }
    .sidebar {
        transform: translateX(-100%);
        width: 85vw;
        max-width: 320px;
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .hamburger-menu {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .sidebarcollapse-btn {
        display: none;
    }
    .main-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .header-actions {
        width: 100%;
    }
    .header-actions .btn {
        flex: 1;
        font-size: 12px;
        padding: 8px 12px;
    }
    .mobile-bottom-nav {
        display: flex;
    }
    .metrics-grid {
        grid-template-columns: 1fr 1fr;
    }
    .table-search-filters {
        width: 100%;
    }
    .table-search-filters .search-input {
        flex: 1;
    }

    .orders-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .orders-toolbar-controls {
        justify-content: flex-start;
    }

    .orders-toolbar-search {
        min-width: 100%;
        max-width: none;
    }

    .orders-summary-strip {
        grid-template-columns: 1fr 1fr;
    }

    #orders-table-wrapper .table-scrollable {
        max-height: 56vh;
        min-height: 320px;
    }
    
    .action-bar-processing {
        flex-direction: column;
        align-items: stretch;
    }
    .processing-hint {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    .pagination-buttons .btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .orders-summary-strip {
        grid-template-columns: 1fr;
    }

    .orders-status-select,
    .orders-toolbar-controls .btn {
        width: 100%;
    }
}

/* ==========================================================================
   TEXT UTILITIES
   ========================================================================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.truncate-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 12px;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 4px;
}
.gap-lg { gap: 16px; }
.gap-sm { gap: 8px; }
