/* ==========================================================================
   Reddington Bot : design system « Fluid Functionalism » (portage vanilla)
   Principes : chaque mouvement rend un changement d'état lisible ; un seul
   survol qui glisse par liste ; trois ressorts ; Inter opsz ; un seul accent.
   ========================================================================== */

@font-face {
  font-family: "Inter";
  src: url("/static/fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* --- Jetons ------------------------------------------------------------- */
:root {
  --fluid-accent: #6B97FF;
  --focus-ring: var(--fluid-accent);

  /* Ressorts (durée de stabilisation) : fast = survol/focus, moderate = petits
     déplacements, slow = grandes surfaces. Sorties : un palier plus rapides. */
  --spring-crit: linear(0, 0.0575, 0.1802, 0.3206, 0.4549, 0.5727, 0.6709, 0.7499, 0.812, 0.86, 0.8965, 0.9239, 0.9444, 0.9596, 0.9707, 0.9789, 0.9848, 0.9891, 0.9922, 0.9944, 0.996, 0.9972, 0.998, 0.9986, 1);
  --spring-bounce: linear(0, 0.0441, 0.1458, 0.2718, 0.4012, 0.5223, 0.6288, 0.7186, 0.7918, 0.8497, 0.8944, 0.9281, 0.9528, 0.9705, 0.9828, 0.9912, 0.9965, 0.9999, 1.0017, 1.0027, 1.003, 1.0029, 1.0026, 1.0023, 1);
  --fast: 80ms;      --fast-exit: 60ms;
  --moderate: 160ms; --moderate-exit: 120ms;
  --slow: 240ms;     --slow-exit: 160ms;
  --ease-fast: var(--spring-crit);
  --ease-moderate: var(--spring-crit);
  --ease-slow: var(--spring-crit);           /* taste-skill : aucun dépassement, aucun rebond */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  /* Couche de survol / pression (taste-skill, motion.md) */
  --ease-ui: cubic-bezier(.2, .8, .2, 1);
  --ease-enter: cubic-bezier(.22, 1, .36, 1);
  --m-in: 150ms; --m-out: 120ms; --m-press: 90ms; --m-slide: 240ms;
  /* Teinte secondaire des fonds vitrines : cyan/sarcelle (jamais de violet) */
  --accent-cool: #22d3ee;
  --accent-teal: #2dd4bf;
  --chart-1: var(--fluid-accent);
  --chart-2: var(--accent-teal);

  /* Tailles (défaut) */
  --control-h: 36px;
  --control-px: 12px;
  --row-px: 8px;
  --gap: 8px;
  --radius-outer: 12px;
  --radius: 8px;
  --radius-pill: 20px;

  /* Typographie : rôles taille/interligne */
  --fs-display: 28px; --lh-display: 34px;
  --fs-title: 16px;   --lh-title: 22px;
  --fs-subtitle: 14px;--lh-subtitle: 20px;
  --fs-body: 13px;    --lh-body: 20px;
  --fs-caption: 12px; --lh-caption: 16px;
  --fs-micro: 11px;   --lh-micro: 14px;
  --w-normal: "wght" 400, "opsz" 14;
  --w-semibold: "wght" 550, "opsz" 18;
  --w-bold: "wght" 700, "opsz" 25;
}

/* Sombre (défaut) : surfaces additives de blanc */
:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --background: #101010;
  --surface-1: #171717;
  --surface-2: #1e1e1e;
  --surface-3: #252525;
  --surface-4: #2c2c2c;
  --surface-5: #333333;
  --foreground: #ededed;
  --muted-foreground: #9a9a9a;
  --border: rgb(255 255 255 / 0.09);
  --border-strong: rgb(255 255 255 / 0.16);
  --overlay: 255 255 255;
  --hover: rgb(255 255 255 / 0.06);
  --active: rgb(255 255 255 / 0.10);
  --tint: rgb(255 255 255 / 0.10);
  --destructive: #f87171;
  --success: #86efac;
  --warning: #fcd34d;
  --info: #93c5fd;
  --shadow-surface-2: 0 0 0 1px rgb(255 255 255 / 0.06), 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-surface-3: 0 0 0 1px rgb(255 255 255 / 0.08), 0 8px 24px -6px rgb(0 0 0 / 0.6), 0 2px 6px rgb(0 0 0 / 0.35);
  --shadow-surface-4: 0 0 0 1px rgb(255 255 255 / 0.08), 0 24px 64px -12px rgb(0 0 0 / 0.75), 0 4px 12px rgb(0 0 0 / 0.4);
  --image-ring: inset 0 0 0 1px rgb(255 255 255 / 0.10);
}
:root[data-theme="light"] {
  color-scheme: light;
  --background: #fafafa;
  --surface-1: #fcfcfc;
  --surface-2: #ffffff;
  --surface-3: #ffffff;
  --surface-4: #ffffff;
  --surface-5: #ffffff;
  --foreground: #171717;
  --muted-foreground: #6b6b6b;
  --border: rgb(0 0 0 / 0.08);
  --border-strong: rgb(0 0 0 / 0.16);
  --overlay: 0 0 0;
  --hover: rgb(0 0 0 / 0.04);
  --active: rgb(0 0 0 / 0.07);
  --tint: rgb(0 0 0 / 0.06);
  --destructive: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --info: #3b82f6;
  --shadow-surface-2: 0 0 0 1px rgb(0 0 0 / 0.06), 0 1px 2px rgb(0 0 0 / 0.04);
  --shadow-surface-3: 0 0 0 1px rgb(0 0 0 / 0.06), 0 8px 24px -6px rgb(0 0 0 / 0.12), 0 2px 6px rgb(0 0 0 / 0.05);
  --shadow-surface-4: 0 0 0 1px rgb(0 0 0 / 0.06), 0 24px 64px -12px rgb(0 0 0 / 0.2), 0 4px 12px rgb(0 0 0 / 0.06);
  --image-ring: inset 0 0 0 1px rgb(0 0 0 / 0.10);
}

/* Couleurs de compatibilité pour les gabarits existants */
:root {
  --bg: var(--background);
  --panel: var(--surface-2);
  --panel-2: var(--surface-3);
  --text: var(--foreground);
  --muted: var(--muted-foreground);
  --accent: var(--fluid-accent);
  --accent-2: color-mix(in oklab, var(--fluid-accent), white 18%);
  --ok: var(--success);
  --error: var(--destructive);
}

/* --- Base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-variation-settings: var(--w-normal);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
b, strong, th { font-weight: normal; font-variation-settings: var(--w-semibold); }
a { color: var(--fluid-accent); text-decoration: none; transition: color var(--fast) var(--ease-fast); }
a:hover { color: var(--accent-2); }
h1, h2, h3, h4 { font-weight: normal; margin: 0; }
h1 { font-size: var(--fs-display); line-height: var(--lh-display); font-variation-settings: var(--w-bold); letter-spacing: -0.01em; }
h2 { font-size: var(--fs-title); line-height: var(--lh-title); font-variation-settings: var(--w-semibold); }
h3, h4 { font-size: var(--fs-subtitle); line-height: var(--lh-subtitle); font-variation-settings: var(--w-semibold); }
p { margin: 0 0 12px; }
small, .caption { font-size: var(--fs-caption); line-height: var(--lh-caption); }
.muted { color: var(--muted-foreground); }
code, kbd, pre { font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace; font-size: 0.92em; }
code { background: color-mix(in srgb, var(--foreground) 7%, transparent); padding: 1px 5px; border-radius: 5px; }
pre { background: color-mix(in srgb, var(--foreground) 7%, transparent); padding: 0.75em 1em; border-radius: var(--radius); overflow-x: auto; }
kbd { display: inline-flex; align-items: center; height: 18px; padding: 0 5px; border-radius: 5px; background: var(--tint); font-size: var(--fs-micro); }
hr { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }
img { max-width: 100%; }
::selection { background: color-mix(in oklab, var(--fluid-accent) 35%, transparent); }

/* Focus : anneau 1px accent, uniquement au clavier */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: inherit; transition: none; }

/* Barres de défilement fines */
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--foreground) 14%, transparent) transparent; }

/* --- Mise en page ------------------------------------------------------------ */
.layout { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
  padding: 16px 12px; background: var(--surface-1);
  border-right: 1px solid var(--border);
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px; padding: 4px 8px 12px;
  color: var(--foreground); font-size: var(--fs-title); font-variation-settings: var(--w-semibold);
}
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: 15px;
  background: linear-gradient(135deg, var(--fluid-accent), color-mix(in oklab, var(--fluid-accent), var(--accent-cool) 60%));
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.12) inset, 0 4px 14px -4px color-mix(in oklab, var(--fluid-accent) 70%, transparent);
  color: white;
}
.status {
  display: flex; align-items: center; gap: 8px; margin: 0 8px 12px; padding: 6px 10px;
  border-radius: var(--radius); background: var(--hover);
  font-size: var(--fs-caption); line-height: var(--lh-caption); color: var(--muted-foreground);
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--destructive); flex: none; }
.status.on::before { background: var(--success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 20%, transparent); }
.nav-label { padding: 12px 10px 4px; font-size: var(--fs-caption); color: var(--muted-foreground); }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; position: relative; }
.sidebar nav a, .sidebar > a {
  position: relative; z-index: 1; display: flex; align-items: center; gap: 10px;
  height: 32px; padding: 0 10px; border-radius: var(--radius);
  color: var(--muted-foreground); font-size: var(--fs-body);
  transition: color var(--fast) var(--ease-fast);
}
.sidebar nav a .ico { width: 18px; text-align: center; flex: none; }
.sidebar nav a:hover { color: var(--foreground); }
.sidebar nav a.active { color: var(--foreground); background: var(--active); }
.sidebar nav a.active .lbl { font-variation-settings: var(--w-semibold); }
.sidebar .logout { display: flex; gap: 6px; }
.sidebar .logout .btn { flex: 1; }
/* Compte connecté (bas de la barre latérale) */
.account { margin-top: auto; padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.account .who { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius); background: var(--hover); min-width: 0; }
.avatar { width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center; object-fit: cover;
  background: var(--tint); color: var(--foreground); font-size: var(--fs-body); font-variation-settings: var(--w-semibold); }
.who-text { display: flex; flex-direction: column; min-width: 0; }
.who-name { font-size: var(--fs-body); line-height: var(--lh-body); font-variation-settings: var(--w-semibold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-role { font-size: var(--fs-caption); line-height: var(--lh-caption); color: var(--muted-foreground); }
.content { padding: 32px clamp(16px, 4vw, 48px) 64px; max-width: 1180px; width: 100%; }
.center { display: grid; place-items: center; min-height: 100vh; padding: 16px; position: relative; overflow: hidden; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { margin-bottom: 4px; }
.page-head p { margin: 0; }

/* Libellé dont la graisse change sans décaler ses voisins */
.ghost-text { display: inline-grid; }
.ghost-text > * { grid-area: 1 / 1; }
.ghost-text > [aria-hidden] { visibility: hidden; font-variation-settings: var(--w-semibold); }

/* --- Surfaces / cartes -------------------------------------------------------- */
.card {
  position: relative;
  background: var(--surface-2);
  border-radius: var(--radius-outer);
  box-shadow: var(--shadow-surface-2);
  padding: 20px;
  margin-bottom: 16px;
}
.card > h2:first-child, .card > h3:first-child { margin-bottom: 12px; }
.card .card { background: var(--surface-3); box-shadow: var(--shadow-surface-2); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.stack, form.stack { display: flex; flex-direction: column; gap: 16px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
details { border-radius: var(--radius); }
details > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; font-variation-settings: var(--w-semibold); padding: 6px 0; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "›"; display: inline-block; width: 12px; color: var(--muted-foreground); transition: transform var(--fast) var(--ease-fast); }
details[open] > summary::before { transform: rotate(90deg); }

/* --- Formulaires -------------------------------------------------------------- */
label { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-body); font-variation-settings: var(--w-semibold); color: var(--foreground); }
label > small, label .muted { font-variation-settings: var(--w-normal); }
label.check { flex-direction: row; align-items: center; gap: 10px; font-variation-settings: var(--w-normal); cursor: pointer; }
input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=range]), select, textarea {
  width: 100%; min-height: var(--control-h);
  padding: 7px var(--control-px);
  background: var(--surface-1); color: var(--foreground);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  font: inherit; font-variation-settings: var(--w-normal);
  transition: border-color var(--fast) var(--ease-fast), background-color var(--fast) var(--ease-fast);
}
input:hover:not(:focus), select:hover:not(:focus), textarea:hover:not(:focus) { border-color: color-mix(in srgb, var(--foreground) 28%, transparent); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus-ring); box-shadow: 0 0 0 3px color-mix(in oklab, var(--focus-ring) 28%, transparent); transition-duration: 140ms; }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted-foreground) 75%, transparent); }
select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%239a9a9a' stroke-width='1.5' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
select[multiple] { background-image: none; padding-right: var(--control-px); min-height: 120px; }
textarea { resize: vertical; line-height: var(--lh-body); }
input[type=color] { width: 44px; height: var(--control-h); padding: 3px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface-1); cursor: pointer; }
input[type=range] { accent-color: var(--fluid-accent); }
input[type=checkbox], input[type=radio] {
  appearance: none; width: 16px; height: 16px; flex: none; margin: 0; cursor: pointer;
  border: 1.5px solid var(--border-strong); border-radius: 5px; background: transparent;
  display: inline-grid; place-content: center;
  transition: background-color var(--fast) var(--ease-fast), border-color var(--fast) var(--ease-fast);
}
input[type=radio] { border-radius: 50%; }
input[type=checkbox]:hover, input[type=radio]:hover { border-color: color-mix(in srgb, var(--foreground) 40%, transparent); }
input[type=checkbox]::before {
  content: ""; width: 10px; height: 10px; transform: scale(0.6); opacity: 0;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
  background: white; transition: transform var(--fast) var(--ease-out), opacity var(--fast) var(--ease-out);
}
input[type=radio]::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: white; transform: scale(0); transition: transform var(--fast) var(--ease-out); }
input[type=checkbox]:checked, input[type=radio]:checked { background: var(--fluid-accent); border-color: var(--fluid-accent); }
input[type=checkbox]:checked::before { transform: scale(1); opacity: 1; }
input[type=radio]:checked::before { transform: scale(1); }
input:disabled, select:disabled, textarea:disabled, button:disabled { opacity: 0.5; pointer-events: none; }
@media (pointer: coarse) { input, select, textarea { font-size: 16px !important; } }

/* --- Boutons ------------------------------------------------------------------- */
.btn, button.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--control-h); padding: 0 16px; border: 0; border-radius: var(--radius);
  font: inherit; font-size: var(--fs-body); font-variation-settings: var(--w-semibold);
  cursor: pointer; white-space: nowrap; text-decoration: none;
  color: var(--foreground); background: var(--tint);
  box-shadow: 0 0 0 1px transparent;
  transition: background-color var(--m-out) var(--ease-ui), box-shadow var(--m-out) var(--ease-ui), color var(--m-out) var(--ease-ui), transform var(--m-out) var(--ease-ui);
}
.btn:hover { background: color-mix(in srgb, var(--foreground) 15%, transparent); color: var(--foreground); }
/* taste-skill : le bouton monte d'1 px au survol (pointeur fin) et s'enfonce au clic */
@media (hover: hover) and (pointer: fine) {
  .btn:hover { transform: translateY(-1px); transition-duration: var(--m-in); }
}
.btn:active { transform: translateY(1px) scale(.985); transition-duration: var(--m-press); }
.btn.primary {
  color: white; background: var(--fluid-accent);
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--fluid-accent), black 10%), inset 0 1px 0 rgb(255 255 255 / 0.18);
}
.btn.primary:hover { background: color-mix(in oklab, var(--fluid-accent), white 10%); color: white; }
.btn.primary:active { background: color-mix(in oklab, var(--fluid-accent), black 8%); }
.btn.danger { color: white; background: color-mix(in oklab, var(--destructive), black 18%); }
.btn.danger:hover { background: color-mix(in oklab, var(--destructive), black 8%); color: white; }
.btn.ghost { background: transparent; box-shadow: 0 0 0 1px var(--border-strong); color: var(--foreground); }
.btn.ghost:hover { background: var(--hover); }
.btn.ghost:active { box-shadow: inset 0 0 0 1px var(--border-strong); }
.btn.small { height: 28px; padding: 0 12px; font-size: var(--fs-caption); }
button { font: inherit; }

/* .btn.shimmer : retiré (taste-skill : pas de reflet qui balaie) ; la classe reste sans effet. */

/* Interrupteur (switch) */
.switch { width: 36px; height: 20px; border-radius: 999px; border: 0; background: var(--tint); position: relative; cursor: pointer; padding: 0; flex: none; transition: background-color var(--fast) var(--ease-fast); }
.switch span { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: white; box-shadow: 0 1px 3px rgb(0 0 0 / 0.3); transition: transform var(--moderate) var(--ease-moderate); }
.switch.on { background: var(--fluid-accent); }
.switch.on span { transform: translateX(16px); }

/* --- Badges & messages ----------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 6px;
  font-size: var(--fs-caption); white-space: nowrap; vertical-align: middle;
  color: var(--foreground); background: var(--tint);
}
.badge.ok { color: var(--success); background: color-mix(in srgb, var(--success) 15%, var(--background)); }
.badge.error { color: var(--destructive); background: color-mix(in srgb, var(--destructive) 15%, var(--background)); }
.badge.info { color: var(--warning); background: color-mix(in srgb, var(--warning) 15%, var(--background)); }
.badge.accent { color: var(--fluid-accent); background: color-mix(in srgb, var(--fluid-accent) 15%, var(--background)); }

.flash {
  display: grid; grid-template-columns: 20px 1fr; gap: 10px; align-items: start;
  padding: 12px 16px; margin-bottom: 12px; border-radius: var(--radius-outer);
  background: var(--hover); color: var(--foreground);
  animation: flash-in var(--slow) var(--ease-slow) both;
  transform-origin: top center;
}
.flash::before { content: "ℹ"; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font-size: 12px; color: var(--background); background: var(--info); font-variation-settings: var(--w-bold); }
.flash.ok::before { content: "✓"; background: var(--success); }
.flash.error { background: color-mix(in srgb, var(--destructive) 12%, var(--background)); }
.flash.error::before { content: "!"; background: var(--destructive); }
.flash.info::before { background: var(--warning); }
@keyframes flash-in { from { opacity: 0; transform: translateY(-6px) scaleY(0.96); } }

/* --- Tableaux --------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; margin: 0 -8px; padding: 0 8px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-body); }
th { text-align: left; color: var(--muted-foreground); font-size: var(--fs-caption); padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { position: relative; }

/* --- Survol fluide (une surface qui glisse par conteneur) --------------------------- */
[data-fluid-hover] { position: relative; }
.fluid-highlight {
  position: absolute; left: 0; top: 0; z-index: 0; pointer-events: none;
  border-radius: var(--radius); background: var(--hover); opacity: 0;
  transition: transform var(--fast) var(--ease-fast), width var(--fast) var(--ease-fast), height var(--fast) var(--ease-fast), opacity var(--fast) var(--ease-fast);
}
.fluid-highlight.no-slide { transition: opacity var(--fast) var(--ease-fast); }
[data-fluid-hover] > *:not(.fluid-highlight) { position: relative; z-index: 1; }
.table-wrap[data-fluid-hover] { position: relative; }

/* --- Accueil / pages vitrines (touches Magic UI / Aceternity) ------------------------- */
.hero {
  position: relative; overflow: hidden; isolation: isolate;
  border-radius: 16px; padding: 28px; margin-bottom: 16px;
  background: var(--surface-2); box-shadow: var(--shadow-surface-2);
}
.hero::before {
  content: ""; position: absolute; inset: -40%; z-index: -1; opacity: 0.55;
  background:
    radial-gradient(40% 35% at 20% 30%, color-mix(in oklab, var(--fluid-accent) 55%, transparent), transparent 70%),
    radial-gradient(35% 30% at 78% 18%, color-mix(in oklab, var(--accent-cool) 32%, transparent), transparent 70%),
    radial-gradient(30% 30% at 60% 85%, color-mix(in oklab, var(--accent-teal) 24%, transparent), transparent 70%);
  filter: blur(40px);
}
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse 70% 80% at 70% 0%, black, transparent 75%);
}
/* Entrée du héros (taste-skill) : une fois par visite, le titre monte ligne par ligne puis le reste
   apparaît (12 px, 520 ms, 60 ms d'écart) ; ~1,1 s ; jamais au défilement. */
html.m-enter .hero[data-enter] h1 { clip-path: inset(0 0 -0.2em 0); }
html.m-enter .hero[data-enter] h1 > span { display: inline-block; animation: enter-line 700ms var(--ease-enter) both; }
html.m-enter .hero[data-enter] .enter-item { animation: enter-up 520ms var(--ease-enter) both; animation-delay: calc(350ms + var(--i, 0) * 60ms); }
@keyframes enter-line { from { transform: translateY(105%); } }
@keyframes enter-up { from { opacity: 0; transform: translateY(12px); } }
.hero h1 { font-size: 32px; line-height: 38px; }
.hero .muted { max-width: 60ch; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface-2); box-shadow: var(--shadow-surface-2); border-radius: var(--radius-outer); padding: 16px; }
.tile .k { color: var(--muted-foreground); font-size: var(--fs-caption); line-height: var(--lh-caption); }
.tile .v { font-size: 26px; line-height: 32px; font-variation-settings: var(--w-bold); font-variant-numeric: tabular-nums; margin-top: 4px; }

/* Bento des modules. Carte qui contient un lien (.card.is-link, ou .module) : se soulève de 2 px,
   sa bordure fonce d'un cran, ombre douce au survol seulement (taste-skill). Carte sans lien : immobile.
   .spotlight est conservé comme classe mais n'a plus d'effet de lueur. */
.bento { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.card.is-link, .module {
  transition: transform var(--m-out) var(--ease-ui), box-shadow var(--m-out) var(--ease-ui);
}
@media (hover: hover) and (pointer: fine) {
  .card.is-link:hover, .module:hover {
    transform: translateY(-2px);
    transition-duration: 180ms;
    box-shadow: 0 0 0 1px var(--border-strong), 0 12px 24px -12px rgb(0 0 0 / 0.10);
  }
}
.module { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 16px; }
.module p { flex: 1; margin: 0; font-size: var(--fs-caption); line-height: var(--lh-caption); }
.module-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.module-top h2 { margin: 0; display: flex; align-items: center; gap: 10px; font-size: var(--fs-subtitle); }
.module-top h2 a { color: var(--foreground); }
.module-top h2 a::after { content: ""; position: absolute; inset: 0; z-index: 0; border-radius: inherit; }
.module-top form { position: relative; z-index: 2; }
.module-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-size: 16px; background: var(--tint); flex: none; }
.module.is-off .module-icon { filter: grayscale(1); opacity: 0.6; }
.module .state { font-size: var(--fs-caption); color: var(--muted-foreground); display: flex; align-items: center; gap: 6px; }
.module .state::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--muted-foreground); }
.module.is-on .state::before { background: var(--success); }

/* Page de connexion */
.login { width: min(380px, 100%); display: flex; flex-direction: column; gap: 16px; padding: 28px; background: var(--surface-2); box-shadow: var(--shadow-surface-4); border-radius: 16px; position: relative; z-index: 1; }
.login h1 { font-size: 22px; line-height: 28px; display: flex; align-items: center; gap: 10px; }
.login .lead { margin: -8px 0 0; }
.login .btn.block { width: 100%; justify-content: center; height: 40px; }
.login .btn svg { width: 18px; height: 18px; flex: none; }
.login .or { display: flex; align-items: center; gap: 10px; color: var(--muted-foreground); font-size: var(--fs-caption); }
.login .or::before, .login .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.login details > summary { font-variation-settings: var(--w-normal); color: var(--muted-foreground); font-size: var(--fs-body); }
.login details > summary:hover { color: var(--foreground); }
.login details[open] > summary { color: var(--foreground); }
.login form { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.login .fine { margin: 0; font-size: var(--fs-caption); line-height: var(--lh-caption); color: var(--muted-foreground); }
.denied { width: min(440px, 100%); text-align: center; align-items: center; }
.login-bg { position: absolute; inset: 0; pointer-events: none; }
.login-bg::before { content: ""; position: absolute; inset: -30%; opacity: 0.4; filter: blur(60px);
  background: radial-gradient(30% 30% at 40% 40%, color-mix(in oklab, var(--fluid-accent) 60%, transparent), transparent 70%), radial-gradient(25% 25% at 62% 58%, color-mix(in oklab, var(--accent-cool) 40%, transparent), transparent 70%); }

/* Aperçu de message façon Discord (partagé par les modules) */
.dc-preview { background: #313338; color: #dbdee1; border-radius: var(--radius); padding: 12px 16px; font-size: 14px; line-height: 1.375; }
.dc-preview .dc-name { color: #f2f3f5; font-variation-settings: var(--w-semibold); }
.dc-preview .dc-embed { border-left: 4px solid var(--embed-color, var(--fluid-accent)); background: #2b2d31; border-radius: 4px; padding: 8px 12px; margin-top: 4px; max-width: 520px; }

/* .reveal : retiré (taste-skill : aucun bloc n'apparaît en fondu ; seule l'entrée du héros bouge). */
@keyframes reveal-fade { from { opacity: 0; } }

/* --- Onglets (segmented control, surbrillance qui glisse) ------------------------------ */
.tabs {
  display: inline-flex; gap: 2px; padding: 3px; margin-bottom: 16px; max-width: 100%; overflow-x: auto;
  background: var(--surface-1); border-radius: 10px; box-shadow: inset 0 0 0 1px var(--border);
  position: relative;
}
.tabs .tab {
  position: relative; z-index: 1; height: 30px; padding: 0 12px; border: 0; border-radius: 7px;
  background: transparent; color: var(--muted-foreground); cursor: pointer; white-space: nowrap;
  font: inherit; font-size: var(--fs-body); display: inline-flex; align-items: center; gap: 6px;
  transition: color var(--fast) var(--ease-fast);
}
.tabs .tab:hover { color: var(--foreground); }
/* taste-skill : un indicateur « pastille d'encre » qui glisse (240 ms), libellé couleur du fond */
.tabs .tab.active { color: var(--background); }
.tabs .tab.active .lbl { font-variation-settings: var(--w-semibold); }
.tabs .tab-indicator {
  position: absolute; top: 3px; left: 0; height: 30px; z-index: 0; border-radius: 7px;
  background: var(--foreground);
  transition: transform var(--m-slide) var(--ease-ui), width var(--m-slide) var(--ease-ui);
}
.tabs .tab .tab-n { opacity: .6; font-variant-numeric: tabular-nums; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--muted-foreground); }
.kv dd { margin: 0; }
[data-tab-panel][hidden] { display: none !important; }
[data-tab-panel] { animation: reveal-fade 200ms var(--ease-ui) both; }

/* --- Sections de réglages : titre + aide à gauche, champs à droite --------------------- */
.section { display: grid; grid-template-columns: minmax(200px, 280px) minmax(0, 1fr); gap: 24px; padding: 20px 0; border-top: 1px solid var(--border); }
.section:first-child { border-top: 0; padding-top: 4px; }
.section-head h2, .section-head h3 { margin-bottom: 4px; }
.section-head p { margin: 0; color: var(--muted-foreground); font-size: var(--fs-caption); line-height: var(--lh-caption); }
.section-body { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.form-footer { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 12px 0; margin-top: 8px; background: linear-gradient(transparent, var(--background) 35%); }

/* --- En-têtes de liste, lien retour, éditeur avec aperçu --------------------------------- */
.list-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.list-head h2, .list-head h3 { margin: 0 0 2px; }
.list-head p { margin: 0; color: var(--muted-foreground); font-size: var(--fs-caption); line-height: var(--lh-caption); }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2, .card-head h3 { margin: 0 0 2px; }
.card-head p { margin: 0; color: var(--muted-foreground); font-size: var(--fs-caption); line-height: var(--lh-caption); }
.back, .back-link { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 8px; color: var(--muted-foreground); font-size: var(--fs-caption); }
.back:hover, .back-link:hover { color: var(--foreground); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); gap: 16px; align-items: start; }
.split > .split-aside { position: sticky; top: 16px; }
@media (max-width: 1100px) { .split { grid-template-columns: minmax(0, 1fr); } .split > .split-aside { position: static; } }
.btn.ghost.danger { background: transparent; color: var(--destructive); box-shadow: none; }
.btn.ghost.danger:hover { background: color-mix(in srgb, var(--destructive) 12%, transparent); color: var(--destructive); }

/* --- États vides --------------------------------------------------------------------------- */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 32px 16px; color: var(--muted-foreground); }
.empty .empty-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; background: var(--tint); }
.empty h3 { color: var(--foreground); }
.empty p { margin: 0; max-width: 46ch; font-size: var(--fs-caption); line-height: var(--lh-caption); }

/* --- Puces (listes de mots, de domaines…) ----------------------------------------------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 4px 0 10px; border-radius: 7px; background: var(--tint); font-size: var(--fs-caption); }
.chip button { width: 18px; height: 18px; border: 0; border-radius: 5px; background: transparent; color: var(--muted-foreground); cursor: pointer; display: grid; place-items: center; padding: 0; }
.chip button:hover { background: var(--hover); color: var(--foreground); }

/* --- Responsive ------------------------------------------------------------------------ */
@media (max-width: 980px) {
  .section { grid-template-columns: 1fr; gap: 12px; }
}
@media (max-width: 820px) {
  .layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .sidebar { align-content: flex-start; }
  .sidebar { position: sticky; top: 0; z-index: 20; height: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 10px 12px; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
  .sidebar .brand { padding: 0; flex: 1; }
  .status { margin: 0; }
  .sidebar nav { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; width: 100%; order: 3; scrollbar-width: none; }
  .sidebar nav a { height: 30px; flex: none; }
  .nav-label { display: none; }
  .account { order: 2; flex-direction: row; align-items: center; margin-top: 0; padding-top: 0; }
  .account .who { padding: 0; background: none; }
  .account .who-text { display: none; }
  .sidebar .logout .btn { flex: none; }
  .content { padding: 20px 16px 48px; }
  .hero { padding: 20px; }
  .hero-meta .btn { width: 100%; }
  .hero h1 { font-size: 26px; line-height: 32px; }
}

/* --- Cibles tactiles : 44 px minimum (taste-skill, tap-size) --------------------------------- */
@media (pointer: coarse) {
  .btn, .btn.small, .tabs .tab, .sidebar nav a { min-height: 44px; }
  .tabs .tab-indicator { height: 44px; }
  input[type=checkbox], input[type=radio] { width: 20px; height: 20px; }
  label.check { min-height: 44px; }
  .switch { width: 44px; height: 26px; }
  .switch span { width: 22px; height: 22px; }
  .switch.on span { transform: translateX(18px); }
}

/* --- Mouvement réduit : les couleurs changent encore, rien ne se déplace ---------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; animation-delay: 0ms !important; }
  .fluid-highlight { transition: opacity var(--fast) linear !important; }
  .switch span, .flash, .tabs .tab-indicator { transition: none !important; }
  .btn:hover, .btn:active, .card.is-link:hover, .module:hover { transform: none !important; }
}

/* Texte réservé aux lecteurs d'écran */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
