/* ————————————————————————————————————————————————
   Lyra — Liquid Glass design system
   Verre translucide multi-couches, reflets spéculaires, réfraction (Chromium),
   fond aurore animé. Thèmes sombre/clair, responsive mobile → desktop.
   ———————————————————————————————————————————————— */
:root {
  --font: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --bg: #06060b;
  --ink: #f4f4fb;
  --ink-2: rgba(236, 236, 250, .72);
  --ink-3: rgba(226, 226, 245, .46);
  --line: rgba(255, 255, 255, .09);
  --line-2: rgba(255, 255, 255, .16);

  --glass: rgba(255, 255, 255, .055);
  --glass-2: rgba(255, 255, 255, .085);
  --glass-strong: rgba(22, 22, 36, .55);
  --glass-hi: rgba(255, 255, 255, .22);
  --glass-shadow: 0 1px 0 0 rgba(255,255,255,.10) inset, 0 -1px 0 0 rgba(255,255,255,.03) inset, 0 24px 60px -20px rgba(0,0,0,.65), 0 2px 8px -2px rgba(0,0,0,.4);
  --blur: blur(28px) saturate(175%);

  --violet: #8b7bff; --cyan: #4fd8ff; --pink: #ff7ac8; --teal: #36e2b4; --amber: #ffb84d; --blue: #5b8cff; --green: #5ee38a; --red: #ff6b7d;
  --accent: var(--violet);
  --iris: linear-gradient(120deg, #a594ff 0%, #6fd6ff 45%, #ff9ad5 100%);
  --aurora-1: #5b3dff; --aurora-2: #00b3ff; --aurora-3: #ff4fb0; --aurora-4: #00d6a1;

  --r-sm: 12px; --r: 20px; --r-lg: 28px; --r-xl: 36px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #eef0f7;
  --ink: #12121c;
  --ink-2: rgba(22, 22, 40, .70);
  --ink-3: rgba(22, 22, 40, .46);
  --line: rgba(20, 20, 50, .08);
  --line-2: rgba(20, 20, 50, .14);
  --glass: rgba(255, 255, 255, .48);
  --glass-2: rgba(255, 255, 255, .62);
  --glass-strong: rgba(255, 255, 255, .72);
  --glass-hi: rgba(255, 255, 255, .95);
  --glass-shadow: 0 1px 0 0 rgba(255,255,255,.9) inset, 0 -1px 0 0 rgba(255,255,255,.4) inset, 0 24px 50px -24px rgba(40,40,90,.28), 0 2px 6px -2px rgba(40,40,90,.12);
  --aurora-1: #9c8cff; --aurora-2: #7fd8ff; --aurora-3: #ffb3dd; --aurora-4: #8ff0d3;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--ink);
  font: 450 15px/1.5 var(--font); letter-spacing: -.005em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: color-mix(in srgb, var(--violet) 45%, transparent); }
.mono { font-family: var(--mono); font-feature-settings: 'tnum'; }
.muted { color: var(--ink-2); } .faint { color: var(--ink-3); }
.hidden { display: none !important; }

/* ——— Fond aurore ——— */
.aurora { position: fixed; inset: 0; z-index: -2; overflow: hidden; pointer-events: none; }
.aurora i {
  position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%;
  filter: blur(90px); opacity: .55; mix-blend-mode: screen; will-change: transform;
  animation: drift 28s var(--ease) infinite alternate;
}
:root[data-theme="light"] .aurora i { mix-blend-mode: multiply; opacity: .45; }
.aurora i:nth-child(1) { background: var(--aurora-1); top: -25vmax; left: -15vmax; }
.aurora i:nth-child(2) { background: var(--aurora-2); top: 10vmax; right: -25vmax; animation-duration: 34s; animation-delay: -8s; }
.aurora i:nth-child(3) { background: var(--aurora-3); bottom: -30vmax; left: 20vmax; animation-duration: 40s; animation-delay: -16s; opacity: .35; }
.aurora i:nth-child(4) { background: var(--aurora-4); bottom: -20vmax; right: 10vmax; width: 40vmax; height: 40vmax; animation-duration: 30s; opacity: .25; }
@keyframes drift {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(6vmax, 4vmax, 0) scale(1.12); }
  100% { transform: translate3d(-4vmax, 8vmax, 0) scale(.94); }
}
.grain {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.vignette { position: fixed; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(120% 80% at 50% 0%, transparent 40%, color-mix(in srgb, var(--bg) 80%, transparent) 100%); }

/* ——— Verre liquide ——— */
.glass {
  position: relative; isolation: isolate;
  background: linear-gradient(160deg, var(--glass-2), var(--glass) 60%);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border-radius: var(--r-lg);
  box-shadow: var(--glass-shadow);
}
/* Bordure dégradée (lumière rasante en haut à gauche). */
.glass::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none; z-index: 1;
  background: linear-gradient(150deg, var(--glass-hi), rgba(255,255,255,.04) 35%, rgba(255,255,255,.02) 65%, rgba(255,255,255,.14));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
}
/* Reflet spéculaire. */
.glass::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1;
  background: radial-gradient(120% 60% at 15% -10%, rgba(255,255,255,.14), transparent 55%);
}
:root[data-theme="light"] .glass::after { background: radial-gradient(120% 60% at 15% -10%, rgba(255,255,255,.7), transparent 55%); }
.glass.strong { background: var(--glass-strong); }
/* Réfraction réelle (Chromium) — amélioration progressive. */
@supports (backdrop-filter: url(#x)) {
  .refract { backdrop-filter: url(#liquid) var(--blur); }
}
.glass.interactive { transition: transform .5s var(--spring), box-shadow .4s var(--ease), background .3s; }
.glass.interactive:hover { transform: translateY(-2px); background: linear-gradient(160deg, color-mix(in srgb, var(--glass-2) 140%, transparent), var(--glass-2)); }

/* ——— Boutons ——— */
.btn {
  --b: var(--glass-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px;
  border: 0; border-radius: 999px; cursor: pointer; white-space: nowrap; font-weight: 550; font-size: 14px;
  background: var(--b); color: var(--ink); position: relative; isolation: isolate;
  box-shadow: 0 1px 0 rgba(255,255,255,.14) inset, 0 0 0 1px var(--line-2) inset, 0 6px 18px -8px rgba(0,0,0,.5);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  transition: transform .35s var(--spring), background .25s, box-shadow .25s, opacity .2s;
}
.btn:hover { background: color-mix(in srgb, var(--b) 100%, rgba(255,255,255,.08)); transform: translateY(-1px); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn svg { width: 18px; height: 18px; }
.btn.primary {
  color: #0b0b14; background: var(--iris); background-size: 160% 100%;
  box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 10px 30px -10px color-mix(in srgb, var(--violet) 80%, transparent);
  animation: iris 8s ease-in-out infinite alternate;
}
@keyframes iris { to { background-position: 100% 0; } }
.btn.ghost { background: transparent; box-shadow: none; backdrop-filter: none; }
.btn.ghost:hover { background: var(--glass); }
.btn.danger { background: color-mix(in srgb, var(--red) 85%, black); color: #fff; }
.btn.sm { height: 34px; padding: 0 13px; font-size: 13px; }
.btn.lg { height: 52px; padding: 0 26px; font-size: 15.5px; }
.btn.icon { width: 42px; padding: 0; }
.btn.icon.sm { width: 34px; }

/* ——— Formulaires ——— */
.field { display: grid; gap: 7px; }
.field > span { font-size: 12.5px; font-weight: 550; color: var(--ink-2); letter-spacing: .01em; }
.field small { color: var(--ink-3); font-size: 12px; }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 11px 14px; border-radius: 14px; border: 0; outline: 0;
  background: color-mix(in srgb, var(--bg) 35%, transparent);
  box-shadow: 0 0 0 1px var(--line-2) inset, 0 1px 2px rgba(0,0,0,.2) inset;
  transition: box-shadow .2s, background .2s;
}
:root[data-theme="light"] .input, :root[data-theme="light"] .select, :root[data-theme="light"] .textarea { background: rgba(255,255,255,.6); }
.input:focus, .select:focus, .textarea:focus { box-shadow: 0 0 0 1px color-mix(in srgb, var(--violet) 70%, transparent) inset, 0 0 0 4px color-mix(in srgb, var(--violet) 18%, transparent); }
.textarea { min-height: 120px; resize: vertical; line-height: 1.55; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.select option { background: #15151f; color: #eee; }
.row { display: flex; gap: 12px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }

.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; z-index: 1; margin: 0; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--glass-2); box-shadow: 0 0 0 1px var(--line-2) inset; transition: background .3s; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); transition: transform .4s var(--spring); }
.switch input:checked + i { background: linear-gradient(120deg, var(--violet), var(--cyan)); }
.switch input:checked + i::after { transform: translateX(18px); }
.range { width: 100%; accent-color: var(--violet); }

.seg { display: inline-flex; padding: 4px; gap: 2px; border-radius: 999px; background: color-mix(in srgb, var(--bg) 40%, transparent); box-shadow: 0 0 0 1px var(--line) inset; }
.seg button { border: 0; background: none; height: 32px; padding: 0 14px; border-radius: 999px; cursor: pointer; color: var(--ink-2); font-weight: 550; font-size: 13px; transition: all .3s var(--ease); }
.seg button.on { background: var(--glass-2); color: var(--ink); box-shadow: 0 1px 0 rgba(255,255,255,.14) inset, 0 0 0 1px var(--line-2) inset, 0 4px 12px -4px rgba(0,0,0,.4); }

/* ——— Pastilles & badges ——— */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 99px; font-size: 12px; font-weight: 550; background: var(--glass-2); box-shadow: 0 0 0 1px var(--line) inset; color: var(--ink-2); white-space: nowrap; }
.pill.ok { color: var(--teal); background: color-mix(in srgb, var(--teal) 14%, transparent); }
.pill.warn { color: var(--amber); background: color-mix(in srgb, var(--amber) 14%, transparent); }
.pill.bad { color: var(--red); background: color-mix(in srgb, var(--red) 14%, transparent); }
.pill.info { color: var(--cyan); background: color-mix(in srgb, var(--cyan) 12%, transparent); }
.pill.violet { color: var(--violet); background: color-mix(in srgb, var(--violet) 15%, transparent); }
:root[data-theme="light"] .pill.ok { color: #0a8a68; } :root[data-theme="light"] .pill.warn { color: #a86400; } :root[data-theme="light"] .pill.info { color: #0679a6; } :root[data-theme="light"] .pill.violet { color: #5a45e0; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.dot.live { background: var(--green); box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 60%, transparent); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* ——— Avatars orbes ——— */
.orb-av { --c: var(--violet); position: relative; display: inline-block; vertical-align: middle; width: 44px; height: 44px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 32% 28%, rgba(255,255,255,.95), transparent 22%), radial-gradient(circle at 60% 70%, var(--c), color-mix(in srgb, var(--c) 30%, #000) 85%);
  box-shadow: 0 8px 24px -6px var(--c), inset 0 -4px 10px rgba(0,0,0,.25), inset 0 2px 4px rgba(255,255,255,.4); }
.orb-av.lg { width: 64px; height: 64px; }
.orb-av.sm { width: 30px; height: 30px; }
.orb-av[data-c="teal"] { --c: var(--teal); } .orb-av[data-c="amber"] { --c: var(--amber); } .orb-av[data-c="blue"] { --c: var(--blue); }
.orb-av[data-c="pink"] { --c: var(--pink); } .orb-av[data-c="green"] { --c: var(--green); } .orb-av[data-c="cyan"] { --c: var(--cyan); }

/* ——— Typographie ——— */
h1, h2, h3, h4 { margin: 0; letter-spacing: -.025em; line-height: 1.15; font-weight: 600; }
.display { font-size: clamp(40px, 7vw, 84px); letter-spacing: -.045em; line-height: 1; font-weight: 620; }
.iris-text { background: var(--iris); -webkit-background-clip: text; background-clip: text; color: transparent; }
.eyebrow { font: 600 11.5px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }

/* ——— Toasts & modales ——— */
.toasts { position: fixed; z-index: 100; left: 50%; transform: translateX(-50%); bottom: calc(96px + env(safe-area-inset-bottom)); display: grid; gap: 8px; pointer-events: none; width: min(420px, calc(100vw - 32px)); }
@media (min-width: 900px) { .toasts { bottom: 28px; } }
.toast { pointer-events: auto; padding: 13px 18px; border-radius: 18px; display: flex; gap: 10px; align-items: center; font-weight: 500; animation: rise .5s var(--spring); background: var(--glass-strong); }
.toast.err { box-shadow: var(--glass-shadow), 0 0 0 1px color-mix(in srgb, var(--red) 50%, transparent) inset; }
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(.96); } }
.modal-wrap { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; background: rgba(5,5,12,.45); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade .3s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(620px, 100%); max-height: calc(100dvh - 32px); overflow: auto; padding: 28px; background: var(--glass-strong); animation: pop .5s var(--spring); }
@keyframes pop { from { opacity: 0; transform: translateY(20px) scale(.96); } }
.modal h3 { font-size: 21px; margin-bottom: 6px; }
@media (max-width: 640px) {
  .modal-wrap { place-items: end stretch; padding: 0; }
  .modal { width: 100%; border-radius: 28px 28px 0 0; padding: 24px 20px calc(24px + env(safe-area-inset-bottom)); animation: sheet .5s var(--spring); }
  @keyframes sheet { from { transform: translateY(100%); } }
}

.skeleton { border-radius: 12px; background: linear-gradient(90deg, var(--glass) 0%, var(--glass-2) 50%, var(--glass) 100%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty { padding: 48px 20px; text-align: center; color: var(--ink-3); }

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