:root {
  --brique: #94301c; --brique-f: #7a2716; --fond: #f6f3f1; --carte: #fff; --texte: #1a1a1a;
  --gris: #555; --ligne: #ddd3cf; --ok: #2e7d32; --err: #b3261e; --sel: #fbeae5;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fond); color: var(--texte);
  font: 17px/1.45 -apple-system, "Segoe UI", Roboto, "DejaVu Sans", Arial, sans-serif; }
button, input, textarea, select { font: inherit; }
.bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px;
  background: var(--brique); color: #fff; padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); min-height: 52px; }
.bar-title { flex: 1; font-weight: 700; font-size: 16px; }
.bar-home { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.6); border-radius: 8px;
  padding: 6px 10px; min-height: 48px; }
.save-state { font-size: 14px; font-weight: 600; opacity: .95; text-align: right; }
main { max-width: 640px; margin: 0 auto; padding: 16px 16px 110px; outline: none; }
.loading { color: var(--gris); }
h1 { font-size: 22px; margin: 6px 0 14px; color: var(--brique); }
h2 { font-size: 19px; margin: 18px 0 10px; color: var(--brique); }
.muted { color: var(--gris); font-size: 15px; }
.err { color: var(--err); font-weight: 600; }

/* Accueil : deux actions */
.home { display: grid; gap: 16px; margin-top: 12px; }
.big { display: block; width: 100%; text-align: left; border: 0; border-radius: 14px; padding: 22px 20px;
  background: var(--brique); color: #fff; font-size: 24px; font-weight: 700; min-height: 96px; cursor: pointer; }
.big small { display: block; font-size: 15px; font-weight: 400; opacity: .92; margin-top: 4px; }
.big.alt { background: var(--carte); color: var(--brique); border: 2px solid var(--brique); }
.big.alt small { color: var(--gris); }
.link { background: none; border: 0; color: var(--brique); text-decoration: underline; padding: 12px 0; min-height: 44px; cursor: pointer; }

/* Formulaire */
.progress { display: flex; gap: 4px; margin: 2px 0 6px; }
.progress span { flex: 1; height: 6px; border-radius: 3px; background: #c9bcb7; }
.progress span.done { background: #c0705f; }
.progress span.cur { background: var(--brique); }
.steplbl { font-size: 14px; color: var(--gris); }
.field { background: var(--carte); border: 1px solid var(--ligne); border-radius: 12px; padding: 12px 14px; margin: 0 0 12px; }
.field > .lbl { display: block; font-weight: 600; margin-bottom: 8px; }
.req { color: var(--err); }
.hint { font-size: 14px; color: var(--gris); margin: -4px 0 8px; }
input[type=text], input[type=tel], input[type=email], input[type=date], input[type=time], input[type=password], textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; border: 1.5px solid #7d6a63; border-radius: 10px; background: #fff; color: var(--texte); }
textarea { min-height: 110px; resize: vertical; }
input:focus, textarea:focus { outline: 3px solid rgba(148,48,28,.35); border-color: var(--brique); }
.num { display: flex; align-items: center; gap: 8px; }
.num input { max-width: 170px; }
.unit { color: var(--gris); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; display: inline-flex; align-items: center; min-height: 48px; padding: 8px 14px;
  border: 1.5px solid #7d6a63; border-radius: 24px; background: #fff; cursor: pointer; user-select: none; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip:has(input:checked) { background: var(--sel); border-color: var(--brique); color: var(--brique-f); font-weight: 700; }
.chip:has(input:checked)::before { content: "✓ "; white-space: pre; }
.chip:has(input:focus-visible) { outline: 3px solid rgba(148,48,28,.45); }
.note { background: #fff7e0; border: 1px solid #ecd9a0; padding: 8px 12px; border-radius: 10px; font-size: 15px; margin-bottom: 12px; }

.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 4; display: flex; gap: 10px;
  padding: 10px 16px; padding-bottom: max(10px, env(safe-area-inset-bottom)); background: rgba(246,243,241,.97);
  border-top: 1px solid var(--ligne); }
.nav .inner { display: flex; gap: 10px; max-width: 640px; margin: 0 auto; width: 100%; }
.btn { flex: 1; min-height: 52px; border-radius: 12px; border: 2px solid var(--brique); background: #fff; color: var(--brique);
  font-weight: 700; font-size: 17px; cursor: pointer; padding: 8px 12px; }
.btn.primary { background: var(--brique); color: #fff; }
.btn:disabled { opacity: .5; }
.btn.danger { border-color: var(--err); color: var(--err); }
.stack { display: grid; gap: 10px; margin-top: 12px; }

/* Photos */
.photobtns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0 12px; }
.photobtns label { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 64px;
  border-radius: 12px; border: 2px solid var(--brique); font-weight: 700; color: var(--brique); background: #fff; cursor: pointer; padding: 6px; }
.photobtns label.primary { background: var(--brique); color: #fff; }
.photobtns input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.ph { background: #fff; border: 1px solid var(--ligne); border-radius: 10px; overflow: hidden; }
.ph img { display: block; width: 100%; aspect-ratio: 4/3; object-fit: cover; background: #eee; }
.ph .phb { padding: 6px; display: grid; gap: 6px; }
.ph .phb input { min-height: 48px; font-size: 15px; padding: 6px 8px; }
.ph .phn { font-size: 13px; color: var(--gris); }
.ph .del { min-height: 48px; border: 1px solid var(--err); color: var(--err); background: #fff; border-radius: 8px; cursor: pointer; }
.upl { font-weight: 600; color: var(--brique); margin: 6px 0; }

/* Récap, archives */
.manques { background: #fdecea; border: 1px solid #f1b5af; border-radius: 12px; padding: 10px 14px; margin: 10px 0; }
.manques ul { margin: 6px 0 0; padding-left: 0; list-style: none; }
.manques li { margin: 4px 0; }
.manques button { background: none; border: 0; color: var(--err); text-decoration: underline; text-align: left; padding: 10px 0; min-height: 48px; cursor: pointer; font-weight: 600; }
.okbox { background: #e8f5e9; border: 1px solid #a5d6a7; border-radius: 12px; padding: 10px 14px; margin: 10px 0; }
.card { display: block; width: 100%; text-align: left; background: #fff; border: 1px solid var(--ligne); border-radius: 12px;
  padding: 12px 14px; margin: 0 0 10px; cursor: pointer; color: inherit; }
.card b { color: var(--brique); font-size: 18px; }
.card .l2 { color: var(--gris); font-size: 15px; }
dl.ro { margin: 0; background: #fff; border: 1px solid var(--ligne); border-radius: 12px; padding: 4px 14px; }
dl.ro div { padding: 8px 0; border-bottom: 1px solid #eee; }
dl.ro div:last-child { border-bottom: 0; }
dl.ro dt { font-size: 14px; color: var(--gris); }
dl.ro dd { margin: 2px 0 0; white-space: pre-wrap; }
.nr { color: #6b6b6b; font-style: italic; }
.lock { display: inline-block; background: #eee; border-radius: 8px; padding: 2px 8px; font-size: 13px; color: #444; }
dialog.zoom { padding: 0; border: 0; max-width: 100vw; max-height: 100vh; background: #000; }
dialog.zoom img { display: block; max-width: 100vw; max-height: 92vh; }
dialog.zoom button { width: 100%; min-height: 48px; border: 0; background: #222; color: #fff; }
.login { max-width: 360px; margin: 40px auto 0; }
.login .btn { width: 100%; margin-top: 12px; }

/* v1.1 */
select.jump { width: 100%; min-height: 48px; margin: 6px 0 2px; padding: 8px 10px; border: 1.5px solid #7d6a63; border-radius: 10px; background: #fff; color: var(--texte); font-size: 16px; }
.pend { font-size: 15px; color: #8a4b00; font-weight: 600; margin: 0 0 8px; }
.pend:empty { display: none; }
.link.small { font-size: 15px; padding: 10px 0 0; min-height: 44px; }
.danger-zone { margin: 28px 0 8px; padding-top: 14px; border-top: 1px dashed var(--ligne); }
.danger-zone .btn { width: 100%; }
.rechead { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.rechead .link { white-space: nowrap; }
a.linkbtn { display: flex; align-items: center; justify-content: center; text-decoration: none; }
.zoombtn { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.zoomlink { display: block; text-align: center; color: #fff; padding: 12px; min-height: 48px; }
.photobtns label.busy { opacity: .6; }
input[type=search] { width: 100%; min-height: 48px; padding: 10px 12px; border: 1.5px solid #7d6a63; border-radius: 10px; margin-bottom: 12px; }
.bar-home, .save-state { white-space: nowrap; }
.bar-title { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
