/* App shell: header + left sidenav + main content */

#app-shell {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

/* ---- Header ---- */
.app-header {
  height: var(--header-height);
  background: var(--navy-900);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-5);
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: var(--shadow-sm);
}
.app-header__left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}
.app-header__menu-btn {
  display: none;
  background: transparent;
  border: 0;
  color: var(--white);
  font-size: 20px;
  line-height: 1;
  padding: var(--space-2);
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.app-header__menu-btn:hover { background: var(--navy-700); }
.app-header__brand {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.app-header__brand-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 16px;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-header__brand-sub {
  font-size: 11px;
  color: var(--gray-300);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.app-header__right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.app-header__demo-tag {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--status-amber-bg);
  color: var(--status-amber-fg);
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 700;
}
.app-header__user {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 13px;
}
.app-header__user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  /* --role-accent is set per signed-in user on #app-shell (router.js's
     renderShell) — falls back to the old fixed navy if it's ever unset. */
  background: var(--role-accent, var(--navy-600));
  color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}
.app-header__user-meta { line-height: 1.3; display: none; }
.app-header__user-role { color: var(--role-accent-light, var(--gray-300)); font-size: 11px; font-weight: 600; }
.app-header__logout {
  background: transparent;
  border: 1px solid var(--navy-600);
  color: var(--white);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
}
.app-header__logout:hover { background: var(--navy-700); }

/* ---- Body: sidenav + content ---- */
.app-body {
  flex: 1;
  display: flex;
  min-height: calc(100vh - var(--header-height));
}

.app-sidenav {
  width: var(--sidenav-width);
  flex-shrink: 0;
  background: var(--navy-800);
  color: var(--gray-200);
  padding: var(--space-4) 0;
  overflow-y: auto;
}
.app-sidenav__group {
  margin-bottom: var(--space-4);
}
.app-sidenav__group-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-400);
  padding: var(--space-2) var(--space-5);
  font-weight: 700;
}
.app-sidenav__link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px var(--space-5);
  color: var(--gray-200);
  font-size: 14px;
  border-left: 3px solid transparent;
  cursor: pointer;
}
.app-sidenav__link:hover {
  background: var(--navy-700);
  text-decoration: none;
  color: var(--white);
}
.app-sidenav__link.is-active {
  background: var(--navy-700);
  border-left-color: var(--role-accent, var(--accent-600));
  color: var(--white);
  font-weight: 600;
}
.app-sidenav__icon {
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.85;
}

.app-sidenav__backdrop {
  display: none;
}

.app-main {
  flex: 1;
  min-width: 0;
  background: var(--white);
  padding: var(--space-6) var(--space-8);
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}
.page-header__eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-600);
  font-weight: 700;
  margin-bottom: 2px;
}
.page-header__desc {
  color: var(--gray-500);
  max-width: 60ch;
  margin: 0;
}
.page-header__actions {
  display: flex;
  gap: var(--space-2);
  flex-shrink: 0;
}

.app-footer {
  text-align: center;
  font-size: 12px;
  color: var(--gray-400);
  padding: var(--space-4);
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .app-header__user-meta { display: none; }
}

@media (max-width: 900px) {
  .app-header__menu-btn { display: inline-flex; align-items: center; justify-content: center; }
  .app-header__brand-sub { display: none; }

  .app-sidenav {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-md);
  }
  .app-body.is-nav-open .app-sidenav { transform: translateX(0); }
  .app-body.is-nav-open .app-sidenav__backdrop {
    display: block;
    position: fixed;
    inset: var(--header-height) 0 0 0;
    background: rgba(10, 31, 60, 0.35);
    z-index: 45;
  }

  .app-main { padding: var(--space-5); }
}

@media (max-width: 560px) {
  .app-main { padding: var(--space-4); }
  h1 { font-size: 22px; }
  .app-header { padding: 0 var(--space-3); }
}
