/* ── App shell: top banner + sidebar + content ───────────────────────────── */
#app { min-height: 100vh; }

/* ── Top banner (always visible) ─────────────────────────────────────────── */
#topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h);
  background: var(--bg-2);
  color: var(--text);
  display: flex; align-items: center; gap: 14px;
  padding: 0 20px; z-index: 60;
  border-bottom: 1px solid var(--line);
}
#topbar .brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
#topbar .brand img { height: 34px; width: auto; filter: invert(1); } /* white Luminous logo → dark on light bg */
#topbar .brand .divider { width: 1px; height: 28px; background: var(--line); }
#topbar .brand .co-name {
  font-weight: 700; font-size: 1.02rem;
  letter-spacing: -.01em; white-space: nowrap; color: var(--text);
}
#topbar .spacer { flex: 1; }
#topbar .topbar-user { display: flex; align-items: center; gap: 12px; }
#topbar .topbar-user .u-meta { text-align: right; line-height: 1.2; }
#topbar .topbar-user .u-name { font-weight: 600; font-size: .9rem; }
#topbar .topbar-user .u-role { font-size: .72rem; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
#topbar .avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: var(--surface-3); color: var(--text);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem;
}
#topbar .logout-btn {
  display: flex; align-items: center; gap: 7px;
  background: var(--surface-2); color: var(--text-2);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 14px; font-size: .85rem; font-weight: 500;
  transition: all var(--transition);
}
#topbar .logout-btn:hover { background: var(--surface-3); color: var(--text); }
#menu-toggle {
  display: none; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  width: 42px; height: 42px; font-size: 1.2rem; line-height: 1;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
#sidebar {
  position: fixed; top: var(--topbar-h); bottom: 0; left: 0; width: var(--sidebar-w);
  background: var(--bg-2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; z-index: 50;
  transition: transform var(--transition);
  overflow-y: auto;
}
.sidebar-section { padding: 14px 12px 6px; }
.sidebar-section + .sidebar-section { border-top: 1px solid var(--line-2); }
.sidebar-section-label {
  font-size: .68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .09em; color: var(--text-3); padding: 4px 12px 8px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500; font-size: .93rem;
  cursor: pointer; transition: all var(--transition); margin-bottom: 2px;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--surface-3); color: var(--text); font-weight: 600; }
.nav-item.active .nav-icon { color: var(--text); }
.nav-icon { display: flex; color: var(--text-3); flex-shrink: 0; }
.sidebar-foot { margin-top: auto; padding: 18px 16px; border-top: 1px solid var(--line-2); }
.sidebar-foot .powered {
  font-size: .66rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--text-3); text-align: center;
}
.sidebar-foot .powered img { height: 26px; margin: 10px auto 0; opacity: .9; }

/* ── Main content ────────────────────────────────────────────────────────── */
#main-wrap { margin-left: var(--sidebar-w); padding-top: var(--topbar-h); min-height: 100vh; }
#content { padding: 26px 30px 70px; max-width: 1360px; }
.page-head { margin-bottom: 22px; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head .titles h1 { margin-bottom: 3px; }
.page-head .titles p { color: var(--text-3); font-size: .92rem; }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Sidebar drawer overlay (mobile/tablet) */
#sidebar-overlay {
  display: none; position: fixed; inset: 0; top: var(--topbar-h);
  background: rgba(0,0,0,.55); z-index: 45;
}
#sidebar-overlay.open { display: block; }

/* ── Responsive (tablet + mobile) ────────────────────────────────────────── */
@media (max-width: 960px) {
  #menu-toggle { display: flex; align-items: center; justify-content: center; }
  #sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  #sidebar.open { transform: translateX(0); }
  #main-wrap { margin-left: 0; }
  #content { padding: 18px 16px 80px; }
  #topbar .brand .co-name { font-size: .92rem; }
  #topbar .topbar-user .u-meta { display: none; }
  #topbar .logout-btn span { display: none; }
  #topbar .logout-btn { padding: 9px; }
}
/* Phones: the long company name overflows into the avatar — keep just the logo. */
@media (max-width: 620px) {
  #topbar { padding: 0 12px; gap: 10px; }
  #topbar .brand .co-name,
  #topbar .brand .divider { display: none; }
  #topbar .brand img { height: 30px; }
  #topbar .topbar-user { gap: 8px; }
}
