.rsm-site-preferences {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font: 600 12px/1.4 var(--ds-font, system-ui, sans-serif);
  color: var(--ds-muted, #53685f);
}

.site-preferences-footer {
  justify-content: center;
  width: min(100%, 960px);
  margin: 16px auto;
  padding: 8px 16px;
}

/* The signed-in shells own their scrolling; an outside footer sits below the
   fixed mobile navigation (or outside the locked studio viewport entirely).
   Keep the login footer, and use the account menu while signed in. */
body:has(#appView:not([hidden])) > .site-preferences-footer,
body:has(#studioApp:not([hidden])) > .site-preferences-footer {
  display: none;
}

.rsm-account-preferences.rsm-site-preferences {
  display: grid;
  gap: 10px;
  padding: 10px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--ds-line, #dae4db);
}

.rsm-account-preferences .rsm-preference-control {
  display: grid;
  grid-template-columns: 1fr;
}

.rsm-account-preferences .rsm-preference-control select { width: 100%; }

:is(.profile-menu, .account-menu):has(> .rsm-account-preferences) {
  min-width: min(210px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: max(44px, calc(100dvh - var(--topbar-height, var(--studio-topbar-height, 128px)) - var(--safe-top, 0px) - var(--safe-bottom, 0px) - 24px));
  overflow-y: auto;
  overscroll-behavior: contain;
}

@media (max-width: 720px) {
  :is(.profile-menu, .account-menu):has(> .rsm-account-preferences) {
    max-height: max(44px, calc(100dvh - var(--topbar-height, var(--studio-topbar-height, 128px)) - 66px - var(--safe-top, 0px) - var(--safe-bottom, 0px) - 24px));
  }
}

@media print {
  .site-preferences-footer { display: none !important; }
}

.rsm-preference-control {
  display: flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
}

.rsm-preference-control select {
  width: auto;
  min-width: 76px;
  min-height: 44px;
  max-width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--ds-line, #dae4db);
  border-radius: 13px;
  background: var(--ds-soft, #f2f6ef);
  color: var(--ds-ink, #233c36);
  font: inherit;
  cursor: pointer;
}

.rsm-preference-control select:focus-visible {
  outline: 3px solid var(--ds-link, #256b50);
  outline-offset: 2px;
}

@media (max-width: 420px) {
  .rsm-site-preferences { gap: 6px; }
  .rsm-preference-control { gap: 4px; }
  .rsm-preference-control select { padding-inline: 7px; }
}
