/* TwinImmo — pensé d'abord pour le téléphone */
:root { --nuit: #0B1F3A; --bleu: #0142A7; --jaune: #FACC08; --gris: #F3F4F7; --ligne: #E3E5EA; --texte: #16181d; --texte-2: #6b7280;
  --vert: #16a34a; --rouge: #dc2626; --wa: #25D366; }
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: -apple-system, "Segoe UI", Roboto, Inter, sans-serif; background: var(--gris); color: var(--texte); font-size: 16px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
img, video { display: block; max-width: 100%; }
a { color: var(--bleu); }

.barre { position: sticky; top: 0; z-index: 20; background: var(--nuit); color: #fff; display: flex; align-items: center; gap: 10px; padding: 10px 14px; min-height: 52px; }
.barre img { height: 26px; }
.barre .nom { font-weight: 800; font-size: 18px; letter-spacing: -.01em; }
.barre .nom .t { color: #6B95FF; } .barre .nom .s { color: var(--jaune); }
.barre .droite { margin-left: auto; font-size: 14px; opacity: .85; }
.barre button { background: none; border: 0; color: #fff; font-size: 22px; padding: 2px 6px; cursor: pointer; }

main { max-width: 640px; margin: 0 auto; padding: 14px 14px 110px; }
h1 { font-size: 24px; line-height: 1.2; letter-spacing: -.02em; }
h2 { font-size: 18px; margin: 18px 0 10px; }
.sous { color: var(--texte-2); font-size: 14px; }
.vide { text-align: center; color: var(--texte-2); padding: 36px 12px; }

.carte { background: #fff; border-radius: 16px; padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
label { display: block; font-size: 14px; font-weight: 600; color: var(--texte-2); margin: 12px 0 6px; }
input, select, textarea { width: 100%; background: #fff; border: 1.5px solid var(--ligne); border-radius: 12px; padding: 12px; font-size: 16px; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--bleu); }
textarea { min-height: 110px; resize: vertical; }
.ligne { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; border: 0; border-radius: 14px; padding: 15px; font-weight: 700; font-size: 16px;
  background: var(--bleu); color: #fff; cursor: pointer; text-decoration: none; }
.btn.second { background: #fff; color: var(--texte); border: 1.5px solid var(--ligne); }
.btn.jaune { background: var(--jaune); color: var(--nuit); }
.btn.wa { background: var(--wa); color: #fff; }
.btn.rouge { background: #fff; color: var(--rouge); border: 1.5px solid #f3c4c4; }
.btn:disabled { opacity: .55; }
.btn + .btn { margin-top: 10px; }
.bas { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; background: rgba(255,255,255,.96); backdrop-filter: blur(8px);
  border-top: 1px solid var(--ligne); padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
.bas .in { max-width: 640px; margin: 0 auto; display: flex; gap: 10px; }
.bas .btn + .btn { margin-top: 0; }

.bascule { display: grid; grid-template-columns: 1fr 1fr; background: var(--gris); border-radius: 12px; padding: 4px; gap: 4px; }
.bascule button { border: 0; border-radius: 9px; padding: 10px; font-weight: 700; background: transparent; color: var(--texte-2); }
.bascule button.actif { background: #fff; color: var(--bleu); box-shadow: 0 1px 3px rgba(0,0,0,.1); }

.badge { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 3px 9px; }
.badge.en_ligne { background: #dcfce7; color: #166534; }
.badge.brouillon { background: #fef3c7; color: #92400e; }
.badge.indisponible { background: #f3f4f6; color: #4b5563; }

/* Liste des biens (agent et agence) */
.bien-ligne { display: flex; gap: 12px; align-items: center; background: #fff; border-radius: 16px; padding: 10px; margin-bottom: 10px; text-decoration: none; color: inherit; }
.bien-ligne .vignette { width: 84px; height: 84px; border-radius: 12px; background: var(--gris) center/cover no-repeat; flex: none; display: flex; align-items: center; justify-content: center; font-size: 28px; }
.bien-ligne .infos { flex: 1; min-width: 0; }
.bien-ligne b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prix { font-weight: 800; color: var(--bleu); }

.grille { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.carte-bien { background: #fff; border-radius: 16px; overflow: hidden; text-decoration: none; color: inherit; }
.carte-bien .photo { aspect-ratio: 4/3; background: var(--gris) center/cover no-repeat; position: relative; }
.carte-bien .corps { padding: 10px; }
.carte-bien b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Médias (agent) */
.medias { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.media { position: relative; border-radius: 12px; overflow: hidden; background: #000; aspect-ratio: 1; }
.media img, .media video { width: 100%; height: 100%; object-fit: cover; }
.media .piece { position: absolute; left: 4px; right: 4px; bottom: 4px; font-size: 11px; padding: 4px; border-radius: 8px; border: 0; background: rgba(0,0,0,.6); color: #fff; }
.media .suppr { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 15px; }
.media .gauche { position: absolute; top: 4px; left: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 14px; }
.media.envoi { display: flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; font-weight: 700; background: var(--nuit); }
.ajout { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.ajout label, .ajout .btn + .btn { margin: 0; }
.option { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--texte); margin-top: 12px; }
.option input { width: 20px; height: 20px; }
.alerte { background: #fef2f2; color: var(--rouge); border-radius: 12px; padding: 10px 12px; font-size: 14px; margin-top: 10px; }
.succes { background: #f0fdf4; color: #166534; border-radius: 12px; padding: 10px 12px; font-size: 14px; margin-top: 10px; }
.lien-partage { font-family: ui-monospace, Consolas, monospace; font-size: 13px; background: var(--gris); border-radius: 10px; padding: 10px; word-break: break-all; margin: 8px 0; }

/* Visite virtuelle (client) */
.galerie { position: relative; background: #000; }
.defile { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.defile::-webkit-scrollbar { display: none; }
.defile .vue { flex: 0 0 100%; scroll-snap-align: center; aspect-ratio: 4/3; position: relative; }
.defile .vue img { width: 100%; height: 100%; object-fit: cover; }
.etiquette { position: absolute; left: 12px; bottom: 12px; background: rgba(0,0,0,.6); color: #fff; font-size: 13px; font-weight: 700; padding: 5px 10px; border-radius: 999px; }
.compteur { position: absolute; right: 12px; bottom: 12px; background: rgba(0,0,0,.6); color: #fff; font-size: 13px; padding: 5px 10px; border-radius: 999px; }
.plein-ecran { position: absolute; right: 12px; top: 12px; background: rgba(0,0,0,.55); color: #fff; border: 0; border-radius: 999px; padding: 7px 12px; font-size: 13px; font-weight: 700; }
.pieces { display: flex; gap: 8px; overflow-x: auto; padding: 12px 14px 4px; scrollbar-width: none; }
.pieces::-webkit-scrollbar { display: none; }
.pieces button { flex: none; border: 1.5px solid var(--ligne); background: #fff; border-radius: 999px; padding: 7px 13px; font-size: 14px; font-weight: 600; }
.pieces button.actif { border-color: var(--bleu); color: var(--bleu); }
.caracs { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; color: var(--texte); font-size: 15px; }
.bandeau { background: #f3f4f6; color: #374151; text-align: center; font-weight: 700; padding: 10px; border-radius: 12px; margin-bottom: 12px; }
.visite { position: fixed; inset: 0; z-index: 50; background: #000; display: none; flex-direction: column; }
.visite.ouverte { display: flex; }
.visite .defile { flex: 1; height: 100%; }
.visite .defile .vue { aspect-ratio: auto; height: 100%; display: flex; align-items: center; }
.visite .defile .vue img { object-fit: contain; height: auto; max-height: 100%; }
.visite .fermer { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px; z-index: 2; background: rgba(255,255,255,.15); color: #fff; border: 0; border-radius: 999px; width: 40px; height: 40px; font-size: 20px; }
.video-bien { width: 100%; border-radius: 16px; background: #000; max-height: 70vh; }
.agence { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--texte-2); }
.pied { text-align: center; font-size: 12px; color: var(--texte-2); padding: 18px 0 8px; }
.pied b .t { color: #3D7BFF; } .pied b .s { color: #d4a700; }

/* Bandeau « Installer l'application » (pwa.js) */
.installer { display: block; width: 100%; border: 0; background: var(--jaune); color: var(--nuit); font-weight: 700; font-size: 15px; padding: 11px 14px; cursor: pointer; }
