/* ==========================================
   July.Honeyy ERP SaaS - Premium Dark Theme v3
   Design Token System + Single Mobile Breakpoint
   ========================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ==========================================
   0. LOGIN SCREEN
   ========================================== */
#login-screen {
    font-family: 'Inter', sans-serif;
}
.pin-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: all .2s;
}
.pin-dot.filled {
    background: #FF6B9D;
    border-color: #FF6B9D;
    box-shadow: 0 0 8px rgba(255, 107, 157, 0.4);
}
.pin-dot.error {
    border-color: #FF5555;
    animation: pin-shake .4s;
}
.numpad-btn {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 1.3rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all .15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.numpad-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}
.numpad-btn:active {
    transform: scale(0.92);
    background: rgba(255, 107, 157, 0.2);
}
@keyframes pin-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

/* ---- Value Tooltip ---- */
.fmt-tip {
    position: relative;
    cursor: pointer;
    border-bottom: 1px dashed currentColor;
    opacity: 0.95;
}
.fmt-tip::after {
    content: attr(data-full);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    background: var(--bg-card, #1a1a2e);
    color: var(--text-primary, #fff);
    border: 1px solid var(--border, #333);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: all .15s;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.fmt-tip:hover::after,
.fmt-tip:active::after,
.fmt-tip.show-tip::after {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

/* ==========================================
   1. DESIGN TOKENS
   ========================================== */
:root {
    /* Colors — Dracula Dark */
    --primary: #FF6B9D;
    --primary-light: #FF8FB8;
    --primary-dark: #E0527E;
    --primary-glow: rgba(255, 107, 157, 0.3);
    --accent: #FFB86C;
    --accent-light: #FFD4A0;
    --success: #50FA7B;
    --success-bg: rgba(80, 250, 123, 0.12);
    --warning: #FFB86C;
    --warning-bg: rgba(255, 184, 108, 0.12);
    --danger: #FF5555;
    --danger-bg: rgba(255, 85, 85, 0.12);
    --info: #8BE9FD;
    --info-bg: rgba(139, 233, 253, 0.12);
    --purple: #BD93F9;
    --purple-bg: rgba(189, 147, 249, 0.12);

    /* Surfaces */
    --bg-primary: #0B0B19;
    --bg-secondary: #111128;
    --bg-card: #171735;
    --bg-card-hover: #1E1E45;
    --bg-input: #0F0F28;
    --bg-modal: rgba(0, 0, 0, 0.75);
    --surface-1: rgba(255, 255, 255, 0.03);
    --surface-2: rgba(255, 255, 255, 0.06);
    --surface-3: rgba(255, 255, 255, 0.09);

    /* Text */
    --text-primary: #F8F8F2;
    --text-secondary: #B0B0C8;
    --text-muted: #6272a4;

    /* Borders & Shadows */
    --border: rgba(255, 255, 255, 0.07);
    --border-hover: rgba(255, 107, 157, 0.3);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px var(--primary-glow);
    --glass-bg: rgba(17, 17, 40, 0.85);
    --glass-border: rgba(255, 255, 255, 0.08);

    /* Layout */
    --sidebar-w: 250px;
    --topbar-h: 60px;

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Transitions */
    --tr-fast: 0.15s ease;
    --tr-base: 0.3s ease;

    /* Typography scale */
    --text-xs: 0.65rem;
    --text-sm: 0.72rem;
    --text-base: 0.82rem;
    --text-md: 0.92rem;
    --text-lg: 1.15rem;
    --text-xl: 1.45rem;

    /* Component heights */
    --input-h: 40px;
    --btn-h: 38px;
    --btn-sm-h: 32px;
    --btn-icon-size: 32px;

    /* Spacing */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
}

/* ==========================================
   2. LIGHT THEME
   ========================================== */
[data-theme="light"] {
    --primary: #E8457C;
    --primary-light: #FF6B9D;
    --primary-dark: #C73866;
    --primary-glow: rgba(232, 69, 124, 0.2);
    --accent: #E8884A;
    --accent-light: #F5A76A;
    --success: #22A853;
    --success-bg: rgba(34, 168, 83, 0.1);
    --warning: #E8884A;
    --warning-bg: rgba(232, 136, 74, 0.1);
    --danger: #DC3545;
    --danger-bg: rgba(220, 53, 69, 0.08);
    --info: #2B95D6;
    --info-bg: rgba(43, 149, 214, 0.08);
    --purple: #8B5CF6;
    --purple-bg: rgba(139, 92, 246, 0.08);
    --bg-primary: #F8F0F4;
    --bg-secondary: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-card-hover: #FFF5F8;
    --bg-input: #FDF2F6;
    --bg-modal: rgba(0, 0, 0, 0.4);
    --surface-1: rgba(232, 69, 124, 0.03);
    --surface-2: rgba(232, 69, 124, 0.06);
    --surface-3: rgba(232, 69, 124, 0.09);
    --text-primary: #1A1A2E;
    --text-secondary: #555570;
    --text-muted: #8888A0;
    --border: rgba(232, 69, 124, 0.12);
    --border-hover: rgba(232, 69, 124, 0.35);
    --shadow-sm: 0 2px 8px rgba(232, 69, 124, 0.06);
    --shadow-md: 0 4px 16px rgba(232, 69, 124, 0.08);
    --shadow-lg: 0 8px 32px rgba(232, 69, 124, 0.1);
    --shadow-glow: 0 0 20px var(--primary-glow);
    --glass-bg: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(232, 69, 124, 0.1);
}

[data-theme="light"] .sidebar {
    background: linear-gradient(180deg, #FFFFFF 0%, #FFF5F8 100%);
    border-right: 1px solid var(--border);
    box-shadow: 2px 0 20px rgba(232, 69, 124, 0.05);
}

[data-theme="light"] .sidebar-brand {
    border-bottom-color: var(--border);
}

[data-theme="light"] .topbar {
    background: rgba(255, 255, 255, 0.85);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(20px);
}

[data-theme="light"] .card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

[data-theme="light"] .modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
}

[data-theme="light"] .form-control {
    background: var(--bg-input);
    border-color: rgba(232, 69, 124, 0.15);
    color: var(--text-primary);
}

[data-theme="light"] .form-control:focus {
    border-color: var(--primary);
    background: #FFFFFF;
}

[data-theme="light"] .nav-item:hover {
    background: rgba(232, 69, 124, 0.06);
}

[data-theme="light"] .nav-item.active {
    background: rgba(232, 69, 124, 0.1);
    border-left-color: var(--primary);
}

[data-theme="light"] .stat-card {
    background: linear-gradient(135deg, #FFFFFF 0%, #FFF5F8 100%);
    border: 1px solid var(--border);
}

[data-theme="light"] .btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

[data-theme="light"] .table th {
    background: rgba(232, 69, 124, 0.04);
    color: var(--text-muted);
}

[data-theme="light"] .table tr:hover td {
    background: rgba(232, 69, 124, 0.03);
}

[data-theme="light"] .kanban-col-header {
    background: rgba(232, 69, 124, 0.05);
}

[data-theme="light"] .kanban-card {
    background: #FFFFFF;
    border: 1px solid var(--border);
}

[data-theme="light"] .kanban-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

[data-theme="light"] .item-card {
    background: #FEFBFC;
    border: 1px solid var(--border);
}

[data-theme="light"] .img-drop-zone {
    background: var(--bg-input);
    border-color: rgba(232, 69, 124, 0.2);
}

[data-theme="light"] ::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: rgba(232, 69, 124, 0.2);
}

[data-theme="light"] .kanban-col {
    background: #FFFFFF;
    box-shadow: var(--shadow-sm);
}

[data-theme="light"] .kanban-card {
    background: #FEFBFC;
}

[data-theme="light"] .kanban-card:hover {
    background: #FFF5F8;
}

/* ==========================================
   3. SMOOTH THEME TRANSITION
   ========================================== */
body,
body *:not(i):not(img):not(video) {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.15s ease, box-shadow 0.3s ease;
}

/* ==========================================
   4. RESET & BASE
   ========================================== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: inherit;
}

html {
    font-size: 13.5px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: var(--text-base);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--surface-3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

a {
    color: var(--info);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ==========================================
   5. LAYOUT
   ========================================== */
.app {
    display: flex;
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform var(--tr-base);
}

.sidebar-brand {
    padding: var(--sp-4) 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border);
    min-height: 60px;
}

.sidebar-brand .brand-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-lg);
    flex-shrink: 0;
    box-shadow: var(--shadow-glow);
}

.sidebar-brand .brand-name {
    font-size: 1rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-brand .brand-sub {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.sidebar-nav {
    flex: 1;
    padding: var(--sp-2);
    overflow-y: auto;
}

.nav-group-title {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 10px 12px 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--tr-fast);
    font-weight: 500;
    font-size: var(--text-md);
    margin-bottom: 1px;
    user-select: none;
    position: relative;
}

.nav-item:hover {
    background: var(--surface-2);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(255, 107, 157, 0.15), rgba(255, 184, 108, 0.05));
    color: var(--primary);
    font-weight: 600;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 55%;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

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

.nav-item .badge {
    margin-left: auto;
    background: var(--primary);
    color: white;
    font-size: var(--text-xs);
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: var(--sp-2);
    border-top: 1px solid var(--border);
}

/* ---- Sidebar Backdrop ---- */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 99;
    opacity: 0;
    transition: opacity .3s ease;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

.sidebar-backdrop.show {
    display: block;
    opacity: 1;
}

/* ---- Main ---- */
.main {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---- Topbar ---- */
.topbar {
    height: var(--topbar-h);
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--sp-6);
    position: sticky;
    top: 0;
    z-index: 50;
}

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

.topbar-title {
    font-size: 1.2rem;
    font-weight: 700;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
}

.menu-toggle:hover {
    background: var(--surface-2);
}

/* ---- Search Box ---- */
.search-box {
    position: relative;
    width: 260px;
}

.search-box input {
    width: 100%;
    padding: 8px 12px 8px 34px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--text-base);
    transition: all var(--tr-fast);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

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

/* ---- Page ---- */
.page {
    flex: 1;
    padding: var(--sp-5) var(--sp-6);
}

.page-section {
    display: none;
    min-width: 0;
    overflow: hidden;
}

.page-section.active {
    display: block;
    animation: fadeIn .25s ease;
}

/* ==========================================
   6. ANIMATIONS
   ========================================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(16px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 10px var(--primary-glow); }
    50% { box-shadow: 0 0 22px var(--primary-glow); }
}

@keyframes slideUpModal {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

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

/* ==========================================
   7. THEME TOGGLE
   ========================================== */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: var(--text-sm);
    transition: all var(--tr-base);
    white-space: nowrap;
}

.theme-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-glow);
}

.theme-toggle i {
    font-size: .9rem;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.theme-toggle:hover i {
    transform: rotate(30deg);
}

/* ==========================================
   8. STATS GRID
   ========================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--sp-4);
    margin-bottom: var(--sp-6);
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    transition: all var(--tr-base);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    opacity: 0;
    transition: opacity var(--tr-base);
}

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

.stat-card:hover::before {
    opacity: 1;
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-lg);
    flex-shrink: 0;
}

.stat-icon.revenue {
    background: rgba(255, 107, 157, 0.12);
    color: var(--primary);
}

.stat-icon.profit {
    background: var(--success-bg);
    color: var(--success);
}

.stat-icon.orders {
    background: var(--info-bg);
    color: var(--info);
}

.stat-icon.cost {
    background: var(--warning-bg);
    color: var(--warning);
}

.stat-icon.customers {
    background: var(--purple-bg);
    color: var(--purple);
}

.stat-icon.pending {
    background: var(--danger-bg);
    color: var(--danger);
}

.stat-icon.loss {
    background: var(--danger-bg);
    color: var(--danger);
}

.stat-icon.returns {
    background: rgba(255, 121, 198, 0.12);
    color: #FF79C6;
}

.stat-label {
    font-size: var(--text-sm);
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 3px;
}

.stat-value {
    font-size: var(--text-xl);
    font-weight: 700;
    line-height: 1.2;
    word-break: break-word;
    overflow-wrap: break-word;
}

.stat-sub {
    font-size: var(--text-sm);
    margin-top: 3px;
}

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

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

/* ==========================================
   9. CARDS
   ========================================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: var(--sp-5);
}

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

.card-title {
    font-size: var(--text-md);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

.card-body {
    padding: 18px;
    min-width: 0;
    overflow: hidden;
}

.card-body.no-pad {
    padding: 0;
}

/* ==========================================
   10. BUTTONS
   ========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    height: var(--btn-h);
    border-radius: var(--radius-sm);
    font-size: var(--text-base);
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--tr-fast);
    white-space: nowrap;
    user-select: none;
}

.btn:active {
    transform: scale(.97);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 12px rgba(255, 107, 157, .3);
}

.btn-primary:hover {
    box-shadow: 0 6px 18px rgba(255, 107, 157, .4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--surface-2);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--surface-3);
    border-color: var(--border-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--surface-2);
    color: var(--text-primary);
}

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

.btn-danger:hover {
    box-shadow: 0 4px 12px rgba(255, 85, 85, .3);
}

.btn-success {
    background: var(--success);
    color: #0B0B19;
}

.btn-sm {
    padding: 5px 10px;
    height: var(--btn-sm-h);
    font-size: var(--text-sm);
}

.btn-xs {
    padding: 3px 8px;
    height: auto;
    font-size: var(--text-xs);
}

.btn-icon {
    width: var(--btn-icon-size);
    height: var(--btn-icon-size);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--tr-fast);
}

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

.btn-pink {
    background: linear-gradient(135deg, #FF79C6, #FF55A3);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 121, 198, 0.3);
}
.btn-pink:hover {
    box-shadow: 0 6px 18px rgba(255, 121, 198, 0.4);
}

/* ==========================================
   10b. SEARCHABLE SELECT
   ========================================== */
.ss-wrap {
    position: relative;
}
.ss-input {
    cursor: text;
}
.ss-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    z-index: 1000;
    box-shadow: var(--shadow-md);
}
.ss-dropdown.open {
    display: block;
}
.ss-option {
    padding: 8px 12px;
    font-size: var(--text-sm);
    cursor: pointer;
    transition: background var(--tr-fast);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ss-option:hover {
    background: var(--surface-2);
}
.ss-option.active {
    color: var(--primary);
    font-weight: 600;
}
.ss-empty {
    padding: 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: var(--text-sm);
}

/* ==========================================
   11. TABLES
   ========================================== */
.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th {
    padding: 10px 14px;
    text-align: left;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    background: var(--surface-1);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

table td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    font-size: var(--text-base);
    color: var(--text-secondary);
    vertical-align: middle;
}

table tbody tr {
    transition: background var(--tr-fast);
}

table tbody tr:hover {
    background: var(--surface-1);
}

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

/* Desktop defaults: hide mobile list, show table */
.ord-mobile-list { display: none; }

/* ==========================================
   12. BADGES — Status
   ========================================== */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-1);
    padding: 3px 10px;
    border-radius: 16px;
    font-size: var(--text-sm);
    font-weight: 600;
    white-space: nowrap;
}

.badge-status.s-customer-ordered {
    background: rgba(189, 147, 249, 0.15);
    color: #BD93F9;
}

.badge-status.s-ordered-taobao {
    background: rgba(139, 233, 253, 0.15);
    color: #8BE9FD;
}

.badge-status.s-shipping-cn {
    background: rgba(255, 184, 108, 0.15);
    color: #FFB86C;
}

.badge-status.s-arrived-vn {
    background: rgba(80, 250, 123, 0.15);
    color: #50FA7B;
}

.badge-status.s-returned {
    background: rgba(255, 85, 85, 0.15);
    color: #FF5555;
}

.badge-status.s-warehouse {
    background: rgba(255, 121, 198, 0.15);
    color: #FF79C6;
}

.badge-status.s-delivering {
    background: rgba(241, 250, 140, 0.15);
    color: #F1FA8C;
}

.badge-status.s-completed {
    background: rgba(80, 250, 123, 0.25);
    color: #50FA7B;
}

/* ---- Channel Badges ---- */
.ch-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: var(--text-xs);
    font-weight: 500;
}

.ch-instagram {
    background: rgba(225, 48, 108, 0.15);
    color: #E1306C;
}

.ch-facebook {
    background: rgba(24, 119, 242, 0.15);
    color: #1877F2;
}

.ch-shopee {
    background: rgba(238, 77, 45, 0.15);
    color: #EE4D2D;
}

.ch-tiktok {
    background: rgba(105, 201, 208, 0.15);
    color: #69C9D0;
}

.ch-zalo {
    background: rgba(0, 106, 255, 0.15);
    color: #006AFF;
}

.ch-other {
    background: var(--surface-2);
    color: var(--text-secondary);
}

/* ---- Result Badges ---- */
.result-badge {
    padding: 3px 10px;
    border-radius: 16px;
    font-size: var(--text-sm);
    font-weight: 600;
}

.result-completed {
    background: var(--success-bg);
    color: var(--success);
}

.result-returned {
    background: var(--warning-bg);
    color: var(--warning);
}

.result-cancelled {
    background: var(--surface-2);
    color: var(--text-muted);
}

.result-lost {
    background: var(--danger-bg);
    color: var(--danger);
}

.result-partial_lost {
    background: rgba(255, 121, 198, 0.15);
    color: #FF79C6;
}

/* ==========================================
   13. FORMS
   ========================================== */
.form-group {
    margin-bottom: 14px;
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.form-label .req {
    color: var(--danger);
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: var(--text-base);
    transition: all var(--tr-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236272a4' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

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

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.form-hint {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-top: var(--sp-1);
    font-style: italic;
}

/* ==========================================
   14. MODALS
   ========================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-modal);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--sp-4);
}

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

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp .25s ease;
}

.modal-lg {
    max-width: 820px;
}

.modal-xl {
    max-width: 1000px;
}

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

.modal-title {
    font-size: var(--text-lg);
    font-weight: 700;
}

.modal-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
}

.modal-close:hover {
    background: var(--surface-2);
    color: var(--text-primary);
}

.modal-body {
    padding: 18px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--sp-2);
    padding: 12px 18px;
    border-top: 1px solid var(--border);
}

/* ==========================================
   15. KANBAN DESKTOP
   ========================================== */
#pg-kanban {
    margin: -20px -24px;
    padding: 0;
    overflow: hidden;
}

#pg-kanban.active {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--topbar-h));
}

.kanban-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    flex-shrink: 0;
    gap: 12px;
}

.kanban-nav-btn {
    width: var(--btn-icon-size);
    height: var(--btn-icon-size);
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    transition: all var(--tr-fast);
    flex-shrink: 0;
}

.kanban-nav-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
    transform: scale(1.1);
}

.kanban-hint {
    font-size: var(--text-sm);
    color: var(--text-muted);
    text-align: center;
    flex: 1;
}

.kanban {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 10px 10px;
    flex: 1;
    min-height: 0;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.kanban::-webkit-scrollbar {
    height: 5px;
}

.kanban::-webkit-scrollbar-track {
    background: transparent;
}

.kanban::-webkit-scrollbar-thumb {
    background: var(--primary-glow);
    border-radius: 3px;
}

.kanban-col {
    flex: 1 1 0;
    min-width: 0;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    max-height: 100%;
    transition: border-color var(--tr-fast);
}

.kanban-col:hover {
    border-color: var(--border-hover);
}

.kanban-col-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    font-weight: 600;
    font-size: var(--text-xs);
    border-bottom: 1px solid var(--border);
    background: var(--surface-1);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
}

.kanban-col-header .count {
    background: var(--primary);
    color: white;
    font-size: 0.58rem;
    font-weight: 700;
    padding: 0 5px;
    border-radius: 8px;
    min-width: 16px;
    text-align: center;
    flex-shrink: 0;
}

.kanban-col-body {
    flex: 1;
    overflow-y: auto;
    padding: 5px;
    min-height: 60px;
    transition: background var(--tr-fast);
}

.kanban-col-body::-webkit-scrollbar {
    width: 3px;
}

.kanban-col-body::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.kanban-col-body.drag-over {
    background: var(--primary-glow);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.kanban-card {
    background: var(--bg-card-hover);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 7px;
    margin-bottom: 5px;
    cursor: grab;
    transition: all var(--tr-fast);
    position: relative;
    font-size: var(--text-base);
}

.kanban-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.kanban-card.dragging {
    opacity: 0.4;
    transform: rotate(2deg);
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}

.kanban-card:active {
    cursor: grabbing;
}

.kc-code {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1px;
}

.kc-customer {
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kc-product {
    font-size: 0.6rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.kc-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--sp-1);
    padding-top: var(--sp-1);
    border-top: 1px dashed var(--border);
}

.kc-price {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--success);
}

.kc-date {
    font-size: 0.55rem;
    color: var(--text-muted);
}

/* ==========================================
   16. TRACKING TIMELINE
   ========================================== */
.tracking {
    display: flex;
    align-items: center;
    gap: 0;
    padding: var(--sp-4) 0;
    overflow-x: auto;
}

.tracking-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
    min-width: 70px;
}

.tracking-step::after {
    content: '';
    position: absolute;
    top: 16px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: var(--border);
    z-index: 0;
}

.tracking-step:last-child::after {
    display: none;
}

.tracking-step.done::after {
    background: var(--success);
}

.tracking-step.current::after {
    background: linear-gradient(90deg, var(--primary), var(--border));
}

.tracking-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    z-index: 1;
    transition: all var(--tr-base);
}

.tracking-step.done .tracking-dot {
    border-color: var(--success);
    background: var(--success-bg);
    color: var(--success);
}

.tracking-step.current .tracking-dot {
    border-color: var(--primary);
    background: rgba(255, 107, 157, 0.15);
    color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
    animation: pulse 2s infinite;
}

.tracking-label {
    font-size: 0.62rem;
    color: var(--text-muted);
    margin-top: 6px;
    text-align: center;
    max-width: 70px;
    font-weight: 500;
    line-height: 1.3;
}

.tracking-step.done .tracking-label {
    color: var(--success);
}

.tracking-step.current .tracking-label {
    color: var(--primary);
}

/* ==========================================
   17. TABS
   ========================================== */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--sp-4);
    overflow-x: auto;
}

.tab {
    padding: 9px 18px;
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--tr-fast);
    white-space: nowrap;
    user-select: none;
}

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

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

/* ==========================================
   18. FILTER / ACTION BAR
   ========================================== */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: var(--sp-4);
}

.filter-bar .form-control {
    width: auto;
    min-width: 140px;
}

.page-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    margin-bottom: var(--sp-4);
}

.page-action-bar .filter-bar {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
}

/* ==========================================
   19. PAYMENT BAR
   ========================================== */
.payment-bar {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--surface-2);
}

.payment-bar .paid {
    background: var(--success);
}

.payment-bar .remaining {
    background: var(--danger);
}

/* ==========================================
   20. DETAIL GRID
   ========================================== */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.detail-grid-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.detail-item .d-label {
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .3px;
    display: block;
}

.detail-item .d-value {
    font-size: var(--text-base);
    color: var(--text-primary);
    font-weight: 600;
    display: block;
    word-break: break-word;
}

.detail-item .d-value.highlight {
    color: var(--primary);
    font-weight: 700;
    font-size: 1.05rem;
}

/* ==========================================
   21. COST BREAKDOWN
   ========================================== */
.cost-row {
    margin-bottom: 14px;
}

.cost-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    gap: 8px;
    min-width: 0;
}

.cost-row-label {
    font-size: var(--text-base);
    color: var(--text-secondary);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cost-row-value {
    font-size: var(--text-base);
    font-weight: 600;
    text-align: right;
    word-break: break-word;
    min-width: 0;
    flex-shrink: 0;
}

/* ==========================================
   22. EMPTY STATE
   ========================================== */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 2.5rem;
    margin-bottom: var(--sp-3);
    opacity: 0.35;
}

.empty-state h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.empty-state p {
    font-size: var(--text-base);
    margin-bottom: var(--sp-4);
}

/* ==========================================
   23. TOAST
   ========================================== */
.toast-container {
    position: fixed;
    top: var(--sp-4);
    right: var(--sp-4);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    box-shadow: var(--shadow-lg);
    animation: slideInRight .3s ease;
    min-width: 260px;
}

.toast.success {
    border-left: 3px solid var(--success);
}

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

.toast.info {
    border-left: 3px solid var(--info);
}

.toast.warning {
    border-left: 3px solid var(--warning);
}

/* ==========================================
   24. CONFIRM DIALOG
   ========================================== */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-modal);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

.confirm-overlay.open {
    display: flex;
}

.confirm-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--sp-6);
    text-align: center;
    max-width: 360px;
    box-shadow: var(--shadow-lg);
    animation: slideUp .2s ease;
}

.confirm-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--danger-bg);
    color: var(--danger);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    font-size: 1.3rem;
}

.confirm-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.confirm-msg {
    font-size: var(--text-base);
    color: var(--text-secondary);
    margin-bottom: var(--sp-5);
}

.confirm-actions {
    display: flex;
    gap: var(--sp-2);
    justify-content: center;
}

/* ==========================================
   25. PROGRESS
   ========================================== */
.progress {
    height: 5px;
    background: var(--surface-2);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transition: width var(--tr-base);
}

/* ==========================================
   26. IMAGE UPLOAD
   ========================================== */
.img-drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: var(--sp-4);
    text-align: center;
    cursor: pointer;
    transition: all var(--tr-base);
    background: var(--surface-1);
    min-height: 100px;
    position: relative;
}

.img-drop-zone:hover,
.img-drop-zone.drag-over {
    border-color: var(--primary);
    background: rgba(255, 107, 157, 0.05);
    box-shadow: 0 0 0 3px rgba(255, 107, 157, 0.1);
}

.img-drop-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    padding: 10px;
}

.img-drop-placeholder i {
    font-size: 2rem;
    color: var(--primary);
    opacity: 0.5;
}

.img-drop-placeholder span {
    font-size: var(--text-base);
}

.img-drop-placeholder strong {
    color: var(--primary);
}

.img-preview-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.img-preview-item {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 2px solid var(--border);
    transition: all var(--tr-fast);
    flex-shrink: 0;
}

.img-preview-item:hover {
    border-color: var(--primary);
    transform: scale(1.05);
}

.img-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.img-preview-remove {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--danger);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    opacity: 0;
    transition: opacity var(--tr-fast);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.img-preview-item:hover .img-preview-remove {
    opacity: 1;
}

.order-images-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: var(--sp-2);
}

.order-images-grid img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border);
    cursor: pointer;
    transition: all var(--tr-fast);
}

.order-images-grid img:hover {
    border-color: var(--primary);
    transform: scale(1.05);
    box-shadow: var(--shadow-glow);
}

/* Image lightbox */
.img-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    cursor: pointer;
    animation: fadeIn .2s ease;
}

.img-lightbox img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: 0 0 40px rgba(255, 107, 157, 0.2);
}

/* Order image thumbnail in table */
.ord-img-thumb {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
    margin-right: var(--sp-2);
    vertical-align: middle;
    cursor: pointer;
    transition: all var(--tr-fast);
}

.ord-img-thumb:hover {
    border-color: var(--primary);
    transform: scale(1.15);
    box-shadow: var(--shadow-glow);
}

/* ==========================================
   27. ITEM CARD
   ========================================== */
.item-card {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-bottom: 10px;
    position: relative;
    animation: slideUp .2s ease;
}

.item-card:hover {
    border-color: var(--border-hover);
}

.item-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.item-card-num {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--primary);
    background: rgba(255, 107, 157, 0.1);
    padding: 2px 10px;
    border-radius: 12px;
}

.item-card .btn-remove-item {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--danger-bg);
    color: var(--danger);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    transition: all var(--tr-fast);
}

.item-card .btn-remove-item:hover {
    background: var(--danger);
    color: white;
    transform: scale(1.1);
}

.item-card .img-drop-zone {
    min-height: 60px;
    padding: var(--sp-2);
}

.item-card .img-drop-placeholder {
    padding: var(--sp-1);
}

.item-card .img-drop-placeholder i {
    font-size: 1.2rem;
}

.item-card .img-drop-placeholder span {
    font-size: var(--text-sm);
}

/* ==========================================
   28. TRACKING CODES
   ========================================== */
.tracking-code {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-1);
    padding: 3px 10px;
    border-radius: 6px;
    font-size: var(--text-sm);
    font-weight: 600;
    font-family: 'Courier New', monospace;
    letter-spacing: .5px;
}

.tracking-code.tc-cn {
    background: rgba(255, 184, 108, 0.1);
    color: var(--warning);
}

.tracking-code.tc-intl {
    background: rgba(189, 147, 249, 0.1);
    color: var(--purple);
}

.tracking-code.tc-vn {
    background: rgba(80, 250, 123, 0.1);
    color: var(--success);
}

/* ==========================================
   29. PAGINATION
   ========================================== */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-3) var(--sp-4);
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
    gap: var(--sp-2);
}

.pg-info {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.pg-btns {
    display: flex;
    align-items: center;
    gap: var(--sp-1);
}

.pg-btn {
    min-width: var(--btn-icon-size);
    height: var(--btn-icon-size);
    border: 1px solid var(--border);
    background: var(--surface-1);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: var(--text-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .15s;
}

.pg-btn:hover:not([disabled]):not(.active) {
    background: var(--surface-2);
    border-color: var(--primary);
    color: var(--primary);
}

.pg-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 600;
}

.pg-btn[disabled] {
    opacity: .35;
    cursor: not-allowed;
}

.pg-dots {
    color: var(--text-muted);
    font-size: var(--text-sm);
    padding: 0 var(--sp-1);
}

/* ==========================================
   30. INVOICE PRINT
   ========================================== */
.invoice-print {
    background: white;
    color: #333;
    padding: 36px;
    border-radius: var(--radius-lg);
    max-width: 640px;
    margin: 0 auto;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    line-height: 1.5;
}
.inv-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}
.inv-brand { display: flex; gap: 12px; align-items: flex-start; }
.inv-logo {
    width: 44px; height: 44px;
    background: linear-gradient(135deg, #FF6B9D, #FF8FB1);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.2rem;
    flex-shrink: 0;
}
.inv-brand h2 { color: #1a1a2e; margin: 0 0 2px; font-size: 1.15rem; }
.inv-brand p { margin: 0; font-size: 11px; color: #888; }
.inv-brand p i { width: 14px; color: #aaa; }
.inv-meta { text-align: right; }
.inv-code {
    font-size: 1.1rem; font-weight: 700;
    color: #FF6B9D;
    letter-spacing: 0.5px;
}
.inv-date, .inv-order { font-size: 11px; color: #888; margin-top: 2px; }
.inv-date i, .inv-order i { width: 14px; margin-right: 2px; color: #aaa; }
.inv-divider {
    height: 1px;
    background: linear-gradient(to right, transparent, #ddd, transparent);
    margin: 18px 0;
}
.inv-customer { margin-bottom: 4px; }
.inv-section-title {
    font-size: 11px; font-weight: 700;
    color: #888; text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 10px;
}
.inv-section-title i { color: #FF6B9D; margin-right: 4px; }
.inv-cust-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; font-size: 13px; }
.inv-label { color: #999; font-size: 12px; }
.inv-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
}
.inv-table th {
    background: #f8f8fb;
    color: #666;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 12px;
    border-bottom: 2px solid #eee;
}
.inv-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    color: #333;
    font-size: 13px;
}
.inv-table tbody tr:last-child td { border-bottom: none; }
.inv-totals {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 2px solid #eee;
}
.inv-total-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 12px;
    font-size: 13px;
    color: #666;
}
.inv-grand-total {
    margin-top: 8px;
    padding: 12px;
    background: linear-gradient(135deg, #fff0f5, #fff5f8);
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #FF6B9D;
}
.inv-notes {
    margin-top: 16px;
    padding: 10px 14px;
    background: #f8f8fb;
    border-radius: 6px;
    font-size: 12px;
    color: #666;
}
.inv-footer {
    margin-top: 24px;
    text-align: center;
    padding-top: 16px;
    border-top: 1px dashed #ddd;
}
.inv-thanks {
    font-size: 15px;
    font-weight: 700;
    color: #FF6B9D;
    margin-bottom: 4px;
}
.inv-footer-note {
    font-size: 11px;
    color: #aaa;
}

/* ==========================================
   31. RISK
   ========================================== */
.risk-low {
    color: var(--success);
}

.risk-medium {
    color: var(--warning);
}

.risk-high {
    color: var(--danger);
}

/* ==========================================
   32. DASHBOARD
   ========================================== */
.dash-grid {
    grid-template-columns: 1fr;
}

.dash-grid .stat-card {
    transition: all .15s;
}

.dash-grid .stat-card:active {
    transform: scale(.97);
}

.dash-empty {
    text-align: center;
    padding: 30px 16px;
    color: var(--text-muted);
    font-size: var(--text-base);
    grid-column: 1 / -1;
}

.dash-empty i {
    margin-right: 6px;
    opacity: .4;
}

/* Status select in orders table */
.status-select {
    width: auto;
    min-width: 130px;
    padding: 5px 26px 5px 8px;
    font-size: var(--text-sm);
}

/* ==========================================
   33. MOBILE ORDER CARDS
   ========================================== */
.om-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    margin-bottom: var(--sp-2);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.om-card:active {
    background: var(--surface-1);
}

.om-row-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.om-code {
    font-weight: 700;
    font-size: var(--text-base);
    color: var(--primary);
}

.om-row-mid {
    margin-bottom: 6px;
    line-height: 1.4;
}

.om-customer {
    font-size: var(--text-base);
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.om-product {
    font-size: var(--text-sm);
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.om-prices {
    display: flex;
    gap: var(--sp-2);
    align-items: baseline;
}

.om-sell {
    font-weight: 700;
    font-size: var(--text-base);
    color: var(--text-primary);
}

.om-profit {
    font-size: var(--text-sm);
    font-weight: 600;
}

.om-actions {
    display: flex;
    gap: var(--sp-1);
}

.om-btn {
    width: var(--btn-icon-size);
    height: var(--btn-icon-size);
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface-1);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.om-btn:active {
    background: var(--surface-2);
}

.om-btn-del {
    color: var(--danger);
}

/* ---- Customer Mobile Cards ---- */
.cust-mobile-list { display: none; }

.cm-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    margin-bottom: var(--sp-2);
}

.cm-row-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.cm-name {
    font-weight: 700;
    font-size: var(--text-base);
    color: var(--text-primary);
}

.cm-row-mid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
    margin-bottom: 6px;
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.cm-phone, .cm-address {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

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

.cm-stats {
    display: flex;
    gap: var(--sp-3);
    font-size: var(--text-sm);
}

.cm-actions {
    display: flex;
    gap: var(--sp-1);
}

/* ---- Invoice Mobile Cards ---- */
.inv-mobile-list { display: none; }

.invm-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    margin-bottom: var(--sp-2);
}

.invm-row-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.invm-customer {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.invm-row-mid {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: var(--text-sm);
}

.invm-order {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
}

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

.invm-date {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* ---- Payment Mobile Cards ---- */
.pay-mobile-list { display: none; }

.pm-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    margin-bottom: var(--sp-2);
}

.pm-row-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.pm-row-mid {
    margin-bottom: 6px;
}

.pm-amounts {
    display: flex;
    gap: var(--sp-3);
    font-size: var(--text-sm);
}

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

/* ---- Warehouse Mobile Cards ---- */
.wh-mobile-list { display: none; }

.wm-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    margin-bottom: var(--sp-2);
}

.wm-row-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

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

.wm-meta {
    display: flex;
    gap: var(--sp-3);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.wm-actions {
    display: flex;
    gap: var(--sp-1);
}

/* ---- Expense Mobile Cards ---- */
.exp-mobile-list { display: none; }

.em-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    margin-bottom: var(--sp-2);
}

.em-row-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.em-row-mid {
    margin-bottom: 6px;
}

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

/* ---- Returns Mobile Cards ---- */
.ret-mobile-list { display: none; }

.rm-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    margin-bottom: var(--sp-2);
}

.rm-row-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.rm-row-mid {
    display: flex;
    gap: var(--sp-3);
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.rm-row-bottom {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
}

/* ---- Analytics Mobile Cards ---- */
.anam-card {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: var(--sp-2);
    cursor: pointer;
    overflow: hidden;
    min-width: 0;
}
.anam-card:active { background: var(--surface-2); }
.anam-row-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.anam-row-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--text-xs);
    gap: 4px;
    flex-wrap: wrap;
}

/* ---- Kanban Load More ---- */
.ka-load-more {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    width: 100%;
    padding: 10px;
    margin-top: var(--sp-2);
    background: var(--surface-1);
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.ka-load-more:active {
    background: var(--surface-2);
}

.om-pay-bar {
    margin-top: 6px;
    height: 3px;
    border-radius: 2px;
    display: flex;
    overflow: hidden;
    background: var(--surface-2);
}

.om-pay-bar .paid {
    background: var(--success);
}

.om-pay-bar .remaining {
    background: var(--surface-2);
}

/* ==========================================
   34. MOBILE KANBAN ACCORDION
   ========================================== */
.ka-accordion {
    padding: var(--sp-2);
    padding-bottom: calc(var(--sp-2) + env(safe-area-inset-bottom, 0px));
}

.ka-section {
    margin-bottom: 6px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-card);
    overflow: hidden;
}

.ka-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 14px;
    border: none;
    background: var(--surface-1);
    color: var(--text-primary);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    font-size: var(--text-base);
    font-weight: 600;
}

.ka-header:active {
    background: var(--surface-2);
}

.ka-header-left {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

.ka-icon {
    font-size: var(--text-lg);
}

.ka-title {
    font-size: var(--text-base);
}

.ka-count {
    background: var(--primary);
    color: white;
    font-size: var(--text-sm);
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    line-height: 1.4;
}

.ka-chevron {
    font-size: .7rem;
    color: var(--text-muted);
    transition: transform .25s ease;
}

.ka-section.open .ka-chevron {
    transform: rotate(180deg);
}

.ka-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease;
    padding: 0 10px;
}

.ka-section.open .ka-body {
    max-height: 2000px;
    padding: var(--sp-2) 10px 10px;
}

.ka-empty {
    text-align: center;
    padding: var(--sp-4) var(--sp-2);
    color: var(--text-muted);
    font-size: var(--text-sm);
}

.ka-empty i {
    margin-right: 6px;
    opacity: .4;
}

/* ---- Kanban Mobile Card ---- */
.km-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--sp-3);
    margin-bottom: var(--sp-2);
    cursor: pointer;
    transition: all .15s;
    -webkit-tap-highlight-color: transparent;
}

.km-card:active {
    transform: scale(.98);
    border-color: var(--primary);
}

.km-card-main {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.km-card-img {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.km-card-info {
    flex: 1;
    min-width: 0;
}

.km-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

.km-card-top strong {
    font-size: var(--text-base);
}

.km-card-price {
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--success);
    white-space: nowrap;
}

.km-card-customer {
    font-size: var(--text-base);
    color: var(--text-primary);
    margin-bottom: 1px;
}

.km-card-product {
    font-size: var(--text-sm);
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.km-card-tracks {
    display: flex;
    gap: var(--sp-1);
    flex-wrap: wrap;
    margin-top: var(--sp-1);
}

.km-card-tracks .tracking-code {
    font-size: var(--text-sm);
    padding: 2px 6px;
}

.km-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--sp-2);
    padding-top: var(--sp-2);
    border-top: 1px dashed var(--border);
}

.km-card-meta {
    display: flex;
    gap: 10px;
    font-size: var(--text-sm);
}

.km-card-days {
    color: var(--text-muted);
}

.km-card-payment {
    font-weight: 600;
}

.km-advance-btn,
.km-card-advance {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-1);
    padding: 5px 10px;
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    min-height: var(--btn-sm-h);
    box-shadow: 0 2px 6px rgba(255, 107, 157, 0.3);
}

.km-advance-btn:active,
.km-card-advance:active {
    filter: brightness(0.9);
    box-shadow: 0 1px 3px rgba(255, 107, 157, 0.3);
}

/* ==========================================
   35. UTILITY CLASSES
   ========================================== */
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-right { text-align: right !important; }
.text-center { text-align: center !important; }
.fw-bold { font-weight: 700 !important; }
.mt-1 { margin-top: 8px !important; }
.mt-2 { margin-top: 16px !important; }
.mb-1 { margin-bottom: 8px !important; }
.mb-2 { margin-bottom: 16px !important; }
.d-flex { display: flex !important; }
.align-center { align-items: center !important; }
.justify-between { justify-content: space-between !important; }
.flex-wrap { flex-wrap: wrap !important; }
.gap-1 { gap: 8px !important; }
.gap-2 { gap: 16px !important; }
.w-100 { width: 100% !important; }
.cursor-pointer { cursor: pointer; }
.full-span { grid-column: 1/-1; }

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-5);
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--sp-5);
}

/* Kanban mobile tabs & utility — hidden on desktop */
.kanban-mobile-tabs { display: none; }
.kanban-empty { display: none; }

/* Mobile sub-text under main cell — hidden on desktop */
.mobile-sub { display: none; }
/* Show only on mobile — hidden on desktop */
.show-mobile { display: none !important; }

/* Mobile-hide utility class */
.hide-mobile { display: table-cell; }

/* ==========================================
   36. iOS SAFE AREA
   ========================================== */
@supports (padding: env(safe-area-inset-top)) {
    .topbar {
        padding-top: env(safe-area-inset-top);
        height: calc(var(--topbar-h) + env(safe-area-inset-top));
    }
    .sidebar {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
    .page {
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }
    .modal-overlay {
        padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    }
    .toast-container {
        top: calc(12px + env(safe-area-inset-top));
        right: calc(12px + env(safe-area-inset-right));
    }
}

/* PWA standalone */
@media (display-mode: standalone) {
    body { overscroll-behavior-y: contain; }
    .topbar {
        padding-top: env(safe-area-inset-top, 0px);
        height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
    }
}

/* ==========================================
   37. TABLET (1024px)
   ========================================== */
@media (max-width: 1024px) {
    .grid-3 { grid-template-columns: 1fr 1fr; }
    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); }
    .kanban-col { min-width: 200px; }
    .page { padding: var(--sp-4) 18px; }
}

/* ==========================================
   38. MOBILE — SINGLE BREAKPOINT (768px)
   Token overrides make all components auto-scale
   ========================================== */
@media (max-width: 768px) {
    /* ---- Token overrides for mobile ---- */
    :root {
        --text-xs: 12px;
        --text-sm: 13px;
        --text-base: 15px;
        --text-md: 15px;
        --text-lg: 16px;
        --text-xl: 20px;
        --input-h: 38px;
        --btn-h: 38px;
        --btn-sm-h: 34px;
        --btn-icon-size: 34px;
    }

    /* ---- Layout ---- */
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        box-shadow: var(--shadow-lg);
    }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; overflow-x: hidden; }
    .menu-toggle { display: flex; }
    .page { padding: 14px 12px; padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); overflow-x: hidden; max-width: 100vw; box-sizing: border-box; }

    /* ---- Topbar ---- */
    .topbar {
        padding: env(safe-area-inset-top, 0px) 10px 0;
        height: calc(52px + env(safe-area-inset-top, 0px));
    }
    .topbar-left {
        gap: 10px;
        flex-shrink: 0;
    }
    .topbar-title {
        max-width: 130px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .topbar-right {
        gap: 4px;
        position: relative;
        flex-shrink: 0;
    }

    /* Sync indicator compact */
    #sync-indicator { margin-right: 0 !important; font-size: .85rem; }

    /* Theme toggle icon-only */
    .theme-toggle span { display: none; }
    .theme-toggle {
        width: var(--btn-h);
        height: var(--btn-h);
        padding: 0;
        min-width: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: var(--radius-sm);
    }

    /* Search: overlay when opened */
    .search-box {
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
        width: 0;
        min-width: 0;
        overflow: hidden;
        opacity: 0;
        transition: all .3s ease;
        z-index: 10;
    }
    .search-box.mobile-open {
        width: calc(100vw - 80px);
        max-width: 320px;
        opacity: 1;
        right: -10px;
    }

    /* Mobile search btn */
    .mobile-search-btn {
        width: var(--btn-h);
        height: var(--btn-h);
        display: flex;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        color: var(--text-secondary);
        cursor: pointer;
        border-radius: var(--radius-sm);
        font-size: .9rem;
        flex-shrink: 0;
        -webkit-tap-highlight-color: transparent;
    }
    .mobile-search-btn:active { background: var(--surface-2); }

    /* ---- Page Action Bar ---- */
    .page-action-bar {
        flex-direction: column;
        align-items: stretch;
        gap: var(--sp-2);
    }
    .page-action-bar .filter-bar {
        flex-wrap: wrap;
        gap: 6px;
    }
    .page-action-bar > .btn {
        align-self: stretch;
        justify-content: center;
    }
    #pg-kanban .page-action-bar {
        padding: 20px var(--sp-2) 20px;
        margin-bottom: 0 !important;
    }

    /* LEGACY: d-flex justify-between wrapping filter+button */
    .d-flex.align-center.justify-between.mb-2 {
        flex-direction: column;
        align-items: stretch !important;
        gap: 10px;
    }
    .d-flex.align-center.justify-between.mb-2 > .btn {
        align-self: stretch;
        justify-content: center;
    }

    /* ---- Stats Grid ---- */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--sp-2);
        margin-bottom: 14px;
    }
    .stat-card {
        padding: var(--sp-3);
        gap: 10px;
        border-radius: var(--radius-md);
    }
    .stat-card:hover { transform: none; }
    .stat-icon { width: 36px; height: 36px; font-size: 1rem; }

    /* ---- Grids ---- */
    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
        gap: var(--sp-3);
    }

    /* ---- Cards ---- */
    .card {
        margin-bottom: var(--sp-3);
        border-radius: var(--radius-md);
    }
    .card-header {
        padding: var(--sp-3) 14px;
        flex-wrap: wrap;
        gap: var(--sp-2);
    }
    .card-body { padding: 14px; }
    .card-body.no-pad { padding: 0; }

    /* ---- Forms ---- */
    .form-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    .form-row.tracking-row,
    .item-card .form-row:has(.item-track-cn) {
        grid-template-columns: 1fr;
    }
    .modal .form-label, .modal label {
        margin-bottom: 3px;
    }
    textarea.form-control {
        min-height: 44px;
    }
    .form-group { margin-bottom: var(--sp-2); }

    /* ---- Detail Grid ---- */
    .detail-grid { grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
    .detail-grid-3 { grid-template-columns: 1fr 1fr 1fr; }

    /* ---- Order Detail ---- */
    .order-detail-finance .detail-grid {
        grid-template-columns: 1fr 1fr;
    }
    .payment-history-item {
        flex-wrap: wrap;
        gap: var(--sp-1);
    }
    .modal-body[style*="max-height"] {
        max-height: none !important;
    }

    /* ---- Desktop Table hidden on mobile ---- */
    .ord-desktop-table { display: none !important; }
    .ord-mobile-list { display: block; }
    .cust-desktop-table { display: none !important; }
    .cust-mobile-list { display: block; }
    .pay-desktop-table { display: none !important; }
    .pay-mobile-list { display: block; }
    .inv-desktop-table { display: none !important; }
    .inv-mobile-list { display: block; }
    .wh-desktop-table { display: none !important; }
    .wh-mobile-list { display: block; }
    .exp-desktop-table { display: none !important; }
    .exp-mobile-list { display: block; }
    .ret-desktop-table { display: none !important; }
    .ret-mobile-list { display: block; }
    .ana-desktop-table { display: none !important; }
    .ana-mobile-list { display: block; }
    .hide-mobile { display: none !important; }
    .show-mobile { display: block !important; }

    /* ---- Filter Bar ---- */
    .filter-bar {
        flex-wrap: wrap;
        gap: var(--sp-2);
    }
    .filter-bar .form-control {
        flex: 1 1 auto;
        min-width: 120px;
        width: auto;
    }

    /* ---- Tabs ---- */
    .tabs {
        margin: 0 -12px 14px;
        padding: 0 12px;
        gap: 0;
        -webkit-overflow-scrolling: touch;
    }
    .tab {
        padding: 8px 14px;
        flex-shrink: 0;
    }

    /* ---- Modal Bottom-Sheet ---- */
    .modal-overlay {
        align-items: flex-end;
        padding: 0;
    }
    .modal {
        max-width: 100%;
        width: 100%;
        margin: 0;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        max-height: 92vh;
        animation: slideUpModal .3s ease;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    .modal-lg, .modal-xl { max-width: 100%; }
    .modal-header {
        padding: 10px 14px 12px;
        flex-shrink: 0;
        background: var(--bg-card);
        z-index: 2;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        flex-wrap: wrap;
        justify-content: space-between;
    }
    .modal-header::before {
        display: none;
    }
    .modal-title {
        font-size: var(--text-md);
        font-weight: 700;
    }
    .modal-close {
        width: 32px;
        height: 32px;
        font-size: 1.2rem;
    }
    .modal-body {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 12px 14px;
    }
    .modal-footer {
        padding: 10px 14px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
        position: sticky;
        bottom: 0;
        background: var(--bg-card);
        z-index: 2;
        gap: var(--sp-2);
    }
    .modal-footer .btn {
        padding: 7px 16px;
    }

    /* ---- Buttons Touch-Friendly ---- */
    .btn { padding: 7px 14px; }
    .btn-sm { padding: 5px 10px; }
    .btn-xs { padding: 3px 7px; }
    td .btn-icon { width: 32px; height: 32px; min-width: 32px; }
    td .d-flex.gap-1 { gap: 4px !important; }

    /* ---- Kanban Mobile — Accordion ---- */
    #pg-kanban {
        margin: -14px -12px;
        padding: 0;
        overflow: visible;
    }
    #pg-kanban.active {
        display: block;
        overflow: visible;
    }

    .kanban {
        display: block !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        padding: 0;
        min-height: 0;
        -webkit-overflow-scrolling: touch;
    }
    .kanban-col,
    .kanban-col-header,
    .kanban-col-body { display: none !important; }
    .kanban-mobile-tabs { display: none !important; }
    .kanban-nav { display: none; }
    .kanban-hint { display: none; }

    /* ---- Tracking Vertical ---- */
    .tracking {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        padding: var(--sp-3) 0;
    }
    .tracking-step {
        flex-direction: row;
        align-items: center;
        gap: var(--sp-3);
        min-width: auto;
        padding: 6px 0;
    }
    .tracking-step::after {
        top: 32px;
        left: 15px;
        width: 2px;
        height: calc(100% - 10px);
    }
    .tracking-step:last-child::after { display: none; }
    .tracking-dot { width: 30px; height: 30px; flex-shrink: 0; }
    .tracking-label { text-align: left; max-width: none; }

    /* ---- Pagination ---- */
    .pagination-bar {
        padding: 10px var(--sp-2);
        justify-content: center;
        flex-wrap: wrap;
    }
    .pg-info {
        width: 100%;
        text-align: center;
        order: -1;
        margin-bottom: var(--sp-1);
    }
    .pg-btn { min-width: 36px; height: 36px; }

    /* ---- Cost Rows ---- */
    .cost-row { margin-bottom: var(--sp-3); }
    .cost-row-header { flex-wrap: wrap; gap: 2px; }
    .cost-row-label, .cost-row-value { font-size: var(--text-sm); }

    /* ---- Images ---- */
    .order-images-grid img { width: 60px; height: 60px; }
    .img-preview-item { width: 64px; height: 64px; }
    .img-preview-remove { opacity: 1; }
    .img-drop-zone { min-height: 70px; padding: var(--sp-3); }

    /* ---- Item Cards ---- */
    .item-card { padding: 10px; margin-bottom: var(--sp-2); }
    .item-card .form-row { gap: 6px; }
    .item-card .form-group { margin-bottom: 5px !important; }
    .item-card-header { padding: 0 0 6px; }
    .btn-remove-item { width: 26px; height: 26px; font-size: 13px; }

    /* ---- Toast — bottom on mobile ---- */
    .toast-container {
        top: auto;
        bottom: var(--sp-4);
        right: var(--sp-3);
        left: var(--sp-3);
    }
    .toast { min-width: auto; width: 100%; }

    /* ---- Confirm ---- */
    .confirm-box { max-width: calc(100vw - 40px); padding: var(--sp-5); }

    /* ---- Invoice Print ---- */
    .invoice-print { padding: 16px; font-size: 12px; }
    .inv-header { flex-direction: column; gap: 12px; }
    .inv-meta { text-align: left; }
    .inv-cust-grid { grid-template-columns: 1fr; }
    .inv-table th, .inv-table td { padding: 8px 6px; font-size: 12px; }
    .inv-grand-total { font-size: 1rem; }

    /* ---- Dashboard Mobile ---- */
    .dash-grid {
        grid-template-columns: 1fr !important;
        gap: 6px;
    }
    #dash-status-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 6px;
    }
    #dash-status-grid .stat-card {
        padding: 8px 10px;
    }
    #dash-status-grid .stat-value {
        font-size: 1rem;
    }

    /* ---- Empty State ---- */
    .empty-state { padding: 30px var(--sp-4); }
    .empty-state i { font-size: 2rem; }

    /* ---- Settings Data Stats (inline grid-3) ---- */
    .detail-grid[style*="grid-template-columns:1fr 1fr 1fr"],
    .detail-grid[style*="grid-template-columns: 1fr 1fr 1fr"] {
        grid-template-columns: 1fr 1fr 1fr !important;
    }

    /* ---- Order Detail Items ---- */
    .order-item-row {
        flex-direction: column;
        gap: var(--sp-2);
    }
    .order-item-img {
        width: 60px !important;
        height: 60px !important;
    }

    /* ---- Inline Style Overrides ---- */
    [style*="padding:16px;background:var(--surface-1)"] {
        padding: 12px !important;
    }
    [style*="display:flex;gap:12px"] {
        gap: 10px !important;
    }
    [style*="width:70px;height:70px;object-fit:cover"] {
        width: 56px !important;
        height: 56px !important;
    }

    /* ---- Nav Items Touch ---- */
    .nav-item { padding: 12px 14px; }
}

/* ==========================================
   39. PRINT MEDIA
   ========================================== */
@media print {
    body * { visibility: hidden; }
    #modal-invoice-preview,
    #modal-invoice-preview .modal,
    #modal-invoice-preview .modal-body,
    #modal-invoice-preview .invoice-print,
    #modal-invoice-preview .invoice-print * {
        visibility: visible;
    }
    #modal-invoice-preview {
        position: fixed; inset: 0;
        background: white !important;
        z-index: 99999;
    }
    #modal-invoice-preview .modal {
        position: static;
        max-width: 100%;
        box-shadow: none;
        border: none;
        background: white;
    }
    #modal-invoice-preview .modal-header,
    #modal-invoice-preview .modal-footer {
        display: none !important;
    }
    .invoice-print {
        padding: 20px !important;
        max-width: 100% !important;
        box-shadow: none !important;
        border-radius: 0 !important;
    }
    .inv-logo { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .inv-grand-total { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .inv-table th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ==========================================
   v9.0 - AI / Inbox / Posts / Templates
   ========================================== */

/* Switch toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    vertical-align: middle;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: var(--surface-2, #1f1f2e);
    transition: .3s;
    border-radius: 24px;
    border: 1px solid var(--border, #333);
}
.switch .slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-muted, #888);
    transition: .3s;
    border-radius: 50%;
}
.switch input:checked + .slider {
    background-color: var(--primary, #FF6B9D);
    border-color: var(--primary, #FF6B9D);
}
.switch input:checked + .slider:before {
    transform: translateX(20px);
    background-color: #fff;
}

/* Inbox layout */
.inbox-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    height: calc(100vh - 220px);
    min-height: 500px;
    overflow: hidden;
}
.thread-item:hover {
    background: var(--surface-1, #1a1a26);
}
.thread-item.active {
    background: var(--surface-2, #1f1f2e);
    border-left: 3px solid var(--primary, #FF6B9D);
    padding-left: 9px !important;
}
.msg-out > div {
    border-bottom-right-radius: 4px !important;
}
.msg-in > div {
    border-bottom-left-radius: 4px !important;
}

/* Login auth form */
#login-auth-form input {
    transition: border-color 0.2s;
}
#login-auth-form input:focus {
    outline: none;
    border-color: var(--primary, #FF6B9D) !important;
}

/* Mobile inbox: single column with toggle */
@media (max-width: 768px) {
    .inbox-layout {
        grid-template-columns: 1fr;
        height: calc(100vh - 180px);
    }
    .inbox-layout #inbox-thread-list {
        display: none;
    }
    .inbox-layout.show-list #inbox-thread-list {
        display: block;
    }
    .inbox-layout.show-list #inbox-conversation {
        display: none;
    }
}

/* ==========================================
   v9.2 - Products / Taobao Tools
   ========================================== */

/* Product grid */
.prod-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}
@media (max-width: 768px) {
    .prod-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}
@media (max-width: 420px) {
    .prod-grid { grid-template-columns: 1fr; }
}

.prod-card {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.2s;
    position: relative;
}
.prod-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.prod-card.selected {
    border-color: var(--info);
    border-width: 2px;
    background: rgba(139, 233, 253, 0.05);
}
.prod-card.ai-winner {
    border-color: var(--primary);
    border-width: 2px;
    box-shadow: 0 0 20px rgba(255, 107, 157, 0.2);
}

.prod-card-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    background: linear-gradient(135deg, #FF6B9D, #FFB86C);
    color: #fff;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.prod-card-score {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
}

.prod-card-img-wrap {
    aspect-ratio: 1;
    overflow: hidden;
    cursor: pointer;
    background: var(--surface-2);
}
.prod-card-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}
.prod-card:hover .prod-card-img-wrap img {
    transform: scale(1.05);
}
.prod-card-no-img {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 2rem;
}

.prod-card-body {
    padding: 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.prod-card-title {
    font-size: 0.78rem;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text-primary);
    min-height: 2.1em;
}
.prod-card-prices {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
}
.prod-card-cny {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--warning);
}
.prod-card-vnd {
    font-size: 0.72rem;
    color: var(--text-muted);
}
.prod-card-seller {
    font-size: 0.7rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.prod-card-actions {
    display: flex;
    gap: 4px;
    margin-top: auto;
}
.prod-action-btn {
    flex: 1;
    padding: 6px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.72rem;
    transition: all 0.15s;
    text-decoration: none;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.prod-action-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.prod-action-btn.primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.prod-action-btn.primary:hover {
    opacity: 0.9;
}
