/* role-switcher.css — the shared "Viewing as" role-view card (role-switcher.js).
   REM only, mobile-first single column, 2.75rem touch targets, dark mode
   through the host page's --home-* tokens (settings.css defines them for
   :root and [data-theme="dark"]); the fallbacks are settings.css's light
   values for a host without them. Every state is carried by a class and by
   text (badges, status line, alert), never by colour alone. */

.rs-root {
  --rs-danger-bg: #fef2f2;
  --rs-danger-border: #f87171;
  --rs-danger-text: #991b1b;
  --rs-ok-text: #166534;
  --rs-focus: var(--home-accent, #3b82f6);
}
[data-theme="dark"] .rs-root {
  --rs-danger-bg: #3b1219;
  --rs-danger-border: #f87171;
  --rs-danger-text: #fecaca;
  --rs-ok-text: #86efac;
}

.rs-card {
  background: var(--home-card-bg, #ffffff);
  color: var(--home-text, #1e293b);
  border: 0.0625rem solid var(--home-border, #e2e8f0);
  border-radius: 0.75rem;
  padding: 1.25rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.rs-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  margin: 0;
}

.rs-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.rs-eyebrow,
.rs-subhead {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--home-muted, #64748b);
  margin: 0 0 0.5rem;
}

.rs-current-box {
  border: 0.0625rem solid var(--home-border, #e2e8f0);
  border-radius: 0.5rem;
  background: var(--home-accent-light, #eff6ff);
  padding: 0.75rem 1rem;
}

.rs-current-head,
.rs-option-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.rs-current-name {
  font-size: 1rem;
  font-weight: 600;
}

.rs-current-desc,
.rs-option-desc {
  display: block;
  font-size: 0.875rem;
  color: var(--home-muted, #64748b);
  margin: 0.25rem 0 0;
  line-height: 1.4;
}

.rs-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.125rem 0.5rem;
  border-radius: 62.4375rem;
  border: 0.0625rem solid currentColor;
  text-transform: uppercase;
  letter-spacing: 0.03rem;
}
.rs-badge--active { color: var(--home-accent, #3b82f6); }
.rs-badge--admin { color: var(--home-muted, #64748b); }

.rs-note,
.rs-hint {
  font-size: 0.875rem;
  color: var(--home-muted, #64748b);
  margin: 0;
  line-height: 1.5;
}

.rs-held {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.rs-held-item {
  padding: 0.625rem 0.75rem;
  border: 0.0625rem solid var(--home-border, #e2e8f0);
  border-radius: 0.5rem;
}

.rs-fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.rs-legend {
  font-size: 0.9375rem;
  font-weight: 600;
  padding: 0;
  margin-bottom: 0.25rem;
}

.rs-option {
  display: flex;
  align-items: stretch;
  gap: 0.75rem;
  min-height: 2.75rem;
  padding: 0 0.75rem;
  border: 0.0625rem solid var(--home-border, #e2e8f0);
  border-radius: 0.5rem;
}
.rs-option:has(.rs-radio:checked) {
  border-color: var(--home-accent, #3b82f6);
}
.rs-radio {
  flex: 0 0 auto;
  align-self: center;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0;
  accent-color: var(--home-accent, #3b82f6);
}
.rs-option-label {
  /* The label fills the whole row, so the click target is the full
     2.75rem-high option, not only its text. */
  flex: 1 1 auto;
  cursor: pointer;
  min-height: 2.75rem;
  padding: 0.5rem 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.rs-option-name {
  font-size: 0.9375rem;
  font-weight: 500;
}

.rs-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.rs-btn {
  min-height: 2.75rem;
  width: 100%;
  padding: 0.5rem 1.25rem;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: 0.5rem;
  border: 0.0625rem solid var(--home-border, #e2e8f0);
  background: transparent;
  color: var(--home-text, #1e293b);
  cursor: pointer;
}
.rs-btn--primary {
  background: var(--home-accent, #3b82f6);
  border-color: var(--home-accent, #3b82f6);
  color: #ffffff;
}
[data-theme="dark"] .rs-btn--primary { color: #0f172a; }
.rs-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.rs-card.is-busy .rs-btn--primary { cursor: progress; }

.rs-btn:focus-visible,
.rs-radio:focus-visible,
.rs-request-link:focus-visible {
  outline: 0.1875rem solid var(--rs-focus);
  outline-offset: 0.125rem;
}

.rs-status {
  font-size: 0.875rem;
  margin: 0;
  min-height: 1.25rem;
  color: var(--home-text, #1e293b);
}
.rs-status:empty { min-height: 0; }

.rs-error {
  background: var(--rs-danger-bg);
  border: 0.0625rem solid var(--rs-danger-border);
  border-left-width: 0.25rem;
  color: var(--rs-danger-text);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  line-height: 1.5;
}

.rs-divider {
  border: 0;
  border-top: 0.0625rem solid var(--home-border, #e2e8f0);
  margin: 0 0 0.75rem;
}
.rs-request-line {
  font-size: 0.875rem;
  margin: 0;
  color: var(--home-muted, #64748b);
}
.rs-request-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  color: var(--home-accent, #3b82f6);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.1875rem;
}

.rs-root .is-hidden { display: none !important; }

/* Wider than 30rem: buttons sit side by side at their natural width. */
@media (min-width: 30rem) {
  .rs-card { padding: 1.5rem; }
  .rs-actions {
    flex-direction: row;
    justify-content: flex-end;
  }
  .rs-btn { width: auto; }
}

@media (prefers-reduced-motion: no-preference) {
  .rs-btn { transition: background-color 0.15s ease, opacity 0.15s ease; }
}
