/**
 * ReSense Design System — component styles (draft, proposal stage)
 * ------------------------------------------------------------------
 * Styles the shared reference markup (reference.html). Blade partials
 * and Vue SFC templates copy that markup verbatim and link this file —
 * the classes are the contract, this CSS is the single implementation.
 *
 * Rules: consume ONLY --rs-color-{role} + structure tokens from
 * tokens.css. No palette steps, no raw color values.
 * Naming: .rs-{block}, .rs-{block}__{element}, .rs-{block}--{variant}.
 */

/* ---------- base ---------- */
.rs-body {
  margin: 0;
  background: var(--rs-color-bg);
  color: var(--rs-color-text);
  font-family: var(--rs-font-body);
  font-size: var(--rs-text-sm);
  line-height: var(--rs-leading-normal);
  -webkit-font-smoothing: antialiased;
}

:where(.rs-topbar, .rs-menu, .rs-ctx-sheet, .rs-auth-card, .rs-denied, .rs-btn, .rs-field, .rs-alert, .rs-badge) *,
:where(.rs-topbar, .rs-menu, .rs-ctx-sheet, .rs-auth-card, .rs-denied) {
  box-sizing: border-box;
}

/* one focus language everywhere */
:where(.rs-btn, .rs-iconbtn, .rs-field__input, .rs-menu__item, .rs-appmenu__tilebtn, .rs-ctx-trigger, .rs-ctx-strip, .rs-ctx__item, .rs-link):focus-visible {
  outline: none;
  box-shadow: var(--rs-focus-ring);
}

.rs-link {
  color: var(--rs-color-primary);
  font-weight: var(--rs-weight-medium);
  text-decoration: none;
  border-radius: var(--rs-radius-xs);
}
.rs-link:hover { text-decoration: underline; }

/* ---------- buttons ---------- */
.rs-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--rs-space-2);
  padding: 0.625rem var(--rs-space-4);
  border: 1px solid transparent;
  border-radius: var(--rs-radius-sm);
  font: inherit;
  font-weight: var(--rs-weight-semibold);
  cursor: pointer;
  transition: background var(--rs-dur-fast) var(--rs-ease),
              border-color var(--rs-dur-fast) var(--rs-ease);
}
.rs-btn--primary {
  background: var(--rs-color-primary);
  color: var(--rs-color-on-primary);
}
.rs-btn--primary:hover { background: var(--rs-color-primary-hover); }
.rs-btn--primary:active { background: var(--rs-color-primary-active); }
.rs-btn--secondary {
  background: var(--rs-color-primary-container);
  color: var(--rs-color-on-primary-container);
}
.rs-btn--secondary:hover { background: color-mix(in oklab, var(--rs-color-primary-container) 88%, var(--rs-color-primary)); }
.rs-btn--secondary:active { background: color-mix(in oklab, var(--rs-color-primary-container) 78%, var(--rs-color-primary)); }
.rs-btn--quiet {
  background: transparent;
  color: var(--rs-color-text);
  border-color: var(--rs-color-border-strong);
}
.rs-btn--quiet:hover { background: var(--rs-color-surface-muted); }
.rs-btn--danger {
  background: var(--rs-color-danger);
  color: var(--rs-color-on-danger);
}
.rs-btn--danger:hover { background: var(--rs-color-danger-hover); }
.rs-btn--block { width: 100%; }
.rs-btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}
.rs-btn--loading { position: relative; color: transparent; }
.rs-btn--loading::after {
  content: "";
  position: absolute;
  width: 1em; height: 1em;
  border: 2px solid var(--rs-color-on-primary);
  border-right-color: transparent;
  border-radius: var(--rs-radius-full);
  animation: rs-spin 0.7s linear infinite;
}
@keyframes rs-spin { to { transform: rotate(1turn); } }

/* ---------- icon button (topbar) ---------- */
.rs-iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem; height: 2.5rem;
  border: none;
  border-radius: var(--rs-radius-sm);
  background: transparent;
  color: var(--rs-color-text-muted);
  cursor: pointer;
  transition: background var(--rs-dur-fast) var(--rs-ease);
}
.rs-iconbtn:hover {
  background: var(--rs-color-surface-muted);
  color: var(--rs-color-text);
}
.rs-iconbtn[aria-expanded="true"] {
  background: var(--rs-color-primary-container);
  color: var(--rs-color-on-primary-container);
}

/* ---------- top bar ---------- */
.rs-topbar {
  display: flex;
  align-items: center;
  gap: var(--rs-space-3);
  height: var(--rs-topbar-height);
  padding: 0 var(--rs-space-4);
  background: var(--rs-color-surface);
  border-bottom: 1px solid var(--rs-color-border);
}
.rs-topbar__brand {
  display: flex;
  align-items: center;
  gap: var(--rs-space-3);
  text-decoration: none;
  color: inherit;
  margin-right: var(--rs-space-2);
}
/* holds the ReSense logomark SVG (fill: currentColor).
   --rs-color-logo enforces the brand rule: Ink on light, Ivory on dark. */
.rs-topbar__logo {
  display: inline-flex;
  color: var(--rs-color-logo);
}
.rs-topbar__logo svg { height: 1.5rem; width: auto; }
.rs-topbar__product {
  font-family: var(--rs-font-display);
  font-weight: var(--rs-weight-display);
  font-size: var(--rs-text-lg);
  letter-spacing: -0.01em;
}
.rs-topbar__product small {
  color: var(--rs-color-text-muted);
  font-family: var(--rs-font-body);
  font-size: var(--rs-text-xs);
  font-weight: var(--rs-weight-medium);
  margin-left: var(--rs-space-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.rs-topbar__spacer { flex: 1; }
.rs-topbar__cluster {
  display: flex;
  align-items: center;
  gap: var(--rs-space-1);
  position: relative;
}

/* ---------- avatar ---------- */
.rs-avatar {
  width: 2rem; height: 2rem;
  border-radius: var(--rs-radius-full);
  background: var(--rs-color-primary-container);
  color: var(--rs-color-on-primary-container);
  display: inline-grid;
  place-items: center;
  font-size: var(--rs-text-xs);
  font-weight: var(--rs-weight-semibold);
  letter-spacing: 0.02em;
}
.rs-avatar--lg { width: 2.75rem; height: 2.75rem; font-size: var(--rs-text-sm); }

/* ---------- popover menus ---------- */
.rs-menu {
  position: absolute;
  top: calc(100% + var(--rs-space-2));
  right: 0;
  min-width: 15rem;
  background: var(--rs-color-surface);
  border: 1px solid var(--rs-color-border);
  border-radius: var(--rs-radius-lg);
  box-shadow: var(--rs-shadow-pop);
  padding: var(--rs-space-2);
  z-index: 40;
}
.rs-menu[hidden] { display: none; }
.rs-menu__header {
  display: flex;
  align-items: center;
  gap: var(--rs-space-3);
  padding: var(--rs-space-3);
}
.rs-menu__title { font-weight: var(--rs-weight-semibold); }
.rs-menu__sub {
  color: var(--rs-color-text-muted);
  font-size: var(--rs-text-xs);
}
.rs-menu__divider {
  height: 1px;
  background: var(--rs-color-border);
  margin: var(--rs-space-2) calc(-1 * var(--rs-space-2));
  border: none;
}
.rs-menu__item {
  display: flex;
  align-items: center;
  gap: var(--rs-space-3);
  width: 100%;
  padding: var(--rs-space-2) var(--rs-space-3);
  border: none;
  border-radius: var(--rs-radius-md);
  background: transparent;
  color: var(--rs-color-text);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.rs-menu__item:hover { background: var(--rs-color-surface-muted); }
.rs-menu__item--danger { color: var(--rs-color-danger); }

/* ---------- app changer ---------- */
.rs-appmenu { width: 19.5rem; }
.rs-appmenu__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--rs-space-1);
  padding: var(--rs-space-1);
}
.rs-appmenu__tilebtn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--rs-space-2);
  padding: var(--rs-space-3) var(--rs-space-2);
  border: none;
  border-radius: var(--rs-radius-md);
  background: transparent;
  color: var(--rs-color-text);
  font: inherit;
  font-size: var(--rs-text-xs);
  font-weight: var(--rs-weight-medium);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.rs-appmenu__tilebtn:hover { background: var(--rs-color-surface-muted); }
.rs-appmenu__tilebtn[aria-current="true"] {
  background: var(--rs-color-primary-container);
  color: var(--rs-color-on-primary-container);
}
.rs-appmenu__tile {
  width: 2.75rem; height: 2.75rem;
  border-radius: var(--rs-radius-md);
  background: var(--rs-color-primary-container);
  color: var(--rs-color-on-primary-container);
  display: grid;
  place-items: center;
  font-family: var(--rs-font-display);
  font-weight: var(--rs-weight-display);
  font-size: var(--rs-text-base);
}
.rs-appmenu__footnote {
  padding: var(--rs-space-2) var(--rs-space-3) var(--rs-space-1);
  color: var(--rs-color-text-muted);
  font-size: var(--rs-text-xs);
}

/* ---------- context selector (account / property scope) ----------
   Top-bar control that answers "what am I looking at?". Trigger shows
   account + scope on two lines; the popover is a two-pane picker —
   accounts left, properties of the active account right. Personal
   accounts have no properties: use .rs-ctx--single (one pane).
   Menu behavior (Escape / outside click / aria-expanded) follows the
   shared menus contract. */

.rs-ctx-trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--rs-space-2);
  min-height: 2.5rem;
  padding: var(--rs-space-1) var(--rs-space-3);
  border: none;
  border-radius: var(--rs-radius-sm);
  background: transparent;
  color: var(--rs-color-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background var(--rs-dur-fast) var(--rs-ease);
}
.rs-ctx-trigger:hover { background: var(--rs-color-surface-muted); }
.rs-ctx-trigger[aria-expanded="true"] {
  background: var(--rs-color-primary-container);
  color: var(--rs-color-on-primary-container);
}
.rs-ctx-trigger__lines {
  display: grid;
  line-height: var(--rs-leading-tight);
  min-width: 0;
}
.rs-ctx-trigger__account {
  font-size: var(--rs-text-xs);
  opacity: 0.72;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rs-ctx-trigger__scope {
  font-size: var(--rs-text-sm);
  font-weight: var(--rs-weight-semibold);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rs-ctx-trigger__chevron {
  flex: none;
  opacity: 0.55;
  transition: transform var(--rs-dur-fast) var(--rs-ease);
}
.rs-ctx-trigger[aria-expanded="true"] .rs-ctx-trigger__chevron { transform: rotate(180deg); }

/* popover — pairs with .rs-menu for the shell, anchors left */
.rs-ctx {
  left: 0;
  right: auto;
  display: flex;
  align-items: stretch;
  width: min(34rem, calc(100vw - 2rem));
  padding: 0;
  overflow: hidden; /* keep the radius on pane edges */
}
.rs-ctx[hidden] { display: none; }
.rs-ctx--single { width: min(18rem, calc(100vw - 2rem)); }

.rs-ctx__pane {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.rs-ctx__pane + .rs-ctx__pane { border-left: 1px solid var(--rs-color-border); }

.rs-ctx__label {
  padding: var(--rs-space-3) var(--rs-space-4) var(--rs-space-1);
  font-size: var(--rs-text-xs);
  font-weight: var(--rs-weight-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rs-color-text-muted);
}

/* quiet inline search — hairline below, primary underline on focus */
.rs-ctx__search {
  display: flex;
  align-items: center;
  gap: var(--rs-space-2);
  padding: var(--rs-space-2) var(--rs-space-4);
  border-bottom: 1px solid var(--rs-color-border);
  color: var(--rs-color-text-faint);
  transition: border-color var(--rs-dur-fast) var(--rs-ease);
}
.rs-ctx__search:focus-within {
  border-bottom-color: var(--rs-color-primary);
  color: var(--rs-color-text-muted);
}
.rs-ctx__search svg { flex: none; }
.rs-ctx__search input {
  width: 100%;
  min-width: 0;
  border: none;
  background: transparent;
  outline: none;
  font: inherit;
  color: var(--rs-color-text);
}
.rs-ctx__search input::placeholder { color: var(--rs-color-text-faint); }

.rs-ctx__list {
  overflow-y: auto;
  max-height: 19rem;
  padding: var(--rs-space-2);
}

/* group heading inside a list (Personal / Organizations) */
.rs-ctx__group {
  padding: var(--rs-space-3) var(--rs-space-3) var(--rs-space-1);
  font-size: var(--rs-text-xs);
  font-weight: var(--rs-weight-medium);
  color: var(--rs-color-text-muted);
}
.rs-ctx__list > .rs-ctx__group:first-child { padding-top: var(--rs-space-1); }

.rs-ctx__item {
  display: flex;
  align-items: center;
  gap: var(--rs-space-3);
  width: 100%;
  padding: var(--rs-space-2) var(--rs-space-3);
  border: none;
  border-radius: var(--rs-radius-md);
  background: transparent;
  color: var(--rs-color-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.rs-ctx__item:hover { background: var(--rs-color-surface-muted); }
.rs-ctx__item[aria-current="true"] {
  background: var(--rs-color-primary-container);
  color: var(--rs-color-on-primary-container);
}
.rs-ctx__icon {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 1.25rem;
  color: var(--rs-color-text-faint);
}
.rs-ctx__item[aria-current="true"] .rs-ctx__icon { color: inherit; }
.rs-ctx__body {
  flex: 1;
  min-width: 0;
  display: grid;
  line-height: var(--rs-leading-tight);
}
.rs-ctx__name {
  font-weight: var(--rs-weight-medium);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rs-ctx__sub {
  font-size: var(--rs-text-xs);
  color: var(--rs-color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rs-ctx__item[aria-current="true"] .rs-ctx__sub { color: inherit; opacity: 0.72; }
.rs-ctx__item .rs-badge { flex: none; }

/* default-property marker */
.rs-ctx__star { flex: none; color: var(--rs-color-accent-brand); }

.rs-ctx__empty {
  padding: var(--rs-space-4) var(--rs-space-3);
  color: var(--rs-color-text-faint);
  font-size: var(--rs-text-sm);
}

/* right-aligned popover — for triggers near the viewport's right edge */
.rs-ctx--right { left: auto; right: 0; }

/* context strip — the mobile trigger. A 390px top bar can't fit brand,
   a meaningful context label, and the icon cluster in one row, so the
   context gets its own slim full-width bar DIRECTLY BELOW the top bar:
   full context always visible (account · scope), one big touch target,
   ⇄ marks it as the switcher. Opens the context sheet, not the popover.
   Personal accounts: account name only, no scope. */
.rs-ctx-strip {
  display: none;
  align-items: center;
  gap: var(--rs-space-2);
  width: 100%;
  min-height: 2.5rem;
  padding: 0 var(--rs-space-4);
  border: none;
  border-bottom: 1px solid var(--rs-color-border);
  background: var(--rs-color-surface-muted);
  color: var(--rs-color-text);
  font: inherit;
  font-size: var(--rs-text-sm);
  text-align: left;
  cursor: pointer;
  transition: background var(--rs-dur-fast) var(--rs-ease);
}
.rs-ctx-strip[aria-expanded="true"] {
  background: var(--rs-color-primary-container);
  color: var(--rs-color-on-primary-container);
}
/* account truncates before the scope does */
.rs-ctx-strip__account {
  flex: 0 3 auto;
  min-width: 3rem;
  color: var(--rs-color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rs-ctx-strip[aria-expanded="true"] .rs-ctx-strip__account { color: inherit; opacity: 0.72; }
.rs-ctx-strip__account::after { content: " ·"; }
.rs-ctx-strip__scope {
  flex: 0 1 auto;
  min-width: 0;
  font-weight: var(--rs-weight-semibold);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rs-ctx-strip svg { flex: none; margin-left: auto; opacity: 0.7; }

/* the 42rem swap: below it the two-line trigger and the popover are
   replaced by the context strip + context sheet */
@media (max-width: 42rem) {
  .rs-ctx-trigger { display: none; }
  .rs-ctx { display: none; }
  .rs-ctx-strip { display: flex; }
}
/* also respond to a surrounding container (preview frames) */
@container (max-width: 42rem) {
  .rs-ctx-trigger { display: none; }
  .rs-ctx { display: none; }
  .rs-ctx-strip { display: flex; }
}

/* comfortable touch targets on coarse pointers */
@media (pointer: coarse) {
  .rs-ctx__item { min-height: 2.75rem; }
  .rs-ctx__search { min-height: 2.75rem; }
}

/* ---------- context sheet (mobile) ----------
   The mobile form of the context selector: a bottom sheet opened by
   .rs-ctx-strip. Step-based — accounts first, then properties of
   the chosen account — one list at a time, with a header that always
   names the current context. Reuses rs-ctx__search / __list / __item.
   Escape and scrim tap close it; picking an account advances to the
   property step instead of closing. */

.rs-ctx-sheet-scrim {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--rs-color-scrim);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.rs-ctx-sheet {
  width: 100%;
  max-width: 26rem;
  min-height: 22rem;
  max-height: min(85dvh, 36rem);
  display: flex;
  flex-direction: column;
  background: var(--rs-color-surface);
  border: 1px solid var(--rs-color-border);
  border-bottom: none;
  border-radius: var(--rs-radius-lg) var(--rs-radius-lg) 0 0;
  box-shadow: var(--rs-shadow-pop);
}
.rs-ctx-sheet__header {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--rs-space-2);
  min-height: var(--rs-topbar-height);
  padding: var(--rs-space-2) var(--rs-space-3);
  border-bottom: 1px solid var(--rs-color-border);
}
.rs-ctx-sheet__titles {
  flex: 1;
  min-width: 0;
  display: grid;
  line-height: var(--rs-leading-tight);
}
.rs-ctx-sheet__title {
  font-weight: var(--rs-weight-semibold);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rs-ctx-sheet__context {
  font-size: var(--rs-text-xs);
  color: var(--rs-color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* flex column, not grid: search keeps its natural height, the list
   takes the rest — no stretched tracks between them */
.rs-ctx-sheet__step {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.rs-ctx-sheet__step[hidden] { display: none; }
.rs-ctx-sheet .rs-ctx__list {
  flex: 1;
  max-height: none;
}

/* ---------- forms ---------- */
.rs-field { margin-bottom: var(--rs-space-4); }
.rs-field__label {
  display: block;
  margin-bottom: var(--rs-space-2);
  font-weight: var(--rs-weight-medium);
  color: var(--rs-color-text);
}
.rs-field__input {
  width: 100%;
  padding: 0.625rem var(--rs-space-3);
  border: 1px solid var(--rs-color-border-strong);
  border-radius: var(--rs-radius-sm);
  background: var(--rs-color-surface-muted);
  color: var(--rs-color-text);
  font: inherit;
  font-size: var(--rs-text-base);
  transition: border-color var(--rs-dur-fast) var(--rs-ease),
              box-shadow var(--rs-dur-fast) var(--rs-ease);
}
.rs-field__input::placeholder { color: var(--rs-color-text-faint); }
.rs-field__input:focus-visible { border-color: var(--rs-color-primary); }
.rs-field__help {
  margin-top: var(--rs-space-2);
  font-size: var(--rs-text-xs);
  color: var(--rs-color-text-muted);
}
.rs-field--invalid .rs-field__input { border-color: var(--rs-color-danger); }
.rs-field__error {
  margin-top: var(--rs-space-2);
  font-size: var(--rs-text-xs);
  font-weight: var(--rs-weight-medium);
  color: var(--rs-color-danger);
}
.rs-field__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

/* one-time-code (2FA) */
.rs-field__input--code {
  font-family: var(--rs-font-mono);
  font-size: var(--rs-text-xl);
  letter-spacing: 0.45em;
  text-align: center;
}

/* ---------- auth card ---------- */
.rs-auth {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--rs-space-6);
  container-type: inline-size;
}
.rs-auth-card {
  width: 100%;
  max-width: 25.5rem;
  background: var(--rs-color-surface);
  border: 1px solid var(--rs-color-border);
  border-radius: var(--rs-radius-xl);
  box-shadow: var(--rs-shadow-card);
  padding: var(--rs-space-10) var(--rs-space-8) var(--rs-space-8);
}
.rs-auth-card__logo {
  display: inline-flex;
  color: var(--rs-color-logo);
  margin-bottom: var(--rs-space-6);
}
.rs-auth-card__logo svg { height: 2.25rem; width: auto; }
.rs-auth-card__title {
  margin: 0 0 var(--rs-space-2);
  font-family: var(--rs-font-display);
  font-weight: var(--rs-weight-display);
  font-size: var(--rs-text-2xl);
  line-height: var(--rs-leading-tight);
  letter-spacing: -0.015em;
}
.rs-auth-card__lede {
  margin: 0 0 var(--rs-space-6);
  color: var(--rs-color-text-muted);
  font-size: var(--rs-text-sm);
}
/* wide two-column variant for IdP/SSO screens: identity column left,
   form column right — same fields and buttons as the compact card */
.rs-auth-card--split {
  max-width: 52rem;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: var(--rs-space-10);
  align-items: center;
  padding: var(--rs-space-10) var(--rs-space-8);
}
@media (max-width: 44rem) {
  .rs-auth-card--split { grid-template-columns: 1fr; gap: var(--rs-space-6); }
}
/* also respond to the surrounding container (.rs-auth, preview frames) */
@container (max-width: 44rem) {
  .rs-auth-card--split { grid-template-columns: 1fr; gap: var(--rs-space-6); }
}
.rs-auth-card--split .rs-auth-card__logo svg { height: 1.5rem; }
.rs-auth-card--split .rs-auth-card__title { font-size: var(--rs-text-3xl); text-wrap: balance; }
.rs-auth-card--split .rs-auth-card__lede { margin-bottom: 0; }

/* link left, action right */
.rs-auth-card__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--rs-space-4);
  margin-top: var(--rs-space-2);
}
.rs-auth-card__actions .rs-link { font-size: var(--rs-text-sm); }
.rs-auth-card__actions--end { justify-content: flex-end; }

.rs-auth-card__footer {
  margin-top: var(--rs-space-6);
  text-align: center;
  font-size: var(--rs-text-sm);
  color: var(--rs-color-text-muted);
}

/* ---------- access denied ---------- */
.rs-denied {
  width: 100%;
  max-width: 34rem;
  margin-inline: auto;
  background: var(--rs-color-surface);
  border: 1px solid var(--rs-color-border);
  border-radius: var(--rs-radius-xl);
  box-shadow: var(--rs-shadow-card);
  padding: var(--rs-space-10) var(--rs-space-8) var(--rs-space-8);
  text-align: center;
}
.rs-denied__icon {
  display: inline-grid;
  place-items: center;
  width: 4rem;
  height: 4rem;
  margin-bottom: var(--rs-space-5);
  border-radius: var(--rs-radius-full);
  background: var(--rs-color-danger-container);
  color: var(--rs-color-danger);
}
.rs-denied__icon svg {
  width: 2.5rem;
  height: 2.5rem;
}
.rs-denied__title {
  margin: 0 0 var(--rs-space-3);
  font-family: var(--rs-font-display);
  font-weight: var(--rs-weight-display);
  font-size: var(--rs-text-3xl);
  line-height: var(--rs-leading-tight);
}
.rs-denied__body {
  max-width: 28rem;
  margin: 0 auto var(--rs-space-6);
  color: var(--rs-color-text-muted);
  font-size: var(--rs-text-base);
  line-height: var(--rs-leading-relaxed);
}
.rs-denied__actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--rs-space-2);
  padding-top: var(--rs-space-5);
  border-top: 1px solid var(--rs-color-border);
}
.rs-denied__meta {
  display: grid;
  gap: var(--rs-space-1);
  margin-top: var(--rs-space-6);
  color: var(--rs-color-text-muted);
  font-size: var(--rs-text-sm);
}
.rs-denied__meta strong {
  color: var(--rs-color-text);
  font-weight: var(--rs-weight-semibold);
}
@media (max-width: 34rem) {
  .rs-denied {
    padding: var(--rs-space-8) var(--rs-space-5) var(--rs-space-6);
  }
  .rs-denied__title { font-size: var(--rs-text-2xl); }
  .rs-denied__actions .rs-btn { width: 100%; }
}

/* ---------- alerts ---------- */
.rs-alert {
  display: flex;
  gap: var(--rs-space-3);
  padding: var(--rs-space-3) var(--rs-space-4);
  border-radius: var(--rs-radius-md);
  border: 1px solid transparent;
  font-size: var(--rs-text-sm);
  margin-bottom: var(--rs-space-4);
}
.rs-alert--danger {
  background: var(--rs-color-danger-container);
  color: var(--rs-color-on-danger-container);
  border-color: color-mix(in oklab, var(--rs-color-danger) 25%, transparent);
}
.rs-alert--success {
  background: var(--rs-color-success-container);
  color: var(--rs-color-on-success-container);
  border-color: color-mix(in oklab, var(--rs-color-success) 25%, transparent);
}
.rs-alert--warning {
  background: var(--rs-color-warning-container);
  color: var(--rs-color-on-warning-container);
  border-color: color-mix(in oklab, var(--rs-color-warning) 30%, transparent);
}
.rs-alert--info {
  background: var(--rs-color-info-container);
  color: var(--rs-color-on-info-container);
  border-color: color-mix(in oklab, var(--rs-color-info) 25%, transparent);
}

/* ---------- badges ---------- */
.rs-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--rs-space-1);
  padding: 0.125rem var(--rs-space-2);
  border-radius: var(--rs-radius-full);
  font-size: var(--rs-text-xs);
  font-weight: var(--rs-weight-semibold);
  white-space: nowrap;
}
.rs-badge::before {
  content: "";
  width: 0.4rem; height: 0.4rem;
  border-radius: var(--rs-radius-full);
  background: currentColor;
}
.rs-badge--primary { background: var(--rs-color-primary-container); color: var(--rs-color-on-primary-container); }
.rs-badge--success { background: var(--rs-color-success-container); color: var(--rs-color-on-success-container); }
.rs-badge--warning { background: var(--rs-color-warning-container); color: var(--rs-color-on-warning-container); }
.rs-badge--danger  { background: var(--rs-color-danger-container);  color: var(--rs-color-on-danger-container); }
.rs-badge--info    { background: var(--rs-color-info-container);    color: var(--rs-color-on-info-container); }
.rs-badge--neutral { background: var(--rs-color-surface-muted); color: var(--rs-color-text-muted); border: 1px solid var(--rs-color-border); }

/* ---------- SSO login button ---------- */
.rs-btn--sso {
  background: var(--rs-color-surface);
  color: var(--rs-color-text);
  border-color: var(--rs-color-border-strong);
}
.rs-btn--sso:hover { background: var(--rs-color-surface-muted); }
.rs-btn--sso .rs-btn__mark {
  display: inline-flex;
  color: var(--rs-color-logo);
}
.rs-btn--sso .rs-btn__mark svg { height: 1rem; width: auto; }
.rs-btn--sso.rs-btn--sso-prominent {
  min-height: 3.25rem;
  padding: 0.875rem var(--rs-space-5);
  border-color: var(--rs-color-primary);
  border-radius: var(--rs-radius-md);
  background: var(--rs-color-primary);
  color: var(--rs-color-on-primary);
  font-size: var(--rs-text-base);
  text-decoration: none;
}
.rs-btn--sso.rs-btn--sso-prominent:hover {
  border-color: var(--rs-color-primary-hover);
  background: var(--rs-color-primary-hover);
  color: var(--rs-color-on-primary);
}
.rs-btn--sso.rs-btn--sso-prominent:active {
  border-color: var(--rs-color-primary-active);
  background: var(--rs-color-primary-active);
  color: var(--rs-color-on-primary);
}
.rs-btn--sso.rs-btn--sso-prominent .rs-btn__mark { color: currentColor; }
.rs-btn--sso.rs-btn--sso-prominent .rs-btn__mark svg { height: 1.25rem; }

/* ---------- divider with label ---------- */
.rs-divider {
  display: flex;
  align-items: center;
  gap: var(--rs-space-3);
  color: var(--rs-color-text-muted);
  font-size: var(--rs-text-xs);
  margin: var(--rs-space-5) 0;
}
.rs-divider::before, .rs-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rs-color-border);
}

/* ---------- selection controls ---------- */
.rs-check, .rs-radio, .rs-switch {
  display: inline-flex;
  align-items: center;
  gap: var(--rs-space-2);
  cursor: pointer;
  font-size: var(--rs-text-sm);
}
.rs-check input, .rs-radio input, .rs-switch input {
  appearance: none;
  margin: 0;
  width: 1.125rem; height: 1.125rem;
  border: 1px solid var(--rs-color-border-strong);
  border-radius: var(--rs-radius-xs);
  background: var(--rs-color-surface-muted);
  display: grid;
  place-items: center;
  transition: background var(--rs-dur-fast) var(--rs-ease),
              border-color var(--rs-dur-fast) var(--rs-ease);
}
.rs-check input:focus-visible, .rs-radio input:focus-visible, .rs-switch input:focus-visible {
  outline: none;
  box-shadow: var(--rs-focus-ring);
}
.rs-check input:checked, .rs-radio input:checked {
  background: var(--rs-color-primary);
  border-color: var(--rs-color-primary);
}
.rs-check input:checked::after {
  content: "";
  width: 0.3rem; height: 0.55rem;
  border: solid var(--rs-color-on-primary);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translateY(-1px);
}
.rs-radio input { border-radius: var(--rs-radius-full); }
.rs-radio input:checked::after {
  content: "";
  width: 0.4rem; height: 0.4rem;
  border-radius: var(--rs-radius-full);
  background: var(--rs-color-on-primary);
}
.rs-switch input {
  width: 2.25rem; height: 1.25rem;
  border-radius: var(--rs-radius-full);
  justify-items: start;
}
.rs-switch input::after {
  content: "";
  width: 0.875rem; height: 0.875rem;
  border-radius: var(--rs-radius-full);
  background: var(--rs-color-text-faint);
  margin-left: 2px;
  transition: transform var(--rs-dur-fast) var(--rs-ease),
              background var(--rs-dur-fast) var(--rs-ease);
}
.rs-switch input:checked {
  background: var(--rs-color-primary);
  border-color: var(--rs-color-primary);
}
.rs-switch input:checked::after {
  background: var(--rs-color-on-primary);
  transform: translateX(1rem);
}

/* ---------- select + textarea ---------- */
.rs-field__input--select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--rs-color-text-muted) 50%),
                    linear-gradient(135deg, var(--rs-color-text-muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2.25rem;
}
textarea.rs-field__input { resize: vertical; min-height: 5.5rem; }

/* ---------- auth page footer (IdP screens) ---------- */
.rs-authfoot {
  width: 100%;
  max-width: 52rem;
  margin-inline: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--rs-space-4);
  padding: var(--rs-space-4) var(--rs-space-2) 0;
  color: var(--rs-color-text-muted);
  font-size: var(--rs-text-xs);
}
.rs-authfoot__meta { display: flex; align-items: center; gap: var(--rs-space-3); }

/* language switcher */
.rs-lang { display: inline-flex; gap: var(--rs-space-1); }
.rs-lang__opt {
  padding: 0.125rem var(--rs-space-2);
  border-radius: var(--rs-radius-xs);
  color: var(--rs-color-text-muted);
  text-decoration: none;
  font-weight: var(--rs-weight-medium);
}
.rs-lang__opt:hover { background: var(--rs-color-surface-muted); }
.rs-lang__opt:focus-visible { outline: none; box-shadow: var(--rs-focus-ring); }
.rs-lang__opt[aria-current="true"] {
  color: var(--rs-color-text);
  font-weight: var(--rs-weight-semibold);
}

/* consent scope list */
.rs-scopelist {
  list-style: none;
  margin: 0 0 var(--rs-space-6);
  padding: 0;
  display: grid;
  gap: var(--rs-space-3);
  font-size: var(--rs-text-sm);
}
.rs-scopelist__item {
  display: flex;
  gap: var(--rs-space-3);
  align-items: baseline;
}
.rs-scopelist__item::before {
  content: "✓";
  color: var(--rs-color-primary);
  font-weight: var(--rs-weight-semibold);
  flex: none;
}

/* ---------- gradient backgrounds ---------- */
.rs-bg-aurora {
  background:
    radial-gradient(52rem 30rem at 12% -12%, var(--rs-aurora-1), transparent 60%),
    radial-gradient(44rem 26rem at 96% 8%, var(--rs-aurora-2), transparent 62%),
    radial-gradient(40rem 26rem at 55% 115%, var(--rs-aurora-3), transparent 65%),
    var(--rs-color-bg);
}
.rs-bg-brandsweep {
  background:
    linear-gradient(115deg, var(--rs-aurora-1), transparent 42%),
    linear-gradient(245deg, var(--rs-aurora-3), transparent 46%),
    linear-gradient(0deg, var(--rs-aurora-2), var(--rs-aurora-2)),
    var(--rs-color-bg);
}

/* ---------- modal ---------- */
.rs-modal-scrim {
  position: fixed;
  inset: 0;
  background: var(--rs-color-scrim);
  display: grid;
  place-items: center;
  padding: var(--rs-space-6);
  z-index: 50;
}
.rs-modal {
  width: 100%;
  max-width: 26rem;
  background: var(--rs-color-surface);
  border: 1px solid var(--rs-color-border);
  border-radius: var(--rs-radius-lg);
  box-shadow: var(--rs-shadow-pop);
  padding: var(--rs-space-6);
}
.rs-modal__title {
  margin: 0 0 var(--rs-space-2);
  font-family: var(--rs-font-display);
  font-weight: var(--rs-weight-display);
  font-size: var(--rs-text-lg);
}
.rs-modal__body {
  margin: 0 0 var(--rs-space-6);
  color: var(--rs-color-text-muted);
  font-size: var(--rs-text-sm);
  line-height: var(--rs-leading-relaxed);
}
.rs-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--rs-space-2);
}

/* ---------- page sections & form groups ---------- */
.rs-section { margin-bottom: var(--rs-space-10); }
.rs-section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--rs-space-4);
  margin-bottom: var(--rs-space-2);
}
.rs-section__title {
  margin: 0;
  font-family: var(--rs-font-display);
  font-weight: var(--rs-weight-display);
  font-size: var(--rs-text-lg);
}
.rs-section__desc {
  margin: 0 0 var(--rs-space-4);
  color: var(--rs-color-text-muted);
  font-size: var(--rs-text-sm);
  max-width: 46rem;
}
.rs-group {
  container-type: inline-size;
  border: 1px solid var(--rs-color-border);
  border-radius: var(--rs-radius-lg);
  background: var(--rs-color-surface);
  padding: var(--rs-space-6);
}
.rs-group__legend {
  font-weight: var(--rs-weight-semibold);
  font-size: var(--rs-text-sm);
  margin: 0 0 var(--rs-space-1);
}
.rs-group__hint {
  color: var(--rs-color-text-muted);
  font-size: var(--rs-text-xs);
  margin: 0 0 var(--rs-space-4);
}
.rs-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0 var(--rs-space-4);
}
.rs-form-grid .rs-field--span { grid-column: 1 / -1; }
@media (max-width: 40rem) {
  .rs-form-grid { grid-template-columns: 1fr; }
}
@container (max-width: 40rem) {
  .rs-form-grid { grid-template-columns: 1fr; }
}
