/* IMC Caisse — charte « Guide UI application IMC » v1.0 */
@font-face { font-family: Montserrat; font-weight: 400; font-display: swap; src: url(../fonts/montserrat-400.woff2) format('woff2'); }
@font-face { font-family: Montserrat; font-weight: 500 600; font-display: swap; src: url(../fonts/montserrat-600.woff2) format('woff2'); }
@font-face { font-family: Montserrat; font-weight: 700; font-display: swap; src: url(../fonts/montserrat-700.woff2) format('woff2'); }
@font-face { font-family: Montserrat; font-weight: 800; font-display: swap; src: url(../fonts/montserrat-800.woff2) format('woff2'); }

:root {
  --imc-petrol: #05687D; --imc-petrol-deep: #04495A; --imc-petrol-soft: #E3F1F4;
  --imc-ink: #0B0F10; --imc-ink-muted: #4A5A5E;
  --imc-surface: #FFFFFF; --imc-surface-alt: #F4F8F9; --imc-line: #D5E1E4;
  --imc-warm: #E07A56; --imc-warm-soft: #FBEDE6;
  --ok: #1E7F52; --ok-bg: #E4F3EC; --warn: #A86412; --warn-bg: #FBF0DF; --danger: #B83A2E; --danger-bg: #F8E3E0;
  --r-sm: 8px; --r-md: 16px;
  --shadow: 0 1px 3px rgba(11,15,16,.08); --shadow-lg: 0 12px 32px rgba(11,15,16,.16);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--imc-surface-alt); color: var(--imc-ink); font-family: Montserrat, Arial, sans-serif; font-size: 15px; line-height: 24px; }
body { min-height: 100vh; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font-family: inherit; font-size: 15px; color: inherit; }
h1 { font-size: 26px; line-height: 35px; font-weight: 700; margin: 0; }
h2 { font-size: 22px; line-height: 31px; font-weight: 700; margin: 0; }
h3 { font-size: 18px; line-height: 26px; font-weight: 600; margin: 0; }
.eyebrow { font-size: 13px; line-height: 18px; letter-spacing: .3em; font-weight: 500; text-transform: uppercase; color: var(--imc-petrol); }
.muted { color: var(--imc-ink-muted); }
.small { font-size: 13px; line-height: 18px; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.hidden { display: none !important; }

/* En-tête */
.topbar { background: var(--imc-petrol-deep); color: #fff; padding: 10px 16px; display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 20; }
.topbar img { width: 32px; height: 32px; border-radius: 8px; }
.topbar .t { flex: 1; min-width: 0; }
.topbar .t .eyebrow { color: var(--imc-petrol-soft); font-size: 12px; }
.topbar .t b { display: block; font-size: 16px; line-height: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .who { text-align: right; font-size: 13px; line-height: 18px; }
.topbar .who span { color: var(--imc-petrol-soft); }
.net { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: rgba(255,255,255,.12); }
.net::before { content: ''; width: 7px; height: 7px; border-radius: 999px; background: #9fb6bb; }
.net.on::before { background: #6fd3a5; }
.iconbtn { background: transparent; border: 1px solid rgba(255,255,255,.35); color: #fff; border-radius: var(--r-sm); height: 36px; padding: 0 10px; cursor: pointer; font-weight: 600; font-size: 13px; }

/* Navigation */
.tabs { display: flex; gap: 4px; padding: 8px 12px; background: var(--imc-surface); border-bottom: 1px solid var(--imc-line); overflow-x: auto; position: sticky; top: 56px; z-index: 19; }
.tabs button { flex: 0 0 auto; height: 40px; padding: 0 14px; border-radius: var(--r-sm); border: none; background: transparent; color: var(--imc-ink-muted); font-weight: 600; font-size: 14px; cursor: pointer; position: relative; }
.tabs button.on { color: var(--imc-petrol-deep); background: var(--imc-petrol-soft); }
.tabs button.on::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: 3px; height: 3px; border-radius: 3px; background: var(--imc-warm); }
.badge-count { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 999px; background: var(--imc-warm); color: #fff; font-size: 12px; line-height: 20px; text-align: center; }

main { max-width: 880px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
@media (min-width: 900px) { main { padding: 24px 32px 48px; } }

/* Cartes */
.card { background: var(--imc-surface); border: 1px solid var(--imc-line); border-radius: var(--r-md); padding: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; }
.card.focus { border: 2px solid var(--imc-petrol); }
.card-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
@media (min-width: 700px) { .grid4 { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; } }
@media (max-width: 699px) { .grid4 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; } }
.kpi { background: var(--imc-surface); border: 1px solid var(--imc-line); border-radius: var(--r-md); padding: 12px; }
.kpi .l { font-size: 13px; color: var(--imc-ink-muted); line-height: 18px; }
.kpi .v { font-size: 24px; line-height: 33px; font-weight: 800; font-variant-numeric: tabular-nums; }
.kpi.ok { background: var(--ok-bg); border-color: transparent; color: var(--ok); }
.kpi.danger { background: var(--danger-bg); border-color: transparent; color: var(--danger); }
.kpi.ok .l, .kpi.danger .l { color: inherit; }

/* Champs */
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 600; line-height: 20px; }
.inp, select.inp, textarea.inp { height: 44px; border-radius: var(--r-sm); border: 1px solid var(--imc-line); padding: 0 12px; background: #fff; width: 100%; font-weight: 400; }
textarea.inp { height: 72px; padding: 10px 12px; }
.inp:focus { outline: none; border-color: var(--imc-petrol); box-shadow: 0 0 0 3px rgba(5,104,125,.18); }
.inp.big { height: 52px; font-size: 22px; }
.inp.pin { height: 52px; font-size: 26px; letter-spacing: .5em; text-align: center; }
.err { color: var(--danger); font-size: 13px; font-weight: 600; }

/* Boutons */
.btn { height: 44px; border-radius: var(--r-sm); padding: 0 16px; font-weight: 600; font-size: 14px; cursor: pointer; border: 1px solid var(--imc-petrol); background: #fff; color: var(--imc-petrol); display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; }
.btn.primary { background: var(--imc-petrol); color: #fff; border-color: var(--imc-petrol); font-size: 16px; height: 48px; }
.btn.primary:hover { background: var(--imc-petrol-deep); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.dashed { border-style: dashed; }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.block { width: 100%; }
.choice { height: 48px; border-radius: var(--r-sm); border: 1px solid var(--imc-line); background: #fff; font-weight: 600; font-size: 14px; cursor: pointer; padding: 0 8px; }
.choice.on { border: 2px solid var(--imc-petrol); background: var(--imc-petrol-soft); color: var(--imc-petrol-deep); }
.choice:disabled { opacity: .5; cursor: not-allowed; }
.qty { display: flex; align-items: center; gap: 6px; }
.qty button { width: 36px; height: 36px; border-radius: var(--r-sm); border: 1px solid var(--imc-line); background: #fff; font-size: 20px; cursor: pointer; }
.qty b { min-width: 22px; text-align: center; }

/* Listes */
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--imc-line); }
.row:last-child { border-bottom: none; }
.row .main { flex: 1; min-width: 0; }
.row .main b { display: block; font-size: 15px; font-weight: 600; }
.list { display: flex; flex-direction: column; }
.list .item { padding: 12px 14px; border-bottom: 1px solid var(--imc-line); display: flex; justify-content: space-between; gap: 10px; cursor: pointer; background: #fff; text-align: left; border-left: none; border-right: none; border-top: none; width: 100%; }
.list .item:hover { background: var(--imc-surface-alt); }
.list .item.sel { background: var(--imc-petrol-soft); }
.card.flush { padding: 0; overflow: hidden; gap: 0; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--imc-ink-muted); font-weight: 500; text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--imc-line); }
table.t td { padding: 8px 6px; border-bottom: 1px solid var(--imc-line); vertical-align: top; }
.scroll { overflow-x: auto; }

/* Badges et bandeaux */
.badge { display: inline-block; font-size: 12px; font-weight: 600; line-height: 20px; border-radius: var(--r-sm); padding: 1px 8px; background: var(--imc-petrol-soft); color: var(--imc-petrol-deep); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.note { border-radius: var(--r-sm); padding: 10px 12px; font-size: 14px; line-height: 22px; background: var(--imc-petrol-soft); color: var(--imc-petrol-deep); }
.note.warn { background: var(--warn-bg); color: var(--warn); }
.note.danger { background: var(--danger-bg); color: var(--danger); }
.note.ok { background: var(--ok-bg); color: var(--ok); }
.note.warm { background: var(--imc-warm-soft); color: var(--imc-ink); }
.total { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--imc-line); padding-top: 8px; }
.total .v { font-size: 29px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* Fenêtres */
.modal-bg { position: fixed; inset: 0; background: rgba(11,15,16,.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 700px) { .modal-bg { align-items: center; } }
.modal { background: #fff; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: var(--r-md) var(--r-md) 0 0; padding: 18px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 12px; }
@media (min-width: 700px) { .modal { border-radius: var(--r-md); } }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--imc-ink); color: #fff; padding: 10px 16px; border-radius: var(--r-sm); z-index: 60; font-size: 14px; max-width: 92vw; box-shadow: var(--shadow-lg); }
.toast.err { background: var(--danger); }

/* Connexion */
.login { min-height: 100vh; display: flex; flex-direction: column; }
.login .head { background: #fff; padding: 36px 24px 20px; display: flex; flex-direction: column; align-items: center; gap: 12px; border-bottom: 1px solid var(--imc-line); }
.login .head img { width: 240px; max-width: 70vw; height: auto; }
.login .body { padding: 20px 16px 32px; display: flex; flex-direction: column; gap: 14px; max-width: 480px; width: 100%; margin: 0 auto; }
.agentbtn { min-height: 56px; border-radius: var(--r-sm); border: 1px solid var(--imc-line); background: #fff; display: flex; align-items: center; gap: 12px; padding: 8px 12px; text-align: left; cursor: pointer; width: 100%; }
.agentbtn.on { border: 2px solid var(--imc-petrol); }
.avatar { width: 34px; height: 34px; border-radius: 999px; background: var(--imc-petrol-soft); color: var(--imc-petrol-deep); display: flex; align-items: center; justify-content: center; font-weight: 700; flex: 0 0 auto; }
.agentbtn.on .avatar { background: var(--imc-petrol); color: #fff; }

/* Code d'autorisation */
.bigcode { font-size: 44px; font-weight: 800; letter-spacing: .12em; text-align: center; font-variant-numeric: tabular-nums; color: var(--imc-petrol-deep); }

/* Impression */
#print { display: none; }
@media print {
  body > *:not(#print) { display: none !important; }
  #print { display: block; }
  html, body { background: #fff; }
}
.doc { font-family: Montserrat, Arial, sans-serif; color: #000; }
.doc .c { text-align: center; }
.doc .line { display: flex; justify-content: space-between; gap: 8px; }
.doc .sep { border-top: 1px dashed #000; margin: 6px 0; }
.doc.ticket { width: 72mm; font-size: 11px; line-height: 15px; padding: 2mm; }
.doc.ticket img.logo { width: 52mm; display: block; margin: 0 auto 4px; }
.doc.a5 { width: 136mm; font-size: 12px; line-height: 17px; padding: 6mm; }
.doc.a5 img.logo { width: 60mm; }
.doc table { width: 100%; border-collapse: collapse; }
.doc th, .doc td { text-align: left; padding: 3px 2px; border-bottom: 1px solid #ccc; }
.doc .r { text-align: right; }
.doc .qr { width: 26mm; height: 26mm; }
.doc .exigez { font-weight: 700; text-align: center; border: 1px solid #000; padding: 3px; margin-top: 4px; }
.preview { background: #fff; border: 1px solid var(--imc-line); border-radius: var(--r-md); padding: 12px; overflow-x: auto; display: flex; justify-content: center; }
