/* Authenticated app shell (v0.6.0). Token-only styling: every colour
 * comes from web/css/app.css tokens — no hardcoded hex here.
 * The sidebar uses the --side-* tokens, which are dark in both themes,
 * so the sidebar stays dark in both themes. On narrow screens the
 * sidebar hides and the bottom nav (from app.css) takes over.
 *
 * v0.6.0 shell fixes (visual audit):
 * - the topbar is sticky and the sidebar scrolls INDEPENDENTLY (it used
 *   to grow past the viewport, so lower links were unreachable);
 * - the main column has a max-width so cards and lines stop stretching
 *   full-width on wide screens;
 * - sidebar links are grouped with SVG icons and a real unread badge;
 * - the business/plan line is gone from the page body: the business name
 *   stays once as the eyebrow, plan + role live in the sidebar header. */

.shell {
  display: flex;
  align-items: flex-start;
  min-height: calc(100vh - 57px);
}

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-tx);
  border-right: 1px solid var(--border-sidebar-edge);
  padding: 20px 16px;
  position: sticky;
  top: 57px;
  height: calc(100vh - 57px);
  overflow-y: auto;
  align-self: flex-start;
}

.sidebar h2 {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sidebar-tx-2);
  margin: 0 0 12px;
}

.sidebar p {
  color: var(--sidebar-tx-2);
  font-size: 0.8125rem;
  margin: 0;
}

#sideBusiness {
  color: var(--sidebar-tx);
  font-weight: 600;
  font-size: 1rem;
}

.side-role {
  font-size: 13px;
  margin-top: 4px;
}

/* Sidebar section links: grouped, icon + label, with a mint
 * current-page marker. The active link is set by app.js (presentation
 * only); the server still enforces every route. */
.sidebar nav {
  display: grid;
  gap: 6px;
  margin-top: 16px;
}

.side-group {
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sidebar-tx-2);
  margin: 14px 0 2px;
}

.side-group:first-child {
  margin-top: 0;
}

.sidebar nav a {
  display: flex;
  font-size: 1rem;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--sidebar-tx-2);
  text-decoration: none;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar nav a .nav-ic {
  display: inline-flex;
  flex-shrink: 0;
}

.sidebar nav a .nav-ic svg {
  width: 18px;
  height: 18px;
  display: block;
}

.sidebar nav a .nav-badge {
  margin-left: auto;
}

.sidebar nav a:hover {
  background: var(--sidebar-overlay);
  color: var(--sidebar-tx);
}

.sidebar nav a.active {
  background: var(--sidebar-overlay);
  color: var(--sidebar-tx);
  box-shadow: inset 3px 0 0 var(--acc);
}

.shell-main {
  flex: 1;
  min-width: 0;
  max-width: 980px;
  padding: 32px 24px 48px;
}

.shell-main h1 {
  margin: 0 0 6px;
  font-family: var(--font-heading);
  font-size: clamp(1.25rem, 4vw, 1.5rem);
  line-height: 1.3;
}

/* v0.5.2: business name as a small eyebrow above the page-name H1.
 * v0.6.0: it is the ONLY business-name line on the page. */
.page-eyebrow {
  margin: 0 0 4px;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--tx-2);
}

/* Shared table scroll container (Phase 5 fix): admin.html used
 * .table-scroll but only apikeys.css/billing.css defined it, so admin
 * tables had no scroll container on narrow screens. Every table inside
 * .table-scroll scrolls horizontally with sticky first/last columns. */
.table-scroll {
  overflow-x: auto;
}

.table-scroll table {
  min-width: 640px;
  width: 100%;
  border-collapse: collapse;
}

.table-scroll th,
.table-scroll td {
  text-align: left;
  padding: 14px 12px;
  min-height: 48px;
  border-bottom: 1px solid var(--border-default);
  vertical-align: top;
}

.table-scroll th:first-child,
.table-scroll td:first-child {
  position: sticky;
  left: 0;
  background: var(--surface-raised);
}

.table-scroll th:last-child,
.table-scroll td:last-child {
  position: sticky;
  right: 0;
  background: var(--surface-raised);
}

@media (max-width: 760px) {
  .sidebar {
    display: none;
  }

  .shell-main {
    padding-bottom: 76px;
  }
}
