/* ═══════════════════════════════════════════════════════════════
   Orbit — charte commune (v3, nov. 2026)
   Chargée EN DERNIER dans chaque page : elle remplace les couleurs et polices propres à chaque page
   par une palette unique, sobre, claire ou sombre. Les sélecteurs :root:root:root l'emportent
   sur ceux des pages sans toucher à leur code.
   Thème : attribut data-theme="light|dark" (choix enregistré) ; sans choix, celui du téléphone.
   ═══════════════════════════════════════════════════════════════ */

/* ---------- Palette claire ---------- */
:root:root:root {
  color-scheme: light;
  /* fond et surfaces */
  --bg: #f6f6f4; --surface: #ffffff; --surface2: #f1f1ee; --surface3: #e8e8e4;
  --border: rgba(20, 20, 24, .08); --border2: rgba(20, 20, 24, .13); --border3: rgba(20, 20, 24, .22);
  /* texte */
  --text: #17171a; --text2: #5c5c66; --text3: #95959f;
  /* accent unique (violet du logo) */
  --acc: #5b4fd6; --acc-bg: #efedfd; --acc-border: #cdc7f6; --acc-fg: #ffffff;
  /* couleurs de sens, adoucies */
  --teal: #0f6e56; --teal-bg: #e3f4ed; --teal-border: #a9dcc8;
  --amber: #8a5a10; --amber-bg: #fbf0dd; --amber-border: #f0cf95;
  --purple: #5b4fd6; --purple-bg: #efedfd; --purple-border: #cdc7f6;
  --blue: #1d5fa3; --blue-bg: #e7f0fa; --blue-border: #b9d3ef;
  --green: #2f6f22; --green-bg: #e9f3e1; --green-border: #c2dda6;
  --red: #b0322f; --red-bg: #fbeceb; --red-border: #f0c3c1;
  --coral: #9c4222; --coral-bg: #fbeee8; --coral-border: #f0c8b6;
  --rose: #9a2f63; --rose-bg: #fbebf3; --rose-border: #efc1d8;
  /* ombres et rayons */
  --shadow-sm: 0 1px 2px rgba(20, 20, 24, .05);
  --shadow: 0 1px 2px rgba(20, 20, 24, .04), 0 4px 14px -6px rgba(20, 20, 24, .10);
  --shadow-lg: 0 2px 4px rgba(20, 20, 24, .04), 0 20px 40px -18px rgba(20, 20, 24, .22);
  --radius: 12px;
  /* polices du système : nettes, rapides, rien à télécharger */
  --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-head: var(--font-body);
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;

  /* correspondances pour les pages Entretien / Routines */
  --accent: var(--acc); --accent2: var(--teal); --danger: var(--red); --warn: var(--amber);
  --muted: var(--text3); --card: var(--surface);
  /* correspondances pour la page Santé */
  --fg: var(--text); --line: var(--border2); --ok: var(--green);
  --pine: var(--teal); --pine-soft: var(--teal-bg); --steel: var(--blue); --steel-soft: var(--blue-bg);
  --amber-soft: var(--amber-bg); --f-body: var(--font-body); --f-display: var(--font-body);
  /* correspondances pour la page Famille */
  --accent-bg: var(--acc-bg); --accent-border: var(--acc-border);
  /* barre mobile et indicateur (orbit.js) */
  --o-acc: var(--acc); --o-fg: var(--text); --o-mut: var(--text3); --o-line: var(--border2);
  --o-ok: var(--green); --o-err: var(--red);
}

/* ---------- Palette sombre ---------- */
:root:root:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1015; --surface: #15181f; --surface2: #1c2029; --surface3: #252a35;
  --border: rgba(255, 255, 255, .07); --border2: rgba(255, 255, 255, .12); --border3: rgba(255, 255, 255, .2);
  --text: #ececf1; --text2: #a3a6b4; --text3: #6c7082;
  --acc: #9d8cff; --acc-bg: rgba(157, 140, 255, .12); --acc-border: rgba(157, 140, 255, .32); --acc-fg: #0e1015;
  --teal: #5fd3a8; --teal-bg: rgba(95, 211, 168, .10); --teal-border: rgba(95, 211, 168, .28);
  --amber: #f3c47a; --amber-bg: rgba(243, 196, 122, .10); --amber-border: rgba(243, 196, 122, .28);
  --purple: #9d8cff; --purple-bg: rgba(157, 140, 255, .12); --purple-border: rgba(157, 140, 255, .32);
  --blue: #6fb0ff; --blue-bg: rgba(111, 176, 255, .10); --blue-border: rgba(111, 176, 255, .28);
  --green: #7bd88f; --green-bg: rgba(123, 216, 143, .10); --green-border: rgba(123, 216, 143, .28);
  --red: #f19a97; --red-bg: rgba(241, 154, 151, .10); --red-border: rgba(241, 154, 151, .28);
  --coral: #f2a283; --coral-bg: rgba(242, 162, 131, .10); --coral-border: rgba(242, 162, 131, .28);
  --rose: #f29cc6; --rose-bg: rgba(242, 156, 198, .10); --rose-border: rgba(242, 156, 198, .28);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 6px 18px -8px rgba(0, 0, 0, .5);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, .3), 0 24px 48px -20px rgba(0, 0, 0, .7);
}
@media (prefers-color-scheme: dark) {
  :root:root:root:not([data-theme]) {
    color-scheme: dark;
    --bg: #0e1015; --surface: #15181f; --surface2: #1c2029; --surface3: #252a35;
    --border: rgba(255, 255, 255, .07); --border2: rgba(255, 255, 255, .12); --border3: rgba(255, 255, 255, .2);
    --text: #ececf1; --text2: #a3a6b4; --text3: #6c7082;
    --acc: #9d8cff; --acc-bg: rgba(157, 140, 255, .12); --acc-border: rgba(157, 140, 255, .32); --acc-fg: #0e1015;
    --teal: #5fd3a8; --teal-bg: rgba(95, 211, 168, .10); --teal-border: rgba(95, 211, 168, .28);
    --amber: #f3c47a; --amber-bg: rgba(243, 196, 122, .10); --amber-border: rgba(243, 196, 122, .28);
    --purple: #9d8cff; --purple-bg: rgba(157, 140, 255, .12); --purple-border: rgba(157, 140, 255, .32);
    --blue: #6fb0ff; --blue-bg: rgba(111, 176, 255, .10); --blue-border: rgba(111, 176, 255, .28);
    --green: #7bd88f; --green-bg: rgba(123, 216, 143, .10); --green-border: rgba(123, 216, 143, .28);
    --red: #f19a97; --red-bg: rgba(241, 154, 151, .10); --red-border: rgba(241, 154, 151, .28);
    --coral: #f2a283; --coral-bg: rgba(242, 162, 131, .10); --coral-border: rgba(242, 162, 131, .28);
    --rose: #f29cc6; --rose-bg: rgba(242, 156, 198, .10); --rose-border: rgba(242, 156, 198, .28);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 6px 18px -8px rgba(0, 0, 0, .5);
    --shadow-lg: 0 2px 6px rgba(0, 0, 0, .3), 0 24px 48px -20px rgba(0, 0, 0, .7);
  }
}

/* ---------- Base commune ---------- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font-family: inherit; }
input, select, textarea { color: var(--text); }
::selection { background: var(--acc-bg); color: var(--text); }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-radius: 6px; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline-offset: 0; }
input[type="checkbox"], input[type="radio"], progress { accent-color: var(--acc); }
a { color: inherit; }
* { scrollbar-width: thin; scrollbar-color: var(--border3) transparent; }

/* En-têtes collants : verre dépoli discret */
.header { background: color-mix(in srgb, var(--surface) 86%, transparent) !important;
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px); }

/* Barres de progression : fines et arrondies */
.prog-track, .progress-wrap { background: var(--surface3) !important; }

/* ---------- Composants réutilisables (page de connexion, nouvelles pages) ---------- */
.o-input {
  appearance: none; display: block; width: 100%; padding: 11px 13px; font-size: 16px; line-height: 1.3;
  background: var(--bg); color: var(--text); border: 1px solid var(--border2); border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
}
.o-input:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-bg); }
.o-btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 16px; font-size: 15px; font-weight: 600; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border2); background: var(--surface); color: var(--text); transition: background .15s, transform .05s;
}
.o-btn:hover { background: var(--surface2); }
.o-btn:active { transform: translateY(1px); }
.o-btn-primary { background: var(--acc); border-color: var(--acc); color: var(--acc-fg); }
.o-btn-primary:hover { background: color-mix(in srgb, var(--acc) 88%, #000); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
