/* ==========================================================================
   Centre dentaire Nacre — socle commun (site, appli patient, salle, accueil)
   Projet concept Démesure. Lagon, nacre, perle et sable ; corail pour « c’est à vous ».
   ========================================================================== */

:root {
  --lagoon: #0f6e7a;
  --lagoon-2: #138794;
  --lagoon-d: #0c3b44;
  --lagoon-dd: #08262d;
  --mint: #8fd3c1;
  --mint-soft: #dcf1ea;
  --pearl: #f7f5f2;
  --paper: #fffefb;
  --sand: #efe7dc;
  --sand-2: #e6dccd;
  --line: #e2dbcf;
  --ink: #0f1d24;
  --ink-2: #43545b;
  --ink-3: #7b898e;
  --coral: #e2574c;
  --coral-d: #c4443a;
  --coral-soft: #fbe2de;
  --amber: #e0a53a;
  --amber-soft: #f8ebd2;
  --amber-ink: #8a5b06;
  --ok: #2f9b74;
  --ok-soft: #d9efe5;

  --display: "Bricolage Grotesque", "Manrope", system-ui, sans-serif;
  --text: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --nacre: linear-gradient(118deg, #ffffff 0%, #eef8f5 26%, #f8f1e8 48%, #e9f3f8 70%, #ffffff 100%);
  --nacre-dark: linear-gradient(125deg, #0c3b44 0%, #0f5560 45%, #0c3b44 100%);
  --r: 18px;
  --r-sm: 11px;
  --shadow: 0 1px 0 rgba(15, 29, 36, .04), 0 14px 34px -22px rgba(15, 29, 36, .38);
  --shadow-lg: 0 30px 70px -36px rgba(12, 59, 68, .55), 0 10px 24px -18px rgba(15, 29, 36, .3);
  --ease: cubic-bezier(.16, 1, .3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overflow-x: clip; }
body { margin: 0; background: var(--pearl); color: var(--ink); font-family: var(--text); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
h1, h2, h3, h4 { margin: 0; font-family: var(--display); font-weight: 750; font-stretch: 80%; letter-spacing: -.025em; line-height: 1; text-wrap: balance; }
p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--lagoon); outline-offset: 2px; }
svg use { pointer-events: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Logo : un coquillage de nacre dessiné en dent ------------------------------ */
.nlogo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.nlogo svg { width: 36px; height: 36px; flex: none; }
.nlogo__w { display: flex; flex-direction: column; line-height: 1; }
.nlogo__w b { font-family: var(--display); font-weight: 800; font-stretch: 78%; font-size: 26px; letter-spacing: -.045em; }
.nlogo__w small { margin-top: 3px; font-family: var(--mono); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }

/* ---------- Bandeau « projet concept » (couche Démesure) ------------------------------- */
.demo-bar { position: relative; z-index: 60; display: flex; align-items: center; justify-content: space-between; gap: 4px 16px; min-height: 34px; padding: 7px 16px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); background: #071a1f; color: rgba(247, 245, 242, .68); font-size: 12.5px; line-height: 1.35; }
.demo-bar b { color: #fff; font-weight: 600; }
.demo-bar a { padding: 12px 0; margin: -12px 0; color: var(--mint); text-underline-offset: 3px; }
.demo-bar > span:first-child { flex: 1; min-width: 0; }
.demo-bar__links { display: flex; flex-wrap: wrap; gap: 2px 16px; }
.demo-bar__short { display: none; }
@media (max-width: 960px) {
  .demo-bar { flex-wrap: nowrap; white-space: nowrap; }
  .demo-bar > span:first-child { overflow: hidden; text-overflow: ellipsis; }
  .demo-bar__long { display: none; }
  .demo-bar__short { display: inline; }
  .demo-bar__links { flex-wrap: nowrap; }
}

/* ---------- Boutons -------------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font-weight: 700; font-size: 14.5px; letter-spacing: -.005em; text-decoration: none; white-space: nowrap; transition: background-color .2s, border-color .2s, color .2s, transform .25s var(--ease), box-shadow .25s; }
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: scale(.97); }
.btn--lagoon { background: var(--lagoon); border-color: var(--lagoon); color: #fff; box-shadow: 0 10px 24px -14px rgba(15, 110, 122, .9); }
.btn--lagoon:hover { background: var(--lagoon-d); border-color: var(--lagoon-d); }
.btn--coral { background: var(--coral); border-color: var(--coral); color: #fff; }
.btn--coral:hover { background: var(--coral-d); border-color: var(--coral-d); }
.btn--ink { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn--mint { background: var(--mint); border-color: var(--mint); color: var(--lagoon-dd); }
.btn--ghost { background: transparent; }
.btn--sm { min-height: 36px; padding: 0 14px; font-size: 13px; }
.btn--lg { min-height: 54px; padding: 0 24px; font-size: 16px; }
.btn--block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: default; transform: none; }
.btn .i { width: 18px; height: 18px; }

/* ---------- Pastilles d'état ------------------------------------------------------------- */
.tag { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; background: var(--sand); color: var(--ink-2); font-size: 12px; font-weight: 700; white-space: nowrap; }
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.tag--ok { background: var(--ok-soft); color: var(--ok); }
.tag--late { background: var(--coral-soft); color: var(--coral-d); }
.tag--warn { background: var(--amber-soft); color: var(--amber-ink); }
.tag--info { background: var(--mint-soft); color: var(--lagoon); }
.tag--plain::before { display: none; }

/* Segmenté (DA | €, filtres) */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; background: var(--sand); }
.seg button { min-width: 40px; height: 32px; padding: 0 11px; border: 0; border-radius: 999px; background: transparent; color: var(--ink-2); font-size: 13px; font-weight: 700; }
.seg button[aria-pressed="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 2px 6px -2px rgba(15, 29, 36, .25); }

/* Cartes */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card--nacre { background: var(--nacre); }

/* Badge à initiales (praticiens : jamais de portrait) */
.av { --c: var(--lagoon); display: inline-grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 14px; background: color-mix(in srgb, var(--c) 14%, #fff); color: var(--c); font-family: var(--display); font-weight: 800; font-stretch: 80%; font-size: 15px; letter-spacing: -.02em; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 30%, transparent); }
.av--round { border-radius: 50%; }

/* Champs */
.field { display: grid; gap: 6px; min-width: 0; }
.field label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.input { width: 100%; min-width: 0; height: 50px; padding: 0 15px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); font-size: 16px; transition: border-color .2s, box-shadow .2s; }
.input:focus { outline: none; border-color: var(--lagoon); box-shadow: 0 0 0 4px rgba(15, 110, 122, .12); }
.input::placeholder { color: #a7b0b2; }

/* Toasts */
.toast-stack { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast { display: flex; gap: 10px; align-items: flex-start; max-width: min(380px, calc(100vw - 32px)); padding: 12px 14px; border-radius: 14px; background: var(--ink); color: #fff; box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .5); font-size: 14px; line-height: 1.35; pointer-events: auto; clip-path: inset(-60px round 14px); animation: toast-in .45s var(--ease); }
.toast b { display: block; margin-bottom: 2px; }
.toast small { color: rgba(255, 255, 255, .65); }
.toast__dot { flex: none; width: 10px; height: 10px; margin-top: 4px; border-radius: 50%; background: var(--mint); }
.toast--alert .toast__dot { background: var(--coral); }
/* Toujours opaque : la carte monte et se dévoile par le bas, sans fondu, le texte dessous ne transparaît jamais */
.toast.is-out { clip-path: inset(100% -60px -60px round 14px); transform: translateY(10px); transition: clip-path .3s var(--ease), transform .3s var(--ease); }
@keyframes toast-in { from { clip-path: inset(100% -60px -60px round 14px); transform: translateY(16px); } }

/* Point « en direct » */
.live-dot { position: relative; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.live-dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--ok); opacity: 0; animation: live-ring 2s ease-out infinite; }
@keyframes live-ring { 0% { transform: scale(.5); opacity: .7; } 100% { transform: scale(1.6); opacity: 0; } }

/* Ce qui vient d'arriver */
.is-new { animation: flash 2.4s var(--ease); }
@keyframes flash { 0%, 30% { background-color: rgba(143, 211, 193, .45); } 100% { background-color: transparent; } }

/* Reflet nacré qui passe sur une carte */
.sheen { position: relative; overflow: hidden; isolation: isolate; }
.sheen::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, .55) 45%, rgba(214, 238, 247, .35) 52%, transparent 66%); transform: translateX(-100%); animation: sheen 7s var(--ease) infinite; pointer-events: none; }
@keyframes sheen { 0%, 55% { transform: translateX(-100%); } 85%, 100% { transform: translateX(100%); } }

/* ---------- Anneaux de la file (motif : 3 → 2 → 1 → à vous) ------------------------------ */
.rings { position: relative; display: grid; place-items: center; aspect-ratio: 1; }
.rings__c { position: absolute; inset: 0; margin: auto; border-radius: 50%; border: 1.5px solid rgba(15, 110, 122, .16); transition: transform .9s var(--ease), opacity .9s, border-color .6s, background-color .6s; }
.rings__c:nth-child(1) { width: 100%; height: 100%; }
.rings__c:nth-child(2) { width: 82%; height: 82%; }
.rings__c:nth-child(3) { width: 64%; height: 64%; }
.rings__c:nth-child(4) { width: 46%; height: 46%; }
.rings__c.is-on { border-color: var(--lagoon); background: rgba(143, 211, 193, .08); }
.rings__c.is-gone { transform: scale(.7); opacity: 0; }

/* ---------- Schéma dentaire (archSVG de data.js) ------------------------------------------- */
.arch { width: 100%; height: auto; overflow: visible; touch-action: manipulation; }
.arch__guide path, .arch__guide line { fill: none; stroke: rgba(15, 110, 122, .14); stroke-width: 1.2; stroke-dasharray: 3 5; }
.arch__side { font: 600 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; fill: var(--ink-3); }
.arch__num { font: 500 10.5px var(--mono); fill: var(--ink-3); transition: fill .2s; }
.arch__num.is-on { fill: var(--ink); font-weight: 700; }
.tooth { cursor: pointer; outline: none; }
.tooth__shape { fill: #fff; stroke: #b9c7c9; stroke-width: 1.4; transition: fill .25s, stroke .25s, transform .3s var(--ease); transform-box: fill-box; transform-origin: center; }
.tooth:hover .tooth__shape { stroke: var(--lagoon); fill: #f1faf7; }
.tooth:focus-visible .tooth__shape { stroke: var(--lagoon); stroke-width: 2.4; }
.tooth.is-filled .tooth__shape { fill: var(--fill); stroke: color-mix(in srgb, var(--fill) 70%, #000); }
.tooth.is-selected .tooth__shape { stroke: var(--ink); stroke-width: 2.4; transform: scale(1.12); }
.tooth.is-pop .tooth__shape { animation: tooth-pop .45s var(--ease); }
.tooth__mark { font: 700 10px var(--mono); fill: #fff; pointer-events: none; }
.arch--static .tooth { cursor: default; }
.arch--static .tooth:hover .tooth__shape { stroke: #b9c7c9; fill: #fff; }
.arch--static .tooth.is-filled:hover .tooth__shape { fill: var(--fill); stroke: color-mix(in srgb, var(--fill) 70%, #000); }
@keyframes tooth-pop { 0% { transform: scale(1); } 40% { transform: scale(1.3); } 100% { transform: scale(1); } }

/* Pastille de couleur d'acte */
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 4px; background: var(--c, var(--lagoon)); flex: none; }

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