/* ================================================================

   MAGESTOCK v2.6.70 — CSS COMPLET OPTIMISÉ MOBILE/TABLETTE

   Design professionnel avec sidebar desktop + optimisations mobiles

   - Safe areas (notch, barre navigation)

   - Bord à bord sur mobile

   - Touch targets 48px minimum

   - Responsive typography

   ================================================================ */



/* ══════════════════════════════════════════════════════════════

   VARIABLES

   ══════════════════════════════════════════════════════════════ */

:root {

    /* Spacing */

    --sp-1: 4px;

    --sp-2: 8px;

    --sp-3: 12px;

    --sp-4: 16px;

    --sp-5: 20px;

    --sp-6: 24px;

    --sp-8: 32px;

    

    /* Radius */

    --r: 8px;

    --r-sm: 6px;

    --r-lg: 12px;

    --r-xl: 16px;

    --r-full: 9999px;

    

    /* Fonts */

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    --font-mono: 'JetBrains Mono', monospace;

    

    /* Transitions */

    --ease: cubic-bezier(0.4, 0, 0.2, 1);

    --tr: 0.15s var(--ease);

    --tr-md: 0.2s var(--ease);

    

    /* Layout */

    --sidebar-width: 260px;

    --header-height: 60px;

    --bottom-nav-height: 64px;

    

    /* Safe Areas - avec fallbacks */

    --safe-top: env(safe-area-inset-top, 0px);

    --safe-bottom: env(safe-area-inset-bottom, 0px);

    --safe-left: env(safe-area-inset-left, 0px);

    --safe-right: env(safe-area-inset-right, 0px);

    

    /* Touch target minimum (Material Design = 48px, Apple HIG = 44px) */

    --touch-min: 48px;

}



/* Dark Theme (default) */

:root, [data-theme="dark"] {

    --bg-body: #0f172a;

    --bg-sidebar: #1e293b;

    --bg-card: #1e293b;

    --bg-elevated: #334155;

    --bg-input: #0f172a;

    --bg-hover: rgba(255,255,255,0.05);

    

    --blue: #3b82f6;

    --blue-dim: #2563eb;

    --blue-pale: rgba(59,130,246,0.15);

    --green: #22c55e;

    --green-pale: rgba(34,197,94,0.15);

    --orange: #f59e0b;

    --orange-pale: rgba(245,158,11,0.15);

    --red: #ef4444;

    --red-pale: rgba(239,68,68,0.15);

    

    --text-primary: #f8fafc;

    --text-secondary: #94a3b8;

    --text-muted: #64748b;

    

    --border: #334155;

    --border-light: #1e293b;

    

    --shadow: 0 4px 12px rgba(0,0,0,0.3);

    --shadow-lg: 0 8px 24px rgba(0,0,0,0.4);

    --shadow-up: 0 -4px 12px rgba(0,0,0,0.2);

}



/* Light Theme */

[data-theme="light"] {

    --bg-body: #f1f5f9;

    --bg-sidebar: #ffffff;

    --bg-card: #ffffff;

    --bg-elevated: #f8fafc;

    --bg-input: #f1f5f9;

    --bg-hover: rgba(0,0,0,0.04);

    

    --blue: #2563eb;

    --blue-dim: #1d4ed8;

    --blue-pale: rgba(37,99,235,0.1);

    --green: #16a34a;

    --green-pale: rgba(22,163,74,0.1);

    --orange: #d97706;

    --orange-pale: rgba(217,119,6,0.1);

    --red: #dc2626;

    --red-pale: rgba(220,38,38,0.1);

    

    --text-primary: #0f172a;

    --text-secondary: #475569;

    --text-muted: #94a3b8;

    

    --border: #e2e8f0;

    --border-light: #f1f5f9;

    

    --shadow: 0 4px 12px rgba(0,0,0,0.08);

    --shadow-lg: 0 8px 24px rgba(0,0,0,0.1);

    --shadow-up: 0 -4px 12px rgba(0,0,0,0.05);

}



/* ══════════════════════════════════════════════════════════════

   RESET & BASE

   ══════════════════════════════════════════════════════════════ */

*, *::before, *::after { 

    box-sizing: border-box; 

    margin: 0; 

    padding: 0; 

}



html { 

    font-size: 15px; 

    -webkit-text-size-adjust: 100%;

    /* Prevent pull-to-refresh on mobile */

    overscroll-behavior: none;

}



body {

    font-family: var(--font-sans);

    font-size: 14px;

    line-height: 1.5;

    color: var(--text-primary);

    background: var(--bg-body);

    -webkit-font-smoothing: antialiased;

    -moz-osx-font-smoothing: grayscale;

    height: 100vh;

    height: 100dvh;

    /* Safe area padding for notch */

    padding-top: var(--safe-top);

}



a { 

    text-decoration: none; 

    color: inherit; 

    -webkit-tap-highlight-color: transparent;

}



button { 

    font-family: inherit; 

    cursor: pointer; 

    border: none; 

    background: none;

    -webkit-tap-highlight-color: transparent;

    touch-action: manipulation;

}



input, select, textarea { 

    font-family: inherit; 

    font-size: 16px; /* Prevent zoom on iOS */

    -webkit-tap-highlight-color: transparent;

}



select { 

    appearance: none; 

    -webkit-appearance: none; 

}



ul, ol { list-style: none; }



table { 

    border-collapse: collapse; 

    width: 100%; 

}



img, svg { 

    display: block; 

    max-width: 100%; 

}



svg { 

    fill: none; 

    stroke: currentColor; 

    stroke-width: 2; 

    stroke-linecap: round; 

    stroke-linejoin: round; 

    pointer-events: none; 

}



.hidden { display: none !important; }



/* Text utilities */

.text-success { color: var(--green) !important; }

.text-warning { color: var(--orange) !important; }

.text-danger { color: var(--red) !important; }

.text-muted { color: var(--text-muted) !important; }



/* ══════════════════════════════════════════════════════════════

   APP SHELL

   ══════════════════════════════════════════════════════════════ */

.app-shell {

    display: flex;

    height: 100vh;

    height: 100dvh;

    height: calc(100dvh - var(--safe-top));

    overflow: hidden;

}



/* ══════════════════════════════════════════════════════════════

   SIDEBAR (Desktop)

   ══════════════════════════════════════════════════════════════ */

.sidebar {

    width: var(--sidebar-width);

    height: 100%;

    background: var(--bg-sidebar);

    border-right: 1px solid var(--border);

    display: flex;

    flex-direction: column;

    flex-shrink: 0;

    z-index: 100;

    transition: width .18s ease;

}



.sidebar-header {

    padding: var(--sp-4);

    border-bottom: 1px solid var(--border);

}



.sidebar-logo {

    display: flex;

    align-items: center;

    gap: var(--sp-3);

}



.logo-icon {

    width: 40px;

    height: 40px;

    border-radius: var(--r);

    display: flex;

    align-items: center;

    justify-content: center;

    flex-shrink: 0;

    cursor: pointer;

    user-select: none;

}



.logo-icon .logo-img {

    width: 40px;

    height: 40px;

    object-fit: contain;

    display: block;

}







.logo-text {

    font-size: 16px;

    font-weight: 700;

    color: var(--text-primary);

}



/* Utilisateur (dans l'en-tête sidebar) */

.sidebar-user-block{

    margin-top: var(--sp-3);

    display:flex;

    align-items:center;

    gap: var(--sp-3);

}



.sidebar-user-block .sidebar-user{

    width: 40px;

    height: 40px;

    border-radius: var(--r);

    background: var(--blue-pale);

    color: var(--blue);

    font-size: 14px;

    font-weight: 700;

    display:flex;

    align-items:center;

    justify-content:center;

    flex-shrink: 0;

    user-select:none;

}



/* Sidebar Navigation */

.sidebar-nav {

    flex: 1;

    overflow-y: auto;

    padding: var(--sp-3);

    -webkit-overflow-scrolling: touch;

}



.sidebar-link {

    display: flex;

    align-items: center;

    gap: var(--sp-3);

    padding: var(--sp-3);

    border-radius: var(--r);

    color: var(--text-secondary);

    transition: all var(--tr);

    margin-bottom: var(--sp-1);

    min-height: var(--touch-min);

    position: relative;

    border-radius: 12px;

    transition: background .14s ease, transform .14s ease;

}



.sidebar-link:hover {

    background: var(--bg-hover);

    color: var(--text-primary);

}



.sidebar-link.active {

    background: var(--blue-pale);

    color: var(--blue);

}



.sidebar-icon {

    width: 20px;

    height: 20px;

    flex-shrink: 0;

}



.sidebar-icon svg {

    width: 100%;

    height: 100%;

}



.sidebar-text {

    font-size: 14px;

    font-weight: 500;

}



.sidebar-badge {

    margin-left: auto;

    min-width: 20px;

    height: 20px;

    padding: 0 6px;

    background: var(--red);

    color: white;

    font-size: 11px;

    font-weight: 600;

    border-radius: var(--r-full);

    display: flex;

    align-items: center;

    justify-content: center;

}



/* Sidebar Footer */

.sidebar-footer {

    padding: var(--sp-4);

    border-top: 1px solid var(--border);

}





.sidebar-footer-logo {

    margin-top: var(--sp-3);

    width: 100%;

    height: auto;

    max-height: 52px;

    object-fit: contain;

    opacity: .95;

}

.user-card {

    display: flex;

    align-items: center;

    gap: var(--sp-3);

}



.user-avatar {

    width: 40px;

    height: 40px;

    border-radius: var(--r);

    background: var(--blue-pale);

    color: var(--blue);

    font-size: 14px;

    font-weight: 600;

    display: flex;

    align-items: center;

    justify-content: center;

    flex-shrink: 0;

}



.user-info {

    flex: 1;

    min-width: 0;

}



.user-name {

    font-size: 14px;

    font-weight: 600;

    color: var(--text-primary);

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;

}



.user-role {

    font-size: 12px;

    color: var(--text-muted);

}



.user-logout {

    width: 40px;

    height: 40px;

    border-radius: var(--r);

    display: flex;

    align-items: center;

    justify-content: center;

    color: var(--text-muted);

    transition: all var(--tr);

    min-width: var(--touch-min);

    min-height: var(--touch-min);

}



.user-logout:hover {

    background: var(--red-pale);

    color: var(--red);

}



.user-logout svg {

    width: 18px;

    height: 18px;

}



/* ══════════════════════════════════════════════════════════════

   MAIN AREA

   ══════════════════════════════════════════════════════════════ */

.main-area {

    flex: 1;

    display: flex;

    flex-direction: column;

    min-width: 0;

    height: 100%;

    overflow: hidden;

}



/* Top Header */

.top-header {

    display: flex;

    align-items: center;

    justify-content: space-between;

    height: var(--header-height);

    padding: 0 var(--sp-6);

    background: var(--bg-card);

    border-bottom: 1px solid var(--border);

    flex-shrink: 0;

}



.header-left {

    display: flex;

    align-items: center;

    gap: var(--sp-3);

}



.header-title {

    font-size: 18px;

    font-weight: 600;

    color: var(--text-primary);

}



.header-right {

    display: flex;

    align-items: center;

    gap: var(--sp-2);

}





.header-user{

    display:flex;

    align-items:center;

    gap: var(--sp-2);

    padding: 6px 10px;

    border-radius: 999px;

    border: 1px solid var(--border);

    background: var(--surface);

    max-width: 260px;

}



.header-user-meta{

    display:flex;

    flex-direction: column;

    line-height: 1.05;

    min-width: 0;

}



.header-user-name{

    font-weight: 700;

    color: var(--text-primary);

    font-size: 13px;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;

    max-width: 220px;

}



.header-user-role{

    font-size: 12px;

    color: var(--text-secondary);

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;

}



.header-user:focus-within,

.header-user:hover{

    border-color: color-mix(in srgb, var(--blue) 35%, var(--border));

    box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 12%, transparent);

}





.header-btn {

    width: var(--touch-min);

    height: var(--touch-min);

    border-radius: var(--r);

    display: flex;

    align-items: center;

    justify-content: center;

    color: var(--text-secondary);

    transition: all var(--tr);

    background: none;

    border: none;

    cursor: pointer;

    padding: 0;

    -webkit-tap-highlight-color: transparent;

}



.header-btn:hover {

    background: var(--bg-hover);

    color: var(--text-primary);

}



.header-btn svg {

    width: 20px;

    height: 20px;

}



.mobile-menu-btn {

    display: none;

}



.notification-badge {

    position: relative;

}



.notification-badge::after {

    content: '';

    position: absolute;

    top: 10px;

    right: 10px;

    width: 8px;

    height: 8px;

    background: var(--red);

    border-radius: var(--r-full);

    border: 2px solid var(--bg-card);

}



/* Theme Toggle */

.theme-toggle-track {

    width: 48px;

    height: 26px;

    background: var(--bg-elevated);

    border: 1px solid var(--border);

    border-radius: var(--r-full);

    position: relative;

    cursor: pointer;

    transition: all var(--tr);

}



.theme-toggle-thumb {

    position: absolute;

    top: 2px;

    left: 2px;

    width: 20px;

    height: 20px;

    background: var(--text-primary);

    border-radius: var(--r-full);

    transition: all var(--tr);

    display: flex;

    align-items: center;

    justify-content: center;

}



[data-theme="dark"] .theme-toggle-thumb {

    left: 24px;

}



.theme-toggle-thumb svg {

    width: 12px;

    height: 12px;

    stroke: var(--bg-card);

}



/* Main Content */

.main-content {

    flex: 1;

    overflow-y: auto;

    overflow-x: hidden;

    -webkit-overflow-scrolling: touch;

    padding: var(--sp-6);

    padding-right: calc(var(--sp-6) + var(--safe-right));

    padding-left: calc(var(--sp-6) + var(--safe-left));

}



/* Footer */

.main-footer {

    padding: var(--sp-3) var(--sp-6);

    background: var(--bg-card);

    border-top: 1px solid var(--border);

    font-size: 12px;

    color: var(--text-muted);

    text-align: center;

}



/* ══════════════════════════════════════════════════════════════

   BOTTOM NAV (Mobile) - Optimisé avec safe area

   ══════════════════════════════════════════════════════════════ */

.bottom-nav {

    display: none;

    position: fixed;

    bottom: 0;

    left: 0;

    right: 0;

    height: calc(var(--bottom-nav-height) + var(--safe-bottom));

    padding-bottom: var(--safe-bottom);

    background: var(--bg-card);

    border-top: 1px solid var(--border);

    box-shadow: var(--shadow-up);

    z-index: 100;

    /* Flex direct pour les bnav-items */

    flex-direction: row;

}



.bnav-item {

    flex: 1;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    gap: 4px;

    color: var(--text-muted);

    transition: color var(--tr);

    background: none;

    border: none;

    cursor: pointer;

    padding: var(--sp-2);

    min-height: var(--touch-min);

    -webkit-tap-highlight-color: transparent;

    position: relative;

}



.bnav-item::before {

    content: '';

    position: absolute;

    inset: 4px;

    border-radius: var(--r);

    background: transparent;

    transition: background var(--tr);

}



.bnav-item:active::before {

    background: var(--bg-hover);

}



.bnav-item.active {

    color: var(--blue);

}



.bnav-item.active::after {

    content: '';

    position: absolute;

    top: 0;

    left: 50%;

    transform: translateX(-50%);

    width: 24px;

    height: 3px;

    background: var(--blue);

    border-radius: 0 0 var(--r-full) var(--r-full);

}



.bnav-icon {

    width: 24px;

    height: 24px;

    display: flex;

    align-items: center;

    justify-content: center;

    position: relative;

    z-index: 1;

}



.bnav-icon svg {

    width: 22px;

    height: 22px;

}



.bnav-label {

    font-size: 11px;

    font-weight: 500;

    position: relative;

    z-index: 1;

}



.bnav-badge {

    position: absolute;

    top: 4px;

    right: 50%;

    transform: translateX(12px);

    min-width: 18px;

    height: 18px;

    padding: 0 5px;

    background: var(--red);

    color: white;

    font-size: 10px;

    font-weight: 700;

    border-radius: var(--r-full);

    display: flex;

    align-items: center;

    justify-content: center;

    z-index: 2;

}



/* ══════════════════════════════════════════════════════════════

   SLIDE MENU (Mobile) - Optimisé avec safe area

   ══════════════════════════════════════════════════════════════ */

.slide-menu-backdrop {

    display: none;

    position: fixed;

    inset: 0;

    background: rgba(0,0,0,0.5);

    z-index: 200;

    opacity: 0;

    pointer-events: none;

    transition: opacity var(--tr-md);

    -webkit-backdrop-filter: blur(4px);

    backdrop-filter: blur(4px);

}



.slide-menu-backdrop.active {

    opacity: 1;

    pointer-events: auto;

}



.slide-menu {

    position: fixed;

    top: 0;

    left: 0;

    width: 300px;

    max-width: 85vw;

    height: 100%;

    background: var(--bg-sidebar);

    z-index: 201;

    transform: translateX(-100%);

    transition: transform var(--tr-md);

    display: flex;

    flex-direction: column;

    padding-top: var(--safe-top);

    padding-left: var(--safe-left);

    box-shadow: 6px 0 24px rgba(0,0,0,.15);

}



.slide-menu.open {

    transform: translateX(0);

}



.slide-menu-head {

    display: flex;

    align-items: center;

    gap: 12px;

    padding: var(--sp-4);

    border-bottom: 1px solid var(--border);

    min-height: var(--header-height);

}

.slide-menu-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}
.slide-menu-logo {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    object-fit: contain;
    flex-shrink: 0;
}
.slide-menu-logo-ph {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--blue, #3b82f6), var(--green, #22c55e));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    flex-shrink: 0;
}
.slide-menu-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}



.slide-menu-close {

    margin-left: auto;

    width: var(--touch-min);

    height: var(--touch-min);

    border-radius: var(--r);

    display: flex;

    align-items: center;

    justify-content: center;

    color: var(--text-muted);

    background: none;

    border: none;

    cursor: pointer;

    -webkit-tap-highlight-color: transparent;

    flex-shrink: 0;

}



.slide-menu-close:active {

    background: var(--bg-hover);

}



.slide-menu-close svg {

    width: 20px;

    height: 20px;

}



.slide-menu-body {

    flex: 1;

    overflow-y: auto;

    -webkit-overflow-scrolling: touch;

    padding: var(--sp-3);

    padding-bottom: calc(var(--sp-3) + var(--safe-bottom));

}



.slide-item {

    display: flex;

    align-items: center;

    gap: var(--sp-3);

    padding: var(--sp-3) var(--sp-4);

    border-radius: var(--r);

    color: var(--text-secondary);

    transition: all var(--tr);

    margin-bottom: var(--sp-1);

    cursor: pointer;

    text-decoration: none;

    -webkit-tap-highlight-color: transparent;

    min-height: var(--touch-min);

}



.slide-item:active {

    background: var(--bg-hover);

}



.slide-item.active {

    background: var(--blue-pale);

    color: var(--blue);

}



.slide-item-icon {

    width: 24px;

    height: 24px;

    display: flex;

    align-items: center;

    justify-content: center;

    flex-shrink: 0;

}



.slide-item-icon svg {

    width: 20px;

    height: 20px;

}



.slide-item-text {

    font-size: 15px;

    font-weight: 500;

}



.slide-badge {

    margin-left: auto;

    padding: 2px 8px;

    background: var(--red);

    color: white;

    font-size: 11px;

    font-weight: 600;

    border-radius: var(--r-full);

}



.slide-logout {

    color: var(--red);

    margin-top: var(--sp-4);

    border-top: 1px solid var(--border);

    padding-top: var(--sp-4);

}



/* ══════════════════════════════════════════════════════════════

   BUTTONS - Touch optimisés

   ══════════════════════════════════════════════════════════════ */

.btn {

    display: inline-flex;

    align-items: center;

    justify-content: center;

    gap: var(--sp-2);

    padding: 12px 18px;

    font-size: 14px;

    font-weight: 500;

    border-radius: var(--r);

    border: 1px solid transparent;

    cursor: pointer;

    transition: all var(--tr);

    white-space: nowrap;

    min-height: var(--touch-min);

    -webkit-tap-highlight-color: transparent;

    touch-action: manipulation;

}



.btn:disabled {

    opacity: 0.5;

    cursor: not-allowed;

}



.btn:active:not(:disabled) {

    transform: scale(0.98);

}



.btn svg {

    width: 18px;

    height: 18px;

    flex-shrink: 0;

}



.btn-primary {

    background: var(--blue);

    color: white;

}



.btn-primary:hover:not(:disabled) {

    background: var(--blue-dim);

}



.btn-success {

    background: var(--green);

    color: white;

}



.btn-success:hover:not(:disabled) {

    filter: brightness(0.9);

}



.btn-danger {

    background: var(--red);

    color: white;

}



.btn-danger:hover:not(:disabled) {

    filter: brightness(0.9);

}



.btn-warning {

    background: var(--orange);

    color: white;

}



.btn-warning:hover:not(:disabled) {

    filter: brightness(0.9);

}



.btn-secondary {

    background: transparent;

    color: var(--text-secondary);

    border-color: var(--border);

}



.btn-secondary:hover:not(:disabled) {

    background: var(--bg-hover);

    color: var(--text-primary);

    border-color: var(--text-muted);

}



.btn-ghost {

    background: transparent;

    color: var(--text-secondary);

}



.btn-ghost:hover:not(:disabled) {

    background: var(--bg-hover);

    color: var(--text-primary);

}



.btn-sm {

    padding: 8px 12px;

    font-size: 13px;

    min-height: 36px;

}



.btn-lg {

    padding: 14px 24px;

    font-size: 15px;

    min-height: 52px;

}



.btn-icon {

    width: var(--touch-min);

    height: var(--touch-min);

    padding: 0;

}



.btn-block {

    width: 100%;

}



/* ══════════════════════════════════════════════════════════════

   FORMS - Touch optimisés

   ══════════════════════════════════════════════════════════════ */

.form-group {

    margin-bottom: var(--sp-4);

}



.form-label, .lbl {

    display: block;

    margin-bottom: var(--sp-2);

    font-size: 13px;

    font-weight: 500;

    color: var(--text-secondary);

}



.form-input, .form-select, .form-textarea,

.inp, .sel,

input[type="text"], input[type="email"], input[type="password"],

input[type="number"], input[type="date"], input[type="search"],

select, textarea {

    width: 100%;

    padding: 12px 14px;

    background: var(--bg-input);

    border: 1px solid var(--border);

    border-radius: var(--r);

    color: var(--text-primary);

    font-size: 16px; /* Prevent iOS zoom */

    transition: all var(--tr);

    min-height: var(--touch-min);

}



.form-input:focus, .form-select:focus, .inp:focus, .sel:focus,

input:focus, select:focus, textarea:focus {

    outline: none;

    border-color: var(--blue);

    box-shadow: 0 0 0 3px var(--blue-pale);

}



input::placeholder, .inp::placeholder, textarea::placeholder {

    color: var(--text-muted);

}



select, .form-select, .sel {

    padding-right: 40px;

    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");

    background-repeat: no-repeat;

    background-position: right 12px center;

    cursor: pointer;

}



textarea {

    min-height: 100px;

    resize: vertical;

}



.form-hint {

    margin-top: var(--sp-1);

    font-size: 12px;

    color: var(--text-muted);

}



.form-grid {

    display: grid;

    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));

    gap: var(--sp-4);

}



input[type=checkbox] {

    accent-color: var(--blue);

    width: 20px;

    height: 20px;

    cursor: pointer;

}



.chk {

    display: flex;

    align-items: center;

    gap: var(--sp-2);

    cursor: pointer;

    min-height: var(--touch-min);

}



/* ══════════════════════════════════════════════════════════════

   CARDS - Bord à bord mobile

   ══════════════════════════════════════════════════════════════ */

.card {

    background: var(--bg-card);

    border: 1px solid var(--border);

    border-radius: var(--r-lg);

    overflow: hidden;

}



.card-header, .card-hd {

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: var(--sp-3);

    padding: var(--sp-4) var(--sp-5);

    border-bottom: 1px solid var(--border);

}



.card-title {

    font-size: 15px;

    font-weight: 600;

    color: var(--text-primary);

    display: flex;

    align-items: center;

    gap: var(--sp-2);

}



.card-title svg {

    width: 18px;

    height: 18px;

}



.card-body {

    padding: var(--sp-5);

}



.card-footer {

    display: flex;

    align-items: center;

    justify-content: flex-end;

    gap: var(--sp-2);

    padding: var(--sp-3) var(--sp-5);

    border-top: 1px solid var(--border);

    background: var(--bg-elevated);

}



/* ══════════════════════════════════════════════════════════════

   TABLES - Responsive avec scroll horizontal

   ══════════════════════════════════════════════════════════════ */

.table-container, .tbl-wrap {

    overflow-x: auto;

    -webkit-overflow-scrolling: touch;

    margin: 0 calc(-1 * var(--sp-4));

    padding: 0 var(--sp-4);

}



.data-table, table {

    width: 100%;

    border-collapse: collapse;

    font-size: 13px;

    min-width: 600px;

}



.data-table th, table th, thead th {

    padding: 12px 16px;

    text-align: left;

    font-size: 11px;

    font-weight: 600;

    color: var(--text-muted);

    text-transform: uppercase;

    letter-spacing: 0.5px;

    background: var(--bg-elevated);

    border-bottom: 1px solid var(--border);

    white-space: nowrap;

    position: sticky;

    top: 0;

    z-index: 1;

}



.data-table td, table td, tbody td {

    padding: 12px 16px;

    color: var(--text-secondary);

    border-bottom: 1px solid var(--border-light);

    vertical-align: middle;

}



.data-table tbody tr, table tbody tr {

    transition: background var(--tr);

}



.data-table tbody tr:hover, table tbody tr:hover {

    background: var(--bg-hover);

}



.data-table tbody tr:last-child td, table tbody tr:last-child td {

    border-bottom: none;

}



.data-table tbody tr:active {

    background: var(--blue-pale);

}



.cell-primary { 

    color: var(--text-primary); 

    font-weight: 500; 

}



.cell-mono, .col-mono { 

    font-family: var(--font-mono); 

    font-size: 12px; 

    color: var(--blue); 

}



.cell-number, .col-number { 

    text-align: right; 

    font-variant-numeric: tabular-nums; 

}



.cell-center { 

    text-align: center; 

}



.cell-actions, .col-actions { 

    text-align: right; 

    white-space: nowrap; 

}



.cell-actions .btn, .col-actions .btn {

    min-height: 36px;

    min-width: 36px;

}



.tbl-empty {

    text-align: center;

    padding: var(--sp-8) var(--sp-4) !important;

    color: var(--text-muted);

}



/* ══════════════════════════════════════════════════════════════

   BADGES

   ══════════════════════════════════════════════════════════════ */

.badge {

    display: inline-flex;

    align-items: center;

    gap: 4px;

    padding: 4px 10px;

    font-size: 11px;

    font-weight: 600;

    border-radius: var(--r-full);

    white-space: nowrap;

}



.badge-blue {

    background: var(--blue-pale);

    color: var(--blue);

}



.badge-green {

    background: var(--green-pale);

    color: var(--green);

}



.badge-orange, .badge-warning {

    background: var(--orange-pale);

    color: var(--orange);

}



.badge-red, .badge-danger {

    background: var(--red-pale);

    color: var(--red);

}



.badge-gray {

    background: var(--bg-elevated);

    color: var(--text-muted);

}



.badge-success {

    background: var(--green-pale);

    color: var(--green);

}



/* ══════════════════════════════════════════════════════════════

   KPI CARDS / DASHBOARD

   ══════════════════════════════════════════════════════════════ */

.kpi-grid, .kpi-row, .dashboard-kpis {

    display: grid;

    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));

    gap: var(--sp-4);

    margin-bottom: var(--sp-6);

}



.kpi-card {

    background: var(--bg-card);

    border: 1px solid var(--border);

    border-radius: var(--r-lg);

    padding: var(--sp-5);

    position: relative;

    transition: all var(--tr-md);

}



.kpi-card::before {

    content: '';

    position: absolute;

    top: 0;

    left: 0;

    right: 0;

    height: 3px;

    border-radius: var(--r-lg) var(--r-lg) 0 0;

}



.kpi-card:hover {

    transform: translateY(-2px);

    box-shadow: var(--shadow);

}



.kpi-card.blue::before { background: var(--blue); }

.kpi-card.green::before { background: var(--green); }

.kpi-card.orange::before { background: var(--orange); }

.kpi-card.red::before { background: var(--red); }



.kpi-top, .kpi-header {

    display: flex;

    align-items: flex-start;

    justify-content: space-between;

    margin-bottom: var(--sp-3);

}



.kpi-ico, .kpi-icon {

    width: 44px;

    height: 44px;

    border-radius: var(--r);

    display: flex;

    align-items: center;

    justify-content: center;

    flex-shrink: 0;

}



.kpi-ico svg, .kpi-icon svg {

    width: 22px;

    height: 22px;

}



.kpi-card.blue .kpi-ico, .kpi-card.blue .kpi-icon { background: var(--blue-pale); color: var(--blue); }

.kpi-card.green .kpi-ico, .kpi-card.green .kpi-icon { background: var(--green-pale); color: var(--green); }

.kpi-card.orange .kpi-ico, .kpi-card.orange .kpi-icon { background: var(--orange-pale); color: var(--orange); }

.kpi-card.red .kpi-ico, .kpi-card.red .kpi-icon { background: var(--red-pale); color: var(--red); }



.kpi-val, .kpi-value {

    font-size: 28px;

    font-weight: 700;

    color: var(--text-primary);

    line-height: 1.2;

}



.kpi-lbl, .kpi-label {

    font-size: 13px;

    color: var(--text-muted);

    margin-top: var(--sp-1);

}



.kpi-trend {

    display: inline-flex;

    align-items: center;

    gap: 4px;

    font-size: 12px;

    font-weight: 600;

}



.kpi-trend.up { color: var(--green); }

.kpi-trend.down { color: var(--red); }



.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: var(--sp-4);
    margin-bottom: var(--sp-6);
}

/* ── Dashboard v2.6.0 ── */

/* Ligne graphiques (2 colonnes) */
.dash-charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Ligne bas : activité + alertes (60/40) */
.dash-bottom-row {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 16px;
    align-items: start;
}

/* ── Alertes OK ── */
.dash-alerts-ok {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 28px 16px;
    color: var(--green);
    font-size: 14px;
    font-weight: 700;
}
.dash-alerts-ok svg { opacity: .8; }

/* ── Carte alerte produit ── */
.dash-alert-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--r-xl);
    border: 1px solid var(--border);
    background: var(--bg-card);
    margin-bottom: 8px;
    transition: border-color var(--tr), box-shadow var(--tr);
    cursor: pointer;
}
.dash-alert-card:last-child { margin-bottom: 0; }
.dash-alert-card:hover {
    border-color: var(--red);
    box-shadow: 0 2px 8px rgba(239,68,68,0.10);
}

/* Vignette produit */
.dash-alert-thumb {
    width: 52px;
    height: 52px;
    border-radius: var(--r-lg);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
}
.dash-alert-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.dash-alert-img-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--text-muted);
}
.dash-alert-img-fallback svg { width: 24px; height: 24px; opacity: .4; }

/* Contenu texte */
.dash-alert-body { flex: 1; min-width: 0; }
.dash-alert-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
    flex-wrap: wrap;
}
.dash-alert-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}
.dash-alert-badge {
    font-size: 10px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 20px;
    flex-shrink: 0;
    letter-spacing: .03em;
}
.dash-alert-badge-min {
    background: rgba(239,68,68,0.12);
    color: var(--red);
    border: 1px solid rgba(239,68,68,0.25);
}
.dash-alert-badge-max {
    background: rgba(245,158,11,0.12);
    color: var(--orange);
    border: 1px solid rgba(245,158,11,0.25);
}
.dash-alert-sku {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono, monospace);
    margin-bottom: 2px;
}
.dash-alert-wh {
    font-size: 11px;
    color: var(--blue);
    font-weight: 600;
    margin-bottom: 3px;
}
.dash-alert-detail {
    font-size: 12px;
    color: var(--text-secondary);
}
.dash-alert-detail strong {
    color: var(--text-primary);
    font-weight: 700;
}



/* ══════════════════════════════════════════════════════════════

   FILTERS BAR

   ══════════════════════════════════════════════════════════════ */

.filters-bar {

    display: flex;

    flex-wrap: wrap;

    align-items: center;

    gap: var(--sp-3);

    padding: var(--sp-4);

    background: var(--bg-card);

    border: 1px solid var(--border);

    border-radius: var(--r-lg);

    margin-bottom: var(--sp-4);

}



.filters-section {

    display: flex;

    align-items: center;

    gap: var(--sp-3);

    flex-wrap: wrap;

}



.filters-divider {

    width: 1px;

    height: 24px;

    background: var(--border);

}



.search-box {

    position: relative;

    min-width: 250px;

}



.search-box-icon {

    position: absolute;

    left: 14px;

    top: 50%;

    transform: translateY(-50%);

    width: 18px;

    height: 18px;

    color: var(--text-muted);

    pointer-events: none;

}



.search-box input {

    padding-left: 44px;

}



.results-count {

    display: inline-flex;

    align-items: center;

    padding: 6px 14px;

    background: var(--blue-pale);

    color: var(--blue);

    font-size: 13px;

    font-weight: 600;

    border-radius: var(--r-full);

}



/* ══════════════════════════════════════════════════════════════

   PAGINATION

   ══════════════════════════════════════════════════════════════ */

.pagination-bar, .pager {

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: var(--sp-4);

    padding: var(--sp-3) var(--sp-4);

    background: var(--bg-elevated);

    border-top: 1px solid var(--border);

}



.pagination-info {

    font-size: 13px;

    color: var(--text-muted);

}



.pagination-controls {

    display: flex;

    align-items: center;

    gap: var(--sp-2);

}



.pagination-btn, .btn-pager {

    width: var(--touch-min);

    height: var(--touch-min);

    border-radius: var(--r);

    background: var(--bg-card);

    border: 1px solid var(--border);

    display: flex;

    align-items: center;

    justify-content: center;

    color: var(--text-secondary);

    cursor: pointer;

    transition: all var(--tr);

    -webkit-tap-highlight-color: transparent;

}



.pagination-btn:hover:not(:disabled), .btn-pager:hover:not(:disabled) {

    border-color: var(--blue);

    color: var(--blue);

}



.pagination-btn:disabled, .btn-pager:disabled {

    opacity: 0.5;

    cursor: not-allowed;

}



.pagination-btn svg, .btn-pager svg {

    width: 16px;

    height: 16px;

}



/* ══════════════════════════════════════════════════════════════

   MODAL - Optimisé mobile full-screen

   ══════════════════════════════════════════════════════════════ */

.modal-overlay {

    position: fixed;

    inset: 0;

    background: rgba(0,0,0,0.6);

    -webkit-backdrop-filter: blur(4px);

    backdrop-filter: blur(4px);

    z-index: 300;

    display: flex;

    align-items: center;

    justify-content: center;

    padding: var(--sp-4);

    opacity: 0;

    visibility: hidden;

    transition: all var(--tr-md);

}



.modal-overlay.visible {

    opacity: 1;

    visibility: visible;

}



.modal {

    width: 100%;

    max-width: 520px;

    max-height: calc(100vh - var(--sp-8));

    max-height: calc(100dvh - var(--sp-8) - var(--safe-top) - var(--safe-bottom));

    background: var(--bg-card);

    border: 1px solid var(--border);

    border-radius: var(--r-xl);

    box-shadow: var(--shadow-lg);

    display: flex;

    flex-direction: column;

    transform: translateY(20px) scale(0.95);

    transition: all var(--tr-md);

}



.modal-overlay.visible .modal {

    transform: translateY(0) scale(1);

}



.modal-hdr {

    display: flex;

    align-items: flex-start;

    gap: var(--sp-3);

    padding: var(--sp-5);

    border-bottom: 1px solid var(--border);

    flex-shrink: 0;

}



.modal-hdr-icon {

    width: 40px;

    height: 40px;

    border-radius: var(--r);

    display: flex;

    align-items: center;

    justify-content: center;

    flex-shrink: 0;

    background: var(--blue-pale);

}



.modal-hdr-icon svg {

    width: 20px;

    height: 20px;

}



.modal-hdr-icon.info { background: var(--blue-pale); color: var(--blue); }

.modal-hdr-icon.success { background: var(--green-pale); color: var(--green); }

.modal-hdr-icon.warning { background: var(--orange-pale); color: var(--orange); }

.modal-hdr-icon.error { background: var(--red-pale); color: var(--red); }



.modal-hdr-text {

    flex: 1;

    min-width: 0;

}



.modal-hdr-text h3 {

    font-size: 18px;

    font-weight: 600;

    color: var(--text-primary);

}



.modal-hdr-text p {

    font-size: 13px;

    color: var(--text-muted);

    margin-top: var(--sp-1);

}



.modal-close {

    width: var(--touch-min);

    height: var(--touch-min);

    border-radius: var(--r);

    display: flex;

    align-items: center;

    justify-content: center;

    color: var(--text-muted);

    transition: all var(--tr);

    cursor: pointer;

    background: none;

    border: none;

    flex-shrink: 0;

    -webkit-tap-highlight-color: transparent;

}



.modal-close:hover, .modal-close:active {

    background: var(--bg-hover);

    color: var(--text-primary);

}



.modal-close svg {

    width: 20px;

    height: 20px;

}



.modal-body {

    flex: 1;

    padding: var(--sp-5);

    overflow-y: auto;

    -webkit-overflow-scrolling: touch;

}



.modal-footer {

    display: flex;

    align-items: center;

    justify-content: flex-end;

    gap: var(--sp-2);

    padding: var(--sp-4) var(--sp-5);

    padding-bottom: calc(var(--sp-4) + var(--safe-bottom));

    border-top: 1px solid var(--border);

    background: var(--bg-elevated);

    flex-shrink: 0;

    flex-wrap: wrap;

}



/* ══════════════════════════════════════════════════════════════

   TOAST - Optimisé mobile

   ══════════════════════════════════════════════════════════════ */

.toast-wrap {

    position: fixed;

    top: calc(var(--sp-4) + var(--safe-top));

    left: var(--sp-4);

    right: var(--sp-4);

    z-index: 400;

    display: flex;

    flex-direction: column;

    align-items: center;

    gap: var(--sp-2);

    pointer-events: none;

}



.toast {

    display: flex;

    align-items: flex-start;

    gap: var(--sp-3);

    padding: var(--sp-4);

    background: var(--bg-card);

    border: 1px solid var(--border);

    border-radius: var(--r-lg);

    box-shadow: var(--shadow-lg);

    animation: toastIn 0.3s ease;

    max-width: 400px;

    width: 100%;

    pointer-events: auto;

}



@keyframes toastIn {

    from { opacity: 0; transform: translateY(-20px); }

    to { opacity: 1; transform: translateY(0); }

}



.toast.exit {

    animation: toastOut 0.2s ease forwards;

}



@keyframes toastOut {

    to { opacity: 0; transform: translateY(-20px); }

}



.toast-icon {

    width: 32px;

    height: 32px;

    border-radius: var(--r);

    display: flex;

    align-items: center;

    justify-content: center;

    flex-shrink: 0;

}



.toast-icon svg {

    width: 18px;

    height: 18px;

}



.toast-icon.success { background: var(--green-pale); color: var(--green); }

.toast-icon.error { background: var(--red-pale); color: var(--red); }

.toast-icon.warning { background: var(--orange-pale); color: var(--orange); }

.toast-icon.info { background: var(--blue-pale); color: var(--blue); }



.toast-content {

    flex: 1;

    min-width: 0;

}



.toast-title {

    font-size: 14px;

    font-weight: 600;

    color: var(--text-primary);

}



.toast-message {

    font-size: 13px;

    color: var(--text-secondary);

    margin-top: 2px;

}



.toast-close {

    width: 28px;

    height: 28px;

    border-radius: var(--r-sm);

    display: flex;

    align-items: center;

    justify-content: center;

    color: var(--text-muted);

    cursor: pointer;

    transition: all var(--tr);

    flex-shrink: 0;

    background: none;

    border: none;

}



.toast-close:hover {

    background: var(--bg-hover);

    color: var(--text-primary);

}



.toast-close svg {

    width: 14px;

    height: 14px;

}



/* ══════════════════════════════════════════════════════════════

   PRODUCTS GRID

   ══════════════════════════════════════════════════════════════ */

.products-grid, .prod-grid {

    display: grid;

    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));

    gap: var(--sp-4);

}



.product-card, .prod-card {

    background: var(--bg-card);

    border: 1px solid var(--border);

    border-radius: var(--r-lg);

    padding: var(--sp-4);

    cursor: pointer;

    transition: all var(--tr-md);

    position: relative;

}



.product-card:hover, .prod-card:hover {

    border-color: var(--blue);

    transform: translateY(-2px);

    box-shadow: var(--shadow);

}



.product-card:active, .prod-card:active {

    transform: translateY(0);

    box-shadow: none;

}



.prod-card-head {

    display: flex;

    gap: var(--sp-3);

    margin-bottom: var(--sp-3);

}



.prod-thumb {

    width: 56px;

    height: 56px;

    border-radius: var(--r);

    background: var(--bg-elevated);

    border: 1px solid var(--border-light);

    display: flex;

    align-items: center;

    justify-content: center;

    flex-shrink: 0;

    overflow: hidden;

}



.prod-thumb img {

    width: 100%;

    height: 100%;

    object-fit: cover;

}



.prod-thumb svg {

    width: 24px;

    height: 24px;

    color: var(--text-muted);

}



.prod-card-info {

    flex: 1;

    min-width: 0;

}



.prod-card-info h4 {

    font-size: 14px;

    font-weight: 600;

    color: var(--text-primary);

    margin-bottom: 4px;

    display: -webkit-box;

    -webkit-line-clamp: 2;

    -webkit-box-orient: vertical;

    overflow: hidden;

}



.prod-card-info .sku {

    font-family: var(--font-mono);

    font-size: 12px;

    color: var(--text-muted);

}



.prod-stock {

    margin-top: var(--sp-3);

}



.stock-bar {

    height: 6px;

    background: var(--bg-elevated);

    border-radius: var(--r-full);

    overflow: hidden;

    margin-bottom: var(--sp-2);

}



.stock-bar-fill {

    height: 100%;

    border-radius: var(--r-full);

    transition: width var(--tr-md);

}



.stock-bar-fill.ok { background: var(--green); }

.stock-bar-fill.low { background: var(--orange); }

.stock-bar-fill.crit { background: var(--red); }



.prod-stock span {

    font-size: 13px;

    color: var(--text-secondary);

}



.prod-qa-btn {

    position: absolute;

    top: var(--sp-3);

    right: var(--sp-3);

    width: 36px;

    height: 36px;

    border-radius: var(--r);

    background: var(--bg-elevated);

    border: 1px solid var(--border);

    display: flex;

    align-items: center;

    justify-content: center;

    color: var(--text-muted);

    opacity: 0;

    transition: all var(--tr);

    cursor: pointer;

}



.prod-card:hover .prod-qa-btn,

.prod-qa-btn.show {

    opacity: 1;

}



.prod-qa-btn:hover {

    background: var(--blue-pale);

    border-color: var(--blue);

    color: var(--blue);

}



.prod-docs {

    display: flex;

    gap: var(--sp-2);

    margin-top: var(--sp-3);

    padding-top: var(--sp-3);

    border-top: 1px solid var(--border-light);

}



.prod-doc-btn {

    font-size: 11px;

    padding: 4px 8px;

    border-radius: var(--r-sm);

    background: var(--bg-elevated);

    color: var(--text-secondary);

    transition: all var(--tr);

    min-height: 28px;

    display: inline-flex;

    align-items: center;

}



.prod-doc-btn:hover {

    background: var(--blue-pale);

    color: var(--blue);

}



/* View toggle */

.view-toggle {

    display: inline-flex;

    background: var(--bg-input);

    border: 1px solid var(--border);

    border-radius: var(--r);

    padding: 2px;

}



.view-toggle-btn {

    width: 36px;

    height: 32px;

    border-radius: var(--r-sm);

    color: var(--text-muted);

    display: flex;

    align-items: center;

    justify-content: center;

    transition: all var(--tr);

    background: none;

    border: none;

    cursor: pointer;

    padding: 0;

}



.view-toggle-btn:hover {

    color: var(--text-primary);

}



.view-toggle-btn.active {

    background: var(--bg-card);

    color: var(--blue);

    box-shadow: var(--shadow);

}



.view-toggle-btn svg {

    width: 16px;

    height: 16px;

}



/* ══════════════════════════════════════════════════════════════

   WAREHOUSES GRID

   ══════════════════════════════════════════════════════════════ */

.warehouses-grid, .wh-grid {

    display: grid;

    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));

    gap: var(--sp-4);

}



.wh-card {

    background: var(--bg-card);

    border: 1px solid var(--border);

    border-radius: var(--r-lg);

    padding: var(--sp-5);

    cursor: pointer;

    transition: all var(--tr-md);

}



.wh-card:hover {

    border-color: var(--blue);

    transform: translateY(-2px);

    box-shadow: var(--shadow);

}



.wh-card:active {

    transform: translateY(0);

}



.wh-card-head {

    display: flex;

    align-items: flex-start;

    gap: var(--sp-3);

    margin-bottom: var(--sp-4);

}



.wh-card-icon {

    width: 48px;

    height: 48px;

    border-radius: var(--r);

    background: var(--blue-pale);

    display: flex;

    align-items: center;

    justify-content: center;

    flex-shrink: 0;

}



.wh-card-icon svg {

    width: 24px;

    height: 24px;

    color: var(--blue);

}



.wh-card-info {

    flex: 1;

    min-width: 0;

}



.wh-card-info h3 {

    font-size: 16px;

    font-weight: 600;

    color: var(--text-primary);

    margin-bottom: 4px;

}



.wh-card-info p {

    font-size: 13px;

    color: var(--text-muted);

}



.wh-card-stats {

    display: grid;

    grid-template-columns: repeat(3, 1fr);

    gap: var(--sp-3);

    padding-top: var(--sp-4);

    border-top: 1px solid var(--border-light);

}



.wh-stat {

    text-align: center;

}



.wh-stat-value {

    font-size: 18px;

    font-weight: 700;

    color: var(--text-primary);

}



.wh-stat-label {

    font-size: 11px;

    color: var(--text-muted);

    margin-top: 2px;

}



/* ══════════════════════════════════════════════════════════════

   SCANNER

   ══════════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════════════════
   SCANNER — Layout / Preview / Frame / QR / Terrain
   ══════════════════════════════════════════════════════════════ */

/* ── Conteneur page ─────────────────────────────────────────── */
.scanner-wrapper,
.scanner-container {
    max-width: 560px;
    margin: 0 auto;
    width: 100%;
}

/* ── Zone preview ────────────────────────────────────────────── */
/*
   Contexte d'empilement isolé : toutes les couches (vidéo, frame,
   placeholder) sont positionnées absolute à l'intérieur.
   overflow:hidden masque ce que html5-qrcode injecte en dehors.
*/
.scanner-preview {
    position: relative;
    aspect-ratio: 4 / 3;
    background: #111;
    border-radius: var(--r-lg);
    overflow: hidden;
    isolation: isolate;   /* stacking context propre */
}

/* ── Host html5-qrcode (injecté par JS dans la preview) ────── */
/* Doit remplir tout l'espace disponible */
#scannerH5 {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Toute vidéo dans la preview en couverture totale */
.scanner-preview video,
#scannerH5 video {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    border-radius: 0;
}

/* Canvas html5-qrcode (overlay traitement) */
#scannerH5 canvas {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
}

/* ── Suppression UI par défaut de html5-qrcode ─────────────── */
#html5-qrcode-anchor-scan-type-change,
[id*="qr-shaded-region"],
#scannerH5 [id*="qr-shaded-region"],
#scanQrHost [id*="qr-shaded-region"] {
    display: none !important;
}
#scannerH5 [id*="qr-code-camera"] > div,
#scanQrHost [id*="qr-code-camera"] > div,
#scannerH5 [id*="qr-code"] > div,
#scanQrHost [id*="qr-code"] > div {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

/* ── Placeholder (caméra inactive) ──────────────────────────── */
.scanner-placeholder {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text-muted);
    background: var(--bg-elevated);
    border-radius: var(--r-lg);
    pointer-events: none;
}
.scanner-placeholder svg {
    width: 48px;
    height: 48px;
    opacity: 0.4;
}
.scanner-placeholder p {
    font-size: 14px;
    margin: 0;
}

/* ── Frame de scan ───────────────────────────────────────────── */
/*
   Simple div transparent avec box-shadow (masque extérieur) et
   4 coins via ::before / ::after + 2 spans injectés par JS.
   Position pilotée par JS via style.inset (en px, calé sur le
   vrai qrbox rendu par html5-qrcode) — pas de custom props.
*/
.scanner-frame {
    position: absolute;
    z-index: 4;
    pointer-events: none;
    /* Valeur par défaut (état inactif — frame cachée) */
    inset: 20%;
    border-radius: 6px;
    /* Assombrissement extérieur */
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.52);
    /* Pas de border sur la frame elle-même : seulement les coins */
}

/* État caché quand caméra inactive */
.scanner-preview:not([data-scan-mode]) .scanner-frame,
.scanner-preview[data-scan-mode=""] .scanner-frame {
    display: none;
}

/* ── Coins de la frame ─────────────────────────────────────── */
/* 4 coins via 4 pseudo-éléments : ::before/::after sur .scanner-frame
   + ::before/::after sur le span .scanner-frame-bot injecté par JS */
.scanner-frame::before,
.scanner-frame::after,
.scanner-frame-bot::before,
.scanner-frame-bot::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 3px solid #3b82f6;
    border-color: var(--blue, #3b82f6);
}
/* Haut-gauche */
.scanner-frame::before {
    top: -2px; left: -2px;
    border-right: none; border-bottom: none;
    border-radius: 4px 0 0 0;
}
/* Haut-droite */
.scanner-frame::after {
    top: -2px; right: -2px;
    border-left: none; border-bottom: none;
    border-radius: 0 4px 0 0;
}

/* Span injecté par JS pour les 2 coins bas */
.scanner-frame-bot {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
/* Bas-gauche */
.scanner-frame-bot::before {
    bottom: -2px; left: -2px;
    border-right: none; border-top: none;
    border-radius: 0 0 0 4px;
}
/* Bas-droite */
.scanner-frame-bot::after {
    bottom: -2px; right: -2px;
    border-left: none; border-top: none;
    border-radius: 0 0 4px 0;
}

/* Compat : ancienne méthode (pseudo sur .scanner-preview) désactivée */
.scanner-preview::before,
.scanner-preview::after { display: none !important; }

/* ── Ligne de scan animée ────────────────────────────────────── */
.scanner-line {
    position: absolute;
    left: 6px; right: 6px;
    height: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(59,130,246,0.8) 40%,
        #3b82f6 50%,
        rgba(59,130,246,0.8) 60%,
        transparent 100%
    );
    box-shadow: 0 0 8px rgba(59,130,246,0.7);
    animation: smScanLine 2.2s ease-in-out infinite;
    z-index: 6;
    border-radius: 1px;
}
@keyframes smScanLine {
    0%   { top: 6px;   opacity: 0; }
    8%   { opacity: 1; }
    92%  { opacity: 1; }
    100% { top: calc(100% - 8px); opacity: 0; }
}

/* ── Boutons scanner ─────────────────────────────────────────── */
/* La vue PHP utilise .flex.gap-2 — on complète avec centrage */
#pgScanner .flex.gap-2.flex-wrap {
    justify-content: center;
    row-gap: 8px;
}

/* ── Résultat scan ───────────────────────────────────────────── */
.scan-result {
    display: flex;
    align-items: center;
    gap: 12px;
}
.scan-result-icon {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.scan-result-icon.success { background: var(--green-pale, #dcfce7); color: var(--green, #22c55e); }
.scan-result-icon.error   { background: var(--red-pale, #fee2e2);   color: var(--red, #ef4444); }
.scan-result-icon svg { width: 22px; height: 22px; }
.scan-result-content { flex: 1; min-width: 0; }
.scan-result-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.scan-result-text {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Scans récents ───────────────────────────────────────────── */
.recent-scans {
    max-height: 280px;
    overflow-y: auto;
}
.recent-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.recent-item:last-child { border-bottom: none; }
.ri-code { font-family: monospace; color: var(--blue); flex-shrink: 0; }
.ri-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ri-time { color: var(--text-muted); font-size: 11px; flex-shrink: 0; }

/* ── Modal QR scan caméra ────────────────────────────────────── */
/*
   ScannerService injecte sa structure dans #scanQrHost.
   Dans une modale, le host doit être RELATIF et carré.
   On utilise un wrapper .qr-scan-wrap pour contraindre la taille.
*/
.qr-scan-wrap {
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    aspect-ratio: 1;
    position: relative;
    overflow: hidden;
    border-radius: var(--r-lg);
    background: #111;
}

#scanQrHost {
    /* Dans la modal : position relative, pas absolute */
    position: relative !important;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Vidéo et canvas injectés par html5-qrcode dans le host */
#scanQrHost video {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 0 !important;
}
#scanQrHost canvas {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
}

/* ── QR interne (génération) ─────────────────────────────────── */
.qr-internal-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
#smQrBox {
    width: min(240px, 75vw);
    height: min(240px, 75vw);
    background: #ffffff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.12);
}
#smQrBox img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.qr-internal-label {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    max-width: 280px;
    word-break: break-all;
}

.chart-container {

    height: 250px;

    position: relative;

}



.chart-fallback {

    display: flex;

    align-items: center;

    justify-content: center;

    height: 100%;

    color: var(--text-muted);

}



.activity-feed {

    max-height: 280px;

    overflow-y: auto;

}



.act-item {

    display: flex;

    align-items: flex-start;

    gap: var(--sp-3);

    padding: var(--sp-3) var(--sp-4);

    border-bottom: 1px solid var(--border-light);

    transition: background var(--tr);

}



.act-item:hover {

    background: var(--bg-hover);

}



.act-item:last-child {

    border-bottom: none;

}



.act-icon {

    width: 32px;

    height: 32px;

    border-radius: var(--r);

    display: flex;

    align-items: center;

    justify-content: center;

    flex-shrink: 0;

}



.act-icon svg {

    width: 16px;

    height: 16px;

}



.act-icon.add { background: var(--green-pale); color: var(--green); }

.act-icon.remove { background: var(--red-pale); color: var(--red); }

.act-icon.transfer { background: var(--blue-pale); color: var(--blue); }

.act-icon.inventory { background: var(--orange-pale); color: var(--orange); }

.act-icon.entry { background: var(--green-pale); color: var(--green); }



.act-content {

    flex: 1;

    min-width: 0;

}



.act-title {

    font-size: 13px;

    font-weight: 500;

    color: var(--text-primary);

}



.act-meta {

    font-size: 11px;

    color: var(--text-muted);

    margin-top: 2px;

}



.act-time {

    font-size: 11px;

    color: var(--text-muted);

    white-space: nowrap;

}



.act-empty {

    padding: var(--sp-6);

    text-align: center;

    color: var(--text-muted);

}



/* Alert items in dashboard */

.alert-item {

    display: flex;

    align-items: center;

    gap: var(--sp-3);

    padding: var(--sp-3);

    background: var(--orange-pale);

    border-radius: var(--r);

    margin-bottom: var(--sp-2);

}



.alert-item:last-child {

    margin-bottom: 0;

}



.alert-item.critical {

    background: var(--red-pale);

}



.alert-icon {

    width: 28px;

    height: 28px;

    border-radius: var(--r-sm);

    display: flex;

    align-items: center;

    justify-content: center;

    flex-shrink: 0;

    background: var(--orange);

    color: white;

}



.alert-item.critical .alert-icon {

    background: var(--red);

}



.alert-icon svg {

    width: 14px;

    height: 14px;

}



.alert-content {

    flex: 1;

}



.alert-title {

    font-size: 13px;

    font-weight: 500;

    color: var(--text-primary);

}



.alert-desc {

    font-size: 11px;

    color: var(--text-muted);

}



/* Stock status badges */

.stock-status {

    display: inline-flex;

    align-items: center;

    gap: 6px;

    padding: 4px 10px;

    border-radius: var(--r-full);

    font-size: 11px;

    font-weight: 600;

}



.stock-status.ok { background: var(--green-pale); color: var(--green); }

.stock-status.low { background: var(--orange-pale); color: var(--orange); }

.stock-status.critical { background: var(--red-pale); color: var(--red); }

.stock-status.over { background: var(--blue-pale); color: var(--blue); }



/* Card body flush (no padding) */

.card-body-flush {

    padding: 0;

}



.scanner-result-item {

    display: flex;

    align-items: center;

    gap: var(--sp-3);

    padding: var(--sp-3);

    background: var(--bg-card);

    border-radius: var(--r);

    margin-bottom: var(--sp-2);

}



.scanner-result-item:last-child {

    margin-bottom: 0;

}



/* ══════════════════════════════════════════════════════════════

   MOVEMENTS

   ══════════════════════════════════════════════════════════════ */

.movement-card {

    display: flex;

    align-items: center;

    gap: var(--sp-3);

    padding: var(--sp-4);

    background: var(--bg-card);

    border: 1px solid var(--border);

    border-radius: var(--r-lg);

    margin-bottom: var(--sp-3);

}



.movement-icon {

    width: 44px;

    height: 44px;

    border-radius: var(--r);

    display: flex;

    align-items: center;

    justify-content: center;

    flex-shrink: 0;

}



.movement-icon svg {

    width: 22px;

    height: 22px;

}



.movement-icon.in { 

    background: var(--green-pale); 

    color: var(--green); 

}



.movement-icon.out { 

    background: var(--red-pale); 

    color: var(--red); 

}



.movement-icon.transfer { 

    background: var(--blue-pale); 

    color: var(--blue); 

}



.movement-icon.inventory { 

    background: var(--orange-pale); 

    color: var(--orange); 

}



.movement-info {

    flex: 1;

    min-width: 0;

}



.movement-title {

    font-size: 14px;

    font-weight: 600;

    color: var(--text-primary);

    margin-bottom: 4px;

}



.movement-meta {

    font-size: 12px;

    color: var(--text-muted);

}



.movement-qty {

    font-size: 16px;

    font-weight: 700;

    text-align: right;

}



.movement-qty.positive { color: var(--green); }

.movement-qty.negative { color: var(--red); }



/* ══════════════════════════════════════════════════════════════

   INVENTORY

   ══════════════════════════════════════════════════════════════ */


/* ══════════════════════════════════════════════════════════════

   SETTINGS

   ══════════════════════════════════════════════════════════════ */

.settings-container,
.settings-shell {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
}

.settings-page {
    padding-bottom: 6px;
}

.settings-main-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(320px, 0.95fr);
    gap: 20px;
    align-items: start;
}

.settings-main-column,
.settings-side-column {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.settings-side-column {
    position: relative;
}

.settings-card {
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.04);
}

.settings-hero-card {
    position: relative;
    overflow: hidden;
}

.settings-hero-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at top right, rgba(59, 130, 246, 0.12), transparent 34%),
        radial-gradient(circle at left center, rgba(16, 185, 129, 0.08), transparent 32%);
    pointer-events: none;
}

.settings-hero-body {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.settings-hero-copy {
    max-width: 760px;
}

.settings-kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--blue);
}

.settings-hero-title {
    margin: 0 0 10px;
    font-size: clamp(26px, 3vw, 34px);
    line-height: 1.08;
    color: var(--text-primary);
}

.settings-hero-text {
    margin: 0;
    max-width: 820px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-secondary);
}

.settings-hero-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    max-width: 360px;
}

.settings-hero-pill {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 7px 12px;
    border-radius: var(--r-full);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
}

.settings-hero-pill-danger {
    background: var(--red-pale);
    border-color: rgba(220, 38, 38, 0.18);
    color: var(--red);
}

.settings-section-header {
    align-items: flex-start;
}

.settings-section-header > div {
    flex: 1;
}

.settings-section-desc {
    margin: 6px 0 0;
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-muted);
}

.settings-meta-note {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

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

.settings-locale-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-top: 16px;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--blue);
    border-radius: var(--r-lg);
    background: var(--bg-elevated);
}

.settings-locale-preview > div {
    display: grid;
    gap: 4px;
    min-width: 180px;
}

.settings-locale-preview-label {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.settings-locale-preview strong {
    color: var(--text-primary);
    font-size: 22px;
    font-variant-numeric: tabular-nums;
}

.settings-locale-preview p {
    margin: 0;
    max-width: 680px;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.55;
}

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

.settings-action-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px;
    min-height: 100%;
    border-radius: var(--r-lg);
    background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-elevated) 100%);
    border: 1px solid var(--border);
}

.settings-action-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(59, 130, 246, 0.1);
    color: var(--blue);
}

.settings-action-icon svg {
    width: 18px;
    height: 18px;
}

.settings-action-content h4 {
    margin: 0 0 6px;
    font-size: 15px;
    color: var(--text-primary);
}

.settings-action-content p {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-muted);
}

.settings-panel {
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    background: var(--bg-elevated);
}

.settings-panel-text {
    font-size: 13px;
    line-height: 1.65;
}

.settings-block-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.settings-block-text {
    margin: 0;
    max-width: 720px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-muted);
}

.settings-lang-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.archive-form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) 180px auto;
    gap: 12px;
    align-items: end;
}

.archive-year-group {
    min-width: 0;
}

.archive-submit-wrap {
    display: flex;
    align-items: flex-end;
}

.settings-push-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.settings-danger-stack {
    display: grid;
    gap: 12px;
}

.settings-danger-stack .btn {
    justify-content: center;
}

.settings-empty-state {
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* Sous-titre de section */
.settings-subsection-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin: 0 0 10px;
}

@media (max-width: 1100px) {
    .settings-main-grid {
        grid-template-columns: 1fr;
    }

    .settings-hero-pills {
        justify-content: flex-start;
        max-width: none;
    }
}

@media (max-width: 900px) {
    .settings-form-grid,
    .settings-action-grid,
    .archive-form-grid {
        grid-template-columns: 1fr;
    }

    .archive-submit-wrap {
        justify-content: flex-start;
    }

    .settings-locale-preview {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 640px) {
    .settings-hero-body {
        gap: 16px;
    }

    .settings-hero-title {
        font-size: 24px;
    }

    .settings-action-card {
        padding: 16px;
    }
}

/* ── RAPPEL ARCHIVAGE ── */
.archive-reminder {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: rgba(245, 158, 11, 0.08);
    border: 1.5px solid rgba(245, 158, 11, 0.35);
    border-radius: var(--r-xl);
    flex-wrap: wrap;
}
.archive-reminder-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(245, 158, 11, 0.15);
    color: var(--orange, #f59e0b);
    flex-shrink: 0;
}
.archive-reminder-body {
    flex: 1;
    min-width: 200px;
}
.archive-reminder-body strong {
    display: block;
    font-size: 14px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 2px;
}
.archive-reminder-body p {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

/* ── PUSH ── */
.push-unsupported {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg-elevated);
    border-radius: var(--r-lg);
    font-size: 13px;
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.push-types {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.push-type-pill {
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 20px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}
.push-device-info {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    padding: 8px 12px;
    background: var(--bg-elevated);
    border-radius: var(--r-lg);
    border: 1px solid var(--border);
}

/* ── ARCHIVAGE : formulaire ── */
.archive-create-block {
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}
.archive-form-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}
.archive-entity-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.archive-entity-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--r-full);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-card);
    transition: border-color var(--tr), background var(--tr);
    user-select: none;
}
.archive-entity-check:hover {
    border-color: var(--blue);
    background: var(--bg-hover);
}
.archive-entity-check input[type=checkbox] {
    width: 14px;
    height: 14px;
    accent-color: var(--blue);
    cursor: pointer;
}
.archive-entity-icon { font-size: 14px; }
.archive-entity-count {
    font-size: 11px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    background: var(--bg-elevated);
    color: var(--text-muted);
}

/* ── ARCHIVAGE : liste ── */
/* ── Boutons BL / Site dans mouvements ── */
.mv-btn-bl, .mv-btn-site {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--r-full);
    display: inline-flex;
    align-items: center;
    margin-right: 3px;
    letter-spacing: .01em;
    transition: all var(--tr);
}
.mv-btn-bl {
    color: var(--text-secondary);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
}
.mv-btn-bl:hover {
    background: var(--bg-hover);
    border-color: var(--blue);
    color: var(--blue);
}
.mv-btn-site {
    color: var(--blue);
    background: var(--blue-pale);
    border: 1px solid rgba(59,130,246,0.25);
}
.mv-btn-site:hover {
    background: rgba(59,130,246,0.18);
}

.archive-table-wrap {
    overflow-x: auto;
    border-radius: var(--r-xl);
    border: 1px solid var(--border);
}
.archive-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 32px;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
}
.archive-empty svg { opacity: .35; }
.archive-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.archive-pill {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-muted);
}
.archive-pill em { font-style: normal; color: var(--text-secondary); }

/* ── ARCHIVE READER (modal) ── */
.archive-read-card {
    padding: 12px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
}
.archive-read-entity {
    font-size: 13px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.archive-read-count {
    font-size: 12px;
    color: var(--text-muted);
}



.card-danger {

    border-color: var(--red);

}



.card-danger .card-header {

    background: var(--red-pale);

}



/* ══════════════════════════════════════════════════════════════

   REPORTS

   ══════════════════════════════════════════════════════════════ */

.report-card {

    cursor: pointer;

    transition: all var(--tr);

}



.report-card:hover {

    border-color: var(--blue);

    background: var(--bg-hover);

}



.report-card:active {

    transform: scale(0.98);

}



.report-icon {

    width: 48px;

    height: 48px;

    border-radius: var(--r);

    display: flex;

    align-items: center;

    justify-content: center;

    margin-bottom: var(--sp-3);

}



.report-icon svg {

    width: 24px;

    height: 24px;

}



.report-icon.blue { background: var(--blue-pale); color: var(--blue); }

.report-icon.green { background: var(--green-pale); color: var(--green); }

.report-icon.orange { background: var(--orange-pale); color: var(--orange); }

.report-icon.red { background: var(--red-pale); color: var(--red); }



/* ══════════════════════════════════════════════════════════════

   LOGIN PAGE

   ══════════════════════════════════════════════════════════════ */

.login-page {

    min-height: 100vh;

    min-height: 100dvh;

    display: flex;

    align-items: center;

    justify-content: center;

    padding: var(--sp-4);

    padding-top: calc(var(--sp-4) + var(--safe-top));

    padding-bottom: calc(var(--sp-4) + var(--safe-bottom));

    background: var(--bg-body);

}



.login-card {

    width: 100%;

    max-width: 400px;

    background: var(--bg-card);

    border: 1px solid var(--border);

    border-radius: var(--r-xl);

    padding: var(--sp-8);

    box-shadow: var(--shadow-lg);

}



.login-logo {

    display: flex;

    flex-direction: column;

    align-items: center;

    margin-bottom: var(--sp-6);

}



.login-logo .logo-icon {

    width: 40px;

    height: 40px;

    border-radius: var(--r);

    display: flex;

    align-items: center;

    justify-content: center;

    flex-shrink: 0;

    cursor: pointer;

    user-select: none;

}



.logo-icon .logo-img {

    width: 40px;

    height: 40px;

    object-fit: contain;

    display: block;

}





.login-logo 

.login-title {

    font-size: 24px;

    font-weight: 700;

    color: var(--text-primary);

    text-align: center;

}



.login-subtitle {

    font-size: 14px;

    color: var(--text-muted);

    text-align: center;

    margin-top: var(--sp-2);

}



.login-form .form-group {

    margin-bottom: var(--sp-4);

}



.login-form .btn {

    margin-top: var(--sp-4);

}



.login-error {

    padding: var(--sp-3);

    background: var(--red-pale);

    color: var(--red);

    border-radius: var(--r);

    font-size: 13px;

    margin-bottom: var(--sp-4);

    text-align: center;

}



/* ══════════════════════════════════════════════════════════════

   EMPTY STATES

   ══════════════════════════════════════════════════════════════ */

.empty-state {

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    padding: var(--sp-8);

    text-align: center;

}



.empty-state-icon,

.empty-icon {

    width: 80px;

    height: 80px;

    border-radius: var(--r-lg);

    background: var(--bg-elevated);

    display: flex;

    align-items: center;

    justify-content: center;

    margin-bottom: var(--sp-4);

}



.empty-state-icon svg,

.empty-icon svg {

    width: 36px;

    height: 36px;

    color: var(--text-muted);

}



.empty-state h3,

.empty-title {

    font-size: 16px;

    font-weight: 600;

    color: var(--text-primary);

    margin-bottom: var(--sp-2);

}



.empty-state p,

.empty-text {

    font-size: 14px;

    color: var(--text-muted);

    max-width: 300px;

}



.empty-state .btn {

    margin-top: var(--sp-4);

}



/* ══════════════════════════════════════════════════════════════

   UTILITY CLASSES

   ══════════════════════════════════════════════════════════════ */

.flex { display: flex; }

.flex-1 { flex: 1; }

.flex-wrap { flex-wrap: wrap; }

.flex-col { flex-direction: column; }

.items-center { align-items: center; }

.items-start { align-items: flex-start; }

.items-end { align-items: flex-end; }

.justify-center { justify-content: center; }

.justify-between { justify-content: space-between; }

.justify-end { justify-content: flex-end; }

.gap-1 { gap: var(--sp-1); }

.gap-2 { gap: var(--sp-2); }

.gap-3 { gap: var(--sp-3); }

.gap-4 { gap: var(--sp-4); }

.gap-6 { gap: var(--sp-6); }



.mt-1 { margin-top: var(--sp-1); }

.mt-2 { margin-top: var(--sp-2); }

.mt-3 { margin-top: var(--sp-3); }

.mt-4 { margin-top: var(--sp-4); }

.mt-6 { margin-top: var(--sp-6); }

.mb-1 { margin-bottom: var(--sp-1); }

.mb-2 { margin-bottom: var(--sp-2); }

.mb-3 { margin-bottom: var(--sp-3); }

.mb-4 { margin-bottom: var(--sp-4); }

.mb-6 { margin-bottom: var(--sp-6); }

.ml-auto { margin-left: auto; }

.mr-auto { margin-right: auto; }



.p-2 { padding: var(--sp-2); }

.p-3 { padding: var(--sp-3); }

.p-4 { padding: var(--sp-4); }



.text-sm { font-size: 13px; }

.text-xs { font-size: 11px; }

.text-lg { font-size: 16px; }

.text-center { text-align: center; }

.text-right { text-align: right; }

.font-bold { font-weight: 700; }

.font-medium { font-weight: 500; }



.truncate {

    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;

}



.w-full { width: 100%; }

.min-w-0 { min-width: 0; }



/* ══════════════════════════════════════════════════════════════

   INFINITE SCROLL

   ══════════════════════════════════════════════════════════════ */

.infinite-scroll-loader {

    display: flex;

    align-items: center;

    justify-content: center;

    gap: var(--sp-3);

    padding: var(--sp-6);

    color: var(--text-muted);

    font-size: 14px;

    opacity: 0;

    transition: opacity var(--tr);

}



.infinite-scroll-loader.visible {

    opacity: 1;

}



.infinite-loader-spinner {

    width: 24px;

    height: 24px;

    border: 3px solid var(--border);

    border-top-color: var(--blue);

    border-radius: 50%;

    animation: infiniteSpin 0.8s linear infinite;

}



@keyframes infiniteSpin {

    to { transform: rotate(360deg); }

}



.infinite-scroll-end {

    display: flex;

    flex-direction: column;

    align-items: center;

    gap: var(--sp-1);

    padding: var(--sp-6);

    color: var(--text-muted);

    font-size: 13px;

    text-align: center;

}



.infinite-end-count {

    font-size: 12px;

    opacity: 0.7;

}



/* Cacher la pagination sur mobile quand scroll infini actif */

@media (max-width: 1024px) {

    .pagination-bar.hide-mobile,

    .pager.hide-mobile {

        display: none !important;

    }

}



/* ══════════════════════════════════════════════════════════════

   SCROLL TOP BUTTON

   ══════════════════════════════════════════════════════════════ */

#scrollTopBtn.scrolltop {

    position: fixed;

    right: var(--sp-4);

    right: calc(var(--sp-4) + var(--safe-right));

    bottom: calc(var(--bottom-nav-height) + var(--sp-4) + var(--safe-bottom));

    width: 52px;

    height: 52px;

    border: 0;

    border-radius: var(--r-full);

    background: var(--blue);

    color: white;

    display: flex;

    align-items: center;

    justify-content: center;

    cursor: pointer;

    opacity: 0;

    visibility: hidden;

    transform: translateY(20px);

    transition: all var(--tr-md);

    z-index: 90;

    box-shadow: var(--shadow-lg);

}



#scrollTopBtn.scrolltop.show {

    opacity: 1;

    visibility: visible;

    transform: translateY(0);

}



#scrollTopBtn.scrolltop:active {

    transform: scale(0.95);

}



#scrollTopBtn.scrolltop svg {

    width: 24px;

    height: 24px;

}



/* ══════════════════════════════════════════════════════════════

   PRINT STYLES

   ══════════════════════════════════════════════════════════════ */

@media print {

    .sidebar,

    .bottom-nav,

    .top-header,

    .filters-bar,

    .btn,

    .slide-menu,

    .slide-menu-backdrop,

    .toast-wrap,

    .modal-overlay,

    #scrollTopBtn {

        display: none !important;

    }

    

    .main-content {

        padding: 0 !important;

    }

    

    .card {

        border: 1px solid #ddd !important;

        break-inside: avoid;

    }

    

    body {

        background: white !important;

        color: black !important;

    }

}



/* ══════════════════════════════════════════════════════════════

   RESPONSIVE — TABLETTE (max-width: 1024px)

   ══════════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {

    .sidebar {

        display: none;

    }

    

    .mobile-menu-btn {

        display: flex;

    }

    

    .slide-menu-backdrop {

        display: block;

    }

    

    .main-content {

        padding: var(--sp-4);

        padding-bottom: calc(var(--sp-4) + var(--bottom-nav-height) + var(--safe-bottom));

        padding-left: calc(var(--sp-4) + var(--safe-left));

        padding-right: calc(var(--sp-4) + var(--safe-right));

    }

    

    .bottom-nav {

        display: flex;

    }

    

    .main-footer {

        display: none;

    }

    

    .kpi-grid, .kpi-row, .dashboard-kpis { grid-template-columns: repeat(2, 1fr); }
    .dash-charts-row { grid-template-columns: 1fr; }
    .dash-bottom-row { grid-template-columns: 1fr; }
    .dash-alert-card { padding: 8px 10px; }
    .dash-alert-thumb { width: 42px; height: 42px; }

    

    .dashboard-grid { grid-template-columns: 1fr; }
    .dash-charts-row { grid-template-columns: 1fr; }
    .dash-bottom-row { grid-template-columns: 1fr; }
    .dash-alert-name { max-width: 120px; }

    

    /* Cards bord à bord sur tablette */

    .card {

        border-radius: var(--r-lg);

    }

    

    .filters-bar {

        border-radius: var(--r-lg);

    }

    

    /* Modal ajusté */

    .modal {

        max-width: 90vw;

    }

    

    #scrollTopBtn.scrolltop {

        bottom: calc(var(--bottom-nav-height) + var(--sp-4) + var(--safe-bottom));

    }

}



/* ══════════════════════════════════════════════════════════════

   RESPONSIVE — MOBILE LARGE (max-width: 768px)

   ══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {

    .filters-bar {

        flex-direction: column;

        align-items: stretch;

        gap: var(--sp-3);

        padding: var(--sp-3);

    }

    

    .filters-section {

        width: 100%;

    }

    

    .filters-section.ml-auto {

        margin-left: 0;

    }

    

    .filters-divider {

        display: none;

    }

    

    .search-box {

        min-width: 0;

        width: 100%;

    }

    

    .products-grid, .prod-grid {

        grid-template-columns: repeat(2, 1fr);

        gap: var(--sp-3);

    }

    

    .warehouses-grid, .wh-grid {

        grid-template-columns: 1fr;

    }

    

    .pagination-bar, .pager {

        flex-direction: column;

        gap: var(--sp-3);

        align-items: stretch;

    }

    

    .pagination-controls {

        justify-content: center;

    }

    

    .top-header {

        padding: 0 var(--sp-4);

        padding-left: calc(var(--sp-4) + var(--safe-left));

        padding-right: calc(var(--sp-4) + var(--safe-right));

    }

    

    .header-title {

        font-size: 16px;

    }

    

    /* Table scroll hint */

    .table-container, .tbl-wrap {

        margin: 0 calc(-1 * var(--sp-3));

        padding: 0 var(--sp-3);

    }

    

    .data-table th, .data-table td,

    table th, table td {

        padding: 10px 12px;

    }

    

    /* KPI adaptés */

    .kpi-value, .kpi-val {

        font-size: 24px;

    }

    

    .kpi-card {

        padding: var(--sp-4);

    }

    

    /* Modal footer buttons stack */

    .modal-footer {

        flex-direction: column-reverse;

    }

    

    .modal-footer .btn {

        width: 100%;

    }

}



/* ══════════════════════════════════════════════════════════════

   RESPONSIVE — MOBILE SMALL (max-width: 480px)

   ══════════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════════════════
   INVENTAIRES v2.7.0
   ══════════════════════════════════════════════════════════════ */

/* Titre inline */
.page-title-inline {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

/* ── Header barre inventaire en cours ── */
.inv-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 16px 20px;
    margin-bottom: 20px;
}
.inv-header-info { display: flex; flex-direction: column; gap: 4px; }
.inv-header-title { font-size: 17px; font-weight: 700; color: var(--text-primary); margin: 0; }
.inv-header-meta  { font-size: 12px; color: var(--text-muted); }

/* ── KPI row inventaire ── */
.inv-kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}
.inv-kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 14px 16px;
    text-align: center;
    transition: border-color var(--tr);
}
.inv-kpi-card.green  { border-color: rgba(16,185,129,0.3);  background: rgba(16,185,129,0.05); }
.inv-kpi-card.orange { border-color: rgba(245,158,11,0.3);  background: rgba(245,158,11,0.05); }
.inv-kpi-card.muted  { border-color: var(--border); }
.inv-kpi-val {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 4px;
}
.inv-kpi-card.green  .inv-kpi-val { color: var(--green); }
.inv-kpi-card.orange .inv-kpi-val { color: var(--orange); }
.inv-kpi-card.muted  .inv-kpi-val { color: var(--text-muted); }
.inv-kpi-lbl { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

/* ── Barre de progression ── */
.inv-progress-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}
.inv-progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-elevated);
    border-radius: 999px;
    overflow: hidden;
}
.inv-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--blue), var(--green));
    border-radius: 999px;
    transition: width 0.4s ease;
}
.inv-progress-pct {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    min-width: 36px;
    text-align: right;
}

/* ── Tableau historique ── */
.inv-history-row {
    cursor: pointer;
    transition: background var(--tr);
}
.inv-history-row:hover td { background: var(--bg-hover); }

/* ── Vue détail méta ── */
.inv-detail-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
}
.inv-detail-meta-item { display: flex; flex-direction: column; gap: 3px; }
.inv-detail-meta-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    font-weight: 700;
}
.inv-detail-meta-val {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ── Lignes inventaire ── */
.inv-row-ok   { background: rgba(16,185,129,0.04) !important; }
.inv-row-diff { background: rgba(245,158,11,0.06) !important; }
.inv-row-active { background: rgba(59,130,246,0.08) !important; outline: 2px solid var(--blue); outline-offset: -2px; }
.inv-row-highlight { animation: inv-flash 1.5s ease forwards; }
@keyframes inv-flash {
    0%   { background: rgba(59,130,246,0.25); }
    100% { background: transparent; }
}

/* ── Input comptage ── */
.inv-count-input {
    width: 80px;
    text-align: center;
    border-radius: var(--r-lg);
    font-weight: 700;
    font-size: 14px;
    padding: 4px 8px;
    border: 2px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    transition: border-color var(--tr), background var(--tr);
}
.inv-count-input:focus { border-color: var(--blue); outline: none; background: var(--bg-card); }
.inv-count-input.has-value { border-color: var(--green); background: rgba(16,185,129,0.06); }

/* ── Badges couleurs ── */
.badge-gray   { background: var(--bg-elevated); color: var(--text-secondary); border: 1px solid var(--border); }
.badge-blue   { background: var(--blue-pale);   color: var(--blue);   }
.text-green   { color: var(--green) !important; }
.text-orange  { color: var(--orange) !important; }
.text-red     { color: var(--red) !important; }
.font-bold    { font-weight: 700; }

/* ── Responsive ── */
@media (max-width: 900px) {
    .inv-kpi-row { grid-template-columns: repeat(2, 1fr); }
    .inv-header-bar { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 600px) {
    .inv-kpi-row { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .inv-kpi-val { font-size: 20px; }
    .inv-detail-meta-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {

    :root {

        --header-height: 56px;

    }

    

    .main-content {

        padding: var(--sp-3);

        padding-bottom: calc(var(--sp-3) + var(--bottom-nav-height) + var(--safe-bottom));

        padding-left: calc(var(--sp-3) + var(--safe-left));

        padding-right: calc(var(--sp-3) + var(--safe-right));

    }

    

    /* BORD À BORD - Cards sans border-radius ni marge horizontale */

    .card {

        border-radius: 0;

        border-left: none;

        border-right: none;

        margin-left: calc(-1 * var(--sp-3));

        margin-right: calc(-1 * var(--sp-3));

    }

    

    .card + .card {

        margin-top: calc(-1px); /* Éviter double bordure */

    }

    

    .filters-bar {

        border-radius: 0;

        border-left: none;

        border-right: none;

        margin-left: calc(-1 * var(--sp-3));

        margin-right: calc(-1 * var(--sp-3));

        margin-bottom: var(--sp-3);

    }

    

    /* KPI en une colonne */

    .kpi-grid, .kpi-row, .dashboard-kpis {

        grid-template-columns: 1fr;

        gap: var(--sp-3);

    }

    

    .kpi-card {

        display: flex;

        align-items: center;

        gap: var(--sp-4);

        padding: var(--sp-4);

        border-radius: 0;

        border-left: none;

        border-right: none;

        margin-left: calc(-1 * var(--sp-3));

        margin-right: calc(-1 * var(--sp-3));

    }

    

    .kpi-card .kpi-header {

        margin-bottom: 0;

    }

    

    .kpi-card .kpi-value {

        font-size: 22px;

    }

    

    /* Products en une colonne */

    .products-grid, .prod-grid {

        grid-template-columns: 1fr;

        gap: var(--sp-3);

    }

    

    .product-card, .prod-card {

        border-radius: 0;

        border-left: none;

        border-right: none;

        margin-left: calc(-1 * var(--sp-3));

        margin-right: calc(-1 * var(--sp-3));

    }

    

    /* Warehouse cards bord à bord */

    .wh-card {

        border-radius: 0;

        border-left: none;

        border-right: none;

        margin-left: calc(-1 * var(--sp-3));

        margin-right: calc(-1 * var(--sp-3));

    }

    

    /* Movement cards bord à bord */

    .movement-card {

        border-radius: 0;

        border-left: none;

        border-right: none;

        margin-left: calc(-1 * var(--sp-3));

        margin-right: calc(-1 * var(--sp-3));

    }

    

    /* Modal full screen sur petit mobile */

    .modal-overlay {

        padding: 0;

        align-items: flex-end;

    }

    

    .modal {

        max-width: 100%;

        max-height: calc(100dvh - var(--safe-top));

        border-radius: var(--r-xl) var(--r-xl) 0 0;

        border-bottom: none;

    }

    

    .modal-body {

        padding: var(--sp-4);

    }

    

    .modal-hdr {

        padding: var(--sp-4);

    }

    

    .modal-footer {

        padding: var(--sp-4);

        padding-bottom: calc(var(--sp-4) + var(--safe-bottom));

    }

    

    /* Buttons full width dans filtres */

    .filters-section .btn {

        width: 100%;

        justify-content: center;

    }

    

    /* Login page */

    .login-card {

        border-radius: 0;

        border: none;

        max-width: 100%;

        padding: var(--sp-6);

        padding-bottom: calc(var(--sp-6) + var(--safe-bottom));

    }

    

    /* Header compact */

    .header-title {

        font-size: 15px;

    }

    

    .top-header {

        height: var(--header-height);

        padding: 0 var(--sp-3);

        padding-left: calc(var(--sp-3) + var(--safe-left));

        padding-right: calc(var(--sp-3) + var(--safe-right));

    }

    

    /* Scroll top button */

    #scrollTopBtn.scrolltop {

        width: 48px;

        height: 48px;

        right: var(--sp-3);

        right: calc(var(--sp-3) + var(--safe-right));

    }

}



/* ══════════════════════════════════════════════════════════════

   RESPONSIVE — MOBILE LANDSCAPE

   ══════════════════════════════════════════════════════════════ */

@media (max-height: 500px) and (orientation: landscape) {

    .main-content {

        padding: var(--sp-3);

        padding-bottom: calc(var(--sp-3) + var(--bottom-nav-height) + var(--safe-bottom));

    }

    

    .kpi-grid, .kpi-row, .dashboard-kpis {

        grid-template-columns: repeat(4, 1fr);

    }

    

    .kpi-card {

        padding: var(--sp-3);

    }

    

    .kpi-value, .kpi-val {

        font-size: 20px;

    }

    

    .modal {

        max-height: calc(100dvh - var(--sp-4));

    }

    

    .modal-body {

        max-height: 50vh;

    }

    

    .bottom-nav {

        height: calc(52px + var(--safe-bottom));

    }

    

    .bottom-nav-inner {

        height: 52px;

    }

    

    .bnav-label {

        display: none;

    }

}



/* ══════════════════════════════════════════════════════════════

   ACCESSIBILITY

   ══════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {

    *,

    *::before,

    *::after {

        animation-duration: 0.01ms !important;

        animation-iteration-count: 1 !important;

        transition-duration: 0.01ms !important;

    }

}



/* Focus visible pour navigation clavier */

:focus-visible {

    outline: 2px solid var(--blue);

    outline-offset: 2px;

}



button:focus:not(:focus-visible),

a:focus:not(:focus-visible),

input:focus:not(:focus-visible),

select:focus:not(:focus-visible) {

    outline: none;

}



/* ══════════════════════════════════════════════════════════════

   PWA / STANDALONE MODE

   ══════════════════════════════════════════════════════════════ */

@media (display-mode: standalone) {

    body {

        /* Activer safe areas en mode PWA */

        padding-top: var(--safe-top);

    }

    

    .top-header {

        padding-top: var(--safe-top);

        height: calc(var(--header-height) + var(--safe-top));

    }

}





/* Sidebar collapse (desktop) */

.sidebar.is-collapsed { width: 76px; }

.sidebar.is-collapsed .logo-text { display: none; }

.sidebar.is-collapsed .sidebar-label { display: none; }

.sidebar.is-collapsed .sidebar-badge { display: none; }

.sidebar.is-collapsed .sidebar-footer-logo { display: none; }

.sidebar.is-collapsed .user-info { display: none; }

.sidebar.is-collapsed .user-logout { display: none; }

.sidebar.is-collapsed .sidebar-link { justify-content: center; }





/* Sidebar collapsed: hover stylisé + tooltip */

.sidebar.is-collapsed .sidebar-link{

    margin: 6px 10px;

    padding: 10px;

}

.sidebar.is-collapsed .sidebar-link:hover{

    background: rgba(0,0,0,.06);

    box-shadow: 0 8px 20px rgba(0,0,0,.08);

    transform: translateY(-1px);

}

.sidebar.is-collapsed .sidebar-link::after{

    content: attr(data-label);

    position: absolute;

    left: 70px;

    top: 50%;

    transform: translateY(-50%) translateX(-6px);

    background: rgba(10, 15, 25, .92);

    color: #fff;

    padding: 8px 10px;

    border-radius: 12px;

    font-size: 12px;

    font-weight: 600;

    white-space: nowrap;

    opacity: 0;

    pointer-events: none;

    transition: opacity .12s ease, transform .12s ease;

    z-index: 1000;

}

.sidebar.is-collapsed .sidebar-link:hover::after{

    opacity: 1;

    transform: translateY(-50%) translateX(0);

}

.sidebar.is-collapsed .sidebar-icon{ width: 22px; height: 22px; }


/* ══════════════════════════════════════════════════════════
   ALERTES v2.4.0 — Badges de seuil Min/Max dans le tableau
   ══════════════════════════════════════════════════════════ */
.alert-seuil {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
    white-space: nowrap;
}
.alert-seuil svg {
    flex-shrink: 0;
}
.alert-seuil-min {
    background: rgba(239, 68, 68, 0.08);
    color: var(--red, #ef4444);
    border: 1px solid rgba(239, 68, 68, 0.2);
}
.alert-seuil-min.is-active {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.12);
}
.alert-seuil-max {
    background: rgba(249, 115, 22, 0.08);
    color: var(--orange, #f97316);
    border: 1px solid rgba(249, 115, 22, 0.2);
}
.alert-seuil-max.is-active {
    background: rgba(249, 115, 22, 0.15);
    border-color: rgba(249, 115, 22, 0.5);
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.12);
}
.alert-seuil-none {
    color: var(--text-muted, #94a3b8);
    font-size: 14px;
}

/* ══════════════════════════════════════════════════════════════
   MAGESTOCK — LICENCE D’UTILISATION
   ══════════════════════════════════════════════════════════════ */
.footer-sep {
    display: inline-block;
    margin: 0 8px;
    color: var(--text-muted);
}
.footer-license-link {
    color: var(--blue);
    text-decoration: none;
    font-weight: 700;
}
.footer-license-link:hover,
.footer-license-link:focus {
    text-decoration: underline;
}
.license-page {
    display: grid;
    gap: 20px;
    max-width: 1240px;
    margin: 0 auto;
}
.license-hero {
    background:
        linear-gradient(135deg, rgba(37,99,235,0.12), rgba(59,130,246,0.04)),
        var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 28px;
    box-shadow: var(--shadow-sm);
}
.license-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(37,99,235,0.10);
    color: var(--blue);
    font-weight: 800;
    letter-spacing: .02em;
    text-transform: uppercase;
    font-size: 12px;
    margin-bottom: 16px;
}
.license-hero h1 {
    margin: 0 0 14px;
    font-size: clamp(32px, 4vw, 52px);
    line-height: 1.02;
}
.license-hero p {
    max-width: 980px;
    margin: 0;
    color: var(--text-muted);
    font-size: 17px;
    line-height: 1.7;
}
.license-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}
.license-meta span {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
}
.license-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}
.license-card {
    border-radius: var(--radius-xl);
}
.license-card-full {
    grid-column: 1 / -1;
}
.license-list {
    margin: 0;
    padding-left: 20px;
    display: grid;
    gap: 12px;
    line-height: 1.7;
}
.license-note {
    margin-top: 18px;
    padding: 16px 18px;
    border-left: 4px solid var(--blue);
    border-radius: 16px;
    background: rgba(37,99,235,0.08);
    color: var(--text);
    font-weight: 600;
}
.license-contact {
    margin-top: 16px;
    font-size: 16px;
}
@media (max-width: 900px) {
    .license-grid {
        grid-template-columns: 1fr;
    }
    .license-hero {
        padding: 22px;
    }
}
@media (max-width: 640px) {
    .license-hero h1 {
        font-size: 34px;
    }
    .license-hero p {
        font-size: 15px;
    }
    .license-meta span {
        width: 100%;
        justify-content: center;
    }
}


/* MAGESTOCK FOOTER MAGEKORP IDENTITY CONTACT1
   Footer commun inspiré du contrat MageTicket : identité MageKorp, contact public,
   version discrète, licence locale et rendu ordinateur/tablette/smartphone. */
.main-footer {
    display: block;
    padding: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 12px;
    text-align: left;
}
.main-footer__inner {
    min-height: 66px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 10px calc(var(--sp-6) + var(--safe-right)) 10px calc(var(--sp-6) + var(--safe-left));
}
.main-footer__brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 122px;
    min-height: 40px;
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #f8fafc;
    text-decoration: none;
    transition: border-color .14s ease, box-shadow .14s ease, transform .14s ease;
}
.main-footer__brand:hover,
.main-footer__brand:focus-visible {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
    outline: none;
}
.main-footer__brand:active { transform: translateY(1px); }
.main-footer__brand picture { display: flex; align-items: center; justify-content: center; }
.main-footer__brand img {
    display: block;
    width: 112px;
    height: auto;
    max-height: 26px;
    object-fit: contain;
}
.main-footer__meta {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 3px 0;
    line-height: 1.45;
    text-align: center;
}
.main-footer__meta strong { color: var(--text-primary); }
.main-footer__version {
    margin-left: 4px;
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 10px;
    color: var(--text-muted);
}
.main-footer__magekorp-link,
.main-footer__contact {
    color: var(--blue);
    text-decoration: none;
    font-weight: 700;
}
.main-footer__magekorp-link:hover,
.main-footer__magekorp-link:focus-visible,
.main-footer__contact:hover,
.main-footer__contact:focus-visible,
.footer-license-link:hover,
.footer-license-link:focus-visible {
    text-decoration: underline;
}
.main-footer__contact {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-body);
    white-space: nowrap;
}
.main-footer__contact:hover,
.main-footer__contact:focus-visible {
    border-color: var(--blue);
    background: var(--bg-hover);
    outline: none;
}
.main-footer__contact svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.footer-sep {
    display: inline-block;
    margin: 0 8px;
    color: var(--text-muted);
}
.footer-license-link {
    color: var(--blue);
    text-decoration: none;
    font-weight: 700;
}

@media (max-width: 1024px) {
    .main-footer { display: block; }
    .main-footer__inner {
        grid-template-columns: auto minmax(0, 1fr);
        min-height: 62px;
        padding: 9px calc(14px + var(--safe-right)) 9px calc(14px + var(--safe-left));
    }
    .main-footer__meta {
        justify-content: flex-start;
        text-align: left;
    }
    .main-footer__contact {
        grid-column: 1 / -1;
        width: 100%;
        min-height: 44px;
    }
}

@media (max-width: 640px) {
    .main-footer {
        margin-bottom: calc(var(--bottom-nav-height) + var(--safe-bottom));
    }
    .main-footer__inner {
        grid-template-columns: 48px minmax(0, 1fr);
        gap: 10px;
        padding: 10px calc(12px + var(--safe-right)) 10px calc(12px + var(--safe-left));
    }
    .main-footer__brand {
        min-width: 44px;
        width: 44px;
        min-height: 44px;
        height: 44px;
        padding: 5px;
    }
    .main-footer__brand img {
        width: 34px;
        max-height: 30px;
    }
    .main-footer__meta {
        font-size: 11px;
        line-height: 1.5;
    }
    .main-footer__contact {
        grid-column: 1 / -1;
    }
    .footer-sep { margin: 0 5px; }
}

@media (prefers-reduced-motion: reduce) {
    .main-footer__brand { transition: none; }
}

