* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #f3f4f6;
  color: #111827;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
main { max-width: 380px; margin: 0 auto; padding: 40px 16px; }
main:has(#v-admin:not([hidden])),
main:has(#v-report:not([hidden])),
main:has(#v-recap:not([hidden])),
main:has(#v-history:not([hidden])),
main:has(#v-hist-item:not([hidden])) { max-width: 560px; padding-top: 24px; }
h1 { font-size: 1.4rem; margin: 0 0 20px; }
h2 { font-size: 1rem; margin: 28px 0 10px; }
label { display: block; font-size: .9rem; color: #374151; margin-bottom: 14px; }
input, select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 11px;
  font: inherit; font-size: 1rem; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; color: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #1f2937; border-color: transparent; }
input.invalid, select.invalid, textarea.invalid { border-color: #b91c1c; background: #fef2f2; }
button, .btn, .btn-sec {
  display: block; width: 100%; padding: 13px; font: inherit; font-size: 1rem; font-weight: 600;
  border: 0; border-radius: 8px; background: #1f2937; color: #fff; text-align: center; text-decoration: none; cursor: pointer;
}
.btn-sec { background: #e5e7eb; color: #111827; }
button:disabled { opacity: .6; }
section > button + button, section > .btn + button, section > button + .btn-sec { margin-top: 10px; }
.err { color: #b91c1c; min-height: 1.2em; font-size: .9rem; }
.alt { text-align: center; margin-top: 20px; }
.alt a { color: #374151; }
.small { font-size: .85rem; color: #6b7280; }
#otp-qr { display: block; margin: 8px auto; background: #fff; border-radius: 8px; }
code { word-break: break-all; font-size: .95rem; color: #111827; user-select: all; }

/* Formulaire de compte rendu */
fieldset { border: 0; background: #fff; border-radius: 10px; padding: 14px; margin: 0 0 12px; }
legend { float: left; width: 100%; font-weight: 700; margin-bottom: 12px; padding: 0; }
fieldset > :not(legend) { clear: both; }
fieldset label:last-child { margin-bottom: 0; }
.badge { display: inline-block; min-width: 1.6em; padding: 1px 7px; margin-left: 6px; border-radius: 99px; background: #e5e7eb; font-size: .8rem; text-align: center; }
.seg { display: flex; gap: 8px; }
.seg label { flex: 1; margin: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 12px; text-align: center; border: 1px solid #d1d5db; border-radius: 8px; font-weight: 600; color: #111827; }
.seg input:checked + span { background: #1f2937; border-color: #1f2937; color: #fff; }
.seg input:focus-visible + span { outline: 2px solid #1f2937; outline-offset: 2px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 1rem; color: #111827; }
.check input { width: 22px; height: 22px; margin: 0; flex: none; }
.row2 { display: flex; gap: 10px; }
.row2 label { flex: 1; min-width: 0; margin-bottom: 0; }
.line { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.line select, .line input { margin: 0; }
.line select { width: 96px; flex: none; padding-inline: 6px; }
.line input[name="nb"] { width: 58px; flex: none; text-align: center; padding-inline: 4px; }
.line input[name="unite"], .line input[name="dest"] { flex: 1; min-width: 0; text-transform: uppercase; }
.del { width: 40px; flex: none; padding: 10px 0; background: #fee2e2; color: #991b1b; }
#res-list label { margin: 0; padding: 9px 2px; border-bottom: 1px solid #f3f4f6; }
#res-list label:last-child { border-bottom: 0; }

/* Récapitulatif */
.mail { background: #fff; border-radius: 10px; padding: 14px; margin-bottom: 12px; }
.mail-h { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px solid #f3f4f6; font-size: .9rem; }
.mail-h span { width: 48px; flex: none; color: #6b7280; }
.mail-h div { overflow-wrap: anywhere; font-weight: 600; }
.mail pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: .92rem; line-height: 1.5; margin: 12px 0 0; }

section > .btn-sec + .btn-sec, section > button.btn-sec + button { margin-top: 10px; }
#hist-delete.confirm { background: #b91c1c; color: #fff; }

/* Historique */
#hist-list { list-style: none; padding: 0; margin: 0; }
#hist-list li { margin-bottom: 8px; }
#hist-list li.empty { color: #6b7280; font-size: .9rem; }
#hist-list button {
  display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: baseline;
  background: #fff; color: #111827; text-align: left; font-weight: 400; padding: 12px 14px;
}
#hist-list .h-date { font-weight: 700; }
#hist-list .h-lieu { color: #374151; }
#hist-list .h-meta { grid-column: 1 / -1; font-size: .8rem; color: #6b7280; }

/* Administration */
.chips { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.chips li { display: flex; align-items: center; gap: 4px; background: #fff; border-radius: 99px; padding: 4px 4px 4px 12px; font-size: .88rem; overflow-wrap: anywhere; }
.chips li.empty { background: none; padding-left: 0; color: #6b7280; }
.chips button { width: 26px; height: 26px; padding: 0; border-radius: 99px; background: #f3f4f6; color: #6b7280; font-size: .9rem; flex: none; }
.chips button.confirm { background: #b91c1c; color: #fff; }
.inline { display: flex; gap: 8px; }
.inline input { margin: 0; flex: 1; min-width: 0; }
.inline button { width: auto; padding-inline: 16px; }
#adm-search { margin: 0 0 8px; }
#adm-list { list-style: none; padding: 0; margin: 0; }
#adm-list li {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border-radius: 8px; padding: 10px 12px; margin-bottom: 8px;
}
#adm-list .who { flex: 1; min-width: 0; }
#adm-list .name { font-weight: 600; overflow-wrap: anywhere; }
#adm-list .meta { font-size: .8rem; color: #6b7280; }
.tag { font-size: .75rem; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.tag.on { background: #dcfce7; color: #166534; }
.tag.off { background: #e5e7eb; color: #4b5563; }
#adm-list button { width: auto; padding: 8px 10px; font-size: .8rem; background: #e5e7eb; color: #111827; }
#adm-list button.confirm { background: #b91c1c; color: #fff; }
