/* Maluku Kitoko — style
   Mise en page : colonne de navigation à gauche sur ordinateur, barre basse sur téléphone ;
   les trois carrés ProxyTeam (rouge, orange, vert) servent de repère et de code d'état. */
:root {
  --bg: #f3f2ee;
  --surface: #ffffff;
  --surface-2: #f8f7f3;
  --ink: #15171a;
  --muted: #5f6266;
  --line: #e1dfd7;
  --red: #c8102e;
  --red-ink: #a50d26;
  --orange: #f2a51a;
  --green: #1e7b3c;
  --blue: #2a6fdb;
  --tint-red: #fbe9ec;
  --tint-orange: #fdf1db;
  --tint-green: #e4f2e8;
  --tint-blue: #e6eefb;
  --focus: #2a6fdb;
  --shadow: 0 1px 2px rgba(20, 22, 26, .06), 0 4px 16px rgba(20, 22, 26, .05);
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --r: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111214; --surface: #1b1d20; --surface-2: #222428; --ink: #ecebe6; --muted: #a2a4a7; --line: #2f3236;
    --red: #ec4a63; --red-ink: #ff8496; --orange: #f4b443; --green: #47b26c; --blue: #6c9cf0;
    --tint-red: #3a1d22; --tint-orange: #3a2e17; --tint-green: #1a3123; --tint-blue: #1c2840;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111214; --surface: #1b1d20; --surface-2: #222428; --ink: #ecebe6; --muted: #a2a4a7; --line: #2f3236;
  --red: #ec4a63; --red-ink: #ff8496; --orange: #f4b443; --green: #47b26c; --blue: #6c9cf0;
  --tint-red: #3a1d22; --tint-orange: #3a2e17; --tint-green: #1a3123; --tint-blue: #1c2840;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5; -webkit-text-size-adjust: 100%; }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; font-weight: 800; }
h2 { font-size: 1.05rem; font-weight: 800; margin-bottom: .75rem; }
h3 { font-size: .98rem; font-weight: 700; }
p { margin: 0 0 .6rem; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.block { display: block; }
.center { text-align: center; justify-content: center; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; }
.row.gap { gap: .5rem; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; gap: .75rem; }
.mt { margin-top: .9rem; }
.legal { font-size: .78rem; color: var(--muted); border-top: 1px dashed var(--line); padding-top: .5rem; margin-top: .75rem; }

/* ---------- Charpente ---------- */
#app { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 2px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand b { display: block; font-size: 1.05rem; font-weight: 800; }
.brand small { color: var(--muted); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; }
.brand-sq { display: inline-flex; gap: 3px; }
.brand-sq i { width: 12px; height: 12px; display: block; }
.brand-sq.sm i { width: 9px; height: 9px; }
.brand-sq.lg i { width: 22px; height: 22px; }
.brand-sq .r { background: #c8102e; } .brand-sq .o { background: #f2a51a; } .brand-sq .g { background: #1e7b3c; }
.side a { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 9px; text-decoration: none; color: var(--muted); font-weight: 600; }
.side a:hover { background: var(--surface-2); color: var(--ink); }
.side a.on { background: var(--tint-red); color: var(--red-ink); }
.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--bg); }
.top-commune { display: flex; align-items: center; gap: 10px; min-width: 0; }
.top-commune b { display: block; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-commune small { display: block; color: var(--muted); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52vw; }
.top-right { display: flex; align-items: center; gap: 8px; }
.top-commune .brand-sq { display: none; }
main { padding: 20px max(16px, env(safe-area-inset-right, 0px)) 110px max(16px, env(safe-area-inset-left, 0px)); max-width: 1180px; width: 100%; outline: none; }
.demo-band { background: var(--tint-blue); color: var(--ink); font-size: .82rem; padding: 6px max(16px, env(safe-area-inset-left, 0px)); border-bottom: 1px solid var(--line); }
.bottom { display: none; }

.sync { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 10px; font: 600 .78rem var(--font); color: var(--ink); cursor: pointer; }
.sync.good { color: var(--green); } .sync.warn { color: #9a6200; background: var(--tint-orange); } .sync.bad { color: var(--red-ink); background: var(--tint-red); } .sync.info { color: var(--blue); }
.role-switch { max-width: 170px; }

/* ---------- Page ---------- */
.page { display: flex; flex-direction: column; gap: 16px; }
.page-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin: .35rem 0 0; max-width: 70ch; }
.eyebrow { font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--red-ink); font-weight: 800; margin: 0 0 .25rem; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; min-width: 0; }
.card.tint { background: var(--tint-orange); border-color: transparent; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.kv { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 6px 14px; margin: 0; }
.kv dt { color: var(--muted); font-size: .86rem; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.kv a, .list a, .tbl a { color: var(--blue); text-decoration: none; font-weight: 600; }
.note { background: var(--surface-2); border-left: 3px solid var(--blue); padding: 9px 12px; border-radius: 6px; font-size: .9rem; }
.note.warn { border-color: var(--orange); background: var(--tint-orange); }
.note.bad { border-color: var(--red); background: var(--tint-red); }
.note.legal { border-color: var(--line); color: var(--muted); font-size: .8rem; }
.empty-state { text-align: center; padding: 22px 8px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-state p { margin: 0; }

/* ---------- Boutons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 700 .92rem var(--font); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--red-ink); border-color: var(--red); background: transparent; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.sm { min-height: 34px; padding: 4px 10px; font-size: .84rem; }
.btn.lg { min-height: 50px; padding: 10px 18px; font-size: 1rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; flex: none; text-decoration: none; }
.linkish { background: none; border: 0; color: var(--muted); text-decoration: underline; font: inherit; font-size: .82rem; cursor: pointer; margin-top: 8px; }
.sticky-actions { position: sticky; bottom: calc(72px + env(safe-area-inset-bottom, 0px)); display: flex; justify-content: flex-end; gap: 8px; padding: 10px 0; background: linear-gradient(transparent, var(--bg) 30%); z-index: 5; }

/* ---------- Pastilles ---------- */
.pill { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 700; white-space: nowrap; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.pill.good { background: var(--tint-green); color: var(--green); border-color: transparent; }
.pill.warn { background: var(--tint-orange); color: #8a5800; border-color: transparent; }
.pill.bad { background: var(--tint-red); color: var(--red-ink); border-color: transparent; }
.pill.info { background: var(--tint-blue); color: var(--blue); border-color: transparent; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill.warn, :root:not([data-theme="light"]) .sync.warn { color: var(--orange); } }
:root[data-theme="dark"] .pill.warn, :root[data-theme="dark"] .sync.warn { color: var(--orange); }

/* ---------- Listes ---------- */
.list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.card .list { border-radius: 10px; }
.row-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; background: transparent; width: 100%; text-align: left; font: inherit; cursor: pointer; }
.row-item:last-child { border-bottom: 0; }
a.row-item:hover, button.row-item:hover { background: var(--surface-2); }
.row-title { font-weight: 700; overflow-wrap: anywhere; }
.row-sub { color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }
.row-right { flex: none; }
.relier-item { border-bottom: 1px solid var(--line); }
.relier-item:last-child { border-bottom: 0; }
.relier-item .row-item { border-bottom: 0; }
.sugg { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 0 14px 12px; }
ul.plain { margin: 0; padding-left: 1.1rem; }
.searchlist { display: flex; flex-direction: column; gap: 10px; }
.search { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; color: var(--muted); }
.search input { border: 0; background: transparent; padding: 11px 0; flex: 1; min-width: 0; font: inherit; color: var(--ink); outline: none; }
.chips, .tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chip, .tab { flex: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font: 600 .85rem var(--font); color: var(--muted); text-decoration: none; cursor: pointer; }
.chip.on, .tab.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: left; font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.total td { font-weight: 800; border-top: 2px solid var(--ink); }
.tbl input, .tbl select { min-height: 36px; padding: 6px 8px; }
.tbl.tarifs td { vertical-align: middle; }
.tbl.matrix td.center { text-align: center; }
.tbl.dossier td.decision { min-width: 180px; border-left: 1px solid var(--line); font-weight: 600; }
.w-sm { width: 72px; } .w-md { width: 120px; }

/* ---------- Formulaires ---------- */
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form-section { grid-column: 1 / -1; font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--red-ink); margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.form-section:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.form .note, .form .field:has(.seg), .form .field:has(.pick), .form .field:has(.checks), .form .field:has(textarea), .form .field:has(.media-field), .form .field:has(.gps-field), .form .field.wide { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-weight: 700; font-size: .9rem; }
.field .req { color: var(--red); }
.field.invalid input, .field.invalid select, .field.invalid textarea, .field.invalid .seg, .field.invalid .pick { border-color: var(--red); box-shadow: 0 0 0 2px var(--tint-red); }
.hint { font-size: .8rem; color: var(--muted); margin: 0; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 10px 11px; min-height: 44px; width: 100%; min-width: 0; }
textarea { resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; min-height: 0; accent-color: var(--red); flex: none; margin: 0; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; border-radius: 10px; }
.seg button { flex: 1 1 auto; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); font: 600 .9rem var(--font); color: var(--ink); cursor: pointer; }
.seg button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.checks { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow-y: auto; }
.check, .opt { display: flex; align-items: center; gap: 10px; padding: 8px 4px; cursor: pointer; }
.pick { display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: var(--surface); }
.pick input { border: 0; min-height: 38px; padding: 6px 4px; }
.pick-sel { display: flex; flex-wrap: wrap; gap: 6px; }
.pick-sel:empty { display: none; }
.pick-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--tint-blue); color: var(--ink); border-radius: 999px; padding: 4px 4px 4px 12px; font-weight: 600; font-size: .88rem; }
.pick-chip button { border: 0; background: var(--surface); width: 26px; height: 26px; border-radius: 50%; cursor: pointer; color: var(--ink); font-size: 1rem; }
.pick-res { display: flex; flex-direction: column; }
.pick-opt { text-align: left; border: 0; background: transparent; padding: 9px 8px; border-radius: 8px; font: 600 .92rem var(--font); color: var(--ink); cursor: pointer; display: flex; align-items: center; gap: 4px; }
.pick-opt:hover { background: var(--surface-2); }
.pick-opt small { color: var(--muted); font-weight: 500; }
.pick-opt.new { color: var(--red-ink); }
.media-field, .gps-field { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.gps-field .row { width: 100%; }
.thumb { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); cursor: zoom-in; display: flex; align-items: center; justify-content: center; color: var(--muted); background: var(--surface-2); }
.thumb.file { width: auto; padding: 8px 12px; gap: 6px; height: auto; cursor: default; font-size: .85rem; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.photo-lg { width: 100%; max-height: 260px; object-fit: cover; border-radius: 10px; margin-top: 12px; cursor: zoom-in; }
.sigwrap { border: 1px dashed var(--muted); border-radius: 10px; background: #fff; touch-action: none; }
.sigpad { width: 100%; height: auto; display: block; touch-action: none; }

/* ---------- Fenêtres et messages ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 100; background: rgba(10, 11, 13, .45); display: flex; align-items: flex-end; justify-content: center; padding: 0; }
.modal { background: var(--surface); width: 100%; max-width: 620px; max-height: 92vh; display: flex; flex-direction: column; border-radius: 16px 16px 0 0; box-shadow: var(--shadow); padding-bottom: env(safe-area-inset-bottom, 0px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; }
.modal-body { padding: 16px; overflow-y: auto; }
.modal-body .form { grid-template-columns: 1fr; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
#toasts { position: fixed; z-index: 200; left: 50%; transform: translateX(-50%); bottom: calc(86px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 8px; width: min(92vw, 460px); }
.toast { background: var(--ink); color: var(--bg); padding: 11px 14px; border-radius: 10px; box-shadow: var(--shadow); font-weight: 600; font-size: .9rem; transition: opacity .3s, transform .3s; }
.toast.err { background: var(--red); color: #fff; }
.toast.warn { background: var(--orange); color: #1b1300; }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---------- Tableau de bord ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; }
.stat b { font-size: 1.45rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .84rem; }
.money-band { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.4fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.money-band > div { background: var(--surface); padding: 14px 16px; display: flex; flex-direction: column; min-width: 0; }
.money-band span { color: var(--muted); font-size: .82rem; }
.money-band b { font-size: 1.2rem; font-weight: 800; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.money-band .big { background: var(--ink); color: var(--bg); }
.money-band .big span { color: inherit; opacity: .75; }
.money-band .big b { font-size: 1.7rem; }
.money-band .split { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: baseline; }
.money-band .split b { font-size: 1rem; text-align: right; }
.alerts { display: flex; flex-direction: column; gap: 8px; }
.alert { display: block; padding: 10px 14px; border-radius: 10px; text-decoration: none; font-weight: 600; font-size: .92rem; border-left: 4px solid var(--blue); background: var(--tint-blue); }
.alert.warn { border-color: var(--orange); background: var(--tint-orange); }
.alert.bad { border-color: var(--red); background: var(--tint-red); }
.meter { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); min-width: 80px; }
.meter.lg { height: 12px; }
.meter i { display: block; height: 100%; background: var(--green); border-radius: 99px; }
.progress-line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.progress-line .meter { flex: 1 1 200px; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-dasharray: 3 4; }
.chart .axis { stroke: var(--muted); }
.chart .bar { fill: color-mix(in srgb, var(--green) 45%, var(--surface)); }
.chart .bar.last { fill: var(--green); }
.chart .tick { fill: var(--muted); font-size: 11px; text-anchor: middle; font-family: var(--font); }
.chart .val { fill: var(--ink); font-size: 12px; font-weight: 700; text-anchor: middle; font-family: var(--font); }

/* ---------- Questionnaire ---------- */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.choice { display: flex; flex-direction: column; gap: 6px; padding: 18px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: inherit; }
.choice svg { color: var(--red); }
.choice small { color: var(--muted); }
.choice:hover { border-color: var(--red); }

/* ---------- Paramètres ---------- */
.reglage { display: flex; flex-direction: column; gap: 10px; }
.reglage.todo { border-left: 4px solid var(--orange); }
.reglage-head { display: flex; gap: 12px; align-items: flex-start; }
.reglage-head .code { font-weight: 800; font-size: .82rem; background: var(--ink); color: var(--bg); border-radius: 6px; padding: 2px 7px; flex: none; }
.opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 2px 12px; }
.extras { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.extras:empty { display: none; }
.reglage-foot { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 10px; }
.reglage-foot input { flex: 1 1 240px; }

/* ---------- Déploiement ---------- */
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.step { display: flex; gap: 12px; align-items: flex-start; }
.step-dot { flex: none; width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; background: var(--surface); border: 2px solid var(--line); margin-top: 10px; }
.step.fait .step-dot { background: var(--green); border-color: var(--green); color: #fff; }
.step.en_cours .step-dot { border-color: var(--orange); color: var(--ink); }
.step.bloque .step-dot { border-color: var(--red); color: var(--red-ink); }
.step .card { display: flex; flex-direction: column; gap: 8px; }
.step select { width: auto; }
.mini { display: flex; flex-direction: column; gap: 2px; font-size: .78rem; color: var(--muted); flex: 1 1 160px; }

/* ---------- Carte, QR, reçu ---------- */
.map { height: min(70vh, 640px); border-radius: var(--r); border: 1px solid var(--line); background: var(--surface-2); z-index: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: .85rem; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.qr-plate { margin: 0 auto; width: min(100%, 320px); border: 3px solid #15171a; border-radius: 14px; padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 4px; background: #fff; color: #15171a; }
.qr-plate .qr-num { font-size: 3rem; font-weight: 800; line-height: 1; }
.qr-plate .qr-rue { font-weight: 700; text-align: center; }
.qr-plate .qr svg { width: 180px; height: 180px; }
.qr-plate small { color: #555; }
.qr-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.qr-plate.sm .qr-num { font-size: 2rem; }
.qr-plate.sm .qr svg { width: 120px; height: 120px; }
.receipt { max-width: 640px; }
.receipt-head { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 2px solid var(--ink); }
.receipt-head b, .receipt-head small { display: block; }
.receipt-head .right { text-align: right; }
.receipt .tbl { margin: 12px 0; }
.menu-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.menu-grid a { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); text-decoration: none; font-weight: 600; font-size: .85rem; text-align: center; }
.menu-grid a svg { color: var(--red); }

/* ---------- Connexion ---------- */
.login { grid-column: 1 / -1; min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px max(16px, env(safe-area-inset-left, 0px)); background:
  linear-gradient(90deg, #c8102e 0 33.3%, #f2a51a 33.3% 66.6%, #1e7b3c 66.6%) bottom / 100% 10px no-repeat, var(--bg); }
.login-card { width: min(100%, 420px); display: flex; flex-direction: column; gap: 16px; }
.login-brand h1 { font-size: 2.6rem; font-weight: 800; letter-spacing: -.03em; margin-top: 14px; }
.login-brand p { color: var(--muted); }
.login-form { display: flex; flex-direction: column; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.login-status { color: var(--red-ink); min-height: 1.2em; margin: 0; font-size: .9rem; }
.login-foot { color: var(--muted); font-size: .76rem; margin: 0;text-align:center;width:100%; }

/* ---------- Téléphone ---------- */
@media (max-width: 900px) {
  #app { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .top-commune .brand-sq { display: inline-flex; }
  .grid2, .form { grid-template-columns: minmax(0, 1fr); }
  .money-band { grid-template-columns: 1fr 1fr; }
  .money-band .big, .money-band .split { grid-column: 1 / -1; }
  .bottom { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--surface); border-top: 1px solid var(--line); padding: 4px max(4px, env(safe-area-inset-right, 0px)) calc(4px + env(safe-area-inset-bottom, 0px)) max(4px, env(safe-area-inset-left, 0px)); }
  .bottom a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; text-decoration: none; color: var(--muted); font-size: .7rem; font-weight: 700; }
  .bottom a.on { color: var(--red-ink); }
  .bottom a.fab svg { background: var(--red); color: #fff; border-radius: 14px; padding: 6px; width: 40px; height: 40px; margin-top: -14px; box-shadow: var(--shadow); }
  h1 { font-size: 1.35rem; }
  .top-right .role-switch { display: none; }
  .page-head .page-actions { width: 100%; }
  .tbl .w-md { width: 96px; }
  .sync span { display: none; }
  .sync { padding: 7px; }
  .modal-wrap { align-items: flex-end; }
}
@media (min-width: 901px) {
  .modal-wrap { align-items: center; padding: 24px; }
  .modal { border-radius: 16px; }
  .sticky-actions { bottom: 0; }
  #toasts { bottom: 24px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Impression ---------- */
@media print {
  .side, .bottom, .topbar, .demo-band, .page-actions, .sticky-actions, .no-print, .btn, .icon-btn, #toasts, .tabs, .chips, .search { display: none !important; }
  #app { display: block; }
  main { padding: 0; max-width: none; }
  body { background: #fff; color: #000; }
  .card { border: 1px solid #bbb; break-inside: avoid; }
  .map { height: 680px; }
}

/* ---------- Console ProxyTeam (v2) ---------- */
.bottom.single { grid-template-columns: 1fr; }
.login-commune { font-size: 1.15rem; font-weight: 800; color: var(--red-ink); margin: 4px 0 6px; }
.checklist { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.checklist li.ok { background: var(--tint-green); border-color: transparent; }
.checklist li.ko { background: var(--tint-orange); border-color: transparent; }
.checklist .mark { flex: none; width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: .8rem; background: var(--surface); }
.checklist li.ok .mark { color: var(--green); }
.checklist li.ko .mark { color: #8a5800; }
.commune-row { flex-wrap: wrap; cursor: default; }
.commune-row .row-sub a { color: var(--blue); font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.note.bad { border-color: var(--red); background: var(--tint-red); }

/* ---------- v2.1 : mot de passe provisoire ---------- */
.temp-pass { font: 800 1.5rem/1.2 ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; letter-spacing: .08em; background: var(--surface-2); border: 2px dashed var(--orange); border-radius: 10px; padding: 10px 14px; text-align: center; user-select: all; overflow-wrap: anywhere; }
span.temp-pass { display: inline-block; font-size: 1.05rem; padding: 2px 8px; }

/* ---------- 2.2 : écoute (explications à voix haute) ---------- */
.ec-row { margin-top: 8px; display: flex; }
.ec-login { justify-content: center; margin: 4px 0 10px; }
.ec-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--red-ink); font: inherit; font-size: .82rem; font-weight: 700; padding: 5px 12px 5px 9px; border-radius: 999px; cursor: pointer; line-height: 1.2; }
.ec-btn:hover { border-color: var(--red); background: var(--tint-red); }
.ec-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ec-btn.sm { padding: 3px; width: 26px; height: 26px; justify-content: center; border-radius: 50%; flex: none; }
.ec-lab { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ec-lab > label { flex: 1; min-width: 0; }
.form-section.ec-has { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.modal-head .ec-btn { margin-left: auto; margin-right: 6px; }
.ec-player { position: fixed; z-index: 150; left: 50%; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom, 0px)); width: min(94vw, 440px); max-height: 62vh; overflow: auto; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 10px 40px rgba(10, 11, 13, .22); padding: 12px 14px 12px; }
.ec-player.ec-above-nav { bottom: calc(74px + env(safe-area-inset-bottom, 0px)); }
.ec-player.ec-top { top: calc(10px + env(safe-area-inset-top, 0px)); bottom: auto; }
@media (min-width: 901px) { .ec-player { left: auto; right: 20px; transform: none; bottom: 20px; } .ec-player.ec-above-nav { bottom: 20px; } }
.ec-head { display: flex; align-items: center; gap: 10px; color: var(--red-ink); }
.ec-head b { display: block; color: var(--ink); font-size: .95rem; line-height: 1.25; }
.ec-count { color: var(--muted); font-size: .76rem; }
.ec-prog { height: 4px; background: var(--surface-2); border-radius: 4px; margin: 10px 0; overflow: hidden; }
.ec-prog i { display: block; height: 100%; width: 0; background: var(--red); transition: width .3s; }
.ec-ctls { display: flex; align-items: center; justify-content: center; gap: 8px; }
.ec-ctl { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.ec-ctl.main { width: 54px; height: 54px; background: var(--red); border-color: var(--red); color: #fff; }
.ec-ctl.ghost { border: 0; width: 34px; height: 34px; color: var(--muted); }
.ec-rate { width: auto; flex: none; margin-left: 4px; font: inherit; font-size: .8rem; padding: 6px 4px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.ec-txt-toggle { display: block; margin: 10px auto 0; background: none; border: 0; color: var(--muted); text-decoration: underline; font: inherit; font-size: .8rem; cursor: pointer; }
.ec-text { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 8px; font-size: .88rem; line-height: 1.5; }
.ec-text p { margin: 0 0 8px; padding: 4px 8px; border-radius: 8px; cursor: pointer; }
.ec-text p.on { background: var(--tint-orange); }
.ec-warn { font-size: .8rem; background: var(--tint-orange); border-radius: 8px; padding: 8px 10px; margin: 10px 0 0; }
@media print { .ec-btn, .ec-player { display: none !important; } }

/* ---------- 2.2 : démonstration depuis la page de connexion ---------- */
.login-demo { text-align: center; margin: 4px 0 0; }
.login-demo .linkish { margin-top: 0; }
.demo-intro { text-align: left; }
.demo-intro .lead { font-size: .98rem; margin: 0 0 10px; }
.demo-points { margin: 0 0 14px; padding-left: 18px; font-size: .86rem; color: var(--muted); }
.demo-points li { margin-bottom: 6px; }
.demo-points b { color: var(--ink); }
.demo-h { font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--red-ink); margin: 8px 0 8px; }
.demo-profils { display: grid; gap: 8px; margin-bottom: 12px; }
.demo-profil { text-align: left; display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; }
.demo-profil:hover { border-color: var(--red); background: var(--tint-red); }
.demo-profil b { font-size: .92rem; }
.demo-profil span { font-size: .8rem; color: var(--muted); }
.field.half { min-width: 0; }
.estim { background: var(--tint-green); border-radius: 8px; padding: 8px 10px; font-size: .86rem; margin: 8px 0 0; }
.tarif-supp { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .85rem; color: var(--muted); }
.tarif-supp input { width: 90px; }
.tarif-supp-row td { background: var(--surface-2); border-top: 0; padding-top: 4px; }
.tbl.tarifs select { min-width: 84px; }
.mes { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.mes-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.mes-item p { margin: 2px 0 0; }
.mes-dot { flex: none; width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: .85rem; color: #fff; background: var(--orange); }
.mes-item.ok .mes-dot { background: var(--green); }
.mes-q { margin-top: 12px; }
.mes-q summary { cursor: pointer; font-weight: 700; color: var(--red-ink); }
.mes-q h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 12px 0 4px; }
.mes-q li { margin: 4px 0; }
.guide-wrap { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: #fff; margin-top: 12px; }
.guide-frame { display: block; width: 100%; height: calc(100vh - 260px); min-height: 520px; border: 0; }
@media (max-width: 900px) { .guide-frame { height: calc(100vh - 230px); } }

/* ---------- v2.3 : pawaPay payment UI ---------- */

/* Operator badge shown next to phone field */
.pp-operator { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 20px; font-size: .82rem; font-weight: 700; background: var(--tint-green); color: var(--green); margin-top: 6px; }
.pp-operator.unknown { background: var(--tint-orange); color: var(--orange); }

/* Split preview table inside modal */
.pp-split { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: .9rem; }
.pp-split th { text-align: left; font-weight: 700; padding: 4px 8px; color: var(--muted); border-bottom: 1px solid var(--line); }
.pp-split td { padding: 6px 8px; border-bottom: 1px solid var(--line); }
.pp-split td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.pp-split tr.total td { font-weight: 800; background: var(--surface-2); }

/* Payment status polling animation */
.pp-pending { display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: 12px; background: var(--tint-blue); margin: 12px 0; }
.pp-spinner { width: 24px; height: 24px; border: 3px solid var(--line); border-top-color: var(--blue); border-radius: 50%; animation: pp-spin 0.8s linear infinite; flex: none; }
@keyframes pp-spin { to { transform: rotate(360deg); } }

/* Status badge colours on deposit status page */
.pp-status-COMPLETED { color: var(--green); font-weight: 700; }
.pp-status-FAILED, .pp-status-TIMED_OUT { color: var(--red); font-weight: 700; }
.pp-status-INITIATED, .pp-status-ACCEPTED { color: var(--orange); font-weight: 700; }

/* Split rules admin: percentage sum indicator */
.pp-pct-total { font-weight: 800; font-size: 1rem; padding: 4px 10px; border-radius: 8px; background: var(--tint-red); color: var(--red); }
.pp-pct-total.ok { background: var(--tint-green); color: var(--green); }

/* Beneficiary rows in split editor */
.pp-rule-rows { display: grid; gap: 8px; margin: 10px 0; }
.pp-rule-row { display: flex; align-items: center; gap: 8px; }
.pp-rule-row input[type="text"] { flex: 1; }
.pp-rule-row input[type="number"] { width: 80px; }
.pp-rule-row .btn.icon { padding: 8px; min-width: 0; }

/* Module tab group for split rules */
.pp-module-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.pp-module-tab { padding: 6px 12px; border-radius: 20px; border: 1px solid var(--line); font-size: .85rem; font-weight: 700; cursor: pointer; background: var(--surface); color: var(--muted); }
.pp-module-tab.on { background: var(--tint-red); color: var(--red-ink); border-color: transparent; }
