/* Styles du module « Matériel et terrains » (terrains). PROPRIÉTAIRE : l'équipe du module.
   Classes préfixées « te- » ; couleurs : uniquement les jetons de public/app.css (thèmes clair et sombre). */
.te-titre { margin: 8px 0 0; }
.te-zone { display: flex; flex-direction: column; gap: 12px; }
.te-outils { margin-bottom: 0; }
.te-outils > p { margin: 0; flex: 1; min-width: 220px; }
.te-sel { width: auto; min-width: 170px; max-width: 280px; }
.te-fleche { width: 42px; padding: 0; }
.te-semaine { min-width: 0; font-size: 1rem; white-space: nowrap; }

/* cartes des lieux */
.te-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.te-carte { display: flex; flex-direction: column; padding: 0; overflow: hidden; text-decoration: none; transition: border-color .15s; min-width: 0; }
.te-carte:hover { border-color: var(--trait-fort); }
.te-carte:focus-visible { outline: 2px solid var(--club); outline-offset: 2px; }
.te-couverture { width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; background: var(--surface-2); display: block; }
.te-sans-photo { display: grid; place-items: center; color: var(--trait-fort); }
.te-carte-texte { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px 14px; min-width: 0; }
.te-puces { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; min-height: 22px; }

/* plan d'occupation : une ligne par surface, une colonne par jour */
.te-plan table { table-layout: fixed; min-width: 980px; }
.te-plan th, .te-plan td { padding: 8px; vertical-align: top; }
.te-plan thead th { text-align: center; }
.te-plan thead th.te-rang { text-align: left; }
.te-plan .te-rang { width: 190px; text-align: left; background: var(--surface); position: sticky; left: 0; z-index: 1; border-right: 1px solid var(--trait); }
.te-plan thead .te-rang { background: var(--surface-2); overflow: hidden; text-overflow: ellipsis; }
.te-plan tbody th { font-weight: 600; border-bottom: 1px solid var(--trait); text-transform: none; letter-spacing: 0; font-size: .9rem; color: var(--encre); white-space: normal; }
.te-plan tbody tr:last-child th { border-bottom: 0; }
.te-plan tbody tr:hover { background: none; }
.te-plan tr.te-premier > * { border-top: 2px solid var(--trait-fort); }
.te-plan tbody tr.te-premier:first-child > * { border-top: 0; }
.te-lieu { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--doux); font-weight: 650; }
.te-surface { font-weight: 650; }
.te-plan .te-rang small { font-weight: 500; font-size: .78rem; }
.te-case { border-left: 1px solid var(--trait); min-width: 0 !important; max-width: none !important; white-space: normal !important; height: 64px; }
.te-case > * + * { margin-top: 6px; }
.te-auj { background: color-mix(in srgb, var(--club) 5%, transparent); }
thead .te-auj { color: var(--club) !important; }
.te-ferme { background: repeating-linear-gradient(135deg, transparent 0 8px, color-mix(in srgb, var(--alerte) 9%, transparent) 8px 16px); }
.te-fermeture { display: flex; gap: 6px; align-items: flex-start; font-size: .76rem; font-weight: 650; color: var(--alerte); line-height: 1.3; overflow-wrap: anywhere; }
.te-fermeture .icone { margin-top: 2px; }
.te-bloc { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; min-height: 0; padding: 6px 8px; border-radius: 9px; border: 1px solid transparent; border-left: 4px solid var(--club);
  background: var(--teinte); color: var(--encre); font: inherit; font-size: .8rem; line-height: 1.3; text-align: left; white-space: normal !important; overflow: hidden; }
button.te-bloc { cursor: pointer; justify-content: flex-start; }
button.te-bloc:hover { filter: none; border-color: var(--trait-fort); border-left-color: var(--club); }
.te-bloc > * { max-width: 100%; overflow-wrap: anywhere; white-space: normal !important; }
.te-heure { font-variant-numeric: tabular-nums; font-weight: 500; color: var(--doux); font-size: .76rem; }
.te-qui { font-weight: 650; }
.te-portion { color: var(--doux); font-weight: 500; }
.te-match, .te-tournoi { border-left-color: var(--alerte); background: var(--alerte-fond); }
.te-autre { border-left-color: var(--doux); background: var(--surface-2); }
.te-reservation { border-left-color: var(--doux); background: var(--surface-2); border-style: dashed; border-left-style: solid; border-color: var(--trait-fort); border-left-color: var(--doux); }
.te-bloc.te-conflit { border-color: var(--danger); border-left-color: var(--danger); background: var(--danger-fond); }
.te-alerte { display: inline-flex; gap: 4px; align-items: center; color: var(--danger); font-weight: 700; }
.te-legende { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; margin: 0; max-width: none; }
.te-legende-item { display: inline-flex; gap: 8px; align-items: center; white-space: nowrap; }
.te-pastille { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--trait-fort); border-left-width: 4px; flex: none; }
.te-semaine-court { display: none; }
.te-pastille.te-seance { background: var(--teinte); border-left-color: var(--club); }
.te-pastille.te-match { border-left-color: var(--alerte); }
.te-pastille.te-reservation { border-style: dashed; border-left-style: solid; }
.te-pastille.te-conflit { background: var(--danger-fond); border-color: var(--danger); }
.te-titre-impression { display: none; }
.te-resume-conflits { font-weight: 600; }
.te-puce-alerte { background: var(--danger-fond) !important; color: var(--danger) !important; }
.te-puce-alerte .icone { color: var(--danger) !important; }
.te-conflits .ligne-texte strong { white-space: normal; }

/* fenêtres : détails d'une occupation, réservation */
.te-infos { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.te-infos li { display: flex; gap: 10px; align-items: flex-start; }
.te-infos .icone { color: var(--doux); margin-top: 2px; }
.te-infos li.te-alerte .icone { color: var(--danger); }
.te-conflits-form:empty { display: none; }
.te-conflit-liste { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.te-conflit-liste ul { margin: 0; padding-left: 18px; }
.te-conflit-liste p { margin: 0; }
.te-contact { border: 1px solid var(--trait); border-radius: var(--rayon-petit); padding: 10px 12px 12px; margin: 0; }
.te-contact legend { font-weight: 700; font-size: .85rem; padding: 0 4px; }
dialog:has(.te-recurrence), dialog:has(.te-contact) { max-width: 680px; }

/* fiche d'un lieu */
.te-galerie { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.te-vignette { display: block; width: 100%; padding: 0; min-height: 0; border: 1px solid var(--trait); border-radius: var(--rayon-petit); overflow: hidden; background: var(--surface-2); cursor: zoom-in; }
.te-vignette img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; }
.te-vignette:hover { filter: none; border-color: var(--trait-fort); }
.te-colonnes { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; }
.te-colonne { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.te-details { margin: 0; padding: 4px 20px 16px; display: flex; flex-direction: column; }
.te-detail { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-top: 1px solid var(--trait); }
.te-detail:first-child { border-top: 0; }
.te-detail dt { color: var(--doux); font-size: .88rem; font-weight: 600; }
.te-detail dd { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.te-externe { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; }
.te-tel { white-space: nowrap; }
.te-surfaces li { flex-wrap: nowrap; }
.te-surfaces li .ligne-fin { flex: none; width: auto; padding: 0; margin-left: auto; }
.te-vide { padding: 4px 20px 16px; margin: 0; }
.te-semaine-lieu { display: flex; flex-direction: column; gap: 12px; }
.te-semaine-lieu .barre-outils { margin: 0; }
dialog.te-dialogue-photo { max-width: min(1100px, calc(100% - 32px)); }
.te-visionneuse { display: flex; flex-direction: column; gap: 10px; outline: none; }
.te-visionneuse:focus-visible { box-shadow: 0 0 0 2px var(--club); border-radius: var(--rayon-petit); }
.te-visionneuse img { display: block; max-width: 100%; max-height: calc(100vh - 260px); width: auto; height: auto; margin: 0 auto; border-radius: var(--rayon-petit); background: var(--surface-2); object-fit: contain; }
.te-visionneuse-pied { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.te-legende-photo { flex: 1; margin: 0; display: flex; flex-direction: column; align-items: center; text-align: center; max-width: none; min-width: 0; }

@media (max-width: 860px) {
  .te-grille { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .te-colonnes { grid-template-columns: minmax(0, 1fr); }
  .te-detail { grid-template-columns: 1fr; gap: 2px; }
  .te-plan table { min-width: 860px; }
  .te-plan .te-rang { width: 112px; }
  .te-nav { width: 100%; flex-wrap: nowrap; }
  .te-nav .te-semaine { flex: 1; text-align: center; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; }
  .te-semaine-long { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .te-semaine-court { display: inline; }
  .te-outils > .ligne:last-child > .te-sel { flex: 1 1 100%; }
  .te-outils > .ligne:last-child > button { flex: 1; }
  .te-outils > .ligne:last-child { width: 100%; }
  .te-sel { flex: 1; min-width: 0; max-width: none; }
  .te-galerie { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
}

/* impression du plan d'occupation (affichage à la buvette) : la grille seule, en paysage */
@page te-plan { size: A4 landscape; margin: 10mm; }
@media print {
  body:has(.te-plan) { background: #fff; }
  body:has(.te-plan) .barre, body:has(.te-plan) .cote, body:has(.te-plan) .pied, body:has(.te-plan) .annonce, body:has(.te-plan) .onglets, body:has(.te-plan) .entete-page,
  body:has(.te-plan) .te-outils, body:has(.te-plan) .bandeau-apercu, body:has(.te-plan) .retour, body:has(.te-plan) .te-galerie, body:has(.te-plan) .te-colonnes { display: none !important; }
  body:has(.te-plan) .club { display: block; min-height: 0; }
  body:has(.te-plan) .club-contenu { padding: 0; max-width: none; }
  .te-titre-impression { display: block; font-size: 13pt; font-weight: 700; margin: 0 0 6mm; max-width: none; }
  .te-plan { page: te-plan; border: 0; box-shadow: none; overflow: visible; border-radius: 0; }
  .te-plan table { min-width: 0; width: 100%; font-size: 8.5pt; }
  .te-plan th, .te-plan td { border: 1px solid #888 !important; padding: 3px 4px; }
  .te-plan .te-rang { position: static; width: 36mm; }
  .te-plan .te-rang .une-ligne { white-space: normal; overflow: visible; }
  .te-bloc:focus, .te-bloc:focus-visible { outline: none; box-shadow: none; }
  .te-bloc { border: 1px solid #666; border-left-width: 3px; background: none !important; color: #000; padding: 2px 4px; font-size: 8pt; break-inside: avoid; }
  .te-case { height: auto; }
  .te-auj, .te-ferme { background: none !important; }
  .te-plan tr { break-inside: avoid; }
}
