/* ============================================================
   RESET & BASE
   ============================================================ */

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

html {
    font-size: 16px;
}

body {
    font-family: system-ui, sans-serif;
    background: #f4f4f4;
    color: #222;
    min-height: 100vh;
}

/* ============================================================
   MESSAGES
   ============================================================ */

.message {
    padding: .75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: .95rem;
}

.message-erreur {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fca5a5;
}

.message-succes {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #86efac;
}

/* ============================================================
   PAGE LOGIN
   ============================================================ */

.page-login {
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-wrapper {
    background: #1e293b;
    padding: 2.5rem 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 20px rgba(0,0,0,.3);
    width: 100%;
    max-width: 400px;
    margin-top: 10vh;
}

.login-tabs {
    display: flex;
    border-bottom: 2px solid #334155;
    margin-bottom: 1.5rem;
    gap: 0;
}

.login-tab {
    flex: 1;
    padding: .6rem .5rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-size: .875rem;
    font-weight: 600;
    color: #94a3b8;
    cursor: pointer;
    transition: color .15s, border-color .15s;
}

.login-tab:hover { color: #e2e8f0; }

.login-tab.active {
    color: #60a5fa;
    border-bottom-color: #60a5fa;
}

.login-panel-hidden { display: none; }

.login-scan-hint {
    font-size: .875rem;
    color: #64748b;
    text-align: center;
    margin-bottom: 1rem;
}

.login-scan-status {
    font-size: .8rem;
    color: #94a3b8;
    text-align: center;
    margin-top: .75rem;
    min-height: 1.2em;
}

#qr-reader {
    border-radius: 6px;
    overflow: hidden;
}


.login-logo {
    text-align: center;
    margin-bottom: 1.75rem;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    text-align: center;
    letter-spacing: -.5px;
    color: #f59e0b;
}

.login-title strong {
    font-weight: 400;
    color: #7dd3fc;
}

.login-form label {
    display: block;
    font-size: .875rem;
    font-weight: 600;
    margin-bottom: .3rem;
    margin-top: 1rem;
    color: #cbd5e1;
}

.login-form input {
    width: 100%;
    padding: .55rem .75rem;
    border: 1px solid #475569;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color .15s;
    background: #0f172a;
    color: #f1f5f9;
}

.login-form input:focus {
    outline: none;
    border-color: #3b82f6;
}

.login-form button {
    margin-top: 1.75rem;
    width: 100%;
    padding: .65rem;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}

.login-form button:hover {
    background: #1d4ed8;
}

/* ============================================================
   LAYOUT PRINCIPAL (après connexion)
   ============================================================ */

.layout {
    display: grid;
    grid-template-rows: auto 1fr;
    min-height: 100vh;
}

.topbar {
    background: #1e293b;
    color: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1.5rem;
    font-size: .9rem;
    gap: 1.5rem;
}

.topbar-title {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: #f8fafc;
    text-decoration: none;
    white-space: nowrap;
}

.topbar-logo-icon {
    width: 40px;
    height: 28px;
    flex-shrink: 0;
}

.topbar-logo-text {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -.02em;
    color: #f59e0b;
}

.topbar-logo-text strong {
    font-weight: 400;
    color: #7dd3fc;
    letter-spacing: .01em;
}

.topbar-nav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex: 1;
}

.nav-admin-group {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-left: auto;
    padding-left: 1.25rem;
    border-left: 1px solid #334155;
}

.nav-lien {
    color: #cbd5e1;
    text-decoration: none;
    font-size: .9rem;
    padding: .25rem 0;
    border-bottom: 2px solid transparent;
    transition: color .15s, border-color .15s;
}

.nav-lien:hover,
.nav-lien.actif {
    color: #f8fafc;
    border-bottom-color: #2563eb;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    white-space: nowrap;
    font-size: .875rem;
    color: #94a3b8;
}

.topbar-user a {
    color: #94a3b8;
    text-decoration: none;
}

.topbar-user a:hover {
    color: #f8fafc;
}

.page-content {
    padding: 2rem 1.5rem;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
}

/* ============================================================
   EN-TÊTE DE PAGE
   ============================================================ */

.page-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-left: auto;
}

.th-check,
.td-check {
    width: 2rem;
    text-align: center;
    padding-right: 0;
}

.td-check input[type="checkbox"],
.th-check input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    cursor: pointer;
    accent-color: #2563eb;
}

.page-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
}

.btn-retour {
    font-size: .875rem;
    color: #2563eb;
    text-decoration: none;
}

.btn-retour:hover {
    text-decoration: underline;
}

/* ============================================================
   TABLEAU DE DONNÉES
   ============================================================ */

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.data-table th,
.data-table td {
    padding: .75rem 1rem;
    text-align: left;
    font-size: .9rem;
    border-bottom: 1px solid #e5e7eb;
}

.data-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #475569;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

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

.data-table tbody tr:hover td {
    background: #f8fafc;
}

.cell-code {
    font-family: monospace;
    font-size: .85rem;
    color: #64748b;
}

.vide {
    color: #94a3b8;
}

.btn-lien {
    display: inline-block;
    color: #2563eb;
    text-decoration: none;
    font-size: .875rem;
    font-weight: 500;
    padding: .35rem .85rem;
    border-radius: 5px;
    border: 1.5px solid transparent;
}

.btn-lien:hover {
    text-decoration: none;
    background: #f1f5f9;
}

/* ============================================================
   FORMULAIRE D'ÉDITION
   ============================================================ */

.edit-form {
    background: #fff;
    padding: 2rem;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    max-width: 520px;
}

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

.form-group label {
    display: block;
    font-size: .875rem;
    font-weight: 600;
    margin-bottom: .3rem;
    color: #374151;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: .55rem .75rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color .15s;
    background-color: #fff;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #2563eb;
}

.form-valeur-fixe {
    font-size: .95rem;
    color: #64748b;
    font-family: monospace;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.75rem;
}

.form-group-check {
    margin-top: .25rem;
}

.check-label {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .9rem;
    color: #374151;
    cursor: pointer;
    user-select: none;
}

.check-label input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    cursor: pointer;
    accent-color: #2563eb;
}

.form-actions button {
    padding: .55rem 1.25rem;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}

.form-actions button:hover {
    background: #1d4ed8;
}

.btn-annuler {
    font-size: .9rem;
    color: #64748b;
    text-decoration: none;
}

.form-fieldset {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 1rem 1.25rem .5rem;
    margin-bottom: 1.25rem;
}

.form-fieldset legend {
    font-size: .8rem;
    font-weight: 600;
    color: #64748b;
    padding: 0 .4rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.form-row-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .75rem;
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: .75rem;
}

.input-with-hint { display: flex; flex-direction: column; gap: .25rem; }
.input-hint      { font-size: .78rem; color: #94a3b8; }

/* Stock emballages */
.stock-qty           { font-weight: 700; font-size: 1rem; color: #1e293b; }
.stock-qty-alerte    { color: #dc2626; }
.stock-mini-label    { font-size: .8rem; color: #94a3b8; margin-left: .3rem; }
.stock-alerte-badge  { margin-left: .4rem; }

/* Étoile défaut emballage */
.star-defaut {
    font-size: 1.1rem;
    line-height: 1;
    flex-shrink: 0;
}
.star-on  { color: #f59e0b; cursor: default; }
.star-off {
    color: #cbd5e1;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: color .15s;
}
.star-off:hover { color: #f59e0b; }

.stock-header-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    max-width: 640px;
}
.stock-header-alerte { border-color: #fca5a5; background: #fff5f5; }

.stock-header-num    { font-size: 2.5rem; font-weight: 800; color: #1e293b; line-height: 1; }
.stock-header-label  { font-size: .85rem; color: #64748b; display: block; }
.stock-header-qty    { display: flex; flex-direction: column; align-items: center; }
.stock-header-mini   { font-size: .9rem; color: #475569; display: flex; align-items: center; gap: .4rem; }

.stock-mini-dot { width: .6rem; height: .6rem; border-radius: 50%; display: inline-block; }
.dot-vert       { background: #22c55e; }
.dot-rouge      { background: #dc2626; }

.mouvement-delta      { font-weight: 700; font-size: .95rem; }
.delta-plus           { color: #16a34a; }
.delta-moins          { color: #dc2626; }

.requis {
    color: #dc2626;
}

.btn-annuler:hover {
    color: #1e293b;
}

/* =============================================
   PHASE 3 — Vagues & Préparation
   ============================================= */

/* Badges état */
.badge {
    display: inline-block;
    padding: .2rem .55rem;
    border-radius: 4px;
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: uppercase;
}
.badge-lancee             { background: #dbeafe; color: #1d4ed8; }
.badge-en_cours           { background: #dcfce7; color: #15803d; }
.badge-terminee           { background: #f1f5f9; color: #475569; }
.badge-cloturee_partiellement { background: #fef9c3; color: #854d0e; }
.badge-manquant           { background: #fee2e2; color: #b91c1c; }
.badge-preleve_partiel    { background: #fef9c3; color: #92400e; }

/* Actions dans tableau */
.cell-actions { white-space: nowrap; }

.btn-primaire { background: #2563eb; color: #fff; border-color: #2563eb; }
.btn-primaire:hover { background: #1d4ed8; border-color: #1d4ed8; background: #1d4ed8; }

.btn-succes { background: #15803d; color: #fff; border-color: #15803d; }
.btn-succes:hover { background: #166534; }

.btn-large { font-size: 1.05rem; padding: .6rem 1.4rem; }

.btn-retour {
    display: inline-block;
    font-size: .9rem;
    color: #64748b;
    text-decoration: none;
    margin-bottom: .4rem;
}
.btn-retour:hover { color: #1e293b; }

.gris { color: #94a3b8; font-style: italic; }
.vide { color: #94a3b8; padding: 1rem 0; }

/* ---- Liste vagues ---- */
/* (hérite de data-table) */

/* ---- Scan chariot ---- */
.scanner-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 2rem;
    align-items: start;
}

/* Grille bataille navale */
.scanner-grille-bloc h3 {
    font-size: .95rem;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: .75rem;
}

.bn-grille {
    display: grid;
    /* 1 col en-tête-ligne + N colonnes lettres */
    grid-template-columns: 2rem repeat(var(--bn-cols), 1fr);
    gap: .3rem;
}

.bn-coin,
.bn-header-col,
.bn-header-row {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
}

.bn-header-col {
    padding: .3rem 0;
    border-bottom: 2px solid #e2e8f0;
}

.bn-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: .5rem .25rem;
    min-height: 64px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    background: #f8fafc;
    text-align: center;
    gap: .1rem;
}

.bn-cell-ok {
    border-color: #86efac;
    background: #f0fdf4;
}

.bn-cell-neutre {
    border-color: #cbd5e1;
    background: #f1f5f9;
}

.bn-cell-neutre .bn-pos  { color: #94a3b8; }
.bn-cell-neutre .bn-ref  { color: #64748b; }
.bn-cell-neutre .bn-bac  { color: #94a3b8; }

.bn-cell-next {
    border-color: #2563eb;
    background: #eff6ff;
    box-shadow: 0 0 0 3px #93c5fd;
    animation: pulse-next 1.4s ease-in-out infinite;
}

@keyframes pulse-next {
    0%, 100% { box-shadow: 0 0 0 3px #93c5fd; }
    50%       { box-shadow: 0 0 0 6px #bfdbfe; }
}

.bn-pos {
    font-size: .65rem;
    font-weight: 700;
    color: #94a3b8;
    font-family: monospace;
}

.bn-cell-next .bn-pos { color: #1d4ed8; }

/* Couleurs par bac du groupe actif (c1..c5) */
.bn-cell-c1 { border-color: #2563eb; background: #eff6ff; }
.bn-cell-c2 { border-color: #ea580c; background: #fff7ed; }
.bn-cell-c3 { border-color: #7c3aed; background: #f5f3ff; }
.bn-cell-c4 { border-color: #0d9488; background: #f0fdfa; }
.bn-cell-c5 { border-color: #e11d48; background: #fff1f2; }

.bn-cell-c1 .bn-pos { color: #1d4ed8; }
.bn-cell-c2 .bn-pos { color: #c2410c; }
.bn-cell-c3 .bn-pos { color: #6d28d9; }
.bn-cell-c4 .bn-pos { color: #0f766e; }
.bn-cell-c5 .bn-pos { color: #be123c; }

.bn-ref {
    font-size: .7rem;
    font-weight: 700;
    color: #1e293b;
    font-family: monospace;
    word-break: break-all;
}

.bn-bac {
    font-size: .65rem;
    color: #64748b;
}

.bn-next-label {
    font-size: .7rem;
    font-weight: 600;
    color: #1d4ed8;
}

/* Label face (double face) */
.bn-face-label {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #475569;
    margin-bottom: .4rem;
    margin-top: .75rem;
    padding: .2rem .5rem;
    background: #f1f5f9;
    border-radius: 4px;
    display: inline-block;
}

.bn-face-label:first-child { margin-top: 0; }

/* Panneau action scanner */
.scanner-action-bloc {
    position: sticky;
    top: 1rem;
}

.scanner-etape {
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 1.5rem;
}

.etape-num {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #2563eb;
    margin-bottom: .4rem;
}

.scanner-etape h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 1.25rem;
}

/* Position cible mise en avant */
.scanner-position-cible {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #eff6ff;
    border: 2px solid #2563eb;
    border-radius: 8px;
    padding: .75rem 1rem;
    margin-bottom: 1rem;
    text-align: center;
}

.scanner-pos-label {
    font-size: .8rem;
    color: #475569;
    font-weight: 500;
    margin-bottom: .3rem;
}

.scanner-pos-value {
    font-size: 3rem;
    font-weight: 900;
    color: #1d4ed8;
    line-height: 1;
    font-family: monospace;
}

/* Info commande (pour information, pas de choix) */
.scanner-commande-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #f8fafc;
    border-radius: 6px;
    padding: .6rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid #e2e8f0;
    text-align: center;
}

.scanner-cmd-ref {
    font-size: 1rem;
    font-weight: 700;
    font-family: monospace;
    color: #1e293b;
}

.scanner-cmd-client {
    font-size: .85rem;
    color: #64748b;
    margin-top: .15rem;
}

.scanner-scan-form {
    margin-top: .5rem;
}

/* Bac position dans grille prépa */
.bac-pos {
    font-size: .65rem;
    font-weight: 800;
    color: #1d4ed8;
    font-family: monospace;
}


/* ---- En-tête préparation ---- */
.prep-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.prep-titre {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.prep-titre h1 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.prep-progress {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex: 1;
    max-width: 320px;
}

.progress-label {
    font-size: .9rem;
    color: #64748b;
    white-space: nowrap;
}

.progress-bar-wrap {
    flex: 1;
    height: 10px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: #2563eb;
    border-radius: 999px;
    transition: width .3s ease;
}

/* ---- Layout préparation ---- */
.prep-layout {
    display: grid;
    grid-template-columns: 1fr 240px;
    gap: 1.5rem;
    align-items: start;
    margin-bottom: 2rem;
}

/* ---- Coordonnées emplacement ---- */
.emplacement-coords {
    display: flex;
    gap: .6rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.coord-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: .5rem .9rem;
    min-width: 70px;
}

.coord-label {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #64748b;
    font-weight: 600;
    margin-bottom: .2rem;
}

.coord-val {
    font-size: 1.7rem;
    font-weight: 800;
    color: #1e293b;
    line-height: 1;
}

/* ---- Lignes à prélever ---- */
.emplacement-lignes {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ligne-prelevement {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}

.ligne-prelevement.ligne-manquant {
    border-color: #fca5a5;
}

.ligne-prelevement.ligne-partiel {
    border-color: #fde68a;
}

/* Indicateur couleur : bandeau gauche coloré */
.ligne-prelevement.ligne-c1 { border-left: 5px solid #2563eb; }
.ligne-prelevement.ligne-c2 { border-left: 5px solid #ea580c; }
.ligne-prelevement.ligne-c3 { border-left: 5px solid #7c3aed; }
.ligne-prelevement.ligne-c4 { border-left: 5px solid #0d9488; }
.ligne-prelevement.ligne-c5 { border-left: 5px solid #e11d48; }

/* Ligne 1 : infos article */
.lp-top {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: .9rem 1.2rem;
    border-bottom: 1px solid #f1f5f9;
    flex-wrap: wrap;
}

.lp-article {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    flex: 1;
    min-width: 120px;
}

.lp-ref {
    font-weight: 800;
    font-size: 1.15rem;
    color: #1e293b;
    font-family: monospace;
    letter-spacing: .04em;
}

.lp-ean {
    font-size: .78rem;
    font-family: monospace;
    color: #94a3b8;
    letter-spacing: .05em;
}

.lp-designation {
    font-size: .82rem;
    color: #475569;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
}

/* Bloc quantité : centré, mis en avant */
.lp-qty-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #eff6ff;
    border: 1.5px solid #bfdbfe;
    border-radius: 8px;
    padding: .4rem .85rem;
    min-width: 64px;
    text-align: center;
}

.lp-qty-label {
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #3b82f6;
    line-height: 1;
    margin-bottom: .15rem;
}

.lp-qty-num {
    font-size: 2rem;
    font-weight: 900;
    color: #1d4ed8;
    line-height: 1;
}

.qte-prelevee {
    font-size: .8rem;
    color: #d97706;
    font-weight: 600;
}

/* Bloc bac destination */
.lp-bac {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .2rem;
}

.bac-fleche {
    display: none;
}

.bac-cible {
    background: #1e293b;
    color: #fff;
    font-weight: 800;
    font-family: monospace;
    font-size: 1.05rem;
    padding: .3rem .75rem;
    border-radius: 6px;
    letter-spacing: .05em;
}

.lp-commande {
    font-size: .75rem;
    color: #94a3b8;
    font-family: monospace;
}

/* Ligne 2 : actions */
.lp-actions {
    display: flex;
    gap: .6rem;
    align-items: center;
    padding: .7rem 1.2rem;
    background: #f8fafc;
    flex-wrap: wrap;
}

.lp-actions-danger {
    display: flex;
    gap: .6rem;
    align-items: center;
    margin-left: auto;
    flex-wrap: wrap;
}

.form-partiel {
    display: flex;
    align-items: center;
    gap: .35rem;
}

.partiel-label {
    font-size: .8rem;
    color: #64748b;
    white-space: nowrap;
}

.form-prelever {
    display: flex;
    align-items: center;
    gap: .4rem;
}

.input-qte {
    width: 52px;
    padding: .35rem .4rem;
    border: 1.5px solid #cbd5e1;
    border-radius: 5px;
    font-size: .9rem;
    font-weight: 600;
    text-align: center;
    color: #1e293b;
    -moz-appearance: textfield;
    appearance: textfield;
}
.input-qte::-webkit-inner-spin-button,
.input-qte::-webkit-outer-spin-button { -webkit-appearance: none; }

.btn-preleve {
    background: #15803d;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: .5rem 1.1rem;
    font-size: .95rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.btn-preleve:hover { background: #166534; }

.btn-manquant {
    background: #dc2626;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: .5rem 1.1rem;
    font-size: .95rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.btn-manquant:hover { background: #b91c1c; }

.btn-partiel {
    background: #ea580c;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: .5rem 1.1rem;
    font-size: .95rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.btn-partiel:hover { background: #c2410c; }

/* ---- Grille chariot (bataille navale) ---- */
.prep-chariot-grille {
    position: sticky;
    top: 1rem;
}

.prep-chariot-grille h3 {
    font-size: .75rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .1em;
    margin-bottom: .35rem;
    text-align: center;
}

.prep-chariot-grille h3 span.chariot-nom {
    display: block;
    font-size: 1.25rem;
    font-weight: 900;
    color: #1e293b;
    letter-spacing: .04em;
    text-transform: none;
    margin-top: .1rem;
}

/* Bandeau de bacs colorés */
.bac-strip {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-bottom: .75rem;
}

.bac-strip-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: .35rem .55rem;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    background: #f8fafc;
    min-width: 62px;
    text-align: center;
    gap: .1rem;
}

.bs-pos {
    font-size: .6rem;
    font-weight: 700;
    color: #94a3b8;
    font-family: monospace;
}

.bs-num {
    font-size: .78rem;
    font-weight: 700;
    color: #1e293b;
}

.bs-ref {
    font-size: .6rem;
    color: #64748b;
}

.bac-strip-item.bs-c1 { border-color: #2563eb; background: #eff6ff; }
.bac-strip-item.bs-c2 { border-color: #ea580c; background: #fff7ed; }
.bac-strip-item.bs-c3 { border-color: #7c3aed; background: #f5f3ff; }
.bac-strip-item.bs-c4 { border-color: #0d9488; background: #f0fdfa; }
.bac-strip-item.bs-c5 { border-color: #e11d48; background: #fff1f2; }

.bac-strip-item.bs-c1 .bs-num,
.bac-strip-item.bs-c1 .bs-pos { color: #1d4ed8; }
.bac-strip-item.bs-c2 .bs-num,
.bac-strip-item.bs-c2 .bs-pos { color: #c2410c; }
.bac-strip-item.bs-c3 .bs-num,
.bac-strip-item.bs-c3 .bs-pos { color: #6d28d9; }
.bac-strip-item.bs-c4 .bs-num,
.bac-strip-item.bs-c4 .bs-pos { color: #0f766e; }
.bac-strip-item.bs-c5 .bs-num,
.bac-strip-item.bs-c5 .bs-pos { color: #be123c; }

.bac-grille {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .4rem;
}

.bac-cellule {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: .5rem .3rem;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    background: #f8fafc;
}

.bac-cellule.bac-cible-active {
    border-color: #2563eb;
    background: #eff6ff;
    box-shadow: 0 0 0 2px #93c5fd;
}

.bac-numero {
    font-size: .7rem;
    font-weight: 700;
    color: #1e293b;
    font-family: monospace;
}

.bac-cmd {
    font-size: .65rem;
    color: #64748b;
    margin-top: .15rem;
    text-align: center;
}

/* ---- Prochains emplacements ---- */
.prep-prochains {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 2px dashed #e2e8f0;
}

.prep-prochains h3 {
    font-size: .95rem;
    font-weight: 700;
    color: #64748b;
    margin-bottom: .75rem;
    display: flex;
    align-items: baseline;
    gap: .75rem;
}

.prochains-hint {
    font-size: .75rem;
    font-weight: 400;
    color: #94a3b8;
    font-style: italic;
}

.prochain-row {
    cursor: pointer;
    transition: background .1s;
}

.prochain-row:hover td {
    background: #dbeafe;
    color: #1d4ed8;
    font-weight: 600;
}

.prochain-row:hover td:first-child {
    border-left: 4px solid #2563eb;
}

/* ---- Terminé ---- */
.prep-termine {
    text-align: center;
    padding: 2.5rem;
    background: #f0fdf4;
    border: 1.5px solid #bbf7d0;
    border-radius: 8px;
}

.prep-termine p {
    font-size: 1.1rem;
    font-weight: 600;
    color: #15803d;
    margin-bottom: 1.25rem;
}

/* ---- Synthèse ---- */
.synthese-bloc {
    max-width: 760px;
}

.synthese-info {
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

.synthese-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid #e2e8f0;
    flex-wrap: wrap;
}

.synthese-message-emballage {
    flex: 1;
    padding: .9rem 1.2rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    color: #166534;
    font-weight: 600;
    font-size: .95rem;
}

.synthese-message-partielle {
    background: #fefce8;
    border-color: #fde68a;
    color: #92400e;
}

.synthese-alerte-bac {
    padding: .7rem 1.2rem;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 8px;
    color: #9a3412;
    font-weight: 600;
    font-size: .95rem;
    flex-basis: 100%;
}

.synthese-alerte-bac::first-letter {
    color: #ea580c;
    font-weight: 900;
}

.succes-inline {
    color: #15803d;
    font-weight: 600;
    padding: 1rem;
    background: #f0fdf4;
    border-radius: 6px;
    border: 1px solid #bbf7d0;
}

/* ============================================================
   SECTION ADMIN
   ============================================================ */

.admin-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-top: 1rem;
}

.admin-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    text-decoration: none;
    color: #1e293b;
    gap: .5rem;
    transition: border-color .15s, box-shadow .15s;
}

.admin-card:hover {
    border-color: #2563eb;
    box-shadow: 0 2px 12px rgba(37, 99, 235, .1);
}

.admin-card-icon  { font-size: 2rem; display: flex; align-items: center; justify-content: center; }
.admin-card-icon svg { display: block; }
.admin-card-label { font-size: 1.1rem; font-weight: 700; }
.admin-card-desc  { font-size: .8rem; color: #64748b; text-align: center; }

/* Page header — group left (back link + title) */
.page-header-left {
    display: flex;
    align-items: center;
    gap: .75rem;
}

/* Danger link (supprimer inline) */
.btn-danger-lien {
    color: #dc2626;
    background: none;
    border: none;
    cursor: pointer;
    font-size: .875rem;
    padding: .25rem .5rem;
    border-radius: 4px;
    text-decoration: none;
}
.btn-danger-lien:hover { background: #fef2f2; color: #b91c1c; }

/* Vague link inside table cell */
.cell-vague-lien {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    text-decoration: none;
    color: #2563eb;
    white-space: nowrap;
    font-weight: 500;
}
.cell-vague-lien:hover { text-decoration: underline; }

/* Chariot / bac state badges */
.badge-reserve    { background: #fef3c7; color: #92400e; }
.badge-libre      { background: #f0fdf4; color: #166534; }
.badge-disponible { background: #f0fdf4; color: #166534; }
.badge-emballage  { background: #dbeafe; color: #1e40af; }
.badge-urgent     { background: #fee2e2; color: #991b1b; font-weight: 700; letter-spacing: .03em; }
.badge-controle   { background: #fed7aa; color: #9a3412; font-weight: 700; }

.row-manquant td { background: #fff7ed; }

/* Rôles utilisateurs */
.badge-role-admin       { background: #ede9fe; color: #5b21b6; }
.badge-role-preparateur { background: #e0f2fe; color: #0369a1; }

/* ============================================================
   HISTORIQUE
   ============================================================ */

.historique-filtres {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem 1.25rem;
    align-items: flex-end;
    padding: 1rem 1.25rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.filtre-group {
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

.filtre-group label {
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #64748b;
}

.filtre-group input[type="date"],
.filtre-group input[type="text"],
.filtre-group select {
    padding: .35rem .6rem;
    border: 1.5px solid #cbd5e1;
    border-radius: 5px;
    font-size: .9rem;
    background: #fff;
}

.filtre-actions {
    flex-direction: row;
    align-items: center;
    gap: .5rem;
    margin-top: auto;
}

.historique-nb {
    font-size: .85rem;
    color: #64748b;
    margin-bottom: .5rem;
}

/* ── Statistiques ── */
.stat-tabs {
    display: flex;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 1.25rem;
    gap: 0;
}

.stat-tab {
    padding: .55rem 1.25rem;
    font-size: .875rem;
    font-weight: 600;
    color: #6b7280;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color .15s, border-color .15s;
}

.stat-tab:hover { color: #1e293b; }
.stat-tab.active { color: #2563eb; border-bottom-color: #2563eb; }

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

.stat-bar-wrap {
    display: flex;
    align-items: center;
    gap: .5rem;
    height: 18px;
}

.stat-bar-fill {
    height: 10px;
    border-radius: 99px;
    background: #2563eb;
    min-width: 2px;
    transition: width .3s;
}

.stat-bar-fill.stat-bar-green { background: #22c55e; }
.stat-bar-fill.stat-bar-amber { background: #f59e0b; }

.stat-bar-label {
    font-size: .75rem;
    color: #64748b;
    white-space: nowrap;
}

/* Charts */
.stat-chart-card {
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 1rem 1.25rem 1.25rem;
    flex: 1;
}

.stat-chart-title {
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #64748b;
    margin-bottom: .75rem;
}

.stat-chart-row {
    display: flex;
    gap: 1rem;
}

@media (max-width: 700px) {
    .stat-chart-row { flex-direction: column; }
}

/* Detail commande block */
.historique-commande {
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 1.25rem;
    overflow: hidden;
}

.historique-commande-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .65rem 1rem;
    background: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
    font-size: .9rem;
}

.historique-emballage-info {
    margin-left: auto;
    font-size: .85rem;
    color: #475569;
}

.historique-lignes-table {
    border: none;
    margin: 0;
}

.historique-lignes-table th,
.historique-lignes-table td {
    border-top: none;
}

/* ============================================================
   EMBALLAGE
   ============================================================ */

.emballage-count {
    font-size: .95rem;
    color: #64748b;
    font-weight: 500;
}

.emballage-scan-form {
    display: flex;
    gap: .75rem;
    align-items: center;
    margin-top: .5rem;
}

.emballage-scan-input {
    flex: 1;
    max-width: 420px;
    padding: .55rem .85rem;
    border: 2px solid #cbd5e1;
    border-radius: 7px;
    font-size: 1rem;
    outline: none;
    transition: border-color .15s;
}
.emballage-scan-input:focus { border-color: #2563eb; }

.badge-emballage { background: #fef3c7; color: #92400e; }
.badge-vague-verrou {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fca5a5;
    border-radius: 5px;
    padding: .25rem .6rem;
    font-size: .8rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Progress bar emballage */
.emballage-progress-bar-wrap {
    background: #e2e8f0;
    border-radius: 99px;
    height: 10px;
    margin: .75rem 0 .4rem;
    overflow: hidden;
    max-width: 480px;
}
.emballage-progress-bar-inner {
    height: 100%;
    background: #15803d;
    border-radius: 99px;
    transition: width .3s;
}
.emballage-progress-label {
    font-size: .9rem;
    color: #475569;
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1.25rem;
}

/* Article rows in emballage detail */
.emb-ligne-ok td { background: #f0fdf4; }
.emb-ligne-attente td { background: #fff; }
.emb-ligne-sans_ean td { background: #f8fafc; color: #94a3b8; }

/* Emballage meta (commande + client in header) */
.emballage-meta {
    display: flex;
    align-items: center;
    gap: .75rem;
    font-size: .95rem;
    color: #475569;
}

/* ============================================================
   DASHBOARD
   ============================================================ */

.dash-date {
    font-size: .9rem;
    color: #64748b;
    font-weight: 400;
}

/* Bloc générique */
.dash-bloc {
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
}

.dash-bloc-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.dash-bloc-header .dash-section-title {
    margin-bottom: 0;
}

/* Mini KPIs inline (vagues) */
.dash-mini-kpis {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

.dash-mini-kpi {
    font-size: .78rem;
    font-weight: 600;
    padding: .2rem .6rem;
    border-radius: 99px;
    white-space: nowrap;
}

.dash-mini-lancee    { background: #dbeafe; color: #1d4ed8; }
.dash-mini-en_cours  { background: #dcfce7; color: #15803d; }
.dash-mini-terminee  { background: #f1f5f9; color: #475569; }
.dash-mini-partielle { background: #fef9c3; color: #854d0e; }

/* Progress bar dans tableau vagues */
.dash-prog-wrap {
    height: 6px;
    background: #e2e8f0;
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: .25rem;
    min-width: 80px;
}

.dash-prog-bar {
    height: 100%;
    background: #2563eb;
    border-radius: 99px;
    transition: width .3s;
}

.dash-prog-label {
    font-size: .78rem;
    color: #64748b;
}

/* KPI Cards */
.dash-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.dash-kpi {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.25rem 1rem;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    gap: .25rem;
    text-align: center;
}

.dash-kpi-value {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1;
    color: #1e293b;
}

.dash-kpi-label {
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #64748b;
}

.dash-kpi-total  { border-color: #e2e8f0; background: #f8fafc; }
.dash-kpi-green  { border-color: #86efac; background: #f0fdf4; }
.dash-kpi-green .dash-kpi-value  { color: #15803d; }
.dash-kpi-blue   { border-color: #93c5fd; background: #eff6ff; }
.dash-kpi-blue .dash-kpi-value   { color: #2563eb; }
.dash-kpi-gray   { border-color: #cbd5e1; background: #f8fafc; }
.dash-kpi-gray .dash-kpi-value   { color: #475569; }
.dash-kpi-red    { border-color: #fca5a5; background: #fef2f2; }
.dash-kpi-red .dash-kpi-value    { color: #dc2626; }

/* Main layout commandes */
.dash-main {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 1.5rem;
    align-items: start;
}

.dash-section-title {
    font-size: .85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #475569;
    margin-bottom: .9rem;
}

/* Chart bloc */
.dash-chart-bloc {
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.25rem;
}

.dash-chart-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
}

.dash-chart-wrap canvas {
    max-width: 180px;
    max-height: 180px;
}

.dash-chart-legend {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    width: 100%;
}

.dash-legend-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .85rem;
    color: #475569;
}

.dash-legend-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* List bloc */
.dash-list-bloc {
    min-width: 0;
}

/* ============================================================
   RESPONSIVE — mobile (≤ 640px) & tablette (≤ 900px)
   ============================================================ */

/* ---- Topbar ---- */
@media (max-width: 640px) {
    .topbar {
        flex-wrap: wrap;
        gap: .4rem;
        padding: .6rem 1rem;
    }

    /* Logo prend toute la largeur disponible, user se met à droite */
    .topbar-title {
        flex: 1;
    }

    /* Nav passe sur une 2e ligne, scrollable horizontalement */
    .topbar-nav {
        order: 3;
        width: 100%;
        overflow-x: auto;
        gap: .75rem;
        padding-bottom: .15rem;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .topbar-nav::-webkit-scrollbar { display: none; }

    .topbar-user {
        font-size: .8rem;
        gap: .6rem;
        white-space: nowrap;
    }

    .page-content {
        padding: 1rem;
    }
}

/* ---- Tables → cartes sur mobile ---- */
@media (max-width: 640px) {
    /* Cache les en-têtes */
    .data-table thead { display: none; }

    .data-table,
    .data-table tbody,
    .data-table tr,
    .data-table td {
        display: block;
        width: 100%;
    }

    .data-table tr {
        border: 1.5px solid #e2e8f0;
        border-radius: 8px;
        margin-bottom: .75rem;
        background: #fff;
        padding: .5rem 0;
        overflow: hidden;
    }

    .data-table td {
        border-bottom: none;
        padding: .35rem 1rem;
        font-size: .9rem;
    }

    /* Affiche le label de colonne en pseudo-élément */
    .data-table td[data-label]::before {
        content: attr(data-label) ' : ';
        font-size: .75rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .04em;
        color: #94a3b8;
        display: block;
    }

    .cell-actions {
        padding-top: .5rem;
        border-top: 1px solid #f1f5f9;
        white-space: normal;
    }
}

/* ---- Page préparation vague ---- */
@media (max-width: 900px) {
    .prep-layout {
        grid-template-columns: 1fr;
    }

    /* Cache la grille chariot latérale, on la met en bas */
    .prep-chariot-grille {
        position: static;
    }
}

@media (max-width: 640px) {
    .prep-header {
        flex-direction: column;
        align-items: flex-start;
        gap: .75rem;
    }

    .prep-progress {
        width: 100%;
        max-width: 100%;
    }

    .emplacement-coords {
        gap: .4rem;
    }

    .coord-val {
        font-size: 1.3rem;
    }

    .lp-top {
        gap: .75rem;
        padding: .75rem 1rem;
    }

    .lp-qty-num {
        font-size: 1.5rem;
    }

    .lp-designation {
        max-width: 100%;
        white-space: normal;
    }

    .lp-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .lp-actions-danger {
        margin-left: 0;
    }
}

/* ---- Scanner chariot ---- */
@media (max-width: 900px) {
    .scanner-layout {
        grid-template-columns: 1fr;
    }

    .scanner-action-bloc {
        position: static;
        order: -1;
    }
}

/* ---- Emballage ---- */
@media (max-width: 640px) {
    .emballage-scan-form {
        flex-direction: column;
        align-items: stretch;
    }

    .emballage-scan-input {
        max-width: 100%;
    }
}

/* ---- Dashboard KPIs ---- */
@media (max-width: 900px) {
    .dash-main {
        grid-template-columns: 1fr;
    }

    .dash-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .dash-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: .5rem;
    }

    .dash-kpi-value {
        font-size: 1.75rem;
    }
}

/* ---- Page login ---- */
@media (max-width: 480px) {
    .login-wrapper {
        margin-top: 0;
        border-radius: 0;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
}

