/* Vendée Locations HQ — thème sombre, mobile d'abord, fichiers locaux. */

:root {
  --fond: #0B0F19;
  --carte: #111827;
  --encre: #0d1320;
  --bord: #1F2937;
  --texte: #E5E7EB;
  --muted: #9CA3AF;
  --emeraude: #10B981;
  --emeraude-texte: #042f2a;
  --ambre: #F59E0B;
  --danger: #F87171;
  --direct: #34D399;
  --airbnb: #FB7185;
  --booking: #60A5FA;
  --abritel: #FBBF24;
  --driing: #C084FC;
  --blocage: #94A3B8;
  --ombre: 0 18px 50px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--fond);
  color: var(--texte);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

button, input, textarea { font: inherit; color: inherit; }

button { touch-action: manipulation; }

a { color: #6ee7b7; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.marque {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #ecfdf5;
}

.marque::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--emeraude);
  box-shadow: 0 0 10px var(--emeraude);
  flex: none;
}

.muted { color: var(--muted); margin: 0.35rem 0; }

h1 { font-size: 1.45rem; line-height: 1.2; margin: 0; }

h2 { font-size: 1.05rem; margin: 0 0 0.75rem; }

.carte {
  background: var(--carte);
  border: 1px solid var(--bord);
  border-radius: 1rem;
  padding: 1rem;
  margin: 0 0 0.9rem;
  box-shadow: var(--ombre);
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0.85rem 0;
  font-size: 0.92rem;
}

input, textarea {
  width: 100%;
  background: var(--fond);
  border: 1px solid var(--bord);
  border-radius: 0.75rem;
  padding: 0.8rem 0.85rem;
  min-height: 48px;
}

textarea { min-height: 8rem; resize: vertical; }

input:focus, textarea:focus {
  outline: 2px solid rgba(16, 185, 129, 0.55);
  border-color: #065f46;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 0.8rem;
  min-height: 48px;
  padding: 0.75rem 1rem;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  background: transparent;
}

.btn.principal { background: var(--emeraude); color: var(--emeraude-texte); }

.btn.principal:hover { background: #34d399; }

.btn.secondaire { border-color: var(--bord); color: var(--texte); background: var(--encre); }

.btn.danger {
  width: 100%;
  margin-top: 0.4rem;
  border-color: #7f1d1d;
  color: #fecaca;
  background: rgba(127, 29, 29, 0.25);
}

.btn.plein { width: 100%; }

.btn:disabled { opacity: 0.6; cursor: progress; }

.btn.charge::before {
  content: "";
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-right-color: currentColor;
  animation: tourne 0.7s linear infinite;
}

@keyframes tourne { to { transform: rotate(360deg); } }

.erreur { color: #fecaca; min-height: 1.25rem; margin: 0.2rem 0 0.6rem; }

.erreur:empty { display: none; }

/* Connexion */

.ecran-login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse at top, rgba(16, 185, 129, 0.16), transparent 52%),
    radial-gradient(ellipse at bottom right, rgba(217, 119, 6, 0.12), transparent 40%),
    var(--fond);
}

.carte-login { width: min(100%, 26rem); }

.carte-login h1 { margin: 0.35rem 0 0.2rem; }

.carte-login .btn { width: 100%; margin-top: 0.4rem; }

/* Coquille admin : barre du bas, puis colonne à gauche */

.shell main {
  padding: 4.4rem 1rem calc(5.5rem + env(safe-area-inset-bottom));
}

.nav {
  position: fixed;
  z-index: 30;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(11, 15, 25, 0.96);
  border-top: 1px solid var(--bord);
  padding-bottom: env(safe-area-inset-bottom);
}

.nav .marque {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3.25rem;
  padding: 0 1rem;
  background: rgba(11, 15, 25, 0.96);
  border-bottom: 1px solid var(--bord);
}

.onglet {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-height: 64px;
  padding: 0.4rem 0.15rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
}

.onglet svg { width: 1.4rem; height: 1.4rem; }

.onglet.actif { color: #6ee7b7; }

.entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

#sync { flex: none; }

.pastilles { margin-bottom: 0.9rem; }

.sonde-liste { display: flex; flex-wrap: wrap; gap: 0.45rem; }

.sonde {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--bord);
  background: var(--encre);
  font-size: 0.78rem;
  font-weight: 600;
}

.sonde .point {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #64748b;
  flex: none;
}

.sonde.ok .point { background: var(--emeraude); box-shadow: 0 0 8px var(--emeraude); }
.sonde.alerte .point { background: var(--ambre); box-shadow: 0 0 8px var(--ambre); }
.sonde.critique .point { background: var(--danger); box-shadow: 0 0 8px var(--danger); }

.alerte-bandeau {
  margin: 0.75rem 0 0;
  padding: 0.7rem 0.8rem;
  border-radius: 0.75rem;
  color: #fecaca;
  background: rgba(127, 29, 29, 0.4);
  border: 1px solid #7f1d1d;
}

.prenom { font-size: 1.85rem; font-weight: 750; margin: 0.15rem 0; }

.meta { margin: 0.15rem 0 0.6rem; color: var(--muted); }

.contact { display: flex; gap: 0.6rem; }

.btn.tactile {
  flex: 1;
  flex-direction: column;
  gap: 0.1rem;
  min-height: 68px;
  line-height: 1.2;
}

.btn.tactile span { font-size: 0.75rem; font-weight: 600; opacity: 0.85; }

.btn.wa { background: #065f46; color: #d1fae5; }

.btn.sms { background: #78350f; color: #fef3c7; }

.badge {
  display: inline-block;
  margin: 0.35rem 0;
  padding: 0.4rem 0.6rem;
  border-radius: 0.6rem;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.35;
}

.badge.groupe {
  background: #78350f;
  color: #fef3c7;
  border: 1px solid #d97706;
}

.badge.urgent {
  background: #7f1d1d;
  color: #fee2e2;
  border: 1px solid #ef4444;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.7rem;
  margin-bottom: 0.9rem;
}

.kpis > .muted { grid-column: 1 / -1; margin: 0; }

.kpi {
  background: var(--carte);
  border: 1px solid var(--bord);
  border-radius: 0.9rem;
  padding: 0.85rem;
}

.kpi span, .kpi small { color: var(--muted); font-size: 0.8rem; }

.kpi strong {
  display: block;
  margin-top: 0.25rem;
  font-size: 1.45rem;
  font-variant-numeric: tabular-nums;
}

.kpi.alerte strong { color: #fecaca; }

.legende {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  margin: 0 0 0.8rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.legende .pastille::before {
  content: "";
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  margin-right: 0.3rem;
  border-radius: 2px;
  background: currentColor;
  vertical-align: -1px;
}

.pastille.direct { color: var(--direct); }
.pastille.airbnb { color: var(--airbnb); }
.pastille.booking { color: var(--booking); }
.pastille.abritel { color: var(--abritel); }
.pastille.driing { color: var(--driing); }
.pastille.blocage { color: var(--blocage); }

.grille {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.nom-jour {
  text-align: center;
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding-bottom: 0.2rem;
}

.jour {
  min-height: 3.35rem;
  padding: 0.25rem;
  border-radius: 0.55rem;
  border: 1px solid var(--bord);
  background: var(--encre);
  color: inherit;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
}

.jour.hors { border-color: transparent; background: transparent; min-height: 0; }

.jour .num { font-size: 0.8rem; font-variant-numeric: tabular-nums; }

.jour .canal {
  display: none;
  font-size: 0.62rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.jour.direct { background: rgba(52, 211, 153, 0.18); border-color: rgba(52, 211, 153, 0.55); }
.jour.airbnb { background: rgba(251, 113, 133, 0.18); border-color: rgba(251, 113, 133, 0.55); }
.jour.booking { background: rgba(96, 165, 250, 0.18); border-color: rgba(96, 165, 250, 0.55); }
.jour.abritel { background: rgba(251, 191, 36, 0.18); border-color: rgba(251, 191, 36, 0.6); }
.jour.driing { background: rgba(192, 132, 252, 0.18); border-color: rgba(192, 132, 252, 0.55); }
.jour.blocage { background: rgba(148, 163, 184, 0.16); border-color: rgba(148, 163, 184, 0.55); }

.jour.aujourdhui { box-shadow: inset 0 0 0 2px var(--emeraude); }

.jour.rotation { box-shadow: inset 0 0 0 2px var(--danger); }

.actions { display: flex; flex-direction: column; gap: 0.55rem; }

.apercu {
  background: var(--fond);
  border: 1px dashed var(--bord);
  border-radius: 0.75rem;
  padding: 0.75rem;
  white-space: pre-wrap;
  min-height: 4.5rem;
}

.journal { list-style: none; margin: 0; padding: 0; }

.journal li {
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--bord);
  font-size: 0.9rem;
}

.journal time { display: block; color: var(--muted); font-size: 0.75rem; }

.compte-bloc { margin-bottom: 0.9rem; }

.compte-bloc strong { font-size: 1.15rem; }

.dates { margin: 0.35rem 0 0; padding-left: 1.1rem; }

.dates li { margin: 0.15rem 0; }

.tx {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--bord);
}

.tx .quand { display: block; color: var(--muted); font-size: 0.78rem; }

.montant { font-variant-numeric: tabular-nums; font-weight: 700; }

.statut.ok { color: #6ee7b7; }
.statut.echec { color: #fecaca; }

.voile {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(2, 6, 16, 0.72);
  display: grid;
  align-items: end;
}

.tiroir {
  background: var(--carte);
  border-top: 1px solid var(--bord);
  border-radius: 1.15rem 1.15rem 0 0;
  padding: 0.9rem 1rem calc(1rem + env(safe-area-inset-bottom));
  max-height: 88dvh;
  overflow: auto;
}

.tiroir-barre {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.tiroir-barre h2 { margin: 0; }

.pile { display: flex; flex-direction: column; gap: 0.5rem; }

.pile .btn { width: 100%; justify-content: flex-start; }

.toast {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: calc(5.6rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: min(92vw, 28rem);
  margin: 0;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  background: #064e3b;
  color: #ecfdf5;
  text-align: center;
}

body.fige { overflow: hidden; }

/* Espace TDY Net */

.page-tdy {
  width: min(100%, 40rem);
  margin: 0 auto;
  padding: 1.15rem 1rem 2.5rem;
}

.page-tdy .marque { margin-bottom: 0.9rem; }

.compteurs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  margin: 0.9rem 0;
}

.compteur { margin: 0; }

.compteur .libelle {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.compteur .compte { margin: 0.35rem 0 0; }

.compteur .compte strong {
  display: block;
  font-size: 2.6rem;
  line-height: 1;
  color: #6ee7b7;
  font-variant-numeric: tabular-nums;
}

.page-tdy details summary {
  cursor: pointer;
  font-weight: 700;
}

.intervention .quand {
  margin: 0.1rem 0 0.45rem;
  font-size: 1.35rem;
  font-weight: 750;
}

.etat-vide { color: var(--muted); }

@media (min-width: 720px) {
  .jour { min-height: 4.6rem; }
  .jour .canal { display: block; }
  .actions { flex-direction: row; }
  .actions .btn { flex: 1; }
}

@media (min-width: 960px) {
  .nav {
    top: 0;
    bottom: 0;
    right: auto;
    width: 16rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1.25rem 0.85rem;
    border-top: 0;
    border-right: 1px solid var(--bord);
  }

  .nav .marque {
    position: static;
    height: auto;
    padding: 0.35rem 0.7rem 1rem;
    background: transparent;
    border: 0;
  }

  .onglet {
    flex-direction: row;
    justify-content: flex-start;
    gap: 0.7rem;
    width: 100%;
    min-height: 48px;
    padding: 0.75rem 0.85rem;
    border-radius: 0.8rem;
    font-size: 0.98rem;
  }

  .onglet.actif { background: rgba(16, 185, 129, 0.12); }

  .shell main {
    margin-left: 16rem;
    padding: 1.75rem 2rem 3rem;
    max-width: 72rem;
  }

  .voile { align-items: center; justify-items: center; }

  .tiroir {
    width: min(32rem, 92vw);
    border: 1px solid var(--bord);
    border-radius: 1.15rem;
    max-height: 80dvh;
  }

  .toast { bottom: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .btn.charge::before { animation: none; }
}
