/* ==========================================================================
   GABONIMMO — ESPACES SÉPARÉS PAR RÔLE
   Chaque rôle a son tableau de bord : indicateurs, alertes actionnables,
   raccourcis et sections. Mobile-first : 1 colonne sous 768px.
   ========================================================================== */

/* --- Bandeau d'identité de l'espace ------------------------------------- */
.sp-hero {
  border-radius: 16px;
  padding: 20px;
  color: #fff;
  background: linear-gradient(150deg, #B4532A, #7C3517);
  position: relative;
  overflow: hidden;
}
.sp-hero::after {
  content: "";
  position: absolute;
  right: -40px; top: -40px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .07);
}
.sp-hero-top {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}
.sp-hero-avatar {
  width: 54px; height: 54px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .18);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.05rem;
  overflow: hidden;
  flex: 0 0 auto;
}
.sp-hero-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sp-hero-txt { flex: 1 1 200px; min-width: 0; }
.sp-hero-txt .sp-kicker {
  margin: 0;
  font-size: .72rem;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .72);
  font-weight: 600;
}
.sp-hero-txt h1 {
  font-size: 1.32rem;
  margin: 3px 0 4px;
  color: #fff;
  line-height: 1.25;
}
.sp-hero-txt p {
  margin: 0;
  font-size: .88rem;
  color: rgba(255, 255, 255, .84);
  line-height: 1.45;
}
.sp-hero-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
  position: relative;
  z-index: 1;
}
.sp-hero-actions .btn {
  padding: 8px 16px;
  font-size: .86rem;
  border-radius: 7px;
}

/* --- Sélecteur d'espace (basculer d'un rôle à l'autre) ------------------ */
.sp-switch {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 2px 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.sp-switch::-webkit-scrollbar { display: none; }
.sp-switch a {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 7px;
  border: 1px solid var(--line, #E7DED3);
  background: #fff;
  color: var(--ink, #2A2118);
  font-size: .84rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.sp-switch a.is-on {
  background: var(--terra, #B4532A);
  border-color: var(--terra, #B4532A);
  color: #fff;
  font-weight: 600;
}

/* --- Grille des indicateurs -------------------------------------------- */
.sp-kpis {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 560px) {
  .sp-kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 980px) {
  .sp-kpis { grid-template-columns: repeat(3, 1fr); }
}
.sp-kpi {
  display: block;
  background: #fff;
  border: 1px solid var(--line, #E7DED3);
  border-radius: 14px;
  padding: 15px 16px;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 2px 8px rgba(15, 15, 26, .05);
  transition: transform .16s ease, box-shadow .16s ease;
}
.sp-kpi:hover,
.sp-kpi:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(15, 15, 26, .10);
}
.sp-kpi-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.sp-kpi-ico {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: #F4EDE4;
  color: var(--terra, #B4532A);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.sp-kpi-lib {
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .02em;
  color: #6B5C4E;
  text-transform: uppercase;
  line-height: 1.25;
}
.sp-kpi-val {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--ink, #2A2118);
  word-break: break-word;
}
.sp-kpi-note {
  display: block;
  margin-top: 5px;
  font-size: .78rem;
  color: #8A7A6B;
  line-height: 1.4;
}
.sp-kpi-ok .sp-kpi-ico { background: #E7F3EC; color: #2C6E5A; }
.sp-kpi-warn .sp-kpi-ico { background: #FDF3DE; color: #9A6B10; }
.sp-kpi-danger .sp-kpi-ico { background: #FBEAE7; color: #A8342A; }
.sp-kpi-warn .sp-kpi-val { color: #9A6B10; }
.sp-kpi-danger .sp-kpi-val { color: #A8342A; }

/* --- Deux colonnes : colonne principale + latérale ---------------------- */
.sp-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 18px;
}
@media (min-width: 900px) {
  .sp-layout { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
}

/* --- Rangées cliquables (façon maquette) ------------------------------- */
.sp-list {
  background: #fff;
  border: 1px solid var(--line, #E7DED3);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(15, 15, 26, .05);
}
.sp-list-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line, #E7DED3);
  background: #FBF7F2;
}
.sp-list-head h2 {
  margin: 0;
  font-size: .95rem;
  font-weight: 700;
  color: var(--ink, #2A2118);
}
.sp-list-head .sp-count {
  margin-left: auto;
  font-size: .76rem;
  font-weight: 600;
  color: #8A7A6B;
}
.sp-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid #F1E9DF;
  text-decoration: none;
  color: inherit;
  min-height: 56px;
  box-sizing: border-box;
}
.sp-row:last-child { border-bottom: none; }
.sp-row:hover,
.sp-row:focus-visible { background: #FBF7F2; }
.sp-row-ico {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: #F4EDE4;
  color: var(--terra, #B4532A);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.sp-row-txt { flex: 1 1 auto; min-width: 0; }
.sp-row-txt strong {
  display: block;
  font-size: .92rem;
  font-weight: 600;
  color: var(--ink, #2A2118);
  line-height: 1.3;
}
.sp-row-txt small {
  display: block;
  font-size: .79rem;
  color: #8A7A6B;
  line-height: 1.35;
  margin-top: 2px;
}
.sp-row-chev { color: #C0B0A0; flex: 0 0 auto; display: inline-flex; }

/* --- Alertes actionnables --------------------------------------------- */
.sp-alert {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line, #E7DED3);
  background: #fff;
  margin-bottom: 10px;
}
.sp-alert:last-child { margin-bottom: 0; }
.sp-alert-ico {
  width: 32px; height: 32px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  background: #F4EDE4;
  color: var(--terra, #B4532A);
}
.sp-alert-txt { flex: 1 1 auto; min-width: 0; }
.sp-alert-txt strong {
  display: block;
  font-size: .89rem;
  font-weight: 600;
  color: var(--ink, #2A2118);
  line-height: 1.3;
}
.sp-alert-txt p {
  margin: 3px 0 0;
  font-size: .81rem;
  color: #6B5C4E;
  line-height: 1.42;
}
.sp-alert-txt .btn {
  margin-top: 9px;
  padding: 6px 13px;
  font-size: .79rem;
  border-radius: 6px;
}
.sp-alert-warn { border-color: #F0DCAE; background: #FFFBF1; }
.sp-alert-warn .sp-alert-ico { background: #FDF3DE; color: #9A6B10; }
.sp-alert-danger { border-color: #F0C9C2; background: #FFF8F6; }
.sp-alert-danger .sp-alert-ico { background: #FBEAE7; color: #A8342A; }

/* --- Chiffres à retenir (petites statiques) ---------------------------- */
.sp-essentiel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 10px;
}
@media (min-width: 560px) {
  .sp-essentiel { grid-template-columns: repeat(2, 1fr); }
}
.sp-ess {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 10px;
  background: #FBF7F2;
  border: 1px solid #F1E9DF;
}
.sp-ess-lib { font-size: .82rem; color: #6B5C4E; line-height: 1.3; }
.sp-ess-val { font-size: 1.02rem; font-weight: 700; color: var(--ink, #2A2118); }
.sp-ess-ok .sp-ess-val { color: #2C6E5A; }

/* --- Bloc « à compléter » (invitation honnête) ------------------------ */
.sp-vide {
  text-align: center;
  padding: 26px 18px;
  color: #8A7A6B;
  font-size: .87rem;
  line-height: 1.5;
}
.sp-vide .btn { margin-top: 12px; padding: 8px 18px; font-size: .85rem; border-radius: 7px; }

/* --- Titres de section ------------------------------------------------- */
.sp-section { margin-top: 20px; }
.sp-section > h2 {
  font-size: 1.02rem;
  font-weight: 700;
  margin: 0 0 10px;
  color: var(--ink, #2A2118);
}
