:root {
  --bg: #f3f5f9; --panel: #ffffff; --panel-2: #f8fafc; --ink: #0f172a; --muted: #5b6577; --line: #e2e8f0; --line-2: #cbd5e1;
  --brand: #1d4ed8; --brand-ink: #ffffff; --brand-soft: #e0e9ff;
  --side: #0b1220; --side-ink: #c7d0e0; --side-muted: #7c879b; --side-active: #1e2a44;
  --ok: #15803d; --ok-soft: #dcfce7; --warn: #b45309; --warn-soft: #fef3c7; --bad: #b91c1c; --bad-soft: #fee2e2;
  --info: #1d4ed8; --info-soft: #dbeafe; --gray-soft: #eef1f5;
  --in: #16a34a; --out: #2563eb;
  --radius: 10px; --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .06);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h2 { font-size: 15px; font-weight: 650; }
.muted { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- coque ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; font-weight: 700; font-size: 16px; letter-spacing: .01em; }
.brand-logo { width: 30px; height: 30px; border-radius: 8px; background: var(--brand); display: grid; place-items: center; }
.brand small { display: block; font-weight: 400; font-size: 11px; color: var(--side-muted); letter-spacing: 0; }
.nav { padding: 4px 10px 12px; flex: 1; }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--side-muted); padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--side-ink); font-weight: 500; }
.nav a:hover { background: #142036; text-decoration: none; color: #fff; }
.nav a.active { background: var(--side-active); color: #fff; box-shadow: inset 3px 0 0 var(--brand); }
.nav .count { margin-left: auto; background: var(--brand); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; font-weight: 600; }
.side-foot { border-top: 1px solid #1c2740; padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #23324f; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.side-foot .who { min-width: 0; flex: 1; }
.side-foot .who b { display: block; color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who span { font-size: 11px; color: var(--side-muted); }
.side-foot button { background: none; border: 0; color: var(--side-ink); cursor: pointer; padding: 6px; border-radius: 6px; }
.side-foot button:hover { background: #142036; color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; padding: 14px 24px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top h1 { font-size: 19px; font-weight: 650; }
.top .spacer { flex: 1; }
.top .menu-btn { display: none; }
.quick-scan { display: flex; align-items: center; gap: 6px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; }
.quick-scan input { border: 0; background: transparent; padding: 7px 4px; width: 220px; font: inherit; outline: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--gray-soft); color: var(--muted); white-space: nowrap; }
.view { padding: 20px 24px 40px; }
.loading { color: var(--muted); padding: 30px 0; }

/* ---------- composants ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 16px; min-width: 0; }
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-h h2 { margin-right: auto; }
.card.error { border-color: var(--bad); color: var(--bad); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid2 > .card { margin-bottom: 0; }
.grid2 + .card, .grid2 + .grid2 { margin-top: 16px; }
.stack > * + * { margin-top: 16px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar .spacer { flex: 1; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 550; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel); color: var(--ink); padding: 7px 12px; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--panel-2); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: #1e40af; }
.btn.danger { background: var(--panel); border-color: #fca5a5; color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--gray-soft); }
.btn.small { padding: 4px 9px; font-size: 12.5px; }
.btn.icon { padding: 5px 9px; font-size: 18px; line-height: 1; }
.btn.big { padding: 12px 18px; font-size: 16px; }
.input { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px; padding: 7px 10px; width: 100%; min-width: 0; }
.input:focus, .btn:focus-visible, .quick-scan:focus-within { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
select.input { padding-right: 6px; }
.toolbar .input { width: auto; }
.toolbar input[type=search] { min-width: 220px; }
label.inline { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); white-space: nowrap; }

.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--gray-soft); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.strike { text-decoration: line-through; }

/* tableaux */
.dt-tools { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.dt-tools .input { max-width: 320px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
.table { width: 100%; border-collapse: collapse; background: var(--panel); }
.table th, .table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { background: var(--panel-2); font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; position: sticky; top: 0; }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sorted-asc::after { content: " ▲"; font-size: 9px; }
.table th.sorted-desc::after { content: " ▼"; font-size: 9px; }
.table th.num, .table td.num { text-align: right; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #f8fafd; }
.table tr.clickable { cursor: pointer; }
.table td.actions { text-align: right; white-space: nowrap; }
.table td.actions .btn + .btn { margin-left: 4px; }
.table td.empty { text-align: center; color: var(--muted); padding: 22px; }
.table .sub { display: block; font-size: 12px; color: var(--muted); }

/* indicateurs */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); color: var(--ink); display: block; position: relative; overflow: hidden; }
a.kpi:hover { text-decoration: none; border-color: var(--line-2); }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--line-2); }
.kpi.ok::before { background: var(--ok); } .kpi.warn::before { background: #f59e0b; } .kpi.bad::before { background: var(--bad); } .kpi.info::before { background: var(--brand); }
.kpi span { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.kpi b { display: block; font-size: 24px; font-weight: 700; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--muted); }
.banner { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; background: var(--warn-soft); color: var(--warn); font-weight: 550; }
.banner.info { background: var(--info-soft); color: var(--info); }
.tasks { list-style: none; margin: 0; padding: 0; }
.tasks li a { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); color: var(--ink); }
.tasks li:last-child a { border-bottom: 0; }
.tasks li a:hover { text-decoration: none; background: var(--panel-2); }
.tasks .n { margin-left: auto; min-width: 28px; text-align: center; background: var(--brand-soft); color: var(--brand); border-radius: 999px; font-weight: 700; padding: 1px 8px; }
.empty-state { color: var(--muted); padding: 10px 0; }

/* import / export */
.dl-menu { position: relative; display: inline-block; }
.dl-menu > summary { list-style: none; }
.dl-menu > summary::-webkit-details-marker { display: none; }
.dl-menu > summary::after { content: "▾"; font-size: 11px; color: var(--muted); margin-left: 2px; }
.dl-pop { position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 210px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 4px; }
.dl-pop a { display: flex; justify-content: space-between; gap: 14px; padding: 7px 10px; border-radius: 6px; color: var(--ink); }
.dl-pop a:hover { background: var(--panel-2); text-decoration: none; }
.dl-pop a span { color: var(--muted); font-size: 12px; }
.xlist { list-style: none; margin: 0; padding: 0; }
.xlist li { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; padding: 9px 0; border-bottom: 1px solid var(--line); }
.xlist li:last-child { border-bottom: 0; }
.xlist li > span { flex: 1; min-width: 200px; font-weight: 550; }
.xlist .fmts { display: flex; flex-wrap: wrap; gap: 6px; }
.import-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 14px; }
.imp-cols p { margin: 10px 0 0; color: var(--muted); }
.imp-cols b { color: var(--ink); }
.imp-sum { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 14px 0 10px; }
@media (max-width: 760px) { .import-grid { grid-template-columns: 1fr; } .imp-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* graphiques */
.chart { width: 100%; height: auto; display: block; }
.chart .in { fill: var(--in); } .chart .out { fill: var(--out); }
.chart text { fill: var(--muted); font-size: 10px; font-family: var(--font); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart.cumul polyline { fill: none; stroke-width: 2; stroke-linejoin: round; } .chart.cumul .cur { stroke: var(--brand); fill: var(--brand); } .chart.cumul .prev { stroke: var(--line-2); fill: var(--line-2); stroke-dasharray: 4 3; }
.chart.cumul circle.cur, .chart.cumul circle.prev { stroke: none; } .chart.cumul polyline.cur, .chart.cumul polyline.prev { fill: none; }
.imp-paste { font-family: ui-monospace, Consolas, monospace; font-size: 12px; white-space: pre; overflow-x: auto; }
.strat { list-style: none; margin: 0; padding: 0; }
.strat li { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.strat li .sub { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }
.cons-kpis { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.delta { font-weight: 600; font-variant-numeric: tabular-nums; } .delta.up { color: var(--ok); } .delta.down { color: var(--bad); }
.cumul-t th .sub { font-weight: 400; text-transform: none; letter-spacing: 0; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 90px 1fr 110px; gap: 10px; align-items: center; font-size: 13px; }
.bar-track { background: var(--gray-soft); border-radius: 6px; height: 12px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--brand); border-radius: 6px; }
.progress { background: var(--gray-soft); border-radius: 999px; height: 8px; overflow: hidden; }
.progress > div { height: 100%; background: var(--ok); }

/* onglets */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 8px 12px; color: var(--muted); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }
.tabs .badge { margin-left: 4px; }

/* fenêtres */
#modal-root .modal-back { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: grid; place-items: start center; padding: 6vh 16px; overflow-y: auto; z-index: 100; }
.modal { background: var(--panel); border-radius: 12px; width: 100%; max-width: 560px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.modal.wide { max-width: 900px; }
.modal-h { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-h h2 { font-size: 17px; }
.modal-b { padding: 16px 18px 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; grid-column: 1 / -1; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.full, .form-intro, .form-error { grid-column: 1 / -1; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.field .help { color: var(--muted); font-size: 12px; }
.field.check label { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink); font-size: 14px; padding-top: 18px; }
.req { color: var(--bad); }
.form-sec { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-top: 6px; }
.table.tot { width: auto; min-width: 260px; margin: 10px 0 0 auto; }
.table.tot th { text-align: left; font-weight: 600; }
.form-intro { color: var(--muted); }
.form-error { background: var(--bad-soft); color: var(--bad); padding: 8px 12px; border-radius: 8px; font-weight: 550; }
.lines { display: grid; gap: 6px; margin-bottom: 6px; }
.lines-head, .line-row { display: grid; grid-template-columns: 1fr 90px auto; gap: 6px; align-items: center; }
.lines.priced .lines-head, .lines.priced .line-row { grid-template-columns: 1fr 90px 110px auto; }
.lines-head { font-size: 12px; color: var(--muted); font-weight: 600; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px 14px; }
.perm-grid label { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; cursor: pointer; }
.perm-grid small { display: block; color: var(--muted); font-size: 11.5px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin-bottom: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* notifications */
#toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 200; max-width: min(420px, calc(100vw - 36px)); }
.toast { background: #0f172a; color: #fff; padding: 11px 14px; border-radius: 10px; box-shadow: var(--shadow); font-weight: 500; border-left: 4px solid var(--ok); animation: pop .18s ease-out; }
.toast.err { border-left-color: #ef4444; } .toast.warn { border-left-color: #f59e0b; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* connexion */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 600px at 10% -10%, #dbe6ff, transparent), var(--bg); }
.login-card { width: 100%; max-width: 420px; background: var(--panel); border-radius: 14px; box-shadow: 0 20px 60px rgba(15, 23, 42, .12); padding: 28px; }
.login-card.wide { max-width: 640px; }
.login-card .brand { color: var(--ink); padding: 0 0 18px; }
.login-card .brand small { color: var(--muted); }
.login-card form { display: grid; gap: 12px; }
.login-card .btn.primary { width: 100%; padding: 10px; }
.demo-accounts { width: 100%; font-size: 13px; border-collapse: collapse; margin: 10px 0 16px; }
.demo-accounts td, .demo-accounts th { padding: 5px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.demo-accounts tr[data-act] { cursor: pointer; }
.demo-accounts tr[data-act]:hover { background: var(--panel-2); }
.choice { display: grid; gap: 10px; }

/* ---------- page d'accueil et connexion (écran partagé) ---------- */
.auth { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(440px, .8fr); min-height: 100vh; background: #fff; }
.auth-visual {
  position: relative; overflow: hidden; color: #e2e8f0; display: flex; flex-direction: column; justify-content: space-between;
  padding: 44px clamp(32px, 5vw, 72px) 48px;
  background:
    radial-gradient(900px 520px at 12% -8%, rgba(37, 99, 235, .42), transparent 62%),
    radial-gradient(700px 480px at 108% 108%, rgba(14, 165, 233, .22), transparent 60%),
    linear-gradient(160deg, #0b1324 0%, #0a1020 55%, #070b16 100%);
}
.auth-visual::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(148, 163, 184, .16) 1px, transparent 1px); background-size: 26px 26px; mask-image: linear-gradient(180deg, rgba(0, 0, 0, .9), rgba(0, 0, 0, .25)); pointer-events: none; }
.auth-visual > * { position: relative; }
.auth-mark { display: flex; align-items: center; gap: 12px; color: #fff; font-weight: 650; font-size: 17px; letter-spacing: -.01em; }
.auth-mark .brand-logo { width: 36px; height: 36px; border-radius: 10px; box-shadow: 0 8px 24px rgba(37, 99, 235, .45); }
.auth-mark small { display: block; font-weight: 450; font-size: 12px; color: #8a9ab5; letter-spacing: .02em; }
.auth-art { width: 100%; max-width: 620px; margin: 18px auto; display: block; }
.auth-pitch h1 { font-size: clamp(28px, 2.6vw, 40px); line-height: 1.12; font-weight: 650; letter-spacing: -.025em; color: #fff; margin: 0 0 14px; max-width: 16em; }
.auth-pitch h1 span { background: linear-gradient(90deg, #93c5fd, #67e8f9); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-pitch p { color: #94a3b8; font-size: 15.5px; line-height: 1.6; max-width: 34em; margin: 0 0 26px; }
.auth-features { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.auth-features li { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: #cbd5e1; line-height: 1.45; }
.auth-features li b { display: block; color: #fff; font-weight: 600; font-size: 14px; }
.auth-features .fi { flex: none; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: rgba(148, 163, 184, .1); border: 1px solid rgba(148, 163, 184, .18); color: #93c5fd; }
.auth-panel { display: flex; flex-direction: column; justify-content: center; padding: 48px clamp(24px, 5vw, 76px) 28px; background: #fff; }
.auth-box { width: 100%; max-width: 380px; margin: auto; animation: authIn .45s ease-out both; }
.auth-box.wide { max-width: 520px; }
.auth-box h2 { font-size: 26px; font-weight: 650; letter-spacing: -.02em; margin: 0 0 6px; color: #0b1324; }
.auth-box .lead { color: var(--muted); margin: 0 0 26px; font-size: 14.5px; line-height: 1.55; }
.auth-box form { display: grid; gap: 16px; }
.auth-box .field > label { font-size: 13px; font-weight: 600; color: #334155; }
.auth-box .input { height: 46px; border-radius: 10px; border-color: #d7dee8; padding: 10px 14px; font-size: 15px; background: #fbfcfe; transition: border-color .15s, box-shadow .15s, background .15s; }
.auth-box .input:focus { outline: none; background: #fff; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(29, 78, 216, .12); }
.auth-box .btn.primary { height: 48px; border-radius: 10px; font-size: 15px; font-weight: 600; box-shadow: 0 8px 20px rgba(29, 78, 216, .22); transition: transform .12s, box-shadow .12s, background .15s; }
.auth-box .btn.primary:hover { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(29, 78, 216, .28); }
.auth-box .btn.primary:active { transform: none; }
.auth-row { display: flex; justify-content: space-between; align-items: center; margin-top: -6px; font-size: 13.5px; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--brand); font-weight: 550; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 48px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; width: 36px; height: 36px; border-radius: 8px; color: #64748b; cursor: pointer; display: grid; place-items: center; }
.pw-toggle:hover { background: #f1f5f9; color: #0f172a; }
.auth-trust { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 26px; padding-top: 18px; border-top: 1px solid #edf1f6; color: #64748b; font-size: 12.5px; }
.auth-trust span { display: inline-flex; align-items: center; gap: 6px; }
.auth-trust svg.i { width: 15px; height: 15px; color: #16a34a; }
.auth-note { background: #f6f8fb; border: 1px solid #e6ebf2; border-radius: 10px; padding: 12px 14px; color: #475569; font-size: 13.5px; line-height: 1.5; }
.auth-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; border-radius: 10px; padding: 14px; font-size: 14px; line-height: 1.5; }
.auth-sep { display: flex; align-items: center; gap: 12px; color: #94a3b8; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.auth-sep::before, .auth-sep::after { content: ""; flex: 1; height: 1px; background: #e8edf3; }
.auth-foot { text-align: center; color: #94a3b8; font-size: 12px; margin-top: 28px; }
.auth-box .form-error { margin: 0; }
.auth-box .btn.secondary { height: 46px; border-radius: 10px; background: #fff; border: 1px solid #d7dee8; color: #0f172a; font-weight: 600; }
.auth-box .btn.secondary:hover { background: #f8fafc; }
.auth-back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 22px; color: #64748b; font-size: 13.5px; }
@keyframes authIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
/* illustration : flux animés entre les entrepôts */
.auth-art .flow { stroke-dasharray: 3 9; animation: flow 1.8s linear infinite; }
.auth-art .pulse { animation: pulse 2.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.auth-art .float { animation: float 6s ease-in-out infinite; }
@keyframes flow { to { stroke-dashoffset: -24; } }
@keyframes pulse { 0%, 100% { opacity: .35; transform: scale(1); } 50% { opacity: .9; transform: scale(1.6); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .auth-art .flow, .auth-art .pulse, .auth-art .float, .auth-box { animation: none; } }
@media (max-width: 1100px) { .auth-features { grid-template-columns: 1fr; gap: 12px; } }
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-visual { padding: 24px 22px 26px; padding-top: max(24px, env(safe-area-inset-top)); }
  .auth-art, .auth-features { display: none; }
  .auth-pitch h1 { font-size: 24px; margin: 20px 0 6px; }
  .auth-pitch p { font-size: 14px; margin: 0; }
  .auth-panel { padding: 30px 22px 22px; justify-content: flex-start; }
  .auth-box .input { font-size: 16px; }
}

/* scanner et caisse */
.scan-box { display: flex; gap: 8px; }
.scan-box .input { font-size: 18px; padding: 12px 14px; }
.art-card { display: grid; grid-template-columns: 1fr 260px; gap: 16px; align-items: start; }
.barcode { width: 100%; height: 56px; display: block; }
.barcode rect { fill: #000; }
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; max-height: calc(100vh - 260px); overflow-y: auto; padding: 2px; }
.product { text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px; cursor: pointer; font: inherit; color: var(--ink); display: flex; flex-direction: column; gap: 4px; min-height: 106px; }
.product:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.product:disabled { opacity: .45; cursor: not-allowed; }
.product b { font-size: 13.5px; }
.product .price { font-size: 16px; font-weight: 700; color: var(--brand); margin-top: auto; }
.cart { position: sticky; top: 80px; }
#pos-scan .input { width: 100%; }
.cart-lines { display: grid; gap: 6px; margin: 8px 0 12px; max-height: 42vh; overflow-y: auto; }
.cart-line { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.qty-ctl { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 8px; }
.qty-ctl button { border: 0; background: none; width: 28px; height: 28px; cursor: pointer; font-size: 16px; }
.qty-ctl span { min-width: 28px; text-align: center; font-weight: 600; }
.total { display: flex; justify-content: space-between; font-size: 22px; font-weight: 700; margin: 10px 0 14px; }
video.cam { width: 100%; border-radius: 8px; background: #000; }

/* application installable et accès mobile */
.nav-install { display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 10px; padding: 8px 10px; border-radius: 8px; border: 1px dashed #2b3a58; background: none; color: var(--side-ink); font: inherit; font-weight: 500; cursor: pointer; }
.nav-install:hover { background: #142036; color: #fff; }
.nav-install[hidden] { display: none; }
.tabbar { display: none; }
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.qr-card { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; border: 1px solid var(--line); border-radius: 10px; padding: 14px; word-break: break-all; }
.qr { width: 180px; height: 180px; image-rendering: pixelated; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.otp-input { font-size: 22px !important; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.recovery { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin: 10px 0; }
.recovery code { font-size: 15px; padding: 8px; text-align: center; letter-spacing: .05em; }
code { background: var(--gray-soft); padding: 1px 6px; border-radius: 5px; font-size: 12.5px; }

/* rapport d'expert */
.expert-head { display: flex; gap: 18px; align-items: center; padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.expert-head h3 { margin: 0 0 4px; font-size: 17px; }
.expert-head p { margin: 2px 0; }
.expert-note { flex: none; width: 92px; height: 92px; border-radius: 50%; display: flex; align-items: baseline; justify-content: center; padding-top: 26px; border: 6px solid var(--line-2); }
.expert-note b { font-size: 30px; line-height: 1; } .expert-note span { color: var(--muted); font-size: 13px; }
.expert-note.ok { border-color: var(--ok); } .expert-note.warn { border-color: #f59e0b; } .expert-note.bad { border-color: var(--bad); } .expert-note.info { border-color: var(--brand); }
.expert-body h3 { font-size: 15px; margin: 0 0 8px; }
.expert-list { list-style: none; margin: 0; padding: 0; }
.expert-list li { border-left: 4px solid var(--line-2); padding: 6px 10px; margin-bottom: 8px; background: var(--gray-soft); border-radius: 0 6px 6px 0; }
.expert-list li.ok { border-left-color: var(--ok); } .expert-list li.warn { border-left-color: #f59e0b; } .expert-list li.bad { border-left-color: var(--bad); } .expert-list li.info { border-left-color: var(--brand); }
.expert-list p { margin: 4px 0 0; }
.expert-dom { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.expert-val { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.expert-prio { font-size: 13px; margin: 10px 0 6px; text-transform: uppercase; letter-spacing: .03em; }
.expert-prio.p1 { color: var(--bad); } .expert-prio.p2 { color: var(--warn); }
.expert-plan { margin: 0 0 6px; padding-left: 22px; }
.expert-plan li { margin-bottom: 6px; }
.expert-plan small { display: block; color: var(--muted); }
@media (max-width: 600px) { .expert-head { flex-direction: column; align-items: flex-start; } }

/* impression */
#print-area { display: none; }
@media print {
  body.printing > *:not(#print-area) { display: none !important; }
  body.printing #print-area { display: block; }
  body { background: #fff; }
  .labels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4mm; }
  .label { border: 1px dashed #999; padding: 3mm; break-inside: avoid; text-align: center; font-size: 10pt; }
  .label-t { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .label-c { font-family: monospace; font-size: 11pt; letter-spacing: .05em; }
  .label-s { color: #444; font-size: 9pt; }
  .doc { font: 11pt/1.4 var(--font); }
  .doc h1 { font-size: 18pt; margin-bottom: 4mm; }
  .doc table { width: 100%; border-collapse: collapse; margin-top: 4mm; }
  .doc th, .doc td { border: 1px solid #999; padding: 2mm 3mm; text-align: left; }
  .doc .num { text-align: right; }
  .doc .meta { color: #333; margin-bottom: 4mm; }
  .doc h2 { font-size: 13pt; margin: 6mm 0 0; }
  .doc .doc-co { margin-bottom: 6mm; font-size: 10pt; line-height: 1.35; }
  .doc table.tot { width: auto; min-width: 70mm; margin-left: auto; }
  .doc table.tot th { text-align: left; font-weight: 600; }
}

/* petits écrans */
@media (max-width: 980px) {
  .grid2, .art-card, .pos { grid-template-columns: 1fr; }
  .cart { position: static; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 60; left: 0; top: 0; bottom: 0; width: 270px; transform: translateX(-100%); transition: transform .2s; padding-top: env(safe-area-inset-top); }
  body.nav-open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .4); }
  .top { padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); }
  .top h1 { font-size: 17px; }
  .top .menu-btn { display: inline-flex; }
  .top .chip, .quick-scan { display: none; }
  .view { padding: 14px 12px calc(84px + env(safe-area-inset-bottom)); }
  .form { grid-template-columns: 1fr; }
  .toolbar input[type=search] { min-width: 0; width: 100%; }
  .card { padding: 14px; border-radius: 12px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi b { font-size: 20px; }
  /* cibles tactiles et champs à 16 px (évite le zoom automatique sur iPhone) */
  .input, select.input, textarea.input { font-size: 16px; min-height: 42px; }
  .btn { min-height: 40px; }
  .btn.small { min-height: 34px; }
  .table th, .table td { padding: 10px; }
  .scan-box { flex-wrap: wrap; }
  .scan-box .input { flex: 1 1 100%; }
  .modal-back { padding: 0 !important; place-items: end center !important; }
  .modal { border-radius: 16px 16px 0 0; max-height: 92vh; overflow-y: auto; padding-bottom: env(safe-area-inset-bottom); }
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--panel); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -4px 16px rgba(15, 23, 42, .06); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 8px 2px 7px; color: var(--muted); font: 600 11px var(--font); background: none; border: 0; cursor: pointer; text-decoration: none; }
  .tabbar svg.i { width: 22px; height: 22px; }
  .tabbar a.active { color: var(--brand); }
  #toasts { bottom: calc(76px + env(safe-area-inset-bottom)); left: 12px; right: 12px; max-width: none; }
}
@media (display-mode: standalone) {
  body { overscroll-behavior-y: none; }
}

/* clés d'API */
.api-key code { display: block; font: 600 14px/1.5 Consolas, "Cascadia Mono", monospace; background: var(--panel-2); border: 1px solid var(--line); padding: 10px 12px; border-radius: 8px; word-break: break-all; user-select: all; }

/* inscription en ligne */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.plan { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line-2); border-radius: 10px; padding: 12px; cursor: pointer; background: var(--panel); }
.plan:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.plan > span { display: flex; flex-direction: column; gap: 4px; }
.plan .price { font-size: 18px; font-weight: 700; }
.plan small { color: var(--muted); }
.company-code { font: 700 28px/1.3 Consolas, "Cascadia Mono", monospace; letter-spacing: .06em; text-align: center; background: var(--panel-2); border: 1px dashed var(--brand); border-radius: 10px; padding: 14px; margin: 8px 0 14px; }
.login-link { margin: 14px 0 0; text-align: center; }
.plans.single input[type=radio] { display: none; }
.plans.single .plan { cursor: default; }
.tiers { list-style: none; margin: 6px 0 0; padding: 0; font-size: 13px; }
.tiers li { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border-bottom: 1px dashed var(--line); }
.tiers li:last-child { border-bottom: 0; }
.city-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.city-row { display: flex; gap: 6px; align-items: center; }
.city-row .input { flex: 1; min-width: 0; }
.seat-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.seat-row .input { width: 110px; }
.seat-price b { font-size: 18px; }
.seat-bar { height: 8px; background: var(--gray-soft); border-radius: 999px; overflow: hidden; margin: 6px 0 4px; }
.seat-bar > div { height: 100%; background: var(--brand); }

/* langues : sélecteur de langue et affichage de droite à gauche (arabe) */
.lang-pick { margin-top: 14px; display: flex; justify-content: center; }
.lang-pick .input { width: auto; min-width: 160px; }
[dir="rtl"] .num, [dir="rtl"] .table th.num, [dir="rtl"] .table td.num, [dir="rtl"] .table td.actions { text-align: left; }
[dir="rtl"] .table th, [dir="rtl"] .table td, [dir="rtl"] .demo-accounts td, [dir="rtl"] .demo-accounts th, [dir="rtl"] .product { text-align: right; }
[dir="rtl"] .nav .count, [dir="rtl"] .tasks .n { margin-left: 0; margin-right: auto; }
[dir="rtl"] .card-h h2 { margin-right: 0; margin-left: auto; }
[dir="rtl"] .nav a.active { box-shadow: inset -3px 0 0 var(--brand); }
[dir="rtl"] .kpi::before { left: auto; right: 0; }
[dir="rtl"] .table td.actions .btn + .btn { margin-left: 0; margin-right: 4px; }
[dir="rtl"] .dl-pop { right: auto; left: 0; }
[dir="rtl"] #toasts { right: auto; left: 18px; }
[dir="rtl"] .toast { border-left: 0; border-right: 4px solid var(--ok); }
[dir="rtl"] .toast.err { border-right-color: #ef4444; } [dir="rtl"] .toast.warn { border-right-color: #f59e0b; }
[dir="rtl"] .pw-wrap .input { padding-right: 10px; padding-left: 48px; }
[dir="rtl"] .pw-toggle { right: auto; left: 6px; }
[dir="rtl"] .steps { padding-left: 0; padding-right: 20px; }
[dir="rtl"] .legend i { margin-right: 0; margin-left: 5px; }
@media (max-width: 760px) {
  [dir="rtl"] .side { left: auto; right: 0; transform: translateX(100%); }
  [dir="rtl"] body.nav-open .side { transform: none; }
}

/* page d'accueil publique (avant connexion) */
.lp { min-height: 100vh; background: var(--bg); color: var(--ink); }
.lp-strip { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px; padding: 8px 16px; background: var(--side); color: #e2e8f0; font-size: 13.5px; }
.lp-strip a, .lp-strip > span { display: inline-flex; align-items: center; gap: 7px; color: #e2e8f0; }
.lp-strip .i { width: 15px; height: 15px; color: #93c5fd; }
.lp-top { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; max-width: 1180px; margin: 0 auto; padding: 14px 20px; }
.lp-brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.lp-brand .brand-logo { width: 36px; height: 36px; border-radius: 10px; }
.lp-brand b { display: block; font-size: 18px; letter-spacing: -.01em; }
.lp-brand small { display: block; color: var(--muted); font-size: 12px; }
.lp-nav { display: flex; gap: 18px; }
.lp-nav a { color: var(--ink); font-weight: 550; }
.lp-top .lang-pick { margin: 0; }
.lp-hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); gap: 32px; align-items: center; max-width: 1180px; margin: 6px auto 0; padding: 44px 40px; border-radius: 18px;
  background: radial-gradient(900px 420px at 0% 0%, rgba(96, 165, 250, .35), transparent), linear-gradient(135deg, #0b1220 0%, #12306e 60%, #1d4ed8 100%); color: #fff; }
.lp-kicker { display: inline-block; font-size: 12.5px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: #93c5fd; margin-bottom: 12px; }
.lp-pitch h1 { font-size: clamp(28px, 3.4vw, 44px); line-height: 1.1; letter-spacing: -.025em; margin: 0 0 14px; }
.lp-pitch p { color: #cbd5e1; font-size: 16.5px; line-height: 1.6; max-width: 36em; margin: 0 0 24px; }
.lp-cta { display: flex; gap: 10px; flex-wrap: wrap; }
.lp-cta .btn:not(.primary) { background: rgba(255, 255, 255, .08); color: #fff; border-color: rgba(255, 255, 255, .35); }
.lp-login { background: var(--panel); color: var(--ink); border-radius: 14px; padding: 24px; box-shadow: 0 20px 60px rgba(2, 6, 23, .35); }
.lp-login h2 { margin: 0 0 14px; font-size: 20px; }
.lp-login form { display: grid; gap: 12px; }
.lp-login .btn.primary { width: 100%; padding: 10px; }
.lp-section { max-width: 1180px; margin: 0 auto; padding: 40px 20px 8px; }
.lp-section > h2 { font-size: 24px; letter-spacing: -.02em; margin: 0 0 16px; }
.lp-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.lp-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px; box-shadow: var(--shadow); }
.lp-card h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 16px; }
.lp-card h3 .i { color: var(--brand); }
.lp-card dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 14px; }
.lp-card dt { color: var(--muted); }
.lp-card dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }
.lp-features { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.lp-features li { display: flex; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.lp-features .fi { flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.lp-features b { display: block; margin-bottom: 3px; }
.lp-features span { color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.lp-price { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px; max-width: 560px; box-shadow: var(--shadow); }
.lp-price .tiers { font-size: 15px; }
.lp-foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; max-width: 1180px; margin: 40px auto 0; padding: 22px 20px 30px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
@media (max-width: 860px) {
  .lp-hero { grid-template-columns: 1fr; margin: 0; border-radius: 0; padding: 28px 18px; }
  .lp-nav { display: none; }
}
[dir="rtl"] .lp-brand { margin-right: 0; margin-left: auto; }
.table .sub .fam { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 8px; font-size: 11px; line-height: 16px; background: color-mix(in srgb, var(--muted) 15%, transparent); color: var(--muted); }
.table .sub .fam.bad { background: var(--bad-soft); color: var(--bad); }
.table .sub .fam.warn { background: var(--warn-soft); color: var(--warn); }
.table .sub .fam.info { background: var(--info-soft); color: var(--info); }
