body.admin-shell > main { max-width: none; }

body.admin-shell .admin-grid {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.admin-sidebar {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 14px 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-nav { display: grid; gap: 2px; }
.admin-nav-heading {
  margin: 16px 12px 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.admin-nav-heading:first-child { margin-top: 4px; }

body.admin-shell .admin-nav button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 42px;
  gap: 11px;
  padding: 9px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  box-shadow: none;
  cursor: pointer;
}
body.admin-shell .admin-nav button:hover { background: var(--surface-muted); }
body.admin-shell .admin-nav button.active,
body.admin-shell .admin-nav button.active:hover {
  background: #194bc4;
  color: #fff;
}
.admin-nav img { width: 20px; height: 20px; flex: none; }
html[data-theme="light"] .admin-nav button:not(.active) img { filter: brightness(0) opacity(.65); }
.admin-nav button.active img { filter: brightness(0) invert(1); }

.admin-content { min-width: 0; }
body.admin-shell .admin-content > .settings-panel { width: 100%; margin: 0; }
body.admin-shell .admin-settings-view { display: block; }
body.admin-shell .admin-settings-view.hidden { display: none; }
body.admin-shell .admin-settings-view > summary { display: none; }
body.admin-shell .admin-settings-view[open] { padding: 0; border: 0; background: transparent; }
body.admin-shell .admin-settings-view[open] > *:not(summary) { margin-top: 0; }
body.admin-shell #settingsForm > .form-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin-top: 20px;
  padding: 14px 0 0;
  background: var(--panel);
  border-top: 1px solid var(--line);
}
body.admin-shell #settingsMessage { margin: 10px 0 0; }

body.admin-shell .notification-template {
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel);
}
body.admin-shell .notification-template > summary.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  cursor: pointer;
  list-style: none;
  border: 0;
}
body.admin-shell .notification-template > summary::-webkit-details-marker { display: none; }
body.admin-shell .notification-template > summary::after {
  content: "";
  width: 8px;
  height: 8px;
  flex: none;
  margin-left: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 180ms ease;
}
body.admin-shell .notification-template[open] > summary::after { transform: rotate(225deg); }
body.admin-shell .notification-template h3 { margin: 0; font-size: 16px; font-weight: 600; }
.template-state { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 500; }
.template-fields { padding: 18px; border-top: 1px solid var(--line); }
.template-fields textarea { width: 100%; }

@media (max-width: 900px) {
  body.admin-shell .admin-grid { display: block; padding-bottom: 64px; }
  .admin-sidebar {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 10;
    max-height: none;
    margin: 0;
    padding: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    border-radius: 0;
  }
  .admin-nav { display: flex; width: max-content; align-items: center; }
  .admin-nav-heading { display: none; }
  body.admin-shell .admin-nav button { width: auto; white-space: nowrap; }
}

@media (max-width: 620px) {
  body.admin-shell .admin-topbar .topbar-actions {
    display: flex;
    width: 100%;
    flex-wrap: wrap;
    justify-content: stretch;
  }
  html[data-theme] body.admin-shell .admin-theme-switcher { display: grid !important; width: 100%; max-width: none; }
  body.admin-shell .topbar-actions > a,
  body.admin-shell .topbar-actions > button { flex: 1 1 0; justify-content: center; text-align: center; }
  .admin-nav img { width: 18px; height: 18px; }
  body.admin-shell .admin-nav button { font-size: 13px; }
  body.admin-shell .admin-content > .settings-panel { padding: 16px; }
  body.admin-shell .notification-template > summary.panel-head { padding: 14px; }
  .template-fields { padding: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  body.admin-shell .notification-template > summary::after { transition: none; }
}
