:root {
  --bleu: #1d3f8f;
  --bleu-clair: #e8eefb;
  --rouge: #d62e2e;
  --jaune: #e6b400;
  --vert: #2e9e46;
  --gris: #6b7280;
  --bord: #d9dee8;
  --fond: #f4f6fa;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--fond); color: #1f2937;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; font-size: 16px; }
#app { min-height: 100%; display: flex; flex-direction: column; }
.hidden { display: none !important; }

/* Barre du haut */
.topbar { background: var(--bleu); color: #fff; padding: calc(var(--safe-t) + 12px) 14px 12px;
  display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 5; }
.topbar h1 { font-size: 17px; font-weight: 600; margin: 0; flex: 1; letter-spacing: .3px; }
.topbar button { background: none; border: 0; color: #fff; font-size: 22px; padding: 2px 6px; cursor: pointer; }
.menu { position: absolute; right: 8px; top: calc(var(--safe-t) + 48px); background: #fff; color: #111;
  border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.2); overflow: hidden; min-width: 190px; z-index: 20; }
.menu button { display: block; width: 100%; text-align: left; padding: 14px 16px; border: 0; background: #fff;
  font-size: 16px; color: #111; border-bottom: 1px solid #eee; }

/* Contenu */
.content { flex: 1; padding: 14px 14px calc(90px + var(--safe-b)); }
.card { background: #fff; border-radius: 10px; padding: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.06); margin-bottom: 12px; }
.logo { text-align: center; margin: 26px 0 18px; }
.logo .titre { font-size: 30px; font-weight: 700; color: var(--bleu); letter-spacing: 2px; }
.logo .sous { color: var(--gris); font-size: 13px; margin-top: 4px; }
label { display: block; font-size: 13px; color: var(--gris); margin: 12px 0 4px; }
input, textarea, select { width: 100%; font-size: 16px; padding: 11px 12px; border: 1px solid var(--bord);
  border-radius: 8px; background: #fff; color: #111; font-family: inherit; }
input[readonly] { background: #f1f3f7; color: #444; }
input:focus, textarea:focus { outline: 2px solid var(--bleu); border-color: transparent; }
textarea { min-height: 70px; resize: vertical; }
.row { display: flex; gap: 10px; } .row > * { flex: 1; }
.btn { display: block; width: 100%; padding: 14px; font-size: 16px; font-weight: 600; border-radius: 9px; border: 0;
  background: var(--bleu); color: #fff; margin-top: 16px; cursor: pointer; }
.btn.sec { background: var(--bleu-clair); color: var(--bleu); }
.btn.danger { background: var(--rouge); }
.btn:disabled { opacity: .5; }
.info { font-size: 13px; color: var(--gris); margin-top: 10px; line-height: 1.4; }
.vide { text-align: center; color: var(--gris); padding: 40px 10px; }

/* Barre du bas */
.bottombar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--bleu); display: flex;
  padding-bottom: var(--safe-b); z-index: 5; }
.bottombar button { flex: 1; background: none; border: 0; color: #fff; padding: 10px 4px 11px; font-size: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; }
.bottombar button .ico { font-size: 22px; line-height: 1; }

/* Listes */
.liste { background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.item { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-bottom: 1px solid #eef0f4;
  cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.item:last-child { border-bottom: 0; }
.item:active { background: #f3f6fc; }
.item .txt { flex: 1; min-width: 0; }
.item .l1 { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
.item .l2 { font-size: 13px; color: var(--gris); margin-top: 2px; }
.pastille { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.st-TRANSFERED { background: var(--vert); } .st-WAITING { background: var(--jaune); }
.st-CREATED, .st-INPROGRESS { background: var(--rouge); }
.num { text-align: right; font-size: 13px; color: #333; white-space: nowrap; }
.entete { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 14px; }
.entete b { color: var(--bleu); }
.recherche { margin-bottom: 10px; }
.compteur { text-align: center; font-size: 22px; font-weight: 700; color: var(--bleu); margin: 30px 0 4px; }

/* Scanner */
.scan-wrap { position: fixed; inset: 0; background: #000; z-index: 30; display: flex; flex-direction: column; }
.scan-wrap video { flex: 1; width: 100%; object-fit: cover; }
.scan-cadre { position: absolute; left: 50%; top: 45%; width: 64vw; height: 64vw; max-width: 320px; max-height: 320px;
  transform: translate(-50%, -50%); border: 3px solid rgba(255,255,255,.9); border-radius: 14px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.45); }
.scan-txt { position: absolute; top: calc(var(--safe-t) + 20px); width: 100%; text-align: center; color: #fff; font-size: 15px; }
.scan-actions { position: absolute; bottom: calc(var(--safe-b) + 20px); left: 20px; right: 20px; display: flex; gap: 10px; }
.scan-actions .btn { margin: 0; }

/* Toast & modale */
.toast { position: fixed; left: 50%; bottom: calc(var(--safe-b) + 84px); transform: translateX(-50%); background: #222;
  color: #fff; padding: 10px 16px; border-radius: 20px; font-size: 14px; opacity: 0; transition: opacity .25s;
  pointer-events: none; z-index: 50; max-width: 90vw; text-align: center; }
.toast.show { opacity: .95; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; display: flex; align-items: center;
  justify-content: center; padding: 20px; }
.modal .boite { background: #fff; border-radius: 12px; width: 100%; max-width: 380px; padding: 18px; }
.modal h3 { margin: 0 0 8px; font-size: 17px; color: var(--bleu); }
.modal p { margin: 0; white-space: pre-line; line-height: 1.4; font-size: 15px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.modal .actions button { border: 0; background: none; color: var(--bleu); font-weight: 700; font-size: 15px; padding: 8px 12px; }
.spinner { width: 34px; height: 34px; border: 4px solid #dbe3f5; border-top-color: var(--bleu); border-radius: 50%;
  animation: tourne 1s linear infinite; margin: 10px auto; }
@keyframes tourne { to { transform: rotate(360deg); } }
.badge-demo { background: var(--jaune); color: #000; font-size: 11px; padding: 2px 6px; border-radius: 4px; font-weight: 700; }
