/* ============================================================
   Tek-Log hors-ligne — thème (identique à l'application principale)
   ============================================================ */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('../vendor/inter/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url('../vendor/inter/inter-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap; src: url('../vendor/inter/inter-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 800; font-display: swap; src: url('../vendor/inter/inter-latin-800-normal.woff2') format('woff2'); }

:root {
  --blue: #005eb8; --blue-dark: #004a99; --blue-soft: #eaf2fc;
  --navy: #071a33; --gold: #ffb500;
  --ink: #0f172a; --muted: #64748b; --line: #e7ebf0; --bg: #f3f6fa; --card: #fff;
  --green: #16a34a; --green-soft: #ecfdf3; --amber: #d97706; --amber-soft: #fff7e6;
  --red: #dc2626; --red-soft: #fef2f2; --violet: #7c3aed;
  --radius: 16px; --nav-h: 64px; --head-h: 60px;
}
:root[data-theme="dark"] {
  --ink: #e5e7eb; --muted: #94a3b8; --line: #263244; --bg: #0b1220; --card: #111a2b;
  --blue-soft: #10243f; --green-soft: #0e2a1b; --amber-soft: #2b1f0a; --red-soft: #2c1215;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; font-size: 15px; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); }
.hidden { display: none !important; }
.muted, .t2 { color: var(--muted); font-size: .86rem; }

/* ---------- Écran de démarrage / connexion ---------- */
.splash { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--navy); z-index: 50; }
.splash img { height: 34px; }
.login { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 20px 16px; background: linear-gradient(rgba(7,26,51,.86), rgba(7,26,51,.94)), url('../../img/background.jpg') center/cover no-repeat; }
.login-card { width: 100%; max-width: 420px; background: var(--card); border-radius: 22px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.4); }
.login-head { padding: 26px 24px 20px; background: linear-gradient(120deg, #06264d, #004a99); color: #fff; text-align: center; }
.login-head img.logo { height: 30px; }
.login-head h1 { font-size: 1.2rem; margin: 14px 0 4px; font-weight: 800; }
.login-head p { margin: 0; font-size: .86rem; color: rgba(255,255,255,.8); }
.login-body { padding: 22px 24px 24px; }
.login-note { display: flex; gap: 10px; align-items: flex-start; font-size: .84rem; color: var(--muted); background: var(--blue-soft); border-radius: 12px; padding: 10px 12px; margin-bottom: 16px; }
.login-note .bi { color: var(--blue); font-size: 1.1rem; }
.login-foot { text-align: center; padding: 0 24px 20px; }
.login-foot img { height: 26px; opacity: .9; }

/* ---------- Champs et boutons ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .8rem; font-weight: 700; margin-bottom: 6px; color: var(--ink); }
.input, select.input, textarea.input { width: 100%; height: 48px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); outline: none; transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; min-height: 90px; padding: 10px 14px; }
.input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(0,94,184,.12); }
.input[aria-invalid="true"] { border-color: var(--red); }
.field-error { color: var(--red); font-size: .78rem; margin-top: 5px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 16px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); font-weight: 700; cursor: pointer; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: linear-gradient(180deg, #ffc22e, var(--gold)); border-color: var(--gold); color: var(--navy); box-shadow: 0 6px 16px rgba(255,181,0,.28); }
.btn-blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-danger { color: var(--red); border-color: #fecaca; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-block { width: 100%; }
.btn-lg { height: 54px; font-size: 1.02rem; border-radius: 14px; }
.btn-sm { height: 36px; padding: 0 12px; font-size: .84rem; border-radius: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1.5px solid var(--line); background: var(--card); border-radius: 20px; padding: 6px 12px; font-size: .82rem; font-weight: 700; color: var(--muted); cursor: pointer; }
.chip.active { background: var(--blue); border-color: var(--blue); color: #fff; }

/* ---------- Structure ---------- */
.app { min-height: 100%; padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
.topbar { position: sticky; top: 0; z-index: 20; height: var(--head-h); display: flex; align-items: center; gap: 10px; padding: 0 14px; background: var(--navy); color: #fff; }
.topbar img { height: 22px; }
.topbar .title { font-weight: 800; font-size: 1rem; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.net { display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; font-weight: 700; padding: 5px 10px; border-radius: 20px; background: rgba(255,255,255,.1); white-space: nowrap; cursor: pointer; border: 0; color: #fff; }
.net .dot { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
.net.on .dot { background: #4ade80; }
.net.off .dot { background: #f87171; }
.net.sync .dot { background: var(--gold); animation: pulse 1s infinite; }
.net .badge { background: var(--gold); color: var(--navy); border-radius: 10px; padding: 0 6px; font-size: .7rem; }
.net .badge.red { background: #f87171; color: #fff; }
@keyframes pulse { 50% { opacity: .3; } }
.main { max-width: 1100px; margin: 0 auto; padding: 16px 14px 24px; }
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--card); border-top: 1px solid var(--line); }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: .7rem; font-weight: 700; color: var(--muted); text-decoration: none; }
.bottom-nav a .bi { font-size: 1.3rem; }
.bottom-nav a.active { color: var(--blue); }
.bottom-nav a.go .bi { background: var(--gold); color: var(--navy); width: 42px; height: 42px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; margin-top: -14px; box-shadow: 0 8px 18px rgba(255,181,0,.4); }
@media (min-width: 900px) {
  .app { padding-bottom: 0; padding-left: 230px; }
  .bottom-nav { top: var(--head-h); bottom: 0; right: auto; width: 230px; height: auto; display: flex; flex-direction: column; align-items: stretch; gap: 2px; padding: 12px 10px; border-top: 0; border-right: 1px solid var(--line); }
  .bottom-nav a { flex-direction: row; justify-content: flex-start; gap: 10px; padding: 10px 12px; border-radius: 10px; font-size: .9rem; }
  .bottom-nav a.active { background: var(--blue-soft); }
  .bottom-nav a.go .bi { margin: 0; width: 30px; height: 30px; border-radius: 9px; font-size: 1rem; box-shadow: none; }
  .bottom-nav .more-desktop { display: flex !important; }
}
.bottom-nav .more-desktop { display: none !important; }

/* ---------- Cartes ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h2 { font-size: 1rem; margin: 0; font-weight: 800; }
.page-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head h1 { font-size: 1.3rem; margin: 0; font-weight: 800; flex: 1; }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
@media (min-width: 700px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; text-decoration: none; color: inherit; display: block; }
.kpi .l { font-size: .76rem; color: var(--muted); font-weight: 700; display: flex; gap: 6px; align-items: center; }
.kpi .v { font-size: 1.6rem; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi.red .v { color: var(--red); } .kpi.amber .v { color: var(--amber); } .kpi.green .v { color: var(--green); }
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; margin-bottom: 12px; font-size: .88rem; border: 1px solid transparent; }
.banner .bi { font-size: 1.2rem; flex-shrink: 0; }
.banner.info { background: var(--blue-soft); color: var(--ink); border-color: #bfdbfe; }
.banner.warn { background: var(--amber-soft); color: #7c4a03; border-color: #fde4a6; }
.banner.err { background: var(--red-soft); color: #991b1b; border-color: #fecaca; }
.banner.ok { background: var(--green-soft); color: #166534; border-color: #bbf7d0; }
.banner .act { margin-left: auto; }

/* ---------- Listes ---------- */
.search { position: relative; display: flex; gap: 8px; margin-bottom: 12px; }
.search .bi-search { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 40px; flex: 1; }
.scan-btn { flex: 0 0 48px; height: 48px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); color: var(--blue); font-size: 1.2rem; cursor: pointer; }
.list { display: flex; flex-direction: column; gap: 8px; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; text-align: left; width: 100%; cursor: pointer; color: inherit; }
.item:hover { border-color: #c7d2e0; }
.item .av { width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: .82rem; color: #fff; }
.item .main-t { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .sub { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .grow { flex: 1; min-width: 0; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px; font-size: .72rem; font-weight: 800; white-space: nowrap; }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.amber { background: var(--amber-soft); color: var(--amber); }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.blue { background: var(--blue-soft); color: var(--blue); }
.pill.gray { background: #eef2f7; color: var(--muted); }
.pill.tmp { background: #fff4d6; color: #92400e; }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty .bi { font-size: 2rem; display: block; margin-bottom: 8px; color: #cbd5e1; }
.more { display: block; margin: 12px auto 0; }

/* ---------- Feuille (bas d'écran) ---------- */
.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(7,26,51,.5); display: none; align-items: flex-end; justify-content: center; }
.scrim.show { display: flex; }
.sheet { width: 100%; max-width: 620px; max-height: 92vh; overflow-y: auto; background: var(--card); border-radius: 22px 22px 0 0; padding: 10px 18px calc(18px + env(safe-area-inset-bottom)); animation: up .22s ease; }
.sheet .grab { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
.sheet h3 { margin: 4px 0 14px; font-size: 1.1rem; font-weight: 800; }
@media (min-width: 700px) { .scrim { align-items: center; } .sheet { border-radius: 22px; } }
@keyframes up { from { transform: translateY(30px); opacity: .5; } to { transform: none; opacity: 1; } }
.sheet-actions { display: flex; gap: 8px; margin-top: 16px; }
.sheet-actions .btn { flex: 1; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .9rem; margin: 0; }
.dl dt { color: var(--muted); font-weight: 600; } .dl dd { margin: 0; font-weight: 600; }

/* ---------- Scanner (assets/scanner.js) ---------- */
.scan-stage { position: relative; width: 100%; aspect-ratio: 1; max-height: 60vh; background: #000; border-radius: 16px; overflow: hidden; }
.scan-stage video { width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; inset: 18%; border: 3px solid var(--gold); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0,0,0,.25); }
.scan-msg { margin-top: 10px; font-size: .86rem; color: var(--muted); text-align: center; min-height: 1.2em; }

/* ---------- Carte de lecteur ---------- */
.rcard { width: 100%; max-width: 340px; aspect-ratio: 85.6 / 54; margin: 0 auto; border-radius: 14px; overflow: hidden; background: #fff; color: #0f172a; box-shadow: 0 10px 30px rgba(0,0,0,.15); display: flex; flex-direction: column; border: 1px solid var(--line); }
.rcard-top { background: linear-gradient(120deg, #06264d, #004a99); padding: 8px 12px; display: flex; align-items: center; justify-content: space-between; border-bottom: 3px solid var(--gold); }
.rcard-top img { height: 14px; }
.rcard-top span { color: #fff; font-size: .62rem; font-weight: 800; letter-spacing: .08em; }
.rcard-body { flex: 1; display: flex; gap: 10px; padding: 10px 12px; align-items: center; }
.rcard-body .qr svg { width: 86px; height: 86px; display: block; }
.rcard-body .n { font-weight: 800; font-size: .95rem; }
.rcard-body .c { font-family: ui-monospace, Consolas, monospace; font-size: .8rem; margin-top: 4px; }
.rcard-body .e { font-size: .7rem; color: #64748b; margin-top: 4px; }

/* ---------- Divers ---------- */
.toast-wrap { position: fixed; left: 12px; right: 12px; bottom: calc(var(--nav-h) + 12px); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; max-width: 480px; width: 100%; background: #0f172a; color: #fff; border-radius: 12px; padding: 12px 14px; font-size: .88rem; display: flex; gap: 10px; align-items: center; box-shadow: 0 12px 30px rgba(0,0,0,.25); animation: up .2s ease; }
.toast.err { background: #991b1b; } .toast.ok .bi { color: #4ade80; }
.cart { display: flex; flex-direction: column; gap: 6px; }
.steps { display: flex; gap: 6px; margin-bottom: 14px; }
.steps span { flex: 1; height: 5px; border-radius: 3px; background: var(--line); }
.steps span.on { background: var(--blue); }
.progress { height: 8px; border-radius: 8px; background: var(--line); overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, #22c55e, var(--green)); }
.lesson ol { padding-left: 20px; } .lesson li { margin-bottom: 8px; line-height: 1.5; }
.tip { border-radius: 12px; padding: 10px 12px; margin-top: 10px; font-size: .9rem; }
.tip.ex { background: var(--blue-soft); } .tip.ko { background: #fff8e6; }
.opt { display: block; width: 100%; text-align: left; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); margin-bottom: 8px; cursor: pointer; font-weight: 600; }
.opt.sel { border-color: var(--blue); background: var(--blue-soft); }
.update-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 90; background: var(--gold); color: var(--navy); padding: 10px 14px; display: flex; gap: 10px; align-items: center; font-weight: 700; font-size: .88rem; }
@media print {
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area { position: absolute; left: 0; top: 0; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }

/* Champs obligatoires et erreurs par champ */
.req { color: #dc2626; font-weight: 800; }
.ferr { color: #dc2626; font-size: .8rem; margin-top: 4px; min-height: 0; }
.ferr:empty { display: none; }
.input.invalid { border-color: #dc2626; box-shadow: 0 0 0 3px rgba(220, 38, 38, .12); }

/* Écran d'installation */
.inst-card { max-width: 480px; }
.inst-lang { justify-content: center; margin-top: 12px; }
.inst-lang .chip { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.25); }
.inst-lang .chip.active { background: #ffb500; color: #071a33; border-color: #ffb500; }
.inst-big { font-size: 1.1rem; padding: 16px; }
.inst-hint { text-align: center; font-size: .82rem; margin: 8px 0 0; }
.inst-state { text-align: center; padding: 6px 0 4px; }
.inst-state > .bi { font-size: 2.6rem; color: var(--blue); }
.inst-state.ok > .bi { color: #16a34a; }
.inst-state.warn > .bi { color: #d97706; }
.inst-state h2, .inst-h { font-size: 1.15rem; margin: 8px 0 6px; }
.inst-state p { color: var(--muted); line-height: 1.5; margin: 0 0 14px; }
.inst-steps { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 10px; }
.inst-steps li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.inst-steps .n { flex: 0 0 26px; height: 26px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: .85rem; }
.inst-steps .bi { margin-left: auto; font-size: 1.3rem; color: var(--blue); }
.inst-benefits { list-style: none; padding: 0; margin: 18px 0 14px; display: grid; gap: 8px; font-size: .9rem; }
.inst-benefits li { display: flex; gap: 10px; align-items: flex-start; }
.inst-benefits .bi { color: var(--blue); font-size: 1.1rem; }
.return-bar { background: #15803d; color: #fff; top: auto; bottom: 0; flex-wrap: wrap; }
@media (min-width: 900px) { .return-bar { left: 240px; } }
