/**
 * Unified left navigation panel (js/shell.js, instance option UI_SHELL=sidebar).
 * Same layout as the portal and the CAMO module: 240 px panel from 1024 px, top bar + drawer below.
 * Colours follow the instance theme (--brand, --brand-dark from BRAND_COLOR).
 */
.shell-topbar,
.shell-panel,
.shell-backdrop { display: none; }

body.has-shell { padding-left: 0; }

body.has-shell .shell-panel {
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  width: 240px;
  background: var(--brand-dark, #0f1f33);
  color: #fff;
  z-index: 1000;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  font-family: var(--font-sans);
}

.shell-close { display: none; }

.shell-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  text-decoration: none;
}
.shell-brand img { height: 32px; width: auto; }
.shell-brand-text { display: flex; flex-direction: column; min-width: 0; }
.shell-brand-text strong { font-size: 0.85rem; letter-spacing: 0.04em; }
.shell-brand-text small { font-size: 0.68rem; color: rgba(255, 255, 255, 0.6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.shell-apps {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 0.25rem;
  padding: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.shell-apps a {
  padding: 0.35rem 0.4rem;
  border-radius: 6px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.shell-apps a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.shell-apps a.is-current { background: #fff; color: var(--brand, #1e3a5f); }

.shell-nav { flex: 1; overflow-y: auto; padding: 1rem 0.75rem; }
.shell-group + .shell-group { margin-top: 1.25rem; }
.shell-group-label {
  padding: 0 0.75rem 0.35rem;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}
.shell-nav a {
  display: block;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
}
.shell-nav a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.shell-nav a.is-active { background: var(--brand, #2c5aa0); color: #fff; box-shadow: inset 3px 0 0 #fff; }

.shell-footer {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.75rem;
}
.shell-lang { display: inline-flex; align-self: flex-start; border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 6px; overflow: hidden; }
.shell-lang button {
  padding: 0.25rem 0.6rem;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.shell-lang button.is-active { background: #fff; color: var(--brand, #1e3a5f); }
.shell-user { color: rgba(255, 255, 255, 0.7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shell-signout {
  align-self: flex-start;
  padding: 0.35rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  background: transparent;
  color: #fff;
  font: inherit;
  cursor: pointer;
}
.shell-signout:hover { background: rgba(255, 255, 255, 0.1); }

/* page content beside the panel; the page's own header keeps its title and actions */
@media (min-width: 1024px) {
  body.has-shell { padding-left: 240px; }
  body.has-shell .app-header .brand-badge,
  body.has-shell .header .brand-badge,
  body.has-shell .details-topbar .brand-badge { display: none; }
}

/* below 1024 px: top bar with ☰, panel slides in */
@media (max-width: 1023.98px) {
  body.has-shell .shell-topbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    height: 56px;
    padding: 0 1rem;
    background: var(--brand-dark, #0f1f33);
    color: #fff;
  }
  .shell-open {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #fff;
    font-size: 1.25rem;
    cursor: pointer;
  }
  .shell-open:hover { background: rgba(255, 255, 255, 0.1); }
  .shell-topbar-title { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  body.has-shell .shell-panel {
    max-width: 85vw;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  }
  body.shell-open-drawer .shell-panel { transform: none; }
  body.shell-open-drawer .shell-backdrop:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
  }
  .shell-close {
    display: block;
    align-self: flex-end;
    width: 40px;
    height: 40px;
    margin: 0.25rem 0.25rem 0 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
  }
}

@media print {
  .shell-topbar, .shell-panel, .shell-backdrop { display: none !important; }
  body.has-shell { padding-left: 0; }
}
