/* Kapolo Collecte — mobile d'abord, gros boutons, lisible en plein soleil. */
:root {
  --bg: #f6f4ec; --card: #ffffff; --ink: #1d2a1e; --muted: #5f6b60; --line: #dcd8c8;
  --green: #1b5e20; --green2: #2e7d32; --red: #c62828; --amber: #b26a00; --blue: #1565c0;
  --redbg: #fdecea; --amberbg: #fff4e0; --greenbg: #e8f5e9; --bluebg: #e3f2fd;
  --r: 12px; --shadow: 0 1px 3px rgba(0,0,0,.08);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121611; --card: #1c221b; --ink: #e8ece6; --muted: #a3ada0; --line: #2f382e;
    --green: #81c784; --green2: #66bb6a; --red: #ef9a9a; --amber: #ffcc80; --blue: #90caf9;
    --redbg: #3a1f1f; --amberbg: #3a2e18; --greenbg: #1f3320; --bluebg: #1a2a3a;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
a { color: var(--green2); }
h1 { font-size: 1.6rem; margin: .5rem 0; color: var(--green); }
h2 { font-size: 1.1rem; margin: 1.2rem 0 .6rem; }
h3 { font-size: 1.05rem; margin: 1.4rem 0 .5rem; color: var(--green); }
h4 { font-size: .95rem; margin: 1rem 0 .4rem; }
main { max-width: 860px; margin: 0 auto; padding: 12px 16px 24px; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.empty { text-align: center; color: var(--muted); padding: 2rem 0; }

header.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 8px 12px; padding-top: calc(8px + env(safe-area-inset-top)); background: #1b5e20; color: #fff; box-shadow: var(--shadow); }
header .logo { width: 36px; height: 36px; border-radius: 50%; background: #fff; }
header .back { color: #fff; text-decoration: none; font-size: 2rem; line-height: 1; padding: 0 6px; }
header .ttl { flex: 1; min-width: 0; display: flex; flex-direction: column; }
header .ttl b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
header .ttl small { opacity: .8; font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
header .gear { text-decoration: none; font-size: 1.3rem; }
.net { font-size: .7rem; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.net.on { background: #43a047; } .net.off { background: #ef6c00; }

nav.bottom { position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; display: flex; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
nav.bottom a { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 6px 2px 8px; font-size: .72rem; color: var(--muted); text-decoration: none; min-height: 56px; justify-content: center; }
nav.bottom a span { font-size: 1.35rem; }
nav.bottom a.act { color: var(--green); font-weight: 600; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 16px; border-radius: var(--r); border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-weight: 500; text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--green2); border-color: var(--green2); color: #fff; }
.btn.danger { color: var(--red); border-color: var(--red); }
.btn.big { width: 100%; min-height: 54px; font-size: 1.05rem; margin: 8px 0; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: .9rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.install { width: 100%; background: var(--bluebg); color: var(--blue); border-color: var(--blue); margin-bottom: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; margin: 8px 0; }
.stats > div { background: var(--card); border-radius: var(--r); padding: 12px; box-shadow: var(--shadow); text-align: center; border: 1px solid var(--line); }
.stats b { display: block; font-size: 1.7rem; }
.stats span { font-size: .8rem; color: var(--muted); }
.stats .amber b { color: var(--amber); } .stats .red b { color: var(--red); }
.banner { display: block; background: var(--amberbg); color: var(--amber); border-radius: var(--r); padding: 12px; text-decoration: none; font-weight: 600; margin: 8px 0; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.tile { display: flex; flex-direction: column; gap: 6px; padding: 14px 12px; min-height: 96px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--c); text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.tile .ic { font-size: 1.7rem; } .tile b { font-size: .95rem; line-height: 1.2; }

.list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.list .row { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--c, var(--line)); border-radius: var(--r); text-decoration: none; color: var(--ink); }
.row .ic { font-size: 1.6rem; } .row div { flex: 1; min-width: 0; display: flex; flex-direction: column; } .row small { color: var(--muted); } .chev { font-size: 1.5rem; color: var(--muted); }

.fld { margin: 12px 0; display: flex; flex-direction: column; gap: 4px; }
.fld > label { font-weight: 600; font-size: .92rem; }
.req { color: var(--red); font-style: normal; }
input, select, textarea { font: inherit; font-size: 16px; padding: 10px 12px; min-height: 46px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 3px solid color-mix(in srgb, var(--green2) 35%, transparent); border-color: var(--green2); }
.fld.chk label { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.fld.chk input { width: 24px; min-height: 24px; height: 24px; flex: none; margin-top: 2px; }
.help { color: var(--muted); font-size: .8rem; }
.datelong { color: var(--green); font-weight: 600; font-size: .85rem; text-transform: capitalize; }
.frm { border-top: 4px solid var(--c); padding-top: 4px; }

.w30 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.w30 .zone { grid-column: 1 / -1; font-weight: 600; font-size: .85rem; color: var(--muted); margin-top: 6px; }
.wcell { display: flex; flex-direction: column; font-size: .7rem; color: var(--muted); }
.wcell input { padding: 8px 4px; text-align: center; min-height: 42px; }
@media (min-width: 640px) { .w30 { grid-template-columns: repeat(10, 1fr); } }

.lines { display: flex; flex-direction: column; gap: 6px; }
.line { display: flex; gap: 6px; } .line > * { flex: 1; min-width: 0; }
.x, .line .x { flex: none; width: 40px; min-height: 40px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--red); cursor: pointer; }

.photos { display: flex; flex-wrap: wrap; gap: 8px; }
.ph { position: relative; } .ph img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.ph button { position: absolute; top: -6px; right: -6px; width: 26px; height: 26px; border-radius: 50%; border: none; background: var(--red); color: #fff; cursor: pointer; }
.photos.big img { width: 140px; height: 140px; object-fit: cover; border-radius: 8px; }
.photo-btn { margin-top: 4px; }

.live { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; margin: 16px 0 8px; scroll-margin-top: 70px; }
.mini { position: sticky; bottom: calc(60px + env(safe-area-inset-bottom)); display: flex; gap: 8px; align-items: center; justify-content: space-between; margin: 8px -4px; padding: 8px 12px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); box-shadow: 0 -2px 10px rgba(0,0,0,.08); color: var(--ink); text-decoration: none; font-size: .82rem; }
.mini span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; } .mini b { white-space: nowrap; }
.mini.err { border-color: var(--red); } .mini.warn { border-color: var(--amber); } .mini.ok { border-color: var(--green2); }
.sum { font-weight: 600; margin-bottom: 6px; }
.alerts { list-style: none; margin: 6px 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.alerts li { padding: 6px 10px; border-radius: 8px; font-size: .88rem; }
.alerts li.err { background: var(--redbg); color: var(--red); }
.alerts li.warn { background: var(--amberbg); color: var(--amber); }
.alerts li.info { background: var(--bluebg); color: var(--blue); }
.alerts.ok { background: var(--greenbg); color: var(--green); padding: 6px 10px; border-radius: 8px; font-size: .88rem; }
table.calc, table.kv, table.rep { width: 100%; border-collapse: collapse; font-size: .9rem; margin: 6px 0; }
table.calc td, table.kv th, table.kv td, table.rep td { padding: 5px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.kv th { width: 42%; color: var(--muted); font-weight: 500; }
table.rep td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; } .filters > * { flex: 1; min-width: 140px; }
.filters label { display: flex; flex-direction: column; font-size: .85rem; }
.card { display: block; background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--c); border-radius: var(--r); padding: 10px 12px; margin: 8px 0; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); flex: 1; min-width: 0; }
.card-h { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.card-d { font-size: .8rem; color: var(--muted); } .card-s { font-size: .9rem; margin-top: 2px; overflow-wrap: anywhere; } .card-a { font-size: .8rem; margin-top: 4px; }
.red { color: var(--red); } .amber { color: var(--amber); }
.badge { font-size: .7rem; padding: 2px 8px; border-radius: 99px; white-space: nowrap; font-weight: 600; }
.badge.green { background: var(--greenbg); color: var(--green); } .badge.red { background: var(--redbg); color: var(--red); }
.badge.amber { background: var(--amberbg); color: var(--amber); } .badge.blue { background: var(--bluebg); color: var(--blue); } .badge.gray { background: var(--line); color: var(--muted); }
.vrow { display: flex; gap: 8px; align-items: center; } .vrow > input { width: 26px; min-height: 26px; height: 26px; flex: none; }
.detail { border-top: 4px solid var(--c); padding-top: 8px; }
.valbox { padding: 8px 12px; border-radius: 8px; margin: 8px 0; font-size: .9rem; } .valbox.valide { background: var(--greenbg); color: var(--green); } .valbox.rejete { background: var(--redbg); color: var(--red); }

.brow { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 8px; border: 1px dashed var(--line); border-radius: 10px; margin: 6px 0; }
.brow .b-c { grid-column: 1 / -1; } .brow .b-r { display: flex; align-items: center; gap: 6px; font-size: .85rem; } .brow .b-r input { width: 22px; min-height: 22px; }

.setup { max-width: 460px; margin: 0 auto; padding: 32px 16px; text-align: center; }
.setup label { display: flex; flex-direction: column; text-align: left; font-weight: 600; margin: 14px 0; gap: 4px; }
.setup .hint { font-size: .82rem; color: var(--muted); text-align: left; }
.biglogo { display: block; margin: 0 auto 8px; width: 120px; height: 120px; border-radius: 24px; }
.setup h1 { text-align: center; }
.rephead { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; }
.help-page p { margin: .3rem 0 .8rem; }
code { background: var(--line); padding: 1px 5px; border-radius: 4px; }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 20px); opacity: 0; transition: .3s; background: #263238; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 50; max-width: 92vw; font-size: .92rem; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.toast.show { opacity: 1; transform: translate(-50%, 0); } .toast.ok { background: #2e7d32; } .toast.err { background: #c62828; }

@media print {
  header.top, nav.bottom, .actions, .filters, .toast { display: none !important; }
  body { background: #fff; color: #000; padding: 0; } main { max-width: none; }
}

/* --- v2 : assistant, identification, modales, signature, billetage --- */
.steps { list-style: none; display: flex; gap: 4px; padding: 0; margin: 0 0 16px; overflow-x: auto; }
.steps li { flex: 1; font-size: .68rem; text-align: center; padding: 6px 2px; border-bottom: 3px solid var(--line); color: var(--muted); white-space: nowrap; }
.steps li.on { border-color: var(--green2); color: var(--green); font-weight: 700; } .steps li.done { border-color: var(--green2); }
.setup form { text-align: left; } .setup h2 { text-align: left; }
.checks { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.checks label, .chk1 { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; font-weight: 500; }
.checks input, .chk1 input { width: 22px; min-height: 22px; height: 22px; flex: none; margin-top: 1px; }
.people { display: flex; flex-direction: column; gap: 8px; }
.person { flex-direction: column; } .person small { font-weight: 400; font-size: .8rem; opacity: .75; }
.who { color: #fff; text-decoration: underline; }
.modal-bg { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--card); color: var(--ink); border-radius: 14px; padding: 16px; width: 100%; max-width: 440px; max-height: 90vh; overflow: auto; box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.modal h3 { margin-top: 0; }
canvas.sig { width: 100%; max-width: 600px; aspect-ratio: 600 / 220; height: auto; background: #fff; border: 1px dashed var(--line); border-radius: 10px; touch-action: none; }
.sigimg { max-width: 300px; width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.billets { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.billets label { display: flex; flex-direction: column; font-size: .75rem; color: var(--muted); } .billets input { text-align: center; }
.banner.red { background: var(--redbg); color: var(--red); }
details.ecr { margin-top: 8px; } details summary { cursor: pointer; font-weight: 600; color: var(--green); padding: 4px 0; }
table.ecrt th { text-align: left; font-size: .8rem; color: var(--muted); padding: 4px 6px; } table.ecrt td.n, table.ecrt th.n { text-align: right; white-space: nowrap; }
.ph.au { display: flex; align-items: center; } .ph.au audio { height: 40px; max-width: 240px; }
.photos.big audio { width: 100%; max-width: 320px; }
.brow > input, .brow > select, .brow > textarea { min-width: 0; }
.help-page ul { padding-left: 1.2rem; } .help-page li { margin: .3rem 0; }
