@font-face {
  font-family: Geist;
  src: url("/fonts/geist.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: Bricolage;
  src: url("/fonts/bricolage-2.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
html { background: var(--base); }
:root {
  color-scheme: dark;
  --base: #15132d;
  --violet: #6741a0;
  --cyan: #226575;
  --ink: #faf7ff;
  --muted: #ded7ef;
  --glass: #211d3bb0;
  --edge: #fff6ff63;
  --glint: #f3ddff48;
  --reflection: #7de6f137;
  --shadow: #09071963;
  --control: #ede4ff19;
  --selected: #e4cdff3a;
  --focus: #a6f6ff;
  font-family: Geist, system-ui, sans-serif;
}
:root[data-theme="light"] {
  color-scheme: light;
  --base: #ece2f7;
  --violet: #c7a1ec;
  --cyan: #a0e1e9;
  --ink: #221735;
  --muted: #4c4061;
  --glass: #fffaffac;
  --edge: #fffefcda;
  --glint: #fffaffdf;
  --reflection: #9de9ef75;
  --shadow: #4b35603b;
  --control: #fbf4ff74;
  --selected: #d4b9f291;
  --focus: #523587;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 83% 75%, var(--cyan), transparent 54%),
    radial-gradient(ellipse at 19% 36%, var(--violet), transparent 60%),
    var(--base);
}
a { color: inherit; text-decoration: none; }
button { color: inherit; font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
.principal {
  isolation: isolate;
  background: var(--base);
}
.principal::before {
  content: "";
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 16% 24%, var(--violet) 0%, transparent 62%),
    radial-gradient(ellipse at 86% 72%, var(--cyan) 0%, transparent 65%);
  filter: blur(72px);
}
:root[data-theme="light"] .principal::before {
  background:
    radial-gradient(ellipse at 50% 6%, #fff8eb 0%, transparent 55%),
    radial-gradient(ellipse at 12% 34%, var(--violet) 0%, transparent 64%),
    radial-gradient(ellipse at 87% 68%, var(--cyan) 0%, transparent 65%);
}
h1, h2, h3, .brand strong, .clock-time { font-family: Bricolage, Geist, system-ui, sans-serif; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2rem, 4vw, 4.6rem); line-height: 1; letter-spacing: -.055em; overflow-wrap: anywhere; }
h2 { font-size: clamp(1.5rem, 2.4vw, 2.55rem); line-height: 1; letter-spacing: -.04em; }
p { line-height: 1.55; }
.brand, .welcome-controls, .actions, .panel-tools {
  display: flex;
  align-items: center;
  gap: .65rem;
  flex-wrap: wrap;
}
.brand img { width: 44px; height: 44px; }
.brand strong { font-size: 1.6rem; letter-spacing: -.06em; }
.brand span { font-size: .7rem; letter-spacing: .12em; }
.entry-brand { justify-content: center; }
.login .entry-brand { justify-content: flex-start; margin-bottom: 1.4rem; }
.chip, .login .primary, .panel-control {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-height: 44px;
  padding: .45rem .8rem;
  border: 1px solid var(--edge);
  border-radius: 12px;
  background: var(--control);
  font-size: .88rem;
}
.chip:hover, .panel-control:hover { background: var(--selected); }
.glass {
  border: 1px solid var(--edge);
  background: linear-gradient(145deg, var(--glint), transparent 35%, transparent 70%, var(--reflection)), var(--glass);
  box-shadow: inset 0 1px 1px var(--edge), 0 16px 32px var(--shadow);
}
.lockscreen { display: grid; place-items: center; min-height: 100vh; min-height: 100svh; padding: 24px; }
.lock-layout { width: min(100%, 29rem); }
.back { display: inline-flex; align-items: center; min-height: 44px; }
.back:hover { text-decoration: underline; }
.login-card { padding: clamp(20px, 5vw, 42px); border-radius: 30px; }
.login-card p { margin-top: .8rem; }
#form { display: grid; gap: .65rem; margin: 1.3rem 0; }
#form .input {
  min-width: 0;
  padding: .7rem;
  color: var(--ink);
  font: inherit;
  border: 1px solid var(--edge);
  border-radius: 10px;
  background: var(--control);
}
.login .primary { justify-content: space-between; background: var(--selected); }
.login .primary:hover { border-color: var(--ink); }
.muted { color: var(--muted); }
.dashboard { padding: clamp(14px, 3vw, 52px); }
.principal {
  --dock-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  --dock-height: 62px;
  --overview-gap: clamp(.75rem, 1.5vw, 1.5rem);
}
.principal .dashboard {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  gap: 1.2rem;
  padding-bottom: calc(var(--dock-bottom) + var(--dock-height) + 1rem);
}
#storage-notice:not(:empty) { padding: 0 clamp(14px, 3vw, 52px) 1rem; }
.welcome-controls {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--edge);
}
.welcome-controls .brand { margin-right: auto; }
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: var(--overview-gap);
}
.panel { min-width: 0; border-radius: 24px; padding: clamp(1rem, 2vw, 1.75rem); }
.panel > :is(h1, h2) { font-size: clamp(1.75rem, 3.2vw, 3rem); letter-spacing: -.045em; }
.panel-tools { gap: .3rem; margin: .75rem 0; }
.panel-control { padding-inline: .55rem; min-width: 44px; justify-content: center; }
.icon-control {
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  justify-content: center;
}
.icon-control .nav-icon { width: 1.375rem; height: 1.375rem; }
.clock { margin-top: .75rem; }
.clock-time { display: block; font-size: clamp(2.5rem, 5vw, 4.7rem); line-height: 1; font-variant-numeric: tabular-nums; }
.clock-date { display: block; margin-top: .35rem; }
.clock-date::first-letter { text-transform: uppercase; }
#health-body { display: grid; gap: .75rem; align-items: start; }
#health-refresh { justify-self: start; }
@media (min-width: 1200px) {
  #health-body { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); column-gap: 1rem; }
  #health-refresh { grid-column: 1 / -1; }
}
#health-refresh[aria-disabled="true"] { cursor: wait; opacity: .7; }
.health-source { width: 100%; border-top: 1px solid var(--edge); padding-top: .65rem; }
.health-source h3 { margin-bottom: .45rem; }
.health-source dl {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: .25rem .6rem;
  margin: 0 0 .5rem;
}
.health-source dt { overflow-wrap: anywhere; }
.health-source dd { margin: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.health-source time { font-variant-numeric: tabular-nums; }
.dock {
  position: fixed;
  inset-inline: 0;
  bottom: var(--dock-bottom);
  z-index: 4;
  display: flex;
  width: fit-content;
  max-width: calc(100% - 16px);
  margin-inline: auto;
  padding: .5rem;
  gap: .4rem;
  border-radius: 20px;
}
.nav-icon { width: 1.125rem; height: 1.125rem; flex: none; }
.dock .chip {
  min-width: 44px;
  justify-content: center;
  white-space: nowrap;
  font-size: .78rem;
}
.dock .nav-icon { width: 1.375rem; height: 1.375rem; }
.dock [aria-current], #space-modules [aria-current] {
  border-color: var(--focus);
  background: var(--selected);
}
@media (max-width: 640px) {
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Les surfaces reprennent les reflets de la maquette, les actions restent jaunes. */
:root { --focus: #ffd400; }
:root[data-theme="light"] { --focus: #6b5100; }
.glass { backdrop-filter: blur(18px) saturate(130%); }
.welcome:has(.settings[open]) { position: relative; z-index: 5; }
.settings { position: relative; }
.settings summary { cursor: pointer; list-style: none; }
.settings summary::-webkit-details-marker { display: none; }
.settings-content {
  display: grid;
  gap: .45rem;
  position: absolute;
  left: var(--settings-left, 0px);
  top: calc(100% + 8px);
  width: min(15rem, calc(100vw - 24px));
  max-height: var(--settings-height, none);
  overflow: auto;
  overscroll-behavior: contain;
  padding: .65rem;
  border-radius: 14px;
  background-color: var(--base);
}
.settings-content.above {
  top: auto;
  bottom: calc(100% + 8px);
}
#welcome-body { overflow-wrap: anywhere; }
#form .field { display: grid; gap: .3rem; }
#form .check { display: flex; align-items: center; min-height: 44px; gap: .45rem; }
#form .primary { color: #231d00; background: #ffd400; }
#form .err { overflow-wrap: anywhere; }
#form .err:empty { display: none; }
#form.shake { animation: login-shake 240ms ease-in-out; }
@keyframes login-shake { 25%, 75% { transform: translateX(-4px); } 50% { transform: translateX(4px); } }
.space-view {
  position: relative;
  overflow: clip;
  height: 100dvh;
  display: grid;
  grid-template-columns: clamp(220px, 19vw, 270px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: var(--overview-gap);
  padding: max(var(--overview-gap), env(safe-area-inset-top)) max(var(--overview-gap), env(safe-area-inset-right))
    calc(var(--dock-height) + var(--dock-bottom) + var(--overview-gap)) max(var(--overview-gap), env(safe-area-inset-left));
  background: var(--base);
}
.space-view.space-closing { position: fixed; inset: 0; z-index: 3; pointer-events: none; }
.space-sidebar {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  min-height: 0;
  padding: .85rem;
  border-radius: 14px;
  overflow: auto;
}
.space-sidebar h1 { font-size: clamp(1.25rem, 2vw, 1.6rem); line-height: 1.1; }
#space-toggle { display: none; }
#space-modules, .space-actions { display: grid; gap: .35rem; }
#space-modules .chip, .space-actions .chip { padding-inline: .65rem; }
.space-sidebar :focus-visible { outline-offset: -3px; }
.space-actions { margin-top: auto; padding-top: .65rem; border-top: 1px solid var(--edge); }
#space-content { min-width: 0; min-height: 0; }
#space-content .site-gateway { padding: clamp(16px, 4vw, 40px); }
#space-content iframe { display: block; width: 100%; height: 100%; border: 0; border-radius: 12px; }
@media (max-width: 640px) {
  .space-view {
    --overview-gap: .5rem;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, auto) minmax(0, 1fr);
  }
  .space-sidebar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: .4rem;
    max-height: 55dvh;
    padding: .5rem;
  }
  #space-toggle { display: inline-flex; }
  #space-modules {
    grid-column: 1 / -1;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr));
    max-height: 30dvh;
    overflow: auto;
    padding-block: .4rem;
    border-top: 1px solid var(--edge);
  }
  #space-toggle[aria-expanded="false"] + #space-modules { display: none; }
  .space-actions {
    display: flex;
    flex-wrap: wrap;
    grid-column: 1 / -1;
    margin: 0;
    padding-top: .4rem;
  }
  .space-actions .chip, #space-toggle { font-size: .78rem; padding-inline: .45rem; }
  .dock { gap: .25rem; padding: .35rem; }
  .dock .chip { width: 44px; height: 44px; padding: 0; }
  .dock .nav-label { display: none; }
}
/* Reflets ponctuels, sur des surfaces qui gardent leur géométrie finale. */
@media (prefers-reduced-motion: no-preference) {
  :root:not([data-motion="reduced"], [data-motion="none"]) .glass-passing::before,
  :root:not([data-motion="reduced"], [data-motion="none"]) .glass-passing::after {
    content: "";
    position: fixed;
    z-index: 10;
    pointer-events: none;
    left: var(--pass-x);
    top: var(--pass-y);
    width: var(--pass-size);
    aspect-ratio: 1;
    border-radius: 25%;
  }
  :root:not([data-motion="reduced"], [data-motion="none"]) .glass-passing::before {
    background: url("/overview/onyx.svg") center / contain no-repeat;
    animation: glass-mark 230ms ease-out both;
  }
  :root:not([data-motion="reduced"], [data-motion="none"]) .glass-passing::after {
    background: linear-gradient(128deg, transparent 36%, #fff8 49%, transparent 60%);
    box-shadow: 0 0 14px 2px var(--glint), inset 0 0 0 1px var(--edge);
    animation: glass-reflection 230ms ease-out both;
  }
  :root:not([data-motion="reduced"], [data-motion="none"])[data-glass-arrival] :is(.login-card, .dashboard-grid) {
    animation: glass-arrival 320ms cubic-bezier(.2, .7, .26, 1) both;
  }
  :root:not([data-motion="reduced"], [data-motion="none"])[data-glass-arrival] :is(.login .entry-brand, .welcome-controls .brand) img {
    animation: glass-y-reveal 360ms cubic-bezier(.18, .72, .3, 1) both;
  }
  :root:not([data-motion="reduced"], [data-motion="none"]) .space-refracting::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    box-shadow: inset 0 0 0 1px var(--edge), inset 0 0 28px var(--reflection);
    animation: glass-rim 240ms ease-out both;
  }
  :root:not([data-motion="reduced"], [data-motion="none"]) .settings[open] .settings-content {
    transform-origin: top right;
    animation: settings-arrival 135ms ease-out;
  }
  :root:not([data-motion="reduced"], [data-motion="none"]) .settings[open] .settings-content.above {
    transform-origin: bottom right;
  }
}
@keyframes glass-mark {
  0% { transform: translate(-50%, -50%) scale(.95); opacity: 0; }
  64% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
  100% { transform: translate(-50%, -50%); opacity: 1; }
}
@keyframes glass-reflection {
  0% { transform: translate(-50%, -50%) scale(.95); opacity: 0; }
  60% { opacity: .9; }
  100% { transform: translate(-50%, -50%) scale(1.23); opacity: 0; }
}
@keyframes glass-arrival {
  0% { opacity: .38; }
  100% { opacity: 1; }
}
@keyframes glass-y-reveal {
  0% { transform: scale(.55); opacity: .24; }
  58% { transform: scale(1.16); opacity: 1; }
  100% { transform: none; opacity: 1; }
}
@keyframes glass-rim {
  0% { opacity: .8; }
  100% { opacity: 0; }
}
@keyframes settings-arrival {
  from { transform: scale(.97); opacity: .65; }
}
@media (prefers-reduced-motion: reduce) {
  #form.shake { animation: none; }
}
:root:is([data-motion="reduced"], [data-motion="none"]) #form.shake { animation: none; }
