/* =====================================================================
   GASY'CAR Keys - Design system
   Rouge + Noir + Blanc | Auto Locksmith
   ===================================================================== */
@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap; src: url('../fonts/inter-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-weight: 500; font-display: swap; src: url('../fonts/inter-latin-500-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-weight: 600; font-display: swap; src: url('../fonts/inter-latin-600-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-weight: 700; font-display: swap; src: url('../fonts/inter-latin-700-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap; src: url('../fonts/inter-latin-ext-400-normal.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
    --primary: #d90000;
    --primary-dark: #a80000;
    --primary-soft: #fdeaea;
    --black: #111318;
    --dark: #1b1f24;
    --white: #ffffff;
    --gray-50: #f8f9fa;
    --gray-100: #f1f3f5;
    --gray-200: #e5e7eb;
    --gray-500: #6c757d;
    --success: #198754;
    --warning: #f59f00;
    --danger: #dc3545;
    --info: #0d6efd;
    --border: #e5e7eb;
    --radius: 10px;
    --shadow-sm: 0 1px 2px rgba(17, 19, 24, .06), 0 1px 3px rgba(17, 19, 24, .05);
    --shadow-md: 0 4px 14px rgba(17, 19, 24, .08);
    --sidebar-w: 260px;
    --sidebar-w-collapsed: 76px;
    --topbar-h: 64px;
    --brand: var(--primary);        /* compat. facture / QR */
    --brand-dark: var(--primary-dark);

    /* Mappage Bootstrap */
    --bs-primary: var(--primary);
    --bs-primary-rgb: 217, 0, 0;
    --bs-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --bs-body-color: var(--black);
    --bs-secondary-color: var(--gray-500);
    --bs-border-color: var(--border);
    --bs-link-color-rgb: 217, 0, 0;
    --bs-link-hover-color-rgb: 168, 0, 0;
}

/* ---------- Base & typographie ---------- */
body { background: #f4f5f7; color: var(--black); font-size: .925rem; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, .h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -.01em; }
h2, .h2 { font-size: 1.3rem; font-weight: 700; }
h3, .h3 { font-size: 1.15rem; font-weight: 600; }
h4, .h4 { font-size: 1.05rem; font-weight: 600; }
h5, .h5, h6, .h6 { font-weight: 600; }
.text-muted { color: var(--gray-500) !important; }
a { text-decoration: none; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- Boutons ---------- */
.btn { --bs-btn-border-radius: 8px; --bs-btn-font-weight: 500; --bs-btn-padding-x: 1rem; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s; }
.btn-sm { --bs-btn-padding-x: .7rem; --bs-btn-font-size: .8rem; }
.btn-primary { --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary-dark); --bs-btn-hover-border-color: var(--primary-dark); --bs-btn-active-bg: var(--primary-dark); --bs-btn-active-border-color: var(--primary-dark); --bs-btn-disabled-bg: var(--primary); --bs-btn-disabled-border-color: var(--primary); --bs-btn-focus-shadow-rgb: 217, 0, 0; }
.btn-secondary, .btn-dark { --bs-btn-bg: var(--dark); --bs-btn-border-color: var(--dark); --bs-btn-hover-bg: var(--black); --bs-btn-hover-border-color: var(--black); --bs-btn-active-bg: var(--black); --bs-btn-active-border-color: var(--black); --bs-btn-disabled-bg: var(--dark); --bs-btn-disabled-border-color: var(--dark); }
.btn-success { --bs-btn-bg: var(--success); --bs-btn-border-color: var(--success); --bs-btn-hover-bg: #146c43; --bs-btn-hover-border-color: #146c43; }
.btn-danger { --bs-btn-bg: var(--danger); --bs-btn-border-color: var(--danger); --bs-btn-hover-bg: #b02a37; --bs-btn-hover-border-color: #b02a37; }
.btn-outline-primary { --bs-btn-color: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary); --bs-btn-hover-border-color: var(--primary); --bs-btn-active-bg: var(--primary-dark); --bs-btn-active-border-color: var(--primary-dark); }
.btn-outline-secondary { --bs-btn-color: var(--dark); --bs-btn-border-color: #ced4da; --bs-btn-hover-bg: var(--gray-100); --bs-btn-hover-border-color: #adb5bd; --bs-btn-hover-color: var(--black); --bs-btn-active-bg: var(--gray-200); --bs-btn-active-color: var(--black); --bs-btn-active-border-color: #adb5bd; }
.btn-outline-dark { --bs-btn-color: var(--dark); --bs-btn-border-color: var(--dark); --bs-btn-hover-bg: var(--dark); --bs-btn-hover-border-color: var(--dark); }
.btn-outline-light { --bs-btn-color: #fff; --bs-btn-border-color: rgba(255,255,255,.35); --bs-btn-hover-bg: rgba(255,255,255,.12); --bs-btn-hover-color: #fff; --bs-btn-hover-border-color: rgba(255,255,255,.6); }
.btn-link { color: var(--primary); }

/* ---------- Cartes ---------- */
.card { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); background: var(--white); }
.card-header { background: var(--white); border-bottom: 1px solid var(--border); font-weight: 600; padding: .85rem 1.1rem; }
.card-header.bg-white { background: var(--white) !important; }
.stat-card { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }

/* ---------- Badges ---------- */
.badge { font-weight: 600; letter-spacing: .02em; border-radius: 6px; padding: .4em .65em; }
.badge.bg-secondary { background: var(--gray-500) !important; }
.badge.bg-light { background: var(--gray-100) !important; border: 1px solid var(--border); }

/* ---------- Formulaires ---------- */
.form-label { font-weight: 500; font-size: .85rem; margin-bottom: .35rem; color: var(--dark); }
.form-control, .form-select { border-radius: 8px; border-color: #ced4da; padding: .5rem .8rem; font-size: .9rem; }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: var(--primary); box-shadow: 0 0 0 .2rem rgba(217, 0, 0, .15); }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-control::placeholder { color: #9aa1a9; }
.invalid-feedback, .text-danger { font-size: .8rem; }
.input-group-text { background: var(--gray-100); border-color: #ced4da; color: var(--gray-500); }
.form-text { color: var(--gray-500); font-size: .78rem; }

/* ---------- Tables ---------- */
.table { --bs-table-hover-bg: #fbf3f3; margin-bottom: 0; font-size: .88rem; }
.table > :not(caption) > * > * { vertical-align: middle; padding: .75rem .9rem; border-bottom-color: var(--border); }
.table thead th, .table-light { --bs-table-bg: var(--gray-100); --bs-table-color: var(--dark); }
.table thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; color: var(--gray-500); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table-responsive { border-radius: var(--radius); }
.table .btn-sm { padding: .3rem .55rem; }

/* ---------- Pagination ---------- */
.pagination { --bs-pagination-color: var(--dark); --bs-pagination-hover-color: var(--primary); --bs-pagination-hover-bg: var(--primary-soft); --bs-pagination-active-bg: var(--primary); --bs-pagination-active-border-color: var(--primary); --bs-pagination-focus-box-shadow: 0 0 0 .2rem rgba(217, 0, 0, .15); --bs-pagination-border-radius: 8px; gap: .25rem; }
.pagination .page-link { border-radius: 8px; border-color: var(--border); }

/* ---------- Alertes ---------- */
.alert { border-radius: var(--radius); border-width: 1px; font-size: .9rem; }
.toast-stack { position: fixed; top: calc(var(--topbar-h) + .75rem); right: 1rem; z-index: 1100; display: flex; flex-direction: column; gap: .6rem; width: min(380px, calc(100vw - 2rem)); }
.toast-gc { display: flex; align-items: flex-start; gap: .75rem; background: var(--white); border: 1px solid var(--border); border-left: 4px solid var(--info); border-radius: var(--radius); box-shadow: var(--shadow-md); padding: .8rem .9rem; font-size: .88rem; }
.toast-gc .toast-ico { margin-top: .1rem; }
.toast-gc.success { border-left-color: var(--success); } .toast-gc.success .toast-ico { color: var(--success); }
.toast-gc.danger  { border-left-color: var(--danger); }  .toast-gc.danger .toast-ico  { color: var(--danger); }
.toast-gc.warning { border-left-color: var(--warning); } .toast-gc.warning .toast-ico { color: var(--warning); }
.toast-gc.info .toast-ico { color: var(--info); }
.toast-gc .btn-close { margin-left: auto; font-size: .7rem; }
.swal2-popup { border-radius: 14px !important; font-family: inherit !important; }
.swal2-styled.swal2-confirm { background: var(--primary) !important; border-radius: 8px !important; }
.swal2-styled.swal2-cancel { background: var(--dark) !important; border-radius: 8px !important; }

/* ---------- Layout : logo blanc + panneau noir (maquette) ---------- */
.sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w); background: var(--white); z-index: 1040; display: flex; flex-direction: column; transition: width .2s ease, transform .25s ease; }
.sidebar-brand { padding: .85rem 1.1rem .9rem; flex-shrink: 0; }
.sidebar-brand a { display: block; text-align: center; }
.sidebar-brand img { display: block; width: 100%; max-width: 100%; height: auto; max-height: 98px; object-fit: contain; margin: 0 auto; }
.sidebar-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--black); color: #c9ced6; border-top-right-radius: 28px; position: relative; overflow: hidden; }
.sidebar-scroll { flex: 0 1 auto; overflow-y: auto; padding: 1.1rem .8rem .5rem; scrollbar-width: thin; scrollbar-color: #3a3f47 transparent; position: relative; z-index: 1; }
.sidebar .nav-link { display: flex; align-items: center; gap: 1rem; color: #e6e8ec; padding: .7rem 1rem; border-radius: 8px; font-size: .95rem; font-weight: 500; margin-bottom: 4px; transition: background-color .15s, color .15s; white-space: nowrap; }
.sidebar .nav-link i { width: 1.4rem; text-align: center; font-size: 1.15rem; color: #fff; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar .nav-link.active { background: linear-gradient(90deg, #e00000 0%, var(--primary-dark) 100%); color: #fff; box-shadow: 0 4px 12px rgba(217, 0, 0, .35); }
.sidebar-section { list-style: none; font-size: .66rem; text-transform: uppercase; letter-spacing: .1em; color: #6b727d; padding: 1rem 1rem .3rem; font-weight: 700; white-space: nowrap; }
.sidebar-foot { margin-top: auto; position: relative; height: 120px; flex-shrink: 0; }
@media (max-height: 1000px) { .sidebar-foot { display: none; } }
.sidebar-foot::before { content: ''; position: absolute; left: -10%; right: -10%; top: 26px; height: 48px; background: linear-gradient(100deg, transparent 0%, transparent 30%, var(--primary) 30.5%, var(--primary-dark) 100%); transform: skewY(-9deg); opacity: .95; }
.sidebar-foot span { position: absolute; left: 0; right: 0; bottom: 22px; text-align: center; font-style: italic; font-size: .95rem; color: #fff; }
.sidebar-foot span::after { content: ''; display: block; width: 62%; height: 2px; background: var(--primary); margin: .4rem auto 0; }
.sidebar-collapse-btn { margin: 0 .8rem .8rem; background: rgba(255,255,255,.08); border: 0; color: #c9ced6; border-radius: 8px; padding: .45rem; font-size: .85rem; position: relative; z-index: 1; }
.sidebar-collapse-btn:hover { background: rgba(255,255,255,.15); color: #fff; }
.sidebar-backdrop { display: none; }

.topbar { position: fixed; top: 0; left: var(--sidebar-w); right: 0; height: var(--topbar-h); background: var(--white); color: var(--black); display: flex; align-items: center; gap: .75rem; padding: 0 1.5rem; z-index: 1030; box-shadow: 0 1px 0 var(--border); transition: left .2s ease; }
.topbar-menu-btn { display: none; background: transparent; border: 1px solid var(--border); border-radius: 8px; width: 40px; height: 40px; color: var(--dark); }
.topbar-logo { display: none; }
.topbar-logo img { height: 36px; width: auto; display: block; }
.topbar-search { position: relative; flex: 1; max-width: 780px; }
.topbar-search i { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--gray-500); font-size: .85rem; }
.topbar-search input { padding-left: 2.6rem; background: var(--gray-100); border-color: transparent; border-radius: 10px; height: 44px; }
.topbar-search input:focus { background: var(--white); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.icon-btn { position: relative; width: 40px; height: 40px; border: 0; background: transparent; border-radius: 50%; font-size: 1.15rem; color: var(--dark); display: inline-flex; align-items: center; justify-content: center; transition: background-color .15s; }
.icon-btn:hover { background: var(--gray-100); }
.icon-btn .dot { position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--primary); color: #fff; font-size: .65rem; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 2px solid var(--white); }
.user-toggle { display: flex; align-items: center; gap: .6rem; background: transparent; border: 0; padding: .2rem .35rem; border-radius: 999px; }
.user-toggle:hover { background: var(--gray-100); }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--black); color: #fff; font-size: .95rem; display: inline-flex; align-items: center; justify-content: center; }
.user-meta { text-align: left; line-height: 1.15; }
.user-meta strong { display: block; font-size: .85rem; }
.user-meta small { color: var(--gray-500); font-size: .72rem; }
.dropdown-menu { border-radius: var(--radius); border-color: var(--border); box-shadow: var(--shadow-md); font-size: .88rem; }
.dropdown-item { display: flex; align-items: center; gap: .6rem; padding: .5rem .9rem; }
.dropdown-item:active { background: var(--primary); }
.dropdown-item i { width: 1rem; text-align: center; color: var(--gray-500); }

.app-wrapper { display: block; padding-top: var(--topbar-h); min-height: 100vh; }
.app-content { margin-left: var(--sidebar-w); padding: 1.5rem 1.75rem; min-width: 0; transition: margin-left .2s ease; }
.app-footer { margin-top: 2rem; padding-top: 1rem; color: var(--gray-500); font-size: .78rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }

body.sidebar-collapsed { --sidebar-w: var(--sidebar-w-collapsed); }
body.sidebar-collapsed .sidebar-brand { padding: .7rem .4rem; }
body.sidebar-collapsed .sidebar-foot span { display: none; }
body.sidebar-collapsed .sidebar-brand img { content: url('../images/logo/gasycar-keys-icon.png'); max-height: 40px; }
body.sidebar-collapsed.has-custom-logo .sidebar-brand img { content: normal; max-height: 40px; object-fit: contain; }   /* logo personnalisé : pas l'ancienne icône */
body.sidebar-collapsed .nav-link span, body.sidebar-collapsed .sidebar-section, body.sidebar-collapsed .sidebar-collapse-btn span { display: none; }
body.sidebar-collapsed .nav-link { justify-content: center; padding: .65rem; }
body.sidebar-collapsed .sidebar-scroll { overflow-x: hidden; }

/* ---------- Page header ---------- */
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: 1.25rem; }
.page-head h1 { margin: 0; }
.page-head-slim { margin-bottom: 1rem; }

/* ---------- Dashboard (maquette) ---------- */
.hero { border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-md); background: var(--black); }
.hero img { display: block; width: 100%; height: auto; }
@media (min-width: 1200px) { .kpi-col { flex: 1 1 0; } }
.kpi { border: 0; border-left: 4px solid var(--black); border-radius: 10px; box-shadow: var(--shadow-sm); }
.kpi.kpi-red { border-left-color: var(--primary); }
.kpi.kpi-dark { border-left-color: #3b4047; }
.kpi .card-body { display: flex; align-items: center; gap: .9rem; padding: 1.1rem 1rem; }
.kpi .stat-icon { width: 54px; height: 54px; border-radius: 12px; font-size: 1.35rem; color: #fff; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--black); }
.kpi-red .stat-icon { background: var(--primary); }
.kpi-dark .stat-icon { background: #3b4047; }
.kpi-text { min-width: 0; }
.kpi .stat-label { font-size: .85rem; font-weight: 500; color: var(--dark); text-transform: none; letter-spacing: 0; margin: 0; }
.kpi .stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.15; color: var(--black); overflow-wrap: anywhere; }
.kpi-evo { font-size: .76rem; font-weight: 500; }
.kpi-evo.up { color: var(--success); }
.kpi-evo.down { color: var(--danger); }
.panel { border: 0; border-radius: 10px; box-shadow: var(--shadow-sm); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: 1rem 1.1rem .75rem; }
.panel-head h2 { font-size: 1rem; font-weight: 600; margin: 0; display: flex; align-items: center; gap: .6rem; }
.panel-head h2 i { color: var(--primary); font-size: 1.05rem; }
.panel-head .btn-sm { font-size: .75rem; padding: .3rem .7rem; }
.table-compact thead th { background: var(--gray-100); font-size: .75rem; text-transform: none; letter-spacing: 0; color: var(--dark); font-weight: 600; }
.table-compact thead th:first-child { border-radius: 8px 0 0 8px; } .table-compact thead th:last-child { border-radius: 0 8px 8px 0; }
.table-compact > :not(caption) > * > * { padding: .6rem .75rem; }
.pill { display: inline-block; padding: .22rem .75rem; border-radius: 999px; font-size: .74rem; font-weight: 600; white-space: nowrap; }
.pill-success { background: #d7f4e3; color: #137a43; } .pill-info { background: #dbeafe; color: #1d5fd1; }
.pill-warning { background: #ffe8bf; color: #a35f00; } .pill-danger { background: #fde0e3; color: #b02a37; } .pill-gray { background: var(--gray-100); color: var(--gray-500); }
.donut-wrap { display: flex; align-items: center; justify-content: center; gap: 1.5rem; flex-wrap: wrap; padding: .5rem 1.1rem 1.3rem; }
.donut { width: 170px; height: 170px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.donut-hole { width: 104px; height: 104px; border-radius: 50%; background: var(--white); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.donut-hole strong { font-size: 1.35rem; } .donut-hole small { color: var(--gray-500); font-size: .75rem; }
.donut-legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 150px; }
.donut-legend li { display: flex; align-items: center; gap: .55rem; padding: .5rem 0; border-bottom: 1px solid var(--border); font-size: .85rem; }
.donut-legend li:last-child { border-bottom: 0; }
.dotc { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }
.lg-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .lg-pct { font-weight: 600; }
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; padding: .25rem 1.1rem 1.1rem; }
.quick-tile { position: relative; display: flex; flex-direction: column; justify-content: flex-end; gap: .6rem; min-height: 96px; padding: .9rem; border-radius: 10px; color: #fff; font-size: .85rem; font-weight: 500; transition: transform .15s, box-shadow .15s; }
.quick-tile:hover { color: #fff; transform: translateY(-2px); box-shadow: var(--shadow-md); }
.quick-red { background: linear-gradient(135deg, #e00000, var(--primary-dark)); } .quick-black { background: linear-gradient(135deg, #1b1f24, var(--black)); }
.qt-icon { font-size: 1.5rem; } .qt-go { position: absolute; right: .8rem; top: 50%; transform: translateY(-50%); font-size: .8rem; opacity: .9; }
.empty-state { text-align: center; color: var(--gray-500); padding: 2rem 1rem; }
.empty-state i { font-size: 1.6rem; color: #c3c8cf; display: block; margin-bottom: .5rem; }

/* ---------- Envoi d'image (aperçu + glisser-déposer) ---------- */
.img-upload-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.img-upload { position: relative; }
.img-upload-source { margin-bottom: .5rem; }
.img-upload-source .btn { min-width: 132px; }
.img-upload-source .btn.is-selected { background: var(--primary); border-color: var(--primary); color: #fff; }
.img-upload-zone { border: 2px dashed #ced4da; border-radius: 12px; background: var(--gray-50); padding: 1rem; cursor: pointer; transition: border-color .15s, background-color .15s, box-shadow .15s; }
.img-upload-zone:hover, .img-upload.is-drag .img-upload-zone { border-color: var(--primary); background: var(--primary-soft); }
.img-upload-zone:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.img-upload.has-error .img-upload-zone { border-color: var(--danger); background: #fff5f5; }
.img-upload-empty { display: flex; flex-direction: column; align-items: center; gap: .15rem; text-align: center; padding: 1rem .5rem; color: var(--gray-500); font-size: .88rem; }
.img-upload-empty i { font-size: 2rem; color: var(--primary); margin-bottom: .35rem; }
.img-upload-empty strong { color: var(--black); font-weight: 600; }
.img-upload-empty u { color: var(--primary); text-underline-offset: 2px; }
.img-upload-preview { display: flex; align-items: center; gap: 1rem; }
.img-upload-preview[hidden], .img-upload-empty[hidden], .img-upload-error[hidden] { display: none; }
.img-upload-preview img { width: 120px; height: 120px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); background: var(--white); flex-shrink: 0; box-shadow: var(--shadow-sm); }
.img-upload-wide .img-upload-preview img { width: 170px; height: 100px; object-fit: contain; padding: .35rem; }
.img-upload-info { display: flex; flex-direction: column; align-items: flex-start; gap: .2rem; min-width: 0; }
.img-upload-name { font-size: .9rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.img-upload-size { color: var(--gray-500); }
.img-upload-badge { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: .15rem .55rem; border-radius: 999px; background: var(--gray-200); color: var(--dark); }
.img-upload.is-new .img-upload-badge { background: #d7f4e3; color: #137a43; }
.img-upload.is-removed .img-upload-badge { background: #fde0e3; color: #b02a37; }
.img-upload.is-removed .img-upload-preview img { opacity: .35; filter: grayscale(1); }
.img-upload.is-new .img-upload-zone { border-style: solid; border-color: #9fd8b8; }
.img-upload-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.img-upload-error { margin-top: .4rem; color: var(--danger); font-size: .82rem; }
@media (max-width: 575.98px) { .img-upload-preview { flex-direction: column; text-align: center; } .img-upload-info { align-items: center; } }

/* ---------- Commande : sélection, préparation ---------- */
.select-bar { position: fixed; left: var(--sidebar-w); right: 0; bottom: 1.25rem; margin-inline: auto; width: max-content; max-width: calc(100vw - var(--sidebar-w) - 2rem); z-index: 1020; display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; justify-content: center; background: var(--black); color: #fff; padding: .7rem 1.1rem; border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.3); border-left: 4px solid var(--primary); }
.select-bar[hidden] { display: none; }
.table tr.row-selected > * { background-color: var(--primary-soft) !important; }
.nav-badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 .4rem; border-radius: 11px; background: var(--primary); color: #fff; font-size: .72rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.sidebar .nav-link.active .nav-badge { background: #fff; color: var(--primary-dark); }
body.sidebar-collapsed .nav-badge { display: none; }
.qty-stepper { display: inline-flex; align-items: center; gap: .25rem; }
.qty-stepper input { width: 62px; padding: .25rem .3rem; -moz-appearance: textfield; }
.qty-stepper input::-webkit-outer-spin-button, .qty-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty-stepper .btn { width: 30px; height: 30px; padding: 0; }
.cart-table tr.line-error > td, .cart-table tr.stock-error-row > td { background: #fff5f5 !important; }
.cart-table tr.stock-error-row > td { border-top: 0; padding-top: 0 !important; }
.stock-error { margin: 0 0 .35rem; padding: .5rem .65rem; border-left: 3px solid var(--danger); background: #fdeaec; border-radius: 6px; font-size: .8rem; color: #842029; line-height: 1.35; }
.stock-error strong { display: block; }
.scan-video { width: 100%; max-height: 260px; background: #000; border-radius: 10px; }
.final-summary { background: var(--gray-100); border-radius: 10px; padding: .75rem 1rem; }
.client-chip { display: flex; justify-content: space-between; align-items: center; border: 1px solid var(--border); border-radius: 10px; padding: .7rem .9rem; background: var(--gray-50); }
.modal-content { border: 0; border-radius: 14px; }
.modal-header, .modal-footer { border-color: var(--border); }
@media (max-width: 991.98px) { .select-bar { left: 0; max-width: calc(100vw - 1.5rem); } }

/* ---------- Champ Catégorie (recherche + création) ---------- */
.combo { position: relative; }
.combo-field { position: relative; }
.combo-field .form-control { padding-left: 2.3rem; padding-right: 2.3rem; }
.combo-icon { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--gray-500); font-size: .85rem; pointer-events: none; }
.combo.has-value .combo-icon { color: var(--primary); }
.combo.has-value .combo-field .form-control { border-color: #9fd8b8; background-color: #f6fcf9; }
.combo-clear { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border: 0; background: transparent; color: var(--gray-500); border-radius: 8px; }
.combo-clear:hover { background: var(--gray-100); color: var(--black); }
.combo-clear[hidden], .combo-list[hidden] { display: none; }
.combo-list { position: absolute; z-index: 1050; left: 0; right: 0; top: 100%; margin-top: .25rem; background: var(--white); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-md); max-height: 280px; overflow-y: auto; padding: .3rem; }
.combo-item { display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; border-radius: 8px; cursor: pointer; font-size: .9rem; }
.combo-item i { width: 1rem; text-align: center; color: var(--gray-500); }
.combo-item.active { background: var(--gray-100); }
.combo-new { color: var(--primary); font-weight: 600; border-top: 1px dashed var(--border); border-radius: 0 0 8px 8px; }
.combo-new i { color: var(--primary); }
.combo-new.active { background: var(--primary-soft); }
.combo-empty { padding: .7rem; color: var(--gray-500); font-size: .85rem; }

/* ---------- Traçabilité : récapitulatif + historique ---------- */
.recap { display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1rem; font-size: .88rem; }
.recap dt { color: var(--gray-500); font-weight: 500; }
.recap dd { margin: 0; text-align: right; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 .4rem; border-left: 2px solid var(--border); }
.timeline-item { position: relative; padding: 0 0 1rem 1.1rem; }
.timeline-item::before { content: ''; position: absolute; left: -.62rem; top: .35rem; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 3px var(--white); }
.timeline-item.is-system::before { background: var(--dark); }
.timeline-item:last-child { padding-bottom: 0; }
.tl-date { font-size: .75rem; color: var(--gray-500); }
.tl-who { font-weight: 600; font-size: .85rem; }
.tl-what { font-size: .88rem; }
.tl-status { display: inline-block; font-size: .7rem; font-weight: 600; background: var(--gray-100); border-radius: 999px; padding: .1rem .55rem; margin-left: .25rem; text-transform: uppercase; letter-spacing: .03em; }
.tl-amount { font-weight: 600; margin-left: .25rem; }
.tl-det { font-size: .78rem; color: var(--gray-500); margin-top: .1rem; overflow-wrap: anywhere; }

/* ---------- Statistiques ---------- */
.stats-filters .form-select-sm, .stats-filters .form-control-sm { min-width: 150px; }
.seg { display: inline-flex; background: var(--gray-100); border-radius: 10px; padding: 3px; }
.seg-btn { border: 0; background: transparent; padding: .4rem .9rem; border-radius: 8px; font-size: .85rem; font-weight: 500; color: var(--dark); display: inline-flex; align-items: center; gap: .45rem; }
.seg-btn.active { background: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(217, 0, 0, .3); }
.seg-btn:not(.active):hover { background: var(--gray-200); }
.perso-dates[hidden], .mode-magasin[hidden], .mode-comparer[hidden] { display: none; }
.store-chip { display: inline-flex; align-items: center; gap: .45rem; border: 1px solid var(--border); border-radius: 999px; padding: .3rem .8rem; font-size: .85rem; cursor: pointer; background: var(--white); user-select: none; }
.store-chip input { accent-color: var(--primary); }
.store-chip.on { border-color: var(--chip, var(--primary)); background: var(--gray-50); }
.stats-period { font-size: .9rem; }
.stat-value-sm { font-size: 1.15rem !important; }
.chart-box { position: relative; height: 340px; }
.minibar { height: 4px; background: var(--gray-100); border-radius: 2px; margin-top: .3rem; overflow: hidden; }
.minibar span { display: block; height: 100%; background: var(--primary); border-radius: 2px; }
.rank-1 { color: #b8860b; font-weight: 700; }
.kpi-evo.flat { color: var(--gray-500); }

/* ---------- Liste des produits : recherche, pastilles, cartes ---------- */
.search-field { position: relative; }
.search-field > i { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--gray-500); font-size: .9rem; pointer-events: none; }
.search-field .form-control { padding-left: 2.4rem; padding-right: 2.4rem; background: var(--white); }
.search-clear { position: absolute; right: .3rem; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: 0; background: transparent; color: var(--gray-500); border-radius: 8px; }
.search-clear[hidden] { display: none; }
.chip-row { display: flex; gap: .5rem; overflow-x: auto; padding: 0 0 .75rem; margin: 0 0 .25rem; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chip-row::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: .45rem; min-height: 40px; padding: 0 .95rem; border: 1px solid var(--border); border-radius: 999px; background: var(--white); color: var(--dark); font-size: .85rem; font-weight: 500; white-space: nowrap; transition: background-color .15s, border-color .15s; }
.chip i { font-size: .8rem; color: var(--gray-500); }
.chip:hover { color: var(--black); border-color: #cfd4da; }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(217, 0, 0, .25); }
.chip.active i { color: #fff; }
#plRegion.is-loading .products-card { opacity: .55; transition: opacity .15s; pointer-events: none; }
.m-selectall { text-transform: none; letter-spacing: 0; display: inline-flex; align-items: center; gap: .6rem; margin: 0; font-weight: 500; font-size: .85rem; color: var(--dark); }
.p-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: var(--gray-100); }
.p-thumb-empty { font-size: 1.1rem !important; }
.stk { display: inline-flex; align-items: center; gap: .35rem; font-size: .76rem; font-weight: 600; padding: .2rem .6rem; border-radius: 999px; white-space: nowrap; }
.stk-ok { background: var(--gray-100); color: #3f4650; }
.stk-low { background: #fff1d6; color: #9a5b00; }
.stk-out { background: #fde0e3; color: #b02a37; }
.m-meta { display: block; font-size: .78rem; color: var(--gray-500); }
.m-meta code { font-size: .75rem; }
.m-ico { font-size: .72rem; margin-right: .3rem; opacity: .7; }
.m-sep { margin: 0 .3rem; }
.m-tag { display: inline-block; font-size: .68rem; font-weight: 700; padding: .05rem .45rem; border-radius: 6px; background: var(--gray-100); color: var(--dark); margin-right: .3rem; }
.m-tag-off { background: #e2e3e5; color: #41464b; margin: 0 0 0 .3rem; }

/* ---------- Magasin sélectionné (Super Admin) ---------- */
.store-filter { display: flex; align-items: center; gap: .6rem; margin: 0; background: var(--white); border: 1px solid var(--border); border-radius: 12px; padding: 0 .75rem; min-height: 46px; }
.store-filter i { color: var(--primary); }
.store-filter .sf-label { font-size: .78rem; color: var(--gray-500); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.store-filter select { flex: 1; min-width: 0; border: 0; background: transparent; font-weight: 600; font-size: .92rem; padding: .5rem 1.6rem .5rem 0; outline: 0; }
.store-filter:focus-within { border-color: var(--primary); box-shadow: 0 0 0 .2rem rgba(217, 0, 0, .12); }
.store-banner { display: flex; align-items: center; gap: .85rem; background: var(--white); border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: 14px; padding: .7rem .9rem; margin-bottom: .6rem; box-shadow: var(--shadow-sm); }
.store-banner.is-all { border-left-color: var(--black); }
.sb-ico { width: 42px; height: 42px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.store-banner.is-all .sb-ico { background: var(--gray-100); color: var(--black); }
.sb-text { min-width: 0; line-height: 1.2; }
.sb-text small { display: block; color: var(--gray-500); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.sb-text strong { font-size: 1.05rem; overflow-wrap: anywhere; }
.sb-check { color: var(--success); font-size: .95rem; margin-left: .25rem; }
.sb-pill { margin-left: auto; font-size: .72rem; font-weight: 700; background: var(--black); color: #fff; border-radius: 999px; padding: .25rem .65rem; white-space: nowrap; display: inline-flex; align-items: center; gap: .35rem; }
.list-title { font-size: 1rem; font-weight: 700; margin: .25rem 0 .6rem; }
.store-btn { display: inline-flex; align-items: center; gap: .55rem; background: var(--primary-soft); border: 1px solid rgba(217, 0, 0, .25); color: var(--black); border-radius: 12px; padding: .3rem .8rem; max-width: 260px; }
.store-btn.is-all { background: var(--gray-100); border-color: var(--border); }
.store-btn > i:first-child { color: var(--primary); }
.store-btn.is-all > i:first-child { color: var(--black); }
.store-btn-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; text-align: left; }
.store-btn-text small { font-size: .65rem; color: var(--gray-500); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.store-btn-text strong { font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.store-caret { font-size: .7rem; color: var(--gray-500); }
.store-menu { min-width: 250px; max-height: 70vh; overflow-y: auto; }
.store-menu .dropdown-item.active { background: var(--primary-soft); color: var(--black); font-weight: 600; }
.detail-photo { width: 100%; max-width: 280px; aspect-ratio: 1; object-fit: cover; border-radius: 16px; margin: 0 auto; display: block; }
.detail-photo-empty { display: flex; align-items: center; justify-content: center; background: var(--gray-100); color: var(--gray-500); font-size: 3rem; }

/* ---------- Menu d'actions « ⋮ » ---------- */
.row-menu { display: inline-block; }
.row-menu-btn { width: 36px; height: 36px; border: 0; background: transparent; border-radius: 50%; color: var(--dark); font-size: 1.05rem; display: inline-flex; align-items: center; justify-content: center; transition: background-color .12s; }
.row-menu-btn:hover, .row-menu-btn[aria-expanded="true"] { background: var(--gray-100); }
.row-menu-list { min-width: 220px; padding: .4rem; border-radius: 14px; border: 1px solid var(--border); box-shadow: 0 10px 30px rgba(17, 19, 24, .18); z-index: 1060; }
.row-menu-list form { margin: 0; }
.row-menu-list .dropdown-item { display: flex; align-items: center; gap: .75rem; border-radius: 10px; min-height: 40px; font-size: .9rem; font-weight: 500; width: 100%; text-align: left; }
.row-menu-list .dropdown-item i { width: 1.2rem; text-align: center; color: var(--gray-500); flex-shrink: 0; }
.row-menu-list .dropdown-item small { margin-left: auto; color: var(--gray-500); font-size: .72rem; }
.row-menu-list .dropdown-item.is-primary { color: var(--primary-dark); font-weight: 600; }
.row-menu-list .dropdown-item.is-primary i { color: var(--primary); }
.row-menu-list .dropdown-item.is-danger { color: var(--danger); }
.row-menu-list .dropdown-item.is-danger i { color: var(--danger); }
.row-menu-list .dropdown-item:disabled { opacity: .55; }
.row-menu-list .dropdown-item:active { background: var(--primary); color: #fff; }
.row-menu-list .dropdown-item:active i { color: #fff; }

/* ---------- Login / setup ---------- */
.auth-page { background: var(--black); position: relative; }
.auth-page::before { content: ''; position: fixed; inset: 0; background:
    linear-gradient(115deg, rgba(17,19,24,.96) 0%, rgba(17,19,24,.88) 55%, rgba(168,0,0,.55) 100%),
    var(--auth-bg, none) center / cover no-repeat; z-index: 0; }
.auth-page::after { content: ''; position: fixed; right: -12%; bottom: -30%; width: 70vmax; height: 70vmax; border-radius: 50%; border: 2px solid rgba(217,0,0,.35); box-shadow: inset 0 0 0 40px rgba(217,0,0,.05); z-index: 0; pointer-events: none; }
.auth-wrapper { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1rem; }
.auth-wrapper .alert { width: 100%; max-width: 430px; }
.auth-card { width: 100%; max-width: 430px; border: 0; border-top: 4px solid var(--primary); border-radius: 16px; box-shadow: 0 24px 60px rgba(0,0,0,.45); }
.auth-logo { display: block; width: 100%; max-width: 280px; height: auto; margin: 0 auto .5rem; }
.auth-card .brand { font-size: 1.6rem; color: var(--primary); }
.password-wrap { position: relative; }
.password-wrap .form-control { padding-right: 2.8rem; }
.password-toggle { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--gray-500); width: 36px; height: 36px; border-radius: 8px; }
.password-toggle:hover { color: var(--black); background: var(--gray-100); }
.auth-foot { margin-top: 1.25rem; color: rgba(255,255,255,.55); font-size: .78rem; text-align: center; }

/* Planche d'étiquettes QR */
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1rem; }
.qr-label {
    background: #fff; border: 1px dashed #adb5bd; border-radius: 8px; padding: .9rem;
    text-align: center; break-inside: avoid;
}
.qr-label .qr-target svg { width: 150px; height: 150px; }
.qr-name { font-weight: 700; margin-top: .4rem; line-height: 1.2; }
.qr-meta { font-size: .8rem; color: #667085; }
.qr-price { font-weight: 700; color: var(--brand); }
.qr-code-text { font-family: monospace; font-size: .7rem; color: #98a2b3; word-break: break-all; }
@media print {
    .qr-grid { grid-template-columns: repeat(3, 1fr); gap: .5rem; }
    .qr-label { border: 1px solid #999; }
}

/* ===== Facture ===== */
.invoice { position: relative; background: #fff; max-width: 820px; margin: 0 auto; padding: 2rem; border-radius: 12px;
           box-shadow: 0 1px 6px rgba(0,0,0,.08); color: #1a1a1f; font-size: .92rem; }
.inv-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-bottom: 1rem; border-bottom: 2px solid var(--brand); }
.inv-company { display: flex; gap: .9rem; align-items: center; }
.inv-logo { max-height: 64px; max-width: 150px; object-fit: contain; }
.inv-company-name { font-size: 1.15rem; font-weight: 700; color: var(--brand); }
.inv-store { font-weight: 600; }
.inv-muted { color: #6b7280; font-size: .82rem; }
.inv-title { text-align: right; }
.inv-title-big { font-size: 1.9rem; font-weight: 800; color: var(--brand); line-height: 1; }
.inv-number { font-weight: 700; margin: .25rem 0; }
.inv-parties { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin: 1.1rem 0; }
.inv-box { background: #f3f5f9; border-radius: 8px; padding: .7rem .9rem; }
.inv-label { font-size: .68rem; font-weight: 700; color: #6b7280; letter-spacing: .06em; }
.inv-strong { font-weight: 700; }
.inv-table { width: 100%; border-collapse: collapse; }
.inv-table th { background: var(--brand); color: #fff; padding: .5rem .6rem; font-size: .82rem; }
.inv-table td { padding: .55rem .6rem; border-bottom: 1px solid #e5e7eb; vertical-align: top; }
.inv-table .r { text-align: right; white-space: nowrap; }
.inv-ref { color: #6b7280; font-size: .72rem; }
.inv-totals { margin-left: auto; width: 280px; margin-top: .8rem; }
.inv-totals > div { display: flex; justify-content: space-between; padding: .25rem .1rem; }
.inv-totals .inv-grand { background: var(--brand); color: #fff; font-weight: 800; font-size: 1.05rem; padding: .5rem .7rem; border-radius: 6px; margin-top: .3rem; }
.inv-foot { margin-top: 1.5rem; padding-top: .7rem; border-top: 1px solid #e5e7eb; text-align: center; color: #6b7280; font-size: .82rem; }
.inv-stamp { position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%) rotate(-18deg); font-size: 4rem; font-weight: 900;
             color: rgba(200, 30, 30, .18); border: .4rem solid rgba(200, 30, 30, .18); padding: .2rem 1.2rem; border-radius: 12px; pointer-events: none; }
.inv-toolbar { max-width: 820px; margin: 1rem auto; display: flex; gap: .5rem; flex-wrap: wrap; }
@media (max-width: 575.98px) { .inv-parties { grid-template-columns: 1fr; } .inv-title { text-align: left; } .invoice { padding: 1rem; } }
@media print {
    body { background: #fff !important; }
    .invoice { box-shadow: none; padding: 0; max-width: none; border-radius: 0; }
    .inv-parties, .inv-table th, .inv-grand, .inv-box { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
