/* ===========================================================================
   EXKAVE — MON ESPACE / LE LOUNGE
   Salon d'écoute, pas tableau de bord.

   La différence tient en une phrase : l'admin est un outil de gestion, le
   Lounge est un endroit où l'on revient. Donc peu de blocs, beaucoup d'air,
   une seule chose importante par zone, et la couleur vient des pochettes —
   pas de l'interface.

   Rien n'est réinventé ici : la palette, les matières et la typographie
   viennent de exkave-ui-global.css et exkave-typography.css. Ce fichier
   n'ajoute qu'une grille, un shell et une famille de cartes. Il n'existe
   qu'UNE carte : si une section a besoin d'être « plus jolie », c'est la
   carte qu'on corrige, pas une variante locale qu'on invente.

   Deux graisses, 400 et 600. Aucune autre.
   =========================================================================== */

:root {
  /* --- grille : les seules largeurs de rupture du cockpit ---------------- */
  --sp-marge-xl: 64px;   /* ≥1440 */
  --sp-marge-l:  48px;   /* ≥1024 */
  --sp-marge-m:  32px;   /* ≥872  */
  --sp-marge-s:  16px;   /* mobile */
  --sp-marge:    var(--sp-marge-s);

  --sp-gap-cartes: 16px;      /* devient 24 au-dessus de 872 */
  --sp-gap-sections: 40px;    /* devient 48 au-dessus de 1024 */
  --sp-pad-carte: 18px;       /* devient 24 au-dessus de 872 */

  --sp-r-carte: 16px;
  --sp-r-bouton: 12px;
  --sp-r-capsule: 999px;

  --sp-tap: 48px;             /* hauteur minimale d'une cible tactile */
  --sp-sidebar: 248px;
  --sp-contenu-max: 1120px;

  /* --- matières : le salon ----------------------------------------------
     Anthracite CHAUD, pas bleu. Les surfaces montent d'un cran vers le noyer
     à mesure qu'elles s'approchent de la lecture. */
  --sp-fond:      var(--ex-page, #0a0908);
  --sp-surface:   var(--ex-carton, #14110d);
  --sp-surface-2: var(--ex-carton-2, #1e1912);
  --sp-noyer:     #2a2119;
  --sp-encre:     var(--ex-encre, #fffdf7);
  --sp-encre-douce: var(--ex-encre-douce, rgba(255, 253, 247, .70));
  --sp-cendre:    var(--ex-cendre, #8b8478);
  --sp-trait:     var(--ex-trait, rgba(255, 253, 247, .13));
  --sp-laiton:    var(--ex-laiton, #d8b765);
  --sp-laiton-doux: rgba(216, 183, 101, .16);
  --sp-filet:     rgba(216, 183, 101, .26);

  /* Lumière chaude : une seule, très basse, jamais un néon. */
  --sp-lueur: radial-gradient(120% 90% at 12% -10%, rgba(216, 183, 101, .10) 0%, rgba(216, 183, 101, 0) 58%);
  --sp-ombre: 0 18px 40px -26px rgba(0, 0, 0, .78);
  --sp-ombre-relief: 0 26px 60px -30px rgba(0, 0, 0, .85);
  --sp-duree: .22s;
  --sp-courbe: cubic-bezier(.2, .7, .2, 1);
}

html[data-exkave-theme="light"] {
  --sp-fond:      var(--ex-page, #f3eee1);
  --sp-surface:   #fbf7ec;
  --sp-surface-2: #f1e9d8;
  --sp-noyer:     #e2d6bd;
  --sp-encre:     var(--ex-encre, #131210);
  --sp-encre-douce: rgba(19, 18, 16, .74);
  --sp-cendre:    #6b6355;
  --sp-trait:     rgba(19, 18, 16, .14);
  --sp-laiton:    #8a6620;
  --sp-laiton-doux: rgba(138, 102, 32, .12);
  --sp-filet:     rgba(138, 102, 32, .26);
  --sp-lueur: radial-gradient(120% 90% at 12% -10%, rgba(138, 102, 32, .07) 0%, rgba(138, 102, 32, 0) 58%);
  --sp-ombre: 0 16px 34px -26px rgba(60, 45, 20, .34);
  --sp-ombre-relief: 0 24px 50px -30px rgba(60, 45, 20, .40);
}

@media (min-width: 872px) {
  :root {
    --sp-marge: var(--sp-marge-m);
    --sp-gap-cartes: 24px;
    --sp-pad-carte: 24px;
  }
}

@media (min-width: 1024px) {
  :root { --sp-marge: var(--sp-marge-l); --sp-gap-sections: 48px; }
}

@media (min-width: 1440px) {
  :root { --sp-marge: var(--sp-marge-xl); }
}

/* ===========================================================================
   SHELL
   =========================================================================== */

/* Le fond de page appartient au système de thème du site, qui n'active à ce
   jour que le thème sombre : `exkave-theme.css` peint `html` et `body` depuis
   `--bg`. Mon espace, lui, sait s'afficher en clair. On reprend donc le fond
   pour NOS pages seulement — d'où la classe posée sur <html> — sans rien
   changer aux vingt autres routes. */
/* Un ATTRIBUT, pas une classe : la coquille partagée réaffecte
   `document.documentElement.className` au chargement et emportait la classe
   avec elle. L'attribut, lui, survit. */
html[data-space],
html[data-space] body.space-page {
  /* Longhands, pas le raccourci : `background: var(--x) !important` mélangé à
     un `background-image` dans le même bloc laissait des longhands vides, et la
     peau mobile — qui impose `background: none #050505 !important` sur `body` —
     reprenait la main. */
  background-color: var(--sp-fond) !important;
  background-image: none !important;
  background-attachment: initial !important;
}

body.space-page {
  margin: 0;
  background: var(--sp-fond);
  color: var(--sp-encre);
  font-family: var(--font-body);
  font-weight: var(--font-weight-regular, 400);
  -webkit-font-smoothing: antialiased;
}

.space-shell {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  padding: 0 var(--sp-marge) calc(var(--sp-tap) + 40px);
  max-width: calc(var(--sp-sidebar) + var(--sp-contenu-max) + var(--sp-gap-sections) + 2 * var(--sp-marge-xl));
  margin-inline: auto;
}

.space-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  background: var(--sp-lueur);
  pointer-events: none;
  z-index: 0;
}

.space-main { position: relative; z-index: 1; min-width: 0; }

/* --- barre latérale : desktop seulement ---------------------------------- */
.space-sidebar { display: none; }

@media (min-width: 1024px) {
  .space-shell {
    grid-template-columns: var(--sp-sidebar) minmax(0, 1fr);
    gap: var(--sp-gap-sections);
    padding-bottom: 96px;
  }
  .space-sidebar {
    display: block;
    position: sticky;
    top: 96px;
    align-self: start;
    z-index: 1;
    padding-top: 8px;
  }
}

.space-sidebar-profil {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--sp-trait);
  border-radius: var(--sp-r-carte);
  background: var(--sp-surface);
}

.space-avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: var(--sp-r-capsule);
  object-fit: cover;
  background: var(--sp-surface-2);
  border: 1px solid var(--sp-filet);
}

.space-avatar-vide {
  display: grid;
  place-items: center;
  font-weight: var(--font-weight-emphasis, 600);
  color: var(--sp-laiton);
  font-size: .95rem;
}

.space-sidebar-identite { min-width: 0; display: grid; gap: 3px; }
.space-sidebar-nom {
  font-weight: var(--font-weight-emphasis, 600);
  font-size: .95rem;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.space-nav { margin-top: 20px; display: grid; gap: 2px; }

.space-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--sp-r-bouton);
  color: var(--sp-encre-douce);
  text-decoration: none;
  font-size: .95rem;
  transition: background var(--sp-duree) var(--sp-courbe), color var(--sp-duree) var(--sp-courbe);
}

.space-nav a:hover { background: var(--sp-surface); color: var(--sp-encre); }

.space-nav a[aria-current="page"] {
  background: var(--sp-surface);
  color: var(--sp-encre);
  font-weight: var(--font-weight-emphasis, 600);
  box-shadow: inset 2px 0 0 var(--sp-laiton);
}

.space-nav-icone { width: 18px; text-align: center; color: var(--sp-laiton); font-size: .9rem; }

.space-sidebar-pied {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--sp-trait);
  display: grid;
  gap: 8px;
}

/* --- navigation basse : mobile seulement --------------------------------- */
.space-mobile-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--sp-surface) 92%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--sp-trait);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.space-mobile-nav a,
.space-page .space-mobile-nav button {
  appearance: none;
  border: 0;
  background: none;
  display: grid;
  place-items: center;
  gap: 3px;
  min-height: var(--sp-tap);
  padding: 8px 4px;
  color: var(--sp-encre-douce);
  font: inherit;
  font-size: .68rem;
  text-decoration: none;
  cursor: pointer;
}

.space-mobile-nav [aria-current="page"] { color: var(--sp-laiton); font-weight: var(--font-weight-emphasis, 600); }
.space-mobile-nav-icone { font-size: 1.05rem; line-height: 1; }

@media (min-width: 1024px) { .space-mobile-nav { display: none; } }

/* Lounge only: keep the shared scroll threshold and accessible label. */
.space-page:has(.space-shell-dashboard) .exkave-back-top {
  left: auto !important;
  right: 16px !important;
  bottom: 16px !important;
  width: 40px !important;
  min-width: 40px !important;
  height: 40px !important;
  min-height: 40px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  gap: 0 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .2) !important;
}
.space-page:has(.space-shell-dashboard) .exkave-back-top b { display: none !important; }
.space-page:has(.space-shell-dashboard) .exkave-back-top span { background: none !important; }

@media (max-width: 1023px) {
  body.space-page:has(.space-shell-dashboard) {
    padding-bottom: calc(var(--mobile-nav-height, 129px) + env(safe-area-inset-bottom, 0px) + 16px);
  }
  html:has(.space-shell-dashboard) {
    scroll-padding-bottom: calc(var(--mobile-nav-height, 129px) + env(safe-area-inset-bottom, 0px) + 16px);
  }
  .space-page:has(.space-shell-dashboard) .exkave-back-top {
    /* The shared mobile shell pins this control with !important. */
    bottom: calc(var(--mobile-nav-height, 129px) + env(safe-area-inset-bottom, 0px) + 16px) !important;
  }
}

/* --- feuille « Plus » ---------------------------------------------------- */
.space-plus:not([open]) { display: none; }

.space-plus[open] {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  align-items: end;
  background: rgba(0, 0, 0, .58);
  border: 0;
  padding: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
}

.space-plus::backdrop { background: rgba(0, 0, 0, .58); }

.space-plus-panneau {
  background: var(--sp-surface);
  border-top: 1px solid var(--sp-filet);
  border-radius: var(--sp-r-carte) var(--sp-r-carte) 0 0;
  padding: 20px var(--sp-marge) calc(20px + env(safe-area-inset-bottom, 0));
  display: grid;
  gap: 4px;
}

.space-plus-panneau a,
.space-plus-panneau button {
  appearance: none;
  border: 0;
  background: none;
  text-align: left;
  min-height: var(--sp-tap);
  padding: 0 12px;
  border-radius: var(--sp-r-bouton);
  color: var(--sp-encre);
  font: inherit;
  font-size: 1rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.space-plus-panneau a:hover,
.space-plus-panneau button:hover { background: var(--sp-surface-2); }

/* ===========================================================================
   TYPOGRAPHIE DE SECTION
   =========================================================================== */

.space-section { margin-top: var(--sp-gap-sections); }

.space-section-tete {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  /* Le lien de section peut passer à la ligne. Mesuré sur la production le
     2026-08-23 : avec la police réellement servie, « Voir tous tes dépôts »
     poussait l'en-tête 27 px au-delà du cadre sur toutes les largeurs mobiles.
     Le serveur de développement, lui, retombait sur une police système plus
     étroite et ne montrait rien. */
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-bottom: 14px;
  min-width: 0;
}

.space-section-tete > div { min-width: 0; }

.space-section-tete h2 {
  --font-size-h2: 1.0625rem;
  --letter-spacing-h2: -.005em;
  --line-height-heading: 1.3;
  margin: 0;
  font-size: 1.0625rem;
  font-weight: var(--font-weight-emphasis, 600);
  letter-spacing: -.005em;
}

.space-section-tete p {
  margin: 4px 0 0;
  color: var(--sp-cendre);
  font-size: .875rem;
}

.space-lien {
  color: var(--sp-laiton);
  text-decoration: none;
  font-size: .875rem;
  border-radius: var(--sp-r-bouton);
  max-width: 100%;
  overflow-wrap: anywhere;
}

@media (min-width: 872px) { .space-lien { white-space: nowrap; } }

.space-lien:hover { text-decoration: underline; }

/* ===========================================================================
   HERO
   =========================================================================== */

.space-hero {
  position: relative;
  z-index: 1;
  padding: clamp(28px, 5vw, 52px) 0 0;
}

.space-hero-visuel {
  position: relative;
  min-height: clamp(270px, 31vw, 410px);
  overflow: hidden;
  border: 1px solid var(--sp-trait);
  border-radius: var(--sp-r-carte);
  background: #090909;
  isolation: isolate;
}

.space-hero-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: contrast(1.04);
}

.space-hero-visuel::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, .88) 0%, rgba(0, 0, 0, .55) 38%, rgba(0, 0, 0, .08) 72%),
    linear-gradient(0deg, rgba(0, 0, 0, .48), transparent 48%);
  pointer-events: none;
}

.space-hero-titre {
  position: absolute;
  z-index: 2;
  left: clamp(22px, 4vw, 52px);
  bottom: clamp(24px, 4vw, 48px);
  max-width: min(570px, 72%);
}

.space-hero-kicker {
  margin: 0 0 9px;
  color: var(--sp-laiton);
  font-size: .72rem;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.space-hero-bonjour {
  margin: 10px 0 0;
  color: rgba(255, 255, 255, .78);
  font-size: clamp(1rem, 1.5vw, 1.2rem);
}

.space-hero-panneau {
  padding-top: 22px;
}

.space-hero-cockpit .space-hero-salut {
  --font-size-h1: clamp(3rem, 7vw, 6rem);
  color: #fff;
  font-size: clamp(3rem, 7vw, 6rem);
  line-height: .92;
  letter-spacing: -.055em;
}

.space-hero-salut {
  --font-size-h1: clamp(1.75rem, 3.6vw, 2.6rem);
  --letter-spacing-h1: -.02em;
  --line-height-heading: 1.1;
  margin: 0;
  font-size: clamp(1.75rem, 3.6vw, 2.6rem);
  font-weight: var(--font-weight-emphasis, 600);
  line-height: 1.1;
  letter-spacing: -.02em;
  text-wrap: balance;
}

.space-hero-sous {
  margin: 6px 0 0;
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  color: var(--sp-encre-douce);
}

.space-hero-lead {
  margin: 14px 0 0;
  max-width: 54ch;
  color: var(--sp-cendre);
  font-size: .95rem;
  line-height: 1.55;
}

.space-hero-actions {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.space-hero-etiquettes {
  margin-top: 16px;
  margin-bottom: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.space-identite { display: flex; align-items: center; gap: 16px; }
.space-identite .space-avatar { width: 64px; height: 64px; flex-basis: 64px; font-size: 1.25rem; }
.space-identite .space-hero-sous { margin-top: 3px; }
.space-identite .space-hero-etiquettes { margin-top: 8px; }

@media (max-width: 640px) {
  .space-hero-visuel { min-height: 245px; border-radius: 14px; }
  .space-hero-photo { object-position: 61% center; }
  .space-hero-visuel::after {
    background:
      linear-gradient(90deg, rgba(0, 0, 0, .86), rgba(0, 0, 0, .18)),
      linear-gradient(0deg, rgba(0, 0, 0, .58), transparent 55%);
  }
  .space-hero-titre { left: 20px; bottom: 22px; max-width: 82%; }
  .space-hero-cockpit .space-hero-salut { font-size: clamp(2.8rem, 15vw, 4.2rem); }
  .space-hero-panneau { padding-top: 18px; }
}

.space-stats {
  margin-top: 18px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.space-stats::-webkit-scrollbar { display: none; }
.space-stats > span {
  flex: 0 0 auto;
  display: grid;
  gap: 1px;
  min-width: 96px;
  padding: 10px 13px;
  border: 1px solid var(--sp-trait);
  border-radius: var(--sp-r-bouton);
  background: color-mix(in srgb, var(--sp-surface) 74%, transparent);
}
.space-stats strong { font-size: 1.15rem; }
.space-stats small { color: var(--sp-cendre); font-size: .72rem; }

.space-cockpit-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.space-cockpit-colonne { min-width: 0; }
@media (min-width: 1180px) {
  .space-cockpit-grid { grid-template-columns: minmax(0, 1.55fr) minmax(300px, .85fr); gap: 28px; }
}
.space-compteurs .space-carte { padding: 15px; }
.space-depots-finalises { margin-top: var(--sp-gap-cartes); }
.space-carte-compacte { padding: 15px; }

/* Une annonce ne doit jamais élargir la colonne du Lounge sur téléphone. */
[data-space-section="market"],
[data-space-section="market"] .space-grille,
[data-space-section="market"] .space-carte-compacte {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

[data-space-section="market"] .space-carte-meta {
  min-width: 0;
  overflow-wrap: anywhere;
}

.space-conversations {
  display: grid;
  border: 1px solid var(--sp-trait);
  border-radius: var(--sp-r-carte);
  background: var(--sp-surface);
  overflow: hidden;
}
.space-conversation {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  min-height: 72px;
  padding: 11px 14px;
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--sp-trait);
}
.space-conversation:last-child { border-bottom: 0; }
.space-conversation:hover { background: var(--sp-surface-2); }
.space-conversation-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--sp-noyer);
  color: var(--sp-laiton);
  font-weight: var(--font-weight-emphasis, 600);
}
.space-conversation-corps { display: grid; min-width: 0; }
.space-conversation-corps strong,
.space-conversation-corps span,
.space-conversation-corps small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.space-conversation-corps strong { font-size: .88rem; }
.space-conversation-corps span { color: var(--sp-encre-douce); font-size: .78rem; }
.space-conversation-corps small { color: var(--sp-cendre); font-size: .72rem; }
.space-badge-non-lu {
  display: grid;
  place-items: center;
  min-width: 23px;
  height: 23px;
  padding-inline: 6px;
  border-radius: 999px;
  background: var(--sp-laiton);
  color: #131210;
  font-size: .7rem;
  font-weight: var(--font-weight-emphasis, 600);
}

/* ===========================================================================
   BOUTONS — deux niveaux, pas davantage

   Une feuille partagée dore TOUT <button> de la page par
   `background-image: var(--grad) !important`. Sans cette remise à zéro, l'onglet
   « Plus » de la navigation basse et les filtres de la liste arrivaient en
   lingot d'or au milieu d'un salon. On neutralise donc l'héritage sur nos
   propres contrôles, puis on repose nos deux niveaux — et deux seulement.
   =========================================================================== */

.space-page :is(.space-btn, .space-filtre, .space-mobile-nav button, .space-plus-panneau button) {
  background-image: none !important;
  box-shadow: none !important;
  text-shadow: none !important;
}

.space-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--sp-tap);
  padding: 0 20px;
  border-radius: var(--sp-r-bouton);
  border: 1px solid transparent;
  font: inherit;
  font-size: .95rem;
  font-weight: var(--font-weight-emphasis, 600);
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--sp-duree) var(--sp-courbe), background var(--sp-duree) var(--sp-courbe);
}

.space-btn:active { transform: translateY(1px); }

.space-page .space-btn-primaire {
  background-color: var(--sp-laiton);
  color: #131210;
  border-color: var(--sp-laiton);
}

.space-page .space-btn-primaire:hover { background-color: var(--ex-laiton-clair, #f4e6b8); }

.space-page .space-btn-secondaire {
  background-color: transparent;
  color: var(--sp-encre);
  border-color: var(--sp-filet);
}

.space-btn-secondaire:hover { background: var(--sp-surface-2); }

.space-page .space-btn-discret {
  min-height: 40px;
  padding: 0 14px;
  background-color: transparent;
  color: var(--sp-encre-douce);
  border-color: var(--sp-trait);
  font-weight: var(--font-weight-regular, 400);
}

@media (min-width: 872px) { .space-btn-discret { min-height: 38px; } }

/* ===========================================================================
   ÉTIQUETTES
   =========================================================================== */

.space-etiquette {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 11px;
  border-radius: var(--sp-r-capsule);
  border: 1px solid var(--sp-trait);
  background: var(--sp-surface);
  color: var(--sp-encre-douce);
  font-size: .75rem;
  white-space: nowrap;
}

.space-etiquette-laiton {
  border-color: var(--sp-filet);
  background: var(--sp-laiton-doux);
  color: var(--sp-laiton);
  font-weight: var(--font-weight-emphasis, 600);
}

.space-statut { font-weight: var(--font-weight-emphasis, 600); }
.space-statut[data-ton="attente"]   { border-color: var(--sp-filet); color: var(--sp-laiton); background: var(--sp-laiton-doux); }
.space-statut[data-ton="cours"]     { color: var(--sp-encre-douce); }
.space-statut[data-ton="valide"]    { border-color: var(--sp-filet); color: var(--sp-encre); background: var(--sp-surface-2); }
.space-statut[data-ton="repos"]     { color: var(--sp-cendre); }

/* ===========================================================================
   CARTE — la seule
   =========================================================================== */

.space-carte {
  position: relative;
  display: grid;
  gap: 12px;
  padding: var(--sp-pad-carte);
  border: 1px solid var(--sp-trait);
  border-radius: var(--sp-r-carte);
  background: var(--sp-surface);
  box-shadow: var(--sp-ombre);
  min-width: 0;
}

.space-carte-tete {
  display: grid;
  gap: 8px;
  justify-items: start;
  min-width: 0;
}

@media (min-width: 1440px) {
  .space-detail .space-carte-tete {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 12px;
  }
}

.space-carte-titre { display: grid; gap: 2px; min-width: 0; }

.space-carte-titre .artiste {
  font-size: .8rem;
  color: var(--sp-cendre);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.space-carte-titre .album {
  font-size: 1.05rem;
  font-weight: var(--font-weight-emphasis, 600);
  line-height: 1.25;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.space-carte-meta { color: var(--sp-cendre); font-size: .8rem; }
a.space-carte { text-decoration: none; color: inherit; transition: border-color var(--sp-duree) var(--sp-courbe); }
a.space-carte:hover { border-color: var(--sp-filet); }
.space-carte-note { margin: 0; color: var(--sp-encre-douce); font-size: .9rem; line-height: 1.5; }
.space-carte-pied { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.space-carte-pied .space-btn { padding: 0 16px; }

/* --- carte dépôt : pochette + contenu ------------------------------------ */
.space-carte-depot { grid-template-columns: 84px minmax(0, 1fr); align-items: start; gap: 14px; }
.space-carte-depot > .space-depot-corps { display: grid; gap: 10px; min-width: 0; }
.space-carte-depot.is-locked {
  filter: grayscale(.72);
  opacity: .68;
  background: color-mix(in srgb, var(--sp-carte) 84%, var(--sp-fond));
}
.space-carte-depot.is-locked:hover { opacity: .82; }
.space-depot-verrou { font-style: italic; }

@media (min-width: 872px) {
  .space-carte-depot { grid-template-columns: 96px minmax(0, 1fr); gap: 18px; }
}

.space-pochette {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--sp-noyer);
  border: 1px solid var(--sp-trait);
}

.space-pochette img { width: 100%; height: 100%; object-fit: cover; display: block; }

.space-pochette-vide {
  display: grid;
  place-items: center;
  color: var(--sp-cendre);
  font-size: 1.4rem;
  opacity: .5;
}

/* --- progression : quatre jalons, aucun pourcentage ---------------------- */
.space-progres { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.space-progres-jalon {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .72rem;
  color: var(--sp-cendre);
}

.space-progres-jalon::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1px solid var(--sp-trait);
}

.space-progres-jalon[data-etat="fait"] { color: var(--sp-encre-douce); }
.space-progres-jalon[data-etat="fait"]::before { background: var(--sp-laiton); border-color: var(--sp-laiton); }
.space-progres-jalon[data-etat="courant"] { color: var(--sp-laiton); font-weight: var(--font-weight-emphasis, 600); }
.space-progres-jalon[data-etat="courant"]::before { border-color: var(--sp-laiton); box-shadow: inset 0 0 0 2px var(--sp-surface); background: var(--sp-laiton); }

.space-progres { row-gap: 4px; column-gap: 12px; }

/* ===========================================================================
   GRILLES
   =========================================================================== */

.space-grille { display: grid; gap: var(--sp-gap-cartes); grid-template-columns: 1fr; }
.space-grille-auto { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

@media (min-width: 872px) {
  .space-grille-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .space-grille-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1240px) {
  .space-grille-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ===========================================================================
   COLLECTION
   =========================================================================== */

.space-collection { display: grid; gap: 16px; }

.space-collection-chiffre {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 8px;
  min-width: 0;
}

.space-collection-chiffre strong { font-size: 1.9rem; font-weight: var(--font-weight-emphasis, 600); line-height: 1; }
.space-collection-chiffre span { color: var(--sp-cendre); font-size: .875rem; }

.space-collection-rail {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  max-width: 520px;
}

.space-collection-vignette { display: grid; gap: 6px; text-decoration: none; color: inherit; min-width: 0; }
.space-collection-vignette .titre {
  font-size: .8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--sp-encre-douce);
}
.space-collection-vignette .artiste {
  font-size: .72rem;
  color: var(--sp-cendre);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===========================================================================
   ACTIVITÉ
   =========================================================================== */

.space-activite { display: grid; gap: 0; }

.space-activite-ligne {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--sp-trait);
  text-decoration: none;
  color: inherit;
  min-height: var(--sp-tap);
}

.space-activite-ligne:last-child { border-bottom: 0; }
.space-activite-ligne:hover .space-activite-texte { color: var(--sp-laiton); }
.space-activite-texte { font-size: .92rem; min-width: 0; }
.space-activite-quand { color: var(--sp-cendre); font-size: .78rem; white-space: nowrap; }

/* ===========================================================================
   ÉTAT VIDE — compact, jamais 600 px de vide décoratif
   =========================================================================== */

.space-vide {
  display: grid;
  gap: 10px;
  justify-items: start;
  padding: 20px var(--sp-pad-carte);
  border: 1px dashed var(--sp-trait);
  border-radius: var(--sp-r-carte);
  background: color-mix(in srgb, var(--sp-surface) 60%, transparent);
}

.space-vide h3 {
  --font-size-h3: .95rem;
  margin: 0;
  font-size: .95rem;
  font-weight: var(--font-weight-emphasis, 600);
}
.space-vide p { margin: 0; color: var(--sp-cendre); font-size: .875rem; max-width: 46ch; line-height: 1.5; }

/* ===========================================================================
   FILTRES
   =========================================================================== */

.space-filtres {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 18px;
  scrollbar-width: none;
}

.space-filtres::-webkit-scrollbar { display: none; }

.space-page button.space-filtre {
  appearance: none;
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--sp-r-capsule);
  border: 1px solid var(--sp-trait) !important;
  background: transparent !important;
  color: var(--sp-encre-douce) !important;
  box-shadow: none !important;
  font: inherit;
  font-size: .875rem;
  cursor: pointer;
  white-space: nowrap;
}

.space-page .space-filtre[aria-pressed="true"] {
  background: var(--sp-laiton-doux) !important;
  border-color: var(--sp-filet) !important;
  color: var(--sp-laiton) !important;
  font-weight: var(--font-weight-emphasis, 600);
}

@media (hover: hover) {
  .space-page .space-filtre:hover {
    background: var(--sp-surface-2) !important;
    border-color: var(--sp-filet) !important;
    color: var(--sp-encre) !important;
  }
  .space-page .space-filtre[aria-pressed="true"]:hover {
    background: var(--sp-laiton-doux) !important;
    color: var(--sp-laiton) !important;
  }
}

/* ===========================================================================
   DÉTAIL
   =========================================================================== */

.space-detail { display: grid; gap: var(--sp-gap-cartes); }

@media (min-width: 1024px) {
  .space-detail { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
}

.space-detail-pochette { max-width: 320px; border-radius: var(--sp-r-carte); }

.space-fiche { display: grid; gap: 0; margin: 0; }

.space-fiche > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--sp-trait);
  font-size: .9rem;
}

.space-fiche > div:last-child { border-bottom: 0; }
.space-fiche dt { color: var(--sp-cendre); margin: 0; }
.space-fiche dd { margin: 0; text-align: right; overflow-wrap: anywhere; }

/* ===========================================================================
   ÉTATS DE CHARGEMENT ET D'ERREUR
   =========================================================================== */

.space-etat { padding: 40px 0; color: var(--sp-cendre); font-size: .95rem; }
.space-etat[hidden] { display: none; }

/* --- accessibilité ------------------------------------------------------- */
.space-page :is(a, button, [tabindex]):focus-visible {
  outline: 2px solid var(--sp-laiton);
  outline-offset: 2px;
  border-radius: var(--sp-r-bouton);
}

.space-saut {
  position: absolute;
  left: -9999px;
  top: 0;
}

.space-saut:focus {
  left: var(--sp-marge);
  top: 8px;
  z-index: 60;
  padding: 10px 16px;
  background: var(--sp-surface);
  border: 1px solid var(--sp-filet);
  border-radius: var(--sp-r-bouton);
}

@media (prefers-reduced-motion: reduce) {
  .space-page * { animation: none !important; transition: none !important; }
}

/* ===========================================================================
   LOUNGE V2 — cockpit éditorial
   Le dashboard racine reprend le rythme de la landing. Les pages secondaires
   conservent le shell et la navigation existants.
   =========================================================================== */

.space-shell-dashboard {
  display: block;
  max-width: 1504px;
  padding-top: clamp(20px, 3vw, 46px);
}

@media (min-width: 1024px) {
  .space-shell-dashboard { display: block; padding-bottom: 96px; }
}

.space-v2-welcome {
  position: relative;
  min-height: 304px;
  display: block;
  overflow: hidden;
  border: 1px solid var(--sp-filet);
  border-radius: 22px;
  background: var(--sp-surface);
  box-shadow: var(--sp-ombre-relief);
}

.space-v2-welcome::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  background: linear-gradient(90deg, #050505 0%, rgba(5, 5, 5, .96) 34%, rgba(5, 5, 5, .72) 56%, rgba(5, 5, 5, .18) 82%, rgba(5, 5, 5, .08) 100%);
  pointer-events: none;
}

.space-v2-welcome::after {
  content: "";
  position: absolute;
  z-index: 3;
  inset: auto 0 0;
  height: 3px;
  background: linear-gradient(90deg, var(--sp-laiton), rgba(216, 183, 101, 0));
}

.space-v2-welcome-copy {
  position: relative;
  z-index: 2;
  align-self: center;
  max-width: 760px;
  padding: clamp(28px, 4.2vw, 64px);
}

.space-v2-eyebrow {
  margin: 0 0 12px;
  color: var(--sp-laiton);
  font-size: .71rem;
  font-weight: var(--font-weight-emphasis, 600);
  letter-spacing: .2em;
  text-transform: uppercase;
}

.space-v2-welcome h1 {
  max-width: 720px;
  margin: 0;
  color: #fffdf7;
  font-size: clamp(2rem, 4vw, 4.25rem);
  line-height: .98;
  letter-spacing: -.045em;
}

.space-v2-intro {
  max-width: 630px;
  margin: 22px 0 0;
  color: rgba(255, 253, 247, .72);
  font-size: clamp(.96rem, 1.3vw, 1.12rem);
  line-height: 1.65;
}

.space-v2-welcome-art {
  position: absolute;
  z-index: 0;
  inset: 0;
  min-height: 0;
}
.space-v2-welcome-art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(.72) contrast(1.08) brightness(.82);
}

.space-v2-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  margin-top: 22px;
  overflow: hidden;
  border: 1px solid var(--sp-filet);
  border-radius: 18px;
  background: var(--sp-filet);
}

.space-v2-kpi {
  min-width: 0;
  min-height: 117px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 9px 18px;
  background: #0d0c0a;
  color: #fffdf7;
  text-decoration: none;
  transition: background-color var(--sp-duree) var(--sp-courbe), transform var(--sp-duree) var(--sp-courbe);
}

.space-v2-kpi:hover { background: #17130d; }
.space-v2-kpi-label {
  min-height: 0;
  color: rgba(255, 253, 247, .62);
  font-size: .74rem;
  line-height: 1.35;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.space-v2-kpi strong {
  display: block;
  margin-top: 4px;
  color: var(--sp-laiton);
  font-size: clamp(1.65rem, 2.7vw, 2.65rem);
  font-weight: var(--font-weight-emphasis, 600);
  line-height: 1;
  letter-spacing: -.04em;
  overflow-wrap: anywhere;
}
.space-v2-kpi small { margin-top: 4px; color: rgba(255, 253, 247, .58); font-size: 1.0125rem; }

.space-v2-panels {
  display: grid;
  grid-auto-rows: 1fr;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  margin-top: 22px;
}

.space-v2-panel {
  position: relative;
  min-height: 296px;
  display: grid;
  grid-template-columns: minmax(190px, .78fr) minmax(0, 1.22fr);
  overflow: hidden;
  border: 1px solid var(--sp-trait);
  border-radius: 22px;
  background: #0d0c0a;
  box-shadow: var(--sp-ombre);
}

.space-v2-panel-visual {
  position: relative;
  min-height: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    repeating-linear-gradient(135deg, rgba(216, 183, 101, .15) 0 12px, transparent 12px 34px),
    #15110c;
}
.space-v2-panel-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(5, 5, 5, .06), rgba(5, 5, 5, .7));
}
.space-v2-panel-visual::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 74%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(216, 183, 101, .22);
  border-radius: 50%;
  box-shadow: 0 0 70px rgba(216, 183, 101, .12), inset 0 0 46px rgba(216, 183, 101, .06);
}
.space-v2-panel-icon {
  position: relative;
  z-index: 2;
  width: clamp(92px, 10vw, 142px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  color: var(--sp-laiton);
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, .46));
}
.space-v2-panel-icon svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.space-v2-panel-account .space-v2-panel-visual {
  background:
    radial-gradient(circle at 50% 50%, transparent 0 34%, rgba(216, 183, 101, .28) 35% 36%, transparent 37% 49%, rgba(216, 183, 101, .12) 50% 51%, transparent 52%),
    repeating-linear-gradient(135deg, rgba(216, 183, 101, .12) 0 10px, transparent 10px 30px), #15110c;
}
.space-v2-panel-mark {
  position: absolute;
  z-index: 2;
  right: 18px;
  bottom: 16px;
  color: var(--sp-laiton);
  font-size: .72rem;
  letter-spacing: .18em;
}

.space-v2-panel-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: clamp(18px, 1.7vw, 26px);
}
.space-v2-panel h2 {
  margin: 0;
  color: #fffdf7;
  font-size: clamp(1.75rem, 2.8vw, 3rem);
  line-height: 1;
  letter-spacing: -.04em;
}
.space-v2-panel-body > :nth-last-child(2) { margin-bottom: 12px; }
.space-v2-panel-lead {
  max-width: 420px;
  margin: 9px 0 0;
  color: rgba(255, 253, 247, .66);
  line-height: 1.58;
}
.space-v2-panel-meta {
  margin: 9px 0 0;
  color: rgba(255, 253, 247, .88);
  font-size: .84rem;
}
.space-v2-account-row {
  width: 100%;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}
.space-v2-account-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.space-v2-account-row .space-btn-discret { margin-left: auto; color: rgba(255, 253, 247, .72); }
.space-v2-notice {
  box-sizing: border-box;
  width: 100%;
  margin-top: 8px;
  padding: 7px 10px;
  border-left: 2px solid var(--sp-laiton);
  background: rgba(216, 183, 101, .09);
  color: rgba(255, 253, 247, .76);
  font-size: .78rem;
  line-height: 1.4;
}
.space-v2-panel-link {
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: auto;
  padding: 12px 0 0;
  border-top: 1px solid rgba(255, 253, 247, .12);
  color: var(--sp-laiton);
  font-size: .82rem;
  font-weight: var(--font-weight-emphasis, 600);
  letter-spacing: .04em;
  text-decoration: none;
}
.space-v2-panel-link > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.space-v2-panel-link > span:last-child { flex-shrink: 0; }
.space-v2-panel-link:hover { color: #fffdf7; }
.space-v2-panel-link:focus-visible { outline: 2px solid var(--sp-laiton); outline-offset: 3px; }

html[data-exkave-theme="light"] :is(.space-v2-kpi, .space-v2-panel) { background: #12100d; }

@media (max-width: 1040px) {
  .space-v2-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .space-v2-kpi:last-child { grid-column: 1 / -1; }
  .space-v2-kpi:nth-child(3), .space-v2-kpi:nth-child(4) { min-height: 100px; }
  .space-v2-panels { grid-template-columns: 1fr; }
  .space-v2-panel { min-height: 264px; }
}

@media (max-width: 640px) {
  .space-shell-dashboard { padding-top: 14px; }
  .space-v2-welcome {
    min-height: 300px;
    display: block;
    border-radius: 16px;
  }
  .space-v2-welcome-copy { padding: 28px 22px 110px; }
  .space-v2-welcome h1 { font-size: clamp(2rem, 10vw, 3rem); }
  .space-v2-intro { margin-top: 16px; font-size: .92rem; }
  .space-v2-welcome-art {
    position: absolute;
    inset: 0;
    height: auto;
    min-height: 0;
    opacity: 1;
  }
  .space-v2-welcome::before {
    background: linear-gradient(180deg, rgba(5, 5, 5, .96) 0%, rgba(5, 5, 5, .9) 52%, rgba(5, 5, 5, .54) 76%, rgba(5, 5, 5, .18) 100%);
  }
  .space-v2-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); border-radius: 14px; }
  .space-v2-kpi { min-height: 98px; padding: 12px; }
  .space-v2-kpi-label { min-height: 0; font-size: .65rem; }
  .space-v2-kpi strong { font-size: 1.8rem; }
  .space-v2-panels { gap: 16px; margin-top: 16px; }
  .space-v2-panel {
    min-height: 0;
    grid-template-columns: 1fr;
    border-radius: 16px;
  }
  .space-v2-panel-visual { min-height: 120px; max-height: 144px; }
  .space-v2-panel-icon { width: 92px; }
  .space-v2-panel-body { min-height: 228px; padding: 16px; }
  .space-v2-panel h2 { font-size: 2rem; }
  .space-v2-panel-lead { margin-top: 9px; font-size: .9rem; }
  .space-v2-panel-meta { margin-top: 9px; }
}

/* ---- Reservation de hauteur -------------------------------------------- */
/* `#espace` n'accueillait qu'un « Chargement de ton espace… » d'une ligne,
   puis passait a 2507px une fois l'API revenue : le pied de page remontait de
   221px SOUS les yeux du contributeur. On reserve donc la place jusqu'au bas
   du premier ecran, pour que le pied naisse hors champ et n'ait plus a sauter.
   `min-height` seulement : un contenu plus grand continue de gouverner.
   L'en-tete est en `position: fixed` et haut de 68px, d'ou la soustraction. */
#espace {
  min-height: calc(100vh - 68px);
  min-height: calc(100svh - 68px);
}
