/* Planning RDV : système visuel commun (charte NoCode & Co v1.0, style « masterclass » nuit). */

@font-face { font-family: "Montserrat"; src: url("/fonts/montserrat.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/inter.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  color-scheme: dark;
  --nuit: #0B1226;
  --nuit-2: #0E1730;
  --nuit-3: #131E3D;
  --carte: rgba(16, 25, 52, 0.72);
  --carte-pleine: #111B38;
  --bord: rgba(150, 170, 255, 0.13);
  --bord-fort: rgba(150, 170, 255, 0.26);
  --texte: #EAF0FF;
  --texte-2: #AAB6D8;
  --texte-3: #6F7CA6;
  --bleu: #2D5BFF;
  --cyan: #00D4C8;
  --violet: #7B61FF;
  --ok: #2BD99A;
  --ambre: #FFB547;
  --danger: #FF5C7A;
  --grad: linear-gradient(100deg, #2D5BFF 0%, #00D4C8 52%, #7B61FF 100%);
  --grad-doux: linear-gradient(135deg, rgba(45, 91, 255, .22), rgba(123, 97, 255, .14) 60%, rgba(0, 212, 200, .12));
  --f-titre: "Montserrat", "Segoe UI Variable Display", "Segoe UI", Roboto, system-ui, sans-serif;
  --f-texte: "Inter", "Segoe UI Variable Text", "Segoe UI", Roboto, system-ui, sans-serif;
  --f-mono: ui-monospace, "Cascadia Mono", "JetBrains Mono", "Roboto Mono", Consolas, monospace;
  --r-s: 10px;
  --r-m: 16px;
  --r-l: 24px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ressort: cubic-bezier(.34, 1.56, .64, 1);
  --t-court: 160ms;
  --t-moyen: 280ms;
  --ombre: 0 18px 50px -20px rgba(0, 0, 0, .7), 0 2px 0 rgba(255, 255, 255, .02) inset;
  --cat: var(--bleu);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--nuit);
  color: var(--texte);
  font: 400 16px/1.5 var(--f-texte);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

/* Fond : halos colorés qui dérivent lentement + grain. */
.fond { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; background: radial-gradient(120% 80% at 50% -10%, #142456 0%, var(--nuit) 55%); }
.fond .halo { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; will-change: transform; }
.fond .h1 { width: 46vmax; height: 46vmax; left: -12vmax; top: -16vmax; background: radial-gradient(circle, rgba(45, 91, 255, .55), transparent 65%); animation: derive 38s var(--ease) infinite alternate; }
.fond .h2 { width: 40vmax; height: 40vmax; right: -14vmax; top: 18vh; background: radial-gradient(circle, rgba(123, 97, 255, .45), transparent 65%); animation: derive 46s var(--ease) infinite alternate-reverse; }
.fond .h3 { width: 34vmax; height: 34vmax; left: 18vw; bottom: -20vmax; background: radial-gradient(circle, rgba(0, 212, 200, .30), transparent 65%); animation: derive 52s var(--ease) infinite alternate; }
.fond::after {
  content: ""; position: absolute; inset: -50%; opacity: .07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
@keyframes derive { to { transform: translate3d(6vmax, 4vmax, 0) scale(1.08); } }

/* Typographie */
h1, h2, h3 { font-family: var(--f-titre); margin: 0; letter-spacing: -.02em; line-height: 1.05; }
.sur { font: 600 11.5px/1 var(--f-mono); letter-spacing: .18em; text-transform: uppercase; color: var(--cyan); margin: 0 0 12px; display: flex; align-items: center; gap: 10px; }
.sur::before { content: ""; width: 18px; height: 1px; background: currentColor; opacity: .7; }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.discret { color: var(--texte-3); }
.ico { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }

/* Cartes */
.carte {
  position: relative;
  background: var(--carte);
  border: 1px solid var(--bord);
  border-radius: var(--r-l);
  box-shadow: var(--ombre);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
}
.carte::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; padding: 1px;
  background: linear-gradient(160deg, rgba(255, 255, 255, .10), transparent 30%, transparent 70%, rgba(0, 212, 200, .10));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
}

/* Champs */
.champ {
  width: 100%; min-height: 48px; padding: 12px 14px;
  background: rgba(8, 14, 32, .55); color: var(--texte);
  border: 1px solid var(--bord); border-radius: var(--r-m);
  font: 500 16px/1.3 var(--f-texte);
  transition: border-color var(--t-court) var(--ease), box-shadow var(--t-court) var(--ease), background var(--t-court);
}
.champ::placeholder { color: var(--texte-3); }
.champ:hover { border-color: var(--bord-fort); }
.champ:focus { outline: none; border-color: rgba(0, 212, 200, .7); box-shadow: 0 0 0 4px rgba(0, 212, 200, .14); background: rgba(8, 14, 32, .8); }
.champ[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(255, 92, 122, .14); }
textarea.champ { min-height: 96px; resize: vertical; }
select.champ { appearance: none; padding-right: 38px; background-image: linear-gradient(45deg, transparent 50%, var(--texte-2) 50%), linear-gradient(135deg, var(--texte-2) 50%, transparent 50%); background-position: calc(100% - 20px) 52%, calc(100% - 15px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
input[type="date"].champ, input[type="time"].champ { font-variant-numeric: tabular-nums; }
input[type="date"]::-webkit-calendar-picker-indicator, input[type="time"]::-webkit-calendar-picker-indicator { filter: invert(.8); cursor: pointer; }

/* Puces (boutons à bascule) */
.puces { display: flex; flex-wrap: wrap; gap: 8px; }
.puces.defile { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; margin-inline: -4px; padding: 2px 4px 6px; }
.puces.defile::-webkit-scrollbar { display: none; }
.puce {
  --c: var(--cyan);
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  min-height: 40px; padding: 8px 14px; scroll-snap-align: start;
  color: var(--texte-2); background: rgba(255, 255, 255, .035);
  border: 1px solid var(--bord); border-radius: 999px;
  font: 600 14px/1 var(--f-texte); cursor: pointer; user-select: none;
  transition: transform var(--t-court) var(--ease), background var(--t-court), border-color var(--t-court), color var(--t-court), box-shadow var(--t-court);
}
.puce:hover { color: var(--texte); border-color: var(--bord-fort); background: rgba(255, 255, 255, .06); }
.puce:active { transform: scale(.96); }
.puce[aria-pressed="true"], .puce.actif {
  color: #fff; border-color: color-mix(in srgb, var(--c) 70%, transparent);
  background: color-mix(in srgb, var(--c) 20%, rgba(10, 18, 40, .6));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--c) 35%, transparent), 0 8px 24px -10px color-mix(in srgb, var(--c) 80%, transparent);
}
.puce .point { width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); }
.btn-nu { display: inline-grid; place-items: center; padding: 2px; border: 0; background: none; color: inherit; cursor: pointer; border-radius: 50%; }
.puce .x { margin-left: 2px; opacity: .6; }
.puce .x:hover { opacity: 1; }

/* Sélecteur segmenté */
.seg { display: inline-flex; padding: 4px; gap: 4px; background: rgba(8, 14, 32, .55); border: 1px solid var(--bord); border-radius: 14px; flex-wrap: wrap; }
.seg button { min-height: 38px; padding: 8px 12px; display: inline-flex; align-items: center; gap: 7px; border: 0; border-radius: 10px; background: transparent; color: var(--texte-2); font: 600 14px/1 var(--f-texte); cursor: pointer; transition: background var(--t-court), color var(--t-court); }
.seg button:hover { color: var(--texte); }
.seg button[aria-pressed="true"] { background: rgba(255, 255, 255, .09); color: #fff; box-shadow: 0 1px 0 rgba(255, 255, 255, .08) inset, 0 6px 18px -10px rgba(0, 212, 200, .8); }

/* Interrupteur */
.interrupteur { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; color: var(--texte-2); font-weight: 500; }
.interrupteur input { position: absolute; opacity: 0; pointer-events: none; }
.interrupteur .rail { width: 44px; height: 26px; border-radius: 999px; background: rgba(255, 255, 255, .1); border: 1px solid var(--bord); position: relative; transition: background var(--t-moyen) var(--ease); flex: none; }
.interrupteur .rail::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform var(--t-moyen) var(--ressort); box-shadow: 0 2px 6px rgba(0, 0, 0, .4); }
.interrupteur input:checked + .rail { background: var(--grad); border-color: transparent; }
.interrupteur input:checked + .rail::after { transform: translateX(18px); }
.interrupteur input:focus-visible + .rail { box-shadow: 0 0 0 4px rgba(0, 212, 200, .25); }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 44px; padding: 10px 18px; border-radius: 14px; border: 1px solid var(--bord-fort); background: rgba(255, 255, 255, .05); color: var(--texte); font: 650 15px/1 var(--f-texte); cursor: pointer; text-decoration: none; transition: transform var(--t-court) var(--ease), background var(--t-court), border-color var(--t-court); }
.btn:hover { background: rgba(255, 255, 255, .09); }
.btn:active { transform: scale(.97); }
.btn.principal { border: 0; background: var(--grad); color: #fff; box-shadow: 0 14px 34px -14px rgba(45, 91, 255, .9); }
.btn.danger { color: #ffd6de; border-color: rgba(255, 92, 122, .45); background: rgba(255, 92, 122, .08); }
.btn.petit { min-height: 36px; padding: 8px 12px; font-size: 13.5px; border-radius: 11px; }
.btn-icone { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 12px; border: 1px solid var(--bord); background: rgba(255, 255, 255, .04); color: var(--texte-2); cursor: pointer; transition: background var(--t-court), color var(--t-court); }
.btn-icone:hover { color: var(--texte); background: rgba(255, 255, 255, .08); }

:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 8px; }
button { -webkit-tap-highlight-color: transparent; }

/* Bouton principal « Caler » avec états chargement et réussite */
.caler {
  position: relative; overflow: hidden; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  border: 0; border-radius: 18px; cursor: pointer;
  background: var(--grad); background-size: 180% 100%; color: #fff;
  font: 800 17px/1 var(--f-titre); letter-spacing: .01em;
  box-shadow: 0 18px 40px -16px rgba(45, 91, 255, .95), 0 0 0 1px rgba(255, 255, 255, .12) inset;
  transition: transform var(--t-court) var(--ease), box-shadow var(--t-moyen), background-position .8s var(--ease), filter var(--t-court);
}
.caler:hover { background-position: 100% 0; }
.caler:active { transform: scale(.97); }
.caler:disabled { filter: saturate(.4) brightness(.8); cursor: not-allowed; }
.caler::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .35) 50%, transparent 70%); transform: translateX(-120%); }
.caler:not(:disabled):hover::after { animation: reflet 1.1s var(--ease); }
@keyframes reflet { to { transform: translateX(120%); } }
.caler .rond { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid rgba(255, 255, 255, .35); border-top-color: #fff; display: none; animation: tourne .7s linear infinite; }
.caler .coche { width: 26px; height: 26px; display: none; stroke-width: 2.6; }
.caler .coche path { stroke-dasharray: 24; stroke-dashoffset: 24; }
.caler.attente .rond { display: block; }
.caler.attente .libelle { opacity: .85; }
.caler.reussi { background: linear-gradient(100deg, #1fb985, #2BD99A); box-shadow: 0 18px 44px -14px rgba(43, 217, 154, .9); }
.caler.reussi .coche { display: block; }
.caler.reussi .coche path { animation: trace .45s .05s var(--ease) forwards; }
.caler.reussi .rond { display: none; }
.caler.attention { background: linear-gradient(100deg, #E0902A, #FFB547 60%, #7B61FF); }
@keyframes tourne { to { transform: rotate(360deg); } }
@keyframes trace { to { stroke-dashoffset: 0; } }
.onde { position: absolute; left: 50%; top: 50%; width: 12px; height: 12px; margin: -6px; border-radius: 50%; background: rgba(255, 255, 255, .55); pointer-events: none; animation: onde .7s var(--ease) forwards; z-index: -1; }
@keyframes onde { to { transform: scale(40); opacity: 0; } }

/* Notifications à l'écran */
.toasts { position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 96px); display: grid; gap: 10px; width: min(560px, calc(100vw - 24px)); pointer-events: none; }
.toast { position: relative; overflow: hidden; pointer-events: auto; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 14px 14px 16px; border-radius: 18px; background: rgba(14, 22, 46, .94); border: 1px solid var(--bord-fort); box-shadow: 0 22px 50px -18px rgba(0, 0, 0, .85); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); animation: entree .38s var(--ressort); font-weight: 550; }
.toast.sortie { animation: sortie .25s var(--ease) forwards; }
.toast-txt { flex: 1 1 200px; }
.toast-pastille { width: 10px; height: 10px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 14px var(--cyan); flex: none; }
.toast-ok .toast-pastille { background: var(--ok); box-shadow: 0 0 14px var(--ok); }
.toast-erreur .toast-pastille { background: var(--danger); box-shadow: 0 0 14px var(--danger); }
.toast-attente .toast-pastille { background: var(--ambre); box-shadow: 0 0 14px var(--ambre); }
.toast-btn { min-height: 36px; padding: 8px 12px; border-radius: 11px; border: 1px solid var(--bord-fort); background: rgba(255, 255, 255, .05); color: var(--texte); font: 650 13.5px/1 var(--f-texte); cursor: pointer; font-variant-numeric: tabular-nums; }
.toast-btn.principal { background: var(--grad); border-color: transparent; }
.toast-temps { position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--grad); transform-origin: left; animation: temps var(--duree) linear forwards; opacity: .8; }
@keyframes entree { from { opacity: 0; transform: translateY(14px) scale(.97); } }
@keyframes sortie { to { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes temps { to { transform: scaleX(0); } }

/* Pavé de code */
.pave { display: grid; gap: 20px; justify-items: center; }
.pave-points { display: flex; gap: 12px; min-height: 18px; }
.pave-points i { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--bord-fort); transition: background var(--t-court), transform var(--t-court) var(--ressort), border-color var(--t-court); }
.pave-points i.plein { background: var(--grad); border-color: transparent; transform: scale(1.12); box-shadow: 0 0 12px rgba(0, 212, 200, .6); }
.pave-grille { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pave-touche { width: 76px; height: 76px; border-radius: 50%; border: 1px solid var(--bord); background: rgba(255, 255, 255, .04); color: var(--texte); font: 600 28px/1 var(--f-titre); cursor: pointer; display: grid; place-items: center; transition: background var(--t-court), transform var(--t-court) var(--ease); }
.pave-touche:active { background: rgba(0, 212, 200, .18); transform: scale(.94); }
.pave-touche.effacer { font-size: 22px; color: var(--texte-2); }
.pave-touche.valider { background: var(--grad); border: 0; }
.pave-touche.valider:disabled { opacity: .3; }
.pave-touche .ico { width: 30px; height: 30px; }
.pave-msg { min-height: 1.4em; margin: 0; color: var(--danger); font-weight: 600; text-align: center; }
.pave.faux .pave-points { animation: secoue .4s var(--ease); }
.pave.attente { opacity: .6; pointer-events: none; }
@keyframes secoue { 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }

/* Squelettes de chargement */
.squelette { border-radius: 14px; background: linear-gradient(90deg, rgba(255, 255, 255, .04) 0%, rgba(255, 255, 255, .09) 50%, rgba(255, 255, 255, .04) 100%); background-size: 200% 100%; animation: chatoie 1.3s linear infinite; }
@keyframes chatoie { to { background-position: -200% 0; } }

/* Apparition douce des blocs */
.apparait { animation: apparait .5s var(--ease) both; }
@keyframes apparait { from { opacity: 0; transform: translateY(10px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .fond .halo { animation: none; }
}

/* Page hors ligne */
.hors-ligne { min-height: 100dvh; display: grid; place-content: center; gap: 18px; padding: 24px; text-align: center; max-width: 520px; margin: 0 auto; }
.hors-ligne .sur { justify-content: center; }
.hors-ligne h1 { font-size: clamp(32px, 8vw, 48px); font-weight: 850; }
.hors-ligne .btn { justify-self: center; }
