/* ─── AGENDA ───
   Complète /style.css (tokens :root, .app-header, .field, .submit-btn, .toast).
   Règle projet : tout conteneur piloté par el.hidden dont une règle pose un
   display: doit avoir sa règle [hidden] { display: none }. */

#lock-screen[hidden],
#cal-screen[hidden],
#offline-banner[hidden],
.lock-error[hidden],
.refresh-btn[hidden],
#day-panel[hidden],
#day-actions[hidden],
.day-form[hidden],
#rdv-horaire[hidden] { display: none; }

.agenda-container { max-width: 1100px; margin: 0 auto; padding: 1rem; }

/* ─── HEADER (repris du dashboard) ─── */
.back-link {
  font-size: 1.375rem;
  line-height: 1;
  color: var(--text2);
  text-decoration: none;
  padding: 0.25rem 0.5rem 0.25rem 0;
}

.refresh-btn {
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gold);
  background: var(--gold-bg);
  border: 1px solid var(--gold-border);
  border-radius: 100px;
  padding: 6px 14px;
  cursor: pointer;
}

/* ─── ÉCRAN CODE (repris du dashboard) ─── */
#lock-screen { display: flex; justify-content: center; padding-top: 3rem; }

.lock-card {
  width: 100%;
  max-width: 360px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.lock-card form { text-align: left; margin-top: 1.5rem; }
.lock-card .submit-btn { margin-bottom: 0; }

.lock-error {
  color: var(--red);
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

#offline-banner {
  background: var(--orange-bg);
  color: var(--orange);
  border: 1px solid currentColor;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-top: 1rem;
}

/* ─── BARRE DE NAVIGATION DU MOIS ─── */
.cal-bar {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  flex-wrap: wrap;
  margin-bottom: 0.875rem;
}

.cal-nav { display: flex; align-items: center; gap: 0.25rem; }
.cal-nav h2 {
  font-size: 1.125rem;
  letter-spacing: -0.01em;
  min-width: 11.5rem;
  text-align: center;
  margin: 0;
}

.nav-btn {
  font-family: var(--font);
  font-size: 1.375rem;
  line-height: 1;
  color: var(--text2);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  cursor: pointer;
}
.nav-btn:hover { border-color: var(--gold-border); color: var(--gold); }

.today-btn {
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gold);
  background: var(--gold-bg);
  border: 1px solid var(--gold-border);
  border-radius: 100px;
  padding: 6px 14px;
  cursor: pointer;
}

.cal-legende {
  display: flex;
  gap: 1rem;
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text2);
}
.cal-legende span { display: flex; align-items: center; gap: 0.375rem; }
.leg { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.leg-event { background: var(--cyan); }
.leg-prop { background: var(--orange-bg); border: 1.5px dashed var(--orange); }

/* ─── GRILLE ─── */
.cal-grid-head {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 4px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text3);
  text-align: center;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-cell {
  font-family: var(--font);
  text-align: left;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 92px;
  padding: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}
.cal-cell:hover { border-color: var(--gold-border); }
.cal-cell.weekend { background: var(--bg); }
.cal-cell.hors-mois { opacity: 0.4; }
.cal-cell.selection { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-border); }

.cell-num {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text2);
}
.cal-cell.aujourdhui .cell-num {
  color: var(--white);
  background: var(--gold);
  border-radius: 100px;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cell-items { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.pill {
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.35;
  padding: 1px 6px;
  border-radius: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pill-event { background: var(--cyan-light); color: var(--cyan); }
.pill-prop { background: var(--orange-bg); color: var(--orange); border: 1px dashed var(--orange); }
.pill-more { font-size: 0.6875rem; font-weight: 700; color: var(--text3); }

/* ─── PANNEAU DU JOUR ─── */
.day-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 1.25rem;
  margin-top: 1rem;
}

.day-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.875rem;
}
.day-panel-head h3 {
  font-size: 1rem;
  margin: 0;
  text-transform: capitalize;
}
.day-close {
  font-family: var(--font);
  font-size: 0.875rem;
  color: var(--text3);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
}

.day-event {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
  background: var(--cyan-light);
  border-radius: var(--radius-sm);
  padding: 0.625rem 0.875rem;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}
.day-event.day-prop {
  background: var(--orange-bg);
  border: 1px dashed var(--orange);
}
.de-titre { font-weight: 700; }
.de-heure { color: var(--text2); font-size: 0.8125rem; }
.de-lieu { color: var(--text2); font-size: 0.8125rem; }
.de-note { flex-basis: 100%; color: var(--orange); font-size: 0.75rem; font-weight: 600; }

.day-vide { color: var(--text3); font-size: 0.875rem; margin: 0 0 0.5rem; }

.day-actions { display: flex; gap: 0.625rem; flex-wrap: wrap; margin-top: 0.875rem; }

.action-btn {
  font-family: var(--font);
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text2);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.625rem 1rem;
  cursor: pointer;
}
.action-btn:hover { border-color: var(--gold-border); }
.action-gold { color: var(--gold); background: var(--gold-bg); border-color: var(--gold-border); }

/* ─── FORMULAIRES DU PANNEAU ─── */
.day-form {
  border-top: 1px solid var(--border);
  margin-top: 1rem;
  padding-top: 1rem;
  max-width: 480px;
}

.form-note {
  font-size: 0.75rem;
  color: var(--text2);
  background: var(--gold-bg);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-sm);
  padding: 0.625rem 0.875rem;
  margin: 0.25rem 0 0.875rem;
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

.check-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  cursor: pointer;
}
.check-line input { width: 18px; height: 18px; accent-color: var(--gold); }

.opt { font-weight: 400; color: var(--text3); }

.form-btns { display: flex; gap: 0.625rem; align-items: center; }
.form-btns .submit-btn { margin-bottom: 0; width: auto; padding-left: 1.25rem; padding-right: 1.25rem; }

.cancel-btn {
  font-family: var(--font);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text2);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.625rem 1rem;
  cursor: pointer;
}

/* ─── MOBILE (outil de bureau d'abord — le mobile reste lisible) ─── */
@media (max-width: 700px) {
  .agenda-container { padding: 0.625rem; }
  .cal-grid, .cal-grid-head { gap: 2px; }
  .cal-cell { min-height: 52px; padding: 4px; border-radius: 8px; }
  /* Un point coloré par item au lieu des pastilles texte */
  .cell-items { flex-direction: row; flex-wrap: wrap; gap: 3px; }
  .pill {
    width: 8px;
    height: 8px;
    padding: 0;
    border-radius: 50%;
    font-size: 0;
    color: transparent;
  }
  .pill-event { background: var(--cyan); }
  .pill-prop { background: var(--orange); border: none; }
  .pill-more { font-size: 0.625rem; }
  .cal-legende { margin-left: 0; }
  .cal-nav h2 { min-width: 0; font-size: 1rem; }
  .form-grid { grid-template-columns: 1fr; }
}

/* ─── MODE PLACEMENT (arrivée du dashboard ?demande=…) ─── */
#placement-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  background: var(--gold-bg);
  border: 1.5px solid var(--gold-border);
  border-radius: 12px;
  padding: 0.625rem 0.875rem;
  margin-bottom: 0.75rem;
  font-size: 0.9375rem;
}
#placement-bar button {
  margin-left: auto;
  background: none;
  border: 1.5px solid var(--gold-border);
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--gold);
  cursor: pointer;
}

/* ─── DÉTAIL CHANTIER (13/10/2026) ─── Récap de la visite déposé dans la
   description de l'événement par le Worker : surface, essence, état, accès,
   mobilier, remarques. L'équipe l'a sous les yeux sans ouvrir Notion. */
.de-detail {
  flex-basis: 100%;
  /* min-width:0 : sans ça le <pre> impose sa largeur min-content au flex item
     (le lien de la fiche visite ne se coupe pas) et la page déborde sur mobile */
  min-width: 0;
  max-width: 100%;
  font-size: 0.8125rem;
}
.de-detail summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--text2);
  padding: 0.25rem 0;
}
.de-detail pre {
  margin-top: 0.375rem;
  padding: 0.625rem 0.75rem;
  background: var(--white);
  border-radius: var(--radius-sm);
  color: var(--text2);
  font-family: inherit;
  font-size: 0.8125rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow-x: auto;
}

/* ─── RATTACHEMENT d'un événement Google créé à la main ─── */
.de-rattacher {
  align-self: flex-start;
  margin-top: 0.25rem;
  background: none;
  border: 1.5px dashed var(--gold-border);
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--gold);
  cursor: pointer;
}
.rattach-zone {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.375rem;
  width: 100%;
}
.rattach-select {
  flex: 1;
  min-width: 0;
  min-height: 2.5rem;
  padding: 0.25rem 0.5rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font: inherit;
  font-size: 0.875rem;
  background: var(--white);
}
.rattach-go {
  min-height: 2.5rem;
  padding: 0 0.875rem;
  border: none;
  border-radius: 10px;
  background: var(--gold);
  color: #fff;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
}
.rattach-go:disabled { opacity: 0.5; }
