.app-shell {
  display: flex;
  min-height: 100%;
  background: var(--oghma-bg);
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-shrink: 0;
  flex-direction: column;
  width: var(--oghma-sidebar-w);
  height: 100vh;
  padding: 18px 14px 16px;
  color: #e8ecf8;
  background:
    radial-gradient(1200px 420px at -10% -20%, rgba(var(--oghma-gold-rgb), 0.22), transparent 55%),
    linear-gradient(180deg, #1c2c3d 0%, var(--oghma-navy) 58%, #101820 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  isolation: isolate;
  transition: width 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.sidebar-glow {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.sidebar-glow::before {
  content: '';
  position: absolute;
  right: -80px;
  bottom: 80px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--oghma-steel-rgb), 0.28), transparent 68%);
}

.brand {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  margin-bottom: 22px;
  padding: 0 6px;
}

.logo-mark {
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
}

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

.brand-lockup {
  display: block;
  flex: 1;
  min-width: 0;
  width: 100%;
  height: auto;
  object-fit: contain;
  object-position: left center;
}

.app-shell:not(.is-collapsed) .logo-mark {
  display: none;
}

.brand-copy {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  opacity: 1;
  transition: opacity 0.18s ease;
}

.brand-name {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand-tag {
  display: block;
  color: rgba(232, 236, 248, 0.55);
  font-size: 0.72rem;
}

.collapse-btn,
.logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0;
  padding: 0;
  color: inherit;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  cursor: pointer;
}

.collapse-btn {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
}

.collapse-btn:hover,
.logout-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-height: 0;
}

.nav-section {
  margin: 16px 10px 6px;
  color: rgba(232, 236, 248, 0.42);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item,
.logout-btn {
  position: relative;
  height: 44px;
  padding: 0 12px;
  color: rgba(232, 236, 248, 0.72);
  text-decoration: none;
  border-radius: 12px;
  white-space: nowrap;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.nav-item .icon,
.logout-btn .icon {
  flex: 0 0 24px;
  font-size: 22px;
  width: 24px;
  height: 24px;
}

.nav-item:hover,
.nav-item.is-active {
  color: #fff;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.nav-item.is-active {
  background: linear-gradient(135deg, rgba(var(--oghma-gold-rgb), 0.28), rgba(var(--oghma-steel-rgb), 0.16));
  box-shadow: inset 0 0 0 1px rgba(var(--oghma-gold-rgb), 0.36);
}

.nav-item.is-active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 99px;
  background: var(--oghma-grad);
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.user-chip {
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 6px 8px;
}

.user-avatar {
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--oghma-navy);
  background: var(--oghma-grad);
}

.user-meta {
  min-width: 0;
  overflow: hidden;
}

.user-email,
.user-role {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-email {
  max-width: 100%;
  font-size: 0.78rem;
  font-weight: 600;
}

.user-role {
  color: rgba(232, 236, 248, 0.5);
  font-size: 0.7rem;
}

.logout-btn {
  width: 100%;
  justify-content: flex-start;
}

.app-shell.is-collapsed .sidebar {
  width: var(--oghma-sidebar-collapsed);
  padding-left: 12px;
  padding-right: 12px;
}

.app-shell.is-collapsed .brand {
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  margin-bottom: 18px;
  padding: 0;
}

.app-shell.is-collapsed .brand-lockup,
.app-shell.is-collapsed .brand-copy,
.app-shell.is-collapsed .nav-section,
.app-shell.is-collapsed .user-meta {
  display: none;
}

/* Libellés masqués visuellement mais conservés dans l'arbre d'accessibilité (nom accessible des liens). */
.app-shell.is-collapsed .nav-label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.app-shell.is-collapsed .collapse-btn {
  position: static;
  margin: 0 auto;
}

.app-shell.is-collapsed .nav-item.is-active::before {
  display: none;
}

.app-shell.is-collapsed .nav-item,
.app-shell.is-collapsed .logout-btn {
  width: 48px;
  min-width: 48px;
  max-width: 48px;
  margin-inline: auto;
  justify-content: center;
  padding: 0;
}

.app-shell.is-collapsed .user-chip {
  justify-content: center;
  padding: 6px 0;
}

.shell-main {
  position: relative;
  flex: 1;
  min-width: 0;
}

.shell-canvas {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(900px 420px at 12% -10%, rgba(var(--oghma-gold-rgb), 0.16), transparent 55%),
    radial-gradient(700px 380px at 100% 0%, rgba(var(--oghma-steel-rgb), 0.14), transparent 50%),
    linear-gradient(180deg, #f4f6f9 0%, var(--oghma-bg) 100%);
  pointer-events: none;
}

.shell-content {
  position: relative;
  padding: 28px 32px 40px;
  min-height: 100vh;
}

.page-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 22px;
}

.page-header h1 {
  overflow-wrap: anywhere;
  margin: 0;
  font-size: 1.7rem;
  font-weight: 700;
}

.page-kicker {
  margin: 0;
  color: var(--oghma-muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.page-subtitle,
.page-header p {
  overflow-wrap: anywhere;
  margin: 0;
  color: var(--oghma-muted);
  max-width: 62ch;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  margin-bottom: 4px;
  color: var(--oghma-muted);
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
}

.back-link:hover {
  color: var(--oghma-gold-deep);
}

.back-link .icon {
  font-size: 18px;
  width: 18px;
  height: 18px;
}

.page-grid {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.page-stack {
  display: grid;
  gap: 20px;
}

.auth-page {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100vh;
  overflow: hidden;
  padding: 32px 20px;
  background: var(--oghma-navy);
}

.auth-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(10px);
  pointer-events: none;
}

.auth-orb-a {
  top: -120px;
  left: -80px;
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, rgba(var(--oghma-gold-rgb), 0.48), transparent 68%);
}

.auth-orb-b {
  right: -80px;
  bottom: -140px;
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, rgba(var(--oghma-steel-rgb), 0.48), transparent 68%);
}

.auth-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
  color: #eef1f8;
  text-align: center;
}

.auth-brand .logo-mark {
  width: 96px;
  height: 96px;
  flex-basis: 96px;
  margin-bottom: 6px;
}

.auth-brand h1 {
  margin: 0;
  font-size: 1.8rem;
}

.auth-brand p {
  margin: 0;
  color: rgba(238, 241, 248, 0.62);
}

.auth-card {
  padding: 24px;
  background: rgba(255, 255, 255, 0.94);
}

@media (max-width: 960px) {
  .page-grid {
    grid-template-columns: 1fr;
  }

  .shell-content {
    padding: 20px 16px 32px;
  }
}

@media (max-width: 720px) {
  .sidebar {
    position: fixed;
  }

  .shell-main {
    margin-left: var(--oghma-sidebar-collapsed);
  }

  .app-shell:not(.is-collapsed) .shell-main::after {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(var(--oghma-navy-rgb), 0.45);
    pointer-events: none;
  }
}

/* Infobulles de la barre latérale : à droite, et seulement quand elle est repliée (libellés masqués). */
.sidebar [data-tooltip]::after {
  top: 50%;
  bottom: auto;
  left: calc(100% + 10px);
  transform: translateY(-50%);
}

.app-shell:not(.is-collapsed) .sidebar [data-tooltip]::after {
  display: none;
}

.logout-btn .icon {
  flex: 0 0 24px;
}

.sidebar-footer form {
  margin: 0;
}

.btn--block {
  width: 100%;
}

.auth-lockup {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-bottom: 6px;
  padding: 18px 22px;
  overflow: hidden;
  border-radius: var(--oghma-radius);
}

.auth-lockup img {
  display: block;
  width: 100%;
  max-width: 380px;
  height: auto;
  object-fit: contain;
}

.auth-card .card__title {
  margin: 0 0 4px;
  font-size: 1.25rem;
}

.auth-card form {
  margin-top: 16px;
}

.auth-card .hint {
  margin: 0;
}

/* Administration : navigation segmentée et en-tête de sous-page */
.segmented-nav {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 100%;
  padding: 4px;
  border: 1px solid var(--oghma-line);
  border-radius: 999px;
  background: rgba(var(--oghma-steel-rgb), 0.08);
}

.segmented-nav__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 999px;
  color: var(--oghma-muted);
  font-weight: 600;
  text-decoration: none;
}

.segmented-nav__item:hover {
  color: var(--oghma-ink);
}

.segmented-nav__item.is-active {
  background: var(--oghma-grad);
  color: var(--oghma-navy);
  box-shadow: 0 4px 12px rgba(var(--oghma-gold-rgb), 0.35);
}

.subpage-header {
  display: grid;
  gap: 4px;
  margin: 8px 0 16px;
}

.subpage-header h2 {
  margin: 0;
  font-family: var(--oghma-font-display);
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Recherche globale (R-93) */
.sidebar-search {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 14px;
}

.sidebar-search .icon {
  position: absolute;
  left: 10px;
  font-size: 20px;
  color: rgba(255, 255, 255, 0.6);
  pointer-events: none;
}

.sidebar-search input {
  width: 100%;
  padding: 9px 10px 9px 38px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  font: inherit;
}

.sidebar-search input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.nav-search {
  display: none;
}

.app-shell.is-collapsed .sidebar-search {
  display: none;
}

.app-shell.is-collapsed .nav-search {
  display: flex;
}
