/* Identite : bleu medical, blanc, gris clair. Proprietes logiques (inline-start/end) => pret pour le RTL. */
:root {
    --bio-blue: #0b5fa5;
    --bio-blue-dark: #084a82;
    --bio-blue-soft: #e8f1f9;
    --bio-teal: #0e8f8a;
    --bio-bg: #f3f6f9;
    --bio-border: #dfe6ed;
    --bio-text: #1d2b3a;
    --bio-muted: #6b7a8a;
    --sidebar-w: 264px;
    --bs-primary: var(--bio-blue);
    --bs-primary-rgb: 11, 95, 165;
    --bs-link-color: var(--bio-blue);
    --bs-link-hover-color: var(--bio-blue-dark);
    --bs-body-font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --bs-body-color: var(--bio-text);
    --bs-body-bg: var(--bio-bg);
    --bs-border-radius: .55rem;
}
.btn-primary { --bs-btn-bg: var(--bio-blue); --bs-btn-border-color: var(--bio-blue); --bs-btn-hover-bg: var(--bio-blue-dark); --bs-btn-hover-border-color: var(--bio-blue-dark); --bs-btn-active-bg: var(--bio-blue-dark); --bs-btn-disabled-bg: var(--bio-blue); }
.btn-outline-primary { --bs-btn-color: var(--bio-blue); --bs-btn-border-color: var(--bio-blue); --bs-btn-hover-bg: var(--bio-blue); --bs-btn-hover-border-color: var(--bio-blue); }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: #5b9bd1; box-shadow: 0 0 0 .2rem rgba(11, 95, 165, .18); }
.form-check-input:checked { background-color: var(--bio-blue); border-color: var(--bio-blue); }

/* ---------- Layout ---------- */
.app-shell { min-height: 100vh; display: flex; }
.sidebar {
    width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); background: #0a2540; color: #cfe0f1;
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand { padding: 1.15rem 1.25rem; display: flex; align-items: center; gap: .7rem; color: #fff; text-decoration: none; border-block-end: 1px solid rgba(255,255,255,.08); }
.sidebar .brand .logo { width: 38px; height: 38px; border-radius: .6rem; background: var(--bio-teal); display: grid; place-items: center; font-size: 1.25rem; flex: none; }
.sidebar .brand strong { display: block; font-size: .98rem; line-height: 1.15; }
.sidebar .brand small { color: #8fb0d0; font-size: .72rem; }
.sidebar nav { padding: .75rem .65rem 1.5rem; }
.sidebar .nav-link { color: #b9cfe4; border-radius: .5rem; padding: .55rem .8rem; display: flex; align-items: center; gap: .7rem; font-size: .93rem; }
.sidebar .nav-link i { font-size: 1.05rem; width: 1.25rem; text-align: center; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar .nav-link.active { background: var(--bio-blue); color: #fff; font-weight: 600; }
.sidebar .nav-section { text-transform: uppercase; letter-spacing: .08em; font-size: .68rem; color: #6f8fae; padding: 1rem .9rem .35rem; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { background: #fff; border-block-end: 1px solid var(--bio-border); padding: .65rem 1.25rem; display: flex; align-items: center; gap: 1rem; position: sticky; top: 0; z-index: 20; }
.topbar .page-title { font-weight: 600; font-size: 1.05rem; margin: 0; }
.content { padding: 1.5rem; flex: 1; }

.card { border: 1px solid var(--bio-border); box-shadow: 0 1px 2px rgba(10, 37, 64, .04); }
.card-header { background: #fff; border-block-end: 1px solid var(--bio-border); font-weight: 600; }
.table > :not(caption) > * > * { padding: .7rem .85rem; }
.table thead th { background: #f7f9fb; color: var(--bio-muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; border-block-end-width: 1px; }
.kpi { display: flex; gap: .9rem; align-items: center; }
.kpi .icon { width: 46px; height: 46px; border-radius: .7rem; background: var(--bio-blue-soft); color: var(--bio-blue); display: grid; place-items: center; font-size: 1.4rem; }
.kpi .value { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.kpi .label { color: var(--bio-muted); font-size: .82rem; }
.perm-matrix th.role-col { min-width: 120px; text-align: center; vertical-align: bottom; font-size: .72rem; }
.perm-matrix td.cell { text-align: center; }
.perm-matrix tr.module-row td { background: var(--bio-blue-soft); color: var(--bio-blue-dark); font-weight: 600; font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; }
.perm-matrix thead th { position: sticky; top: 0; z-index: 2; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background:
    radial-gradient(1100px 500px at 100% -10%, rgba(14,143,138,.18), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(11,95,165,.22), transparent 60%), var(--bio-bg); }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .logo { width: 56px; height: 56px; border-radius: 1rem; background: var(--bio-blue); color: #fff; display: grid; place-items: center; font-size: 1.7rem; margin: 0 auto 1rem; }

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
    .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 1040; transform: translateX(-100%); transition: transform .2s ease; }
    [dir="rtl"] .sidebar { transform: translateX(100%); }
    body.sidebar-open .sidebar { transform: none; }
    body.sidebar-open::after { content: ""; position: fixed; inset: 0; background: rgba(10,37,64,.45); z-index: 1030; }
    .content { padding: 1rem; }
}
@media print { .sidebar, .topbar, .no-print { display: none !important; } .content { padding: 0; } }
.auth-card.auth-wide { max-width: 680px; }

/* ---------- Etiquettes produit ---------- */
.label-sheet { display: flex; flex-wrap: wrap; gap: 4mm; padding: 6mm; }
.label { width: 70mm; height: 36mm; border: 1px dashed #bbb; padding: 2mm 3mm; display: flex; flex-direction: column; justify-content: space-between; break-inside: avoid; background: #fff; color: #000; }
.label-name { font-size: 9.5pt; font-weight: 600; line-height: 1.15; max-height: 2.4em; overflow: hidden; }
.label-body { display: flex; align-items: center; justify-content: space-between; gap: 3mm; }
.label-barcode { max-width: 44mm; height: 15mm; }
.label-qr { width: 15mm; height: 15mm; flex: none; }
.label-qr svg { width: 100%; height: 100%; }
.label-sku { font-size: 8pt; font-family: ui-monospace, Consolas, monospace; }
@media print { .label { border-color: transparent; } .label-sheet { padding: 0; } body { background: #fff !important; } }
