/* Ajouts Chronomenage à l'espace client : responsive, « Code oublié », installation */

/* --- Responsive : jamais de défilement horizontal --- */
html, body { max-width: 100%; overflow-x: hidden; }
*, *::before, *::after { box-sizing: border-box; }
img, video { max-width: 100%; height: auto; }
.auth-container { width: 100%; max-width: 100vw; }
.modal-container { max-width: calc(100vw - 24px) !important; max-height: calc(100vh - 24px); overflow-y: auto; }
/* Page de connexion : dégradé sur tout l'écran, sans bandes blanches */
.app-content:has(.auth-container) { padding: 0 !important; max-width: none !important; }
.auth-container { min-height: 100vh !important; min-height: 100dvh !important; }

/* Les 6 cases du code se partagent la largeur de la carte (avant : 6 x 20 % = 120 %) */
.code-input-container { display: flex !important; justify-content: center !important; gap: 8px; width: 100%; }
.code-input-container .code-input {
	flex: 0 0 auto !important; min-width: 0; width: calc((100% - 40px) / 6) !important; max-width: 60px;
	height: 64px !important; margin: 0 !important; padding: 0;
}

@media (max-width: 480px) {
	.app-header .app-title, .app-title { font-size: 1rem !important; line-height: 1.25; }
	.user-greeting { font-size: .8rem !important; }
}
@media (max-width: 360px) {
	.auth-card { padding: 1.1rem !important; }
	.code-input-container { gap: 6px; }
	.code-input-container .code-input { width: calc((100% - 30px) / 6) !important; height: 54px !important; font-size: 1.3rem !important; }
}

/* --- Lien « Code oublié ? » --- */
.cm-lien-code {
	display: block; margin: 14px auto 0; background: none; border: 0; padding: 6px 10px;
	color: #4f46e5; font: 600 15px var(--font-family, sans-serif); text-decoration: underline; cursor: pointer;
}

/* --- Fenêtres --- */
.cm-fond {
	position: fixed; inset: 0; z-index: 2000; background: rgba(15, 23, 42, .55);
	display: flex; align-items: center; justify-content: center; padding: 16px;
	animation: cm-apparait .2s ease-out;
}
.cm-boite {
	position: relative; width: 100%; max-width: 400px; background: #fff; border-radius: 16px;
	padding: 26px 22px 22px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
	font-family: var(--font-family, sans-serif); color: #1f2937;
}
.cm-fermer {
	position: absolute; top: 8px; right: 10px; width: 36px; height: 36px; border: 0; background: none;
	font-size: 26px; line-height: 1; color: #6b7280; cursor: pointer;
}
.cm-titre { margin: 0 0 10px; font-size: 1.25rem; text-align: center; }
.cm-texte { margin: 0 0 14px; color: #4b5563; line-height: 1.55; font-size: .95rem; }
.cm-champ {
	width: 100%; padding: 13px 14px; border: 2px solid #e5e7eb; border-radius: 12px; font-size: 16px; margin-bottom: 12px;
}
.cm-champ:focus { outline: none; border-color: #4f46e5; }
.cm-bouton {
	width: 100%; padding: 14px; border: 0; border-radius: 12px; color: #fff; font-weight: 700; font-size: 1rem; cursor: pointer;
	background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
}
.cm-bouton:disabled { opacity: .7; cursor: default; }
.cm-message { margin: 12px 0 0; font-size: .92rem; line-height: 1.5; text-align: center; }
.cm-message:empty { display: none; }
.cm-ok { color: #047857; }
.cm-erreur { color: #b91c1c; }
.cm-etapes { margin: 0 0 14px; padding-left: 20px; line-height: 1.6; color: #374151; }

/* --- Barre « Ajouter à l'écran d'accueil » --- */
.cm-installer {
	position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 1500;
	display: flex; align-items: center; gap: 6px; max-width: 480px; margin: 0 auto;
	background: #fff; border-radius: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); padding: 6px 6px 6px 8px;
	animation: cm-monte .3s ease-out;
}
.cm-installer-action {
	flex: 1; display: flex; align-items: center; gap: 10px; border: 0; cursor: pointer; text-align: left;
	background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%); color: #fff; border-radius: 10px;
	padding: 11px 12px; font: 700 .9rem var(--font-family, sans-serif);
}
.cm-installer-icone { font-size: 1.25rem; }
.cm-installer-fermer { width: 34px; height: 34px; border: 0; background: none; font-size: 22px; color: #6b7280; cursor: pointer; }

@keyframes cm-apparait { from { opacity: 0; } to { opacity: 1; } }
@keyframes cm-monte { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* --- Écran d'ouverture animé (une fois par session) --- */
#cm-splash {
	position: fixed; inset: 0; z-index: 3000;
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
	background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
	animation: cm-splash-sortie .45s ease-in 2s forwards;
}
html.cm-sans-splash #cm-splash { display: none; }
.cm-splash-logo { position: relative; width: min(78vw, 340px); aspect-ratio: 1000 / 341; }
.cm-splash-logo img { position: absolute; inset: 0; width: 100%; height: 100%; }
/* pictogramme : partie gauche du logo, arrive avec un rebond */
.cm-splash-icone {
	clip-path: inset(0 74% 0 0); transform-origin: 15% 50%;
	animation: cm-splash-icone .85s cubic-bezier(.34, 1.56, .64, 1) both;
}
/* nom « Chronomenage » : se dévoile de gauche à droite */
.cm-splash-nom { clip-path: inset(0 100% 0 26%); animation: cm-splash-nom .75s cubic-bezier(.22, 1, .36, 1) .55s forwards; }
.cm-splash-texte {
	color: #fff; opacity: 0; font: 500 15px var(--font-family, sans-serif); letter-spacing: .4px;
	animation: cm-splash-fondu .5s ease 1.15s forwards;
}
.cm-splash-points { display: flex; gap: 7px; opacity: 0; animation: cm-splash-fondu .4s ease 1.3s forwards; }
.cm-splash-points span {
	width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, .85);
	animation: cm-splash-point 1s ease-in-out infinite;
}
.cm-splash-points span:nth-child(2) { animation-delay: .15s; }
.cm-splash-points span:nth-child(3) { animation-delay: .3s; }

@keyframes cm-splash-icone {
	0% { opacity: 0; transform: scale(.2) rotate(-25deg); }
	60% { opacity: 1; }
	100% { opacity: 1; transform: none; }
}
@keyframes cm-splash-nom { to { clip-path: inset(0 0 0 26%); } }
@keyframes cm-splash-fondu { to { opacity: 1; } }
@keyframes cm-splash-point { 0%, 100% { transform: translateY(0); opacity: .5; } 50% { transform: translateY(-5px); opacity: 1; } }
@keyframes cm-splash-sortie { to { opacity: 0; visibility: hidden; } }

@media (prefers-reduced-motion: reduce) {
	#cm-splash { animation-delay: .6s; }
	.cm-splash-icone, .cm-splash-nom, .cm-splash-texte, .cm-splash-points { animation-duration: .01s !important; animation-delay: 0s !important; }
}

/* --- Rester connecté + message de bienvenue --- */
.cm-reste-connecte { margin: 10px 0 0; text-align: center; color: #6b7280; font-size: .82rem; line-height: 1.45; }
.cm-lien-refuse { margin: 0 0 12px; }
.cm-bienvenue {
	position: fixed; top: max(14px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 2500;
	max-width: calc(100vw - 32px); background: #fff; color: #1f2937; border-radius: 999px;
	padding: 11px 20px; font: 700 .95rem var(--font-family, sans-serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
	box-shadow: 0 10px 30px rgba(0, 0, 0, .18); animation: cm-bienvenue-entree .35s cubic-bezier(.34, 1.56, .64, 1);
}
.cm-bienvenue-sortie { opacity: 0; transform: translate(-50%, -10px); transition: all .4s ease; }
@keyframes cm-bienvenue-entree { from { opacity: 0; transform: translate(-50%, -16px); } to { opacity: 1; transform: translateX(-50%); } }

/* --- Tableau de bord : prochaine séance + chiffres --- */
.cm-tdb { display: flex; gap: 12px; align-items: stretch; margin: 0 0 14px; font-family: var(--font-family, sans-serif); }
.cm-tdb-prochaine {
	flex: 1; display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: #fff; border-radius: 16px; padding: 14px 16px;
	background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%); box-shadow: 0 8px 24px rgba(79, 70, 229, .25);
}
.cm-tdb-vide { background: #fff; color: #1f2937; box-shadow: 0 4px 16px rgba(0, 0, 0, .06); }
.cm-tdb-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .6px; opacity: .85; font-weight: 700; }
.cm-tdb-quand { font-size: 1.12rem; font-weight: 800; line-height: 1.3; }
.cm-tdb-detail { font-size: .9rem; opacity: .92; }
.cm-tdb-vide .cm-tdb-detail { color: #6b7280; }
.cm-tdb-chiffres { display: flex; flex-direction: column; gap: 8px; min-width: 104px; }
.cm-tdb-chiffres > div {
	background: #fff; border-radius: 12px; padding: 8px 10px; text-align: center; box-shadow: 0 4px 16px rgba(0, 0, 0, .06);
	display: flex; align-items: baseline; justify-content: center; gap: 6px;
}
.cm-tdb-chiffres strong { font-size: 1.25rem; color: #4f46e5; }
.cm-tdb-chiffres span { font-size: .8rem; color: #6b7280; }
.cm-tdb-reserver {
	display: block; text-align: center; text-decoration: none; border-radius: 12px; padding: 9px 10px; font-weight: 700; font-size: .9rem;
	color: #4f46e5; background: #eef2ff; border: 1px solid #c7d2fe;
}
@media (max-width: 480px) {
	.cm-tdb { flex-direction: column; }
	.cm-tdb-chiffres { flex-direction: row; min-width: 0; }
	.cm-tdb-chiffres > * { flex: 1; }
}

/* --- Bandeau des dates : nombre de séances bien visible --- */
.day-cell.has-reservations { background: #eef2ff; }
.day-cell .reservation-indicator { display: none !important; }
.day-cell .reservation-count {
	position: static !important; left: auto !important; top: auto !important; bottom: auto !important; transform: none !important;
	display: inline-flex !important; align-items: center; justify-content: center; gap: 3px; margin: 6px auto 0;
	background: #4f46e5 !important; color: #fff !important; border-radius: 999px; padding: 2px 8px; font-weight: 800; font-size: .8rem; line-height: 1.4;
}
.day-cell .reservation-count .count-label { color: #e0e7ff !important; font-weight: 600; }
.day-cell .day-inner { display: flex; flex-direction: column; align-items: center; }

/* --- Avant l'annulation : récapitulatif --- */
.cm-annul-seance { display: flex; flex-direction: column; gap: 2px; text-align: center; background: #f9fafb; border-radius: 12px; padding: 12px; margin-bottom: 12px; }
.cm-annul-seance span { color: #6b7280; font-size: .92rem; }
.cm-annul-alerte { background: #fff7ed; border: 1px solid #fdba74; color: #9a3412; border-radius: 12px; padding: 10px 12px; font-size: .9rem; line-height: 1.5; margin: 0 0 12px; }
.cm-annul-historique h4 { margin: 0 0 8px; font-size: .95rem; }
.cm-annul-historique ul { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 180px; overflow-y: auto; }
.cm-annul-historique li { display: flex; flex-direction: column; border-left: 3px solid #e5e7eb; padding: 4px 10px; font-size: .9rem; }
.cm-annul-historique small { color: #9ca3af; }
.cm-annul-aucune { color: #047857; font-size: .9rem; margin: 0 0 12px; }
.cm-annul-info { background: #eff6ff; color: #1e40af; border-radius: 12px; padding: 10px 12px; font-size: .9rem; line-height: 1.5; margin: 0 0 14px; }
.cm-annul-actions { display: flex; flex-direction: column; gap: 10px; }
.cm-bouton-secondaire {
	width: 100%; padding: 13px; border-radius: 12px; border: 2px solid #e5e7eb; background: #fff; color: #1f2937; font-weight: 700; font-size: 1rem; cursor: pointer;
}
.cm-annul-continuer { background: none; border: 0; color: #dc2626; font-weight: 600; text-decoration: underline; padding: 6px; cursor: pointer; font-size: .92rem; }

/* --- Photo de l'intervenante sur chaque séance --- */
.technician-item .cm-photo-tech {
	width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
	border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .15); margin-right: 4px;
}
.technician-item { align-items: center; }
.technician-item > div:first-child { display: flex; align-items: center; gap: 10px; }

/* --- « Réserver » : même réservation ou autre chose --- */
.cm-choix-resa { display: flex; flex-direction: column; gap: 10px; }
.cm-choix-option {
	display: flex; flex-direction: column; gap: 3px; text-align: left; text-decoration: none; color: #1f2937;
	border: 2px solid #e5e7eb; border-radius: 14px; padding: 14px 16px; background: #fff;
}
.cm-choix-option strong { font-size: 1rem; }
.cm-choix-option span { color: #6b7280; font-size: .88rem; line-height: 1.45; }
.cm-choix-principal { border-color: #4f46e5; background: #eef2ff; }
.cm-choix-principal strong { color: #4338ca; }

/* --- Raccourci « Installer l'application » --- */
.cm-tdb-installer {
	display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin: -4px 0 14px;
	border: 1px dashed #a5b4fc; background: #fff; color: #4338ca; border-radius: 12px; padding: 10px 12px;
	font: 700 .9rem var(--font-family, sans-serif); cursor: pointer;
}

/* --- « Arrêter la séance » --- */
.cm-tdb-arreter {
	display: flex; flex-direction: column; align-items: center; gap: 2px; width: 100%; margin: -4px 0 14px; cursor: pointer;
	border: 2px solid #fecaca; background: #fef2f2; color: #b91c1c; border-radius: 14px; padding: 12px; font-family: var(--font-family, sans-serif);
}
.cm-tdb-arreter strong { font-size: 1rem; }
.cm-tdb-arreter span { font-size: .85rem; color: #991b1b; }
.cm-bouton-rouge { background: linear-gradient(135deg, #dc2626, #b91c1c) !important; }

/* --- « Prolonger la séance » --- */
.cm-tdb-prolonger {
	display: flex; flex-direction: column; align-items: center; gap: 2px; width: 100%; margin: -4px 0 14px; cursor: pointer;
	border: 2px solid #bbf7d0; background: #f0fdf4; color: #15803d; border-radius: 14px; padding: 12px; font-family: var(--font-family, sans-serif);
}
.cm-tdb-prolonger strong { font-size: 1rem; }
.cm-tdb-prolonger span { font-size: .85rem; color: #166534; }
button.cm-choix-option { width: 100%; cursor: pointer; font-family: inherit; }

/* --- Mes consignes / Notez votre séance --- */
.cm-tdb-consignes, .cm-tdb-noter {
	display: flex; flex-direction: column; align-items: center; gap: 2px; width: 100%; margin: -4px 0 14px; cursor: pointer;
	border: 1px solid #e5e7eb; background: #fff; color: #1f2937; border-radius: 14px; padding: 12px; font-family: var(--font-family, sans-serif);
	box-shadow: 0 4px 16px rgba(0, 0, 0, .05);
}
.cm-tdb-consignes strong { color: #4338ca; }
.cm-tdb-consignes span { font-size: .85rem; color: #6b7280; text-align: center; }
.cm-tdb-noter { flex-direction: row; justify-content: center; gap: 12px; background: #fffbeb; border-color: #fde68a; }
.cm-tdb-noter img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.cm-tdb-noter > span { display: flex; flex-direction: column; text-align: left; }
.cm-tdb-noter small { color: #92400e; }
.cm-puces-bloc { margin-bottom: 12px; }
.cm-puces-titre { font-weight: 700; font-size: .9rem; margin-bottom: 6px; }
.cm-puces { display: flex; flex-wrap: wrap; gap: 8px; }
.cm-puce input { display: none; }
.cm-puce span { display: inline-block; border: 1.5px solid #e5e7eb; border-radius: 999px; padding: 6px 12px; font-size: .88rem; cursor: pointer; background: #fff; }
.cm-puce input:checked + span { border-color: #4f46e5; background: #eef2ff; color: #4338ca; font-weight: 700; }
.cm-note-ligne { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.cm-etoiles { display: flex; gap: 2px; }
.cm-etoiles button { border: 0; background: none; font-size: 28px; line-height: 1; color: #d1d5db; cursor: pointer; padding: 0 1px; }
.cm-etoiles button.on { color: #f59e0b; }
.cm-exclure { display: flex; align-items: center; gap: 8px; font-size: .88rem; color: #6b7280; margin: 0 0 12px; }

/* --- Réclamation guidée --- */
.cm-reclam-grille { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cm-reclam-cas {
	display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; cursor: pointer;
	border: 2px solid #e5e7eb; border-radius: 14px; background: #fff; padding: 14px 8px; font: 600 .88rem var(--font-family, sans-serif); color: #1f2937;
}
.cm-reclam-cas:active { border-color: #4f46e5; background: #eef2ff; }
.cm-reclam-icone { font-size: 1.6rem; }
.cm-reclam-retour { background: none; border: 0; color: #4f46e5; font-weight: 600; padding: 0 0 10px; cursor: pointer; }
.cm-reclam-conseil { background: #eff6ff; color: #1e40af; border-radius: 12px; padding: 10px 12px; font-size: .9rem; line-height: 1.5; margin: 0 0 12px; }

/* --- Note de plusieurs intervenantes + avis Google --- */
.cm-tdb-noter > .cm-tdb-photos { display: flex; flex-direction: row; }
.cm-tdb-photos img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid #fff; }
.cm-tdb-photos img + img { margin-left: -14px; }
.cm-note-bloc { border: 1.5px solid #e5e7eb; border-radius: 14px; padding: 12px 12px 4px; margin-bottom: 12px; }
.cm-note-qui { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.cm-note-qui img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.cm-tdb-avis { border: 0; background: none; color: #b45309; font-weight: 700; font-size: .85rem; padding: 6px 4px; cursor: pointer; }
.cm-avis-google { background: #fffbeb; border: 1.5px solid #fde68a; border-radius: 14px; padding: 14px; margin: 6px 0 12px; color: #78350f; }
.cm-avis-google > strong { display: block; font-size: 1rem; margin-bottom: 6px; }
.cm-avis-google p { margin: 0 0 8px; font-size: .9rem; line-height: 1.5; }
.cm-avis-google ul { margin: 0 0 12px; padding-left: 18px; font-size: .88rem; line-height: 1.6; }

/* --- Consignes en message vocal --- */
.cm-audio { background: #f5f3ff; border: 1.5px solid #ddd6fe; border-radius: 14px; padding: 14px; margin-bottom: 14px; }
.cm-audio > strong { display: block; color: #4c1d95; margin-bottom: 4px; }
.cm-audio-aide { font-size: .85rem; line-height: 1.5; color: #5b21b6; margin: 0 0 10px; }
.cm-audio audio { width: 100%; margin-bottom: 8px; }
.cm-audio-actions { display: flex; gap: 8px; }
.cm-audio-actions .cm-audio-btn { flex: 1; }
.cm-audio-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; border: 1.5px solid #c4b5fd; background: #fff; color: #4c1d95; border-radius: 12px; padding: 11px; font-weight: 700; font-size: .95rem; cursor: pointer; }
.cm-audio-envoyer { background: #7c3aed; border-color: #7c3aed; color: #fff; }
.cm-audio-suppr { color: #b91c1c; border-color: #fecaca; }
.cm-audio-rec { background: #fef2f2; border-color: #fca5a5; color: #b91c1c; }
.cm-audio-point { width: 12px; height: 12px; border-radius: 50%; background: #dc2626; animation: cm-clignote 1s infinite; }
@keyframes cm-clignote { 50% { opacity: .2; } }
