/* cam.odor — caméra du garage (v2, 30/09/2026)
   Identité reprise de la v1 que Doriane connaît : bleu ciel, clair, doux, arrondi.
   Nouveau : thème sombre automatique (le soir, le téléphone passe en sombre). */
@font-face { font-family: 'Manrope'; font-weight: 400 800; font-display: swap; src: url('/polices/manrope.woff2') format('woff2'); }

:root {
  color-scheme: light;
  --fond: #f2f8fd; --fond-2: #e8f2fb; --surface: #ffffff; --surface-2: #f5f9fd;
  --bord: #dce9f5; --bord-fort: #c5dbee;
  --texte: #15304b; --doux: #5f7d99; --tres-doux: #8aa3ba;
  --ciel: #3a9be0; --ciel-fonce: #1f78bf; --ciel-clair: #8ccdf4; --ciel-fond: #e6f3fd;
  --ok: #1fa971; --ok-fond: #e3f7ee; --alerte: #d9901a; --alerte-fond: #fdf3e1; --danger: #dc4e3c; --danger-fond: #fdecea;
  --video: #0c1824;
  --ombre: 0 1px 2px rgba(31, 120, 191, .06), 0 8px 24px rgba(31, 120, 191, .08);
  --rayon: 18px; --rayon-petit: 12px;
  --police: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --nav: 0px;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --fond: #0b141d; --fond-2: #0f1a25; --surface: #131f2b; --surface-2: #182634;
    --bord: #213243; --bord-fort: #2d4257;
    --texte: #e3edf6; --doux: #93aec6; --tres-doux: #6b879f;
    --ciel: #56b0ef; --ciel-fonce: #7cc3f5; --ciel-clair: #2a6fa3; --ciel-fond: #15314a;
    --ok: #3dd293; --ok-fond: #12332a; --alerte: #f0b24a; --alerte-fond: #33280f; --danger: #f26b5b; --danger-fond: #3a1a17;
    --ombre: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--fond); color: var(--texte); font: 500 15px/1.5 var(--police); min-height: 100dvh; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 800; letter-spacing: -.01em; text-wrap: balance; }
a { color: var(--ciel-fonce); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ciel); outline-offset: 2px; }
.mono { font-variant-numeric: tabular-nums; }

/* ─── Boutons ───────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 9px 16px;
  border-radius: var(--rayon-petit); border: 1px solid var(--bord); background: var(--surface-2); color: var(--texte);
  font: 700 14px/1.2 var(--police); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background-color .15s, border-color .15s, transform .08s; user-select: none; }
.btn:hover { border-color: var(--ciel-clair); background: var(--ciel-fond); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.plein, .btn.actif { background: var(--ciel); border-color: var(--ciel); color: #fff; }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: transparent; }
.btn.danger:hover { background: var(--danger-fond); }
.btn.petit { min-height: 34px; padding: 6px 12px; font-size: 13px; }
.btn.occupe { color: transparent !important; position: relative; pointer-events: none; }
.btn.occupe::after { content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--doux); border-top-color: transparent; animation: tourne .7s linear infinite; }
@keyframes tourne { to { transform: rotate(360deg); } }

input, select { width: 100%; min-height: 44px; padding: 9px 12px; border-radius: var(--rayon-petit); border: 1px solid var(--bord-fort); background: var(--surface); color: var(--texte); font: 500 16px var(--police); }
input:focus, select:focus { outline: none; border-color: var(--ciel); box-shadow: 0 0 0 3px var(--ciel-fond); }
input[type=checkbox] { width: 20px; height: 20px; min-height: 0; accent-color: var(--ciel); }
input[type=range] { padding: 0; min-height: 0; accent-color: var(--ciel); border: 0; box-shadow: none; }
.champ { display: grid; gap: 6px; }
.champ > span { font-size: 12.5px; font-weight: 700; color: var(--doux); }
.aide { font-size: 13px; color: var(--doux); font-weight: 500; }

/* Interrupteur */
.inter { position: relative; display: inline-flex; flex-shrink: 0; width: 52px; height: 30px; cursor: pointer; }
.inter input { position: absolute; opacity: 0; inset: 0; margin: 0; width: 100%; height: 100%; cursor: pointer; }
.inter span { position: absolute; inset: 0; border-radius: 99px; background: var(--bord-fort); transition: background-color .2s; pointer-events: none; }
.inter span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0, 0, 0, .2); transition: transform .2s; }
.inter input:checked + span { background: var(--ciel); }
.inter input:checked + span::after { transform: translateX(22px); }
.inter input:disabled + span { opacity: .45; }
.inter input:focus-visible + span { outline: 2px solid var(--ciel); outline-offset: 2px; }

/* ─── Structure ─────────────────────────────────────────────────────────── */
.appli { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100dvh; }
.rail { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 4px; padding: 18px 12px; background: var(--surface); border-right: 1px solid var(--bord); }
.marque { display: flex; align-items: center; gap: 11px; padding: 4px 8px 18px; text-decoration: none; color: var(--texte); }
.logo { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: linear-gradient(140deg, var(--ciel-clair), var(--ciel)); color: #fff; flex-shrink: 0; box-shadow: 0 5px 14px rgba(58, 155, 224, .3); }
.logo svg { width: 22px; height: 22px; }
.marque b { display: block; font-size: 16px; font-weight: 800; }
.marque small { color: var(--doux); font-size: 12px; font-weight: 600; }
.lien { display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: 12px; color: var(--doux); text-decoration: none; font-weight: 700; font-size: 14.5px; }
.lien svg { width: 20px; height: 20px; flex-shrink: 0; }
.lien:hover { background: var(--ciel-fond); color: var(--ciel-fonce); }
.lien.actif { background: var(--ciel); color: #fff; box-shadow: 0 5px 16px rgba(58, 155, 224, .3); }
.lien .nb { margin-left: auto; font-size: 12px; padding: 1px 8px; border-radius: 99px; background: var(--ciel-fond); color: var(--ciel-fonce); }
.lien.actif .nb { background: rgba(255, 255, 255, .25); color: #fff; }
.rail-bas { margin-top: auto; display: grid; gap: 10px; }
.carte-etat { border: 1px solid var(--bord); border-radius: 14px; padding: 10px 12px; font-size: 13px; background: var(--surface-2); }
.contenu { min-width: 0; padding: 22px 26px 40px; }
.page { max-width: 1280px; margin: 0 auto; }
.entete-mobile { display: none; }
.nav-bas { display: none; }

/* Pastilles */
.pastille { display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px; border-radius: 99px; font: 700 12.5px/1.3 var(--police); background: var(--surface-2); color: var(--doux); border: 1px solid var(--bord); white-space: nowrap; }
.pastille::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pastille.ok { background: var(--ok-fond); color: var(--ok); border-color: transparent; }
.pastille.alerte { background: var(--alerte-fond); color: var(--alerte); border-color: transparent; }
.pastille.danger { background: var(--danger-fond); color: var(--danger); border-color: transparent; }
.pastille.neutre::before { display: none; }

/* ─── Blocs ─────────────────────────────────────────────────────────────── */
.bloc { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 18px; box-shadow: var(--ombre); }
.bloc + .bloc { margin-top: 16px; }
.bloc-tete { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.bloc-tete h2 { font-size: 17px; }
.titre-page { font-size: 26px; margin-bottom: 16px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.vide { color: var(--doux); text-align: center; padding: 26px 8px; font-size: 14px; }
.charge { color: var(--doux); display: flex; justify-content: center; align-items: center; gap: 10px; padding: 26px 0; }
.charge::before { content: ''; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--bord-fort); border-top-color: var(--ciel); animation: tourne .7s linear infinite; }
.avertissement { padding: 12px 14px; border-radius: var(--rayon-petit); background: var(--alerte-fond); color: var(--texte); font-size: 14px; line-height: 1.5; }
.avertissement.info { background: var(--ciel-fond); }
.avertissement.danger { background: var(--danger-fond); }

/* ─── Direct ────────────────────────────────────────────────────────────── */
.grille-direct { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.video { position: relative; aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; background: var(--video) center / contain no-repeat; max-height: calc(100dvh - 220px); width: 100%; }
.video video { width: 100%; height: 100%; object-fit: contain; display: block; background: transparent; }
.video:fullscreen { border-radius: 0; max-height: none; }
.badge-direct { position: absolute; top: 12px; left: 12px; display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 99px; background: rgba(12, 24, 36, .72); color: #fff; font: 800 11.5px var(--police); letter-spacing: .08em; backdrop-filter: blur(6px); }
.badge-direct i { width: 8px; height: 8px; border-radius: 50%; background: #ff4d3d; animation: bat 1.6s ease-in-out infinite; }
.badge-direct.attente i { background: #f0b24a; animation: none; }
@keyframes bat { 50% { opacity: .25; } }
.badge-direct small { font-weight: 600; letter-spacing: 0; opacity: .8; }
.message-video { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; text-align: center; padding: 20px; color: #dce9f5; font-size: 14px; background: rgba(12, 24, 36, .55); }
.message-video .rond { width: 30px; height: 30px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .2); border-top-color: #8ccdf4; animation: tourne .8s linear infinite; }
.sur-video { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 8px; }
.sur-video button { width: 44px; height: 44px; border-radius: 13px; border: 0; background: rgba(255, 255, 255, .92); color: #15304b; display: grid; place-items: center; cursor: pointer; box-shadow: 0 3px 12px rgba(0, 0, 0, .25); }
.sur-video button.actif { background: var(--ciel); color: #fff; }
.sur-video svg { width: 20px; height: 20px; }
.commandes { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px; align-items: center; margin-top: 14px; }
.pave { display: grid; grid-template-columns: repeat(3, 56px); grid-template-rows: repeat(3, 56px); gap: 7px; touch-action: none; }
.pave button { border-radius: 15px; border: 1px solid var(--bord); background: var(--surface-2); color: var(--texte); display: grid; place-items: center; cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; }
.pave button:active, .pave button.appui { background: var(--ciel); color: #fff; border-color: var(--ciel); }
.pave button svg { width: 22px; height: 22px; pointer-events: none; }
.pave .haut { grid-area: 1 / 2; } .pave .gauche { grid-area: 2 / 1; } .pave .centre { grid-area: 2 / 2; background: var(--surface); color: var(--doux); } .pave .droite { grid-area: 2 / 3; } .pave .bas { grid-area: 3 / 2; }
.cote-pave { display: grid; gap: 12px; min-width: 0; }
.qualite { display: inline-flex; padding: 4px; border-radius: 13px; background: var(--surface-2); border: 1px solid var(--bord); }
.qualite button { border: 0; background: none; padding: 8px 14px; border-radius: 10px; font: 700 13.5px var(--police); color: var(--doux); cursor: pointer; }
.qualite button.actif { background: var(--surface); color: var(--ciel-fonce); box-shadow: var(--ombre); }
.positions { display: flex; flex-wrap: wrap; gap: 7px; }
.puce { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 99px; border: 1px solid var(--bord); background: var(--surface-2); color: var(--texte); font: 700 13px var(--police); cursor: pointer; white-space: nowrap; }
.puce:hover { border-color: var(--ciel-clair); }
.puce.actif { background: var(--ciel); border-color: var(--ciel); color: #fff; }
.puce b { font-weight: 700; opacity: .7; }
.btn-parler { min-height: 52px; font-size: 15px; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.btn-parler.appui { background: var(--danger); border-color: var(--danger); color: #fff; }
.note { min-height: 20px; font-size: 13px; color: var(--doux); margin-top: 8px; }

/* ─── Événements ────────────────────────────────────────────────────────── */
.filtres { display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; margin-bottom: 8px; }
.filtres::-webkit-scrollbar { display: none; }
.jour { display: flex; align-items: center; gap: 10px; margin: 18px 0 10px; font-size: 12.5px; font-weight: 800; color: var(--doux); text-transform: uppercase; letter-spacing: .07em; }
.jour::after { content: ''; flex: 1; height: 1px; background: var(--bord); }
.evts { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.evt { display: block; padding: 0; border-radius: 15px; overflow: hidden; border: 1px solid var(--bord); background: var(--surface); color: inherit; text-decoration: none; cursor: pointer; text-align: left; font: inherit; transition: transform .15s, box-shadow .15s; }
.evt:hover { transform: translateY(-2px); box-shadow: var(--ombre); }
.evt .img { aspect-ratio: 16 / 9; background: var(--fond-2) center / cover no-repeat; position: relative; }
.evt .img .dur { position: absolute; right: 7px; bottom: 7px; background: rgba(12, 24, 36, .75); color: #fff; font-size: 11.5px; font-weight: 700; padding: 2px 7px; border-radius: 6px; }
.evt .img .garde { position: absolute; left: 7px; top: 7px; background: var(--ciel); color: #fff; font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 6px; }
.evt .txt { padding: 9px 11px; display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.evt .txt b { font-size: 14px; }
.evt .txt small { color: var(--doux); font-size: 12.5px; }
.liste-mini { display: grid; gap: 8px; }
.liste-mini .evt { display: grid; grid-template-columns: 92px minmax(0, 1fr); align-items: center; }
.liste-mini .evt .img { aspect-ratio: 16 / 10; }

/* Lecteur */
.voile { position: fixed; inset: 0; z-index: 60; background: rgba(8, 16, 24, .82); backdrop-filter: blur(8px); display: grid; place-items: center; padding: 14px; animation: apparait .15s ease; }
@keyframes apparait { from { opacity: 0; } }
.lecteur { width: min(1000px, 100%); display: grid; gap: 12px; color: #fff; }
.lecteur-tete { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.lecteur-tete h2 { font-size: 18px; color: #fff; }
.lecteur-tete small { color: #b8cde0; font-weight: 600; }
.lecteur video, .lecteur img { width: 100%; max-height: 68dvh; border-radius: 14px; background: #000; object-fit: contain; display: block; }
.lecteur .actions .btn { background: rgba(255, 255, 255, .95); color: #15304b; border-color: transparent; }
.lecteur .actions .btn.danger { background: transparent; color: #ff9a8c; border-color: rgba(255, 154, 140, .5); }

/* ─── Réglages ──────────────────────────────────────────────────────────── */
.ligne { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--bord); }
.ligne:last-child { border-bottom: 0; }
.ligne .txt { flex: 1; min-width: 0; }
.ligne .txt b { display: block; font-size: 15px; }
.ligne .txt small { display: block; color: var(--doux); font-size: 13px; line-height: 1.4; margin-top: 2px; }
.confidentiel { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 16px; background: var(--ciel-fond); }
.confidentiel.on { background: var(--danger-fond); }
.confidentiel .txt { flex: 1; }
.confidentiel b { font-size: 16px; }
.grille-reglages { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.grille-reglages > .bloc { margin-top: 0; }
.heures { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.heures input { width: auto; }
.mesures { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.mesure { background: var(--surface-2); border: 1px solid var(--bord); border-radius: 14px; padding: 11px 13px; }
.mesure small { display: block; color: var(--doux); font-size: 12px; font-weight: 700; }
.mesure b { font-size: 20px; font-variant-numeric: tabular-nums; }

/* Historique */
.hist { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--bord); font-size: 14px; }
.hist:last-child { border-bottom: 0; }
.hist time { color: var(--doux); font-size: 12.5px; }
.hist small { display: block; color: var(--doux); }

/* ─── Connexion ─────────────────────────────────────────────────────────── */
.ecran-connexion { min-height: 100dvh; display: grid; place-items: center; padding: 20px 16px; background: radial-gradient(900px 600px at 15% -10%, var(--ciel-fond), transparent 60%), radial-gradient(800px 700px at 100% 10%, var(--fond-2), transparent 55%), var(--fond); }
.carte-connexion { width: min(390px, 100%); background: var(--surface); border: 1px solid var(--bord); border-radius: 24px; padding: 28px 24px; box-shadow: var(--ombre); display: grid; gap: 14px; }
.carte-connexion .logo { width: 56px; height: 56px; border-radius: 17px; }
.carte-connexion .logo svg { width: 30px; height: 30px; }
.carte-connexion h1 { font-size: 24px; }
.erreur-form { color: var(--danger); font-size: 14px; min-height: 20px; }
.case { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }

/* Fenêtres + notifications */
.fenetre { width: min(440px, 100%); background: var(--surface); color: var(--texte); border-radius: 20px; padding: 20px; display: grid; gap: 14px; box-shadow: var(--ombre); }
.fenetre h2 { font-size: 19px; }
.fenetre p { margin: 0; white-space: pre-line; color: var(--doux); }
.fenetre .actions { justify-content: flex-end; }
.notifs { position: fixed; z-index: 70; left: 50%; transform: translateX(-50%); bottom: calc(16px + var(--nav) + env(safe-area-inset-bottom, 0px)); display: grid; gap: 8px; width: min(420px, calc(100vw - 32px)); }
.notif { background: var(--texte); color: var(--surface); border-radius: 14px; padding: 12px 16px; font-size: 14px; font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); animation: monte .2s ease; }
.notif.erreur { background: var(--danger); color: #fff; }
@keyframes monte { from { transform: translateY(8px); opacity: 0; } }
.aide-bulle { display: none; }

/* ─── Adaptatif ─────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .grille-direct { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  :root { --nav: 68px; }
  .appli { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .entete-mobile { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30; padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top, 0px)); background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--bord); }
  .entete-mobile .logo { width: 34px; height: 34px; border-radius: 11px; }
  .entete-mobile .logo svg { width: 19px; height: 19px; }
  .entete-mobile b { font-size: 16px; }
  .entete-mobile .pastille { margin-left: auto; }
  .nav-bas { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--bord); padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px)); }
  .nav-bas a { flex: 1; display: grid; justify-items: center; gap: 2px; padding: 6px 0; border-radius: 12px; font-size: 11.5px; font-weight: 700; color: var(--doux); text-decoration: none; position: relative; }
  .nav-bas a svg { width: 22px; height: 22px; }
  .nav-bas a.actif { color: var(--ciel-fonce); background: var(--ciel-fond); }
  .nav-bas a .nb { position: absolute; top: 2px; left: calc(50% + 8px); font-size: 10.5px; padding: 0 6px; border-radius: 99px; background: var(--ciel); color: #fff; }
  .contenu { padding: 12px 12px calc(var(--nav) + 24px + env(safe-area-inset-bottom, 0px)); }
  .video { border-radius: 14px; max-height: 56dvh; }
  .commandes { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .cote-pave { width: 100%; }
  .pave { grid-template-columns: repeat(3, 62px); grid-template-rows: repeat(3, 62px); }
  .bloc { padding: 14px; border-radius: 16px; }
  .titre-page { font-size: 22px; }
  .evts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .grille-reglages { grid-template-columns: minmax(0, 1fr); }
  .hist { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}
