@font-face { font-family: Lato; font-style: normal; font-weight: 300; font-display: swap; src: url(fonts/lato-300.woff2) format("woff2"); }
@font-face { font-family: Lato; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/lato-400.woff2) format("woff2"); }
@font-face { font-family: Lato; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/lato-700.woff2) format("woff2"); }
@font-face { font-family: Lato; font-style: normal; font-weight: 900; font-display: swap; src: url(fonts/lato-900.woff2) format("woff2"); }
:root {
  color-scheme: light dark;
  --ink: #1B3B45;
  --ink-2: #3F5A64;
  --bg: #F5F8F9;
  --blue: #98C6D5;
  --green: #D4E3C1;
  --blue-deep: #2B6C7E;
  --green-deep: #6E8F52;
  --amber: #C98A3B;
  --grid: #CFDDE2;
  --glass: rgba(255, 255, 255, 0.70);
  --glass-strong: rgba(255, 255, 255, 0.78);
  --glass-border: rgba(255, 255, 255, 0.95);
  --glass-shadow: 0 10px 30px rgba(27, 59, 69, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  --chip: rgba(31, 90, 106, 0.14);
  --tab-h: 74px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #F5F8F9;
    --ink-2: #BCD0D7;
    --bg: #0F2229;
    --grid: rgba(255, 255, 255, 0.10);
    --glass: rgba(27, 59, 69, 0.50);
    --glass-strong: rgba(27, 59, 69, 0.78);
    --glass-border: rgba(255, 255, 255, 0.14);
    --glass-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.10);
    --chip: rgba(152, 198, 213, 0.16);
    --blue-deep: #98C6D5;
    --green-deep: #B9D39A;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Lato, "Century Gothic", Calibri, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  padding-top: var(--safe-top);
}
button { font: inherit; color: inherit; }
svg { display: block; }

/* Fond : taches de couleur floutées derrière le verre */
.blobs { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.blobs span { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.9; }
.blobs .b1 { width: 60vw; height: 60vw; background: #6FB3C8; top: -12vw; left: -18vw; }
.blobs .b2 { width: 48vw; height: 48vw; background: #A9CC87; top: 32vh; right: -20vw; }
.blobs .b3 { width: 55vw; height: 55vw; background: #6FB3C8; bottom: -20vw; left: 10vw; opacity: 0.7; }
@media (prefers-color-scheme: dark) {
  .blobs .b1, .blobs .b3 { background: #2B6C7E; opacity: 0.55; }
  .blobs .b2 { background: #3E5A2E; opacity: 0.5; }
}

/* En-tête */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px 10px;
  background: linear-gradient(var(--bg), rgba(245, 248, 249, 0));
}
@media (prefers-color-scheme: dark) { .top { background: linear-gradient(var(--bg), rgba(15, 34, 41, 0)); } }
.top-date { font-weight: 900; font-size: 22px; letter-spacing: -0.01em; }
.top-date::first-letter { text-transform: uppercase; }
.top-sync { font-size: 13px; color: var(--ink-2); }
.top-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--glass-border);
  background: var(--glass); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--glass-shadow); display: grid; place-items: center; cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.spin svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Contenu */
.view { position: relative; z-index: 1; padding: 4px 16px calc(var(--tab-h) + var(--safe-bottom) + 24px); max-width: 640px; margin: 0 auto; }
.glass {
  background: var(--glass); border: 1px solid var(--glass-border);
  backdrop-filter: blur(22px) saturate(1.2); -webkit-backdrop-filter: blur(22px) saturate(1.2);
  box-shadow: var(--glass-shadow); border-radius: 24px; padding: 18px 18px 16px; margin-bottom: 14px;
}
.glass h2 { margin: 0 0 10px; font-size: 15px; font-weight: 700; color: var(--ink-2); }
.glass h2 small { font-weight: 400; margin-left: 6px; }

/* Héros : récupération */
.hero { display: grid; grid-template-columns: 124px 1fr; gap: 16px; align-items: center; }
.orb { width: 124px; height: 124px; }
.gauge { width: 124px; height: 124px; overflow: visible; }
.gauge-word { font-family: inherit; font-weight: 900; font-size: 17px; }
.gauge-sub { font-family: inherit; font-size: 10px; fill: var(--ink-2); }
.hero-title { font-size: 24px; font-weight: 900; line-height: 1.1; margin: 0 0 6px; }
.hero-sub { color: var(--ink-2); font-size: 14px; margin: 0; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { background: var(--chip); border-radius: 999px; padding: 5px 10px; font-size: 13px; white-space: nowrap; }
.chip b { font-weight: 700; }

/* Grille de tuiles */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.tile { padding: 14px 16px; border-radius: 20px; margin: 0; }
.tile .k { font-size: 13px; color: var(--ink-2); }
.tile .v { font-size: 26px; font-weight: 900; line-height: 1.15; margin-top: 2px; }
.tile .v small { font-size: 14px; font-weight: 400; color: var(--ink-2); margin-left: 3px; }
.tile .d { font-size: 12px; color: var(--ink-2); margin-top: 4px; }

/* Listes */
.row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--grid); }
.row:first-of-type { border-top: 0; }
.row .ico { width: 40px; height: 40px; border-radius: 14px; background: var(--chip); display: grid; place-items: center; flex: none; }
.row .ico svg { width: 20px; height: 20px; fill: none; stroke: var(--blue-deep); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.row .main { flex: 1; min-width: 0; }
.row .t { font-weight: 700; }
.row .s { font-size: 13px; color: var(--ink-2); }
.row .r { text-align: right; font-weight: 700; white-space: nowrap; }
.row .r small { display: block; font-size: 12px; font-weight: 400; color: var(--ink-2); }
.row.clickable { cursor: pointer; }

/* Détail séance */
.zones { display: flex; height: 12px; border-radius: 999px; overflow: hidden; margin: 10px 0 6px; background: var(--grid); }
.zones span { display: block; height: 100%; }
.zone-legend { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-2); }
.z1 { background: #BFDCE6; } .z2 { background: #5FA3B9; } .z3 { background: #4C7A2E; } .z4 { background: #1F5A6A; } .z5 { background: #1B3B45; }
@media (prefers-color-scheme: dark) { .z5 { background: #F5F8F9; } }
.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.kv > div { background: var(--chip); border-radius: 14px; padding: 8px 10px; }
.kv .k { font-size: 11px; color: var(--ink-2); }
.kv .v { font-weight: 900; font-size: 17px; }

/* Graphiques SVG */
.chart { width: 100%; height: auto; overflow: visible; }
.chart text { font-family: inherit; fill: var(--ink-2); font-size: 11px; }
.chart .axis { stroke: var(--grid); stroke-width: 1; }
.chart .lbl-strong { fill: var(--ink); font-weight: 700; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* États */
.empty { text-align: center; padding: 36px 18px; }
.empty h3 { margin: 0 0 8px; font-size: 20px; font-weight: 900; }
.empty p { color: var(--ink-2); margin: 0 0 16px; }
.warn { font-size: 13px; color: var(--amber); margin-top: 8px; }
.seg { display: flex; background: var(--chip); border-radius: 14px; padding: 3px; margin-bottom: 14px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 11px; color: var(--ink-2); cursor: pointer; }
.seg button.on { background: var(--glass-strong); color: var(--ink); font-weight: 700; box-shadow: 0 2px 8px rgba(27,59,69,0.10); }

/* Barre d'onglets */
.tabbar {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--safe-bottom) + 10px); z-index: 6;
  height: var(--tab-h); border-radius: 28px; display: flex;
  background: var(--glass-strong); border: 1px solid var(--glass-border);
  backdrop-filter: blur(24px) saturate(1.3); -webkit-backdrop-filter: blur(24px) saturate(1.3);
  box-shadow: var(--glass-shadow); max-width: 616px; margin: 0 auto;
}
.tab { flex: 1; border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--ink-2); font-size: 11px; cursor: pointer; border-radius: 24px; }
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tab.is-active { color: var(--blue-deep); font-weight: 900; }
.tab:focus-visible, .icon-btn:focus-visible, .btn:focus-visible { outline: 2px solid var(--blue-deep); outline-offset: 2px; }

/* Panneau réglages */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(27,59,69,0.35); z-index: 20; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; padding: 10px 20px calc(var(--safe-bottom) + 20px);
  background: var(--glass-strong); border-top: 1px solid var(--glass-border); border-radius: 28px 28px 0 0;
  backdrop-filter: blur(28px); -webkit-backdrop-filter: blur(28px); max-width: 640px; margin: 0 auto;
}
.sheet-handle { width: 40px; height: 5px; border-radius: 3px; background: var(--grid); margin: 0 auto 14px; }
.sheet h2 { margin: 0 0 12px; font-size: 20px; font-weight: 900; }
.field span { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.field input { width: 100%; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--glass-border); background: var(--glass); color: var(--ink); font: inherit; }
.sheet-status { font-size: 14px; margin: 12px 0; }
.sheet-actions { display: grid; gap: 8px; }
.btn { border: 1px solid var(--glass-border); background: var(--glass); padding: 12px 16px; border-radius: 16px; cursor: pointer; font-weight: 700; }
.btn.primary { background: #2B6C7E; color: #fff; border-color: #2B6C7E; }
.btn[disabled] { opacity: 0.5; cursor: default; }
.sheet-note { font-size: 12px; color: var(--ink-2); margin: 14px 0 0; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab-h) + var(--safe-bottom) + 24px); z-index: 30; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 14px; max-width: 90vw; }

@media (prefers-reduced-motion: reduce) { .icon-btn.spin svg { animation: none; } }

/* v2 */
.mt { margin-top: 16px; }
.btn.back { margin-bottom: 12px; }
.overlay { position: relative; }
.overlay .chart + .chart { position: absolute; inset: 0; }
.reco p { margin: 0 0 8px; font-size: 15px; line-height: 1.45; }
.reco p b { color: var(--blue-deep); }
.reco-note { font-size: 12px !important; color: var(--ink-2); margin-top: 6px !important; }
.tile.clickable { cursor: pointer; }
