/* Shared left-nav shell (.view--shell / .sidebar / .mobile-topbar /
   .workspace) used by BOTH admin_dashboard pages — extracted from
   ceo-overview.css (its original owner) so Inquiry Inbox
   (index.html/dashboard.css) can reuse the exact same sidebar, instead
   of risking the two pages' chrome drifting apart over time. Loaded
   AFTER dashboard.css (which supplies the shared :root tokens) on both
   pages. Nothing page-specific lives here — CEO Overview's own
   .demo-badge and Inquiry Inbox's own bounded-height .workspace--app
   modifier (see dashboard.css) stay in their own stylesheets. */

.view--shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  align-items: start;
  min-height: 100vh;
  /* Resets the generic .view base rule's `padding: 24px 16px`
     (dashboard.css) — that padding used to be fully overridden by the
     old .view--app's own padding, since both classes landed on the
     same element and .view--app came later in the cascade. .view--shell
     declares no padding of its own, so without this reset the leaked
     padding pushes the whole grid inward and, on Inquiry Inbox's own
     bounded-height .workspace--app (which is exactly 100dvh tall,
     positioned starting 24px down), 24px past the bottom of the
     viewport — a real, confirmed overflow, not just a cosmetic gap.
     Both .sidebar and .workspace already own their own internal
     padding, so the outer shell needs none. */
  padding: 0;
}

.sidebar {
  /* No explicit grid-column — relies on DOM-order auto-placement
     (sidebar first, .workspace second) so it adapts correctly at every
     breakpoint without a media query having to reset it. A hardcoded
     grid-column: 2 on .workspace previously forced CSS Grid to
     auto-generate an implicit second column even after the mobile media
     query collapsed .view--shell to a single 1fr column — that implicit
     column's auto width is exactly what caused a ~130px horizontal
     overflow confirmed via window.innerWidth at 390px (see
     docs/CEO_OVERVIEW_REDESIGN_PLAN.md's verification notes). */
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px 14px;
  background: var(--ink);
  color: #fff;
}
.sidebar__brand { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
/* Inquiry Inbox's .private-tag pill (dashboard.css) reuses CEO
   Overview's .demo-badge slot in the brand row — both pages' own
   stylesheets keep the pill's colors/meaning; this just repositions it
   correctly against the sidebar's dark background instead of its
   original light-topbar styling. */
.sidebar__brand .private-tag { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.2); color: rgba(255, 255, 255, 0.7); }
.sidebar__org {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--teal);
  text-transform: uppercase;
  text-decoration: none;
}
.sidebar__org:hover { text-decoration: underline; text-underline-offset: 3px; }
.sidebar__org:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 2px; }

.sidebar__nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar__current {
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: rgba(31, 158, 141, 0.18);
}
.sidebar__link {
  font-size: 13.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
}
.sidebar__link:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.sidebar__link:focus-visible { outline: 2px solid var(--teal); outline-offset: 1px; }

.sidebar__section-links { display: flex; flex-direction: column; gap: 1px; margin-top: 6px; }
.sidebar__section-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  padding: 6px 10px 2px;
}
.sidebar__jump {
  font: inherit;
  font-size: 13px;
  text-align: left;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.sidebar__jump:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.sidebar__jump:focus-visible { outline: 2px solid var(--teal); outline-offset: 1px; }

.sidebar__session { display: flex; flex-direction: column; gap: 6px; margin-top: auto; }
.sidebar__session .session-note { color: rgba(255, 255, 255, 0.6); font-size: 11.5px; }
.sidebar__session .btn { width: 100%; justify-content: flex-start; background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.2); color: #fff; }
.sidebar__session .btn:hover { background: rgba(255, 255, 255, 0.12); }

/* Reset demo (CEO Overview only, but the class stays shared/generic in
   case Inquiry Inbox ever grows an equally-secondary sidebar action):
   deliberately separated from the daily-use session controls above — a
   plain small link, not a button. */
.sidebar__secondary { padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, 0.14); }
.sidebar__secondary .link-btn { color: rgba(255, 255, 255, 0.55); font-size: 12px; }
.sidebar__secondary .link-btn:hover { color: #fff; }

.sidebar-backdrop { display: none; }

.mobile-topbar { display: none; }

.workspace { padding: 22px 24px 40px; min-width: 0; }

@media (max-width: 1023px) {
  .view--shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    padding: 10px 16px;
  }
  .sidebar__nav { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .sidebar__section-links { flex-direction: row; flex-wrap: wrap; margin-top: 0; gap: 2px; }
  .sidebar__section-label { display: none; }
  .sidebar__session { flex-direction: row; margin-top: 0; margin-left: auto; align-items: center; }
  .sidebar__session .btn { width: auto; }
  .sidebar__secondary { border-top: none; padding-top: 0; }
  .workspace { padding: 20px 16px 32px; }
}

@media (max-width: 699px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(280px, 86vw);
    height: 100vh;
    flex-direction: column;
    align-items: stretch;
    transform: translateX(-100%);
    transition: transform 180ms ease;
    z-index: 60;
    box-shadow: 2px 0 16px rgba(15, 27, 45, 0.35);
  }
  .sidebar[data-open="true"] { transform: translateX(0); }
  .sidebar__nav { flex-direction: column; }
  .sidebar__section-links { flex-direction: column; }
  .sidebar__section-label { display: block; }
  .sidebar__session { flex-direction: column; margin-left: 0; margin-top: auto; }
  .sidebar__session .btn { width: 100%; }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 27, 45, 0.45);
    z-index: 50;
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
  }
  .sidebar-backdrop[data-open="true"] { opacity: 1; pointer-events: auto; }

  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--line-soft);
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 30;
  }
  .mobile-topbar__toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
    font-size: 18px;
    cursor: pointer;
  }
  .mobile-topbar__toggle:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
  .mobile-topbar__title { font-weight: 700; color: var(--ink); font-size: 14px; }
  .workspace { padding: 16px 14px 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar, .sidebar-backdrop { transition: none; }
}
