html, body, #app {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font-family-base);
  background: radial-gradient(circle at 12% 8%, var(--color-page-bg-alt) 0%, var(--color-page-bg) 45%, var(--color-page-bg) 100%);
  color: var(--color-text);
  transition: background-color 180ms ease, color 180ms ease;
}

.shell {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 56px;
  padding: 0 16px;
  background: var(--color-topbar-bg);
  color: var(--color-topbar-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-notice-bar {
  background: color-mix(in srgb, #f7dd8f 78%, var(--color-surface));
  border-bottom: 1px solid color-mix(in srgb, #c89e2a 55%, var(--color-control-border));
  color: color-mix(in srgb, #3b2b00 80%, var(--color-text));
}

.site-notice-inner {
  min-height: 36px;
  padding: 0 16px;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}

.site-notice-spacer {
  min-width: 1px;
}

.site-notice-message {
  justify-self: center;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
}

.site-notice-version {
  justify-self: end;
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.brand {
  font-size: 18px;
  font-weight: 700;
}

.brand-short {
  display: none;
}

.brand-link {
  color: var(--color-topbar-text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
}

.brand-link:hover .brand-logo {
  filter: brightness(1.15);
}

@media (max-width: 1200px) {
  .brand-full {
    display: none;
  }

  .brand-short {
    display: inline;
  }

  .person-search {
    min-width: 220px;
    max-width: 64ch;
  }

  .search-input {
    width: 100%;
  }
}

.menu {
  display: grid;
  grid-template-columns: 1fr minmax(220px, 64ch) auto;
  gap: 8px;
  align-items: center;
  flex: 1;
  min-width: 0;
  margin-left: 12px;
}

.person-search {
  grid-column: 2;
  justify-self: center;
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 220px;
  max-width: 64ch;
}

.menu-actions {
  grid-column: 3;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.search-input {
  width: 100%;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--color-control-border);
  background: var(--color-control-bg);
  color: var(--color-control-text);
  padding: 0 66px 0 10px;
  box-sizing: border-box;
}

.search-input.search-input-loading {
  padding-left: 32px;
}

.search-input::placeholder {
  color: var(--color-text-muted);
}

.search-submit,
.search-clear {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-control-text);
  background: transparent;
}

.search-submit {
  right: 5px;
}

.search-clear {
  right: 34px;
}

.search-submit:hover,
.search-clear:hover {
  background: var(--color-control-hover);
}

.search-loading {
  position: absolute;
  left: 10px;
  top: 50%;
  width: 14px;
  height: 14px;
  transform: translateY(-50%);
  border-radius: 999px;
  border: 2px solid color-mix(in srgb, var(--color-control-border) 70%, transparent);
  border-top-color: var(--color-primary);
  animation: search-spin 0.8s linear infinite;
  pointer-events: none;
}

@keyframes search-spin {
  to {
    transform: translateY(-50%) rotate(360deg);
  }
}

.search-suggest-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  border: 1px solid var(--color-control-border);
  border-radius: 10px;
  background: var(--color-control-bg);
  box-shadow: var(--shadow-soft);
  overflow: auto;
  max-height: min(62vh, 440px);
  z-index: 25;
  scrollbar-width: thin;
  scrollbar-color: var(--color-control-border) transparent;
}

.search-suggest-menu::-webkit-scrollbar {
  width: 8px;
}

.search-suggest-menu::-webkit-scrollbar-track {
  background: transparent;
  margin-block: 12px;
}

.search-suggest-menu::-webkit-scrollbar-thumb {
  background: var(--color-control-border);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}

.search-suggest-menu::-webkit-scrollbar-thumb:hover {
  background: var(--color-control-hover);
}

.search-suggest-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--color-control-text);
  text-align: left;
  padding: 9px 10px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  column-gap: 10px;
  align-items: center;
  cursor: pointer;
}

.search-suggest-item + .search-suggest-item {
  border-top: 1px solid var(--color-control-border);
}

.search-suggest-item:hover {
  background: var(--color-control-hover);
}

.search-suggest-main {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
}

.search-suggest-text {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.search-suggest-meta {
  font-size: 12px;
  color: var(--color-text-muted);
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}

.search-suggest-photo {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  object-fit: cover;
  object-position: center;
  border: 1px solid var(--color-control-border);
  box-sizing: border-box;
  background: color-mix(in srgb, var(--color-control-hover) 60%, transparent);
}

.search-suggest-photo-placeholder {
  display: inline-block;
  border: 0;
  background: transparent;
}

.search-suggest-years {
  font-variant-numeric: tabular-nums;
}

@media (max-width: 900px) {
  .person-search {
    min-width: 160px;
    max-width: 48ch;
  }

  .menu {
    grid-template-columns: 1fr minmax(160px, 48ch) auto;
  }

  .site-notice-inner {
    grid-template-columns: 1fr;
    padding: 6px 12px;
    gap: 2px;
  }

  .site-notice-spacer {
    display: none;
  }

  .site-notice-version {
    justify-self: center;
    text-align: center;
  }
}

.menu-link {
  color: var(--color-topbar-link);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 600;
}

.menu-link.active {
  background: var(--color-topbar-link-active-bg);
  color: var(--color-topbar-link-active-text);
}

.lang-picker,
.theme-picker {
  position: relative;
  display: flex;
  align-items: center;
}

.lang-button,
.theme-button {
  min-width: 0;
  width: max-content;
  max-width: 100%;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--color-control-border);
  background: var(--color-control-bg);
  color: var(--color-control-text);
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  white-space: nowrap;
}

.lang-menu,
.theme-menu {
  position: absolute;
  top: 38px;
  right: 0;
  min-width: 0;
  width: max-content;
  max-width: min(92vw, 420px);
  border: 1px solid var(--color-control-border);
  border-radius: 10px;
  background: var(--color-control-bg);
  padding: 6px;
  z-index: 20;
  display: grid;
  gap: 4px;
  box-shadow: var(--shadow-soft);
}

.lang-menu {
  max-height: min(80vh, calc((34px * 15) + (4px * 14) + 12px));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 10px;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--color-control-border) transparent;
}

.lang-menu::-webkit-scrollbar {
  width: 8px;
}

.lang-menu::-webkit-scrollbar-track {
  background: transparent;
  margin-block: 12px;
}

.lang-menu::-webkit-scrollbar-thumb {
  background: var(--color-control-border);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}

.lang-menu::-webkit-scrollbar-thumb:hover {
  background: var(--color-control-hover);
}

.lang-option,
.theme-option {
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--color-control-text);
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
}

.lang-option:hover,
.theme-option:hover {
  background: var(--color-control-hover);
}

.lang-option:disabled,
.theme-option:disabled {
  color: var(--color-control-disabled);
  cursor: default;
}

.flag-icon {
  width: 18px;
  height: 12px;
  border-radius: 2px;
  object-fit: cover;
  flex: 0 0 auto;
}

.theme-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-control-text);
  flex: 0 0 auto;
}

.main {
  flex: 1;
  min-height: 0;
}

.main-shell {
  width: 100%;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 12px;
}

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

.ad-rail {
  width: 300px;
  padding-top: 16px;
}

.ad-rail-slot {
  position: sticky;
  top: 68px;
  min-height: 600px;
  border: 1px solid var(--color-control-border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--color-surface) 86%, transparent);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  box-sizing: border-box;
  overflow: hidden;
}

.ad-rail-tag {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  position: relative;
  z-index: 2;
}

.ad-rail-placeholder {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  text-align: center;
}

.ad-rail-slot-adsense {
  justify-content: flex-start;
}

.ad-rail-adsense-slot {
  width: 300px;
  min-height: 600px;
  position: relative;
  z-index: 1;
}

.ad-rail-slot-adsense .ad-rail-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 44px 12px 12px;
  box-sizing: border-box;
}

.ad-rail-adsense-slot[data-ad-status="filled"] ~ .ad-rail-placeholder {
  display: none;
}

@media (max-width: 1279px) {
  .main-shell {
    padding: 0;
    display: block;
  }

  .ad-rail {
    display: none;
  }
}

@media (min-width: 1280px) {
  .main-shell .main-content > .atlas-page {
    padding-left: 0;
  }
}

.home-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 38px 16px 32px;
}

.home-hero {
  display: flex;
  align-items: flex-start;
  gap: 22px;
}

.home-logo {
  display: inline-flex;
  color: var(--color-primary);
  flex: 0 0 auto;
}

.home-content {
  min-width: 0;
  max-width: 760px;
}

.home-copy {
  min-width: 0;
}

.home-title {
  margin: 0 0 8px;
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1.05;
  color: var(--color-text);
}

.home-caption {
  margin: 0;
  max-width: 760px;
  font-size: 18px;
  color: var(--color-text-muted);
}

.home-description {
  margin-top: 26px;
}

.home-body {
  margin: 0;
  color: var(--color-text);
  line-height: 1.6;
  font-size: 17px;
  text-align: justify;
  white-space: pre-line;
}

@media (max-width: 720px) {
  .home-hero {
    align-items: flex-start;
    gap: 14px;
  }

  .home-logo svg {
    width: 64px;
    height: 64px;
  }
}

.site-footer {
  border-top: 1px solid var(--color-surface-border);
  background: var(--color-surface);
  padding: 12px 8px 12px 16px;
}

.footer-nav {
  width: 100%;
  margin: 0;
  display: flex;
  gap: 20px;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
}

.footer-link {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 14px;
}

.footer-link:hover,
.footer-link.active {
  color: var(--color-text);
}

.stats-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 16px 32px;
}

.user-button {
  min-width: 0;
  width: max-content;
  max-width: 220px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--color-control-border);
  background: var(--color-control-bg);
  color: var(--color-control-text);
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}

.user-button.active {
  background: var(--color-topbar-link-active-bg);
  color: var(--color-topbar-link-active-text);
}

.user-button-label {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 136px;
}

@media (max-width: 860px) {
  .user-button-label {
    display: none;
  }
}

.account-page {
  width: min(860px, 94vw);
  margin: 28px auto 34px;
  display: grid;
  gap: 16px;
}

.account-profile-page {
  width: fit-content;
  max-width: 94vw;
  justify-items: start;
}

.auth-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.auth-switch-item {
  border-radius: 999px;
  border: 1px solid var(--color-control-border);
  background: var(--color-control-bg);
  color: var(--color-control-text);
  height: 34px;
  padding: 0 14px;
  cursor: pointer;
}

.auth-switch-item.active {
  background: var(--color-topbar-link-active-bg);
  color: var(--color-topbar-link-active-text);
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.account-card {
  border: 1px solid var(--color-control-border);
  background: var(--color-control-bg);
  color: var(--color-control-text);
  border-radius: 12px;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.account-profile-page .account-card {
  width: fit-content;
  max-width: 100%;
}

.account-form-grid {
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(0, 1fr);
  gap: 8px 10px;
  align-items: center;
}

.account-form-grid label {
  font-size: 13px;
  color: var(--color-text-muted);
  text-align: right;
  padding-right: 6px;
}

.account-profile-page .account-form-grid {
  grid-template-columns: minmax(120px, 180px) minmax(260px, 420px);
  justify-content: start;
}

.account-profile-page .account-form-grid > :nth-child(2n) {
  width: 100%;
  justify-self: stretch;
}

.account-form-grid input,
.account-form-grid select {
  min-width: 0;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--color-control-border);
  background: var(--color-page-bg);
  color: var(--color-text);
  padding: 0 10px;
  box-sizing: border-box;
}

.account-phone-inline {
  display: flex;
  gap: 8px;
  align-items: center;
}

.account-phone-field {
  display: grid;
  gap: 4px;
}

.account-phone-input {
  width: 14ch;
  max-width: 14ch;
  min-width: 14ch;
}

.account-inline-validation {
  margin: 0;
  font-size: 12px;
  color: color-mix(in srgb, #f0ad4e 75%, var(--color-text));
}

.account-dial-picker {
  position: relative;
  flex: 0 0 auto;
  width: fit-content;
  max-width: min(92vw, 420px);
}

.account-dial-button,
.account-dial-option {
  width: auto;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--color-control-border);
  background: var(--color-page-bg);
  color: var(--color-text);
  display: grid;
  grid-template-columns: 18px 56px minmax(0, 1fr);
  align-items: center;
  gap: 4px;
  padding: 0 10px;
  text-align: left;
  box-sizing: border-box;
  white-space: nowrap;
}

.account-dial-button {
  cursor: pointer;
  max-width: 100%;
}

.account-dial-menu {
  position: absolute;
  left: 0;
  right: auto;
  top: calc(100% + 4px);
  z-index: 40;
  border: 1px solid var(--color-control-border);
  border-radius: 8px;
  background: var(--color-control-bg);
  width: max-content;
  min-width: 100%;
  max-width: min(92vw, 420px);
  max-height: 260px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 10px;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--color-control-border) transparent;
  padding: 4px;
  display: grid;
  gap: 4px;
}

.account-dial-search {
  width: 100%;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--color-control-border);
  background: var(--color-page-bg);
  color: var(--color-text);
  padding: 0 10px;
  box-sizing: border-box;
}

.account-dial-empty {
  min-height: 34px;
  border-radius: 8px;
  border: 1px solid var(--color-control-border);
  background: var(--color-page-bg);
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  padding: 0 10px;
  box-sizing: border-box;
}

.account-dial-menu::-webkit-scrollbar {
  width: 8px;
}

.account-dial-menu::-webkit-scrollbar-track {
  background: transparent;
  margin-block: 12px;
}

.account-dial-menu::-webkit-scrollbar-thumb {
  background: var(--color-control-border);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}

.account-dial-menu::-webkit-scrollbar-thumb:hover {
  background: var(--color-control-hover);
}

.account-dial-option {
  cursor: pointer;
  width: 100%;
}

.account-dial-option:hover,
.account-dial-button:hover {
  background: var(--color-control-hover);
}

.account-dial-code {
  min-width: 56px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.account-flag-icon {
  width: 18px;
  height: 12px;
  object-fit: cover;
  border-radius: 2px;
}

.account-flag-fallback {
  width: 18px;
  text-align: center;
  line-height: 1;
  font-size: 9px;
  font-weight: 700;
  color: var(--color-text-muted);
  letter-spacing: 0.2px;
}

.account-form-grid .account-sso-readonly:disabled {
  background: color-mix(in srgb, var(--color-control-bg) 72%, var(--color-page-bg));
  color: var(--color-text-muted);
  border-color: color-mix(in srgb, var(--color-control-border) 82%, var(--color-text-muted));
  opacity: 1;
  cursor: not-allowed;
}

.account-birth-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.account-form-grid .account-birth-input {
  flex: 0 0 auto;
  min-width: 78px;
  padding-right: 26px;
}

.account-birth-year {
  min-width: 102px;
}

.account-birth-month,
.account-birth-day {
  min-width: 86px;
}

:root[data-theme="night"] .account-form-grid .account-birth-input,
:root[data-theme="dawn"] .account-form-grid .account-birth-input,
:root[data-theme="futuristic"] .account-form-grid .account-birth-input {
  color-scheme: dark;
}

.account-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.account-spacer {
  margin-top: 8px;
}

.btn-primary,
.btn-secondary {
  border-radius: 8px;
  border: 1px solid var(--color-control-border);
  height: 34px;
  padding: 0 14px;
  cursor: pointer;
  color: var(--color-control-text);
}

.btn-primary {
  background: color-mix(in srgb, var(--color-primary) 22%, var(--color-control-bg));
}

.btn-secondary {
  background: var(--color-control-bg);
}

.btn-primary:hover,
.btn-secondary:hover {
  background: var(--color-control-hover);
}

.account-message-error,
.account-message-success {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--color-control-border);
}

.account-message-error {
  background: color-mix(in srgb, #c82333 15%, var(--color-control-bg));
}

.account-message-success {
  background: color-mix(in srgb, #198754 15%, var(--color-control-bg));
}

.account-dev-note {
  margin: 0;
  font-size: 12px;
  color: var(--color-text-muted);
}

.account-subtitle {
  margin: 0;
  font-size: 16px;
}

.account-divider {
  height: 1px;
  background: var(--color-control-border);
  margin: 2px 0;
}

.auth-inline-links {
  margin: 2px 0 0;
  display: grid;
  gap: 6px;
}

.account-card-login {
  width: min(430px, 100%);
}

.account-card-reset {
  width: min(430px, 100%);
}

.auth-text-link {
  border: 0;
  background: transparent;
  color: var(--color-primary);
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  font-size: 13px;
}

.auth-text-link:hover {
  color: color-mix(in srgb, var(--color-primary) 80%, white);
}

.google-signin-box {
  min-height: 42px;
}

@media (max-width: 760px) {
  .account-form-grid {
    grid-template-columns: 1fr;
  }

  .account-form-grid label {
    text-align: left;
    padding-right: 0;
  }

  .account-birth-inline {
    flex-wrap: wrap;
  }

  .account-phone-inline {
    flex-direction: column;
    align-items: stretch;
  }

  .account-phone-input {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .account-dial-picker {
    flex: 1 1 auto;
  }
}

@supports selector(.main:has(.stats-page)) {
  .main:has(.stats-page) {
    background: var(--color-page-bg);
  }
}

.legal-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 16px 32px;
}

.legal-page h1 {
  margin: 0 0 10px;
}

.legal-page p {
  margin: 0;
  color: var(--color-text-muted);
}

.stats-head h1 {
  margin: 0;
  font-size: 28px;
}

.stats-head p {
  margin: 6px 0 0;
  color: var(--color-text-muted);
}

.admin-global-refresh {
  color: var(--color-admin-refresh-accent);
  font-weight: 700;
}

.stats-controls {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: end;
}

.stats-btn {
  padding: 10px 14px;
  border: 0;
  border-radius: 8px;
  background: var(--color-primary);
  color: var(--color-primary-text);
  font-weight: 600;
  cursor: pointer;
}

.stats-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.stats-error {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--color-danger-bg);
  color: var(--color-danger-text);
}

.stats-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.admin-stats-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
  width: min(100%, 560px);
}

.admin-stat-card {
  width: auto;
  min-width: 0;
  max-width: none;
  box-sizing: border-box;
  text-align: left;
}

.admin-stat-card p.admin-stat-value {
  margin: 8px 0 0;
  font-size: 30px;
  font-weight: 800;
  text-align: right;
}

.admin-services {
  margin-top: 18px;
}

.admin-services h2 {
  margin: 0;
  font-size: 24px;
}

.admin-services-grid {
  margin-top: 12px;
  display: inline-block;
  max-width: 100%;
}

.admin-service-card {
  display: inline-block;
  width: max-content;
  max-width: 100%;
  min-width: 280px;
  text-align: left;
}

.admin-service-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-service-led {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  flex: 0 0 48px;
}

.admin-service-led.is-up {
  background: var(--color-success, #2ec96b);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-success, #2ec96b) 25%, transparent);
}

.admin-service-led.is-down {
  background: var(--color-danger, #e25252);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-danger, #e25252) 25%, transparent);
}

.admin-service-card p.admin-service-name {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
  text-align: left;
}

.admin-service-card p.admin-service-version {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--color-text-muted);
  font-weight: 500;
  text-align: left;
}

.admin-service-card p.admin-service-meta {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--color-text-muted);
  font-weight: 500;
  text-align: left;
}

.stats-separator {
  border: 0;
  border-top: 1px solid var(--color-surface-border);
  margin: 20px 0 0;
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-surface-border);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: var(--shadow-soft);
}

.stat-card h2 {
  margin: 0;
  font-size: 14px;
  color: var(--color-text-muted);
  font-weight: 600;
}

.stat-card p {
  margin: 8px 0 0;
  font-size: 30px;
  font-weight: 800;
  color: var(--color-text);
  text-align: right;
}

.stats-ranking {
  margin-top: 18px;
}

.stats-fold-section {
  margin-top: 18px;
}

.stats-fold-toggle {
  width: 100%;
  border: 1px solid var(--color-surface-border);
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
}

.stats-fold-toggle:hover {
  border-color: color-mix(in srgb, var(--color-primary) 45%, var(--color-surface-border) 55%);
}

.stats-fold-title {
  display: block;
  flex: 1 1 auto;
  margin-right: 12px;
  text-align: left;
  font-size: 18px;
  font-weight: 700;
}

.stats-fold-icon {
  width: 26px;
  height: 26px;
  padding: 3px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-primary) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-primary) 40%, transparent);
  transition: transform 180ms ease, background-color 180ms ease, border-color 180ms ease;
}

.stats-fold-toggle:hover .stats-fold-icon {
  background: color-mix(in srgb, var(--color-primary) 18%, transparent);
  border-color: color-mix(in srgb, var(--color-primary) 58%, transparent);
}

.stats-fold-icon.is-open {
  transform: rotate(180deg);
}

.stats-ranking-head h2 {
  margin: 0;
  font-size: 20px;
}

.stats-ranking-head p {
  margin: 6px 0 0;
  color: var(--color-text-muted);
}

.stats-ranking-empty {
  margin: 12px 0 0;
  color: var(--color-text-muted);
}

.stats-ranking-table-wrap {
  margin-top: 12px;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--color-surface-border);
  border-radius: 12px;
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
}

.stats-ranking-table {
  width: max-content;
  border-collapse: collapse;
}

.stats-ranking-table th,
.stats-ranking-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-surface-border);
}

.stats-ranking-table th {
  text-align: left;
  font-size: 13px;
  color: var(--color-text-muted);
  font-weight: 700;
}

.stats-ranking-table td {
  font-size: 14px;
}

.stats-total-row td {
  background: color-mix(in srgb, var(--color-primary) 12%, var(--color-surface) 88%);
  font-weight: 700;
}

.stats-human-population-table tbody td {
  text-align: right;
}

.stats-human-population-table .stats-th-sub {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.1;
}

.stats-human-population-table th.stats-th-center {
  text-align: center;
}

.stats-ranking-person-link {
  color: var(--color-text);
  text-decoration: none;
  font-weight: 600;
}

.stats-ranking-person-link:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

.stats-ranking-table tbody tr:nth-child(even) {
  background: var(--color-table-row-alt);
}

.stats-ranking-table td:nth-child(1) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.admin-cache-table th:nth-child(1),
.admin-cache-table th:nth-child(2),
.admin-cache-table th:nth-child(3),
.admin-cache-table th:nth-child(5),
.admin-cache-table td:nth-child(1),
.admin-cache-table td:nth-child(2),
.admin-cache-table td:nth-child(3),
.admin-cache-table td:nth-child(5) {
  text-align: left;
  font-variant-numeric: normal;
}

.admin-cache-sort-btn {
  width: 100%;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  cursor: pointer;
}

.admin-cache-sort-btn:hover {
  color: var(--color-text);
}

.admin-cache-sort-icon {
  display: inline-flex;
  width: 12px;
  justify-content: center;
  color: color-mix(in srgb, var(--color-text-muted) 70%, var(--color-text));
  font-size: 11px;
  line-height: 1;
}

.admin-cache-table th:nth-child(4) .admin-cache-sort-btn {
  justify-content: flex-end;
}

.admin-cache-table th:nth-child(4),
.admin-cache-table td:nth-child(4) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.admin-cache-status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 9px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.admin-cache-status-pill.is-completed {
  background: color-mix(in srgb, #2ec96b 18%, transparent);
  border-color: color-mix(in srgb, #2ec96b 50%, transparent);
  color: color-mix(in srgb, #1d8a49 84%, var(--color-text));
}

.admin-cache-status-pill.is-in-progress {
  background: color-mix(in srgb, #3e8bff 18%, transparent);
  border-color: color-mix(in srgb, #3e8bff 50%, transparent);
  color: color-mix(in srgb, #235ebf 84%, var(--color-text));
}

.admin-cache-status-pill.is-error {
  background: color-mix(in srgb, #e25252 16%, transparent);
  border-color: color-mix(in srgb, #e25252 48%, transparent);
  color: color-mix(in srgb, #b12323 84%, var(--color-text));
}

.admin-cache-status-pill.is-unknown {
  background: color-mix(in srgb, var(--color-text-muted) 18%, transparent);
  border-color: color-mix(in srgb, var(--color-text-muted) 44%, transparent);
  color: var(--color-text-muted);
}

.stats-top-married-table td:nth-child(1) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.stats-top-married-table td:nth-child(2) {
  text-align: center;
  font-variant-numeric: normal;
}

.stats-top-married-table td:nth-child(3) {
  text-align: left;
  font-variant-numeric: normal;
}

.stats-top-married-table td:nth-child(4) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.stats-top-married-table th:nth-child(1),
.stats-top-married-table th:nth-child(4) {
  text-align: right;
}

.stats-top-married-table th:nth-child(2) {
  text-align: center;
}

.stats-top-genealogy-table td:nth-child(1),
.stats-top-genealogy-table td:nth-child(4),
.stats-top-genealogy-table td:nth-child(5) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.stats-top-genealogy-table td:nth-child(2) {
  text-align: center;
  font-variant-numeric: normal;
}

.stats-top-genealogy-table td:nth-child(3) {
  text-align: left;
  font-variant-numeric: normal;
}

.stats-top-genealogy-table th:nth-child(1),
.stats-top-genealogy-table th:nth-child(4),
.stats-top-genealogy-table th:nth-child(5) {
  text-align: right;
}

.stats-top-genealogy-table th:nth-child(2) {
  text-align: center;
}

.stats-top-photo {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: cover;
  object-position: center;
  border: 1px solid var(--color-control-border);
  box-sizing: border-box;
  background: color-mix(in srgb, var(--color-control-hover) 60%, transparent);
  display: inline-block;
}

.stats-top-photo-placeholder {
  border-color: transparent;
  background: color-mix(in srgb, var(--color-control-hover) 45%, transparent);
}

.stats-ranking-table tbody tr:last-child td {
  border-bottom: 0;
}

.atlas-page {
  width: 100%;
  max-width: none;
  margin: 0;
  height: calc(100dvh - 108px);
  min-height: calc(100dvh - 108px);
  padding: 10px 16px 10px 16px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.atlas-content {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.atlas-content.has-detail-panel {
  flex-direction: row;
  align-items: stretch;
  gap: 12px;
}

.atlas-error {
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--color-danger-bg);
  color: var(--color-danger-text);
}

@media (max-width: 720px) {
  .atlas-page {
    height: calc(100dvh - 126px);
    min-height: calc(100dvh - 126px);
    padding-left: 10px;
    padding-right: 10px;
  }
}

.atlas-stage-wrap {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.atlas-stage {
  width: 100%;
  flex: 1;
  min-height: 260px;
  min-width: 0;
  border-radius: 12px;
  border: 1px solid var(--color-surface-border);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.atlas-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.atlas-stage-loading {
  position: absolute;
  inset: 0;
  z-index: 18;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--color-page-bg) 74%, transparent);
  backdrop-filter: blur(2px);
  pointer-events: none;
}

.atlas-stage-spinner {
  width: 56px;
  height: 56px;
  border-radius: 999px;
  border: 4px solid color-mix(in srgb, var(--color-control-border) 75%, transparent);
  border-top-color: var(--color-primary);
  animation: atlas-stage-spin 0.85s linear infinite;
}

.atlas-stage-loading-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
}

@keyframes atlas-stage-spin {
  to {
    transform: rotate(360deg);
  }
}

.atlas-mode2-fold-controls {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 14;
}

.atlas-mode2-fold-btn {
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid var(--color-control-border);
  background: color-mix(in srgb, var(--color-surface) 88%, #091126);
  color: var(--color-text);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: var(--shadow-soft);
  transform: translate(-50%, -50%);
  transform-origin: center center;
}

.atlas-mode2-fold-btn:hover {
  border-color: var(--color-control-hover);
}

.atlas-mode2-fold-btn:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 2px;
}

.atlas-hud {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--color-control-border);
  background: color-mix(in srgb, var(--color-surface) 82%, transparent);
  color: var(--color-text-muted);
  backdrop-filter: blur(5px);
  pointer-events: none;
  font-size: 18px;
}

.atlas-legend-panel {
  position: absolute;
  left: 12px;
  bottom: 76px;
  z-index: 16;
  width: fit-content;
  max-width: min(420px, calc(100% - 24px));
  border-radius: 12px;
  border: 1px solid var(--color-control-border);
  background: color-mix(in srgb, var(--color-surface) 88%, transparent);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(5px);
  color: var(--color-text);
}

.atlas-legend-panel.is-collapsed {
  width: 38px;
  height: 40px;
  overflow: hidden;
}

.atlas-legend-toggle {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid var(--color-control-border);
  background: color-mix(in srgb, var(--color-surface) 84%, #091126);
  color: var(--color-text);
  cursor: pointer;
  z-index: 2;
}

.atlas-legend-body {
  padding: 10px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.atlas-legend-title {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
}

.atlas-legend-subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--color-text-muted);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.atlas-legend-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.atlas-legend-item {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 18px;
  color: var(--color-text-muted);
  font-size: 13px;
}

.atlas-legend-line {
  display: block;
  width: 64px;
  height: 0;
  border-top: 3px solid transparent;
  border-radius: 999px;
}

.atlas-legend-line-pink {
  border-top-color: var(--atlas-legend-tree-pink);
}

.atlas-legend-line-green {
  border-top-color: var(--atlas-legend-tree-green);
}

.atlas-legend-candy-card {
  --atlas-legend-candy-color: #7ab6ff;
  position: relative;
  display: block;
  width: 64px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid var(--color-control-border);
  background: color-mix(in srgb, var(--color-page-bg) 84%, transparent);
  overflow: hidden;
}

.atlas-legend-candy-canvas {
  position: absolute;
  display: block;
  pointer-events: none;
  background: transparent;
}

.atlas-legend-candy-top {
  --atlas-legend-candy-color: var(--atlas-legend-candy-ancestors);
}

.atlas-legend-candy-top .atlas-legend-candy-canvas {
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
}

.atlas-legend-candy-bottom {
  --atlas-legend-candy-color: var(--atlas-legend-candy-descendants);
}

.atlas-legend-candy-bottom .atlas-legend-candy-canvas {
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px;
}

.atlas-legend-candy-right {
  --atlas-legend-candy-color: var(--atlas-legend-candy-siblings);
}

.atlas-legend-candy-right .atlas-legend-candy-canvas {
  top: 0;
  right: 0;
  width: 4px;
  height: 100%;
}

.atlas-legend-candy-left {
  --atlas-legend-candy-color: var(--atlas-legend-candy-unions);
}

.atlas-legend-candy-left .atlas-legend-candy-canvas {
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.atlas-reset-btn {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 88px;
  height: 88px;
  border-radius: 20px;
  border: 1px solid #ff4dff;
  background: #050b17;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(5, 11, 23, 0.35) inset;
}

.atlas-reset-btn:hover {
  background: #091126;
  border-color: #ff66ff;
}

.atlas-reset-btn:focus-visible {
  outline: 2px solid #ff66ff;
  outline-offset: 2px;
}

.atlas-reset-btn svg {
  width: 40px;
  height: 40px;
  fill: currentColor;
}

.atlas-fit-btn {
  position: absolute;
  right: 108px;
  bottom: 12px;
  width: 88px;
  height: 88px;
  border-radius: 20px;
  border: 1px solid #ff4dff;
  background: #050b17;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(5, 11, 23, 0.35) inset;
}

.atlas-fit-btn:hover {
  background: #091126;
  border-color: #ff66ff;
}

.atlas-fit-btn:focus-visible {
  outline: 2px solid #ff66ff;
  outline-offset: 2px;
}

.atlas-fit-btn svg {
  width: 40px;
  height: 40px;
}

.atlas-fit-btn.is-disabled {
  pointer-events: none;
}

.atlas-reset-btn.is-disabled {
  pointer-events: none;
}

.atlas-view-picker {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 16;
}

.atlas-view-backdrop {
  position: absolute;
  inset: 0;
  z-index: 15;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: default;
}

.atlas-view-button {
  min-width: 0;
  width: fit-content;
  min-height: 44px;
  height: auto;
  justify-content: flex-start;
  gap: 8px;
  box-shadow: var(--shadow-soft);
  font-size: 18px;
  font-weight: 500;
  white-space: nowrap;
}

.atlas-view-label {
  font-weight: 700;
}

.atlas-view-value,
.atlas-view-option-content {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.atlas-view-mode1-icon {
  display: inline-flex;
  width: 16px;
  height: 16px;
  color: color-mix(in srgb, var(--color-text) 90%, #8ad6ff);
  flex: 0 0 auto;
}

.atlas-view-mode1-icon svg {
  width: 16px;
  height: 16px;
}

.atlas-view-mode2-icon {
  display: inline-flex;
  width: 16px;
  height: 16px;
  color: color-mix(in srgb, var(--color-text) 88%, #88dfff);
  flex: 0 0 auto;
}

.atlas-view-mode2-icon svg {
  width: 16px;
  height: 16px;
}

.atlas-view-menu {
  top: 38px;
  min-width: 0;
  width: max-content;
  z-index: 17;
}

.atlas-view-option {
  width: auto;
  justify-content: flex-start;
  white-space: nowrap;
}

.atlas-tree-count-panel {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 16;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--color-control-border);
  background: color-mix(in srgb, var(--color-surface) 90%, #091126);
  color: var(--color-text);
  display: inline-flex;
  align-items: center;
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: var(--shadow-soft);
  pointer-events: none;
}

.atlas-mode-toggle {
  position: absolute;
  top: 12px;
  right: 12px;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--color-control-border);
  background: color-mix(in srgb, var(--color-surface) 90%, #091126);
  color: var(--color-text);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
}

.atlas-mode-toggle:hover {
  border-color: var(--color-control-hover);
}

.atlas-mode-toggle:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 2px;
}

.atlas-mode-toggle.is-active {
  border-color: #5ec9ff;
  color: #d9f4ff;
}

.atlas-mode-legend {
  position: absolute;
  top: 56px;
  right: 12px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--color-control-border);
  background: color-mix(in srgb, var(--color-surface) 85%, transparent);
  color: var(--color-text-muted);
  font-size: 13px;
  backdrop-filter: blur(4px);
  pointer-events: none;
}

.atlas-detail-panel {
  position: relative;
  flex: 0 0 min(340px, 34vw);
  width: min(340px, 34vw);
  height: auto;
  max-height: min(72dvh, calc(100dvh - 190px));
  border-radius: 12px;
  border: 1px solid var(--color-surface-border);
  box-shadow: var(--shadow-soft);
  background: color-mix(in srgb, var(--color-surface) 94%, #051021);
  overflow: auto;
  min-width: 0;
  margin-left: auto;
  align-self: flex-start;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--color-control-border) transparent;
}

.atlas-detail-panel::-webkit-scrollbar {
  width: 8px;
}

.atlas-detail-panel::-webkit-scrollbar-track {
  background: transparent;
  margin-block: 12px;
}

.atlas-detail-panel::-webkit-scrollbar-thumb {
  background: var(--color-control-border);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}

.atlas-detail-panel::-webkit-scrollbar-thumb:hover {
  background: var(--color-control-hover);
}

.atlas-detail-panel.is-collapsed {
  flex-basis: 38px;
  width: 38px;
  min-width: 38px;
  height: 40px;
  max-height: 40px;
  overflow: hidden;
}

.atlas-detail-toggle {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid var(--color-control-border);
  background: color-mix(in srgb, var(--color-surface) 84%, #091126);
  color: var(--color-text);
  cursor: pointer;
  z-index: 2;
}

.atlas-detail-card {
  flex: 1;
  min-height: 0;
  overflow: visible;
  padding: 38px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.atlas-detail-photo {
  width: 100%;
  max-width: 220px;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--color-control-border);
  align-self: center;
}

.atlas-detail-photo-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  background: color-mix(in srgb, var(--color-surface) 80%, transparent);
}

.atlas-detail-name {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.atlas-detail-meta {
  color: var(--color-text-muted);
  font-size: 14px;
  word-break: break-word;
}

.atlas-detail-fields {
  margin: 0;
}

.atlas-detail-fields > div {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px;
  align-items: baseline;
}

.atlas-detail-fields dt {
  margin: 0;
  color: var(--color-text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.atlas-detail-fields dd {
  margin: 0;
}

.atlas-detail-description {
  margin: 0;
  color: var(--color-text-muted);
  line-height: 1.4;
}

.atlas-detail-separator {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--color-surface-border);
  margin: 4px 0 0;
}

.atlas-unions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.atlas-unions-title {
  margin: 0;
  font-size: 16px;
}

.atlas-union-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.atlas-union-item {
  display: grid;
  grid-template-columns: 50px 1fr;
  gap: 8px;
  align-items: start;
}

.atlas-union-photo {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--color-control-border);
}

.atlas-union-photo-placeholder {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.atlas-union-child-photo.atlas-union-photo-placeholder,
.atlas-union-photo.atlas-union-photo-placeholder {
  border-color: transparent;
  background: transparent;
}

.atlas-union-content {
  min-width: 0;
}

.atlas-union-link {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--color-primary);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
}

.atlas-union-link:hover {
  filter: brightness(1.1);
}

.atlas-union-dates {
  margin-top: 2px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  color: var(--color-text-muted);
  font-size: 13px;
}

.atlas-union-relation-caption {
  font-size: 11px;
  line-height: 1.25;
  color: color-mix(in srgb, var(--color-text-muted) 86%, white 14%);
}

.atlas-union-children {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.atlas-union-child-item {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 7px;
  align-items: start;
}

.atlas-union-child-photo {
  width: 36px;
  height: 36px;
  border-radius: 7px;
  object-fit: cover;
  border: 1px solid var(--color-control-border);
}

.atlas-union-child-content {
  min-width: 0;
}

.atlas-union-child-link {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--color-text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
}

.atlas-union-child-link:hover {
  color: var(--color-primary);
}

.atlas-union-child-dates {
  margin-top: 1px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  color: var(--color-text-muted);
  font-size: 12px;
}

@media (max-width: 1180px) {
  .atlas-detail-panel {
    flex-basis: min(320px, 38vw);
    width: min(320px, 38vw);
    max-height: min(68dvh, calc(100dvh - 190px));
  }

  .atlas-detail-panel.is-collapsed {
    flex-basis: 38px;
    width: 38px;
    min-width: 38px;
    height: 40px;
    max-height: 40px;
  }

  .atlas-detail-card {
    max-height: min(64dvh, 620px);
  }
}

@media (max-width: 900px) {
  .atlas-content.has-detail-panel {
    flex-direction: column;
    gap: 10px;
  }

  .atlas-detail-panel,
  .atlas-detail-panel.is-collapsed {
    width: 100%;
    max-height: none;
    flex-basis: auto;
    min-width: 0;
  }

  .atlas-detail-panel.is-collapsed {
    height: 40px;
    max-height: 40px;
  }

  .atlas-detail-card {
    max-height: 38dvh;
  }
}
