/* ================================================================
   Panel Crème — Shell unifié (sidebar commune à toutes les pages)
   Mobile-first : bottom-nav. Desktop >=900px : rail vertical 208px.
   ================================================================ */

/* Subtle grid pattern en fond */
.panel-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(23,20,18,0.06) 1px, transparent 0);
  background-size: 24px 24px;
  pointer-events: none;
  z-index: 0;
}

.panel-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ================================================================
   SIDEBAR
   ================================================================ */

/* Mobile : bottom-nav fixe */
.sidebar {
  order: 2;
  width: 100%;
  background: #f5f2ea;
  border-top: 2px solid #e5e2da;
  padding: 8px 12px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-around;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 50;
  gap: 0.25rem;
}

.sidebar-logo { display: none; }

.side-nav {
  display: flex;
  flex: 1;
  gap: 0.25rem;
  justify-content: space-around;
  align-items: center;
}

.side-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 0.75rem;
  color: #a8a29e;
  text-decoration: none;
  border: 2px solid transparent;
  transition: transform 0.18s ease, box-shadow 0.18s ease, color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}
.side-link svg {
  width: 28px;
  height: 28px;
  transition: transform 0.2s ease;
}
.side-link:hover { color: #3905c8; }
.side-link:hover svg { transform: scale(1.08); }

.side-link.is-active {
  color: #3905c8 !important;
  background: rgba(57, 5, 200, 0.07);
  border: 2px solid #3905c8;
  box-shadow: 3px 3px 0 #171412;
  border-radius: 1rem;
}

.panel-shell { padding-bottom: 68px; }

.side-user { display: none; }

/* Mobile top brand bar */
.main-header-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 12px 16px;
  margin: -1.1rem -1rem 1rem;
  background: #f5f2ea;
  border-bottom: 2px solid #e5e2da;
  position: sticky;
  top: 0;
  z-index: 40;
}
.main-header-brand .mhb-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.main-header-brand img {
  width: 96px;
  height: auto;
  display: block;
}
.main-header-brand .brand-name {
  font-family: "Labil", Arial, sans-serif;
  font-size: 8px;
  letter-spacing: 0.35em;
  color: #171412;
  font-weight: 700;
  text-transform: uppercase;
  background: #ffea29;
  padding: 4px 12px;
  border-radius: 6px;
  border: 2px solid #171412;
  box-shadow: 3px 3px 0 #171412;
  transform: rotate(-2deg);
  display: inline-block;
}
.main-header-brand .mhb-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}
.main-header-brand .brand-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #ffea29;
  color: #171412;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 10px;
  border: 2px solid #171412;
  flex-shrink: 0;
  cursor: pointer;
  overflow: hidden;
}
.main-header-brand .brand-avatar.has-logo {
  background: #fff;
}
.main-header-brand .brand-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.main-header-brand .brand-lines {
  line-height: 1.15;
  min-width: 0;
}
.main-header-brand .brand-user {
  font-size: 11px;
  font-weight: 700;
  color: #171412;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.main-header-brand .brand-role {
  font-size: 8px;
  color: #78716c;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

/* ================================================================
   MAIN
   ================================================================ */

.main {
  order: 1;
  flex: 1;
  padding: 1.1rem 1rem 2rem;
  max-width: 100%;
  overflow-x: hidden;
}

/* ================================================================
   DESKTOP (min-width: 900px)
   ================================================================ */

@media (min-width: 900px) {
  .panel-shell { flex-direction: row; padding-bottom: 0; }

  .sidebar {
    order: 0;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    width: 13rem;
    height: 100vh;
    position: sticky;
    top: 0; bottom: auto; left: auto; right: auto;
    padding: 3rem 1.5rem;
    gap: 0;
    border-top: none;
    border-right: 2px solid #e5e2da;
    box-shadow: none;
    background: #f5f2ea;
  }

  .sidebar-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    margin-bottom: 4rem;
    padding: 0;
    width: 100%;
    text-align: center;
    animation: sidebar-in 0.6s cubic-bezier(0.22, 1, 0.36, 1) both 0.1s;
  }
  .sidebar-logo a {
    display: inline-block;
    margin-bottom: 0.5rem;
    line-height: 0;
  }
  .sidebar-logo img {
    width: 11rem;
    height: auto;
    transition: opacity 0.2s ease;
  }
  .sidebar-logo a:hover img { opacity: 0.8; }
  .sidebar-logo span {
    font-family: Labil, Arial, sans-serif;
    font-size: 0.6875rem;
    letter-spacing: 0.35em;
    color: #171412;
    font-weight: 700;
    text-transform: uppercase;
    background: #ffea29;
    padding: 5px 16px;
    border-radius: 8px;
    border: 2px solid #171412;
    box-shadow: 4px 4px 0 #171412;
    transform: rotate(-2deg);
    display: inline-block;
  }

  .side-nav {
    flex-direction: column;
    gap: 2.5rem;
    flex: 1;
    justify-content: flex-start;
    align-items: center;
    padding-top: 0;
    width: 100%;
    animation: sidebar-in 0.6s cubic-bezier(0.22, 1, 0.36, 1) both 0.2s;
  }

  .side-link {
    width: 7rem;
    height: 7rem;
    border-radius: 1rem;
  }
  .side-link svg { width: 3.25rem; height: 3.25rem; }
  .side-link.is-active { box-shadow: 3px 3px 0 #171412; }

  .side-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: auto;
    padding-top: 2.5rem;
    border-top: 1px solid #e5e2da;
    width: 100%;
    animation: sidebar-in 0.6s cubic-bezier(0.22, 1, 0.36, 1) both 0.45s;
  }
  .side-user-avatar {
    width: 3rem; height: 3rem;
    border-radius: 50%;
    background: #ffea29;
    color: #171412;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    letter-spacing: 0.02em;
    border: 2px solid #171412;
    box-shadow: 3px 3px 0 #171412;
    flex-shrink: 0;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
  }
  .side-user-avatar.has-logo {
    background: #fff;
  }
  .side-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }
  .side-user-avatar:hover { transform: translate(-1px, -2px); box-shadow: 4px 5px 0 #171412; }
  .side-user-info { overflow: hidden; flex: 1; min-width: 0; }
  .side-user-name {
    font-size: 0.75rem;
    font-weight: 800;
    color: #171412;
    line-height: 1.25;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    margin-bottom: 4px;
  }
  .side-user-role {
    font-size: 0.5625rem;
    color: #78716c;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }

  .main-header-brand { display: none; }

  @keyframes sidebar-in {
    from { opacity: 0; transform: translateX(-20px); }
    to   { opacity: 1; transform: translateX(0); }
  }

  .main {
    padding: 2.5rem clamp(1.5rem, 3.5vw, 3rem);
    max-width: none;
    width: 100%;
  }

  .main-header { margin-bottom: 2.25rem; }
}

@media (min-width: 1200px) {
  .main { padding: 2.5rem 3rem; }
}

