.app-shell {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  grid-template-rows: 66px 1fr;
  min-height: 100vh;
}

.sidebar {
  grid-row: 1 / -1;
  position: sticky;
  top: 0;
  height: 100vh;
  background: hsl(var(--shell));
  border-right: 1px solid hsl(var(--border));
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.sidebar__brand {
  display: flex;
  align-items: center;
  min-height: 66px;
  padding: 0 4px;
  margin-bottom: 18px;
  color: hsl(var(--text));
  text-decoration: none;
}
.brand-logo {
  width: 188px;
  max-width: 100%;
  height: auto;
  display: block;
}
.brand-mark {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: hsl(var(--primary));
  color: hsl(var(--primary-fg));
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0;
}
.brand-mark--lg {
  width: 58px;
  height: 58px;
  font-size: 22px;
}
.brand-copy,
.login-brand__copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.brand-copy strong,
.login-brand__copy strong {
  color: hsl(var(--text));
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.05;
}
.brand-copy small,
.login-brand__copy small {
  color: hsl(var(--text-muted));
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  line-height: 1.2;
}
.sidebar__link {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--radius);
  color: hsl(var(--text-muted));
  text-decoration: none;
  font-size: 14px;
  font-weight: 800;
  transition: background-color 150ms ease, color 150ms ease;
}
.sidebar__link:hover {
  background: hsl(var(--surface-alt) / .55);
  color: hsl(var(--text));
}
.sidebar__link--active {
  background: hsl(var(--primary) / .14);
  color: hsl(var(--primary));
}
.sidebar__footer {
  margin-top: auto;
  padding: 14px 12px;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--surface-alt) / .34);
  display: grid;
  gap: 2px;
}
.sidebar__footer strong {
  font-size: 13px;
  color: hsl(var(--text));
}
.sidebar__footer small {
  font-size: 12px;
  color: hsl(var(--text-muted));
}
.sidebar__eyebrow {
  color: hsl(var(--primary));
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.topbar {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 66px;
  padding: 0 32px;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--bg) / .94);
}
.topbar [data-sidebar-toggle] { display: none; }
.topbar__left,
.topbar__session {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.topbar__session {
  margin-left: auto;
  color: hsl(var(--text-muted));
}
.topbar__user {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-sm);
  background: hsl(var(--surface-alt) / .28);
  color: hsl(var(--text));
  font-size: 13px;
  font-weight: 700;
}

.content {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  width: 100%;
  max-width: 1280px;
  padding: 34px 32px 56px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: 34px;
}
.page-header h1 { margin-bottom: 8px; }
.page-header p {
  max-width: 680px;
  margin: 0;
  color: hsl(var(--text-muted));
  font-size: 15px;
}

.sidebar-backdrop { display: none; }

@media (max-width: 1099px) and (min-width: 1024px) {
  .app-shell { grid-template-columns: 76px minmax(0, 1fr); }
  .sidebar { padding-inline: 10px; }
  .sidebar__brand {
    justify-content: center;
    padding-inline: 0;
    min-height: 44px;
  }
  .sidebar__brand img { width: 38px; }
  .sidebar__link { justify-content: center; padding-inline: 0; }
  .sidebar__link span { display: none; }
  .sidebar__footer { display: none; }
}

@media (max-width: 1023px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(288px, 86vw);
    z-index: 40;
    height: auto;
    transform: translateX(-100%);
    transition: transform 180ms ease;
    padding-bottom: max(var(--space-4), env(safe-area-inset-bottom));
  }
  .sidebar.is-open {
    transform: translateX(0);
    box-shadow: var(--shadow-2);
  }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: hsl(220 24% 13% / .4);
  }
  .sidebar-backdrop[hidden] { display: none; }
  .sidebar__brand {
    justify-content: flex-start;
    min-height: 66px;
  }
  .sidebar__brand img { width: 156px; }
  .sidebar__link { justify-content: flex-start; padding-inline: 12px; }
  .sidebar__link span { display: inline; }
  .sidebar__footer { display: grid; }
  .topbar, .content { grid-column: 1; }
  .topbar { grid-row: 1; }
  .content { grid-row: 2; }
  .topbar [data-sidebar-toggle] { display: inline-flex; }
}

@media (max-width: 767px) {
  .app-shell { grid-template-rows: 58px 1fr; }
  .topbar {
    min-height: 58px;
    padding: 0 max(var(--space-4), env(safe-area-inset-right)) 0 max(var(--space-4), env(safe-area-inset-left));
    overflow: hidden;
  }
  .topbar__session {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .topbar__user {
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .content {
    padding: 18px max(var(--space-4), env(safe-area-inset-right)) calc(var(--space-8) + 64px + env(safe-area-inset-bottom)) max(var(--space-4), env(safe-area-inset-left));
  }
  .page-header {
    display: grid;
    gap: var(--space-3);
    margin-bottom: 22px;
  }
  .page-header .actions,
  .page-header .cluster {
    width: 100%;
  }
  .page-header .btn {
    flex: 1 1 calc(50% - var(--space-3));
  }
  .bottom-nav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(56px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: hsl(var(--shell));
    border-top: 1px solid hsl(var(--border));
    z-index: 30;
  }
  .bottom-nav__item {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 2px;
    font-size: 11px;
    font-weight: 800;
    color: hsl(var(--text-muted));
    text-decoration: none;
    text-align: center;
  }
  .bottom-nav__item--active { color: hsl(var(--primary)); }
}
