:root {
  --ink: #2b2825;
  --paper: #fbfaf6;
  --card: #fff;
  --muted: #6b6760;
  --faint: #e4dfd5;          /* séparateurs */
  --line: #dcd6cb;           /* contours des cartes et photos */
  --line-strong: #b9b2a6;    /* contours des champs et boutons */
  --wash: #f2eee6;           /* surfaces teintées, emplacements vides */
  --accent: #b9470f;
  --ok: #2b8a3e;
  --play: #fbe6d4;
  --play-ink: #8a3a0e;
  --found: #dcf3df;
  --found-ink: #24693a;
  --gone: #ebe8e2;
  --gone-ink: #5f5a52;
  --alert: #f9dede;
  --alert-ink: #9b2c2c;
  --radius: 10px;
  --ring: 0 0 0 3px rgba(185, 71, 15, .18);
  --title: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --hand: var(--title);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.45 var(--hand);
}
a { color: inherit; text-decoration-color: var(--line-strong); text-underline-offset: .18em; }
a:hover { color: var(--accent); text-decoration-color: currentColor; }
::selection { background: var(--play); color: var(--ink); }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--title); font-weight: 650; line-height: 1.15; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 28px; }
h2 { font-size: 24px; }
h3 { font-size: 18px; }
p { margin: 0; }
small, .muted { color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: var(--gap, 14px); }
.row { display: flex; align-items: center; gap: var(--gap, 10px); flex-wrap: wrap; }
.between { justify-content: space-between; }
.center { text-align: center; }
.grow { flex: 1; }
.icon { width: 1em; height: 1em; vertical-align: -.14em; flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Badges de statut ---------- */
.badge {
  display: inline-block; white-space: nowrap;
  font-size: 13px; font-weight: 500; line-height: 1.6;
  border-radius: 20px; padding: 0 9px;
}
.badge.en_jeu, .tag.en_jeu { background: var(--play); color: var(--play-ink); }
.badge.trouvee, .tag.trouvee { background: var(--found); color: var(--found-ink); }
.badge.disparue, .badge.retiree, .tag.disparue, .tag.retiree { background: var(--gone); color: var(--gone-ink); }
.badge.brouillon { background: none; box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--muted); }
.tag { padding: 0 5px; border-radius: 4px; }
.pill { font-size: 13px; padding: 0 6px; border-radius: 9px; background: var(--play); color: var(--play-ink); }
.pill.alert { background: var(--alert); color: var(--alert-ink); }

/* ---------- Boutons & champs ---------- */
.btn, button {
  font: inherit; color: inherit; cursor: pointer;
  display: inline-block; text-align: center; text-decoration: none;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--card); padding: 9px 17px;
  transition: background-color .15s ease-out, border-color .15s ease-out, color .15s ease-out;
}
.btn:hover, button:hover { border-color: var(--ink); color: var(--ink); }
.btn.primary, button.primary { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 500; }
.btn.primary:hover, button.primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.block, button.block { display: block; width: 100%; }
.btn.small, button.small { padding: 3px 11px; font-size: 15px; border-radius: 6px; }
.link { border: 0; background: none; padding: 0; text-decoration: underline; color: inherit; }
.link:hover { color: var(--accent); }
.danger { color: var(--accent); }

input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=url], select, textarea {
  font: inherit; color: inherit; width: 100%;
  border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; padding: 7px 10px;
}
textarea { min-height: 90px; resize: vertical; }
input[type=radio], input[type=checkbox] { accent-color: var(--ink); }
input[type=file] { font-size: 14px; color: var(--muted); max-width: 100%; }
input[type=file]::file-selector-button {
  font: inherit; color: var(--ink); cursor: pointer;
  background: var(--card); border: 1px solid var(--line-strong); border-radius: 6px;
  padding: 3px 10px; margin-right: 8px;
}
input[type=file]::file-selector-button:hover { border-color: var(--ink); }
label.row:has(> input[type=radio]) { flex-wrap: nowrap; align-items: baseline; }
input:focus, select:focus, textarea:focus, button:focus-visible, .btn:focus-visible {
  outline: none; box-shadow: var(--ring); border-color: var(--accent);
}
label.field { display: flex; flex-direction: column; gap: 4px; }
label.field > span { font-size: 16px; }
.hint { font-size: 14px; color: var(--muted); }
[aria-invalid=true] { border-color: var(--accent) !important; background: #fffaf6; }
[data-field-error] { font-size: 15px; margin-top: -4px; }
.error { color: var(--accent); }
.flash { border-radius: var(--radius); padding: 9px 13px; background: var(--found); color: var(--found-ink); }
.flash.err { background: #fbe9df; color: var(--play-ink); }

/* ---------- Photos ---------- */
.photo {
  position: relative; overflow: hidden;
  border-radius: var(--radius);
  background: var(--wash);
  box-shadow: inset 0 0 0 1px rgba(43, 40, 37, .08);
}
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo .corner {
  position: absolute; right: 8px; bottom: 8px;
  background: rgba(251, 250, 246, .88); border-radius: 12px;
  padding: 1px 9px; font-size: 13px; color: var(--ink);
}
.placeholder { display: grid; place-items: center; font-size: 13px; color: var(--muted); }

/* =================================================================
   PUBLIC (mobile d'abord)
   ================================================================= */
.pub { max-width: 520px; margin: 0 auto; padding: 18px 16px 40px; }
.pub header { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.pub header h1 { font-size: 26px; }
.hero { aspect-ratio: 4 / 3; }
.chrono { text-align: center; line-height: 1.2; }
.dezoom { font-size: 16px; line-height: 1.35; margin-top: -6px; }
.dezoom [data-until], .dezoom b { white-space: nowrap; }
.chrono b { display: block; font-size: 30px; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }
.tiles > li:only-child { grid-column: 1 / -1; }
.tile { display: flex; flex-direction: column; gap: 6px; text-decoration: none; }
.tile .photo { aspect-ratio: 4 / 3; transition: box-shadow .15s ease-out; }
.tile:hover .photo { box-shadow: inset 0 0 0 1px rgba(43, 40, 37, .08), 0 2px 10px rgba(43, 40, 37, .12); }
.tile:hover b { color: var(--accent); }
.tile-meta { display: flex; flex-direction: column; font-size: 15px; line-height: 1.3; }
.tile-meta [data-since] { white-space: nowrap; }
.hint-box { border-left: 1px solid var(--accent); padding: 2px 0 2px 12px; color: #47433e; }
.hint-box b { color: var(--play-ink); font-weight: 600; }
.howto { background: var(--wash); border-radius: var(--radius); padding: 12px 14px; color: #47433e; }

.archive { list-style: none; padding: 0; margin: 0; }
.archive li { border-bottom: 1px solid var(--faint); }
.archive li:last-child { border-bottom: 0; }
.archive a { display: flex; gap: 12px; padding: 10px 0; text-decoration: none; }
.archive .thumb { width: 76px; height: 76px; flex: none; border-radius: 6px; }
.archive .gone .thumb { filter: grayscale(1); opacity: .7; }
.archive .gone { color: var(--muted); }
.archive .meta { font-size: 16px; line-height: 1.3; }
.quote { font-style: normal; }
.quote::before { content: '« '; }
.quote::after { content: ' »'; }

.comment { border-top: 1px solid var(--faint); padding-top: 10px; }
.empty { background: var(--wash); border-radius: var(--radius); padding: 18px; text-align: center; color: var(--muted); }
.foot { margin-top: 36px; font-size: 14px; text-align: center; color: var(--muted); }

/* ---------- Parcours J'ai trouvé ---------- */
.flow { max-width: 440px; margin: 0 auto; padding: 22px 16px 40px; min-height: 100svh; display: flex; flex-direction: column; gap: 16px; }
.flow .actions { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.flow .question { font-size: 26px; font-weight: 600; line-height: 1.2; }
.flow .ok { color: var(--ok); display: flex; align-items: center; gap: 6px; }
.flow .steps { display: flex; gap: 6px; }
.flow .steps span { flex: 1; height: 4px; border-radius: 2px; background: var(--gone); }
.flow .steps span.on { background: var(--ink); }
.flow.found { background: #f5faf4; }
.code-boxes { display: flex; gap: 8px; min-width: 0; min-inline-size: 0; border: 0; padding: 0; margin: 0; }
.code-boxes input {
  flex: 1; min-width: 0; width: 100%; height: 64px; text-align: center;
  font: 28px ui-monospace, Menlo, monospace;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
}
.code-boxes.bad input { border-color: var(--accent); animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.reminder { aspect-ratio: 16 / 9; }
.file-drop { border: 1px dashed var(--line-strong); border-radius: 8px; padding: 10px; text-align: center; font-size: 16px; }

/* =================================================================
   ADMIN (responsive : menu latéral → barre d'onglets en bas)
   ================================================================= */
.adm { display: grid; grid-template-columns: 210px 1fr; min-height: 100vh; }
.adm nav {
  border-right: 1px solid var(--faint); padding: 18px 14px;
  display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh; background: var(--paper);
}
.adm nav .brand { font: 650 20px var(--title); margin-bottom: 10px; text-decoration: none; }
.adm nav a.item { text-decoration: none; padding: 4px 9px; border-radius: 6px; display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.adm nav a.item:hover { background: var(--wash); color: var(--ink); }
.adm nav a.item.on { background: var(--wash); color: var(--ink); font-weight: 600; }
.adm nav .bottom { margin-top: auto; font-size: 15px; display: flex; flex-direction: column; gap: 6px; }
.adm main { padding: 24px 28px 60px; max-width: 1100px; width: 100%; display: flex; flex-direction: column; gap: 18px; }
.adm main > header { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.adm main > header h1 { font: 600 24px var(--title); }

.box { border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: var(--card); }
.box.alert { border-color: #e8b99c; }
.current { display: grid; grid-template-columns: 200px 1fr; gap: 14px; align-items: start; }
.current .photo { aspect-ratio: 4 / 3; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.kpi { border-radius: 12px; padding: 12px 10px; text-align: center; background: var(--wash); color: var(--muted); font-size: 15px; line-height: 1.35; }
.kpi b { display: block; font-size: 26px; font-weight: 600; line-height: 1.15; color: var(--ink); font-variant-numeric: tabular-nums; }

table.list { width: 100%; border-collapse: collapse; font-size: 16px; }
table.list th { text-align: left; font-weight: 400; color: var(--muted); font-size: 14px; border-bottom: 1px solid var(--line); padding: 4px 6px; }
table.list td { border-bottom: 1px solid var(--faint); padding: 7px 6px; vertical-align: top; }
table.list td.actions { white-space: nowrap; text-align: right; }
table.list .thumb { width: 54px; height: 54px; border-radius: 6px; }
.spoiler { color: var(--accent); font-size: 14px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 16px; }
.filters a { text-decoration: none; border: 1px solid var(--line); border-radius: 20px; padding: 1px 11px; }
.filters a:hover { border-color: var(--line-strong); color: var(--ink); }
.filters a.on { background: var(--wash); border-color: var(--wash); font-weight: 600; }
.inline { display: inline; }

.editor { display: grid; grid-template-columns: 1fr 220px; gap: 20px; align-items: start; }
.zoompick { position: relative; cursor: crosshair; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--wash); min-height: 160px; }
.zoompick img { width: 100%; height: auto; user-select: none; -webkit-user-drag: none; }
.zoompick .empty-pick { min-height: 160px; display: grid; place-items: center; font-size: 14px; color: var(--muted); padding: 10px; text-align: center; }
.zoompick .mark {
  position: absolute; width: 20px; height: 20px; border: 2px solid var(--accent); border-radius: 50%;
  transform: translate(-50%, -50%); pointer-events: none; box-shadow: 0 0 0 2px rgba(255,255,255,.9), 0 1px 4px rgba(0,0,0,.25);
}
.zoompick .arrow-layer { position: absolute; left: 0; top: 0; pointer-events: none; }
.zoompick.arrow-mode { cursor: cell; }
.pickmode { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.zoompick .frame { position: absolute; border: 2px solid var(--accent); box-shadow: 0 0 0 1px rgba(255,255,255,.75); pointer-events: none; }
.days { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.day { display: flex; flex-direction: column; gap: 3px; font-size: 13px; text-align: center; color: var(--muted); }
.day canvas { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; box-shadow: 0 0 0 1px rgba(43,40,37,.08); }
.days > .hint { grid-column: 1 / -1; }
.label-card { border-left: 1px solid var(--faint); padding-left: 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; font-size: 15px; }
.label-card .qr { width: 150px; height: 150px; border: 1px solid var(--line); background: #fff; padding: 6px; }
.label-card .qr svg { width: 100%; height: 100%; }
.write-here { border: 1px dashed var(--line-strong); border-radius: 4px; padding: 3px 10px; color: var(--muted); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

.bars { display: flex; flex-direction: column; gap: 6px; }
.bar { display: grid; grid-template-columns: 54px 1fr 70px; align-items: center; gap: 8px; font-size: 15px; }
.bar .track { height: 12px; border-radius: 6px; background: var(--wash); overflow: hidden; }
.bar .fill { height: 100%; background: var(--line); border-radius: 6px; }
.bar .fill.trouvee { background: #9fd3a9; }
.bar .fill.disparue, .bar .fill.retiree { background: #cfc9be; }
.bar .fill.en_jeu { background: #f2bf98; }

.login { max-width: 380px; margin: 10vh auto; padding: 0 16px; }

@media (max-width: 820px) {
  .adm { display: block; padding-bottom: 72px; }
  .adm nav {
    position: fixed; z-index: 10; inset: auto 0 0 0; height: auto;
    flex-direction: row; justify-content: space-around; gap: 0;
    border-right: 0; border-top: 1px solid var(--faint); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .adm nav .brand, .adm nav .bottom, .adm nav a.item.desk { display: none; }
  .adm nav a.item { flex-direction: column; gap: 0; font-size: 13px; padding: 3px 4px; text-align: center; }
  .adm nav a.item.on { background: none; color: var(--accent); font-weight: 600; }
  .adm main { padding: 18px 16px 30px; }
  .mob-only { display: inline-block !important; }
  .editor, .two, .three { grid-template-columns: 1fr; }
  .current { grid-template-columns: 96px 1fr; gap: 12px; }
  .label-card { border-left: 0; border-top: 1px solid var(--faint); padding: 14px 0 0; }
  .kpis { gap: 8px; }
  .kpi { font-size: 14px; line-height: 1.3; padding: 10px 6px; }
  .kpi b { font-size: 22px; }
  table.list.resp thead { display: none; }
  table.list.resp tr { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; border-bottom: 1px solid var(--faint); padding: 10px 0; }
  table.list.resp td { display: block; border: 0; padding: 0; }
  table.list.resp td.actions { flex-basis: 100%; text-align: left; padding-top: 4px; }
}
.mob-only, .mob-label { display: none; }
@media (max-width: 820px) {
  .desk-label { display: none; }
  .mob-label { display: inline; }
}

/* ---------- Étiquette imprimable ---------- */
.print-page { max-width: 640px; margin: 24px auto; padding: 0 16px; }
.sticker {
  width: 9cm; border: 2px solid #000; border-radius: 10px; padding: 14px;
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; margin: 0 auto;
}
.sticker .qr { width: 5.2cm; height: 5.2cm; }
.sticker .qr svg { width: 100%; height: 100%; }
.sticker .codebox { width: 100%; border: 2px dashed #000; border-radius: 6px; height: 1.4cm; display: flex; align-items: center; padding-left: 10px; font-size: 16px; }
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .print-page { margin: 0; }
}
