/* Page frame: top bar, side menu, content. The menu slides in on phones
   and stays open on wide screens. */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 var(--space);
  background: var(--c-primary);
  color: #fff;
}

.topbar__menu {
  border: 0;
  background: none;
  color: inherit;
  font-size: 1.4rem;
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
}

.topbar__brand { color: inherit; font-weight: 600; text-decoration: none; flex: 1; }
.topbar__logout { margin: 0; }
.topbar .link-button { color: #fff; }

.sidenav {
  position: fixed;
  top: 56px;
  bottom: 0;
  left: 0;
  z-index: 15;
  width: 240px;
  padding: var(--space) 0;
  background: var(--c-card);
  border-right: 1px solid var(--c-border);
  transform: translateX(-100%);
  transition: transform 0.2s ease;
}

.sidenav.is-open { transform: translateX(0); }

.sidenav__who { margin: 0 var(--space) 12px; font-weight: 600; }
.sidenav__role { display: block; font-weight: 400; font-size: .85rem; color: var(--muted, #667085); }

.sidenav__link {
  display: block;
  padding: 12px var(--space);
  color: var(--c-text);
  text-decoration: none;
}

.sidenav__link.is-current {
  background: var(--c-bg);
  border-left: 4px solid var(--c-primary);
  font-weight: 600;
}

.content { padding: var(--space); max-width: 1100px; }

.auth { min-height: 100vh; display: grid; place-content: center; padding: var(--space); }
.auth__brand { text-align: center; color: var(--c-primary); }

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.grid-2 { display: grid; gap: var(--space); }

@media (min-width: 900px) {
  .topbar__menu { display: none; }
  .sidenav { transform: none; }
  .content { margin-left: 240px; padding: 24px 32px; }
  .grid-2 { grid-template-columns: 1fr 1fr; }
}

/* Long menus scroll inside the side menu (tablets showed only the first items) */
.sidenav { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding-bottom: 72px; }

/* Phones: quick bar at the bottom with the four things done most */
.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 18;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--c-card); border-top: 1px solid var(--c-border);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottombar__item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 56px; font-size: .78rem; color: var(--c-text); text-decoration: none;
}
.bottombar__item span { font-size: 1.25rem; line-height: 1; }
.bottombar__item.is-current { color: var(--c-primary); font-weight: 600; }
body:has(.bottombar) .content { padding-bottom: 80px; }
body:has(.bottombar) .sticky-actions { bottom: 56px; }

/* Wide tables scroll sideways inside their card instead of stretching the page */
.content .card { overflow-x: auto; }
.content table { min-width: 0; }
.content img, .content video { max-width: 100%; height: auto; }

.setup-grid { display: grid; gap: var(--space); }
.setup-card h2 { margin-top: 0; }
.setup-card__links { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 0; }

@media (min-width: 700px) {
  .setup-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 900px) {
  .bottombar { display: none; }
  body:has(.bottombar) .content { padding-bottom: 24px; }
  body:has(.bottombar) .sticky-actions { bottom: 0; }
  .setup-grid { grid-template-columns: 1fr 1fr 1fr; }
}
.auth--wide { display: block; width: 100%; max-width: 640px; margin: 0 auto; }
.auth--wide .card { overflow-x: auto; }
