/* Verdannet App Shell — Commandes SI, sidebar-only */
#app-shell {
  --commandes-sidebar-width: 248px;
  --commandes-sidebar-collapsed-width: 72px;
  display: grid;
  grid-template-columns: var(--commandes-sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns var(--vd-duration-base, .2s) var(--vd-ease, ease);
}

#app-shell.vd-sidebar-collapsed {
  grid-template-columns: var(--commandes-sidebar-collapsed-width) minmax(0, 1fr);
}

#app-shell > main { min-width: 0; }

#app-shell > .sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  width: auto;
  height: 100vh;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
}

#app-shell .sidebar nav a {
  display: grid;
  grid-template-columns: 1.7rem minmax(0, 1fr);
  align-items: center;
  gap: .65rem;
  min-height: 42px;
}

.vd-commandes-nav-icon {
  width: 1.7rem;
  height: 1.7rem;
  display: grid;
  place-items: center;
  border-radius: .52rem;
  background: rgb(255 255 255 / .08);
  color: #e8f2f7;
  font-size: .69rem;
  font-weight: 850;
  line-height: 1;
}

.sidebar nav a.active .vd-commandes-nav-icon {
  background: #fff;
  color: #294e69;
}

.vd-commandes-nav-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#app-shell .vd-commandes-sidebar-footer {
  display: grid;
  gap: .8rem;
  margin-top: auto;
  padding: .9rem 1rem 0;
  border-top: 1px solid rgb(255 255 255 / .11);
  color: rgb(255 255 255 / .68);
}

.vd-commandes-account {
  display: grid;
  grid-template-columns: 2.2rem minmax(0, 1fr);
  align-items: center;
  gap: .65rem;
}

.vd-commandes-account__avatar {
  width: 2.2rem;
  height: 2.2rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgb(255 255 255 / .12);
  color: #fff;
  font-size: .67rem;
  font-weight: 850;
}

.vd-commandes-account__copy {
  min-width: 0;
  display: grid;
  gap: .08rem;
}

.vd-commandes-account__copy > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vd-commandes-account__copy .nom { color: #fff; font-weight: 700; }
.vd-commandes-account__copy .user-role { color: rgb(255 255 255 / .5); font-size: .7rem; }

.vd-commandes-sidebar-preferences { display: grid; gap: .35rem; }
.vd-commandes-sidebar-label {
  color: rgb(255 255 255 / .4);
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

#app-shell .vd-commandes-display-controls--sidebar {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  padding: 3px;
  border: 1px solid rgb(255 255 255 / .1);
  border-radius: .7rem;
  background: rgb(255 255 255 / .055);
}

#app-shell .vd-commandes-display-controls--sidebar button {
  min-width: 0;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  padding: 0 .35rem;
  border: 0;
  border-radius: .55rem;
  background: transparent;
  color: rgb(255 255 255 / .65);
  font-size: .67rem;
  font-weight: 800;
}

#app-shell .vd-commandes-display-controls--sidebar button:hover { background: rgb(255 255 255 / .08); color: #fff; }
#app-shell .vd-commandes-display-controls--sidebar button[aria-pressed="true"] { background: #fff; color: #294e69; }

#app-shell .sidebar .logout-btn {
  min-height: 34px;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: .5rem;
  padding: 0 .45rem;
  border: 0;
  border-radius: .55rem;
  background: transparent;
  color: rgb(255 255 255 / .62);
  text-decoration: none;
}
#app-shell .sidebar .logout-btn:hover { background: rgb(255 255 255 / .07); color: #fff; }
.vd-commandes-logout-icon { width: 1.6rem; text-align: center; font-size: .9rem; }

.vd-commandes-sidebar-collapse {
  position: fixed;
  z-index: 70;
  top: 50%;
  left: calc(var(--commandes-sidebar-width) - .875rem);
  width: 1.75rem;
  height: 3.5rem;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--vd-border);
  border-radius: 999px;
  background: var(--vd-surface);
  color: var(--vd-primary);
  box-shadow: var(--vd-shadow-card);
  transform: translateY(-50%);
  transition: left var(--vd-duration-base, .2s) var(--vd-ease, ease), background .15s ease;
}
.vd-commandes-sidebar-collapse:hover { background: var(--vd-primary-soft); }
#app-shell.vd-sidebar-collapsed .vd-commandes-sidebar-collapse { left: calc(var(--commandes-sidebar-collapsed-width) - .875rem); }

#app-shell.vd-sidebar-collapsed > .sidebar { padding-inline: .55rem; }
#app-shell.vd-sidebar-collapsed .sidebar .brand { padding-inline: 0; text-align: center; }
#app-shell.vd-sidebar-collapsed .sidebar .brand .eyebrow,
#app-shell.vd-sidebar-collapsed .sidebar .brand .title,
#app-shell.vd-sidebar-collapsed .sidebar .section-label,
#app-shell.vd-sidebar-collapsed .sidebar .vd-commandes-nav-text,
#app-shell.vd-sidebar-collapsed .vd-commandes-account__copy,
#app-shell.vd-sidebar-collapsed .vd-commandes-sidebar-label { display: none; }
#app-shell.vd-sidebar-collapsed .sidebar nav a {
  grid-template-columns: 1.7rem;
  justify-content: center;
  padding-inline: .4rem;
  border-left-color: transparent;
}
#app-shell.vd-sidebar-collapsed .sidebar nav a.active { box-shadow: inset 3px 0 var(--vd-ambience-accent); }
#app-shell.vd-sidebar-collapsed .vd-commandes-nav-icon { margin-inline: auto; }
#app-shell.vd-sidebar-collapsed .vd-commandes-sidebar-footer { padding-inline: .2rem; }
#app-shell.vd-sidebar-collapsed .vd-commandes-account { grid-template-columns: 2.2rem; justify-content: center; }
#app-shell.vd-sidebar-collapsed .vd-commandes-display-controls--sidebar { grid-template-columns: 1fr; }
#app-shell.vd-sidebar-collapsed .vd-commandes-display-controls--sidebar button span:last-child { display: none; }
#app-shell.vd-sidebar-collapsed .sidebar .logout-btn { justify-content: center; padding-inline: 0; }

.vd-commandes-mobile-nav-toggle,
.vd-commandes-mobile-nav-close,
.vd-commandes-nav-backdrop { display: none; }

@media (max-width: 900px) {
  #app-shell,
  #app-shell.vd-sidebar-collapsed { display: block; }

  #app-shell > .sidebar,
  #app-shell.vd-sidebar-collapsed > .sidebar {
    position: fixed;
    z-index: 90;
    inset: 0 auto 0 0;
    width: min(20rem, 86vw);
    height: 100dvh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: 22px 0 16px;
    overflow-x: hidden;
    overflow-y: auto;
    background: linear-gradient(180deg, #17364c, #294e69);
    box-shadow: 18px 0 45px rgb(11 34 51 / .28);
    transform: translateX(-102%);
    transition: transform var(--vd-duration-base, .2s) var(--vd-ease, ease);
  }

  #app-shell.vd-nav-open > .sidebar { transform: translateX(0); }
  #app-shell .sidebar .brand,
  #app-shell.vd-sidebar-collapsed .sidebar .brand { display: block; padding: 0 52px 18px 20px; text-align: left; }
  #app-shell .sidebar .brand .eyebrow,
  #app-shell .sidebar .brand .title,
  #app-shell.vd-sidebar-collapsed .sidebar .brand .eyebrow,
  #app-shell.vd-sidebar-collapsed .sidebar .brand .title,
  #app-shell .sidebar .section-label,
  #app-shell.vd-sidebar-collapsed .sidebar .section-label,
  #app-shell .sidebar .vd-commandes-nav-text,
  #app-shell.vd-sidebar-collapsed .sidebar .vd-commandes-nav-text,
  #app-shell.vd-sidebar-collapsed .vd-commandes-account__copy,
  #app-shell.vd-sidebar-collapsed .vd-commandes-sidebar-label { display: initial; }
  #app-shell .sidebar nav { display: flex; flex: 1; flex-direction: column; gap: 1px; overflow: visible; }
  #app-shell .sidebar nav a,
  #app-shell.vd-sidebar-collapsed .sidebar nav a {
    width: 100%;
    grid-template-columns: 1.7rem minmax(0, 1fr);
    justify-content: stretch;
    padding: 9px 20px;
  }
  #app-shell .vd-commandes-sidebar-footer,
  #app-shell.vd-sidebar-collapsed .vd-commandes-sidebar-footer { display: grid; padding: .9rem 1rem 0; }
  #app-shell .vd-commandes-account,
  #app-shell.vd-sidebar-collapsed .vd-commandes-account { grid-template-columns: 2.2rem minmax(0, 1fr); justify-content: stretch; }
  #app-shell .vd-commandes-display-controls--sidebar,
  #app-shell.vd-sidebar-collapsed .vd-commandes-display-controls--sidebar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #app-shell.vd-sidebar-collapsed .vd-commandes-display-controls--sidebar button span:last-child { display: inline; }
  #app-shell .sidebar .logout-btn,
  #app-shell.vd-sidebar-collapsed .sidebar .logout-btn { justify-content: flex-start; padding-inline: .45rem; }

  .vd-commandes-sidebar-collapse { display: none; }
  .vd-commandes-mobile-nav-toggle {
    position: fixed;
    z-index: 80;
    top: 14px;
    left: 14px;
    width: 42px;
    height: 42px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--vd-border);
    border-radius: .68rem;
    background: var(--vd-surface);
    color: var(--vd-primary);
    box-shadow: var(--vd-shadow-card);
    font-size: 1.05rem;
  }
  .vd-commandes-mobile-nav-close {
    position: absolute;
    z-index: 2;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid rgb(255 255 255 / .12);
    border-radius: .6rem;
    background: rgb(255 255 255 / .08);
    color: #fff;
    font-size: 1.1rem;
  }
  .vd-commandes-nav-backdrop {
    position: fixed;
    z-index: 85;
    inset: 0;
    display: block;
    padding: 0;
    border: 0;
    background: rgb(12 34 50 / .46);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }
  #app-shell.vd-nav-open .vd-commandes-nav-backdrop { opacity: 1; pointer-events: auto; }
  #app-shell main { padding: 72px 16px 48px; }
}

@media (prefers-reduced-motion: reduce) {
  #app-shell,
  #app-shell > .sidebar,
  .vd-commandes-sidebar-collapse,
  .vd-commandes-nav-backdrop { transition: none; }
}
