:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #d97706;
    --bg: #f8fafc;
    --card: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-light: #64748b;
    --carrefour: #004E9A;
    --leclerc: #E30613;
    --franprix: #FF6B00;
    --super_u: #E5007D;
    --intermarche: #D4A017;
    --g20: #00A550;
    --auchan: #83268E;
    --monoprix: #0EA5E9;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* Auth pages */
.auth-container {
    max-width: 400px;
    margin: 80px auto;
    padding: 0 16px;
}

.auth-card {
    background: var(--card);
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.auth-card h1 {
    font-size: 24px;
    margin-bottom: 24px;
    text-align: center;
}

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

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--text-light);
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

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

.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
}

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

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

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

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

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

/* Colored outline variants */
.btn-outline-success {
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: #166534;
}
.btn-outline-success:hover { background: #dcfce7; }

.btn-outline-warning {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    color: #92400e;
}
.btn-outline-warning:hover { background: #fef3c7; }

.btn-outline-info {
    background: #eff6ff;
    border: 1px solid #93c5fd;
    color: var(--primary);
}
.btn-outline-info:hover { background: #dbeafe; }

.auth-toggle {
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    color: var(--text-light);
}

.auth-toggle a {
    color: var(--primary);
    text-decoration: none;
    cursor: pointer;
}

/* Profile choice cards (registration) */
.profile-choice {
    display: flex;
    gap: 12px;
    margin-top: 4px;
}
.profile-option {
    flex: 1;
    cursor: pointer;
}
.profile-option input[type="radio"] {
    display: none;
}
.profile-card {
    display: flex;
    flex-direction: column;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    text-align: center;
    transition: border-color 0.2s, background 0.2s;
}
.profile-card strong {
    font-size: 13px;
    margin-bottom: 4px;
}
.profile-card span {
    font-size: 11px;
    color: var(--text-light);
}
.profile-option input[type="radio"]:checked + .profile-card {
    border-color: var(--primary);
    background: #eff6ff;
}

/* Auth separator ("ou") */
.auth-separator {
    display: flex;
    align-items: center;
    margin: 20px 0;
    color: var(--text-light);
    font-size: 13px;
}
.auth-separator::before,
.auth-separator::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}
.auth-separator span {
    padding: 0 12px;
}

/* Google sign-in button wrapper */
.google-btn-wrapper {
    display: flex;
    justify-content: center;
}

.error-msg {
    color: var(--danger);
    font-size: 13px;
    margin-top: 8px;
    display: none;
}

/* Plan expired banner */
.plan-expired-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 8px 24px;
    background: #fef2f2;
    color: #7f1d1d;
    font-size: 13px;
    font-weight: 500;
    border-bottom: 1px solid #fecaca;
    position: sticky;
    top: 0;
    z-index: 10001;
}
.plan-expired-banner .btn {
    width: auto;
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    background: #dc2626;
    color: white;
    border: none;
    border-radius: 6px;
}
.plan-expired-banner .btn:hover {
    background: #b91c1c;
}

/* Toast notifications */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 100000;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s, transform 0.3s;
}
.toast-visible {
    opacity: 1;
    transform: translateY(0);
}
.toast-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}
.toast-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fbbf24;
}
.toast-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

/* Impersonation banner */
.impersonation-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 8px 24px;
    background: #fef3c7;
    color: #92400e;
    font-size: 13px;
    font-weight: 500;
    border-bottom: 1px solid #fbbf24;
    position: sticky;
    top: 0;
    z-index: 10001;
}
.impersonation-btn {
    border-color: #92400e !important;
    color: #92400e !important;
    font-weight: 600;
}
.impersonation-btn:hover {
    background: #92400e !important;
    color: white !important;
}

/* Navbar */
.navbar {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    display: flex;
    align-items: center;
    height: 56px;
    gap: 24px;
    position: relative;
    z-index: 1000;
}

.navbar .brand {
    font-weight: 700;
    font-size: 18px;
    color: var(--primary);
}

.navbar .nav-links {
    display: flex;
    gap: 16px;
    flex: 1;
}

.navbar .nav-links a {
    text-decoration: none;
    color: var(--text-light);
    font-size: 14px;
    font-weight: 500;
    padding: 4px 0;
}

.navbar .nav-links a.active,
.navbar .nav-links a:hover {
    color: var(--primary);
}

.navbar .user-info {
    font-size: 14px;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Layout */
.app-layout {
    display: flex;
    height: calc(100vh - 56px);
}

.sidebar {
    width: 400px;
    border-right: 1px solid var(--border);
    background: var(--card);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
}

.sidebar-tabs button {
    flex: 1;
    padding: 12px;
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.sidebar-tabs button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

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

.sidebar-resize-handle {
    width: 5px;
    cursor: col-resize;
    background: transparent;
    border-left: 1px solid var(--border);
    transition: background 0.15s;
    flex-shrink: 0;
}
.sidebar-resize-handle:hover,
.sidebar-resize-handle:active {
    background: var(--primary);
    opacity: 0.4;
}

.map-container {
    flex: 1;
    position: relative;
}

#map { width: 100%; height: 100%; }

/* Store sub-tabs */
.store-subtabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin: -16px -16px 12px -16px;
    padding: 0 16px;
    background: #f8fafc;
}
.store-subtab {
    padding: 10px 16px;
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    display: flex;
    align-items: center;
    gap: 6px;
}
.store-subtab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
.store-subtab-count {
    background: var(--primary);
    color: white;
    font-size: 11px;
    padding: 1px 7px;
    border-radius: 10px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}
.store-subtab:not(.active) .store-subtab-count {
    background: var(--text-light);
}
.store-subtab-panel { display: none; }
.store-subtab-panel.active { display: block; }

/* Store search bar */
.store-search-bar {
    margin-bottom: 10px;
}
.store-search-bar input[type="text"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    outline: none;
}
.store-search-bar input[type="text"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

/* Enseigne checkboxes */
.enseigne-filters {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.enseigne-chip {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border: 2px solid;
    user-select: none;
}

.enseigne-chip input { display: none; }

.enseigne-chip.checked { color: white; }
.enseigne-chip.carrefour { border-color: var(--carrefour); color: var(--carrefour); }
.enseigne-chip.carrefour.checked { background: var(--carrefour); color: white; }
.enseigne-chip.leclerc { border-color: var(--leclerc); color: var(--leclerc); }
.enseigne-chip.leclerc.checked { background: var(--leclerc); color: white; }
.enseigne-chip.franprix { border-color: var(--franprix); color: var(--franprix); }
.enseigne-chip.franprix.checked { background: var(--franprix); color: white; }
.enseigne-chip.super_u { border-color: var(--super_u); color: var(--super_u); }
.enseigne-chip.super_u.checked { background: var(--super_u); color: white; }
.enseigne-chip.intermarche { border-color: var(--intermarche); color: var(--intermarche); }
.enseigne-chip.intermarche.checked { background: var(--intermarche); color: white; }
.enseigne-chip.g20 { border-color: var(--g20); color: var(--g20); }
.enseigne-chip.g20.checked { background: var(--g20); color: white; }
.enseigne-chip.auchan { border-color: var(--auchan); color: var(--auchan); }
.enseigne-chip.auchan.checked { background: var(--auchan); color: white; }
.enseigne-chip.monoprix { border-color: var(--monoprix); color: var(--monoprix); }
.enseigne-chip.monoprix.checked { background: var(--monoprix); color: white; }

/* Store table */
.store-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.store-table th {
    text-align: left;
    padding: 8px 6px;
    border-bottom: 2px solid var(--border);
    font-weight: 600;
    color: var(--text-light);
    font-size: 12px;
    position: sticky;
    top: 0;
    background: var(--card);
}

.store-table td {
    padding: 6px;
    border-bottom: 1px solid var(--border);
}

.store-table tr:hover { background: #f1f5f9; }
.store-row-selected { background: #eff6ff; }
.store-row-selected:hover { background: #dbeafe !important; }

.store-zip-cell {
    font-size: 12px;
    color: var(--text-light);
    white-space: nowrap;
}

.store-btn-added {
    color: var(--success) !important;
    border-color: var(--success) !important;
    cursor: default !important;
    font-size: 11px !important;
}

.store-empty-msg {
    color: var(--text-light);
    font-size: 13px;
    text-align: center;
    padding: 24px;
}

.store-result-count {
    font-size: 12px;
    color: var(--text-light);
}

/* My stores sub-tab */
.my-stores-empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-light);
}
.my-stores-empty p { font-size: 14px; margin-bottom: 8px; }
.my-stores-empty-hint { font-size: 12px; }

.my-stores-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.my-stores-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.btn-danger-outline {
    color: var(--danger) !important;
    border-color: var(--danger) !important;
}
.btn-danger-outline:hover {
    background: var(--danger) !important;
    color: white !important;
}

.enseigne-logo {
    object-fit: contain;
    border-radius: 3px;
    vertical-align: middle;
    flex-shrink: 0;
}

.store-enseigne-cell {
    display: flex;
    align-items: center;
    gap: 6px;
}

.enseigne-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}

.enseigne-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: white;
}

.badge-carrefour { background: var(--carrefour); }
.badge-leclerc { background: var(--leclerc); }
.badge-franprix { background: var(--franprix); }
.badge-super_u { background: var(--super_u); }
.badge-intermarche { background: var(--intermarche); color: white; }
.badge-g20 { background: var(--g20); }
.badge-auchan { background: var(--auchan); }
.badge-monoprix { background: var(--monoprix); }

.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    align-items: center;
    font-size: 13px;
}

/* Products */
.product-input-group {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.product-input-group input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
}

.product-list {
    list-style: none;
}

.product-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

/* Results */
.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.results-table th, .results-table td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.results-table th {
    font-weight: 600;
    background: #f8fafc;
    position: sticky;
    top: 0;
}

/* Result cards */
.results-cards {
    display: flex; flex-direction: column; gap: 12px;
}

.result-card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: 8px; overflow: hidden;
}

.result-card-header {
    display: flex; align-items: center; gap: 8px; padding: 10px 12px;
    background: #f8fafc; border-bottom: 1px solid var(--border);
    font-size: 12px; flex-wrap: wrap;
}

.result-store { font-weight: 600; }
.result-search { color: var(--text-light); font-style: italic; }
.result-date { color: var(--text-light); margin-left: auto; }

.result-items { padding: 8px 12px; }

.result-items-loading, .result-items-empty, .result-items-error {
    color: var(--text-light); font-size: 12px; margin: 0;
}

.result-item {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 0; border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
}

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

.result-item-rank {
    color: var(--text-light); font-weight: 600; min-width: 18px;
}

.result-item-name { flex: 1; }

.result-item-qty {
    color: var(--text-light); font-size: 11px;
    background: #f1f5f9; padding: 1px 5px; border-radius: 3px;
    margin-left: 4px;
}

.result-item-price {
    font-weight: 600; white-space: nowrap;
}

.result-item-score {
    display: inline-block; min-width: 28px; text-align: center;
    font-size: 11px; font-weight: 600; padding: 1px 6px;
    border-radius: 4px;
}

.score-high { background: #dcfce7; color: var(--success); }
.score-mid { background: #fef3c7; color: var(--warning); }
.score-low { background: #fee2e2; color: var(--danger); }

.result-card-footer {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 12px; background: #f8fafc;
    border-top: 1px solid var(--border); font-size: 12px;
}

.result-rows { color: var(--text-light); }

/* Admin */
.admin-container {
    max-width: 1200px;
    margin: 24px auto;
    padding: 0 24px;
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
}

.admin-card {
    background: var(--card);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.admin-card h2 {
    font-size: 16px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.stat-item {
    text-align: center;
    padding: 12px;
    background: var(--bg);
    border-radius: 8px;
}

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

.stat-item .label {
    font-size: 12px;
    color: var(--text-light);
}

.job-list {
    list-style: none;
}

.job-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    display: flex;
    justify-content: space-between;
}

.status-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.status-pending { background: #fef3c7; color: var(--warning); }
.status-running { background: #dbeafe; color: var(--primary); }
.status-completed { background: #dcfce7; color: var(--success); }
.status-failed { background: #fee2e2; color: var(--danger); }

/* Map overlay controls */
.map-overlay {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1000;
    background: var(--card);
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

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

.selection-actions {
    display: flex;
    gap: 6px;
}

.selection-count {
    font-size: 14px;
    font-weight: 600;
    padding: 8px 12px;
    background: var(--bg);
    border-radius: 6px;
    text-align: center;
}

/* Subscription matrix */
.matrix-scroll {
    overflow: auto;
    max-height: calc(100vh - 200px);
}

.subscription-matrix {
    border-collapse: collapse;
    font-size: 12px;
    width: 100%;
}

.subscription-matrix th,
.subscription-matrix td {
    border: 1px solid var(--border);
    padding: 6px 8px;
}

.matrix-corner {
    position: sticky;
    left: 0;
    top: 0;
    z-index: 4;
    background: var(--card);
    min-width: 120px;
}

.matrix-store-header {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f8fafc;
    text-align: center;
    min-width: 80px;
    vertical-align: middle;
}

.matrix-store-header .enseigne-badge,
.matrix-store-header .enseigne-name {
    display: block;
    margin: 0 auto 2px;
    width: fit-content;
}
.matrix-store-header .enseigne-logo {
    display: block;
    margin: 0 auto 2px;
}

.matrix-store-name {
    display: block;
    font-size: 10px;
    color: var(--text-light);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
}

.matrix-product-cell {
    position: sticky;
    left: 0;
    background: #f1f5f9;
    font-weight: 600;
    font-size: 12px;
    z-index: 1;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.matrix-cell {
    text-align: center;
    vertical-align: middle;
}

.matrix-cell:hover {
    background: #f1f5f9;
}

.matrix-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}
.matrix-cell-disabled {
    color: #cbd5e1;
    text-align: center;
    font-size: 11px;
}

.matrix-group-header td {
    background: #f1f5f9;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    padding: 6px 10px;
    border-bottom: 2px solid var(--border);
    position: sticky;
    left: 0;
}

/* Plan badge (navbar) */
.plan-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    background: #e2e8f0;
    color: var(--text-light);
}
.plan-badge-trial {
    background: #fef3c7;
    color: var(--warning);
}

/* Quota bar */
.quota-bar {
    padding: 10px 0;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border);
}
.quota-text {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}
.quota-plan {
    font-weight: 400;
    color: var(--text-light);
    font-size: 12px;
}
.quota-progress {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}
.quota-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}
.quota-fill.quota-warning {
    background: var(--warning);
}
.quota-fill.quota-full {
    background: var(--danger);
}
.quota-limit-msg {
    font-size: 11px;
    color: var(--danger);
    margin-top: 4px;
    font-style: italic;
}

/* Pricing modal */
.pricing-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}
.pricing-modal {
    background: var(--card);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 720px;
    width: 92vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.pricing-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.pricing-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}
.pricing-body {
    padding: 20px;
    overflow-y: auto;
}
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}
.pricing-card {
    position: relative;
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 16px 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: border-color 0.2s;
}
.pricing-card-current {
    border-color: var(--primary);
    background: #eff6ff;
}
.pricing-card-popular {
    border-color: var(--primary);
}
.pricing-card-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 10px;
    white-space: nowrap;
}
.pricing-card-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}
.pricing-card-price {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.1;
}
.pricing-card-price span {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
}
.pricing-card-limit {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}
.pricing-card-detail {
    font-size: 11px;
    color: var(--text-light);
}
.pricing-card-action {
    margin-top: 8px;
}
.pricing-current-label {
    display: inline-block;
    padding: 4px 12px;
    background: #dbeafe;
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
    border-radius: 4px;
}
.pricing-hint {
    text-align: center;
    color: var(--text-light);
    font-size: 12px;
    margin-top: 16px;
}

/* Admin: plan select & profile badge */
.plan-select {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 12px;
    background: var(--card);
    cursor: pointer;
    outline: none;
    transition: outline 0.2s;
}
.plan-select:focus {
    border-color: var(--primary);
}
.plan-select:disabled {
    opacity: 0.5;
    cursor: default;
}
.profile-type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: #e2e8f0;
    color: var(--text-light);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Leaflet popup */
.leaflet-popup-content { font-size: 13px; }
.leaflet-popup-content .popup-title { font-weight: 600; margin-bottom: 4px; }
.leaflet-popup-content .popup-detail { color: var(--text-light); font-size: 12px; }
.leaflet-popup-content .popup-soon {
    font-size: 11px; color: var(--warning); font-style: italic; margin-top: 4px;
}
.leaflet-popup-content .btn { margin-top: 8px; }

.badge-soon {
    display: inline-block; font-size: 10px; color: var(--warning);
    border: 1px solid var(--warning); border-radius: 4px;
    padding: 0 4px; margin-left: 4px; vertical-align: middle;
    font-style: italic;
}

/* Comparison table (Resultats tab — full width) */
.comparison-container {
    flex-direction: column;
    width: 100%;
    height: calc(100vh - 56px);
    background: var(--bg);
    overflow: hidden;
}

.comparison-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.comparison-title { font-size: 16px; font-weight: 600; }

.comparison-actions { display: flex; gap: 8px; }

#comparison-selector-area,
#history-selector-area {
    flex-shrink: 0;
    padding: 0 24px;
}
#comparison-selector-area:empty,
#history-selector-area:empty {
    display: none;
}

.ean-select {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    min-width: 300px;
    max-width: 100%;
    background: var(--card);
    color: var(--text);
    cursor: pointer;
}

.comparison-table-wrapper {
    flex: 1;
    overflow: auto;
    padding: 16px 24px;
}

.comparison-loading, .comparison-empty {
    color: var(--text-light); font-size: 14px;
    text-align: center; padding: 48px 24px;
}

.comparison-empty-state {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 64px 24px;
}

.comparison-empty-hint {
    color: var(--text-light); font-size: 13px; margin-top: 8px;
}

.comparison-table {
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

.comparison-table th,
.comparison-table td {
    border: 1px solid var(--border);
    padding: 8px 10px;
    vertical-align: top;
}

.comparison-product-header {
    width: 160px; min-width: 160px;
    font-weight: 600; background: #f1f5f9;
    position: sticky; left: 0; z-index: 4;
    box-shadow: 2px 0 4px rgba(0,0,0,0.08);
}

.comparison-store-header {
    min-width: 200px; text-align: center;
    background: #f8fafc;
    position: sticky; top: 0; z-index: 1;
}

.comparison-store-header .enseigne-badge {
    display: block; margin: 0 auto 4px; width: fit-content;
}

.comparison-store-name {
    display: block; font-size: 11px;
    color: var(--text-light); font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.comparison-product-cell {
    font-weight: 600; background: #f1f5f9;
    position: sticky; left: 0; z-index: 1;
    box-shadow: 2px 0 4px rgba(0,0,0,0.08);
}

.comparison-product-name { font-size: 13px; }

.comparison-item-cell { min-width: 200px; }

.comparison-item-name {
    font-size: 12px; color: var(--text);
    margin-bottom: 4px; line-height: 1.3;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.comparison-item-meta {
    display: flex; align-items: center; gap: 6px;
}

.comparison-item-price {
    font-weight: 600; font-size: 14px; white-space: nowrap;
}

.comparison-item-unit-price {
    font-size: 11px; color: var(--text-light); white-space: nowrap;
}

.comparison-item-brand {
    font-size: 11px; color: var(--text-light); font-weight: 500;
    margin-top: -2px; margin-bottom: 1px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.comparison-item-ean {
    font-size: 10px; color: var(--text-light); font-family: monospace;
    margin-top: 1px;
}

.comparison-item-score {
    display: inline-block; min-width: 28px; text-align: center;
    font-size: 11px; font-weight: 600; padding: 1px 6px;
    border-radius: 4px; margin-left: auto;
}

.comparison-cheapest { background: #f0fdf4; }
.comparison-cheapest .comparison-item-price { color: var(--success); }

.comparison-empty-cell { background: #fafafa; }

.comparison-no-result {
    color: #d1d5db; font-size: 14px;
    display: block; text-align: center;
}

/* Toggle buttons (Par recherche / Par EAN) */
.comparison-toggle {
    display: flex;
    background: var(--bg);
    border-radius: 6px;
    padding: 2px;
    gap: 2px;
}

.toggle-btn {
    padding: 6px 14px;
    border: none;
    background: transparent;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-light);
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}

.toggle-btn:hover { background: #e2e8f0; }

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

/* EAN-specific styles */
.ean-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
}

.ean-th-product {
    width: 240px;
    min-width: 180px;
    font-weight: 600;
    background: #f1f5f9;
    position: sticky;
    left: 0;
    top: 0;
    z-index: 4;
    padding: 8px 10px;
    box-shadow: 2px 0 4px rgba(0,0,0,0.08);
}

.ean-th-store {
    text-align: center;
    background: #f8fafc;
    position: sticky;
    top: 0;
    z-index: 2;
    min-width: 90px;
    width: 110px;
    padding: 8px 6px;
}

.ean-th-store .comparison-store-name {
    font-size: 10px;
    max-width: 90px;
}

.ean-td-product {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--card);
    padding: 6px 10px;
    box-shadow: 2px 0 4px rgba(0,0,0,0.08);
}
.ean-td-product > .ean-product-img {
    float: left;
    margin-right: 8px;
}

.ean-product-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 4px;
}

.ean-product-info {
    min-width: 0;
}

.ean-td-name {
    display: block;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ean-product-detail {
    display: block;
    font-size: 10px;
    color: var(--text-light);
    font-weight: 400;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ean-td-price {
    text-align: center;
    padding: 6px 4px;
    white-space: nowrap;
}

.ean-price {
    display: block;
    font-weight: 600;
    font-size: 13px;
}

.ean-unit-price {
    display: block;
    font-size: 10px;
    color: var(--text-light);
    margin-top: 1px;
}

.ean-cheapest {
    background: #f0fdf4;
}

.ean-cheapest .ean-price {
    color: var(--success);
}

.ean-td-empty {
    color: #d1d5db;
    background: #fafafa;
}

.comparison-ean-code {
    display: block;
    font-size: 10px;
    color: var(--text-light);
    font-weight: 400;
    font-family: monospace;
    margin-top: 2px;
}

.ean-source-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 600;
    color: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 3px;
    padding: 0 4px;
    margin-left: auto;
    line-height: 1.4;
}

.comparison-ean-summary {
    color: var(--text-light);
    font-size: 12px;
    text-align: center;
    margin-top: 16px;
}

/* Search table sections (one per search term) */
.search-table-section {
    margin-bottom: 28px;
    background: var(--card);
    border-radius: 8px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.search-table-scroll {
    overflow-x: auto;
}

.search-table-header {
    padding: 10px 16px;
    background: #f1f5f9;
    border-bottom: 1px solid var(--border);
}

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

/* Sort controls */
.sort-controls-global {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 16px;
}

.sort-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-light);
    margin-right: 4px;
}

.sort-btn {
    padding: 5px 12px;
    border: 1px solid var(--border);
    background: var(--card);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-light);
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.sort-btn:hover { background: #e2e8f0; }

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

/* Rank column */
.comparison-rank-header {
    width: 36px;
    min-width: 36px;
    text-align: center;
    font-weight: 600;
    background: #f1f5f9;
    position: sticky;
    left: 0;
    z-index: 3;
}

.comparison-rank-cell {
    text-align: center;
    font-weight: 600;
    color: var(--text-light);
    font-size: 13px;
    background: #f1f5f9;
    position: sticky;
    left: 0;
    z-index: 1;
}

/* EAN in item cell */
.comparison-item-ean {
    display: block;
    font-size: 10px;
    color: var(--text-light);
    font-weight: 400;
    font-family: monospace;
    margin-top: 2px;
}

/* History (price history tab — full width) */
.history-container {
    flex-direction: column;
    width: 100%;
    height: calc(100vh - 56px);
    background: var(--bg);
    overflow: hidden;
}

.history-table-wrapper {
    flex: 1;
    overflow: auto;
    padding: 16px 24px;
}

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

.history-selector label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}

.history-selector select {
    flex: 1;
    max-width: 600px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    background: var(--card);
    color: var(--text);
    outline: none;
    cursor: pointer;
}

.history-selector select:focus {
    border-color: var(--primary);
}

.history-product-section {
    margin-bottom: 24px;
    background: var(--card);
    border-radius: 8px;
    border: 1px solid var(--border);
    /* no overflow: hidden — would break position: sticky on thead/store column */
}

.history-product-header {
    padding: 10px 16px;
    background: #f1f5f9;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-table-scroll {
    overflow-x: auto;
}

.history-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

.history-table th,
.history-table td {
    border: 1px solid var(--border);
    padding: 6px 10px;
    vertical-align: middle;
}

.history-store-cell {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--card);
    width: 220px;
    min-width: 220px;
    max-width: 220px;
    box-shadow: 2px 0 4px rgba(0,0,0,0.08);
    font-size: 12px;
}
.history-store-cell > .enseigne-name {
    white-space: nowrap;
}

.history-store-name {
    display: block;
    font-size: 11px;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-reference {
    display: block;
    font-size: 11px;
    color: var(--primary);
    font-style: normal;
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: #eff6ff;
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid #bfdbfe;
}
.history-reference-link {
    text-decoration: none;
    cursor: pointer;
}
.history-reference-link:hover {
    text-decoration: underline;
}
.history-reference-none {
    color: #999;
}

/* Reference picker modal */
.ref-picker-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.ref-picker-modal {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.2);
    max-width: 520px;
    width: 90vw;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
}
.ref-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
}
.ref-picker-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    padding: 0 4px;
}
.ref-picker-list {
    overflow-y: auto;
    flex: 1;
    padding: 8px 0;
}
.ref-picker-item {
    padding: 8px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
}
.ref-picker-item-content {
    display: flex;
    align-items: center;
    gap: 8px;
}
.ref-picker-item-text {
    min-width: 0;
}
.ref-picker-item:hover {
    background: #eff6ff;
}
.ref-picker-item-active {
    background: #dbeafe;
    border-left: 3px solid var(--primary);
}
.ref-picker-item-name {
    font-size: 13px;
    font-weight: 500;
}
.ref-picker-item-meta {
    font-size: 11px;
    color: #666;
    margin-top: 2px;
}
.ref-picker-ean {
    color: #999;
    font-family: monospace;
}
.ref-picker-count {
    color: #888;
    margin-left: 6px;
}
.ref-picker-hint {
    font-size: 11px;
    color: #888;
    font-style: italic;
    text-align: center;
    padding: 8px 16px;
    margin: 0;
    border-top: 1px solid #e5e7eb;
}

.history-date-header {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f8fafc;
    text-align: center;
    min-width: 80px;
    font-weight: 600;
    font-size: 12px;
}

.history-store-cell.history-date-header {
    z-index: 4;
}

.history-price-cell {
    text-align: center;
    white-space: nowrap;
    font-size: 13px;
}

.history-cheapest {
    background: #f0fdf4;
    font-weight: 600;
    color: var(--success);
}

.history-empty-cell {
    background: #fafafa;
    color: #d1d5db;
}

.history-unit-price {
    font-size: 10px;
    color: var(--text-light);
}

.history-delta-down {
    color: var(--success);
    font-size: 11px;
    font-weight: 600;
}

.history-delta-up {
    color: var(--danger);
    font-size: 11px;
    font-weight: 600;
}

/* Price matrix specific */
.matrix-date-badge {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 12px;
    text-align: right;
}

.matrix-clickable {
    cursor: pointer;
    transition: background 0.15s;
}

.matrix-clickable:hover {
    background: #eef2ff !important;
}

.matrix-alt-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    font-size: 10px;
    font-weight: 600;
    background: #e2e8f0;
    color: var(--text-light);
    border-radius: 50%;
    margin-left: 4px;
}

/* Alternatives modal overlay */
.alt-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.alt-modal {
    background: var(--card);
    border-radius: 12px;
    width: 90%;
    max-width: 550px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

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

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

.alt-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
    line-height: 1;
    padding: 0 4px;
}

.alt-close-btn:hover { color: var(--text); }

.alt-persist-hint {
    font-size: 11px;
    color: #64748b;
    margin: 0;
    padding: 0 20px 8px;
    font-style: italic;
}

.alt-modal-body {
    overflow-y: auto;
    padding: 12px 20px;
}

.alt-item {
    display: flex;
    flex-direction: column;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
    gap: 6px;
}

.alt-item-selected {
    border-color: var(--primary);
    background: #eff6ff;
}

.alt-item-top {
    display: flex;
    align-items: center;
    gap: 8px;
}

.alt-item-rank {
    font-weight: 700;
    color: var(--text-light);
    font-size: 12px;
    flex-shrink: 0;
}

.alt-item-name {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
}

.alt-item-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-left: 28px;
}

.alt-item-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    min-width: 0;
}

.alt-item-brand {
    font-size: 11px;
    color: var(--text-light);
}

.alt-selected-badge {
    font-size: 11px;
    font-weight: 600;
    color: var(--primary);
    background: #dbeafe;
    padding: 4px 10px;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

.alt-select-btn {
    white-space: nowrap;
    flex-shrink: 0;
}

/* EAN correction — clickable cell */
.ean-td-editable {
    cursor: pointer;
    position: relative;
    transition: background 0.15s;
}

.ean-td-editable:hover {
    background: #eef2ff !important;
}

.ean-edit-btn {
    display: block;
    font-size: 11px;
    color: var(--text-light);
    margin-top: 2px;
    opacity: 0.4;
    transition: opacity 0.15s;
}

.ean-td-editable:hover .ean-edit-btn {
    opacity: 1;
    color: var(--primary);
}

.ean-correct-modal {
    max-width: 520px;
}

.ean-correct-info,
.ean-correct-current {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.ean-correct-info:first-child {
    padding-top: 0;
}

.ean-correct-current-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ean-correct-preview-content {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

.ean-correct-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.ean-correct-detail {
    font-size: 12px;
    color: var(--text-light);
    line-height: 1.5;
}

.ean-correct-form {
    padding: 8px 0;
}

.ean-correct-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    font-family: monospace;
    letter-spacing: 1px;
    outline: none;
    transition: border-color 0.2s;
    margin-top: 4px;
}

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

.ean-correct-preview {
    margin-top: 10px;
    padding: 10px 12px;
    background: #f0fdf4;
    border-radius: 6px;
    border: 1px solid #bbf7d0;
}

.ean-correct-fields {
    margin-top: 10px;
    padding: 10px 12px;
    background: #fefce8;
    border-radius: 6px;
    border: 1px solid #fef08a;
}

.ean-correct-fields .form-group label {
    font-size: 12px;
    color: var(--text-light);
}

.ean-correct-fields .form-group input {
    font-size: 13px;
}

.ean-correct-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 0 4px;
    border-top: 1px solid var(--border);
    margin-top: 8px;
}

/* Stock availability badge */
.stock-badge {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: 4px;
    vertical-align: middle;
}
/* Dashboard cards */
.history-chart-container {
    position: relative;
    width: 100%;
    height: 320px;
    margin-bottom: 24px;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 8px;
    padding: 16px;
}

.dashboard-cards {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.dashboard-card {
    flex: 1;
    min-width: 140px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    text-align: center;
}
.dashboard-card-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
    margin-bottom: 4px;
}
.dashboard-card-label {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.dashboard-card-detail {
    font-size: 12px;
    color: var(--text-light);
}

/* Profile-aware visibility */
.produit-only { display: none; }
.magasin-only { display: block; }
.profile-produit .produit-only { display: block; }
.profile-produit .magasin-only { display: none; }

/* EAN search suggestions dropdown */
.ean-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    max-height: 320px;
    overflow-y: auto;
    z-index: 100;
}
.ean-suggestion-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
}
.ean-suggestion-item:last-child { border-bottom: none; }
.ean-suggestion-item:hover { background: #eff6ff; }
.ean-suggestion-img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 4px;
    background: #f8fafc;
    flex-shrink: 0;
}
.ean-suggestion-info { flex: 1; min-width: 0; }
.ean-suggestion-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ean-suggestion-meta {
    font-size: 11px;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ean-suggestion-loading {
    padding: 12px;
    text-align: center;
    color: var(--text-light);
    font-size: 12px;
}

/* EAN badge & preview */
.ean-badge {
    display: inline-block;
    background: #e0e7ff;
    color: #3730a3;
    font-size: 11px;
    font-family: monospace;
    padding: 1px 6px;
    border-radius: 4px;
    margin-right: 4px;
}
.ean-preview-card {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    padding: 8px 12px;
    margin: 8px 0;
    font-size: 13px;
}

/* Corridor violations */
.corridor-violation-high {
    background: #fef2f2 !important;
    border: 2px solid #fca5a5 !important;
}
.corridor-violation-low {
    background: #fefce8 !important;
    border: 2px solid #fde68a !important;
}

/* My Products price table */
.my-products-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}
.my-products-table th,
.my-products-table td {
    border: 1px solid var(--border);
    padding: 8px 10px;
    vertical-align: top;
}
.my-products-table th {
    background: #f8fafc;
    position: sticky;
    top: 0;
    z-index: 1;
    text-align: center;
    font-size: 12px;
}
.my-products-product-cell {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #f1f5f9;
    font-weight: 600;
    min-width: 180px;
    box-shadow: 2px 0 4px rgba(0,0,0,0.08);
}
th.my-products-product-cell {
    z-index: 4;
}
.my-products-product-cell > .ean-product-img {
    float: left;
    margin-right: 8px;
}
.my-products-price-cell {
    text-align: center;
    white-space: nowrap;
}
.my-products-cheapest {
    background: #f0fdf4;
    font-weight: 600;
    color: var(--success);
}
.my-products-trend-up {
    color: var(--danger);
    font-size: 11px;
    font-weight: 600;
}
.my-products-trend-down {
    color: var(--success);
    font-size: 11px;
    font-weight: 600;
}
.my-products-trend-stable {
    color: var(--text-light);
    font-size: 11px;
}

/* Distribution view */
.distribution-bar {
    display: inline-block;
    height: 8px;
    border-radius: 4px;
    min-width: 30px;
    max-width: 60px;
    vertical-align: middle;
    margin-right: 4px;
}
.distribution-high { background: var(--success); }
.distribution-mid { background: var(--warning); }
.distribution-low { background: var(--danger); }

.stock-unknown  { background: #e2e8f0; border: 1px solid #cbd5e1; }
.stock-critical { background: #1e1e1e; }
.stock-danger   { background: #dc2626; }
.stock-warning  { background: #f59e0b; }
.stock-ok       { background: #16a34a; }

/* Section hint (explanatory text under titles) */
.section-hint {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 12px;
    line-height: 1.5;
}

/* Results legend bar */
.results-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    margin-top: 16px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-light);
}
.results-legend-title {
    font-weight: 600;
    color: var(--text);
    margin-right: 4px;
}
.results-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}
.results-legend-sep {
    width: 1px;
    height: 16px;
    background: var(--border);
}
.legend-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
}
.corridor-swatch-high {
    background: #fef2f2;
    border: 2px solid #fca5a5;
}
.corridor-swatch-low {
    background: #fefce8;
    border: 2px solid #fde68a;
}
.cheapest-swatch {
    background: #f0fdf4;
    border: 2px solid #86efac;
}

/* Help button */
.help-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: #f1f5f9;
    color: var(--text-light);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s, color 0.2s;
    position: relative;
}
.help-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: scale(1.12);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

/* First-visit pulse */
.help-btn-pulse {
    animation: helpPulse 2s ease-in-out infinite;
}
.help-btn-pulse::after {
    content: '';
    position: absolute;
    top: -3px;
    right: -3px;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    border: 2px solid var(--card);
}
@keyframes helpPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(37, 99, 235, 0); }
}

/* Help modal animation */
.help-overlay-visible .alt-modal {
    animation: helpModalIn 0.25s ease-out;
}
@keyframes helpModalIn {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Help modal title icon */
.help-title-icon {
    margin-right: 8px;
    font-size: 18px;
}

/* Help modal body */
.help-body {
    padding: 16px 20px;
    overflow-y: auto;
    font-size: 13px;
    max-height: 60vh;
}
.help-body h4 {
    margin-top: 18px;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-dark);
    padding: 6px 10px;
    background: #eff6ff;
    border-left: 3px solid var(--primary);
    border-radius: 0 4px 4px 0;
}
.help-body h4:first-child {
    margin-top: 0;
}
.help-body p {
    margin: 6px 0;
    line-height: 1.6;
    color: var(--text);
}
.help-body ul {
    padding-left: 18px;
    margin: 6px 0;
}
.help-body li {
    margin: 4px 0;
    line-height: 1.6;
}
.help-body .help-step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-size: 11px;
    font-weight: 700;
    margin-right: 6px;
    flex-shrink: 0;
    vertical-align: middle;
}

/* Legal page */
.legal-container {
    max-width: 800px;
    margin: 40px auto;
    padding: 0 20px;
}
.legal-card {
    background: var(--card);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 32px;
}
.legal-back {
    display: inline-block;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 16px;
}
.legal-back:hover { text-decoration: underline; }
.legal-card header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}
.legal-card header p {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 0;
}
.legal-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 20px 0;
}
.legal-tab-btn {
    padding: 8px 16px;
    border-radius: 20px;
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    background: var(--bg);
    color: var(--text-light);
}
.legal-tab-btn:hover { background: #e2e8f0; }
.legal-tab-btn.active {
    background: var(--primary);
    color: white;
}
.legal-section { display: none; }
.legal-section.active { display: block; }
.legal-section h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 16px;
}
.legal-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-top: 20px;
    margin-bottom: 6px;
}
.legal-section p {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text);
    margin: 6px 0;
}
.legal-section ul {
    padding-left: 20px;
    margin: 8px 0;
}
.legal-section li {
    font-size: 14px;
    line-height: 1.7;
    margin: 4px 0;
}
.legal-section a {
    color: var(--primary);
    text-decoration: none;
}
.legal-section a:hover { text-decoration: underline; }
.legal-footer {
    margin-top: 32px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-light);
}
.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: var(--text-light);
}
.auth-footer a {
    color: var(--text-light);
    text-decoration: none;
    margin: 0 8px;
}
.auth-footer a:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* ===== Landing page ===== */
html { scroll-behavior: smooth; }

/* Landing navbar */
.landing-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--card);
    border-bottom: 1px solid var(--border);
}

.landing-nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    height: 56px;
    gap: 24px;
}

.landing-nav-links {
    display: flex;
    gap: 20px;
    margin-left: auto;
}

.landing-nav-links a {
    text-decoration: none;
    color: var(--text-light);
    font-size: 14px;
    font-weight: 500;
}

.landing-nav-links a:hover {
    color: var(--primary);
}

/* Hero */
.landing-hero {
    padding: 120px 24px 64px;
    text-align: center;
    max-width: 760px;
    margin: 0 auto;
}

.landing-hero h1 {
    font-size: 36px;
    font-weight: 800;
    line-height: 1.25;
    color: var(--text);
    margin-bottom: 16px;
}

.landing-hero-sub {
    font-size: 18px;
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 32px;
}

.landing-hero-cta {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.landing-btn {
    padding: 12px 28px;
    font-size: 15px;
    width: auto;
}

/* Generic section */
.landing-section {
    padding: 64px 24px;
    max-width: 1100px;
    margin: 0 auto;
}

.landing-section-alt {
    background: var(--bg);
    max-width: none;
    padding-left: 24px;
    padding-right: 24px;
}

.landing-section-alt > h2,
.landing-section-alt > .landing-steps {
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
}

.landing-section-title {
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 40px;
    color: var(--text);
}

/* Profiles (2 columns) */
.landing-profiles {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.landing-profile-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px;
}

.landing-profile-card h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.landing-profile-tagline {
    font-size: 14px;
    color: var(--primary);
    font-weight: 500;
    margin-bottom: 16px;
}

.landing-profile-card ul {
    list-style: none;
    padding: 0;
}

.landing-profile-card li {
    font-size: 14px;
    color: var(--text);
    padding: 6px 0;
    padding-left: 20px;
    position: relative;
    line-height: 1.5;
}

.landing-profile-card li::before {
    content: "—";
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: 600;
}

/* Steps (3 columns) */
.landing-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.landing-step {
    text-align: center;
    padding: 24px 16px;
}

.landing-step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 16px;
}

.landing-step p {
    font-size: 15px;
    color: var(--text);
    line-height: 1.5;
}

/* Pricing (landing) */
.landing-pricing {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

/* Pricing pair hint */
.pricing-pair-hint {
    display: block;
    font-size: 11px;
    font-weight: 400;
    color: var(--text-light);
    margin-top: 2px;
}

/* Footer */
.landing-footer {
    padding: 32px 24px;
    border-top: 1px solid var(--border);
}

.landing-footer .auth-footer {
    margin-top: 0;
}

/* Auth container override inside landing */
.landing-section .auth-container {
    margin: 0 auto;
    padding: 0;
}

/* Landing map */
.landing-map {
    height: 450px;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    overflow: hidden;
}

.landing-map-sub {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 16px;
    font-size: 15px;
}

.landing-map-stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 15px;
    color: var(--text);
}

.landing-stat strong {
    font-weight: 700;
    color: var(--primary);
}

.landing-stat-sep {
    width: 1px;
    height: 18px;
    background: var(--border);
}

.landing-enseigne-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
}

.landing-legend-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 16px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: opacity 0.2s;
    background: var(--card);
    user-select: none;
}

.landing-legend-chip:hover {
    border-color: var(--text-light);
}

.landing-legend-chip.inactive {
    opacity: 0.35;
}

/* ===== Burger menu (hidden on desktop) ===== */
.landing-burger,
.app-burger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    width: 28px;
    height: 24px;
    position: relative;
    padding: 0;
    flex-shrink: 0;
}
.landing-burger span,
.app-burger span {
    display: block;
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.3s, opacity 0.3s;
}
.landing-burger span:nth-child(1),
.app-burger span:nth-child(1) { top: 2px; }
.landing-burger span:nth-child(2),
.app-burger span:nth-child(2) { top: 11px; }
.landing-burger span:nth-child(3),
.app-burger span:nth-child(3) { top: 20px; }
.landing-nav-open .landing-burger span:nth-child(1),
.app-drawer-open .app-burger span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}
.landing-nav-open .landing-burger span:nth-child(2),
.app-drawer-open .app-burger span:nth-child(2) {
    opacity: 0;
}
.landing-nav-open .landing-burger span:nth-child(3),
.app-drawer-open .app-burger span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* App drawer backdrop (hidden on desktop) */
.app-drawer-backdrop { display: none; }
.landing-nav-backdrop {
    display: none;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    /* Burger visible */
    .landing-burger {
        display: block;
    }

    /* Nav links as dropdown */
    .landing-nav-links {
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        background: var(--card);
        flex-direction: column;
        gap: 0;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transition: max-height 0.3s ease, opacity 0.25s ease;
        border-bottom: 1px solid var(--border);
        z-index: 999;
        margin-left: 0;
    }

    .landing-nav-open .landing-nav-links {
        max-height: 280px;
        opacity: 1;
    }

    .landing-nav-links a {
        display: block;
        padding: 16px 24px;
        font-size: 15px;
        border-bottom: 1px solid var(--border);
    }

    .landing-nav-links a:last-child {
        border-bottom: none;
    }

    /* Backdrop */
    .landing-nav-open .landing-nav-backdrop {
        display: block;
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.3);
        z-index: 998;
    }

    /* Section spacing */
    .landing-section {
        padding: 48px 16px;
    }

    .landing-section-alt {
        padding-left: 16px;
        padding-right: 16px;
    }

    .landing-hero {
        padding: 100px 16px 48px;
    }

    .landing-hero h1 {
        font-size: 26px;
    }

    .landing-hero-sub {
        font-size: 15px;
    }

    .landing-section-title {
        font-size: 20px;
    }

    .landing-profiles {
        grid-template-columns: 1fr;
    }

    .landing-steps {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .landing-pricing {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .landing-map {
        height: 300px;
    }

    /* Legend chips horizontal scroll */
    .landing-enseigne-legend {
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: 4px;
    }

    /* Map stats wrap */
    .landing-map-stats {
        flex-wrap: wrap;
        font-size: 13px;
    }

    /* ===== App + Admin navbar ===== */
    .app-burger { display: block; }
    .navbar .nav-links { display: none; }
    .navbar .user-info #user-name,
    .navbar .user-info #plan-badge,
    .navbar .user-info .btn-outline-info { display: none; }
    .navbar { padding: 0 12px; gap: 12px; }

    /* Admin nav dropdown */
    .navbar { flex-wrap: wrap; }
    .admin-nav-open {
        height: auto;
        min-height: 56px;
    }
    .admin-nav-open .nav-links,
    .admin-nav-open .user-info {
        display: flex;
        flex: 0 0 100%;
        padding: 8px 12px;
        border-top: 1px solid var(--border);
        gap: 8px;
        flex-wrap: wrap;
    }
    .admin-nav-open .user-info #user-name { display: inline; }

    /* ===== App sidebar drawer ===== */
    .sidebar {
        position: fixed;
        top: 56px;
        left: 0;
        bottom: 0;
        width: 85vw;
        max-width: 360px;
        z-index: 999;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: none;
    }
    .app-drawer-open .sidebar {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0,0,0,0.15);
    }
    .app-drawer-open .app-drawer-backdrop {
        display: block;
        position: fixed;
        inset: 56px 0 0 0;
        background: rgba(0,0,0,0.3);
        z-index: 998;
    }
    .sidebar-resize-handle { display: none; }
    .sidebar-tabs button { padding: 10px 6px; font-size: 11px; }

    /* ===== Comparison / History toolbar responsive ===== */
    .comparison-toolbar { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
    .comparison-title { width: 100%; }
    .comparison-toggle { width: 100%; overflow-x: auto; flex-shrink: 0; }
    .comparison-actions { width: 100%; flex-wrap: wrap; gap: 6px; }
    .comparison-table-wrapper,
    .history-table-wrapper { padding: 8px 12px; }

    /* ===== Table first-column sizing for mobile ===== */
    .history-store-cell {
        width: 130px; min-width: 130px; max-width: 130px;
        font-size: 11px;
    }
    .history-reference { display: none; }

    .ean-th-product { width: 120px; min-width: 120px; padding: 6px 6px; }
    .ean-td-product { padding: 4px 6px; gap: 4px; }
    .ean-product-img { width: 28px; height: 28px; }
    .ean-product-detail, .comparison-ean-code { font-size: 10px; }

    .comparison-product-header { width: 120px; min-width: 120px; }
    .comparison-item-cell { min-width: 130px; }
    .comparison-store-header { min-width: 130px; }

    /* ===== Selector areas (outside scroll containers) ===== */
    #comparison-selector-area,
    #history-selector-area { padding: 8px 12px; }
    .history-selector { flex-direction: column; align-items: stretch; }
    .ean-select { min-width: 0; width: 100%; }

    /* ===== Pricing modal ===== */
    .pricing-modal { width: 95vw; }

    /* ===== Admin responsive ===== */
    .admin-container { padding: 0 12px; }
    .admin-container h1 { font-size: 20px; }
    .admin-grid { grid-template-columns: 1fr; }

    /* ===== Legal responsive ===== */
    .legal-container { margin: 20px auto; padding: 0 12px; }
    .legal-card { padding: 20px; }
    .legal-tab-btn { font-size: 12px; padding: 6px 12px; }
}

@media (max-width: 480px) {
    .landing-hero h1 {
        font-size: 22px;
    }

    .landing-hero-sub {
        font-size: 14px;
    }

    .landing-pricing {
        grid-template-columns: 1fr;
    }

    .landing-hero-cta {
        flex-direction: column;
        align-items: center;
    }

    .landing-btn {
        width: 100%;
        text-align: center;
    }

    .auth-card {
        padding: 24px 20px;
    }

    .profile-choice {
        flex-direction: column;
    }

    .pricing-card {
        padding-top: 20px;
    }

    .landing-step {
        padding: 16px 12px;
    }

    /* ===== App sidebar 480px ===== */
    .sidebar-tabs button { font-size: 10px; padding: 8px 4px; }
    .comparison-title { font-size: 14px; }
    .toggle-btn { font-size: 11px; padding: 5px 10px; }

    /* ===== Admin 480px ===== */
    .admin-card { padding: 16px; }

    /* ===== Legal 480px ===== */
    .legal-card header h1 { font-size: 20px; }
}
