:root {
  --fond: #f6f4ef; --carte: #ffffff; --texte: #1d211f; --doux: #5f6662; --ligne: #dcd8cf;
  --vert: #0e5a4a; --vert-texte: #ffffff; --vert-pale: #e3efe9; --rouge: #a3271c; --rouge-pale: #fbe9e6;
  --ambre: #8a5a00; --ambre-pale: #fdf1d8; --focus: #1f7a65; --ombre: 0 1px 2px rgb(0 0 0 / .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fond: #121513; --carte: #1b1f1d; --texte: #eceeea; --doux: #a3aaa5; --ligne: #333a36;
    --vert: #3fae8f; --vert-texte: #07140f; --vert-pale: #1d3a31; --rouge: #ff8a7d; --rouge-pale: #3a1e1b;
    --ambre: #f0bf5a; --ambre-pale: #3a2e14; --focus: #6fd1b4; --ombre: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --fond: #121513; --carte: #1b1f1d; --texte: #eceeea; --doux: #a3aaa5; --ligne: #333a36;
  --vert: #3fae8f; --vert-texte: #07140f; --vert-pale: #1d3a31; --rouge: #ff8a7d; --rouge-pale: #3a1e1b;
  --ambre: #f0bf5a; --ambre-pale: #3a2e14; --focus: #6fd1b4; --ombre: none; color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fond); color: var(--texte); font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Arabic", sans-serif; }
[hidden] { display: none !important; }
main { max-width: 560px; margin: 0 auto; padding: 16px 16px 48px; }
main.large { max-width: 1100px; }
h1 { font-size: 1.35rem; margin: 0; }
h2 { font-size: 1.15rem; margin: 0 0 4px; }
p { margin: 0; }
.entete { display: flex; align-items: center; gap: 12px; margin: 8px 0 16px; }
.entete img { width: 40px; height: 40px; }
.entete .espace { flex: 1; min-width: 0; }
.doux { color: var(--doux); font-size: .92rem; }
.carte { background: var(--carte); border: 1px solid var(--ligne); border-radius: 12px; padding: 16px; box-shadow: var(--ombre); }
.pile > * + * { margin-top: 12px; }
.note { display: flex; gap: 10px; background: var(--carte); border: 1px solid var(--ligne); border-radius: 12px; padding: 12px 14px; font-size: .88rem; color: var(--doux); }
.note.ambre { background: var(--ambre-pale); border-color: transparent; color: var(--texte); }
.note svg { flex: 0 0 18px; margin-top: 2px; }
button, .bouton { font: inherit; border-radius: 10px; border: 1px solid var(--ligne); background: var(--carte); color: var(--texte); padding: 11px 16px; min-height: 46px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
button.principal { background: var(--vert); border-color: var(--vert); color: var(--vert-texte); font-weight: 600; }
button.danger { color: var(--rouge); }
button.petit { min-height: 36px; padding: 6px 12px; font-size: .9rem; }
button.lien { border: 0; background: none; padding: 4px; min-height: 0; color: var(--doux); text-decoration: underline; }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible, .choix:focus-within, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.pointille { width: 100%; border-style: dashed; background: transparent; }
.large-bouton { width: 100%; }
.choix-photo { position: relative; }
.fichier-cache { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 0; }
.champ { display: block; }
.champ > span:first-child, .champ > label.libelle { display: block; font-size: .9rem; margin-bottom: 4px; font-weight: 500; }
input, select, textarea { font: inherit; width: 100%; min-width: 0; min-height: 46px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--ligne); background: var(--carte); color: var(--texte); }
input[type="date"] { -webkit-appearance: none; appearance: none; display: block; }
input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; flex: 0 0 22px; accent-color: var(--vert); margin: 0; }
.erreur { color: var(--rouge); font-size: .86rem; margin-top: 4px; }
[aria-invalid="true"] { border-color: var(--rouge); }
.deux { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choix { display: flex; align-items: center; gap: 10px; border: 1px solid var(--ligne); border-radius: 10px; padding: 12px 14px; background: var(--carte); cursor: pointer; }
.choix input[type="radio"] { width: 18px; height: 18px; min-height: 0; margin: 0; accent-color: var(--vert); flex: 0 0 18px; }
.choix:has(input:checked) { border-color: var(--vert); background: var(--vert-pale); }
.choix .drapeau { font-size: 1.25rem; }
.coche { display: flex; gap: 10px; align-items: flex-start; }
.progres { display: flex; justify-content: space-between; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--doux); margin-bottom: 6px; }
.barre { height: 4px; background: var(--ligne); border-radius: 2px; overflow: hidden; margin-bottom: 18px; }
.barre > div { height: 100%; background: var(--vert); transition: width .2s; }
.navigation { display: grid; grid-template-columns: auto 1fr; gap: 10px; margin-top: 20px; }
.voyageur { display: flex; align-items: center; gap: 12px; }
.voyageur .espace { flex: 1; min-width: 0; }
.voyageur strong { display: block; overflow-wrap: anywhere; }
.etat { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; padding: 2px 8px; border-radius: 999px; background: var(--ligne); color: var(--texte); white-space: nowrap; }
.etat.vert { background: var(--vert-pale); color: var(--vert); }
.etat.ambre { background: var(--ambre-pale); color: var(--ambre); }
.etat.rouge { background: var(--rouge-pale); color: var(--rouge); }
.signature { position: relative; border: 1px solid var(--ligne); border-radius: 10px; background: #fff; height: 170px; touch-action: none; }
.signature canvas { width: 100%; height: 100%; display: block; border-radius: 10px; }
.signature .aide { position: absolute; left: 12px; bottom: 8px; font-size: .8rem; color: #7c827e; pointer-events: none; }
.apercu { width: 100%; max-height: 300px; object-fit: contain; border-radius: 10px; border: 1px solid var(--ligne); background: var(--fond); }
.resume { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: .92rem; }
.resume dt { color: var(--doux); }
.resume dd { margin: 0; overflow-wrap: anywhere; }
.langue { width: auto; min-height: 38px; padding: 6px 10px; border-radius: 999px; font-size: .9rem; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--texte); color: var(--fond); padding: 10px 16px; border-radius: 10px; font-size: .92rem; z-index: 10; max-width: calc(100% - 32px); }
.vide { text-align: center; padding: 32px 16px; color: var(--doux); }
/* Hôte */
.outils .espace { flex: 1; min-width: 0; }
button.carte { width: 100%; text-align: start; justify-content: flex-start; }
svg.sig { display: block; }
@media (max-width: 480px) { h1 { font-size: 1.15rem; } }
.outils { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th { text-align: start; font-weight: 600; color: var(--doux); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; padding: 8px 10px; border-bottom: 1px solid var(--ligne); }
td { padding: 10px; border-bottom: 1px solid var(--ligne); vertical-align: middle; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--vert-pale); }
.cartes-sejours { display: none; }
@media (max-width: 720px) {
  table.sejours { display: none; }
  .cartes-sejours { display: grid; gap: 10px; }
  .cartes-sejours .carte { cursor: pointer; }
}
dialog { border: 1px solid var(--ligne); border-radius: 14px; padding: 0; background: var(--carte); color: var(--texte); width: min(640px, calc(100% - 24px)); max-height: calc(100dvh - 24px); }
dialog::backdrop { background: rgb(0 0 0 / .45); }
dialog .corps { padding: 18px; overflow: auto; }
dialog .tete { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--ligne); position: sticky; top: 0; background: var(--carte); z-index: 1; }
dialog .tete h2 { flex: 1; margin: 0; overflow-wrap: anywhere; }
.lien-boite { display: flex; gap: 8px; }
.lien-boite input { font-family: ui-monospace, Menlo, monospace; font-size: .82rem; }
textarea { min-height: 150px; resize: vertical; font-size: .9rem; }
.photo-hote { width: 100%; border-radius: 10px; border: 1px solid var(--ligne); }
svg.sig { width: 100%; max-width: 360px; height: auto; background: #fff; border: 1px solid var(--ligne); border-radius: 8px; }
#impression { display: none; }
@media print {
  body { background: #fff; color: #000; }
  body > *:not(#impression) { display: none !important; }
  #impression { display: block; font: 11pt/1.35 Arial, sans-serif; }
  .bulletin { page-break-after: always; break-after: page; padding: 8mm 4mm; }
  .bulletin h1 { text-align: center; font-size: 15pt; margin-bottom: 2mm; }
  .bulletin .ar { text-align: center; direction: rtl; font-size: 13pt; }
  .bulletin .cadre { border: 2px solid #000; border-radius: 4mm; padding: 4mm 5mm; margin-top: 4mm; }
  .bulletin .cadre h3 { margin: 0 0 2mm; font-size: 10pt; text-transform: uppercase; }
  .bulletin table td { border: 0; padding: 1.3mm 0; }
  .bulletin table td:first-child { width: 48mm; font-weight: bold; }
  .bulletin svg.sig { border: 0; max-width: 70mm; }
  .bulletin .pied { font-size: 8pt; color: #444; margin-top: 3mm; }
}
/* Champ de date (modèle ImmoFlo V2DateInput) */
.date { position: relative; display: block; width: 100%; min-width: 0; }
.date > input { padding-inline-end: 44px; font-variant-numeric: tabular-nums; text-align: start; }
.date > input[type="date"]::-webkit-calendar-picker-indicator { display: none; }
.date-bouton { position: absolute; top: 50%; inset-inline-end: 6px; transform: translateY(-50%); width: 34px; height: 34px; min-height: 0; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--vert); display: grid; place-items: center; }
.date-bouton:hover, .date-bouton[aria-expanded="true"] { background: var(--vert-pale); }
.date-calendrier { position: fixed; z-index: 1000; box-sizing: border-box; overflow-y: auto; border: 1px solid var(--ligne); border-radius: 12px; padding: 10px; background: var(--carte); color: var(--texte); box-shadow: 0 14px 34px rgb(0 0 0 / .18); font-size: 14px; }
.date-tete { display: grid; grid-template-columns: 32px minmax(0, 1fr) 84px 32px; gap: 6px; align-items: center; margin-bottom: 8px; }
.date-tete select { height: 36px; min-height: 0; padding: 0 6px; font-weight: 600; font-size: 14px; }
.date-nav { width: 32px; height: 32px; min-height: 0; padding: 0; border: 0; background: transparent; color: var(--doux); display: grid; place-items: center; }
.date-nav:hover { background: var(--fond); }
.date-grille { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.date-semaine { padding: 4px 0; color: var(--doux); font-size: 11px; font-weight: 700; text-align: center; text-transform: uppercase; }
.date-jour { height: 38px; min-height: 0; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--texte); font-weight: 600; justify-content: center; }
.date-jour:hover:not(:disabled) { background: var(--fond); }
.date-jour.aujourdhui { box-shadow: inset 0 0 0 1px var(--ligne); }
.date-jour[aria-pressed="true"] { background: var(--vert); color: var(--vert-texte); }
.date-jour:disabled { opacity: .3; }
.date-pied { display: flex; justify-content: flex-end; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--ligne); }
.date-pied button { min-height: 34px; padding: 4px 12px; font-size: 14px; }
.apercu.grand { max-height: 60vh; }
.resume.guide dd { white-space: pre-line; }
.resume.guide dd.gros { font-size: 1.3rem; font-weight: 700; letter-spacing: .04em; }
