@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* Simple Light Theme (White, Black, Blue) */
    --bg-principal: #f9fafb; /* Light gray background */
    --bg-secondary: #ffffff; /* White for cards, sidebar */
    --text-principal: #111827; /* Near black */
    --text-muted: #6b7280; /* Gray text */
    
    --btn-primary: #2563eb; /* Blue primary */
    --btn-primary-hover: #1d4ed8;
    --btn-primary-text: #ffffff;
    
    --btn-secondary: #f3f4f6; /* Light gray button */
    --btn-secondary-hover: #e5e7eb;
    --btn-secondary-text: #374151;

    --border-color: #e5e7eb;
    --radius: 8px; /* Slightly sharper corners */
    --transition: all 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-principal);
    color: var(--text-principal);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: var(--text-principal);
}

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

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
    background-color: var(--bg-principal);
}

/* Sidebar */
.sidebar {
    width: 76px;
    background-color: #18181b;
    border-radius: 24px;
    margin: 16px 0 16px 16px;
    height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 0;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25), 0 2px 8px rgba(0,0,0,0.15);
    position: sticky;
    top: 16px;
    border: none;
    z-index: 100;
    flex-shrink: 0;
    align-self: flex-start;
    overflow: hidden;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.expanded {
    width: 230px;
    align-items: flex-start;
    padding: 24px 16px;
}

.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    width: 100%;
    padding: 0 4px;
    min-height: 40px;
    overflow: hidden;
}

.sidebar.expanded .brand {
    justify-content: flex-start;
    gap: 12px;
    padding: 0 4px;
}

.brand-name {
    color: white;
    font-weight: 600;
    font-size: 1rem;
    white-space: nowrap;
    opacity: 0;
    width: 0;
    overflow: hidden;
    transition: opacity 0.2s ease 0.1s, width 0.3s ease;
}

.sidebar.expanded .brand-name {
    opacity: 1;
    width: auto;
}

.brand-icon {
    color: white;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    flex-shrink: 0;
}

/* Toggle Button */
.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.1);
    cursor: pointer;
    color: #a1a1aa;
    margin-bottom: 20px;
    transition: background 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: rgba(255,255,255,0.12);
    color: #ffffff;
}

.sidebar-toggle .icon-expand {
    display: block;
}
.sidebar-toggle .icon-collapse {
    display: none;
}
.sidebar.expanded .sidebar-toggle .icon-expand {
    display: none;
}
.sidebar.expanded .sidebar-toggle .icon-collapse {
    display: block;
}
.sidebar.expanded .sidebar-toggle {
    width: 100%;
    justify-content: flex-end;
    padding-right: 4px;
    background: transparent;
    border: none;
}

.nav-links {
    list-style: none;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    align-items: center;
}

.sidebar.expanded .nav-links {
    align-items: stretch;
}

.nav-links li {
    margin-bottom: 0;
    width: 100%;
    display: flex;
    justify-content: center;
}

.sidebar.expanded .nav-links li {
    justify-content: stretch;
}

.nav-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    width: 48px;
    height: 48px;
    color: #a1a1aa;
    border-radius: 14px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    flex-shrink: 0;
    gap: 0;
}

.sidebar.expanded .nav-links a {
    width: 100%;
    padding: 0 14px;
    justify-content: flex-start;
    gap: 12px;
}

.nav-links a svg {
    margin: 0;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.nav-label {
    opacity: 0;
    width: 0;
    overflow: hidden;
    transition: opacity 0.2s ease 0.05s, width 0.3s ease;
    font-size: 0.9rem;
}

.sidebar.expanded .nav-label {
    opacity: 1;
    width: auto;
}

.nav-links a:hover {
    background-color: rgba(255, 255, 255, 0.07);
    color: #ffffff;
}

.nav-links a.active {
    background-color: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.1), 0 4px 12px rgba(0,0,0,0.2);
}

.logout-link {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    width: 48px;
    height: 48px;
    color: #a1a1aa;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 14px;
    margin-top: auto;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    gap: 0;
    flex-shrink: 0;
}

.sidebar.expanded .logout-link {
    width: 100%;
    padding: 0 14px;
    justify-content: flex-start;
    gap: 12px;
}

.logout-link svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}
.logout-link:hover {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 2.5rem;
    max-width: calc(100vw - 108px);
    min-width: 0;
    transition: max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
}
.page-title {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.page-title-text h1 {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
}

.page-title-text p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Global Desktop Search Pill */
.mobile-search-input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    background: #f3f4f6;
    border-radius: 9999px;
    padding: 0 12px;
    height: 40px;
}
.mobile-search-input-wrapper > svg {
    color: #6b7280;
}
.mobile-search-input-wrapper input {
    border: none;
    background: transparent;
    flex: 1;
    padding: 0 8px;
    font-size: 0.95rem;
    outline: none;
    width: 100%;
}
.mobile-search-btn {
    display: none;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
    cursor: pointer;
}
.mobile-search-input-wrapper input:not(:placeholder-shown) + .mobile-search-btn {
    display: flex;
}
.desktop-search-pill {
    display: flex;
    align-items: center;
    background-color: #eeeeee;
    border-radius: 9999px;
    padding: 4px;
    width: 280px;
    transition: all 0.3s ease;
}

.desktop-search-pill input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 12px 8px 16px;
    font-size: 14.5px;
    outline: none;
    color: #111;
    font-weight: 600;
}

.desktop-search-pill input::placeholder {
    color: #a3a3a3;
    font-weight: 700;
}

.desktop-search-pill .search-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: #000;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 2;
}

/* When typing (not placeholder shown), make button black with white icon */
.desktop-search-pill input:not(:placeholder-shown) + .search-btn {
    background: #000;
    color: #fff;
}

/* Progress bar effect */
.desktop-search-pill.searching {
    position: relative;
    overflow: hidden;
}
.desktop-search-pill.searching::before {
    content: '';
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 100%;
    background-color: #000;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 1.5s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 0;
}
.desktop-search-pill.searching.animate-progress::before {
    transform: scaleX(1);
}
.desktop-search-pill.searching input {
    color: #fff;
    z-index: 1;
}
.desktop-search-pill.searching .search-btn {
    color: #fff;
    background: transparent;
}

@media (max-width: 768px) {
    .desktop-search-pill {
        display: none;
    }
}

/* Cards */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.stat-title {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
}

.stat-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background-color: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-principal);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    gap: 8px;
}

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

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

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

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

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-principal);
}

.form-control {
    width: 100%;
    padding: 0.6rem 0.8rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-principal);
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--btn-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Tabs */
.tabs-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    padding: 0.5rem 0;
    background: none;
    border: none;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.tab-btn.active {
    color: var(--text-principal);
    border-bottom-color: var(--text-principal);
}

.tab-btn-pill {
    padding: 0.4rem 0.8rem;
    background: var(--btn-secondary);
    border-radius: 20px;
    color: var(--text-principal);
    font-weight: 500;
    font-size: 0.85rem;
    border: none;
    cursor: pointer;
}
.tab-btn-pill.active {
    background: #e5e7eb;
}

/* Tables */
.table-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow-x: auto;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

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

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

th {
    font-weight: 500;
    color: var(--text-muted);
    background-color: #f9fafb;
}

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

/* Badges */
.badge {
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}
.badge-new { background-color: #f3f4f6; color: #374151; }
.badge-confirmed { background-color: #dbeafe; color: #1e40af; }
.badge-followup { background-color: #fef3c7; color: #92400e; }
.badge-assigned { background-color: #d1fae5; color: #065f46; }

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal.active { display: flex; }
.modal-content {
    background-color: var(--bg-secondary);
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    padding: 2rem;
    position: relative;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
.close-modal {
    position: absolute;
    top: 1rem; right: 1rem;
    cursor: pointer;
    color: var(--text-muted);
    background: none;
    border: none;
    font-size: 1.2rem;
}
/* "Annuler"-style footer buttons also carry .close-modal for the JS hook —
   they must stay in normal flow, only the bare × is pinned top-right. */
.btn.close-modal {
    position: static;
    font-size: 0.9rem;
}
.btn-secondary.close-modal {
    color: var(--btn-secondary-text);
    background-color: var(--btn-secondary);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}
.empty-state svg {
    margin-bottom: 1rem;
    color: #9ca3af;
}

/* Auth Page Specific */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
    background: var(--bg-principal);
}
.auth-card {
    width: 100%;
    max-width: 400px;
}
.error-message {
    background-color: #fef2f2;
    color: #ef4444;
    padding: 0.75rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    border: 1px solid #fca5a5;
    font-size: 0.9rem;
}

/* Mobile Adjustments */
.bottom-nav { display: none; }
.mobile-header { display: none; }
/* .mobile-page-body wraps each page's actual content (not just decorative chrome),
   so on desktop it must not hide anything — display:contents removes the wrapper
   from layout entirely, leaving children to render exactly as if it wasn't there. */
.mobile-page-body { display: contents; }
.page-transition-overlay { display: none; }
.mobile-sub-header { display: none; }
.mobile-menu-panel { display: none; }
.mobile-menu-backdrop { display: none; }

/* Upload Dropzone */
.upload-dropzone {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 2.5rem 1.5rem;
    background: #f9fafb;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 160px;
}
.upload-dropzone:hover {
    border-color: #9ca3af;
    background: #f3f4f6;
}
.upload-dropzone.dragover {
    border-color: #3b82f6;
    background: #eff6ff;
}
.upload-dropzone.has-file {
    border-style: solid;
    border-color: #c7d2fe;
    background: #f5f8ff;
    cursor: default;
}

/* Date filter drawer — works on all screen sizes */
.date-filter-drawer {
    position: fixed;
    top: 0;
    right: -340px;
    width: min(320px, 90vw);
    height: 100vh;
    background: #fff;
    z-index: 5100;
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.date-filter-drawer.open {
    right: 0;
}
.date-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}
.date-drawer-header h3 {
    margin: 0;
    font-size: 16px;
}
.date-drawer-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6b7280;
}
.date-drawer-close:hover { color: #111; }
.date-drawer-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    flex: 1;
}
.date-drawer-btn {
    text-align: left;
    padding: 12px 16px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}
.date-drawer-btn:hover {
    background: #f3f4f6;
}
.date-drawer-btn.active-date {
    background: #1d4f8a;
    color: #fff;
    border-color: #1d4f8a;
    font-weight: 600;
}

@media (max-width: 768px) {
    /* Hide scrollbars for mobile but allow scrolling */
    *::-webkit-scrollbar {
        display: none !important;
    }
    * {
        -ms-overflow-style: none !important;
        scrollbar-width: none !important;
    }

    body {
        background-color: #000;
    }
    

    .sidebar {
        position: fixed;
        top: 0;
        left: -250px;
        height: 100vh;
        z-index: 5000;
        transition: left 0.3s ease;
        display: flex;
        box-shadow: 4px 0 20px rgba(0,0,0,0.18);
    }
    .sidebar.open {
        left: 0;
    }
    .mobile-backdrop {
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 4900;
        display: none;
    }
    .mobile-backdrop.active {
        display: block;
    }

    /* Mobile Date Filter Drawer */
    .date-filter-drawer {
        top: auto;
        bottom: -100%;
        right: 0;
        left: 0;
        width: 100%;
        height: auto;
        max-height: 85vh;
        border-radius: 24px 24px 0 0;
        transition: bottom 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .date-filter-drawer.open {
        bottom: 0;
        right: 0;
    }
    .date-drawer-close {
        width: 32px;
        height: 32px;
        background-color: #f3f4f6;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 20px;
        color: #374151;
        border: none;
        padding: 0;
        line-height: 1;
        margin: 0;
    }

    .main-content {
        max-width: 100vw;
        padding: 1rem;
        padding-top: 0;
        padding-bottom: 80px;
    }
    
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 12px;
        left: 50%;
        transform: translateX(-50%);
        background: #18181b;
        border-radius: 20px;
        padding: 8px 10px;
        justify-content: space-around;
        align-items: center;
        z-index: 999;
        gap: 4px;
        box-shadow: 0 8px 32px rgba(0,0,0,0.35), 0 2px 8px rgba(0,0,0,0.2);
        width: calc(100% - 32px);
        max-width: 420px;
        padding-bottom: calc(8px + env(safe-area-inset-bottom));
    }
    .bn-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        color: #71717a;
        font-size: 0.65rem;
        gap: 3px;
        padding: 8px 12px;
        border-radius: 14px;
        border: none;
        background: none;
        cursor: pointer;
        transition: all 0.2s ease;
        flex: 1;
        font-family: inherit;
        text-decoration: none;
    }
    .bn-item:hover, .bn-item.active {
        color: #ffffff;
        background: rgba(255,255,255,0.1);
    }
    .bn-hamburger {
        color: #71717a;
    }
    .bn-hamburger:hover {
        color: #ffffff;
        background: rgba(255,255,255,0.1);
    }

    /* Slide-up Menu Panel */
    .mobile-menu-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.6);
        z-index: 5100;
        backdrop-filter: blur(2px);
    }
    .mobile-menu-backdrop.active {
        display: block;
    }
    .mobile-menu-panel {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 50vh;
        background: #18181b;
        border-radius: 28px 28px 0 0;
        z-index: 5200;
        padding: 12px 20px 32px;
        transform: translateY(100%);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 -10px 40px rgba(0,0,0,0.4);
        display: flex;
        flex-direction: column;
    }
    .mobile-menu-panel.open {
        transform: translateY(0);
    }
    .mobile-menu-handle {
        width: 40px;
        height: 4px;
        background: rgba(255,255,255,0.2);
        border-radius: 2px;
        margin: 0 auto 20px;
        flex-shrink: 0;
    }
    .mobile-menu-links {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 4px;
        overflow-y: auto;
    }
    .mobile-menu-item {
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 13px 16px;
        border-radius: 14px;
        color: #a1a1aa;
        font-size: 0.95rem;
        font-weight: 500;
        text-decoration: none;
        transition: all 0.2s ease;
    }
    .mobile-menu-item:hover,
    .mobile-menu-item.active {
        background: rgba(255,255,255,0.1);
        color: #ffffff;
    }
    .mobile-menu-logout {
        color: #f87171;
        margin-top: auto;
    }
    .mobile-menu-logout:hover {
        background: rgba(239,68,68,0.1);
        color: #f87171;
    }

    .page-header, .shopify-stats-container {
        display: none !important;
    }
    
    /* The header keeps 20px of black below the title row; the white card pulls
       up over it (margin-top: -20px) so its rounded top corners reveal black,
       like the original Commandes design. */
    .mobile-header {
        display: block;
        background: #000;
        color: white;
        margin: 0 -1rem 0 -1rem;
        padding: 1rem 1rem 20px 1rem;
    }

    .mobile-top-bar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        /* Fixed height: identical black bar on every page, with or without an action button */
        height: 44px;
    }
    
    .mobile-top-bar h2 {
        color: white;
        font-size: 1.5rem;
        font-weight: 700;
        margin: 0;
    }
    
    .mobile-icon-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        color: white;
        padding: 8px;
        cursor: pointer;
    }

    /* Shared white rounded-top card that holds every mobile page's content,
       directly under the black .mobile-header title bar. */
    .mobile-page-body {
        display: block;
        position: relative;
        background: #fff;
        border-radius: 20px 20px 0 0;
        /* Pull up over the header's 20px black tail so the rounded corners show black */
        margin: -20px -1rem 0 -1rem;
        padding: 16px;
        min-height: calc(100vh - 150px);
        color: #111;
    }

    /* position: fixed so it always covers the visible viewport, not the full
       (possibly very tall/scrolled) height of .mobile-page-body's content.
       `top` is set inline by JS at click-time to match the card's current
       on-screen position. */
    .page-transition-overlay {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 20;
        background: #fff;
        border-radius: 20px 20px 0 0;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        gap: 0.75rem;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.15s ease;
    }
    .page-transition-overlay.active {
        opacity: 1;
        pointer-events: all;
    }

    .mobile-sub-header {
        display: block;
        margin-bottom: 4px;
    }

    .mobile-search-row {
        display: flex;
        gap: 12px;
        margin-bottom: 16px;
    }

    .mobile-search-input-wrapper {
        flex: 1;
        position: relative;
    }

    .mobile-search-input-wrapper > svg {
        position: absolute;
        left: 12px;
        top: 50%;
        transform: translateY(-50%);
        color: #9ca3af;
    }

    .mobile-search-input-wrapper input {
        width: 100%;
        background: #f3f4f6;
        border: none;
        border-radius: 8px;
        padding: 10px 10px 10px 36px;
        font-size: 15px;
        outline: none;
    }

    .mobile-date-filter-btn {
        background: #f3f4f6;
        border: none;
        color: #374151;
        border-radius: 8px;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }
    
    .mobile-status-filters {
        display: flex;
        gap: 16px;
        overflow-x: auto;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
        border-bottom: 1px solid #f3f4f6;
    }
    .mobile-status-filters::-webkit-scrollbar {
        display: none;
    }
    
    .mobile-stat-btn {
        background: none;
        border: none;
        white-space: nowrap;
        font-size: 14px;
        font-weight: 500;
        color: #6b7280;
        display: flex;
        align-items: center;
        gap: 6px;
        padding-bottom: 8px;
        border-bottom: 2px solid transparent;
        cursor: pointer;
    }
    .mobile-stat-btn.active {
        color: #111827;
        border-bottom-color: #111827;
    }
    
    .count-circle {
        background: #f3f4f6;
        color: #4b5563;
        font-size: 11px;
        padding: 2px 6px;
        border-radius: 12px;
    }
    .mobile-stat-btn.active .count-circle {
        background: #e5e7eb;
    }
    
    /* Responsive Table Layout */
    .table-container {
        overflow: visible !important;
        border: none !important;
        box-shadow: none !important;
        background: transparent !important;
    }
    .desktop-td {
        display: none !important;
    }
    .mobile-td {
        display: block !important;
        flex: 1;
        width: 100%;
        border: none !important;
        padding: 12px 16px !important;
    }
    .shopify-table-row {
        display: flex;
        align-items: stretch !important;
        padding: 0 !important;
        border-bottom: 1px solid #e5e7eb !important;
        position: relative;
        transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        background: #ffffff;
    }
    .shopify-table-row.expanded {
        margin: 16px 0;
        border-radius: 20px;
        background: rgba(255, 255, 255, 0.85) !important;
        backdrop-filter: blur(24px);
        -webkit-backdrop-filter: blur(24px);
        box-shadow: 0 20px 50px rgba(0,0,0,0.12), 0 0 0 1px rgba(255,255,255,0.8) inset;
        transform: scale(1.03);
        z-index: 50;
        border-bottom: none !important;
    }
    .shopify-table-row.expanded .mobile-td {
        padding: 16px 20px !important;
        background: transparent !important;
    }
    .shopify-table-row.expanded .swipe-bg-td {
        display: none !important;
    }
    .mobile-order-details {
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease, padding 0.4s ease, margin 0.4s ease;
        padding-top: 0;
        margin-top: 0;
        border-top: 1px solid transparent;
        display: flex;
        flex-direction: column;
        gap: 14px;
    }
    .shopify-table-row.expanded .mobile-order-details {
        max-height: 500px;
        opacity: 1;
        padding-top: 16px;
        margin-top: 16px;
        border-top: 1px solid rgba(0,0,0,0.08);
    }
    .expand-chevron {
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .shopify-table-row.expanded .expand-chevron {
        transform: rotate(180deg) scale(1.1);
    }
    .checkbox-td {
        display: none !important;
        align-items: flex-start;
        border: none !important;
        padding: 16px 12px 12px 16px !important;
        width: 44px !important;
    }
    body.selection-mode-active .checkbox-td {
        display: flex !important;
    }
    .table-container thead {
        display: none !important;
    }
    body.selection-mode-active .table-container thead {
        display: block !important;
    }
    .table-container thead tr {
        display: flex !important;
        padding: 12px 16px;
        border-bottom: 1px solid #e5e7eb;
        background: #f9fafb;
        border-radius: 12px 12px 0 0;
        align-items: center;
    }
    .table-container thead th {
        display: none;
    }
    .table-container thead th:first-child {
        display: flex;
        align-items: center;
        width: 100% !important;
        padding: 0;
        text-align: left !important;
        background: transparent !important;
        border: none !important;
    }
    .table-container thead th:first-child::after {
        content: "Sélectionner tout";
        margin-left: 12px;
        font-weight: 500;
        font-size: 14px;
        color: #4b5563;
    }
    #headerBulkOverlay {
        display: none !important;
    }
    
    /* Swipe Actions CSS */
    .swipe-bg-td {
        display: flex !important;
        position: absolute;
        top: 0; left: 0; right: 0; bottom: 0;
        z-index: 1;
        padding: 0 !important;
        border: none !important;
        justify-content: space-between;
        opacity: 0;
        transition: opacity 0.2s ease-out;
    }
    .shopify-table-row.is-swiping .swipe-bg-td {
        opacity: 1;
    }
    .swipe-action-left, .swipe-action-right {
        display: flex;
        align-items: center;
        color: white;
        font-weight: 600;
        width: 50%;
        height: 100%;
        padding: 0 20px;
    }
    .swipe-action-left {
        background-color: #f59e0b;
        justify-content: flex-start;
    }
    .swipe-action-right {
        background-color: #10b981;
        justify-content: flex-end;
    }
    .checkbox-td {
        background: #fff;
        position: relative;
        z-index: 2;
        transition: transform 0.2s ease-out;
    }
    .mobile-td {
        background: #fff;
        position: relative;
        z-index: 2;
        transition: transform 0.2s ease-out;
    }
}

.mobile-td {
    display: none;
}
.swipe-bg-td {
    display: none;
}

/* =========================================
   Shopify Restyle for Orders Page
   ========================================= */

/* Stats Bar */
.shopify-stats-container {
    display: flex;
    align-items: center;
    background-color: #fafafa;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0;
    margin-bottom: 24px;
    overflow: hidden;
}

.shopify-period-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 20px;
    border-right: 1px solid #e5e7eb;
    background-color: #f9fafb;
    color: #4b5563;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    min-width: 150px;
}
.shopify-period-selector:hover {
    background-color: #f3f4f6;
}

.shopify-stats-cards {
    display: flex;
    flex: 1;
}

.shopify-stat-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px 24px;
    background: transparent;
    border: none;
    border-right: 1px solid #e5e7eb;
    text-align: left;
    cursor: pointer;
    position: relative;
    transition: background-color 0.2s;
}
.shopify-stat-card:last-child {
    border-right: none;
}
.shopify-stat-card:hover {
    background-color: #f3f4f6;
}
.shopify-stat-card.active {
    background-color: #ffffff;
    box-shadow: inset 0 2px 0 0 #2563eb;
}

.stat-label {
    font-size: 0.85rem;
    color: #6b7280;
    font-weight: 500;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
}

.stat-line {
    height: 3px;
    border-radius: 3px;
    margin-top: 8px;
    background-color: #e5e7eb;
    width: 30px;
}

/* Shopify Table Styles */
.table-container {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
}

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

th {
    background-color: #ffffff;
    color: #6b7280;
    font-weight: 500;
    font-size: 13px;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
    vertical-align: middle;
}

.shopify-table-row {
    transition: background-color 0.15s ease;
}
.shopify-table-row:hover {
    background-color: #f9fafb;
}

.shopify-checkbox {
    width: 16px;
    height: 16px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    accent-color: #374151;
}

/* Status Dropdown Badges */
.shopify-select-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    padding: 4px 12px;
    font-size: 13px;
    font-weight: 500;
}

/* The actual select overlays everything but is transparent */
/* Custom Dropdown Styling */
.custom-dropdown {
    position: relative;
    display: inline-block;
}

.custom-dropdown .dropdown-trigger {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
}

.custom-dropdown .dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    z-index: 50;
    min-width: 120px;
    padding: 4px 0;
    overflow: hidden;
}

.custom-dropdown.open .dropdown-menu {
    display: block;
}

.custom-dropdown .dropdown-item {
    padding: 8px 16px;
    font-size: 13px;
    cursor: pointer;
    color: #374151;
    transition: background-color 0.15s, color 0.15s;
}

.custom-dropdown .dropdown-item:hover {
    background-color: #2563eb;
    color: #ffffff;
}

/* Status Colors */
.status-new {
    background-color: #e0f2fe;
    color: #0369a1;
}
.status-confirmed {
    background-color: #dcfce7;
    color: #15803d;
}
.status-followup {
    background-color: #fef3c7;
    color: #b45309;
}
.status-assigned {
    background-color: #f3e8ff;
    color: #7e22ce;
}

/* Primary Button (Nouvelle commande) */
.btn-primary.btn-shopify {
    background-color: #2563eb !important;
    border-color: #2563eb !important;
    border-radius: 6px;
    padding: 8px 16px;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
.btn-primary.btn-shopify:hover {
    background-color: #1d4ed8 !important;
    border-color: #1d4ed8 !important;
}

/* =========================================
   Bulk Selection Styles (Desktop Snackbar)
   ========================================= */
.bulk-snackbar {
    position: fixed;
    bottom: -100px; /* Hidden state */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.1), 0 0 0 1px rgba(255,255,255,0.4) inset;
    border-radius: 24px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 6000;
    transition: bottom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(0, 0, 0, 0.05);
}
.bulk-snackbar.visible {
    bottom: 30px;
}
.bulk-count {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
}
.bulk-actions-group {
    display: flex;
    gap: 8px;
    align-items: center;
    border-left: 1px solid rgba(0,0,0,0.1);
    padding-left: 12px;
}
.bulk-btn {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}
.bulk-btn:hover {
    background: #e5e7eb;
}
.bulk-btn-shipping {
    background: #1d4f8a;
    color: #ffffff;
    border-color: #1d4f8a;
}
.bulk-btn-shipping:hover {
    background: #153e6d;
}
.bulk-close {
    background: transparent;
    border: none;
    font-size: 20px;
    color: #9ca3af;
    cursor: pointer;
    margin-left: 8px;
    line-height: 1;
}
.bulk-close:hover {
    color: #374151;
}
.bulk-select-dropdown {
    padding: 6px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #f9fafb;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    white-space: nowrap;
}
/* Allow custom dropdown inside bulk actions */
.bulk-actions-group .custom-dropdown {
    position: relative;
}

/* Responsive Snackbar */
@media (max-width: 768px) {
    .bulk-snackbar {
        width: 100%;
        max-width: calc(100% - 32px);
        padding: 12px;
        gap: 8px;
        flex-wrap: wrap;
        border-radius: 20px;
        bottom: -150px;
        justify-content: center;
    }
    .bulk-snackbar.visible {
        bottom: 80px; /* Above mobile bottom nav */
    }
    .bulk-count {
        width: 100%;
        text-align: center;
        font-size: 14px;
        padding-bottom: 2px;
    }
    .bulk-actions-group {
        border-left: none;
        padding-left: 0;
        border-top: 1px solid rgba(0,0,0,0.1);
        padding-top: 10px;
        gap: 10px;
        width: 100%;
        justify-content: center;
    }
    .bulk-actions-group .custom-dropdown {
        flex: 1;
    }
    .bulk-select-dropdown {
        width: 100%;
        box-sizing: border-box;
    }
    .bulk-select-dropdown, .bulk-btn {
        flex: 1;
        font-size: 13px;
        padding: 8px 10px;
        white-space: normal;
        line-height: 1.2;
        text-align: center;
        display: flex;
        align-items: center;
        justify-content: center;
        height: auto;
    }
    .bulk-close {
        position: absolute;
        top: 10px;
        right: 12px;
        background: transparent;
        padding: 0;
        margin: 0;
        font-size: 20px;
        backdrop-filter: none;
    }
}

/* ==========================================
   Products
   ========================================== */
.products-flash {
    margin-bottom: 1.5rem;
    padding: 1rem 1.5rem;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 1rem;
}

.product-card {
    background: var(--bg-secondary, #fff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.product-card:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.product-card-img {
    position: relative;
    aspect-ratio: 1 / 1;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
}
.product-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-status-chip {
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 999px;
}
.product-status-active   { background: #dcfce7; color: #15803d; }
.product-status-draft    { background: #f3f4f6; color: #4b5563; }
.product-status-archived { background: #fee2e2; color: #b91c1c; }

.product-img-count {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(17, 24, 39, 0.75);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 7px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.product-card-info {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.product-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: #111827;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.5em;
}
.product-price-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}
.product-price {
    font-weight: 700;
    color: #111827;
}
.product-compare {
    color: #9ca3af;
    text-decoration: line-through;
    font-size: 0.82rem;
}
.product-qty {
    font-size: 0.8rem;
    color: var(--text-muted, #6b7280);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Grid/List view toggle */
.view-toggle {
    display: flex;
    background: #f3f4f6;
    border-radius: 8px;
    padding: 3px;
    gap: 2px;
    flex-shrink: 0;
}
.view-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 30px;
    border: none;
    background: transparent;
    border-radius: 6px;
    color: #6b7280;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.view-toggle-btn.active {
    background: #fff;
    color: #111827;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* List view: the same .product-card markup laid out as a horizontal row —
   square thumbnail, title/price/stock stacked, status pill pinned to the right. */
.product-status-chip-list { display: none; }

.products-grid.view-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: var(--bg-secondary, #fff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 12px;
    overflow: hidden;
}
.products-grid.view-list .product-card {
    flex-direction: row;
    align-items: center;
    gap: 12px;
    border: none;
    border-radius: 0;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    padding: 10px 14px;
}
.products-grid.view-list .product-card:last-child {
    border-bottom: none;
}
.products-grid.view-list .product-card:hover {
    transform: none;
    box-shadow: none;
    background: #f9fafb;
}
.products-grid.view-list .product-card-img {
    width: 52px;
    height: 52px;
    aspect-ratio: 1 / 1;
    flex: 0 0 52px;
    border-radius: 8px;
}
.products-grid.view-list .product-status-chip,
.products-grid.view-list .product-img-count {
    display: none;
}
.products-grid.view-list .product-card-info {
    flex: 1;
    min-width: 0;
    padding: 0;
    gap: 2px;
}
.products-grid.view-list .product-title {
    -webkit-line-clamp: 1;
    min-height: 0;
    font-size: 0.92rem;
}
.products-grid.view-list .product-status-chip-list {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
}

@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .product-card {
        border-radius: 12px;
    }
    .product-card-info {
        padding: 10px;
    }
    .product-title {
        font-size: 0.88rem;
    }
    .products-flash {
        margin-bottom: 1rem;
    }
    /* Edit modal: two-column field rows collapse to one column on small screens */
    #editProductModal .modal-content > form > div[style*="grid-template-columns"] {
        display: block !important;
    }
}
