/* Shared app shell: sidebar + topbar + content frame, used by admin.html,
   portal.html, and console.html. Structural rules only — page content styling
   lives in components.css. Depends on tokens.css being loaded first. */

.app { display: flex; min-height: 100vh; }
.app.hidden { display: none; }

.sidebar {
  width: 244px; flex-shrink: 0; background: var(--sidebar-bg);
  border-right: 1px solid var(--line); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { display: flex; align-items: baseline; gap: 0.5rem; font-weight: 700; padding: 1.15rem 1.35rem; border-bottom: 1px solid var(--line); }
.sidebar .brand .stx { color: var(--accent); font-family: var(--mono); font-weight: 800; font-size: 1.1rem; }
.sidebar .brand .rest { color: var(--sidebar-text-dim); font-size: 0.8rem; font-weight: 500; }
.sidebar nav { padding: 0.7rem; display: flex; flex-direction: column; gap: 0.15rem; flex: 1; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 0.65rem; padding: 0.62rem 0.8rem; border-radius: 9px; color: var(--sidebar-text-dim); font-size: 0.92rem; font-weight: 550; cursor: pointer; user-select: none; }
.nav-item:hover { background: rgba(255,255,255,0.08); color: var(--sidebar-text); text-decoration: none; }
.nav-item.active { background: rgba(249,115,22,0.16); color: var(--accent-2); }
.nav-item .ico { width: 1.25rem; height: 1.25rem; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.nav-item .ico svg { width: 1.05rem; height: 1.05rem; }
.nav-badge { margin-left: auto; background: var(--crit); color: #fff; font-size: 0.64rem; font-weight: 700; border-radius: 999px; padding: 0.05rem 0.42rem; }
.sidebar-foot { padding: 0.9rem; border-top: 1px solid rgba(255,255,255,0.08); }
/* Buttons inside the sidebar (e.g. the portal's "Sign out") sit on the
   always-dark sidebar background, so they need the same fixed light-on-dark
   treatment as the rest of the sidebar rather than components.css's
   theme-flipping button.secondary colors. */
.sidebar-foot button.secondary { background: rgba(255,255,255,0.08); color: var(--sidebar-text); border-color: rgba(255,255,255,0.18); }
.sidebar-foot button.secondary:hover { background: rgba(255,255,255,0.14); }
.staff-tag { font-size: 0.68rem; color: var(--sidebar-text-faint); font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.08em; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--header-bg); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 1rem; padding: 0.85rem 1.5rem;
}
.topbar h1 { font-size: 1.12rem; margin: 0; color: var(--text-strong); font-weight: 650; flex: 1; letter-spacing: -0.01em; }
.crumb { color: var(--text-faint); font-weight: 500; margin-right: 0.35rem; }
.header-right { display: flex; align-items: center; gap: 0.7rem; }
#whoami { font-size: 0.82rem; color: var(--text-faint); font-family: var(--mono); }

.theme-toggle {
  background: rgba(255,255,255,0.06); color: var(--text-dim); border: 1px solid var(--line-strong);
  border-radius: 999px; padding: 0.3rem 0.7rem; font-size: 0.8rem; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 0.35rem; line-height: 1;
}
.theme-toggle:hover { background: rgba(255,255,255,0.1); }
.menu-toggle { display: none; background: transparent; border: 1px solid var(--line-strong); color: var(--text); padding: 0.35rem 0.6rem; border-radius: 8px; font-size: 1rem; }

/* Quick links pill + notification bell, in the header-right cluster. */
.quicklinks { position: relative; }
.quicklinks-btn {
  background: rgba(255,255,255,0.06); color: var(--text-dim); border: 1px solid var(--line-strong);
  border-radius: 999px; padding: 0.3rem 0.75rem 0.3rem 0.6rem; font-size: 0.8rem; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; gap: 0.35rem;
}
.quicklinks-btn:hover { background: rgba(255,255,255,0.1); }
.quicklinks-btn svg { width: 0.95rem; height: 0.95rem; }
.quicklinks-menu {
  display: none; position: absolute; right: 0; top: calc(100% + 0.4rem); min-width: 170px; z-index: 30;
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: 10px; padding: 0.35rem;
  box-shadow: 0 20px 40px -20px rgba(0,0,0,0.6);
}
.quicklinks-menu.open { display: block; }
.quicklinks-menu a {
  display: block; padding: 0.45rem 0.6rem; border-radius: 7px; font-size: 0.86rem; color: var(--text);
}
.quicklinks-menu a:hover { background: rgba(255,255,255,0.06); text-decoration: none; }

/* Header "recent activity" dropdown — live status of runs/fixes, so nothing
   dispatched to a PC is ever a pure wait-and-wonder. */
.activity-dot { position: absolute; top: 0.28rem; right: 0.32rem; width: 0.5rem; height: 0.5rem; border-radius: 999px; background: var(--info, #4c8dff); border: 1.5px solid var(--header-bg); }
.activity-dot.hidden { display: none; }
.activity-menu {
  display: none; position: absolute; right: 0; top: calc(100% + 0.4rem); width: 320px; z-index: 30;
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: 10px; padding: 0.5rem;
  box-shadow: 0 20px 40px -20px rgba(0,0,0,0.6);
}
.activity-menu.open { display: block; }
.activity-menu-head { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-dim); padding: 0.3rem 0.4rem 0.5rem; }
.activity-menu-list { max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 0.15rem; }
.activity-menu-row { display: flex; align-items: flex-start; gap: 0.55rem; padding: 0.45rem 0.4rem; border-radius: 7px; }
.activity-menu-row:hover { background: rgba(255,255,255,0.05); }
.activity-menu-row-body { min-width: 0; flex: 1; }
.activity-menu-row-title { font-size: 0.84rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-menu-row-meta { font-size: 0.74rem; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-menu-empty { padding: 1rem 0.4rem; font-size: 0.84rem; color: var(--text-dim); text-align: center; }
.activity-menu-viewall {
  display: block; width: 100%; margin-top: 0.35rem; padding: 0.5rem; border: none; border-top: 1px solid var(--line);
  background: transparent; color: var(--accent, #4c8dff); font-size: 0.82rem; font-weight: 600; cursor: pointer; border-radius: 0 0 8px 8px;
}
.activity-menu-viewall:hover { background: rgba(255,255,255,0.05); }

.bell-btn {
  position: relative; background: rgba(255,255,255,0.06); border: 1px solid var(--line-strong);
  color: var(--text-dim); border-radius: 999px; width: 2.05rem; height: 2.05rem; display: inline-flex;
  align-items: center; justify-content: center; cursor: pointer;
}
.bell-btn:hover { background: rgba(255,255,255,0.1); }
.bell-btn svg { width: 1.05rem; height: 1.05rem; }
.bell-dot { position: absolute; top: 0.28rem; right: 0.32rem; width: 0.5rem; height: 0.5rem; border-radius: 999px; background: var(--crit); border: 1.5px solid var(--header-bg); }
.bell-dot.hidden { display: none; }

.content { padding: 0.3rem 1.5rem 3.5rem; max-width: 1180px; width: 100%; }
.page.hidden { display: none; }
.scrim { display: none; }

/* Sub-nav tab bar directly under the topbar, ManageEngine-style page tabs. */
.subnav, .subnav-tab-group { display: flex; gap: 0.3rem; padding: 0.6rem 1.5rem 0; flex-wrap: wrap; }
.subnav-tab-group { padding: 0; }
.subnav-tab {
  background: transparent; color: var(--text-dim); border: none; border-bottom: 2px solid transparent;
  padding: 0.5rem 0.2rem; margin-right: 1rem; font-size: 0.88rem; font-weight: 600; cursor: pointer;
  border-radius: 0;
}
.subnav-tab:hover { color: var(--text); background: transparent; }
.subnav-tab.active { color: var(--accent-2); border-bottom-color: var(--accent); }
.tab-pane.hidden { display: none; }

@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 60; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 50px rgba(0,0,0,0.55); }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: inline-flex; }
  .scrim.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 55; }
  .content { padding: 0.3rem 1rem 3rem; }
  .subnav { padding: 0.5rem 1rem 0; }
  /* Header-right gets crowded on narrow screens — the quick-links pill
     duplicates pages already reachable from the hamburger nav, and the
     signed-in email is low priority, so both drop first. Whatever's left
     wraps onto its own row instead of clipping. */
  .quicklinks, #adminWho, #whoami, .crumb { display: none; }
  .topbar { flex-wrap: wrap; row-gap: 0.5rem; }
  .header-right { gap: 0.5rem; flex-wrap: wrap; }
  .header-right button.secondary { padding: 0.5rem 0.6rem; font-size: 0.82rem; }
}
