body[data-auth="authenticated"] {
  overflow-x: hidden;
}

body[data-auth="authenticated"] .shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  width: 100%;
  max-width: none;
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

.topbar {
  grid-column: 2;
  grid-row: 1;
  min-height: 74px;
  margin: 0;
  padding: 13px 24px;
  border: 0;
  border-bottom: 1px solid var(--border-subtle);
  border-radius: 0;
  background: color-mix(in srgb, var(--surface-card) 92%, transparent);
  box-shadow: none;
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar strong {
  color: var(--text-primary);
  font-family: "Raleway", "Manrope", "Inter", sans-serif;
  font-size: 16px;
  letter-spacing: -0.015em;
}

.topbar span {
  color: var(--text-muted);
  font-size: 12px;
}

.topbar-actions {
  align-items: center;
}

.tabs {
  grid-column: 1;
  grid-row: 1 / span 2;
  position: sticky;
  top: 0;
  z-index: 40;
  align-self: start;
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 4px;
  width: 232px;
  height: 100vh;
  margin: 0;
  padding: 18px 12px;
  overflow-y: auto;
  border: 0;
  border-radius: 0;
  background: linear-gradient(168deg, var(--nav-start), var(--nav-end));
  box-shadow: 12px 0 32px rgba(1, 24, 56, 0.1);
}

.sidebar-brand {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  padding: 3px 8px 20px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(156, 192, 255, 0.16);
}

.sidebar-logo {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(156, 192, 255, 0.35);
  border-radius: 12px;
  color: #ffffff;
  background: linear-gradient(145deg, #0758df, #0040a8);
  box-shadow: 0 8px 22px rgba(0, 73, 198, 0.3);
  font: 800 21px/1 "Raleway", sans-serif;
}

.sidebar-brand strong,
.sidebar-brand span {
  display: block;
}

.sidebar-brand strong {
  color: #ffffff;
  font-family: "Raleway", "Manrope", sans-serif;
  font-size: 15px;
  letter-spacing: 0.04em;
}

.sidebar-brand span {
  margin-top: 2px;
  color: var(--nav-muted);
  font-size: 11px;
}

.sidebar-label {
  padding: 8px 11px 4px;
  color: var(--nav-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tab {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--nav-muted);
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease;
}

.tab:hover {
  color: var(--nav-text);
  background: var(--nav-hover);
}

.tab.is-active {
  color: var(--nav-active);
  border-color: rgba(156, 192, 255, 0.22);
  background: rgba(156, 192, 255, 0.14);
  box-shadow: inset 3px 0 0 #69a0ff;
}

.tab-icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  opacity: 0.92;
}

.view {
  grid-column: 2;
  grid-row: 2;
  width: min(1460px, calc(100% - 40px));
  margin: 20px auto 36px;
}

.view.is-active {
  animation: admin-view-in 180ms ease both;
}

@keyframes admin-view-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.theme-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--surface-sunken);
}

.theme-switch button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border-radius: 7px;
  color: var(--text-muted);
  background: transparent;
}

.theme-switch button:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
}

.theme-switch button.is-active {
  color: var(--brand-foreground);
  background: var(--surface-raised);
  box-shadow: 0 1px 4px rgba(8, 21, 42, 0.12);
}

.theme-switch svg {
  width: 16px;
  height: 16px;
}

body[data-auth="anonymous"] .shell {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 100vh;
  margin: 0;
  padding: 28px;
}

.login-panel {
  position: relative;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  width: min(880px, 100%);
  margin: 0;
  padding: 38px;
  overflow: hidden;
  border-radius: 18px;
  background: var(--surface-card);
  box-shadow: 0 24px 70px rgba(1, 24, 56, 0.15);
}

.login-panel::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  background: linear-gradient(180deg, #0758df, #013591);
}

.login-panel h1 {
  margin-top: 8px;
  color: var(--text-primary);
  font-family: "Raleway", "Manrope", sans-serif;
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.04;
}

.login-panel p {
  max-width: 500px;
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 15px;
}

.login-form {
  padding: 22px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  background: var(--surface-sunken);
}

.login-theme {
  position: absolute;
  top: 18px;
  right: 18px;
}

@media (max-width: 1100px) {
  body[data-auth="authenticated"] .shell {
    display: block;
    min-height: 100vh;
  }

  .topbar {
    position: sticky;
    grid-column: auto;
    padding: 11px 16px;
  }

  .tabs {
    position: sticky;
    top: 69px;
    flex-direction: row;
    width: 100%;
    height: auto;
    padding: 7px 12px;
    overflow-x: auto;
    overflow-y: hidden;
    box-shadow: 0 10px 26px rgba(1, 24, 56, 0.1);
  }

  .sidebar-brand,
  .sidebar-label {
    display: none;
  }

  .tab {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 7px 11px;
  }

  .tab.is-active {
    box-shadow: inset 0 -2px 0 #69a0ff;
  }

  .view {
    width: min(100% - 28px, 1280px);
    margin: 16px auto 32px;
  }
}

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .topbar-actions > #refresh,
  .topbar-actions > #logout {
    flex: 1;
  }

  .tabs {
    top: 126px;
  }

  .login-panel {
    grid-template-columns: 1fr;
    padding: 54px 22px 24px;
  }
}
