* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --vert: #2d6a4f; --vert-clair: #40916c; --fond: #f4f1ea; --carte: #fff;
  --texte: #222; --gris: #777; --rouge: #c1121f; --orange: #e76f51;
}
body { font-family: system-ui, -apple-system, sans-serif; background: var(--fond); color: var(--texte); padding-bottom: 80px; }
header { background: var(--vert); color: #fff; padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 10; }
header h1 { font-size: 1.15rem; }
.icon-btn { background: none; border: none; color: #fff; font-size: 1.3rem; cursor: pointer; }
#tabs { display: flex; background: var(--vert-clair); position: sticky; top: 52px; z-index: 9; }
#tabs button { flex: 1; padding: 12px 4px; border: none; background: none; color: #e8f0ec; font-size: .85rem; font-weight: 600; cursor: pointer; }
#tabs button.active { background: #fff; color: var(--vert); border-radius: 10px 10px 0 0; }
main { padding: 12px; max-width: 640px; margin: 0 auto; }
.btn { display: inline-block; padding: 10px 14px; border: none; border-radius: 10px; font-size: .92rem; font-weight: 600; cursor: pointer; background: var(--vert); color: #fff; }
.btn.gris { background: #ccc; color: #333; }
.btn.rouge { background: var(--rouge); }
.btn.orange { background: var(--orange); }
.btn.plein { width: 100%; margin-top: 8px; }
.btn.plein.btn-save { position: sticky; bottom: 0; margin-top: 12px; padding: 13px; border-radius: 12px; box-shadow: 0 -2px 10px rgba(0,0,0,.12); }
.btn:disabled { opacity: .5; }
.carte { background: var(--carte); border-radius: 12px; padding: 12px; margin-bottom: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.08); cursor: pointer; }
.carte.tete { display: flex; gap: 10px; align-items: center; }
.carte img.thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; background: #eee; flex-shrink: 0; }
.carte .titre { font-weight: 700; font-size: .95rem; }
.carte .sous { color: var(--gris); font-size: .82rem; margin-top: 2px; }
.carte .prix { color: var(--vert); font-weight: 700; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: .72rem; font-weight: 700; }
.badge.a_vendre { background: #e8f5e9; color: #2e7d32; }
.badge.vendu { background: #fce4ec; color: #c62828; }
.badge.stock { background: #e3f2fd; color: #1565c0; }
.badge.abandonne { background: #f5f5f5; color: #777; }
.badge.nouveau { background: #fff3e0; color: #e65100; }
.badge.achete { background: #e8f5e9; color: #2e7d32; }
.empty { text-align: center; color: var(--gris); padding: 30px 10px; font-size: .9rem; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: flex-end; justify-content: center; z-index: 50; }
.hidden { display: none !important; }
.modal.plein { align-items: center; background: rgba(0,0,0,.92); }
.modal.plein .modal-box { max-width: 100vw; background: transparent; box-shadow: none; text-align: center; padding: 10px; }
.modal-box { position: relative; background: #fff; width: 100%; max-width: 640px; max-height: 90vh; overflow-y: auto; border-radius: 18px 18px 0 0; padding: 16px; }
.croix { position: absolute; top: 8px; left: 14px; font-size: 1.4rem; cursor: pointer; color: var(--gris); padding: 6px; z-index: 6; background: rgba(255,255,255,.85); border-radius: 50%; line-height: 1; }
.modal-box h2 { font-size: 1.2rem; margin-bottom: 12px; padding-left: 40px; }
.modal-box .sous { font-size: .95rem; line-height: 1.55; margin-bottom: 6px; }
label { display: block; font-size: .8rem; font-weight: 600; color: var(--gris); margin: 10px 0 3px; }
input, select, textarea { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 8px; font-size: .95rem; font-family: inherit; }
textarea { min-height: 60px; }
.form-row { display: flex; gap: 8px; }
.form-row > div { flex: 1; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.actions .btn { flex: 1; min-width: 100px; }
.stat-cartes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-carte { background: var(--carte); border-radius: 12px; padding: 14px; text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.stat-carte .val { font-size: 1.5rem; font-weight: 800; color: var(--vert); }
.stat-carte .lab { font-size: .78rem; color: var(--gris); }
.gps-ok { color: var(--vert); font-weight: 700; }
.gps-off { color: var(--gris); }
.gps-mini { display: flex; align-items: center; margin: 8px 0; }
#p-gps { cursor: pointer; font-size: 1.05rem; }
.sup-details { margin-top: 14px; margin-bottom: 20px; border-top: 1px solid #e8e4dc; padding-top: 10px; }
.sup-btn { display: block; background: var(--fond); border: 1px solid #e0dcd2; border-radius: 10px; padding: 12px; text-align: center; font-weight: 700; color: var(--vert); cursor: pointer; font-size: .95rem; list-style: none; }
.sup-btn::-webkit-details-marker { display: none; }
.sup-details .sep { border: none; border-top: 1px solid #e8e4dc; margin: 10px 0; }
.photo-zone { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.photo-zone img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }
.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: #333; color: #fff; padding: 10px 18px; border-radius: 24px; font-size: .85rem; z-index: 99; opacity: 0; transition: opacity .3s; pointer-events: none; }
.toast.show { opacity: 1; }
