@font-face { font-family: Nunito; font-weight: 400; font-display: swap; src: url(/static/fonts/nunito-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: Nunito; font-weight: 600; font-display: swap; src: url(/static/fonts/nunito-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: Nunito; font-weight: 700; font-display: swap; src: url(/static/fonts/nunito-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: Nunito; font-weight: 800; font-display: swap; src: url(/static/fonts/nunito-latin-800-normal.woff2) format("woff2"); }

:root {
  --bg: #F7F4EE; --card: #FFFFFF; --line: #E4DED3; --field: #D6CFC2;
  --ink: #24211D; --muted: #6B655C; --green: #1F5E50; --green-soft: #E3EFEA;
  --sold: #C2410C; --ok: #15803D; --ok-soft: #DDF3E6; --warn: #8A4B08; --warn-soft: #FFF4E5;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: Nunito, system-ui, sans-serif; font-size: 16px; -webkit-text-size-adjust: 100%; }
body { padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
main { max-width: 560px; margin: 0 auto; padding: 16px 18px 40px; display: flex; flex-direction: column; gap: 14px; }
h1 { margin: 0; font-size: 24px; font-weight: 800; }
h2 { margin: 6px 0 0; font-size: 15px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
p { margin: 0; }
a { color: var(--green); }
.loading { color: var(--muted); text-align: center; margin-top: 40vh; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.top { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.top .titles { display: flex; flex-direction: column; min-width: 0; }
.top .titles span { font-size: 14px; color: var(--muted); }
.back { flex-shrink: 0; width: 44px; height: 44px; border-radius: 22px; background: var(--card); border: 1px solid var(--line); display: grid; place-items: center; color: var(--ink); text-decoration: none; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.row > :last-child { text-align: right; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; }
.stat b { font-size: 22px; font-weight: 800; }
.stat span { font-size: 13px; color: var(--muted); }
.sep { height: 1px; background: var(--line); }

.btn { font: inherit; font-weight: 800; font-size: 17px; border-radius: 16px; padding: 15px 16px; border: 1px solid var(--field); background: var(--card); color: var(--ink); text-decoration: none; display: flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer; text-align: center; min-height: 52px; }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.sold { background: var(--sold); border-color: var(--sold); color: #fff; font-size: 21px; padding: 20px; }
.btn.dashed { border: 2px dashed var(--green); color: var(--green); background: transparent; }
.btn.danger { color: #B42318; border-color: #F0C6C2; }
.btn.small { font-size: 15px; padding: 10px 12px; min-height: 44px; border-radius: 12px; }
.btn[disabled] { opacity: .5; cursor: default; }
.hero { background: var(--green); color: #fff; border-radius: 22px; padding: 24px 20px; display: flex; align-items: center; gap: 16px; text-decoration: none; }
.hero b { font-size: 22px; font-weight: 800; display: block; }
.hero span { font-size: 15px; opacity: .92; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 6px; color: var(--ink); text-decoration: none; min-height: 112px; }
.tile b { font-size: 18px; font-weight: 700; }
.tile span { font-size: 14px; color: var(--muted); }

.list { display: flex; flex-direction: column; gap: 8px; }
.li { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 11px 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.li .t { display: flex; flex-direction: column; min-width: 0; }
.li .t b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.li .t span { font-size: 13px; color: var(--muted); }
.li .p { font-weight: 800; white-space: nowrap; }
.li.due { background: var(--warn-soft); border-color: #F3D2A6; }
.li.due span { color: var(--warn); }

.badge { display: inline-block; font-size: 12px; font-weight: 800; padding: 3px 8px; border-radius: 10px; }
.b-en_vente { background: var(--ok-soft); color: #0F5A2B; }
.b-vendu { background: #FBE3D6; color: #8F2E07; }
.b-rendu { background: #ECE8E1; color: #4A453E; }
.banner { border-radius: 16px; padding: 14px 16px; display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 800; }
.banner.en_vente { background: var(--ok-soft); border: 2px solid var(--ok); color: #0F5A2B; }
.banner.vendu { background: var(--sold); color: #fff; flex-direction: column; align-items: center; text-align: center; font-size: 30px; gap: 2px; padding: 18px; }
.banner.vendu small { font-size: 15px; font-weight: 600; }
.banner.rendu { background: #ECE8E1; color: #4A453E; }
.notice { background: var(--warn-soft); border: 1px solid #F3D2A6; color: var(--warn); border-radius: 14px; padding: 10px 14px; font-weight: 700; font-size: 15px; }

label.f { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 700; }
input, select, textarea { font: inherit; font-size: 17px; font-weight: 600; padding: 11px 12px; border: 1px solid var(--field); border-radius: 12px; background: #fff; color: var(--ink); min-width: 0; width: 100%; }
textarea { min-height: 70px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 3px solid #8CC5B5; outline-offset: 1px; }
.price-in { display: flex; align-items: center; border: 1px solid var(--field); border-radius: 12px; background: #fff; padding: 0 14px; }
.price-in input { border: 0; font-size: 26px; font-weight: 800; padding: 8px 0; outline: none; }
.price-in b { font-size: 22px; font-weight: 800; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font: inherit; font-size: 15px; font-weight: 600; padding: 9px 13px; border-radius: 22px; border: 1px solid var(--field); background: #fff; color: var(--ink); cursor: pointer; min-height: 44px; }
.chip[aria-pressed="true"] { border: 2px solid var(--green); background: var(--green-soft); color: var(--green); font-weight: 800; }
.info { background: var(--green-soft); color: #1F4D42; border-radius: 14px; padding: 10px 14px; font-size: 15px; display: flex; justify-content: space-between; }
.photo { width: 100%; max-height: 300px; object-fit: contain; border-radius: 18px; background: #E9E3D8; }
.photo-ph { height: 110px; border-radius: 18px; background: #E9E3D8; display: grid; place-items: center; color: #8A8276; font-weight: 700; }
.error { color: #B42318; font-weight: 700; }

#scanner { position: relative; border-radius: 20px; overflow: hidden; background: #000; aspect-ratio: 3 / 4; }
#scanner video { width: 100%; height: 100%; object-fit: cover; display: block; }
#scanner .frame { position: absolute; inset: 18% 14%; border: 4px solid rgba(255,255,255,.9); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }

#toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 700; max-width: 90vw; z-index: 10; }

dialog { border: 0; border-radius: 20px; padding: 20px; max-width: 420px; width: calc(100vw - 36px); }
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog .actions { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }

/* ---------- planche d'étiquettes ---------- */
.labels-tools { display: flex; flex-direction: column; gap: 12px; }
.sheet { background: #fff; width: 210mm; height: 297mm; position: relative; margin: 0 auto; box-shadow: 0 2px 12px rgba(0,0,0,.15); transform-origin: top left; }
.sheet-wrap { overflow: hidden; }
.label { position: absolute; overflow: hidden; display: flex; gap: 2mm; align-items: center; padding: 2mm 2.5mm; font-family: Nunito, Arial, sans-serif; color: #000; }
.label.empty { background: repeating-linear-gradient(45deg, #f2f2f2 0 4px, #fff 4px 8px); }
.label .qr { flex-shrink: 0; }
.label .qr svg { display: block; width: 100%; height: 100%; }
.label .txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.label .shop { font-size: 6pt; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; color: #333; }
.label .desc { font-size: 8.5pt; font-weight: 800; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.label .det { font-size: 7pt; color: #222; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.label .price { font-size: 15pt; font-weight: 800; line-height: 1.1; }
.label .ref { font-size: 6.5pt; color: #333; }

@media print {
  @page { size: A4; margin: 0; }
  html, body { background: #fff; padding: 0; }
  main { max-width: none; padding: 0; margin: 0; display: block; }
  .no-print, #toast { display: none !important; }
  .sheet-wrap { overflow: visible; height: auto !important; }
  .sheet { box-shadow: none; transform: none !important; margin: 0; page-break-after: always; }
  .sheet:last-child { page-break-after: auto; }
  .label.empty { background: none; }
}
