/* Page du spa : téléphone d'abord, clair et sombre selon le téléphone. */
:root {
	--fond: #eef3f7;
	--carte: #ffffff;
	--texte: #13202b;
	--texte-doux: #5b6b78;
	--bord: #d5dee6;
	--eau: #0b6aa2;
	--eau-clair: #d7ebf7;
	--sur-eau: #ffffff;
	--chaud: #e0761b;
	--chaud-clair: #fdebd9;
	--alerte: #b3261e;
	--alerte-clair: #fbe4e2;
	--attention: #8a5a00;
	--attention-clair: #fff1cc;
	--ombre: 0 1px 3px rgba(19, 32, 43, .08);
	color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
	:root {
		--fond: #0d1a24;
		--carte: #162734;
		--texte: #e7eef3;
		--texte-doux: #9cb0bf;
		--bord: #284050;
		--eau: #4fb3ea;
		--eau-clair: #173a52;
		--sur-eau: #062033;
		--chaud: #ff9a45;
		--chaud-clair: #4a2c12;
		--alerte: #ff8a80;
		--alerte-clair: #4a1d1a;
		--attention: #ffd166;
		--attention-clair: #3d3112;
		--ombre: none;
	}
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	background: var(--fond);
	color: var(--texte);
	font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

button { font: inherit; color: inherit; touch-action: manipulation; cursor: pointer; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }

.ecran {
	max-width: 480px;
	margin: 0 auto;
	padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
		max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

h1 { font-size: 1.35rem; margin: 0; }
h2 { font-size: .8rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
	color: var(--texte-doux); margin: 0 0 .7rem; }

/* ---- Connexion ---- */
#connexion { text-align: center; padding-top: 12vh; }
#connexion .logo img { width: 84px; height: 84px; }
#connexion h1 { margin: .6rem 0 1.6rem; }
#connexion form { text-align: left; background: var(--carte); border-radius: 16px; padding: 1.2rem;
	box-shadow: var(--ombre); }
#connexion label { display: block; font-size: .9rem; color: var(--texte-doux); margin-bottom: .35rem; }
#connexion input[type=password] { width: 100%; font: inherit; padding: .75rem .8rem; border-radius: 10px;
	border: 1px solid var(--bord); background: var(--fond); color: var(--texte); }
.erreur { color: var(--alerte); min-height: 1.4em; margin: .5rem 0; font-size: .92rem; }
.principal { width: 100%; padding: .8rem; border: 0; border-radius: 10px; background: var(--eau);
	color: var(--sur-eau); font-weight: 600; }

/* ---- En-tête ---- */
.entete { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 12px; }
.liaison { font-size: .82rem; padding: .2rem .6rem; border-radius: 999px; background: var(--carte);
	color: var(--texte-doux); border: 1px solid var(--bord); }
.liaison.ok::before { content: ""; display: inline-block; width: .5rem; height: .5rem; border-radius: 50%;
	background: #2e9d5b; margin-right: .4rem; vertical-align: .05rem; }
.liaison.ko { color: var(--alerte); border-color: var(--alerte); }

/* ---- Alertes ---- */
.alertes:empty { display: none; }
.alertes { display: grid; gap: 8px; margin-bottom: 12px; }
.alerte { border-radius: 12px; padding: .7rem .9rem; font-size: .95rem; }
.alerte.rouge { background: var(--alerte-clair); color: var(--alerte); }
.alerte.jaune { background: var(--attention-clair); color: var(--attention); }
.alerte.bleue { background: var(--eau-clair); color: var(--texte); }

/* ---- Cartes ---- */
.carte { background: var(--carte); border-radius: 16px; padding: 1rem; margin-bottom: 12px;
	box-shadow: var(--ombre); }
.note { color: var(--texte-doux); font-size: .88rem; margin: .5rem 0 0; }
.petit { font-size: .8rem; color: var(--texte-doux); min-height: 1.1em; }
.legende { font-size: .8rem; color: var(--texte-doux); text-transform: uppercase; letter-spacing: .05em; }
.unite { font-size: .45em; font-weight: 500; vertical-align: .9em; margin-left: .08em; }

/* ---- Cadran ---- */
.cadran { position: relative; width: min(260px, 78vw); margin: 0 auto; }
.cadran svg { display: block; width: 100%; height: auto; }
.piste, .arc { fill: none; stroke-width: 12; stroke-linecap: round; }
.piste { stroke: var(--eau-clair); }
.arc { stroke: var(--eau); transition: stroke-dasharray .6s ease; }
.chauffe-en-cours .arc { stroke: var(--chaud); }
.repere { fill: var(--carte); stroke: var(--texte); stroke-width: 3; }
.lecture { position: absolute; inset: 22% 0 auto 0; display: flex; flex-direction: column; align-items: center; }
.lecture .valeur { font-size: 3.6rem; font-weight: 300; line-height: 1.05; font-variant-numeric: tabular-nums; }
.chauffe { font-size: .85rem; color: var(--texte-doux); min-height: 1.3em; text-align: center; }
.chauffe-en-cours .chauffe { color: var(--chaud); font-weight: 600; }

.consigne { display: flex; align-items: center; justify-content: center; gap: 1.2rem; margin-top: .3rem; }
.consigne-valeur { display: flex; flex-direction: column; align-items: center; min-width: 7.5rem; }
.consigne-valeur > span:nth-child(2) { font-size: 1.9rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.consigne.modifiee .consigne-valeur > span:nth-child(2) { color: var(--eau); }
.rond { width: 3.4rem; height: 3.4rem; border-radius: 50%; border: 1px solid var(--bord);
	background: var(--fond); font-size: 1.8rem; line-height: 1; }
.rond:active:not(:disabled) { background: var(--eau-clair); }
.rond:disabled { opacity: .35; }

/* ---- Tuiles ---- */
.tuiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tuile { display: flex; flex-direction: column; align-items: flex-start; gap: .15rem; text-align: left;
	padding: .8rem .9rem; border-radius: 14px; border: 1px solid var(--bord); background: var(--fond);
	min-height: 4.6rem; position: relative; }
.tuile strong { font-weight: 600; }
.tuile span { font-size: .88rem; color: var(--texte-doux); }
.tuile.on { background: var(--eau); border-color: var(--eau); color: var(--sur-eau); }
.tuile.on span { color: var(--sur-eau); opacity: .85; }
.tuile.envoi::after { content: ""; position: absolute; top: .7rem; right: .7rem; width: .9rem; height: .9rem;
	border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
	animation: tourne .8s linear infinite; }
.tuile:disabled { opacity: .5; }
@keyframes tourne { to { transform: rotate(360deg); } }

/* ---- Choix ---- */
.choix { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px;
	background: var(--fond); border-radius: 12px; border: 1px solid var(--bord); margin-top: .9rem; }
.choix:first-of-type { margin-top: 0; }
.choix button { border: 0; background: transparent; border-radius: 9px; padding: .55rem .3rem;
	display: flex; flex-direction: column; align-items: center; font-weight: 500; }
.choix button small { font-size: .75rem; font-weight: 400; color: var(--texte-doux); }
.choix button.actif { background: var(--carte); box-shadow: 0 1px 2px rgba(0, 0, 0, .15); color: var(--eau); }
.choix button.envoi { opacity: .6; }
.choix button:disabled { opacity: .45; }

/* ---- Entretien ---- */
.infos { display: grid; grid-template-columns: auto 1fr; gap: .55rem 1rem; margin: 0; }
.infos dt { color: var(--texte-doux); font-size: .92rem; }
.infos dd { margin: 0; text-align: right; }
.lien { border: 0; background: none; padding: 0; color: var(--eau); font-weight: 500; }
.lien:disabled { opacity: .5; }

/* Réglage de la filtration, ouvert sous la liste. */
.filtration { margin-top: .9rem; padding-top: .9rem; border-top: 1px solid var(--bord); }
.filtration fieldset { border: 0; margin: 0 0 .8rem; padding: 0; display: grid; gap: .5rem; }
.filtration legend { font-weight: 600; padding: 0; margin-bottom: .5rem; }
.filtration label { display: flex; align-items: center; justify-content: space-between; gap: .8rem;
	color: var(--texte-doux); font-size: .92rem; }
.filtration label.case { justify-content: flex-start; gap: .5rem; color: var(--texte); font-size: 1rem; }
.filtration .case input { width: 1.2rem; height: 1.2rem; margin: 0; accent-color: var(--eau); }
.filtration input[type=time], .filtration select { font: inherit; color: var(--texte); background: var(--fond);
	border: 1px solid var(--bord); border-radius: 10px; padding: .45rem .55rem; min-height: 2.6rem; }
.filtration input:disabled, .filtration select:disabled { opacity: .45; }
.filtration .duree { display: inline-flex; align-items: center; gap: .35rem; color: var(--texte); }
.filtration .note { margin: 0 0 .9rem; }
.boutons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.secondaire { padding: .8rem; border-radius: 10px; border: 1px solid var(--bord); background: var(--fond);
	font-weight: 500; }
.principal:disabled { opacity: .5; }

.pied { display: flex; justify-content: space-between; align-items: center; font-size: .8rem;
	color: var(--texte-doux); padding: .4rem .2rem; }

/* ---- Message passager ---- */
.message { position: fixed; left: 50%; transform: translateX(-50%);
	bottom: max(16px, env(safe-area-inset-bottom)); max-width: min(440px, calc(100vw - 32px));
	background: var(--texte); color: var(--fond); padding: .7rem 1rem; border-radius: 12px; font-size: .92rem;
	box-shadow: 0 4px 14px rgba(0, 0, 0, .25); }
.message.rouge { background: var(--alerte); color: #fff; }

/* ---- Page « Informations » (info.html) ---- */
.info-boitier dd { overflow-wrap: anywhere; }
.info-boitier .code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; }
.info-boitier dd.ok { color: #2e9d5b; }
.info-boitier dd.ko { color: var(--alerte); }
.info-boitier dd .lien { margin-left: .6rem; }
details.carte summary { cursor: pointer; font-weight: 600; }
.brut { margin: .8rem 0 0; font-size: .72rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.pied a.lien { text-decoration: none; }
