:root {
  color-scheme: dark;
  --bg: #0d1411;
  --bg-top: #17231d;
  --surface: #141f1a;
  --surface-strong: #1d2c25;
  --field: #0f1814;
  --ink: #f4f7f3;
  --muted: #aab8b1;
  --line: #2c4037;
  --accent: #62d0ad;
  --accent-dark: #9be4ce;
  --button-ink: #06100c;
  --gold: #d5a34b;
  --danger: #e06666;
  --bar: rgba(13, 20, 17, 0.88);
  --flag-red: #c84646;
  --flag-blue: #2e4f89;
  --flag-white: #f6f2e8;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.32);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f7f3;
  --bg-top: #fbfcfb;
  --surface: #ffffff;
  --surface-strong: #eef3ef;
  --field: #ffffff;
  --ink: #18211d;
  --muted: #65716a;
  --line: #dce3de;
  --accent: #2f7d68;
  --accent-dark: #225d50;
  --button-ink: #ffffff;
  --gold: #bd7b2b;
  --danger: #b23b3b;
  --bar: rgba(255, 255, 255, 0.9);
  --flag-red: #b63838;
  --flag-blue: #29487d;
  --flag-white: #fff8ea;
  --shadow: 0 18px 45px rgba(20, 36, 28, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 34rem);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: var(--accent-dark);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
.button {
  align-items: center;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: var(--button-ink);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  justify-content: center;
  min-height: 2.6rem;
  padding: 0.65rem 1rem;
  text-align: center;
  white-space: normal;
}

button:hover,
.button:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  text-decoration: none;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button.secondary,
.button.secondary {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

button.danger {
  background: var(--danger);
  border-color: var(--danger);
}

input,
select,
textarea {
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  margin-top: 0.4rem;
  min-height: 2.6rem;
  padding: 0.65rem 0.75rem;
  width: 100%;
}

input[type="file"]::file-selector-button {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  margin-right: 0.75rem;
  min-height: 2rem;
  padding: 0.35rem 0.65rem;
}

input[type="file"]::file-selector-button:hover {
  border-color: var(--accent);
}

textarea {
  line-height: 1.45;
  resize: vertical;
}

label {
  color: var(--ink);
  display: block;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 4.5rem);
  line-height: 0.95;
  margin-bottom: 1rem;
  max-width: 13ch;
}

h2 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

h3 {
  font-size: 1rem;
}

.topbar {
  align-items: center;
  background: var(--bar);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  padding: 0.8rem clamp(1rem, 4vw, 2rem);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(16px);
}

.brand {
  align-items: center;
  color: var(--ink);
  display: flex;
  font-weight: 900;
  gap: 0.65rem;
  min-width: max-content;
}

.brand-mark {
  border: 1px solid var(--line);
  border-radius: 3px;
  height: 1.45rem;
  object-fit: contain;
  width: 2.75rem;
}

.nav {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  justify-content: flex-end;
}

.nav a,
.link-button {
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 700;
}

.desktop-nav {
  display: flex;
}

.mobile-nav {
  display: none;
  margin-left: auto;
  position: relative;
}

.nav-dropdown,
.mobile-nav,
.mobile-submenu,
.action-menu {
  color: var(--ink);
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown summary,
.mobile-nav > summary,
.mobile-submenu > summary,
.action-menu > summary {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  font-weight: 800;
  list-style: none;
  min-height: 2.25rem;
  padding: 0.35rem 0.65rem;
}

.nav-dropdown summary::-webkit-details-marker,
.mobile-nav > summary::-webkit-details-marker,
.mobile-submenu > summary::-webkit-details-marker,
.action-menu > summary::-webkit-details-marker {
  display: none;
}

.nav-dropdown summary:hover,
.mobile-nav > summary:hover,
.mobile-submenu > summary:hover,
.action-menu > summary:hover {
  background: var(--surface-strong);
  border-color: var(--line);
}

.dropdown-menu,
.mobile-menu {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 0.15rem;
  min-width: 12rem;
  padding: 0.45rem;
  z-index: 20;
}

.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.45rem);
}

.dropdown-menu a,
.dropdown-action,
.mobile-menu a,
.mobile-submenu > a {
  background: transparent;
  border: 0;
  border-radius: 7px;
  color: var(--ink);
  display: block;
  font: inherit;
  font-size: 0.94rem;
  font-weight: 750;
  min-height: auto;
  padding: 0.55rem 0.65rem;
  text-align: left;
  width: 100%;
}

.dropdown-menu a:hover,
.dropdown-action:hover,
.mobile-menu a:hover,
.mobile-submenu > a:hover {
  background: var(--surface-strong);
  color: var(--ink);
  text-decoration: none;
}

.menu-count-row {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
}

.topbar-backroom-link {
  align-items: center;
}

.nav-badge {
  align-items: center;
  background: #d83f3f;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-size: 0.72rem;
  font-weight: 900;
  height: 1.25rem;
  justify-content: center;
  line-height: 1;
  margin-left: 0.4rem;
  min-width: 1.25rem;
  padding: 0 0.35rem;
}

.danger-text {
  color: var(--danger);
}

.theme-toggle {
  background: var(--surface-strong);
  border-color: var(--line);
  color: var(--ink);
  font-size: 0.85rem;
  min-height: 2rem;
  padding: 0.25rem 0.65rem;
}

.inline-form {
  display: inline;
  margin: 0;
}

.link-button {
  background: transparent;
  border: 0;
  min-height: auto;
  padding: 0;
}

.page {
  margin: 0 auto;
  max-width: 1180px;
  padding: clamp(1.25rem, 4vw, 3rem);
}

.backroom-layout {
  align-items: start;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: minmax(13rem, 16rem) minmax(0, 1fr);
}

.backroom-sidebar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 1rem;
  padding: 1rem;
  position: sticky;
  top: 5.25rem;
}

.backroom-sidebar-heading h2 {
  font-size: 1.1rem;
  margin: 0;
}

.backroom-nav {
  display: grid;
  gap: 0.3rem;
}

.backroom-nav h3 {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0;
  margin: 0.25rem 0 0.15rem;
  text-transform: uppercase;
}

.backroom-nav a {
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ink);
  font-weight: 800;
  padding: 0.65rem 0.7rem;
}

.backroom-nav a:hover {
  background: var(--surface-strong);
  border-color: var(--line);
  text-decoration: none;
}

.backroom-nav a.active {
  background: var(--surface-strong);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  color: var(--accent-dark);
}

.backroom-main {
  min-width: 0;
}

.notice,
.error {
  border-radius: 8px;
  font-weight: 700;
  margin: 1rem auto 0;
  max-width: 1180px;
  padding: 0.9rem 1rem;
}

.notice {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  color: var(--accent-dark);
}

.error {
  background: rgba(224, 102, 102, 0.16);
  border: 1px solid rgba(224, 102, 102, 0.35);
  color: var(--danger);
}

.muted {
  color: var(--muted);
}

.eyebrow {
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0;
  margin-bottom: 0.55rem;
  text-transform: uppercase;
}

.landing-grid,
.auth-shell,
.profile-layout,
.person-hero {
  align-items: start;
  display: grid;
  gap: clamp(1rem, 4vw, 3rem);
  grid-template-columns: minmax(0, 1fr) minmax(20rem, 28rem);
}

.landing-copy {
  min-height: min(70vh, 42rem);
  padding-top: clamp(1rem, 8vh, 6rem);
}

.dashboard-hero,
.home-hero {
  align-items: stretch;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: minmax(0, 1.2fr) minmax(19rem, 0.8fr);
  margin-bottom: 1.25rem;
}

.dashboard-hero h1,
.home-hero h1 {
  max-width: 14ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.spotlight-card,
.dashboard-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: clamp(1rem, 3vw, 1.25rem);
}

.spotlight-card {
  display: grid;
  gap: 0.8rem;
}

.spotlight-link {
  color: var(--ink);
  display: grid;
  gap: 0.6rem;
}

.spotlight-link strong {
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.08;
}

.dashboard-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 1.25rem;
}

.home-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.25fr);
  margin-bottom: 1.25rem;
}

.dashboard-panel {
  display: grid;
  gap: 0.95rem;
}

.attention-panel {
  border-color: color-mix(in srgb, var(--gold) 45%, var(--line));
}

.quick-link-grid,
.work-grid {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
}

.quick-link-grid a,
.work-grid a {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  display: grid;
  gap: 0.2rem;
  min-height: 4.25rem;
  padding: 0.75rem;
}

.quick-link-grid a:hover,
.work-grid a:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.work-grid strong {
  font-size: 1.8rem;
  line-height: 1;
}

.work-grid span {
  color: var(--muted);
}

.dashboard-mini-stats {
  align-content: start;
}

.compact-card {
  box-shadow: none;
}

.full-width-panel {
  margin-top: 1.25rem;
}

.form-panel,
.review-card,
.item-card,
.comment,
.history-card,
.copy-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.form-panel {
  display: grid;
  gap: 1rem;
  padding: clamp(1rem, 3vw, 1.4rem);
}

.form-panel.compact {
  box-shadow: none;
  margin-top: 1rem;
}

.form-panel > summary,
.person-editor > summary,
.user-editor > summary,
.request-editor > summary,
.filter-shell > summary {
  cursor: pointer;
  list-style: none;
}

.form-panel > summary::-webkit-details-marker,
.person-editor > summary::-webkit-details-marker,
.user-editor > summary::-webkit-details-marker,
.request-editor > summary::-webkit-details-marker,
.filter-shell > summary::-webkit-details-marker {
  display: none;
}

.filter-shell {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
}

.filter-shell > summary {
  align-items: center;
  display: flex;
  font-weight: 900;
  gap: 0.75rem;
  justify-content: space-between;
}

.embedded-filter {
  box-shadow: none;
  margin: 0.85rem 0 0;
  padding: 0;
}

.add-person-panel {
  margin-bottom: 1.25rem;
}

.add-person-panel > summary {
  font-size: 1.1rem;
  font-weight: 900;
}

.add-person-panel form,
.person-editor form,
.user-editor form,
.request-editor form {
  display: grid;
  gap: 1rem;
}

.add-person-panel form {
  margin-top: 1rem;
}

.narrow {
  max-width: 42rem;
}

.page-heading {
  margin-bottom: 1.5rem;
}

.page-heading .action-row {
  justify-content: flex-start;
}

.page-heading h1 {
  max-width: 16ch;
}

.stat-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  margin-bottom: 2rem;
}

.stat-card {
  background: #111c17;
  border-radius: 8px;
  color: #fff;
  display: grid;
  gap: 0.35rem;
  min-height: 8rem;
  padding: 1.1rem;
}

.stat-card strong {
  font-size: 2.4rem;
  line-height: 1;
}

.stat-card span {
  color: #c7d7cf;
}

.stat-card.urgent {
  background: var(--gold);
}

.two-column {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.three-column {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.paired-fields {
  align-items: start;
  display: grid;
  gap: 0.85rem;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.two-column.wide-left {
  grid-template-columns: minmax(0, 1.35fr) minmax(18rem, 0.65fr);
}

.section-title,
.action-row,
.reaction-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
}

.item-list,
.grid-list {
  display: grid;
  gap: 0.9rem;
}

.filter-bar {
  align-items: end;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 0.85rem;
  grid-template-columns: minmax(12rem, 1fr);
  margin-bottom: 1.25rem;
  padding: 1rem;
}

.filter-bar label {
  min-width: 0;
}

@media (min-width: 760px) {
  .filter-bar {
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  }
}

.grid-list {
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
}

.item-card {
  color: var(--ink);
  display: grid;
  gap: 0.35rem;
  padding: 1rem;
}

.item-card:hover {
  border-color: rgba(47, 125, 104, 0.45);
  text-decoration: none;
}

.person-card {
  align-items: center;
  grid-template-columns: 3.75rem minmax(0, 1fr);
}

.person-card-thumb,
.media-preview {
  align-items: center;
  aspect-ratio: 1;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent-dark);
  display: flex;
  font-weight: 900;
  justify-content: center;
  overflow: hidden;
}

.person-card-thumb {
  font-size: 1rem;
  width: 3.75rem;
}

.person-card-thumb img,
.media-preview img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.person-card-copy {
  display: grid;
  gap: 0.3rem;
  min-width: 0;
}

.review-card {
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

.admin-person-list {
  margin-top: 1.25rem;
}

.person-editor,
.user-editor,
.request-editor {
  box-shadow: none;
}

.person-editor[open],
.user-editor[open],
.request-editor[open] {
  box-shadow: var(--shadow);
}

.person-editor-summary {
  align-items: center;
  display: grid;
  gap: 0.85rem;
  grid-template-columns: 3.75rem minmax(0, 1fr) auto;
}

.person-editor-summary:hover .person-card-copy strong {
  color: var(--accent-dark);
}

.compact-row h2,
.compact-row h3 {
  font-size: 1.05rem;
  line-height: 1.25;
  margin-bottom: 0;
}

.compact-results {
  gap: 0.65rem;
}

.compact-meta {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.88rem;
  gap: 0.45rem;
}

.compact-meta span {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.25rem 0.5rem;
}

.status {
  background: var(--surface-strong);
  border-radius: 999px;
  color: var(--accent-dark);
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 900;
  padding: 0.25rem 0.55rem;
  width: fit-content;
}

.status.warning {
  background: rgba(213, 163, 75, 0.16);
  color: var(--gold);
}

.empty {
  background: var(--surface-strong);
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 1rem;
}

.profile-layout {
  grid-template-columns: 9rem minmax(0, 1fr);
}

.profile-photo {
  align-items: center;
  aspect-ratio: 1;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent-dark);
  display: flex;
  font-size: 2rem;
  font-weight: 900;
  justify-content: center;
  overflow: hidden;
}

.profile-photo img,
.person-hero img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.media-field {
  align-items: start;
  display: grid;
  gap: 1rem;
  grid-template-columns: 7rem minmax(0, 1fr);
}

.compact-media-field {
  grid-template-columns: 5rem minmax(0, 1fr);
}

.profile-preview {
  font-size: 1.6rem;
  width: 7rem;
}

.person-preview {
  font-size: 1.15rem;
  width: 5rem;
}

.field-help {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0.4rem 0 0.65rem;
}

.mini-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.mini-stats span,
.reaction-counts span {
  background: var(--surface-strong);
  border-radius: 999px;
  padding: 0.45rem 0.7rem;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.badge {
  background: color-mix(in srgb, var(--gold) 18%, var(--surface-strong));
  border: 1px solid color-mix(in srgb, var(--gold) 45%, var(--line));
  border-radius: 999px;
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 900;
  padding: 0.35rem 0.6rem;
}

.person-hero {
  grid-template-columns: minmax(10rem, 18rem) minmax(0, 1fr);
  margin-bottom: 2rem;
}

.person-hero:not(.has-image) {
  display: block;
}

.person-hero img {
  aspect-ratio: 1;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.content-detail {
  display: grid;
  gap: 1rem;
}

.content-heading-row {
  align-items: flex-start;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

.content-heading-row h1 {
  max-width: 18ch;
}

.action-menu {
  flex: 0 0 auto;
  position: relative;
}

.action-menu > summary {
  background: var(--surface);
  border-color: var(--line);
  font-size: 1.2rem;
  justify-content: center;
  min-width: 2.5rem;
}

.action-menu-panel {
  min-width: 13.5rem;
}

.backroom-meta {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.9rem;
  gap: 0.5rem;
}

.backroom-meta span {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
}

.request-meta {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.lore,
.interaction-panel,
.comments {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 1rem;
  padding: 1rem;
}

.interaction-panel {
  padding: 0.75rem;
}

.interaction-quickbar,
.vote-buttons,
.reaction-buttons {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.interaction-quickbar {
  justify-content: space-between;
}

.vote-buttons form,
.reaction-buttons form {
  display: inline-flex;
}

.chip-button {
  background: var(--surface-strong);
  border-color: var(--line);
  color: var(--ink);
  gap: 0.4rem;
  min-height: 2.25rem;
  padding: 0.45rem 0.65rem;
}

.chip-button:hover {
  border-color: var(--accent);
}

.chip-button.active {
  background: color-mix(in srgb, var(--accent) 24%, var(--surface-strong));
  border-color: var(--accent);
  color: var(--accent-dark);
}

.reaction-chip {
  font-weight: 800;
}

.icon-chip {
  font-size: 1.1rem;
  min-width: 2.55rem;
  padding-inline: 0.55rem;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.segmented label,
.check-row {
  align-items: center;
  background: var(--surface-strong);
  border-radius: 8px;
  display: flex;
  gap: 0.55rem;
  padding: 0.7rem;
}

.segmented input,
.check-row input {
  margin: 0;
  min-height: auto;
  width: auto;
}

.reaction-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.8rem;
}

.comment,
.history-card,
.copy-box {
  padding: 1rem;
}

.comment-heading,
.history-footer {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
}

.small-button {
  min-height: 2rem;
  padding: 0.35rem 0.65rem;
}

.pagination {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin: 1rem 0;
}

.disabled-link {
  opacity: 0.5;
  pointer-events: none;
}

.result-count {
  margin: 0.2rem 0 1rem;
}

.leaderboard-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.leaderboard-grid .dashboard-panel:last-child {
  grid-column: 1 / -1;
}

.rank-list {
  display: grid;
  gap: 0.55rem;
}

.rank-row {
  align-items: center;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 2rem minmax(0, 1fr) auto;
  min-height: 3.25rem;
  padding: 0.65rem 0.75rem;
}

.rank-row:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.rank-row strong {
  display: block;
}

.rank-number {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent-dark);
  display: inline-flex;
  font-size: 0.85rem;
  font-weight: 900;
  height: 2rem;
  justify-content: center;
  width: 2rem;
}

.table-wrap {
  overflow-x: auto;
}

table {
  background: var(--surface);
  border: 1px solid var(--line);
  border-collapse: collapse;
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 52rem;
  overflow: hidden;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 0.85rem;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

code {
  background: var(--surface-strong);
  border-radius: 6px;
  padding: 0.15rem 0.35rem;
}

.form-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
}

@media (max-width: 860px) {
  .topbar {
    align-items: center;
  }

  .desktop-nav {
    display: none;
  }

  .mobile-nav {
    display: block;
  }

  .mobile-nav > summary {
    background: var(--surface);
    border-color: var(--line);
  }

  .mobile-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 0.55rem);
    width: min(22rem, calc(100vw - 2rem));
  }

  .mobile-submenu {
    display: grid;
    gap: 0.15rem;
  }

  .mobile-submenu > summary {
    width: 100%;
  }

  .mobile-submenu > a,
  .mobile-submenu .dropdown-action {
    padding-left: 1.35rem;
  }

  .landing-grid,
  .auth-shell,
  .dashboard-hero,
  .home-hero,
  .dashboard-grid,
  .home-grid,
  .leaderboard-grid,
  .backroom-layout,
  .profile-layout,
  .person-hero,
  .paired-fields,
  .two-column,
  .three-column,
  .two-column.wide-left {
    grid-template-columns: 1fr;
  }

  .landing-copy {
    min-height: auto;
    padding-top: 1rem;
  }

  .profile-photo {
    max-width: 9rem;
  }

  .media-field,
  .compact-media-field {
    grid-template-columns: 1fr;
  }

  .backroom-sidebar {
    position: static;
  }

  .backroom-nav {
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  }

  .backroom-nav h3 {
    grid-column: 1 / -1;
  }

  .leaderboard-grid .dashboard-panel:last-child {
    grid-column: auto;
  }
}

@media (max-width: 560px) {
  .topbar {
    gap: 0.75rem;
  }

  .brand {
    min-width: 0;
  }

  .brand span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .content-heading-row {
    align-items: flex-start;
  }

  .person-editor-summary {
    grid-template-columns: 3.25rem minmax(0, 1fr);
  }

  .person-editor-summary .status {
    grid-column: 1 / -1;
  }

  .rank-row {
    gap: 0.6rem;
  }
}
