:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --text: #1f2933;
    --muted: #6b7280;
    --border: #d9dee7;
    --primary: #176b5f;
    --primary-dark: #0f4d44;
    --danger: #c0392b;
    --success: #168a4a;
    --shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}
body.theme-dark {
    --bg: #111827;
    --surface: #1f2937;
    --text: #f3f4f6;
    --muted: #aeb7c2;
    --border: #374151;
    --primary: #2fb39e;
    --primary-dark: #1f8f7e;
    --danger: #f87171;
    --success: #34d399;
    --shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}
html, body { min-height: 100%; }
body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}
a, a:hover, a:focus { text-decoration: none; }
#wrapper { width: 100%; min-height: 100vh; }
#page-wrapper {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 40px;
    background: transparent;
}
.topbar {
    width: min(1180px, calc(100% - 32px));
    margin: 16px auto 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    box-shadow: var(--shadow);
}
.topbar-brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; min-width: 0; }
.topbar-brand span:not(.offline-note) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-brand i { color: var(--primary); }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.topbar-quick { display: flex; align-items: center; gap: 8px; }
.topbar-toggle { display: none; background: var(--bg); border: 1px solid var(--border); color: var(--text); padding: 8px 12px; }
.back-btn, .btn { border-radius: 6px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover, .btn-primary:focus { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-success { background: var(--success); border-color: var(--success); }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.header, .header-title, .page-hero, .alert, .form-container, .panel-card {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px 20px;
    margin-bottom: 18px;
    box-shadow: var(--shadow);
    text-align: left;
}
.header h2, .header-title h2, .page-hero h2 { margin: 0; font-size: 26px; font-weight: 700; color: var(--text); }
.header p, .page-hero p { margin: 6px 0 0; color: var(--muted); }
.header-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: auto; }
.header-title a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    min-height: 38px;
    border-radius: 6px;
    background: var(--primary);
    color: #fff;
    padding: 8px 10px;
}
.menu-grid, .row.text-center.pad-top, .dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
}
.menu-item {
    width: auto;
    min-height: 150px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    text-align: left;
    box-shadow: var(--shadow);
    transition: transform 0.15s ease, border-color 0.15s ease;
}
.menu-item:hover { transform: translateY(-2px); border-color: var(--primary); }
.menu-item a { display: block; color: var(--text); }
.menu-item i { font-size: 34px; color: var(--primary); margin-bottom: 14px; }
.menu-item h4 { margin: 0; color: var(--text); font-size: 17px; font-weight: 700; }
.metric-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px;
    box-shadow: var(--shadow);
}
.metric-card span { color: var(--muted); font-size: 13px; font-weight: 700; text-transform: uppercase; }
.metric-card strong { display: block; margin-top: 8px; font-size: 28px; color: var(--text); }
.metric-card small { display: block; margin-top: 4px; color: var(--muted); font-weight: 700; }
.metric-card.warning strong { color: var(--danger); }
.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    padding: 3px 5px;
    border-radius: 999px;
    min-width: 16px;
    text-align: center;
}
.notif-item { display: block; padding: 14px 16px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 10px; background: var(--surface); }
.notif-item.is-unread { border-left: 4px solid var(--primary); }
.notif-item .notif-titre { font-weight: 700; color: var(--text); }
.notif-item .notif-message { color: var(--muted); margin-top: 4px; }
.notif-item .notif-date { color: var(--muted); font-size: 12px; margin-top: 6px; display: block; }
.no-data { text-align: center; color: var(--muted); font-weight: 700; padding: 18px; }
.table-responsive { width: 100%; overflow-x: auto; }
.table { width: 100%; background: var(--surface); border-collapse: collapse; margin-top: 12px; }
.table th, .table td { padding: 12px 14px; text-align: left; border: 1px solid var(--border); vertical-align: middle; }
.table th { background: #eef3f2; color: var(--text); font-size: 13px; text-transform: uppercase; }
.table td { background: var(--surface); }
.pagination { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.pagination a { padding: 8px 12px; background: var(--surface); color: var(--primary); border: 1px solid var(--border); border-radius: 6px; }
.pagination .active, .pagination a:hover { background: var(--primary); color: #fff; }
.offline-note {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    background: #eef3f2;
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 700;
}
.theme-toggle {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    min-width: 38px;
    min-height: 34px;
}
.theme-toggle:hover { border-color: var(--primary); color: var(--primary); }
.amount-positive { color: var(--success); font-weight: 700; }
.amount-negative { color: var(--danger); font-weight: 700; }
.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        linear-gradient(135deg, rgba(23, 107, 95, 0.12), rgba(22, 138, 74, 0.08)),
        var(--bg);
}
.login-shell {
    width: min(940px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    min-height: 560px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.16);
}
.login-brand {
    padding: 42px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: #123c36;
    color: #fff;
}
.login-brand i { font-size: 38px; }
.login-brand h1 { margin: 18px 0 10px; font-size: 34px; font-weight: 800; color: #fff; }
.login-brand p { margin: 0; color: rgba(255, 255, 255, 0.76); max-width: 420px; }
.login-badges { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.login-badges span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.88);
    font-weight: 700;
    font-size: 12px;
}
.login-card {
    padding: 42px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.login-card h2 { margin: 0 0 6px; font-size: 28px; font-weight: 800; color: var(--text); }
.login-card p { margin: 0 0 26px; color: var(--muted); }
.login-card label { color: var(--text); font-weight: 700; }
.login-card .form-control {
    min-height: 44px;
    border-radius: 6px;
    border-color: var(--border);
    box-shadow: none;
}
.login-card .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(23, 107, 95, 0.14);
}
.login-card .btn {
    width: 100%;
    min-height: 46px;
    font-weight: 800;
}
.login-error {
    margin-top: 16px;
    padding: 12px 14px;
    border: 1px solid rgba(192, 57, 43, 0.28);
    border-radius: 6px;
    background: rgba(192, 57, 43, 0.08);
    color: var(--danger);
    font-weight: 700;
}
@media (max-width: 700px) {
    #page-wrapper, .topbar { width: calc(100% - 20px); }
    .topbar { align-items: center; flex-direction: row; flex-wrap: wrap; position: relative; }
    .topbar-brand { flex: 1 1 auto; }
    .offline-note .btn-label { display: none; }
    .topbar-toggle { display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; }
    .topbar-actions {
        display: none;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        order: 3;
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid var(--border);
        gap: 6px;
    }
    .topbar-actions.is-open { display: flex; }
    .topbar-actions .btn {
        width: 100%;
        display: flex;
        align-items: center;
        gap: 10px;
        justify-content: flex-start;
        min-height: 42px;
        padding: 8px 12px;
    }
    .header-title { align-items: flex-start; flex-direction: column; }
    .header h2, .header-title h2, .page-hero h2 { font-size: 22px; }
    .login-page { padding: 14px; place-items: stretch; }
    .login-shell { grid-template-columns: 1fr; min-height: 0; }
    .login-brand { padding: 28px; }
    .login-brand h1 { font-size: 28px; }
    .login-card { padding: 28px; }
    .menu-grid, .row.text-center.pad-top, .dashboard-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
    .menu-item { min-height: 116px; padding: 14px; }
    .menu-item i { font-size: 26px; margin-bottom: 8px; }
    .menu-item h4 { font-size: 14px; }
}

@media (max-width: 420px) {
    .menu-grid, .row.text-center.pad-top, .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
    .topbar-brand span:not(.offline-note) { max-width: 40vw; }
}

/* ---------- Depots, stock et filtres de recherche ---------- */
.stock-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline-form { display: inline; }
.action-sep { color: var(--muted); margin: 0 4px; }
.link-danger { background: none; border: 0; padding: 0; color: var(--danger); cursor: pointer; }
.stock-low td { background: rgba(192, 57, 43, 0.08) !important; }
.stock-badge { display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; vertical-align: middle; }
.breadcrumb-link { display: inline-block; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.breadcrumb-link:hover { color: var(--primary); }
.depot-place { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 14px; }
.filter-field { position: relative; flex: 1 1 260px; min-width: 0; }
.filter-field i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.filter-field .form-control { padding-left: 34px; height: 40px; }
.filter-select { width: auto; min-width: 180px; height: 40px; flex: 0 1 220px; }
.filter-check { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 600; color: var(--text); white-space: nowrap; }
.filter-count { color: var(--muted); font-size: 13px; font-weight: 700; margin-left: auto; white-space: nowrap; }
.filter-empty { text-align: center; color: var(--muted); padding: 18px 0; margin: 0; }

.empty-state { text-align: center; padding: 36px 16px; background: var(--surface); border: 1px dashed var(--border); border-radius: 8px; color: var(--text); }
.empty-state > i { font-size: 40px; color: var(--primary); }
.empty-state h3 { margin: 10px 0 6px; font-size: 20px; }
.empty-state p { color: var(--muted); margin: 0 0 14px; }

.depot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.depot-card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.depot-link { display: block; padding: 18px 18px 12px; color: var(--text); flex: 1; border-radius: 8px 8px 0 0; }
.depot-link:hover { background: rgba(23, 107, 95, 0.06); color: var(--text); }
.depot-link h3 { margin: 6px 0 0; font-size: 19px; font-weight: 700; }
.depot-icon { font-size: 26px; color: var(--primary); }
.depot-stats { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; }
.depot-stats span { display: block; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.depot-stats strong { font-size: 17px; }
.depot-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 18px 16px; border-top: 1px solid var(--border); }
.depot-rename { padding: 16px 18px 0; }
.depot-rename label { margin-top: 6px; }
.depot-rename .depot-actions { padding: 12px 0 16px; border-top: 0; }
.depot-split { list-style: none; padding: 0; margin: 0; border: 1px solid var(--border); border-radius: 6px; }
.depot-split li { display: flex; justify-content: space-between; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.depot-split li:last-child { border-bottom: 0; }
.depot-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.depot-picker label { margin: 0; font-weight: 700; }
.depot-picker select { width: auto; min-width: 220px; }

.qty-input, .price-input { max-width: 170px; }
.row-filled td { background: rgba(22, 138, 74, 0.08) !important; }
.row-filled .qty-input { border-color: var(--success); font-weight: 700; }
.input-changed { border-color: var(--primary) !important; box-shadow: 0 0 0 2px rgba(23, 107, 95, 0.18); font-weight: 700; }
.submit-bar { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; padding: 12px; margin-top: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); }
.submit-bar > span { margin-right: auto; color: var(--muted); font-weight: 600; }

@media (max-width: 640px) {
    .filter-select, .filter-field { flex: 1 1 100%; }
    .filter-count { margin-left: 0; }
    .submit-bar > span { flex: 1 1 100%; }
    .qty-input, .price-input { max-width: none; min-width: 90px; }
}
.header-title a.breadcrumb-link { display: inline-flex; min-width: 0; min-height: 0; padding: 0; background: none; color: var(--muted); gap: 6px; }
.header-title a.breadcrumb-link:hover { color: var(--primary); }
.header-title a.btn-default { background: var(--surface); color: var(--text); border: 1px solid var(--border); gap: 6px; }
.header-title a.btn-success { background: var(--success); gap: 6px; }
.header-title a.btn { gap: 6px; }
.alert > p + form, .alert > p + .filter-bar, .alert > p + hr { margin-top: 12px; }
@media (max-width: 640px) { .hide-sm { display: none !important; } }
.depot-picker label { color: var(--text) !important; }

/* Barre de recherche compacte : zone de recherche courte + petit bouton filtre cote a cote */
.filter-bar { flex-wrap: wrap; gap: 8px; }
.filter-bar .filter-field { flex: 0 1 260px; }
.filter-bar .filter-field .form-control { height: 34px; }
.filter-toggle { height: 34px; width: 38px; padding: 0; position: relative; }
.filter-toggle.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.filter-toggle.filter-on::after { content: ""; position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.filter-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex-basis: 100%; }
.filter-panel[hidden] { display: none; }
.filter-panel .filter-select { height: 34px; flex: 0 1 220px; }
@media (max-width: 640px) {
    .filter-bar .filter-field { flex: 1 1 auto; }
    .filter-panel .filter-select { flex: 1 1 100%; }
}

/* ---------- Vente : lignes par depot ---------- */
.vente-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 18px; align-items: start; }
.vente-card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); padding: 18px; color: var(--text); }
.vente-card h3 { margin: 0 0 12px; font-size: 18px; font-weight: 700; }
.vente-card label { color: var(--text) !important; font-weight: 700; font-size: 12px; text-transform: uppercase; margin-bottom: 4px; }
.vente-ligne { display: grid; grid-template-columns: minmax(0, 1fr) 110px 120px 40px; gap: 10px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--border); }
.vente-ligne.a-gros { grid-template-columns: minmax(0, 1fr) 190px 110px 120px 40px; }
.vente-ligne .l-unite-field[hidden] { display: none; }
.pc-price small { display: block; text-align: right; font-size: 11px; color: var(--muted); font-weight: 700; }
.vente-ligne:last-child { border-bottom: 0; }
.vente-ligne .l-total { height: 34px; display: flex; align-items: center; justify-content: flex-end; font-weight: 700; font-size: 15px; }
.vente-ligne .l-remove { height: 34px; margin-top: 22px; }
.vente-ligne .l-info { display: flex; flex-wrap: wrap; gap: 6px; min-height: 22px; margin-top: 6px; }
.l-chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; background: rgba(23, 107, 95, 0.1); color: var(--primary); font-size: 12px; font-weight: 700; }
.l-chip-error { background: rgba(192, 57, 43, 0.12); color: var(--danger); }
.vente-ligne.l-error .l-qty { border-color: var(--danger); }

/* Autocompletion en cartes : un produit par depot ou il est en stock */
.picker { position: relative; }
.picker-icon { position: absolute; left: 12px; top: 10px; color: var(--muted); pointer-events: none; }
.picker .l-nom { padding-left: 34px; }
.picker-cards { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 6px); max-height: 340px; overflow-y: auto; padding: 8px; display: grid; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18); }
.picker-cards[hidden] { display: none; }
.pc-card { padding: 10px 12px; border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: 8px; background: var(--surface); cursor: pointer; transition: background .12s, border-color .12s, transform .12s; }
.pc-card:hover, .pc-card.active { background: rgba(23, 107, 95, 0.07); border-color: var(--primary); }
.pc-card.active { transform: translateX(2px); }
.pc-card.disabled { opacity: .55; cursor: not-allowed; border-left-color: var(--muted); }
.pc-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.pc-name { font-weight: 700; font-size: 15px; color: var(--text); }
.pc-name mark { background: rgba(245, 180, 0, 0.35); color: inherit; padding: 0 1px; border-radius: 2px; }
.pc-price { font-weight: 700; color: var(--primary); white-space: nowrap; }
.pc-bottom { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 6px; font-size: 12px; }
.pc-depot { color: var(--muted); font-weight: 600; }
.pc-stock { padding: 2px 9px; border-radius: 999px; font-weight: 700; white-space: nowrap; }
.pc-ok { background: rgba(22, 138, 74, 0.12); color: var(--success); }
.pc-low { background: rgba(245, 158, 11, 0.18); color: #b45309; }
.pc-out { background: rgba(192, 57, 43, 0.12); color: var(--danger); }
.pc-empty { padding: 14px; text-align: center; color: var(--muted); }
.vente-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; margin-top: 14px; }
.vente-summary .summary-line { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.vente-summary .summary-line small { display: block; color: var(--muted); font-size: 11px; }
.vente-summary .summary-total { display: flex; justify-content: space-between; margin-top: 12px; font-size: 20px; font-weight: 700; }
.vente-summary .summary-empty { color: var(--muted); font-style: italic; }
.facture-modif { color: var(--muted); font-size: 12px; margin-top: 6px; }
@media (max-width: 900px) {
    .vente-layout { grid-template-columns: 1fr; }
    .vente-ligne, .vente-ligne.a-gros { grid-template-columns: 1fr 1fr 40px; }
    .vente-ligne .l-prod-field, .vente-ligne .l-unite-field { grid-column: 1 / -1; }
}

/* Entete : plus de liens (Vente, Stock) -> on compacte sur les ecrans moyens */
@media (min-width: 701px) and (max-width: 1250px) {
    .topbar .offline-note { display: none; }
    .topbar-actions { gap: 6px; }
    .topbar-actions .btn { padding: 6px 9px; font-size: 13px; }
}
@media (min-width: 701px) and (max-width: 1020px) {
    .topbar-actions .btn-label { display: none; }
}

/* V2 : depot principal et mode simple (un seul depot) */
.stock-badge.depot-principal-badge { background: var(--primary); }
.depot-simple-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.initial-stock-depot { max-width: 360px; }

/* V2 : formulaire des droits, groupe par theme */
.droits-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.droits-groupe { border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px 4px; margin: 0; background: var(--surface); }
.droits-groupe legend { width: auto; border: 0; margin: 0; padding: 0 6px; font-size: 14px; font-weight: 700; color: var(--primary); }
.droits-groupe .checkbox { margin: 6px 0; }
.droits-form > p { grid-column: 1 / -1; }

/* ------------------------------------------------------------------ */
/* Console super-admin V2 : menu lateral + composants                   */
/* ------------------------------------------------------------------ */
.sa-layout { display: flex; min-height: 100vh; }
.sa-sidebar { width: 240px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border); position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.sa-brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px; font-weight: 700; color: var(--text); border-bottom: 1px solid var(--border); }
.sa-brand i.fa-cogs { color: var(--primary); font-size: 20px; }
.sa-brand span { flex: 1; min-width: 0; }
.sa-menu-toggle { display: none; }
.sa-nav { display: flex; flex-direction: column; padding: 10px 8px; gap: 2px; flex: 1; }
.sa-nav > a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 6px; color: var(--text); font-weight: 600; }
.sa-nav > a i { width: 18px; text-align: center; color: var(--muted); }
.sa-nav > a:hover { background: var(--bg); color: var(--text); }
.sa-nav > a.active { background: var(--primary); color: #fff; }
.sa-nav > a.active i { color: #fff; }
.sa-badge { margin-left: auto; background: var(--danger); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 7px; }
.sa-nav-bottom { margin-top: auto; padding: 12px 4px 4px; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sa-langs { display: flex; gap: 4px; flex-wrap: wrap; }
.sa-langs a { padding: 4px 8px; border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: 12px; }
.sa-langs a.active { border-color: var(--primary); color: var(--primary); font-weight: 700; }
.sa-logout { width: 100%; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 6px; color: var(--danger); font-weight: 700; }
.sa-logout:hover { background: var(--bg); color: var(--danger); }
.sa-main#page-wrapper { flex: 1; min-width: 0; width: auto; margin: 0; padding: 24px 28px 40px; }
.sa-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; }
.sa-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.sa-kpis .metric-card a { color: inherit; }
.sa-list { list-style: none; padding: 0; margin: 0; }
.sa-list li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.sa-list li:last-child { border-bottom: 0; }
.sa-list small, .sa-muted { color: var(--muted); }
.sa-pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #fff; background: var(--muted); white-space: nowrap; }
.sa-pill.ok { background: var(--success); }
.sa-pill.warn { background: #d68910; }
.sa-pill.bad { background: var(--danger); }
.sa-pill.info { background: var(--primary); }
.sa-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sa-actions form { display: inline; margin: 0; }
.sa-def { display: grid; grid-template-columns: 170px 1fr; gap: 6px 14px; margin: 0; }
.sa-def dt { color: var(--muted); font-weight: 600; }
.sa-def dd { margin: 0; }
.panel-card h3 { margin-top: 0; font-size: 18px; font-weight: 700; }
@media (max-width: 900px) {
    .sa-layout { display: block; }
    .sa-sidebar { position: static; width: auto; height: auto; border-right: 0; border-bottom: 1px solid var(--border); }
    .sa-menu-toggle { display: inline-block; }
    .sa-nav { display: none; }
    .sa-nav.is-open { display: flex; }
    .sa-main#page-wrapper { padding: 16px; }
    .sa-def { grid-template-columns: 1fr; }
    .sa-grid-2 { grid-template-columns: 1fr; }
}
.header-title .sa-actions a.btn-default { background: var(--surface); color: var(--danger); border: 1px solid var(--border); }

/* Support : coordonnees et fil de discussion */
.support-contacts-liste { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 6px; }
.support-fil { display: flex; flex-direction: column; gap: 12px; }
.support-bulle { max-width: 80%; border-radius: 10px; padding: 10px 14px; border: 1px solid var(--border); }
.support-bulle-client { align-self: flex-end; background: var(--bg); }
.support-bulle-equipe { align-self: flex-start; background: var(--surface); border-left: 4px solid var(--primary); }
.support-bulle-entete { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.support-bulle-entete small { color: var(--muted); }
.support-bulle-texte { word-break: break-word; }
@media (max-width: 700px) { .support-bulle { max-width: 100%; } }

/* Achats fournisseurs : pastilles de statut (paiement, marchandise, cloture auto) */
.statut-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; background: rgba(107,114,128,.14); color: var(--muted); }
.statut-chip.ok, .statut-chip.paye, .statut-chip.livre { background: rgba(22,138,74,.14); color: var(--success); }
.statut-chip.partiel, .statut-chip.en_cours, .statut-chip.credit, .statut-chip.auto { background: rgba(217,119,6,.15); color: #b45309; }
.statut-chip.non_paye, .statut-chip.annule { background: rgba(192,57,43,.12); color: var(--danger); }
.statut-chip.commande { background: rgba(37,99,235,.12); color: #2563eb; }
.achats-onglets { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.achats-onglets a { padding: 8px 16px; border-radius: 999px; border: 1px solid var(--border); color: var(--text); font-weight: 700; text-decoration: none; }
.achats-onglets a.actif { background: var(--primary); border-color: var(--primary); color: #fff; }
.achats-etapes { display: flex; gap: 0; margin: 6px 0 18px; }
.achats-etapes span { flex: 1; text-align: center; padding: 8px 4px; font-size: 12.5px; font-weight: 700; color: var(--muted); border-bottom: 3px solid var(--border); }
.achats-etapes span.fait { color: var(--success); border-bottom-color: var(--success); }
.achats-etapes span.actuel { color: var(--primary); border-bottom-color: var(--primary); }
.caisse-info { padding: 10px 14px; border-radius: 10px; background: rgba(23,107,95,.08); margin-bottom: 12px; font-size: 13.5px; }
tr.row-negative td { color: var(--danger); }
body.theme-dark .statut-chip.partiel, body.theme-dark .statut-chip.en_cours, body.theme-dark .statut-chip.credit, body.theme-dark .statut-chip.auto { color: #fbbf24; }
body.theme-dark .statut-chip.commande { color: #93c5fd; }

/* Devises et modes d'encaissement */
.vente-summary .summary-secondaire { text-align: right; color: var(--muted); font-weight: 600; min-height: 1em; }
.taux-ligne { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.taux-ligne input { max-width: 180px; }
.modes-grille { display: flex; flex-wrap: wrap; gap: 8px; }
.mode-case { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 7px 12px; border: 1px solid var(--border); border-radius: 999px; font-weight: 600; background: var(--surface, #fff); cursor: pointer; }
.mode-case.perso { border-style: dashed; }
.mode-chip { display: inline-block; padding: 1px 8px; border-radius: 999px; background: rgba(23, 107, 95, .1); color: var(--primary, #176b5f); font-size: 12px; font-weight: 600; white-space: nowrap; }
.equiv-sec { display: block; color: var(--muted); font-size: 12px; font-weight: 600; }
.paiement-devise { display: flex; gap: 8px; align-items: center; }
.paiement-devise select { max-width: 130px; }
.table-modes td, .table-modes th { white-space: nowrap; }
.page-hero .taux-jour { margin-top: 4px; font-weight: 600; }
.unite-select { margin-top: 6px; max-width: 220px; height: 32px; padding: 3px 8px; font-size: 13px; }
.gros-creation { clear: both; margin-top: 4px; } .gros-creation summary { cursor: pointer; font-weight: 600; color: var(--primary, #176b5f); margin-bottom: 8px; }
.regle-prix { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 6px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; font-weight: 400; cursor: pointer; }
.regle-prix input { margin-top: 3px; }
.regle-prix small { display: block; color: var(--muted); }

/* ---------- Menu lateral ---------- */
.menu-lateral { position: fixed; z-index: 70; top: 0; bottom: 0; left: 0; width: 236px; overflow-y: auto; padding: 14px 10px 24px; background: var(--surface); border-right: 1px solid var(--border); }
.menu-lateral-marque { display: flex; align-items: center; gap: 10px; padding: 8px 10px 14px; font-weight: 800; font-size: 16px; color: var(--text); text-decoration: none; }
.menu-lateral-marque i { color: var(--primary); }
.menu-lateral-marque span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-lateral-titre { margin: 14px 10px 4px; font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.menu-lateral-lien { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--text); font-weight: 600; font-size: 14px; text-decoration: none; }
.menu-lateral-lien i { width: 18px; text-align: center; color: var(--muted); }
.menu-lateral-lien:hover, .menu-lateral-lien:focus { background: rgba(23, 107, 95, .08); color: var(--text); text-decoration: none; }
.menu-lateral-lien.actif { background: var(--primary); color: #fff; }
.menu-lateral-lien.actif i { color: #fff; }
.menu-lateral-voile { display: none; position: fixed; z-index: 65; inset: 0; background: rgba(15, 23, 42, .45); }
.menu-lateral-bouton { display: none; background: var(--bg); border: 1px solid var(--border); color: var(--text); padding: 8px 12px; }
@media (min-width: 992px) {
    body.avec-menu #wrapper { padding-left: 236px; }
    body.avec-menu .topbar .topbar-brand > .fa-shopping-cart, body.avec-menu .topbar .topbar-brand > span { display: none; }
}
@media (max-width: 991px) {
    .menu-lateral { transform: translateX(-105%); transition: transform .2s ease; box-shadow: 0 10px 40px rgba(15, 23, 42, .25); width: min(280px, 84vw); }
    body.menu-ouvert .menu-lateral { transform: none; }
    body.menu-ouvert .menu-lateral-voile { display: block; }
    .menu-lateral-bouton { display: inline-flex; }
}
@media print {
    .menu-lateral, .menu-lateral-voile { display: none !important; }
    body.avec-menu #wrapper { padding-left: 0 !important; }
}
.menu-lateral-groupe { margin-top: 4px; }
.menu-lateral-groupe > summary { display: flex; align-items: center; justify-content: space-between; padding: 10px; border-radius: 8px; cursor: pointer; list-style: none; font-size: 12px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); user-select: none; }
.menu-lateral-groupe > summary::-webkit-details-marker { display: none; }
.menu-lateral-groupe > summary:hover { background: rgba(23, 107, 95, .08); color: var(--text); }
.menu-lateral-groupe > summary .fa { font-size: 16px; transition: transform .15s ease; }
.menu-lateral-groupe[open] > summary .fa { transform: rotate(180deg); }
.menu-lateral-groupe[open] > summary { color: var(--text); }
.menu-lateral-groupe .menu-lateral-lien { margin-left: 6px; }
.menu-lateral-sortie { margin-top: 12px; border-top: 1px solid var(--border); border-radius: 0 0 8px 8px; padding-top: 14px; color: var(--danger, #c0392b); }
.menu-lateral-sortie i { color: var(--danger, #c0392b); }
/* Avec le menu lateral, les tuiles du tableau de bord font doublon sur ordinateur. */
@media (min-width: 992px) { body.avec-menu .tuiles-accueil { display: none; } }

/* Console : badges de profil des membres de l'equipe */
.sa-pill.sa-profil-support { background: #1f7a8c; }
.sa-pill.sa-profil-finances { background: #7a5c1f; }
.sa-pill.sa-profil-technique { background: #5b4b9a; }
.sa-pill.sa-profil-mesure { background: var(--muted); }

/* Notification pas encore vue avant cette visite */
.notif-nouveau { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; white-space: nowrap; }

/* Boutixy: prix libre/mixte, colonne de saisie visible uniquement si autorisee. */
#lignesVente.vente-prix-modifiable .vente-ligne { grid-template-columns: minmax(0, 1fr) 115px 115px 120px 40px; }
#lignesVente.vente-prix-modifiable .vente-ligne.a-gros { grid-template-columns: minmax(0, 1fr) 160px 100px 115px 120px 40px; }
#lignesVente .l-price-field[hidden] { display: none; }
#lignesVente .l-price-field input { min-width: 0; }
#lignesVente .vente-ligne.l-error .l-prix { border-color: var(--danger); }
@media (max-width: 900px) {
  #lignesVente.vente-prix-modifiable .vente-ligne,
  #lignesVente.vente-prix-modifiable .vente-ligne.a-gros { grid-template-columns: 1fr 1fr 40px; }
  #lignesVente.vente-prix-modifiable .vente-ligne .l-prod-field,
  #lignesVente.vente-prix-modifiable .vente-ligne .l-unite-field { grid-column: 1 / -1; }
}
