/* ---------- Announcement & notices ---------- */
.announcement {
  --c: var(--brand);
  position: relative;
  z-index: 41;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 38px;
  padding: 6px 44px;
  background: color-mix(in srgb, var(--c) 12%, var(--bg));
  border-bottom: 1px solid color-mix(in srgb, var(--c) 25%, transparent);
  font-size: 13.5px;
  text-align: center;
}
.announcement a,
.announcement button.link {
  font-weight: 600;
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.announcement-warning {
  --c: var(--warning);
}
.announcement-danger {
  --c: var(--danger);
}
.announcement .btn {
  position: absolute;
  right: 8px;
}
button.link {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
}

/* ---------- Header ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  min-width: 0;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.015em;
}
.brand img {
  height: 32px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--brand);
  color: var(--brand-contrast);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), var(--shadow-sm);
}
.brand-mark svg {
  width: 17px;
  height: 17px;
}
.header-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 12px;
}
.header-nav a {
  position: relative;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 550;
  color: var(--text-muted);
  transition: color var(--dur), background var(--dur);
}
.header-nav a:hover {
  color: var(--text);
  background: var(--bg-hover);
}
.header-nav a.active {
  color: var(--text);
}
.header-nav a.active::after {
  content: '';
  position: absolute;
  left: 11px;
  right: 11px;
  bottom: -13px;
  height: 2px;
  border-radius: 2px;
  background: var(--brand);
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.header-search {
  position: relative;
  width: 260px;
  margin-right: 6px;
}
.header-search svg {
  position: absolute;
  left: 11px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  color: var(--text-subtle);
  pointer-events: none;
}
.header-search .input {
  height: 36px;
  padding-left: 34px;
  padding-right: 52px;
  background: var(--bg-subtle);
}
.header-search .keys {
  position: absolute;
  right: 8px;
  top: 50%;
  display: flex;
  gap: 3px;
  transform: translateY(-50%);
  pointer-events: none;
}
.header-search .input:focus ~ .keys {
  display: none;
}
.icon-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: var(--text-muted);
  transition: background var(--dur), color var(--dur), transform var(--dur);
}
.icon-button:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.icon-button:active {
  transform: scale(0.92);
}
.icon-button svg {
  width: 19px;
  height: 19px;
}
.count-badge {
  position: absolute;
  top: 1px;
  right: 1px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--bg);
  font-variant-numeric: tabular-nums;
}
.count-badge.brand {
  background: var(--brand);
  color: var(--brand-contrast);
}
.avatar-button {
  display: inline-grid;
  place-items: center;
  margin-left: 6px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: none;
  transition: box-shadow var(--dur);
}
.avatar-button:hover,
.avatar-button[aria-expanded='true'] {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--brand);
}
.menu-button {
  display: none;
}
.user-menu {
  width: 280px;
}
.user-menu-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 10px;
  border-radius: var(--radius);
}
.user-menu-head:hover {
  background: var(--bg-hover);
}
.notif-menu {
  width: min(380px, calc(100vw - 24px));
  padding: 0 !important;
}
.notif-menu-list {
  max-height: 420px;
  overflow-y: auto;
  padding: 4px;
}
.notif-item {
  display: flex;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: inherit;
  text-align: left;
  font: inherit;
}
.notif-item:hover {
  background: var(--bg-hover);
}
.notif-item.unread {
  background: var(--brand-softer);
}
.notif-item .notif-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--bg-muted);
  color: var(--text-muted);
}
.notif-title {
  display: block;
  font-size: 13.5px;
  line-height: 1.4;
}
.notif-item.unread .notif-title {
  font-weight: 600;
}
.notif-time {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: var(--text-subtle);
}
.unread-dot {
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--brand);
}

/* ---------- Mobile drawer ---------- */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--overlay);
  animation: fade-in 160ms;
}
.drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 61;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: min(320px, 86vw);
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  transform: translateX(-102%);
  transition: transform 220ms var(--ease);
  overflow-y: auto;
}
.drawer.open {
  transform: none;
}
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.drawer-head .brand img {
  max-width: 150px;
}
.drawer nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.drawer nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 550;
}
.drawer nav a:hover {
  background: var(--bg-hover);
}
.drawer nav a.active {
  background: var(--brand-soft);
  color: var(--brand-text);
}
.drawer nav a svg {
  width: 18px;
  height: 18px;
}
.eyebrow {
  margin: 14px 0 6px;
  padding: 0 4px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-subtle);
}

/* ---------- Page shells ---------- */
.page {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 20px 72px;
}
.narrow-page {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 36px 20px 80px;
}
/* Sign-in pages fill the space between header and footer and centre their card in it, so a short
   card (e.g. Discord as the only sign-in method) doesn't hang under the header. The extra bottom
   padding keeps it a little above the true centre, which reads as centred. A tall form just grows. */
.auth-page {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: 40px 20px 88px;
}
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.page-title {
  margin: 0 0 4px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
}
.page-subtitle {
  margin: 0;
  color: var(--text-muted);
}
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--text-subtle);
}
.breadcrumbs a {
  color: var(--text-muted);
}
.breadcrumbs a:hover {
  color: var(--text);
}
.breadcrumbs svg {
  width: 14px;
  height: 14px;
}
.page-notices {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}
.with-sidebar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 32px;
  align-items: start;
}
.side-nav-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}
.side-nav {
  position: sticky;
  top: calc(var(--header-h) + 20px);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.side-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 550;
  color: var(--text-muted);
}
.side-nav a:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.side-nav a.active {
  background: var(--brand-soft);
  color: var(--brand-text);
}
.side-nav a .count {
  margin-left: auto;
  font-size: 12px;
  font-weight: 650;
}
.sub-nav {
  margin-bottom: 20px;
}

/* ---------- Footer ---------- */
.footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 40px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 44px 20px;
}
.footer-grid p {
  max-width: 300px;
  margin: 12px 0 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-muted);
}
.footer-grid ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
}
.footer-grid ul a {
  color: var(--text-muted);
}
.footer-grid ul a:hover {
  color: var(--text);
}
.footer-grid .eyebrow {
  margin: 0 0 12px;
  padding: 0;
}
.footer-bottom {
  border-top: 1px solid var(--border);
}
.footer-bottom-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px 20px;
  font-size: 12.5px;
  color: var(--text-subtle);
}
/* Copyright link: looks like plain footer text until hovered or focused, then glows blue. */
.footer-copyright-link {
  --copyright-glow: #2563eb;
  color: inherit;
  border-radius: 3px;
  transition: color 220ms var(--ease), text-shadow 220ms var(--ease);
}
:root[data-theme='dark'] .footer-copyright-link {
  --copyright-glow: #60a5fa;
}
.footer-copyright-link:hover,
.footer-copyright-link:focus-visible {
  color: var(--copyright-glow);
  text-shadow: 0 0 6px color-mix(in srgb, var(--copyright-glow) 55%, transparent), 0 0 16px color-mix(in srgb, var(--copyright-glow) 35%, transparent);
}

/* ---------- Status pages ---------- */
.status-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 60vh;
  padding: 40px 20px;
  text-align: center;
}
.status-page .code {
  font-size: 72px;
  font-weight: 750;
  letter-spacing: -0.05em;
  line-height: 1;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.status-page h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: -0.02em;
}
.status-page p {
  margin: 0;
  max-width: 460px;
  color: var(--text-muted);
  white-space: pre-line;
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .with-sidebar {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 960px) {
  .header-nav,
  .header-search {
    display: none;
  }
  .menu-button {
    display: inline-grid;
  }
  .side-nav-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }
  .side-nav {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
  }
  .side-nav a {
    flex: none;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 560px) {
  .header-inner {
    gap: 6px;
    padding: 0 10px;
  }
  .brand > span:not(.brand-mark) {
    display: none;
  }
  .page,
  .narrow-page {
    padding: 20px 14px 56px;
  }
  .page-title {
    font-size: 23px;
  }
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .hide-sm {
    display: none !important;
  }
}
