:root {
    --bg: #F5EFE6;
    --ink: #1A1410;
    --ink-soft: #44362B;
    --ink-muted: #7A685A;
    --orange: #E8782D;
    --orange-deep: #C25A1F;
    --leaf: #2D4A3E;
    --cream: #FAF6F0;
    --sidebar: #1A1410;
    --border: rgba(26, 20, 16, 0.10);
    --panel: #FFFFFF;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

/* ─── Shell ─── */
.admin-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.admin-main { overflow-x: auto; }
.admin-content { padding: 40px 48px; max-width: 1400px; }

/* ─── Sidebar ─── */
.admin-sidebar {
    background: var(--sidebar);
    color: var(--cream);
    display: flex;
    flex-direction: column;
    padding: 28px 0;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sidebar-brand { padding: 0 28px 32px; }
.sidebar-logo {
    font-family: 'Fraunces', serif;
    font-weight: 700;
    font-size: 24px;
    display: block;
    line-height: 1;
}
.sidebar-sub {
    font-size: 10px;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--orange);
    margin-top: 4px;
    display: block;
}
.sidebar-nav { list-style: none; flex: 1; padding: 0 16px; }
.sidebar-nav li { margin-bottom: 4px; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    color: rgba(250, 246, 240, 0.7);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
}
.sidebar-nav a:hover { background: rgba(255,255,255,0.06); color: var(--cream); }
.sidebar-nav a.active { background: var(--orange); color: white; }
.nav-ico { font-size: 16px; }

.sidebar-footer { padding: 16px 28px 0; border-top: 1px solid rgba(255,255,255,0.1); }
.sidebar-user { margin-bottom: 12px; }
.user-name { font-size: 13px; color: rgba(250,246,240,0.85); }
.logout-btn {
    width: 100%;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: rgba(250,246,240,0.8);
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    transition: all 0.15s;
}
.logout-btn:hover { background: rgba(255,255,255,0.08); color: var(--cream); }

/* ─── Titres ─── */
.page-title {
    font-family: 'Fraunces', serif;
    font-weight: 500;
    font-size: 36px;
    letter-spacing: -0.02em;
    margin-bottom: 28px;
}
.page-head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 28px; }
.page-head .page-title { margin-bottom: 0; }
.page-count { color: var(--ink-muted); font-size: 14px; }
.muted { color: var(--ink-muted); font-size: 14px; }

/* ─── Stat cards ─── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}
.stat-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
}
.stat-card--accent { background: var(--leaf); color: var(--cream); border-color: var(--leaf); }
.stat-label {
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin-bottom: 10px;
}
.stat-card--accent .stat-label { color: rgba(250,246,240,0.7); }
.stat-value { font-family: 'Fraunces', serif; font-size: 38px; font-weight: 600; line-height: 1; }
.stat-detail { font-size: 12px; color: var(--ink-muted); margin-top: 8px; }
.stat-card--accent .stat-detail { color: rgba(250,246,240,0.7); }

/* ─── Panels ─── */
.dashboard-cols { display: grid; grid-template-columns: 1.6fr 1fr; gap: 24px; }
.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
}
.panel-title { font-family: 'Fraunces', serif; font-size: 18px; font-weight: 600; margin-bottom: 16px; }

/* ─── Tables ─── */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th {
    text-align: left;
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-muted);
    padding: 10px 12px;
    border-bottom: 2px solid var(--border);
}
.data-table td { padding: 12px; border-bottom: 1px solid var(--border); }
.data-table tr:hover td { background: var(--bg); }
.cell-name { font-weight: 500; }
.cell-thumb { width: 56px; }
.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; display: block; }
.thumb--emoji {
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; background: var(--bg); border-radius: 6px;
}

/* ─── Badges ─── */
.badge {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 99px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.badge--online { background: #DCFCE7; color: #166534; }
.badge--store { background: #FEF3C7; color: #92400E; }
.badge--hidden { background: #E5E7EB; color: #4B5563; }
.badge--pending { background: #FEF3C7; color: #92400E; }
.badge--paid { background: #DBEAFE; color: #1E40AF; }
.badge--preparing { background: #E0E7FF; color: #3730A3; }
.badge--shipped { background: #DCFCE7; color: #166534; }
.badge--delivered { background: #D1FAE5; color: #065F46; }
.badge--cancelled { background: #FEE2E2; color: #991B1B; }

/* ─── Toolbar ─── */
.toolbar { display: flex; gap: 12px; margin-bottom: 20px; }
.search-input, .filter-select {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    background: var(--panel);
}
.search-input { flex: 1; max-width: 360px; }

/* ─── Low stock ─── */
.low-stock-list { list-style: none; }
.low-stock-list li {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px;
}
.stock-badge { font-size: 12px; color: #B45309; font-weight: 600; }
.stock-badge--late { color: #B91C1C; }

/* ─── Empty ─── */
.empty-state { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 48px; text-align: center; }
.empty-state p { margin-bottom: 8px; }
.access-denied { padding: 48px; }

/* ─── Login ─── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--sidebar);
}
.login-card {
    background: var(--cream);
    border-radius: 16px;
    padding: 48px;
    width: 100%;
    max-width: 400px;
}
.login-brand { text-align: center; margin-bottom: 32px; }
.login-logo { font-family: 'Fraunces', serif; font-weight: 700; font-size: 32px; display: block; }
.login-sub { font-size: 10px; letter-spacing: 0.25em; text-transform: uppercase; color: var(--orange); }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-form label { font-size: 13px; font-weight: 600; display: flex; flex-direction: column; gap: 6px; }
.login-form input {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    background: white;
}
.login-btn {
    background: var(--ink);
    color: var(--cream);
    border: none;
    padding: 14px;
    border-radius: 999px;
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 8px;
    transition: background 0.2s;
}
.login-btn:hover { background: var(--orange); }
.login-error {
    background: #FEE2E2; color: #991B1B;
    padding: 12px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; text-align: center;
}
.login-hint { font-size: 11px; color: var(--ink-muted); text-align: center; margin-top: 20px; line-height: 1.6; }
.login-hint code { background: rgba(0,0,0,0.06); padding: 1px 5px; border-radius: 3px; }

/* Éléments mobiles : cachés sur grand écran (ne doivent pas devenir des cellules de la grille). */
.nav-toggle, .mobile-topbar, .nav-backdrop { display: none; }

@media (max-width: 900px) {
    .admin-shell { display: block; }
    .admin-main { min-width: 0; }
    .admin-content { padding: 20px 16px 48px; }
    .page-title { font-size: 26px; }

    /* Barre du haut + tiroir de navigation */
    .mobile-topbar {
        display: flex; align-items: center; gap: 8px;
        position: sticky; top: 0; z-index: 40;
        height: 54px; padding: 0 8px;
        background: var(--sidebar); color: var(--cream);
    }
    .burger { font-size: 26px; line-height: 1; padding: 10px 12px; cursor: pointer; user-select: none; }
    .mobile-brand { font-family: 'Fraunces', serif; font-weight: 700; font-size: 20px; }
    .admin-sidebar {
        position: fixed; top: 0; left: 0; bottom: 0; z-index: 60;
        width: 280px; max-width: 85vw; height: 100vh; height: 100dvh;
        overflow-y: auto; transform: translateX(-100%); transition: transform 0.2s ease;
    }
    .sidebar-nav a { padding: 14px 16px; }
    .nav-backdrop {
        display: block; position: fixed; inset: 0; z-index: 50;
        background: rgba(0, 0, 0, 0.45); opacity: 0; pointer-events: none; transition: opacity 0.2s;
    }
    .nav-toggle:checked ~ .admin-sidebar { transform: none; }
    .nav-toggle:checked ~ .nav-backdrop { opacity: 1; pointer-events: auto; }

    .stat-grid { grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
    .stat-card { padding: 16px; }
    .stat-value { font-size: 28px; }
    .dashboard-cols { grid-template-columns: 1fr; }
    .panel { padding: 16px; }

    .page-head { flex-wrap: wrap; row-gap: 10px; }
    .toolbar { flex-wrap: wrap; }
    .toolbar .search-input, .toolbar .filter-select { flex: 1 1 100%; }
    .edit-bar { flex-wrap: wrap; }
    .edit-bar .btn-run, .panel > .btn-run { width: 100%; }
    .btn-ghost-sm, .btn-new, .btn-run { min-height: 44px; }
    .modal { width: calc(100vw - 32px); }
}

/* Tableaux « en cartes » sur mobile (une ligne = une carte, libellés via data-label) */
@media (max-width: 700px) {
    .data-table--stack, .data-table--stack tbody, .data-table--stack tr, .data-table--stack td { display: block; width: 100%; }
    .data-table--stack thead { display: none; }
    .data-table--stack tr {
        background: var(--cream); border: 1px solid var(--border); border-radius: 10px;
        padding: 8px 14px; margin-bottom: 10px;
    }
    .data-table--stack td {
        display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
        border: 0; padding: 5px 0; text-align: right;
    }
    .data-table--stack td::before {
        content: attr(data-label); flex-shrink: 0; text-align: left;
        font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-muted);
    }
    .data-table--stack tr:hover td { background: transparent; }
}
@media (max-width: 380px) {
    .stat-grid { grid-template-columns: 1fr; }
}

/* ════════ PAGE IMPORT ════════ */
.import-intro { max-width: 760px; margin-bottom: 28px; }
.import-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 24px; align-items: start; }

.field { margin-bottom: 20px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.text-input {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    background: var(--panel);
}
.field small { display: block; margin-top: 6px; }

.options { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; cursor: pointer; }
.check--primary span { color: var(--orange); font-weight: 600; }
.check--danger span { color: #B91C1C; }

.btn-run {
    background: var(--ink);
    color: var(--cream);
    border: none;
    padding: 13px 28px;
    border-radius: 999px;
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: background 0.2s;
}
.btn-run:hover:not(:disabled) { background: var(--orange); }
.btn-run:disabled { opacity: 0.5; cursor: wait; }
.dest-hint { display: block; margin-top: 14px; word-break: break-all; }

.alert-error {
    background: #FEE2E2; color: #991B1B;
    padding: 12px 14px; border-radius: 8px; font-size: 13px;
}

.result-stats {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
    font-size: 14px; margin-bottom: 24px;
}
.result-stats strong { font-family: 'Fraunces', serif; font-size: 20px; color: var(--orange); }
.result-stats .warn { color: #B45309; font-size: 12px; }

.breakdown-title { font-family: 'Fraunces', serif; font-size: 16px; margin: 8px 0 14px; }
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 160px 1fr 36px; align-items: center; gap: 10px; font-size: 13px; }
.bar-label { font-weight: 500; }
.bar-track { background: var(--bg); border-radius: 99px; height: 13px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 99px;
    background: linear-gradient(90deg, var(--orange), var(--orange-deep)); transition: width 0.4s; }
.bar-count { text-align: right; font-family: 'Fraunces', serif; font-weight: 600; }

.fallback {
    margin-top: 16px; padding: 12px 14px; background: #FEF3C7; color: #92400E;
    border-radius: 8px; font-size: 13px; line-height: 1.5;
}
.fallback code, .alert-error code, .import-intro code, .dest-hint code {
    background: rgba(0,0,0,0.06); padding: 1px 5px; border-radius: 3px;
}
.warnings { margin-top: 16px; font-size: 13px; }
.warnings summary { cursor: pointer; font-weight: 600; }
.warnings ul { margin: 10px 0 0 18px; max-height: 280px; overflow-y: auto; }
.warnings li { margin-bottom: 4px; color: var(--ink-soft); }

@media (max-width: 900px) {
    .import-grid { grid-template-columns: 1fr; }
    .bar-row { grid-template-columns: 110px 1fr 32px; }
}

/* ════════ CRUD PRODUITS (Lot 2) ════════ */
.page-head { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.page-count { color: var(--ink-muted); font-size: 14px; }
.btn-new {
    margin-left: auto; background: var(--ink); color: var(--cream); border: none;
    padding: 10px 20px; border-radius: 999px; font-family: inherit; font-weight: 600;
    font-size: 13px; cursor: pointer; transition: background 0.2s;
}
.btn-new:hover { background: var(--orange); }

.toolbar { display: flex; gap: 12px; margin-bottom: 20px; }
.search-input, .filter-select {
    padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px;
    font-family: inherit; font-size: 14px; background: var(--panel);
}
.search-input { flex: 1; }

.cell-thumb { width: 52px; }
.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; display: block; }
.thumb--emoji {
    display: flex; align-items: center; justify-content: center;
    background: var(--bg); font-size: 22px;
}
.cell-name { font-weight: 600; }
.row-link { color: var(--ink); text-decoration: none; }
.row-link:hover { color: var(--orange); }
.row-clickable { cursor: pointer; }
.row-clickable:hover td { background: var(--cream, rgba(0,0,0,.03)); }

.price-sale { color: var(--orange); font-weight: 700; }
.price-old { color: var(--ink-muted); text-decoration: line-through; font-size: 12px; margin-left: 6px; }

.cell-actions { white-space: nowrap; text-align: right; }
.act {
    display: inline-block; border: none; background: transparent; cursor: pointer;
    font-size: 15px; padding: 5px 7px; border-radius: 6px; text-decoration: none;
    color: var(--ink-soft); transition: background 0.15s, color 0.15s;
}
.act:hover { background: var(--bg); color: var(--ink); }
.act--danger:hover { background: #FEE2E2; color: #B91C1C; }

/* Modal de confirmation */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(20,15,10,0.45);
    display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal {
    background: var(--panel); border-radius: 14px; padding: 28px; max-width: 380px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.modal h3 { font-family: 'Fraunces', serif; font-size: 19px; margin: 0 0 8px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

.btn-ghost-sm {
    background: transparent; border: 1px solid var(--border); color: var(--ink);
    padding: 9px 18px; border-radius: 999px; font-family: inherit; font-weight: 600;
    font-size: 13px; cursor: pointer; transition: border-color 0.2s;
}
.btn-ghost-sm:hover { border-color: var(--ink); }
.btn-danger {
    background: #B91C1C; color: #fff; border: none; padding: 9px 18px; border-radius: 999px;
    font-family: inherit; font-weight: 600; font-size: 13px; cursor: pointer; transition: background 0.2s;
}
.btn-danger:hover { background: #991B1B; }

/* Édition produit */
.edit-grid { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; }
.edit-main { display: flex; flex-direction: column; gap: 24px; }
.edit-side { position: sticky; top: 24px; }
.field-row { display: flex; gap: 16px; }
.field-row .field { flex: 1; }

.img-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.img-item {
    display: flex; gap: 12px; padding: 8px; border: 1px solid var(--border);
    border-radius: 10px; align-items: center;
}
.img-item--primary { border-color: var(--orange); background: rgba(232,120,45,0.05); }
.img-item img { width: 60px; height: 60px; object-fit: cover; border-radius: 6px; }
.img-actions { display: flex; flex-direction: column; gap: 6px; }
.img-btn {
    border: none; background: var(--bg); cursor: pointer; padding: 5px 10px;
    border-radius: 6px; font-size: 12px; font-family: inherit; color: var(--ink-soft);
}
.img-btn:hover { background: var(--border); color: var(--ink); }
.img-btn--danger:hover { background: #FEE2E2; color: #B91C1C; }
.img-primary-badge { color: var(--orange); font-size: 12px; font-weight: 600; padding: 5px 0; }

.upload-zone {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 18px; border: 2px dashed var(--border); border-radius: 10px;
    cursor: pointer; text-align: center; color: var(--ink-soft); font-size: 14px;
    transition: border-color 0.2s;
    position: relative; overflow: hidden;
}
.upload-zone:hover { border-color: var(--orange); }
/* l'input natif est masqué : toute la zone est cliquable (évite le « Sélect. fichiers » qui déborde) */
.upload-zone input[type="file"] {
    position: absolute; inset: 0; width: 100%; height: 100%;
    opacity: 0; cursor: pointer; font-size: 0;
}
.th-sort { cursor: pointer; user-select: none; white-space: nowrap; }
.th-sort:hover { color: var(--orange); }

.edit-bar {
    display: flex; align-items: center; gap: 12px; margin-top: 24px;
    padding-top: 20px; border-top: 1px solid var(--border);
}
.edit-bar-right { margin-left: auto; display: flex; gap: 10px; }

@media (max-width: 900px) {
    .edit-grid { grid-template-columns: 1fr; }
    .edit-side { position: static; }
    .field-row { flex-direction: column; gap: 0; }
}

/* ════════ DÉTAIL COMMANDE ════════ */
.order-grid { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: start; }
.order-main { display: flex; flex-direction: column; gap: 24px; }
.order-side { display: flex; flex-direction: column; gap: 16px; }
.order-side .panel p { margin: 0 0 6px; }
.order-totals { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 14px; }
.order-totals > div { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; }
.order-total-final { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 10px !important; font-size: 16px; }
.order-total-final strong { color: var(--orange); font-family: 'Fraunces', serif; font-size: 19px; }
.order-meta { margin-top: 18px; font-size: 13px; }
.order-meta dt { color: var(--ink-muted); margin-top: 8px; }
.order-meta dd { margin: 2px 0 0; font-weight: 600; }
.saved-hint { color: #15803D; font-size: 13px; margin-left: 10px; }
.small { font-size: 12px; }
@media (max-width: 900px) { .order-grid { grid-template-columns: 1fr; } }

/* ════════ FICHE CLIENT (cartes commande) ════════ */
.order-card {
    border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin-bottom: 14px;
}
.order-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.order-card-num { font-weight: 700; }
.order-card-total { margin-left: auto; font-family: 'Fraunces', serif; font-weight: 600; }
.order-card-lines { list-style: none; margin: 0 0 8px; padding: 0; font-size: 13px; }
.order-card-lines li { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px dashed var(--border); }
.order-card-lines li:last-child { border-bottom: none; }

/* Espacement des cases à cocher dans les fiches */
.panel .check { margin: 4px 0 16px; }

/* Message de succès */
.alert-success {
    background: #DCFCE7; color: #166534;
    padding: 12px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px;
}

/* ─── Formulaires (fiches produit / recette…) ─── */
/* Espace entre panneaux empilés dans un formulaire */
.panel + .panel { margin-top: 20px; }

/* Titres de section dans les panneaux */
.panel > h3 {
    font-family: 'Fraunces', serif;
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 4px;
}
.panel > h3 + .hint { margin-top: 0; }

/* Ligne de formulaire : libellé au-dessus, champ pleine largeur */
.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.form-row:last-child { margin-bottom: 0; }
.form-row > label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }

/* Apparence commune des champs dans les panneaux */
.panel input:not([type="checkbox"]):not([type="radio"]),
.panel textarea,
.panel select {
    padding: 10px 12px;
    font: inherit;
    font-size: 14px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.panel input:not([type="checkbox"]):not([type="radio"]):focus,
.panel textarea:focus,
.panel select:focus {
    outline: none;
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(232, 120, 45, 0.15);
}
.panel input::placeholder,
.panel textarea::placeholder { color: var(--ink-muted); opacity: 0.7; }
.panel textarea { resize: vertical; min-height: 44px; line-height: 1.5; }

/* Champs pleine largeur dans une .form-row */
.form-row input,
.form-row textarea,
.form-row select { width: 100%; }

.form-row .hint { font-size: 12px; color: var(--ink-muted); }

/* Options à cocher */
.form-options { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 6px; }
label.checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; color: var(--ink-soft); cursor: pointer; }
label.checkbox input { width: auto; }

/* ─── Formulaire resserré (Paramètres) + interrupteur ─── */
.form-narrow { max-width: 720px; }
.form-actions { margin-top: 20px; display: flex; align-items: center; gap: 12px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 4px 0 18px; font-weight: 600; color: var(--ink-soft); }
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: var(--border); border-radius: 999px; transition: .2s; cursor: pointer; }
.switch .slider::before { content: ""; position: absolute; height: 20px; width: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .slider { background: var(--orange); }
.switch input:checked + .slider::before { transform: translateX(20px); }

.img-zoomable { cursor: zoom-in; }
.lightbox {
    position: fixed; inset: 0; z-index: 200; background: rgba(20,15,10,0.8);
    display: flex; align-items: center; justify-content: center; padding: 24px; cursor: zoom-out;
}
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; background: #fff; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.lightbox-close {
    position: absolute; top: 16px; right: 20px; border: none; background: rgba(255,255,255,0.15);
    color: #fff; font-size: 20px; width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
}

/* ─── Produits : bascule liste / vignettes ─── */
.view-toggle { display: inline-flex; margin-left: auto; border: 1px solid #E4DACB; border-radius: 8px; overflow: hidden; }
.view-toggle button { background: #fff; border: 0; padding: 8px 14px; font: inherit; font-size: 13px; color: var(--ink-soft); cursor: pointer; }
.view-toggle button + button { border-left: 1px solid #E4DACB; }
.view-toggle button.active { background: var(--ink); color: var(--cream); }

.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.admin-card { position: relative; background: var(--cream); border: 1px solid #EDE4D6; border-radius: 6px; overflow: hidden; transition: box-shadow .2s, transform .2s; }
.admin-card:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(26,20,16,.12); }
.admin-card-image { position: relative; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; text-decoration: none; }
.admin-card-image img { width: 100%; height: 100%; object-fit: contain; }
.admin-card-emoji { font-size: 72px; }
.admin-card-tag { position: absolute; left: 12px; bottom: 12px; background: var(--cream); color: var(--ink); border: 1px solid #E4DACB; border-radius: 99px; padding: 5px 11px; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; font-weight: 600; }
.admin-card-tag--sold { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.admin-card-actions { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; background: rgba(255,255,255,.92); border-radius: 8px; padding: 2px; }
.admin-card:hover .admin-card-actions, .admin-card:focus-within .admin-card-actions { opacity: 1; }
.admin-card-info { padding: 14px 16px 16px; }
.admin-card-cat { font-size: 11px; letter-spacing: .15em; text-transform: uppercase; color: var(--orange); font-weight: 600; margin-bottom: 6px; }
.admin-card-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.admin-card-name { font-family: 'Fraunces', serif; font-weight: 500; font-size: 17px; line-height: 1.3; color: var(--ink); text-decoration: none; }
.admin-card-name:hover { color: var(--orange); }
.admin-card-price { font-family: 'Fraunces', serif; font-weight: 600; font-size: 17px; white-space: nowrap; text-align: right; }

/* ─── DDM dans la liste des produits ─── */
.bbd-pill { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.bbd-pill--soon { background: #FEF3C7; color: #92400E; }
.bbd-pill--expired { background: #FEE2E2; color: #991B1B; }

/* ─── Étiquettes magasin ─── */
.shelf-grid { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 24px; align-items: start; }
.shelf-side { display: flex; flex-direction: column; gap: 20px; position: sticky; top: 16px; }
.shelf-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.shelf-fields .form-row { margin-bottom: 12px; }
.copies-input { width: 70px; padding: 6px 8px; font: inherit; border: 1px solid var(--border); border-radius: 6px; }
.row-selected { background: rgba(232, 120, 45, 0.07); }
.shelf-selection { list-style: none; max-height: 220px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.shelf-selection li { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.shelf-selection li > span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.form-actions a.btn-new { text-decoration: none; }
.btn-new:disabled { opacity: .5; cursor: not-allowed; }

/* A4 dessinée en mm puis réduite : 210 mm × 0,45 ≈ 357 px */
.sheet-wrap { width: calc(210mm * 0.45); height: calc(297mm * 0.45); overflow: hidden; margin: 0 auto;
              box-shadow: 0 2px 10px rgba(0,0,0,.12); background: #fff; }
.sheet { position: relative; width: 210mm; height: 297mm; transform: scale(0.45); transform-origin: top left; background: #fff; }
.sheet-label { position: absolute; display: flex; gap: 2mm; overflow: hidden; color: #222; font-family: Helvetica, Arial, sans-serif; }
.sheet-label--border { outline: 0.2mm solid #bbb; outline-offset: -0.1mm; }
.sheet-label--empty { background: repeating-linear-gradient(45deg, #f4f4f4, #f4f4f4 2mm, #fff 2mm, #fff 4mm); }
.sheet-label img { object-fit: contain; flex-shrink: 0; }
.sheet-label-text { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: space-between; }
.sheet-label-title { font-weight: 700; line-height: 1.05; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sheet-label-price { font-weight: 700; color: var(--orange-deep); text-align: right; white-space: nowrap; }
.sheet-label-price small { font-size: 45%; color: #666; font-weight: 400; }
.sheet-label-bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5mm; }
.sheet-label-barcode { flex-shrink: 0; display: flex; flex-direction: column; align-items: center; line-height: 1; }
.sheet-label-barcode svg { display: block; width: 100%; height: 100%; }
.sheet-label-barcode small { color: #000; letter-spacing: 0.05em; white-space: nowrap; }

@media (max-width: 1100px) {
    .shelf-grid { grid-template-columns: 1fr; }
    .shelf-side { position: static; }
}

/* Fiche produit : prix vu par le client sur le site (marge, promo, remise DDM). */
.client-price { margin-top: 14px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: rgba(0, 0, 0, 0.02); display: flex; flex-direction: column; gap: 4px; }
.client-price--bbd { border-color: var(--orange-deep); background: rgba(194, 90, 31, 0.06); }
.client-price-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-weight: 600; }
.client-price-value { white-space: nowrap; }
.client-price-value s { color: #888; font-weight: 400; margin-right: 6px; }
.client-price-value strong { color: var(--orange-deep); font-size: 1.15em; }
.client-price-steps { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 0.9em; color: #555; }

/* Import des codes-barres : statut des lignes. */
.text-danger { color: #c0392b; }
.text-success { color: #1e8449; }
.form-error { color: #c0392b; margin-top: 8px; }
