/* layout.css — barre supérieure, barre latérale, zone de contenu, grilles de page. */

/* --- Barre supérieure ------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-h); display: flex; align-items: center; gap: var(--sp-4);
  padding: 0 var(--sp-4); background: var(--c-surface); border-bottom: 1px solid var(--c-border);
}
.topbar-brand { display: inline-flex; align-items: center; gap: var(--sp-2); font-weight: 700; font-size: var(--fs-lg); color: var(--c-text); }
.topbar-brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  background: var(--c-primary); color: var(--c-text-invert); font-weight: 700; font-size: var(--fs-lg);
}
.brand-logo { height: 32px; width: auto; max-width: 180px; object-fit: contain; }
.topbar-toggle { display: none; background: none; border: 0; font-size: 1.5rem; line-height: 1; padding: var(--sp-1); cursor: pointer; }
.topbar-user { margin-left: auto; display: flex; flex-wrap: nowrap; align-items: center; gap: var(--sp-2); }
.topbar-user-name { font-weight: 500; white-space: nowrap; }
/* Sélecteur de langue : une seule ligne (icône + liste), jamais de retour à la ligne. */
form.lang-switch { display: inline-flex; flex: 0 0 auto; flex-wrap: nowrap; align-items: center; gap: var(--sp-1); margin: 0 var(--sp-2) 0 0; color: var(--c-text-muted); white-space: nowrap; }
.lang-switch .bi { flex: 0 0 auto; line-height: 1; }
.lang-switch select { flex: 0 0 auto; width: auto; min-height: 0; height: 28px; padding: 0 22px 0 6px; font-size: var(--fs-sm); line-height: 26px; border: 1px solid var(--c-border); border-radius: var(--radius-sm); background-color: var(--c-surface); color: var(--c-text); }
.page-auth .lang-switch { justify-content: center; width: 100%; margin: var(--sp-2) 0 var(--sp-3); }

/* Sélecteur société / boutique */
.scope-selector { display: flex; gap: var(--sp-2); align-items: center; }
.scope-selector select { max-width: 220px; }

/* --- Barre latérale + contenu ----------------------------------------- */
.layout { display: flex; min-height: calc(100vh - var(--topbar-h)); }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 auto; display: flex; flex-direction: column;
  background: var(--c-surface); border-right: 1px solid var(--c-border);
  position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto;
}
.sidebar-menu { list-style: none; margin: 0; padding: var(--sp-3) var(--sp-2); }
.sidebar-menu a {
  display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm); color: var(--c-text); font-size: var(--fs-sm);
}
.sidebar-menu a:hover { background: var(--c-surface-2); text-decoration: none; }
.sidebar-menu a.active { background: var(--c-primary-soft); color: var(--c-primary); font-weight: 600; }
.sidebar-menu i { font-size: 1.1rem; width: 1.25rem; text-align: center; }
.sidebar-sep { height: 1px; margin: var(--sp-2) var(--sp-3); background: var(--c-border); }
.sidebar-footer { margin-top: auto; padding: var(--sp-3) var(--sp-4); font-size: var(--fs-xs); }

.content { flex: 1 1 auto; min-width: 0; padding: var(--sp-5) var(--sp-5) var(--sp-8); max-width: var(--content-max); }

/* --- En-tête de page et grilles ---------------------------------------- */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-5); }
.page-header h1 { margin-bottom: var(--sp-1); }
.page-header p { margin: 0; }
.page-actions { display: flex; gap: var(--sp-2); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-4); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--sp-4); margin-bottom: var(--sp-5); }

/* --- Pages hors layout (login, erreur) ---------------------------------- */
.page-auth { display: grid; place-items: center; padding: var(--sp-4); }
.auth-card { width: 100%; max-width: 400px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-lg); padding: var(--sp-6); box-shadow: var(--shadow); }
.auth-brand { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-5); }
.auth-brand h1 { margin: 0; font-size: var(--fs-xl); }
.auth-brand small { color: var(--c-text-muted); font-weight: 400; }
.auth-footer { margin: var(--sp-5) 0 0; font-size: var(--fs-xs); color: var(--c-text-muted); text-align: center; }

/* --- Responsive --------------------------------------------------------- */
@media (max-width: 900px) {
  .brand-logo { height: 32px; width: auto; max-width: 180px; object-fit: contain; }
.topbar-toggle { display: inline-block; }
  .topbar-user-name { display: none; }
  .scope-selector { flex: 1; }
  .scope-selector select { max-width: none; flex: 1; }
  .sidebar { position: fixed; left: 0; transform: translateX(-100%); transition: transform .2s; z-index: 40; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .content { padding: var(--sp-4); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
