/* =============================================================================
   GNM Radar — layout.css (refonte)
   Coquille de l'espace client : sidebar stable, barre haute compacte, zone de
   contenu dense, disposition de l'authentification, responsive.
   ========================================================================== */

.app-root { min-height: 100vh; display: flex; flex-direction: column; }

/* ------------------------------------------------------ Shell applicatif */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  width: 100%;
}

/* ---------------------------------------------------------------- Sidebar */

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-3);
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 40;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 8px 8px;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--sp-3);
}
.sidebar__brand:hover { text-decoration: none; }

.brand-mark {
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: var(--r);
  background: var(--accent);
  display: grid;
  place-items: center;
  color: var(--accent-fg);
}

.brand-name { font-weight: 700; letter-spacing: -0.01em; font-size: var(--fs-14); }
.brand-name span { color: var(--text-2); font-weight: 600; }

.sidebar__section {
  font-size: var(--fs-11);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-3);
  font-weight: 650;
  padding: 0 8px;
  margin-bottom: 2px;
}

.sidebar__nav { display: grid; gap: 1px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border-radius: var(--r);
  color: var(--text-2);
  font-size: var(--fs-13);
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }

.nav-item.is-active {
  background: var(--accent-soft);
  border-color: rgba(255, 138, 61, 0.3);
  color: var(--text);
  box-shadow: inset 2px 0 0 var(--accent);
}

.nav-item__icon { display: flex; flex: none; color: currentColor; opacity: 0.9; }
.nav-item__label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.nav-item__count {
  font-size: var(--fs-11);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
  background: var(--surface-3);
  border-radius: var(--r-sm);
  padding: 0 5px;
}

.sidebar__foot {
  margin-top: auto;
  display: grid;
  gap: var(--sp-2);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
}

.plan-mini {
  display: grid;
  gap: 6px;
  padding: 10px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--border);
}

.plan-mini__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--fs-12);
  color: var(--text-3);
}
.plan-mini__row b { color: var(--text-2); font-weight: 650; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------- Barre haute */

.topbar {
  position: sticky;
  top: 0;
  /* Au-dessus de la barre latérale (40) : le bouton burger reste cliquable
     pour refermer le tiroir de navigation sur mobile. */
  z-index: 45;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  height: var(--topbar-h);
  padding: 0 var(--sp-5);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

:root[data-theme="light"] .topbar { background: color-mix(in srgb, var(--bg) 90%, transparent); }

.topbar__title { font-size: var(--fs-14); font-weight: 650; color: var(--text); }
.topbar__meta { font-size: var(--fs-12); color: var(--text-3); display: flex; align-items: center; gap: var(--sp-3); }
.topbar__spacer { flex: 1 1 auto; }

.burger { display: none; }

/* ---------------------------------------------------------------- Contenu */

.main { display: flex; flex-direction: column; min-width: 0; }

.content {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--sp-5);
  display: grid;
  gap: var(--sp-4);
  align-content: start;
}

.view { display: grid; gap: var(--sp-4); align-content: start; animation: gnm-fade var(--dur) var(--ease); }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}
.page-head__title { font-size: var(--fs-20); font-weight: 650; }
.page-head__sub { font-size: var(--fs-13); color: var(--text-3); margin-top: 2px; }
.page-head__actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }

/* Panneau latéral de détail (fiche cible) */
.detail-side { display: grid; gap: var(--sp-4); align-content: start; }

/* Barre de navigation mobile */
.nav-scrim { display: none; }

/* ------------------------------------------------------------------- Compte */

.account { display: flex; align-items: center; gap: var(--sp-2); }
.account__name { font-size: var(--fs-13); font-weight: 600; color: var(--text-2); }

/* ---------------------------------------------------------- Authentification */

.auth {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 100vh;
}
@media (min-width: 960px) {
  /* Deux colonnes équilibrées : le message et le formulaire ont le même poids
     visuel, aucun n'est repoussé au bord de l'écran. */
  .auth { grid-template-columns: minmax(0, 1.04fr) minmax(0, 0.96fr); }
}

.auth__panel {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: var(--sp-5);
  padding: var(--sp-7) var(--sp-6);
}

.auth__brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.auth__brand:hover { text-decoration: none; }
.auth__title { font-size: var(--fs-24); font-weight: 650; letter-spacing: -0.02em; }
.auth__sub { font-size: var(--fs-14); color: var(--text-2); max-width: 46ch; line-height: 1.6; }
.auth__points { display: grid; gap: var(--sp-3); margin-top: var(--sp-2); }
.auth__point { display: flex; gap: var(--sp-3); align-items: flex-start; font-size: var(--fs-13); color: var(--text-2); line-height: 1.55; }
.auth__point svg { flex: none; color: var(--accent); margin-top: 2px; }

.auth__box {
  display: grid;
  gap: var(--sp-4);
  padding: var(--sp-5);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-2);
  width: min(430px, 100%);
}

.auth__aside {
  display: none;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  padding: var(--sp-7) var(--sp-6);
  align-content: center;
  gap: var(--sp-5);
}
@media (min-width: 960px) { .auth__aside { display: grid; } }

/* Le contenu reste mesuré quel que soit l'écran : pas de vide béant. */
.auth__aside-inner {
  display: grid;
  gap: var(--sp-5);
  width: min(470px, 100%);
  margin: 0 auto;
}

.auth__headline {
  font-size: clamp(24px, 2.4vw, 30px);
  font-weight: 680;
  letter-spacing: -0.025em;
  line-height: 1.18;
  max-width: 20ch;
  text-wrap: balance;
}

.auth__aside-foot {
  font-size: var(--fs-12);
  color: var(--text-3);
  line-height: 1.6;
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border);
}

.auth__foot { font-size: var(--fs-13); color: var(--text-3); text-align: center; }
.auth__foot a { font-weight: 600; }

/* -------------------------------------------------------------- Responsive */

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(300px, 84vw);
    transform: translateX(-102%);
    transition: transform var(--dur) var(--ease);
    box-shadow: var(--shadow-3);
  }

  .shell.is-nav-open .sidebar { transform: none; }

  .shell.is-nav-open .nav-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: var(--overlay);
  }

  .burger { display: inline-flex; }
  .topbar { padding: 0 var(--sp-4); gap: var(--sp-2); }
  /* La barre haute ne doit jamais imposer sa largeur minimale : le libellé
     du compte et l'intitulé de page tronquent sur écran étroit. */
  .topbar__title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar__meta { gap: var(--sp-2); }
  .account__name, .account .badge { display: none; }
  .content { padding: var(--sp-4); }
}

@media (max-width: 640px) {
  .kpi__value { font-size: var(--fs-24); }
  .page-head__title { font-size: var(--fs-18, 18px); }
  /* Centrage « sûr » : formulaire court centré, formulaire long accroché en
     haut (jamais de contenu coupé en haut d'écran). */
  .auth__panel { align-content: safe center; padding: var(--sp-6) var(--sp-4) var(--sp-7); }
  .auth__box { padding: var(--sp-4); }
}
