/* idp-only rules. Loads after theme.css from the idp-theme webjar, which holds the shared tokens and components. */

/* --- Second step: the key's view, the method list and the switch between them ---------- */

/* Both kinds side by side need more than the sign-in column's 22rem; one kind keeps it. */
.login:has(.key-step__kind + .key-step__kind) {
  max-width: 30rem;
}

.key-step__kinds {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: var(--space-3);
}

.key-step__kind {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-4) var(--space-3) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  text-align: center;
}

.key-step__kind-icon {
  width: 2rem;
  height: 2rem;
  margin-bottom: var(--space-1);
  color: var(--color-fg-muted);
}

.key-step__kind-title {
  font-size: 0.9375rem;
  font-weight: 600;
}

.key-step__kind .key-step__list {
  align-self: stretch;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-sm);
  color: var(--color-fg-muted);
}

.key-step__account {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}

/* An empty status line stays in the page so screen readers announce what it says later; out of the flow it
   takes no gap. */
.key-step__status {
  margin: 0;
}

.key-step__status:empty {
  position: absolute;
}

.key-step__account-label {
  font-size: var(--text-xs);
  color: var(--color-fg-muted);
}

.key-step__account-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  max-width: 100%;
  padding: var(--space-1) var(--space-3) var(--space-1) var(--space-1);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  font-size: var(--text-sm);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.key-step__account-icon {
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0.3rem;
  border-radius: var(--radius-full);
  background: var(--color-surface-sunken);
  color: var(--color-fg-muted);
}

/* The buttons line up at the bottom however many keys each kind lists. */
.key-step__kind-button {
  width: 100%;
  margin-top: auto;
}

.key-step__kind-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  align-self: stretch;
  gap: var(--space-1);
  margin-bottom: var(--space-3);
}

.key-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  gap: var(--space-4);
}

.key-column {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.key-column__title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  font-size: var(--text-sm);
  font-weight: 600;
}

.key-column__icon {
  width: 1.125rem;
  height: 1.125rem;
  color: var(--color-fg-muted);
}

.key-column__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.key-column__list li {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  overflow-wrap: anywhere;
}

.key-column__name {
  font-size: var(--text-sm);
  font-weight: 500;
}

.key-column__meta {
  font-size: var(--text-xs);
  color: var(--color-fg-muted);
}

.key-column__form {
  margin-top: auto;
}

.key-step__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--text-sm);
}

.key-step__list li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  overflow-wrap: anywhere;
}

.method-switch {
  margin-top: var(--space-4);
  font-size: var(--text-sm);
}

.method-target__button {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

/* One bordered group on the page surface, so the rows stand off the card's subtle fill. */
.method-list {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.method-list > li + li {
  border-top: 1px solid var(--color-border);
}

.method-list__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  color: var(--color-fg);
  text-decoration: none;
}

.method-list__item:is(:hover, :focus-visible) {
  background: var(--color-surface-hover);
}

.method-list__item:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
}

/* The icons cut their holes with --badge-fill, so they follow the badge when a hovered row recolours it. */
.method-list__badge {
  --badge-fill: var(--color-fill-quiet);
  flex: none;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-md);
  background: var(--badge-fill);
  color: var(--color-fg-muted);
}

.method-list__item:is(:hover, :focus-visible) .method-list__badge {
  --badge-fill: var(--color-surface);
}

.method-list__icon {
  width: 1.125rem;
  height: 1.125rem;
}

.method-list__text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  gap: 0.125rem;
}

.method-list__title {
  font-size: var(--text-sm);
  font-weight: 500;
}

.method-list__description {
  font-size: var(--text-xs);
  color: var(--color-fg-muted);
  overflow-wrap: anywhere;
}

.method-list__chevron {
  flex: none;
  width: 1rem;
  height: 1rem;
  color: var(--color-fg-subtle);
  transition: transform 120ms;
}

.method-list__item:is(:hover, :focus-visible) .method-list__chevron {
  color: var(--color-fg-muted);
  transform: translateX(2px);
}

/* =============================================================
   Org admin (users & groups) — ported from design mock
   ============================================================= */

/* --- Header org-bar --------------------------------------- */
.org-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.org-bar-name {
  font-weight: 600;
  letter-spacing: -0.01em;
}
.navbar-sep {
  width: 1px;
  height: 20px;
  background: var(--color-border);
}

/* --- Detail form cards ------------------------------------ */
/* The body sits on the page surface; only the header (and tables, credentials) carry the subtle fill. */
.form-card { padding: 0; }
.form-card .card-header {
  margin: 0;
  padding: var(--space-4) var(--space-5);
  background: transparent;
}
.form-card .card-body {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
.form-card .card-title { font-size: 0.9375rem; line-height: 1.25rem; margin: 0; }
.form-card .card-footer {
  margin: 0;
  padding: 0 var(--space-5) var(--space-5);
  border-top: 0;
  background: transparent;
  justify-content: flex-end;
  align-items: center;
}

/* --- Backup page ------------------------------------------ */
.backup-card + .backup-card { margin-top: var(--space-4); }
/* The file field carries two hint lines, so its blocks need more air than a plain form. */
.backup-card-import { border-top: 1px solid var(--color-border); }
.form-card .card-body.backup-card-import { gap: var(--space-6); }
.backup-key {
  display: inline-block;
  max-width: 32ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}
.backup-recent { margin-top: var(--space-4); }

/* Inside a .table-card (theme.css) these rows highlight a step off the card's fill, like .table rows. */
.table-card :is(.group-table, .signin-table) tbody tr:hover { background: var(--color-row-hover); }
/* The batch row's subject cell is a disclosure: it lines up with the plain subject text of
   single-subject rows and turns its chevron over once the subjects are listed below. */
.batch-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}
.batch-toggle-chevron {
  flex: none;
  color: var(--color-fg-muted);
  transition: transform 120ms;
}
[data-batch-open] .batch-toggle-chevron { transform: rotate(180deg); }
/* An open batch and its subjects read as one group: the batch row loses its rule, the subjects sit on a sunken fill
   with a tighter row and an accent bar down the left edge, the arrow indented under the batch's time. */
.scim-jobs-table tr[data-batch-open] > * { border-bottom-color: transparent; }
.scim-jobs-table tr[data-batch-child] > * {
  --bs-table-bg-state: var(--color-surface-sunken);
  padding-block: var(--space-2);
  font-size: 0.8125rem;
}
/* .form-card sets the first cell's padding with a longer selector, hence the .card prefix. */
.card .table-responsive .scim-jobs-table tr[data-batch-child] > td:first-child {
  padding-left: var(--space-8);
  box-shadow: inset 2px 0 0 var(--color-accent), inset 0 0 0 9999px var(--bs-table-bg-state);
}

/* --- Key/value table (user attributes) -------------------- */
.kv-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--text-sm);
}
.kv-table th, .kv-table td {
  padding: var(--space-2) var(--space-3);
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--color-border);
}
.kv-table th {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-fg-subtle);
  font-weight: 500;
  background: var(--color-surface-subtle);
  border-top: 1px solid var(--color-border);
}
.kv-table .form-control { padding: 0.3rem var(--space-2); }
.invite-table .form-control { height: 2rem; }
.invite-updating { display: none; align-items: center; gap: var(--space-2); margin-right: var(--space-2); font-size: 13px; color: var(--color-fg-muted); }
#invite-panel[data-busy] .invite-updating { display: inline-flex; }
#invite-panel[data-busy] form[inert] { opacity: 0.85; }
.invite-formats { margin-bottom: var(--space-3); }
.invite-formats > tbody > tr > :is(th, td) {
  padding: var(--space-3) var(--space-4);
  border-top: 0;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}
.invite-formats > tbody > tr > :first-child { padding-left: 0; }
.invite-formats > tbody > tr > :last-child { padding-right: 0; }
.invite-formats > tbody > tr:last-child > * { border-bottom: 0; }
/* Nudges the small mono label onto the first text line of its cell. */
.invite-formats > tbody > tr > th { width: 9rem; padding-top: calc(var(--space-3) + 0.3rem); text-align: left; font-weight: 500; color: var(--color-fg); }
.invite-formats td { color: inherit; }
.invite-formats td > div { margin-top: var(--space-1); }
.invite-formats .cert-pem { margin: 0; }
.kv-table-edit {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.kv-table-edit .form-control { flex: 1; width: auto; }
/* The save state sits inside the input's right edge, so a saved row keeps the same input width. */
.kv-table-edit { position: relative; }
.kv-table-edit .save-state {
  position: absolute;
  right: var(--space-3);
  margin-left: 0;
  pointer-events: none;
}
.kv-table-edit:has(.save-state:not([data-state="idle"])) .form-control { padding-right: 5.5rem; }
.row-actions { width: 3rem; text-align: right; }
/* Several row actions stay on one line instead of stacking in the icon-sized column. */
td.row-actions:has(> .btn + .btn) { width: auto; white-space: nowrap; }
/* Built-in names share one width so their badges line up; firstName/lastName are the longest. */
.kv-table-name { display: inline-block; min-width: 10ch; }

/* --- Group switch list (user detail) ---------------------- */
.toggle-list { display: flex; flex-direction: column; }
/* The switch (or the "member" chip standing in for it) leads the row; a fixed slot keeps the names aligned. */
.toggle-list-row {
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border);
}
.toggle-list-row:last-child { border-bottom: none; }
.toggle-list-row-choice {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: var(--space-4);
}
.toggle-list-row-choice > :is(.segmented, .session-limit) { justify-self: end; }
.session-limit { display: flex; gap: var(--space-2); }
.session-limit > .form-control { width: 6rem; }
.session-limit > .form-select { width: 8rem; }
@media (max-width: 40rem) {
  .toggle-list-row-choice { grid-template-columns: minmax(0, 1fr); row-gap: var(--space-2); }
  .toggle-list-row-choice > :is(.segmented, .session-limit) { justify-self: start; }
}
.toggle-list-row > .form-check.form-switch,
.toggle-list-row > .toggle-list-chip { flex: none; width: 2.75rem; }
.toggle-list-name { font-weight: 500; }
.toggle-list-desc {
  font-size: var(--text-xs);
  color: var(--color-fg-subtle);
}
.toggle-list-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.toggle-list-chip {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--color-fg-subtle);
}
.toggle-list-name .toggle-list-chip { margin-left: var(--space-2); }

/* --- Member table (group detail) -------------------------- */
.member-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--text-sm);
}
.member-table th, .member-table td {
  padding: var(--space-2) var(--space-3);
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--color-border);
}
.member-table th {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-fg-subtle);
  font-weight: 500;
  background: var(--color-surface-subtle);
  border-top: 1px solid var(--color-border);
}
.member-table tbody tr:hover { background: var(--color-surface-subtle); }

/* --- Auto-save state (htmx) ------------------------------- */
.save-state {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  margin-left: var(--space-2);
  vertical-align: middle;
  font-size: var(--text-xs);
  font-weight: 400;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.save-state[data-state="saving"],
.save-state[data-state="saved"],
.save-state[data-state="error"] { opacity: 1; }

/* In a card header, sit next to the title and push the section meta to the right. */
.card-header .save-state { margin-left: 0; margin-right: auto; }

.save-state .spinner-border.spinner-border-sm { display: none; }
.save-state[data-state="saving"] .spinner-border.spinner-border-sm { display: inline-block; }

/* Slow actions: htmx puts its requestClass (htmx-request) on the element for the whole request,
   so the label and the spinner swap without any JS. */
.btn-busy { display: inline-flex; align-items: center; gap: var(--space-2); }
.btn-busy > .spinner-border.spinner-border-sm,
.btn-busy > [data-busy-label] { display: none; }
.btn-busy.htmx-request > .spinner-border.spinner-border-sm { display: inline-block; }
.btn-busy.htmx-request > [data-busy-label] { display: inline; }
.btn-busy.htmx-request > [data-busy-idle] { display: none; }

.save-state-label { color: var(--color-fg-subtle); }
.save-state[data-state="saved"] .save-state-label {
  color: var(--color-accent);
  font-weight: 500;
}
.save-state[data-state="saved"] .save-state-label::before { content: "✓ "; }
.save-state[data-state="error"] .save-state-label {
  color: var(--color-danger-fg);
  font-weight: 500;
}

/* --- Inline edit (read-only → pencil → Save/Cancel) ------- */
.editable-head {
  display: flex;
  justify-content: flex-end;
}
.editable-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}
.icon-btn { display: inline-flex; align-items: center; gap: var(--space-2); }

.kv-view { margin: 0; display: flex; flex-direction: column; }
.kv-view-row {
  display: grid;
  grid-template-columns: minmax(8rem, 30%) 1fr;
  gap: var(--space-4);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border);
}
.kv-view-row:last-child { border-bottom: 0; }
.kv-view-key {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-fg);
  word-break: break-word;
}
.kv-view-val {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-fg-muted);
  word-break: break-word;
}

/* =============================================================
   Org admin list views + app form — ported from design mock
   (panel head, toolbar, chips, app cards, form groups, tables)
   ============================================================= */

/* --- Panel header (list pages) ---------------------------- */
.panel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
}
.panel-title {
  font-size: var(--text-2xl);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}
.panel-lede {
  font-size: var(--text-sm);
  color: var(--color-fg-muted);
  margin: var(--space-1) 0 0;
}

/* --- Toolbar (search + filter + sort) on list pages ------- */
.admin-main .toolbar { align-items: center; margin-bottom: var(--space-3); }
.admin-main .toolbar-search { flex: 1 1 22rem; min-width: 16rem; }
.admin-main .toolbar-search .form-control,
.dlg-filter .form-control,
.dlg-list .toolbar-search .form-control {
  padding-left: 2rem;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23737373' stroke-width='2'><circle cx='11' cy='11' r='8'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>");
  background-repeat: no-repeat;
  background-position: 0.5rem center;
}
.toolbar-sort {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-fg-muted);
}
/* Sort icon inside the select, like the search icon, so no separate label competes with the filter. */
.toolbar-sort .form-select {
  width: auto;
  padding-left: 2rem;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23737373' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M7 4v16M3 8l4-4 4 4M17 20V4M13 16l4 4 4-4'/></svg>"), var(--select-chevron);
  background-position: 0.5rem center, right var(--space-3) center;
}
/* Once TomSelect takes over, the icon moves to its control; the list opens leftwards from the toolbar's edge. */
.toolbar-sort .ts-wrapper.no-search .ts-control {
  padding-left: 2rem;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23737373' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M7 4v16M3 8l4-4 4 4M17 20V4M13 16l4 4 4-4'/></svg>"), var(--select-chevron) !important;
  background-position: 0.5rem center, right var(--space-3) center !important;
}
.toolbar-sort .ts-dropdown { left: auto; right: 0; }
/* --- App grid (applications list) ------------------------- */
.app-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
}
.app-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  /* the head sits 32px down: the space two (now removed) corner-mark spans took above it */
  padding: var(--space-8) var(--space-5) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  background: var(--color-surface-subtle);
  text-decoration: none;
  color: inherit;
  position: relative;
  transition: border-color .15s;
}
.app-card:hover { border-color: var(--color-border-strong); }
.app-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}
.app-card-name { font-weight: 600; }
.app-card-entity {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-fg-muted);
  word-break: break-all;
}
.app-card-meta {
  display: flex;
  gap: var(--space-4);
  font-size: var(--text-xs);
  color: var(--color-fg-subtle);
  margin-top: var(--space-2);
}
.app-card-meta strong { color: var(--color-fg); font-weight: 600; }

/* --- Key/value + mapping tables --------------------------- */
.map-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--text-sm);
}
.map-table th, .map-table td {
  padding: var(--space-2) var(--space-4);
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--color-divider);
}
.map-table th {
  padding-block: 10px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-fg-subtle);
  font-weight: 400;
  background: var(--color-surface-sunken);
  border-top: 1px solid var(--color-divider);
}
.map-table .form-control, .map-table .form-select { padding: 0.3rem var(--space-2); }
.map-arrow {
  text-align: center;
  font-family: var(--font-mono);
  color: var(--color-fg-subtle);
  width: 2rem;
}

/* --- Group / session / signing tables (share member-table look) --- */
.group-table, .session-table, .signin-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--text-sm);
}
.group-table th, .group-table td,
.session-table th, .session-table td,
.signin-table th, .signin-table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--color-divider);
}
.group-table th, .session-table th, .signin-table th {
  padding-block: 10px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-fg-subtle);
  font-weight: 400;
  background: var(--color-surface-sunken);
  border-top: 1px solid var(--color-divider);
}
.group-table tbody tr:hover, .signin-table tbody tr:hover { background: var(--color-surface-subtle); }
.cell-detail { overflow-wrap: anywhere; }
.cell-detail-fix { margin-top: var(--space-1); color: var(--color-fg); }

/* --- Member picker (group detail) ------------------------- */
.member-toolbar {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  flex-wrap: wrap;
}
.member-toolbar .field { flex: 1 1 18rem; min-width: 14rem; }
.picker { position: relative; }
.picker-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 16rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  padding: var(--space-2);
  z-index: 10;
}
.picker.is-open .picker-menu { display: block; }
.picker-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2);
  font-size: var(--text-sm);
  cursor: pointer;
}
.picker-row:hover { background: var(--color-surface-subtle); }

/* --- App tabs (detail page) ------------------------------- */
.app-tabs { margin-top: 0; }
.app-tabs .nav.nav-tabs { flex-wrap: wrap; }
.nav-link-danger { color: var(--color-danger-fg); }
.nav-link-danger[aria-selected="true"] {
  color: var(--color-danger-fg);
  border-bottom-color: var(--color-danger-fg);
}
/* Mode switch pinned to the right of the tab bar (SSO / Provisioning).
   The switch sits outside the tab list, so tabs may wrap while the
   switch stays on the first line. */
nav.app-tabs {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.app-tabs .nav.nav-tabs { flex: 1 1 auto; min-width: 0; }
.nav-mode-switch {
  flex: none;
  margin-left: auto;
  align-self: center;
}
/* Compact density so all SSO tabs plus the switch share one line. */
nav.app-tabs .nav-link { padding: 13px 0.875rem; }
/* Danger zone stands apart at the far end of the tab row. */
.app-tabs .nav.nav-tabs > li:has(> .nav-link-danger) { margin-left: auto; }
/* Verified-connection checkmark in the Connection tab. */
[data-conn-check] {
  color: var(--color-success-fg);
  font-weight: 700;
}
/* Provisioning tabs stay visible but dimmed until a connection test passes. */
.nav-link-locked { opacity: 0.55; }
/* SCIM gate: fieldset wrapper disabling a whole panel until the connection test passes. */
.scim-gate {
  display: block;
  border: 0;
  margin: 0;
  padding: 0;
  min-inline-size: 0;
}
.scim-gate[disabled] { opacity: 0.6; }
/* Native <dialog> using the .modal card look — UA centering, dimmed backdrop. Content stays inside
   the box; overflow: visible keeps the UA's overflow: auto from adding scrollbars of its own. */
dialog.modal {
  position: fixed;
  margin: auto;
  color: var(--color-fg);
  overflow: visible;
}
dialog.modal::backdrop { background: rgb(0 0 0 / 0.5); }
/* A dialog must never outgrow the viewport. The overflow: visible above (which lets the corner
   decorations sit outside the box) means the dialog itself cannot scroll, and a modal makes the
   page behind inert — so a tall body pushes the footer, and every way out, past the fold with
   nothing able to scroll to it. The body scrolls instead, keeping header and footer reachable at
   any content length. The :not([open]) rule puts back what the UA gives closed dialogs: setting
   display here would otherwise leave a closed dialog laid out and swallowing every click. */
dialog.modal {
  display: flex;
  flex-direction: column;
  max-height: 85vh;
}
dialog.modal:not([open]) { display: none; }
/* The body takes whatever is left and is the ONE scroller. Capping the payload pane instead
   would give two nested scrollbars and still let the footer slide off a short viewport. */
dialog.modal > .modal-body { flex: 1; overflow: auto; min-height: 0; }
/* Wide enough for a SCIM resource; 28rem wraps every URL in the payload over three lines. */
dialog.modal-wide { max-width: min(44rem, 92vw); }
.modal-list {
  margin: var(--space-3) 0 0;
  padding-left: 1.2rem;
  display: grid;
  gap: var(--space-1);
}
/* Attention mark on the Provisioning switch/sidebar group. */
[data-activity-attention] {
  color: var(--color-warn-fg);
  font-weight: 700;
}
select.scim-user-picker,
select.scim-user-picker + .ts-wrapper {
  min-width: 22rem;
}
/* A fixed-width picker (form-select-inline) keeps its width once TomSelect takes over. */
.ts-wrapper.form-select-inline { min-width: 19.625rem; }
/* Job details: a zero-width wrapper keeps the wide transcript from stretching the table
   columns, and grid items need min-width: 0 or long JSON lines push past the table edge. */
[data-job-detail] .job-detail {
  width: 0;
  min-width: 100%;
}
[data-job-detail] .grid-2 { min-width: 0; }
[data-job-detail] .grid-2 > div { min-width: 0; }
/* Wire transcripts: one step per exchange, so a failed test shows which call broke. */
.wire-log { margin-top: var(--space-2); }
.wire-log-step {
  padding-left: var(--space-3);
  border-left: 2px solid var(--color-border);
}
.wire-log-step + .wire-log-step { margin-top: var(--space-4); }
.wire-log-step-failed { border-left-color: var(--color-danger-fg); }
.wire-log-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}
.wire-log-call {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}
.wire-log-pane { min-width: 0; }
.wire-log-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-fg-muted);
}
.wire-log-label + .cert-pem { margin-top: var(--space-1); }
/* Provisioning jobs table: fixed layout so the 3s refresh cannot shuffle column widths as
   relative times and error lines change length. Widths come from the <th> styles. */
.scim-jobs-table { table-layout: fixed; }
.scim-jobs-table td { overflow-wrap: anywhere; }
/* The actions column shares the free width with Subject; a job's Details, Retry now and Cancel wrap when it runs out. */
.scim-jobs-table th.row-actions { width: auto; }
.scim-jobs-table td.row-actions:has(> .btn + .btn) { white-space: normal; }

/* Icon-only copy button: the checkmark replaces the glyph, so the button never resizes. */
[data-copy-pane] { padding: 0 var(--space-1); }
[data-copy-pane].is-copied > svg { display: none; }
[data-copy-pane].is-copied::before {
  content: "✓";
  color: var(--color-success-fg);
}

/* Wire transcripts: the same box wherever a raw request/response is shown — Activity job
   details, the connection test diagnostics, the user lookup result. */
.cert-pem {
  margin: var(--space-2) 0 0;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}
/* .form-group / .field set display, which beats the user-agent [hidden] rule; restore it. */
[data-tab-panel][hidden] { display: none !important; }
[data-meta-panel][hidden] { display: none !important; }
[data-search-toolbar][hidden] { display: none !important; }
/* .btn sets display, which beats the user-agent [hidden] rule; a hidden button must really go. */
.btn[hidden] { display: none; }
[data-app-prov-field][hidden] { display: none !important; }
[data-protocol-note][hidden] { display: none !important; }
.badge[hidden] { display: none !important; }
[data-sp-badges][hidden] { display: none !important; }
button.badge { cursor: pointer; }
button.badge:hover { border-color: currentColor; box-shadow: inset 0 0 0 1px currentColor; }
button.badge:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 1px; }
/* Below 36rem the table scrolls in its wrapper instead of squeezing the provisioning options under the picker. */
.scope-groups-table { table-layout: fixed; min-width: 36rem; }
.scope-groups-table th:nth-child(1) { width: 22%; }
.scope-groups-table th:nth-child(2) { width: 5.5rem; }
.scope-groups-table th:nth-child(3) { width: 30%; }
/* Each option stays on one line; the pair stacks when the 30% column gets too narrow for both. */
.scope-groups-table [data-scope-sync-col] > .cluster-tight { flex-wrap: wrap; row-gap: var(--space-1); }
.scope-groups-table .checkbox-row { white-space: nowrap; }
.scope-groups-table select.js-searchable + .ts-wrapper { width: 100%; min-width: 0; }
#scim-scope-region .group-table select.js-searchable + .ts-wrapper { min-width: 0; }
.scope-groups-table .ts-control { overflow: hidden; flex-wrap: nowrap; }
.scope-groups-table .ts-control .item { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scope-groups-table [data-sp-effect] { display: block; white-space: normal; }
.scope-groups-table .badge { white-space: nowrap; }
/* Scope card: Groups and Users are framed sub-sections, the add button at the bottom right under the table. CSS only,
   so the markup stays the same as the Java pages the tests compare against. */
#scim-scope-form > .vstack > div:has(> .table-responsive) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: var(--space-3);
  padding: var(--space-4) var(--space-4) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}
#scim-scope-form > .vstack > div:has(> .table-responsive) > * { grid-column: 1 / -1; }
#scim-scope-form > .vstack > div:has(> .table-responsive) > strong { grid-column: 1; grid-row: 1; font-size: var(--text-base); }
#scim-scope-form > .vstack > div:has(> .table-responsive) > .actions { justify-self: end; margin-top: var(--space-3) !important; }
#scim-scope-form > .vstack > div:has(> .table-responsive) > .table-responsive { margin: var(--space-3) calc(-1 * var(--space-4)) 0; }
#scim-scope-form > .vstack > div:has(> .table-responsive) > p:last-child { margin: var(--space-3) 0 0; }
#scim-scope-form .group-table { margin-top: 0 !important; table-layout: fixed; }
/* Fixed layout cannot widen a column, so long group names and user emails wrap instead of painting into the remove column. */
#scim-scope-form .group-table td:first-child { overflow-wrap: anywhere; }
#scim-scope-form .group-table tbody tr:last-child td { border-bottom: none; }
/* Buttons that read as .btn-secondary but keep the btn-ghost class of the markup the Java DOM tests
   compare. Only the .btn-secondary variables are set, so the theme's .btn rules draw every state;
   add a button here rather than restyling it elsewhere. */
#scim-scope-form [data-scope-add],
[data-mapping-add],
#scim-activity-form > .btn,
#scim-activity-region .actions-note > .btn,
.actions-field:has(> .backup-key) .btn,
#dlg-protected-region [data-add-group] {
  --bs-btn-color: var(--color-fg);
  --bs-btn-bg: var(--color-btn-secondary-bg);
  --bs-btn-border-color: var(--color-control-border);
  --bs-btn-hover-color: var(--color-fg);
  --bs-btn-hover-bg: var(--color-surface-hover);
  --bs-btn-hover-border-color: var(--color-border-strong);
  --bs-btn-active-color: var(--color-fg);
  --bs-btn-active-bg: var(--color-surface-pressed);
  --bs-btn-active-border-color: var(--color-control-border);
  --bs-btn-disabled-color: var(--color-fg-disabled);
}
/* One remove column, the same width in the scope and mapping tables, with a button big enough to hit. */
#scim-scope-form .group-table .row-actions, .map-table:has([data-mapping-remove]) .row-actions { width: 3.5rem; padding-inline: var(--space-2); text-align: center; }
.scope-groups-table .cluster-tight { gap: var(--space-4); }
/* Remove (×) buttons in the admin's row tables: one 2rem square everywhere, muted, red on hover. Matched by table
   kind because the markup, shared with the Java pages the tests compare, has no remove class; those tables hold no
   other ghost buttons in their action cell except Copy. */
:is(.group-table, .map-table, .kv-table, .invite-formats) td.row-actions:has(> .btn-ghost.btn-sm:not([data-copy-url])) {
  width: 3.5rem; padding-inline: var(--space-2); text-align: center;
}
:is(.group-table, .map-table, .kv-table, .invite-formats) td.row-actions > .btn-ghost.btn-sm:not([data-copy-url]) {
  width: 2rem; height: 2rem; padding: 0;
  font-size: 1.25rem; line-height: 1;
  color: var(--color-fg-muted);
}
:is(.group-table, .map-table, .kv-table, .invite-formats) td.row-actions > .btn-ghost.btn-sm:not([data-copy-url]):hover {
  color: var(--color-danger-fg); background: var(--color-danger-bg);
}
/* SCIM activity card. The filter row: segmented, search and Retry all failing at one height, the button at the right.
   Sync status: the title, the reconciliation note and Reconcile now on one line. Look up: Check as tall as the picker.
   CSS only, so the markup stays the same as the Java pages the tests compare against. */
#scim-activity-form { align-items: center; gap: var(--space-2); }
#scim-activity-form input[type="search"] { flex: 0 1 16rem; height: 2.5rem; }
#scim-activity-form > .btn { margin-left: auto; height: 2.5rem; }
/* Sync status: the title sits beside the note and Reconcile button where there is room, above them on a narrow
   screen. The note and button wrap rather than push past the card. */
#scim-activity-region .actions-note > span { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 720px) { #scim-activity-region .actions-note { flex-wrap: wrap; } }
@media (min-width: 721px) {
  #scim-activity-region .actions-note > .btn { flex: none; }
  #scim-activity-region > div:has(> .actions-note) {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: var(--space-4);
  }
  #scim-activity-region > div:has(> .actions-note) > * { grid-column: 1 / -1; }
  #scim-activity-region > div:has(> .actions-note) > strong { grid-column: 1; grid-row: 1; }
  #scim-activity-region > div:has(> .actions-note) > .actions-note { grid-column: 2; grid-row: 1; margin-top: 0 !important; }
}
.actions-field:has(> .scim-user-picker) > .btn { align-self: stretch; height: auto; }
/* SCIM connection: the last test's transcript is the card's bottom section, headed like a .card-header with a
   ghost Show / Hide button. Drawn on the bare <details>, whose markup is shared with the Java pages the tests compare. */
[data-tab-panel="prov-conn"] .card-body > details {
  margin: 0 calc(-1 * var(--bs-card-spacer-x)) calc(-1 * var(--bs-card-spacer-y));
  border-top: 1px solid var(--color-border);
}
[data-tab-panel="prov-conn"] .card-body > details > summary {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-3) var(--bs-card-spacer-x);
  font-size: 0.9375rem; font-weight: 600; line-height: 1.5;
  color: var(--color-fg) !important;
  list-style: none; cursor: pointer;
}
[data-tab-panel="prov-conn"] .card-body > details > summary::-webkit-details-marker { display: none; }
[data-tab-panel="prov-conn"] .card-body > details > summary::after {
  content: "Show";
  display: inline-flex; align-items: center; flex: none;
  height: 2rem; padding: 0 var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-xs); font-weight: 500;
  color: var(--color-fg-secondary);
  transition: color 120ms, background 120ms;
}
[data-tab-panel="prov-conn"] .card-body > details[open] > summary::after { content: "Hide"; }
[data-tab-panel="prov-conn"] .card-body > details > summary:hover::after { color: var(--color-fg); background: var(--color-fill-quiet); }
[data-tab-panel="prov-conn"] .card-body > details > summary:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -2px; }
[data-tab-panel="prov-conn"] .card-body > details[open] > summary { border-bottom: 1px solid var(--color-border); }
[data-tab-panel="prov-conn"] .card-body > details > :not(summary) { margin: var(--bs-card-spacer-y) var(--bs-card-spacer-x); }
/* SCIM scope and mapping save rows laid out like the theme's .save-bar: the note on the left, Discard then Save at
   the right edge. Reordered in CSS, so the markup stays the same as the Java pages the tests compare against. */
.card-body > .cluster:has(> .btn-primary[hx-post$="/preview"]) { flex-wrap: nowrap; gap: var(--space-2); }
.card-body > .cluster:has(> .btn-primary[hx-post$="/preview"]) > span { order: 0; flex: 1 1 auto; min-width: 0; }
.card-body > .cluster:has(> .btn-primary[hx-post$="/preview"]) > .btn-ghost { order: 1; flex: none; }
.card-body > .cluster:has(> .btn-primary[hx-post$="/preview"]) > .btn-primary { order: 2; flex: none; }
/* As .save-bar on a narrow screen: the note takes its own line and the buttons stay at the right edge below it. */
@media (max-width: 720px) {
  .card-body > .cluster:has(> .btn-primary[hx-post$="/preview"]) { flex-wrap: wrap; justify-content: flex-end; }
  .card-body > .cluster:has(> .btn-primary[hx-post$="/preview"]) > span { flex-basis: 100%; }
}
[data-meta-panel] { margin-top: var(--space-4); }

/* --- Sidebar: applications list (app detail pages) ---------- */
/* On an application's page the Applications entry is an open parent: no fill, accent icon, chevron. */
.admin-nav-link.is-open { color: var(--color-fg-strong); font-weight: 500; }
.admin-nav-link.is-open > .icon { color: var(--color-accent); }
/* The group folds: the row is a <summary>, its chevron turns sideways while closed. */
.admin-nav-group > summary { list-style: none; cursor: pointer; }
.admin-nav-group > summary::-webkit-details-marker { display: none; }
.admin-nav-group > summary:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -2px; }
.admin-nav-chevron { display: grid; place-items: center; color: var(--color-fg-muted); transition: transform 150ms; }
.admin-nav-group:not([open]) .admin-nav-chevron { transform: rotate(-90deg); }
.admin-nav-group:not([open]) > summary.is-open { color: var(--color-fg-muted); font-weight: 400; }
.admin-nav-group:not([open]) > summary.is-open > .icon { color: inherit; }
/* The label is a link of its own; the chevron gets a hit area wide enough to aim at. */
.admin-nav-group > summary > a.admin-nav-label { color: inherit; text-decoration: none; align-self: stretch; display: flex; align-items: center; }
.admin-nav-chevron { width: 1.5rem; height: 1.5rem; margin-right: -4px; border-radius: var(--radius-md); }
.admin-nav-chevron:hover { color: var(--color-fg); background: color-mix(in srgb, var(--color-fg) 8%, transparent); }
.admin-nav-apps { display: flex; flex-direction: column; }
.admin-nav-app {
  display: flex; align-items: center; gap: var(--space-3);
  min-height: 2.5rem; padding: 0 var(--space-3) 0 var(--space-2);
  font-size: var(--text-sm); color: var(--color-fg-muted);
  text-decoration: none;
  border-radius: var(--radius-lg);
}
.admin-nav-app:hover { color: var(--color-fg); background: var(--color-nav-active); }
.admin-nav-app.is-active { color: var(--color-fg-strong); font-weight: 500; background: var(--color-accent-soft); }
.admin-nav-mark {
  flex: none; display: grid; place-items: center;
  width: 1.5rem; height: 1.5rem;
  font-size: 0.8125rem; font-weight: 600;
  color: var(--color-fg-muted);
  background: var(--avatar-neutral-bg);
  border: 1px solid var(--color-control-border);
  border-radius: var(--radius-md);
}
.admin-nav-app.is-active .admin-nav-mark {
  color: var(--color-accent);
  background: color-mix(in srgb, var(--color-accent) 30%, var(--color-surface));
  border-color: var(--color-accent-line);
}
.admin-nav-app .admin-nav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-nav-proto {
  flex: none;
  padding: 2px 6px;
  font: 0.6875rem var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--color-fg-subtle);
  background: var(--color-btn-secondary-bg);
  border-radius: var(--radius-sm);
}


/* --- Card anatomy: heading with a subtitle, flush bodies ----- */
.card-heading { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.card-subtitle { line-height: normal; }
.card-title-note { font-weight: 400; color: var(--color-fg-muted); }
.card-header-actions { display: flex; flex: none; align-items: center; gap: var(--space-2); margin: 0; white-space: nowrap; }
.card-intro { margin: 0; max-width: 42.5rem; font-size: var(--text-sm); line-height: 1.55; color: var(--color-fg-muted); }
/* A table or list runs edge to edge; the rows carry their own side padding. */
.form-card .card-body-flush { padding: 0; gap: 0; }
.form-card .card-body-row { padding: var(--space-4) var(--space-5); }
.card-strip { padding: var(--space-3) var(--space-5); border-bottom: 1px solid var(--color-divider); }
.card-strip .field-aliases { margin-top: 0; }
.sub-block:has(> .sub-block-title) { display: flex; flex-direction: column; gap: var(--space-4); }
.sub-block-title { font-size: 0.8125rem; font-weight: 500; color: var(--color-fg-secondary); }
/* !important to outrank Bootstrap's .text-secondary utility, which has the same name */
.text-secondary { color: var(--color-fg-secondary) !important; }

/* Every table in a card runs edge to edge: its scroll box steps out over the card body's
   padding, and the outer cells take that padding back so text stays aligned with the rest. */
.form-card .card-body:not(.card-body-flush) .table-responsive { margin-inline: calc(var(--space-5) * -1); }
/* A framed table stays inside its frame; only a bare table bleeds to the card's edges. */
.form-card .card-body .table-frame .table-responsive { margin-inline: 0; }
.form-card .card-body:not(.card-body-flush) .table-responsive :is(th, td):first-child { padding-left: var(--space-5); }
.form-card .card-body:not(.card-body-flush) .table-responsive :is(th, td):last-child { padding-right: var(--space-5); }
.card:not(.form-card) .table-responsive { margin-inline: calc(var(--bs-card-spacer-x) * -1); }
.card:not(.form-card) .table-responsive :is(th, td):first-child { padding-left: var(--bs-card-spacer-x); }
.card:not(.form-card) .table-responsive :is(th, td):last-child { padding-right: var(--bs-card-spacer-x); }

/* Edge-to-edge tables inside a flush card body. */
.table-flush th:first-child, .table-flush td:first-child { padding-left: var(--space-5); }
.table-flush th:last-child, .table-flush td:last-child { padding-right: var(--space-5); }
.table-flush th { border-top: 0; }
.table-flush tbody tr:last-child td { border-bottom: 0; }
.table-flush td { font-size: 0.8125rem; }
.keys-table { table-layout: fixed; }
.keys-table th { padding-top: 10px; padding-bottom: 11px; line-height: 14px; }
/* The fingerprint is cut at its column, as in the design; the cell's title holds the whole value. */
.keys-table td:nth-child(2) { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.keys-table td { padding-top: 14px; padding-bottom: 14px; }
/* Columns from the design: status 110px and actions 280px, the middle ones 2 : 1.2 : 1.7,
   a 16px gutter between them (each cell's right padding) and 20px at the card edges. */
.keys-table th, .keys-table td { padding-left: 0; padding-right: var(--space-4); }
.keys-table th:nth-child(1) { width: calc(var(--space-5) + 110px + var(--space-4)); }
.keys-table th:nth-child(2) { width: 23.85%; }
.keys-table th:nth-child(3) { width: 14.9%; }
.keys-table th:nth-child(4) { width: 20.5%; }
.keys-table th:nth-child(5) { width: calc(280px + var(--space-5)); }
/* .signin-table cells align left, which beats .row-actions; the actions sit at the right edge. */
.keys-table td.row-actions { text-align: right; }
.keys-table .fingerprint { max-width: 22ch; }
.acs-table td { padding-top: 10px; padding-bottom: 11px; }
.acs-table-default { width: 6.5rem; }
.acs-table-index { width: 4rem; }
.acs-table-binding { width: 11rem; }
.acs-table-source { width: 8rem; }
.acs-table-source-value::first-letter { text-transform: uppercase; }
/* Mapping rows read source -> target from the left, as in the design: a fixed source column. */
#attributes-region .map-table th:first-child, #attributes-region .map-table td:first-child { width: 17.5rem; }
#attributes-region .map-table .map-arrow { width: 2.5rem; padding-inline: 0; }
#attributes-region .map-table td { padding-top: 18px; padding-bottom: 19px; }
.map-arrow .icon { display: inline-block; vertical-align: middle; }

.field-row { display: flex; align-items: center; gap: var(--space-3); }
.btn-field { flex: none; height: 2.75rem; padding: 0 18px; }
.form-select-inline { width: auto; min-width: 19.625rem; height: 2.75rem; }

/* --- Settings switches (checkbox-field.jte) ------------------- */
.toggle-group { display: flex; flex-direction: column; gap: var(--space-5); padding-top: var(--space-5); border-top: 1px solid var(--color-divider); }
/* The switch sits where a checkbox would, before the label (as .form-check.form-switch in theme.html). */
.field.toggle-row { flex-direction: row-reverse; align-items: flex-start; justify-content: flex-end; gap: var(--space-3); }
.toggle-row .form-switch-input { margin-top: 1px; }
.toggle-row-text { display: flex; flex-direction: column; gap: 3px; cursor: pointer; }
.toggle-row-title { font-size: var(--text-sm); font-weight: 500; color: var(--color-fg); }
.toggle-row-hint { max-width: 56rem; font-size: 0.8125rem; line-height: 1.55; color: var(--color-fg-muted); }
/* Same look as .form-check.form-switch (theme.html), drawn on the input itself: an outlined track with a square knob
   that slides right and takes the accent when on. */
input.form-switch-input {
  --switch-w: 2.25rem;
  --switch-h: 1.25rem;
  position: relative;
  width: var(--switch-w); height: var(--switch-h);
  border: 1px solid var(--color-border-strong); border-radius: 4px;
  background: var(--color-surface);
  box-shadow: none;
  transition: border-color 120ms;
}
input.form-switch-input::before {
  content: "";
  position: absolute; top: 2px; left: 2px;
  width: calc(var(--switch-h) - 6px); height: calc(var(--switch-h) - 6px); border-radius: 2px;
  background: var(--color-border-strong);
  transition: transform 120ms, background 120ms;
}
/* The theme's checkbox hover (darker border, accent fill when checked) would turn the whole switch into a green block. */
input.form-switch-input:hover { border-color: var(--color-border-strong); }
input.form-switch-input:checked,
input.form-switch-input:checked:hover { border-color: var(--color-accent); background: var(--color-surface); box-shadow: none; }
input.form-switch-input:checked::before {
  transform: translateX(calc(var(--switch-w) - var(--switch-h)));
  background: var(--color-accent);
}

/* --- Choice cards (one-of settings with a description) -------- */
.choice-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); margin: 0; }
.choice-card {
  display: flex; flex-direction: column; gap: 7px;
  padding: var(--space-4);
  border: 1px solid var(--color-control-border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 120ms, background 120ms;
}
.choice-card:hover { border-color: var(--color-border-strong); }
.choice-card:has(input:checked) {
  border-color: var(--color-accent);
  background: color-mix(in srgb, var(--color-accent) 8%, transparent);
}
.choice-card:has(input:focus-visible) { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.choice-card-head { display: flex; align-items: center; gap: 10px; }
.choice-card-head input[type="radio"]:focus-visible { outline: 0; }
/* Unchecked radios are hollow, so the card shows through, and a shade lighter-edged than the card's border. */
.choice-card-head input[type="radio"]:not(:checked) { background: transparent; border-color: color-mix(in srgb, var(--color-border-strong), var(--color-fg) 8%); }
.choice-card-title { font-size: var(--text-sm); line-height: normal; font-weight: 500; color: var(--color-fg); }
.choice-card-desc { font-size: 0.8125rem; line-height: 1.55; color: var(--color-fg-muted); overflow-wrap: anywhere; }

/* --- Metadata source row -------------------------------------- */
.icon-tile {
  flex: none; display: grid; place-items: center;
  width: 2.375rem; height: 2.375rem;
  color: var(--color-fg-muted);
  background: var(--avatar-neutral-bg);
  border: 1px solid var(--color-control-border);
  border-radius: var(--radius-lg);
}
.source-row { display: flex; align-items: center; gap: var(--space-3); }
.source-row-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.source-row-title { font-size: var(--text-sm); font-weight: 500; color: var(--color-fg); }
.source-row-sub { font-size: 0.8125rem; color: var(--color-fg-muted); }
.source-row-actions { flex: none; display: flex; gap: var(--space-2); }


/* --- Add panels inside form cards ----------------------------- */
/* The toggle joins the card header's right edge; the opened form spans the card under the table. */
.form-card:has(.add-panel-bar) > .card-header { min-height: 4.75rem; padding-right: 13rem; }
.form-card:has(.add-panel-bar) > .card-header .section-meta { display: none; }
.form-card > .card-body .add-panel { margin-top: 0; }
.form-card > .card-body .add-panel-bar { position: absolute; top: 1.125rem; right: var(--space-5); }
/* Collapsed, the panel leaves nothing in the body, so it takes no room; a table that then closes the body
   runs to the card's bottom edge as it runs to the sides. */
.form-card > .card-body .add-panel:has(> .add-panel-body[hidden]) { display: contents; }
.form-card > .card-body:has(> .table-responsive:last-child, > .table-responsive + .add-panel:last-child > .add-panel-body[hidden]) {
  padding-bottom: 0;
}
.form-card > .card-body:has(> .table-responsive:last-child, > .table-responsive + .add-panel:last-child > .add-panel-body[hidden]) > .table-responsive tbody tr:last-child {
  & > td { border-bottom: 0; }
  /* The row hover fill follows the card's rounded corners. */
  & > td:first-child { border-bottom-left-radius: calc(var(--radius-xl) - 1px); }
  & > td:last-child { border-bottom-right-radius: calc(var(--radius-xl) - 1px); }
}
.form-card > .card-body-flush .add-panel-body {
  margin-top: 0;
  border: 0;
  border-top: 1px solid var(--color-accent-line);
  border-radius: 0;
  padding: var(--space-4) var(--space-5);
}
.add-panel-title { margin-bottom: var(--space-4); font-size: 0.9375rem; font-weight: 600; }
.add-panel-body .add-panel-form { align-items: flex-start; gap: var(--space-6); }
.add-panel-body .add-panel-form > .field { flex: 1 1 12rem; min-width: 0; }
.add-panel-body .add-panel-form > .map-arrow { align-self: center; margin-top: 1.5rem; }
.add-panel-actions { margin-top: var(--space-1); }
.acs-form-index { flex: 0 0 6rem !important; }
.acs-form-binding { flex: 0 0 13rem !important; }
.acs-form-location { flex: 1 1 18rem !important; }
.badge-nodot::before { display: none; }

/* --- Form section groups (app detail tabs) ---------------- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  /* Cards carry their own frame, so the group adds none; the top padding plus the
     main column's gap keeps them 24px below the tab bar. */
  padding: var(--space-2) 0 0;
  background: transparent;
}
.form-group-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}
.form-group-head { margin-bottom: var(--space-3); }
.form-group-title {
  font-size: var(--text-base);
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.005em;
}
.form-group-hint {
  font-size: var(--text-xs);
  font-style: italic;
  color: var(--color-fg-muted);
  margin: 2px 0 0;
}

/* --- Credential rows (OIDC client id / secret) ------------- */
.credential {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface-subtle);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}
.credential-value {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  word-break: break-all;
}
.credential-value-masked { color: var(--color-fg-muted); letter-spacing: 0.15em; }
.credential-actions { display: flex; gap: var(--space-2); flex-shrink: 0; }

/* Sub-groupings inside a single card body. */
.sub-block { padding-top: var(--space-5); border-top: 1px solid var(--color-divider); }
.sub-block:first-child { padding-top: 0; border-top: 0; }

/* --- Checkbox / radio + label row ------------------------- */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  width: fit-content;
}

.checkbox-row:has(input:disabled) {
  cursor: default;
  color: var(--color-fg-muted);
}

.form-control:disabled,
.form-control:disabled,
.form-select:disabled {
  color: var(--color-fg-subtle);
  background: var(--color-surface-subtle);
  cursor: not-allowed;
}

/* --- Group-access table selects ------------------ */
.form-select-narrow { width: 12rem; }

/* --- Field aliases (Also known as pills) ------------------- */
.field-aliases {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
  margin-top: var(--space-2);
}
.field-aliases-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--color-fg-subtle);
  margin-right: var(--space-1);
}
.field-aliases .badge { background: transparent; text-transform: none; }

/* --- Collapsed add-panel (add-panel.jte + add-panel.js) ---- */
.add-panel { margin-top: var(--space-4); }
.add-panel-bar { display: flex; justify-content: flex-end; }
.add-panel-body {
  position: relative;
  margin-top: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--color-accent-line);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--color-accent) 4%, transparent);
}
.add-panel-form {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.add-panel-form-stack { display: block; }
.add-panel-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-3);
}
.add-panel-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: none;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border-radius: inherit;
  background: color-mix(in srgb, var(--color-surface) 75%, transparent);
  font-size: var(--text-sm);
  color: var(--color-fg-muted);
}
.add-panel.is-loading .add-panel-overlay { display: flex; }
.add-panel.is-loading .add-panel-body > :not(.add-panel-overlay) {
  pointer-events: none;
}

/* --- Two-factor enrolment --------------------------------- */
.mfa-qr {
  display: block;
  width: 12rem;
  max-width: 100%;
  margin: 0 auto;
  padding: var(--space-2);
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}
.mfa-qr svg { display: block; width: 100%; height: auto; }
.mfa-secret { letter-spacing: 0.12em; word-break: normal; overflow-wrap: normal; }

/* Device approval (/device) */
.device-request { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-1) var(--space-4); margin: 0 0 var(--space-4); font-size: var(--text-sm); }
.device-request dt { color: var(--color-fg-muted); }
.device-request dd { margin: 0; overflow-wrap: anywhere; }
.device-request code { font-size: var(--text-xs); }
.device-warning { margin: 0 0 var(--space-5); font-size: var(--text-sm); font-weight: 600; }
/* The scopes read as one list: areas as small mono labels, rows close together. */
.scope-list { display: flex; flex-direction: column; }
.scope-area {
  margin: var(--space-4) 0 var(--space-1);
  font: 400 0.6875rem var(--font-mono);
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--color-fg-subtle);
}
.scope-list > .scope-area:first-child { margin-top: 0; }
.scope { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--space-2); padding: var(--space-1) 0; font-size: var(--text-sm); cursor: pointer; }
.scope-name { font-family: var(--font-mono); }
.scope small { flex-basis: 100%; padding-left: calc(1rem + var(--space-2)); font-size: var(--text-xs); color: var(--color-fg-muted); }
.scope-danger .scope-name { color: var(--color-danger-fg); }
.scope-all { border-bottom: 1px solid var(--color-border); padding-bottom: var(--space-2); margin-bottom: var(--space-1); }
/* With access, the deny form only carries its fields; its button sits beside Approve. */
.device-deny { display: none; }

/* API access pages */
.api-grants-row-ended { opacity: 0.6; }
.api-grants form { display: inline; }
.api-grants time { white-space: nowrap; }
/* Seven or eight columns: tighter gutters, the card's own edges kept. */
.table-card .api-grants :is(th, td) { padding-inline: var(--space-3); }
/* "Last 24 h" over "Revoke": side by side they would widen an already wide table. */
.api-grants td.text-end.text-nowrap > .btn,
.api-grants td.text-end.text-nowrap > form { display: flex; justify-content: flex-end; margin-left: auto; width: max-content; }
.api-grants td.text-end.text-nowrap > * + * { margin-top: var(--space-1); }
/* Each grant has a row below it that "Last 24 h" fills; until then it takes no room,
   and the grant above it closes the card without a divider when it is the last one. */
.api-grants-usage:has(td:empty) { display: none; }
.table-card .api-grants tbody tr:has(+ .api-grants-usage:last-child td:empty) td { border-bottom: 0; }
.api-usage { padding: 0.5rem 0; }
.code-inline.scope-unused { text-decoration: line-through; opacity: 0.7; }
.code-inline.scope-used { font-weight: 600; }
.table-tight td, .table-tight th { padding-top: 0.25rem; padding-bottom: 0.25rem; font-size: 0.85rem; }

/* Branding admin page */
/* Each theme is a column: a live header bar, then labels beside their controls. */
.form-card .card-body.branding-themes { display: grid; grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr)); gap: var(--space-8) var(--space-12); }
.branding-theme { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; margin: 0; padding: 0; border: 0; }
/* A floated legend drops out of the fieldset's border slot and lays out like a heading. */
.branding-theme-title { float: left; width: 100%; margin: 0; padding: 0; font-size: var(--text-sm); font-weight: 600; }
.branding-rows { display: grid; grid-template-columns: 6rem minmax(0, 1fr); gap: var(--space-4); align-items: center; }
.branding-rows-label { color: var(--color-fg-muted); font-size: var(--text-sm); }
.branding-icon-preview,
.branding-preview-logo {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  background: var(--color-accent) center / contain no-repeat; color: #ffffff; font-weight: 700;
}
.upload-tile-tile:has(.branding-icon-preview) { border-radius: var(--radius-md); overflow: hidden; }
.upload-tile-tile .branding-icon-preview { width: 100%; height: 100%; border-radius: 0; font-size: var(--text-xs); }
.branding-preview-logo { width: 1.5rem; height: 1.5rem; font-size: 0.625rem; }
.branding-preview {
  display: flex; align-items: center; gap: var(--space-3);
  min-height: 3rem; padding: 0 var(--space-3);
  border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  font-weight: 600;
}
.branding-preview-nav { margin-left: auto; font-size: var(--text-xs); font-weight: 400; opacity: 0.7; }
.branding-footer { display: flex; justify-content: flex-end; align-items: center; gap: var(--space-2); }
.branding-footer-status { margin-right: auto; color: var(--color-fg-muted); font-size: var(--text-sm); }
/* !important: the error also carries .d-block */
.invalid-feedback:empty { display: none !important; }

/* --- Home (signed-in landing) ------------------------------------------ */

.home { position: relative; display: flex; flex-direction: column; gap: var(--space-12); width: 100%; max-width: 55rem; margin: 0 auto; }
/* Top right, level with the eyebrow; out of the flow so the hero keeps its place. */
.home-account-slot { position: absolute; top: 0; right: 0; z-index: 2; }

/* An ambient glow along the top of the page, behind the header: green, violet, blue. */
body:has(.home) { position: relative; }
body:has(.home)::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 250px;
  z-index: -1;
  pointer-events: none;
  opacity: var(--home-glow-opacity);
  background:
    radial-gradient(20% 225px at 100% 0, rgb(37 83 144 / 0.76), transparent),
    radial-gradient(36% 175px at 67% 0, rgb(93 43 116 / 0.4), transparent),
    radial-gradient(33% 200px at 25% 0, rgb(16 126 87 / 0.6), transparent);
}
/* The landing page has no header bar: sign-out closes the page, admin has its own section.
   The content keeps a centred column; the footer runs the full width. */
.shell:has(> .home) { max-width: none; min-height: 100dvh; padding: 5.5rem var(--space-10) var(--space-5); gap: var(--space-12); }
.shell:has(> .home) > .navbar { display: none; }
/* A short page still ends at the viewport's bottom edge. */
.shell:has(> .home) > .shell-footer { margin-top: auto; border-top: 0; padding-top: 0; }

/* Hero: plain type on the page, the glow above does the atmosphere. */
.home-hero { position: relative; display: flex; align-items: flex-end; }
.home-hero.bg-mix { background: transparent; }
.home-hero.bg-mix::before,
.home-hero.bg-mix::after,
.home-hero > .bg-aurora-blob { display: none; }
.home-hero-inner { position: relative; display: flex; flex-direction: column; gap: 18px; }
.home-hero .shell-eyebrow { font-size: var(--text-xs); letter-spacing: 0.12em; color: var(--color-fg-muted); }
.home-hero-title { margin: 0; font-size: 3.75rem; line-height: 61px; letter-spacing: -0.05em; font-weight: 600; }
.home-hero-name { color: var(--color-accent); }
.home-hero-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2);
  font-size: 0.8125rem; color: var(--color-fg-muted);
}
.home-hero-meta a { color: inherit; }
/* The hero and the nudge under it read as one group. */
.home-hero:has(+ .home-nudge) { margin-bottom: calc(var(--space-12) * -1 + 36px); }

/* Security nudge: the theme's warning icon, the message in body text, the fix as the one accent button on the page.
   The row is centred, so the icon is too (the theme pins it to the first line of a multi-line alert). */
.home-nudge {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  min-height: 3.625rem;
  padding: 10px 11px 10px 2.875rem;
  font-size: var(--text-sm);
  color: var(--color-fg);
}
.home-nudge::before { top: 50%; translate: 0 -50%; }
.home-nudge .btn { flex: none; font-weight: 600; }

.home-section-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  margin-bottom: var(--space-3);
}
.home-section-title { margin: 0; font-size: 0.8125rem; font-weight: 400; color: var(--color-fg-muted); }
.home-section-count { font-size: var(--text-xs); color: var(--color-fg-muted); }

.home-filter { position: relative; width: 16rem; max-width: 100%; }
.home-filter .form-control { height: 2.25rem; padding-right: 2.25rem; }
.home-filter .kbd { position: absolute; right: 0.5rem; top: 50%; translate: 0 -50%; pointer-events: none; }

/* App list: one card, a row per app - monogram, name over activity, an open button on the right. */
.home-apps {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-subtle);
  overflow: hidden;
}
.home-apps > li + li { border-top: 1px solid var(--color-border); }
.home-apps > li[hidden] { display: none; }
.home-apps form { margin: 0; }
.home-tile {
  all: unset; box-sizing: border-box; cursor: pointer;
  width: 100%; min-height: 5.25rem;
  display: flex; align-items: center; gap: 14px;
  padding: var(--space-4) 19px var(--space-4) 21px;
  color: inherit; font: inherit; text-align: left;
  transition: background .15s;
}
.home-tile:hover, .home-tile:focus-visible { background: var(--color-surface-sunken); }
.home-tile:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -2px; }
.home-tile-mark {
  flex: none;
  width: 3.125rem; height: 3.125rem; display: grid; place-items: center;
  background: var(--color-btn-secondary-bg);
  border: 1px solid var(--color-control-border);
  border-radius: var(--radius-md);
  color: var(--color-accent);
  font-weight: 700; font-size: 1.0625rem;
}
.home-tile-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.home-tile-name { font-size: 0.9375rem; font-weight: 600; }
.home-tile-desc, .home-tile-foot {
  font-size: 0.8125rem; color: var(--color-fg-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.home-tile-foot::first-letter { text-transform: uppercase; }
.home-tile-go {
  flex: none; display: grid; place-items: center;
  width: 2.125rem; height: 2.125rem;
  color: var(--color-fg-muted);
  border: 1px solid var(--color-control-border);
  border-radius: var(--radius-full);
  transition: color .15s, border-color .15s;
}
.home-tile:hover .home-tile-go { color: var(--color-fg); border-color: var(--color-border-strong); }
/* Link under the tile's text: "or as Anna K." opens the account chooser for a shared account. It cannot
   sit inside the tile (a link in a link or a button), so it is laid over a strip the tile keeps free at its
   bottom, lined up with the text column (tile padding + mark + gap) and clear of the arrow. */
.home-apps-item { position: relative; --alt-line: 1.125rem; --alt-left: calc(21px + 3.125rem + 14px); --alt-right: calc(19px + 2.125rem + 14px); }
/* The strip is the link's line plus a gap above it, so the tile's footer text always ends above the link. */
.home-apps-item-shared .home-tile { padding-bottom: calc(var(--space-4) + var(--alt-line) + var(--space-2)); }
.home-tile-alt {
  position: absolute; left: var(--alt-left); right: var(--alt-right); bottom: var(--space-4);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: var(--alt-line);
  font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-fg-muted);
}
.home-tile-alt:hover { color: var(--color-fg); }

.home-empty {
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-lg);
  padding: var(--space-10) var(--space-6);
  text-align: center; color: var(--color-fg-muted); font-size: 0.8125rem;
  display: flex; flex-direction: column; align-items: center; gap: var(--space-2);
}
.home-empty-title { color: var(--color-fg); font-weight: 500; font-size: var(--text-sm); }
.home-nomatch { color: var(--color-fg-muted); font-size: 0.8125rem; padding: var(--space-4) 0; }

/* Account shortcuts: a row of cards, each an icon tile over its label and state. */
.home-account {
  display: grid; gap: var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
}
.home-shortcut {
  display: flex; flex-direction: column; gap: 5px;
  min-height: 8rem;
  padding: 17px var(--space-4) 15px 17px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-subtle);
  color: inherit; text-decoration: none;
  transition: border-color .15s;
}
.home-shortcut:hover { border-color: var(--color-border-strong); }
.home-shortcut-warn, .home-shortcut-warn:hover { border-color: var(--color-warn-border); }
.home-shortcut-icon {
  display: grid; place-items: center;
  width: 2.375rem; height: 2.375rem;
  margin-bottom: 11px;
  color: var(--color-accent);
  background: var(--color-btn-secondary-bg);
  border: 1px solid var(--color-control-border);
  border-radius: var(--radius-md);
}
.home-shortcut-label { font-weight: 600; font-size: 0.9375rem; }
.home-shortcut-hint { font-size: 0.8125rem; color: var(--color-fg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-shortcut-hint::first-letter { text-transform: uppercase; }
.home-shortcut-hint-warn { display: inline-flex; align-items: center; gap: 6px; color: var(--color-warn-fg); }
.home-shortcut-hint-warn::before {
  content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}

/* Admin strip: the account cards' frame, numbers instead of icons */
.home-admin {
  display: grid; gap: var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
}
.home-admin-stat {
  display: flex; flex-direction: column; gap: 5px;
  padding: 17px var(--space-4) 15px 17px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-subtle); color: inherit; text-decoration: none;
  transition: border-color .15s;
}
a.home-admin-stat:hover { border-color: var(--color-border-strong); }
.home-admin-value { font-size: var(--text-xl); font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.2; }
.home-admin-label { font-size: 0.8125rem; color: var(--color-fg-muted); }
.home-admin-label-warn { color: var(--color-warn-fg); }

/* Who is signed in, and the way out, closing the page. */
.home-signed-in {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  margin-top: calc(var(--space-12) * -1 + 32px);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);
}
.home-signed-in form { margin: 0; }
.home-signed-in-login { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-fg-muted); }
.home-signed-in-out {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: 0; border: 0; background: none; cursor: pointer;
  font: 0.8125rem var(--font-sans); color: var(--color-fg-muted);
}
.home-signed-in-out:hover { color: var(--color-fg); }

@media (max-width: 40rem) {
  .home { gap: var(--space-8); }
  .home-hero-title { font-size: 2.5rem; line-height: 1.05; }
  .home-section-head { flex-wrap: wrap; }
  .home-filter { width: 100%; }
  .home-nudge { flex-direction: column; align-items: flex-start; }
  /* stacked, the icon goes back beside the message */
  .home-nudge::before { top: 12px; translate: none; }
  .home-tile { padding: var(--space-3); }
  .home-tile-desc { display: none; }
  .home-account { grid-template-columns: repeat(2, 1fr); }
  /* The tile's own padding is smaller here; the link follows it. */
  .home-apps-item { --alt-left: calc(var(--space-3) + 3.125rem + 14px); --alt-right: calc(var(--space-3) + 2.125rem + 14px); }
  .home-apps-item-shared .home-tile { padding-bottom: calc(var(--space-3) + var(--alt-line) + var(--space-2)); }
  .home-tile-alt { bottom: var(--space-3); }
}

/* ===== Invitations: last invite mail on the users list and user page ===== */
.invite-mail { margin-top: 2px; font-size: 12px; color: var(--color-fg-muted); white-space: nowrap; }
.invite-mail-failed { color: var(--color-danger-fg); }
.invite-row { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; justify-content: space-between; }
.invite-row-hint { font-size: 13px; color: var(--color-fg-muted); }
.invite-link { display: flex; gap: var(--space-2); align-items: center; }
.invite-link .form-control { flex: 1; min-width: 0; }

/* =============================================================
   Settings that depend on a switch (SAML and OIDC sign-out)
   ============================================================= */

/* Settings that only apply while their box is ticked (SAML and OIDC sign-out): unticked, they stay
   visible but inactive. Not [disabled]: a disabled control drops out of the posted form. */
[data-enable-scope]:has([data-enable-toggle] input:not(:checked)) [data-enabled-only] {
  opacity: 0.5;
  pointer-events: none;
  user-select: none;
  interactivity: inert;
}
.slo-checks { display: flex; flex-direction: column; gap: var(--space-4); }
.slo-checks-title { font-size: var(--text-sm); font-weight: 600; }
.actions-field > .backup-key { max-width: none; align-self: center; }
/* Backup import key: the key reads as a read-only field and Copy / New key as secondary buttons of the same height. */
.actions-field:has(> .backup-key) { align-items: stretch; }
/* Centred by line height, not flex: a flex box would wrap the text in an anonymous item and drop its ellipsis. */
.actions-field > .backup-key {
  display: block; box-sizing: border-box;
  height: 2.75rem; line-height: calc(2.75rem - 2px); padding: 0 var(--space-3);
  font-size: var(--text-sm);
  border-radius: var(--radius-lg);
}
.actions-field:has(> .backup-key) .btn { height: 2.75rem; }
/* The theme sizes a plain list to its longest option; NameID formats are URNs too long for the window. */
#nameid-fmt + .ts-wrapper .ts-dropdown { width: 100%; }
#nameid-fmt + .ts-wrapper .ts-dropdown .option { white-space: normal; overflow-wrap: anywhere; }

/* --- Custom domain ------------------------------------------ */
.domain-sub { margin: var(--space-1) 0 0; max-width: 42rem; }
/* Status words read as written ("Wrong target"), not title-cased by the theme badge. */
#domain-region .badge { text-transform: none; }
#domain-region .card-header { flex-wrap: wrap; }
.domain-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3) var(--space-6);
}
.domain-head-host { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); }
.domain-head-title { margin: 0; font-size: var(--text-lg); font-weight: 500; overflow-wrap: anywhere; }
.domain-head-lede { margin: var(--space-1) 0 0; max-width: 40rem; }
.domain-head > :first-child { flex: 1 1 26rem; min-width: 0; }
.domain-head-aside { flex: none; display: flex; align-items: center; gap: var(--space-3); color: var(--color-fg-muted); }
.domain-alert-acts { margin-top: var(--space-2); }

/* Three steps in a row, titles only on a phone: done is solid, the current one carries the accent ring. */
.domain-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}
.step {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  background: var(--color-surface-subtle);
}
.step-n {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.375rem;
  height: 1.375rem;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-fg-muted);
  background: var(--color-fill-quiet);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
}
.step-t { font-size: 0.8125rem; font-weight: 500; }
.step-d { font-size: var(--text-xs); color: var(--color-fg-muted); }
.step.is-done .step-n { color: var(--color-on-accent); background: var(--color-accent); border-color: var(--color-accent); }
.step.is-now { border-color: var(--color-accent); box-shadow: 0 0 0 3px var(--color-accent-soft); }
.step.is-now .step-n { color: var(--color-accent); background: var(--color-accent-soft); border-color: var(--color-accent); }

/* A value people copy: mono, wraps rather than widening the table, copy button right after it. */
.domain-val { display: inline-flex; align-items: center; gap: var(--space-1); max-width: 100%; }
.domain-val code { font-family: var(--font-mono); font-size: 0.8125rem; overflow-wrap: anywhere; }
.domain-note { margin-left: var(--space-2); }
.domain-detail { overflow-wrap: anywhere; }

/* A record name as DNS panels ask for it, relative to the zone, with the zone after it in grey. */
.domain-zone { color: var(--color-fg-subtle); }
/* Record values stay on one line; the table scrolls on a phone instead of breaking a name at a hyphen. */
.domain-records .domain-val code { white-space: nowrap; overflow-wrap: normal; }
.domain-records td { height: auto; }
.form-card .card-footer.domain-foot { align-items: center; justify-content: space-between; flex-wrap: wrap; padding-top: var(--space-4); border-top: 1px solid var(--color-divider); }
.domain-foot-note { margin-right: auto; }
.domain-foot-acts { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; justify-content: flex-end; }

/* Label column and value column, rows separated by hairlines. */
.domain-kv { display: grid; grid-template-columns: minmax(8rem, 12rem) minmax(0, 1fr); margin: 0; }
.domain-kv > dt,
.domain-kv > dd {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
  margin: 0;
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--color-divider);
}
.domain-kv > dt { font-size: var(--text-sm); color: var(--color-fg-muted); }
.domain-kv > dd { font-size: var(--text-sm); }

.domain-modal .modal-body { display: flex; flex-direction: column; gap: var(--space-4); }
.domain-modal .modal-body p { margin: 0; }

/* Activate dialog: what changes, old value struck through, arrow, new value; stacked on a phone. */
#domain-promote-modal { width: min(780px, calc(100vw - 2rem)); max-width: none; }
.act-changes { display: grid; grid-template-columns: max-content minmax(0, 1fr) auto minmax(0, 1fr); align-items: baseline; gap: var(--space-3) 0.875rem; padding: 0.875rem var(--space-4); border: 1px solid var(--color-border); border-radius: var(--radius-md); font-size: 0.8125rem; }
.act-k { color: var(--color-fg-muted); }
.act-old { color: var(--color-fg-subtle); overflow-wrap: anywhere; }
.act-old s { text-decoration-thickness: 1px; }
.act-arrow { color: var(--color-fg-muted); }
.act-new { display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.act-why { font-size: var(--text-xs); color: var(--color-fg-subtle); }
#domain-promote-modal code { font-family: var(--font-mono); font-size: var(--text-xs); }
.act-apps { margin-top: 0.375rem; }
.act-apps .chip { font-family: inherit; letter-spacing: 0; text-transform: none; }
.act-note { margin: 0; font-size: var(--text-xs); color: var(--color-fg-muted); }
.act-note code { overflow-wrap: anywhere; }
.act-foot { justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.act-foot-btns { display: flex; gap: var(--space-2); margin-left: auto; }
@media (max-width: 620px) {
  .act-changes { grid-template-columns: auto minmax(0, 1fr); gap: var(--space-1) var(--space-2); }
  .act-k { grid-column: 1 / -1; margin-top: var(--space-2); }
  .act-k:first-child { margin-top: 0; }
  .act-old { grid-column: 1 / -1; }
}
.domain-health td:first-child { white-space: nowrap; }
.affix { display: flex; align-items: stretch; min-width: 0; border: 1px solid var(--color-control-border); border-radius: var(--radius-lg); overflow: hidden; background: var(--color-surface); }
.affix:focus-within { border-color: var(--color-accent); }
.affix-pre { display: flex; align-items: center; padding: 0 var(--space-3); font: 0.8125rem var(--font-mono); color: var(--color-fg-muted); background: var(--color-surface-subtle); border-right: 1px solid var(--color-control-border); }
.affix .form-control { border: 0; border-radius: 0; box-shadow: none; min-width: 0; flex: 1; }
.field-error .affix { border-color: var(--color-danger-strong); }

/* Verify step: one line per record, then the certificate, each with its own state. */
.domain-checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-4); }
.domain-check { display: grid; grid-template-columns: 1.5rem minmax(0, 1fr); gap: var(--space-3); align-items: start; }
.domain-check-icon { width: 1.5rem; height: 1.5rem; border-radius: var(--radius-full); display: grid; place-items: center; border: 1px solid var(--color-border-strong); color: var(--color-fg-muted); }
.domain-check-ok .domain-check-icon { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-on-accent); }
.domain-check-bad .domain-check-icon { background: var(--color-danger-bg); border-color: var(--color-danger-border); color: var(--color-danger-fg); }
.domain-check-busy .domain-check-icon { border-color: var(--color-accent-line); }
.domain-check-todo { opacity: .6; }
.domain-check-t { font-weight: 500; line-height: 1.5rem; }
.domain-check-d { font-size: var(--text-sm); color: var(--color-fg-muted); overflow-wrap: anywhere; }
.domain-check-code { display: block; font: 0.75rem var(--font-mono); color: var(--color-fg-muted); overflow-wrap: anywhere; }
.domain-danger-link { color: var(--color-danger-fg); }
.domain-later { margin: 0; }

@media (max-width: 720px) {
  .domain-steps .step-d { display: none; }
  /* records stack: type on the left, name over target, so nothing scrolls sideways */
  .domain-records thead { display: none; }
  .domain-records tr { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-1) var(--space-3); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-divider); }
  .domain-records td { padding: 0; border: 0; }
  .domain-records td:first-child { grid-row: span 2; }
  .domain-records td:nth-child(3) { display: flex; gap: var(--space-1); }
  .domain-records td:nth-child(3)::before { content: "→"; color: var(--color-fg-muted); }
  .domain-records .domain-val code { white-space: normal; overflow-wrap: anywhere; }
  .domain-kv { grid-template-columns: minmax(0, 1fr); }
  .domain-kv > dt { padding-bottom: 0; border-top: 1px solid var(--color-divider); }
  .domain-kv > dd { border-top: 0; }
}

/* --- Narrow viewport ---------------------------------------- */
/* The shared shell's own narrow rules are in theme.css. The design mock loads this file as is. */
@media (max-width: 1024px) {
  /* The list of applications would crowd the nav row; the Applications entry leads to it. */
  .admin-nav-apps { display: none; }
  .admin-nav-chevron { display: none; }
  .app-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  .app-grid { grid-template-columns: 1fr; }
  /* Headers stack: title first, its actions on their own row at the right edge. */
  .panel-head { flex-direction: column; align-items: stretch; }
  .panel-head > .cluster,
  .panel-head > .actions { justify-content: flex-end; }
  /* App tabs: the SSO / Provisioning switch takes its own row above the tabs. */
  nav.app-tabs { flex-wrap: wrap; }
  nav.app-tabs .nav.nav-tabs { flex-basis: 100%; }
  .nav-mode-switch { order: -1; }
}

/* Group picking: the user page's group chips and picker, the groups list's bulk changes. */
.add-row { display: flex; gap: var(--space-2); align-items: flex-start; flex-wrap: wrap; }
.add-row > select,
.add-row > .ts-wrapper { flex: 1 1 22rem; min-width: 0; }
/* Same height as the picker control beside it, not the small default. */
.add-row > .btn { height: 2.75rem; padding-inline: var(--space-5); font-size: var(--text-sm); }
.opt { display: flex; align-items: center; gap: var(--space-2); flex: 1; min-width: 0; }
.opt-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.opt-name { font-weight: 500; }
.opt-desc { color: var(--color-fg-subtle); font-size: var(--text-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opt-meta { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-fg-subtle); white-space: nowrap; }
.ts-dropdown .option.disabled { opacity: 0.5; cursor: default; }

.gchips-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); margin: var(--space-4) 0 var(--space-2); flex-wrap: wrap; }
.gchips-head .form-control { max-width: 16rem; height: 2rem; }
.gchips-head .form-control[hidden] { display: none; }
.gchips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.gchip {
  display: inline-flex; align-items: center; gap: 2px; height: 1.75rem; padding: 0 2px 0 var(--space-2);
  border: 1px solid var(--color-border); background: var(--color-surface-subtle); font-size: var(--text-sm);
  border-radius: var(--radius-md); max-width: 100%;
}
.gchip[hidden] { display: none; }
.gchip a { color: var(--color-fg); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gchip a:hover { text-decoration: underline; }
.gchip button { background: none; border: 0; cursor: pointer; color: var(--color-fg-subtle); font-size: 1rem; line-height: 1; padding: 0 6px; height: 100%; }
.gchip button:hover { color: var(--color-danger-fg); }
.gchip-system { border-style: dashed; }
.gchip-tag { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-fg-subtle); padding: 0 6px 0 4px; }
.gchips-more { margin-top: var(--space-2); }
.linkish { background: none; border: 0; padding: 0; color: var(--color-accent); cursor: pointer; font: inherit; font-weight: 500; text-decoration: none; }
.linkish:hover, .linkish:focus-visible { text-decoration: underline; }
.linkish[hidden] { display: none; }

.bulkbar {
  display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap;
  min-height: 2.75rem; padding: 5px 5px 5px var(--space-4); margin-bottom: var(--space-2);
  border: 1px solid var(--color-border); border-radius: 0.625rem; background: var(--color-surface-subtle);
  font-size: var(--text-sm);
}
.bulkbar[hidden] { display: none; }
.bulkbar-count { font-weight: 500; color: var(--color-fg-strong); margin-right: var(--space-2); }
.bulkbar-spacer { flex: 1; }
/* The bulk bar sits in the toolbar's cell and swaps with it, so ticking a row never moves the table. */
.toolbar-swap { display: grid; }
.toolbar-swap > * { grid-area: 1 / 1; min-width: 0; }
.toolbar-swap > .bulkbar { margin-bottom: 0; }
.toolbar-swap:not(.is-bulk) > .bulkbar, .toolbar-swap.is-bulk > .toolbar { visibility: hidden; }
.bulkbar-note { color: var(--color-fg-muted); }
.table-check input[type="checkbox"] { display: block; width: 1rem; height: 1rem; margin: 0; accent-color: var(--color-fg); cursor: pointer; }
.table tr.is-selected { background: var(--color-surface-subtle); }
#group-bulk-form > .chips { margin-bottom: var(--space-3); }
#group-bulk-form > [data-bulk-preview] { margin: var(--space-2) 0 0; }
/* The modal body is the dialog's scroller: an absolute list would be clipped, so it pushes down instead. */
[data-bulk-dialog] .ts-dropdown, [data-members-dialog] .ts-dropdown { position: static; margin-top: var(--space-1); box-shadow: none; }
[data-bulk-dialog] .ts-dropdown-content, [data-members-dialog] .ts-dropdown-content { max-height: 12rem; }

/* Group page: header avatar, members just added, the "Add members" side panel, toasts with Undo. */
.page-header-top > .avatar-xl { flex: none; }
.table tr.is-new td:first-child { box-shadow: inset 2px 0 0 var(--color-accent); }
.user-cell > .chip { margin-left: var(--space-2); }
/* A flag that is set but not used now, such as a group's "2FA" under a policy that ignores groups. */
.chip-idle { color: var(--color-fg-subtle); border-style: dashed; }
[data-group-panel][hidden] { display: none; }

/* The modal card pinned to the right edge at full height; the body between tools and footer scrolls. */
dialog.modal.side-panel {
  margin: 0 0 0 auto; width: min(32rem, 100vw); max-width: none; height: 100dvh; max-height: 100dvh;
  border-radius: 0; border-width: 0 0 0 1px;
}
.side-panel .modal-header .form-text { margin: var(--space-1) 0 0; }
/* The body reaches into the panel's right padding so its scrollbar runs along the panel edge
   instead of over the list's border and badges (overlay scrollbars take no room of their own). */
dialog.modal.side-panel > .side-panel-body { margin-right: calc(-1 * var(--space-6)); padding-right: var(--space-6); }
.side-panel .modal-footer { align-items: center; }
.side-panel .ts-wrapper { width: 100%; }
.side-panel-tools { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-3); }
.side-panel-tools[hidden] { display: none; }
.side-panel-section { display: flex; align-items: center; gap: var(--space-2); margin: var(--space-3) 0 var(--space-2); }
.side-panel-section .form-label { margin: 0 auto 0 0; }
.side-panel-section .btn[hidden] { display: none; }
.side-panel-paste { margin-bottom: var(--space-2); }
.side-panel-paste .modal-list { margin-top: var(--space-1); }
.side-panel-groupbar { margin-bottom: var(--space-2); }
.side-panel-hide { margin: 0 0 var(--space-2); font-size: var(--text-sm); color: var(--color-fg-muted); }
.members-dialog-move { margin-top: var(--space-3); }
.scim-impact { margin-top: var(--space-3); }
.side-panel-count { margin-right: auto; font-size: var(--text-sm); color: var(--color-fg-muted); }
.side-panel-error { color: var(--color-danger-fg); }
.side-panel label.user-cell { cursor: pointer; }
.side-panel tr.is-off { opacity: 0.55; }
/* The list fits the panel: fixed columns, long names and emails cut with an ellipsis. */
.side-panel .table { table-layout: fixed; width: 100%; }
.side-panel .table td.table-check { width: 3rem; }
.side-panel .table td.text-end.text-nowrap { width: 8.5rem; }
.side-panel .user-cell { min-width: 0; }
/* "member" reads as a status next to the Invited / Suspended badges, so it takes the badge shape. */
.side-panel [data-panel-list] .chip {
  height: 1.5rem;
  padding: 0 10px;
  font: 500 var(--text-xs)/1 var(--font-sans);
  letter-spacing: 0;
  text-transform: capitalize;
  border-color: var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-badge-neutral);
}
.side-panel .user-cell-meta { min-width: 0; overflow: hidden; }
.side-panel .user-cell-meta > * { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-panel .table-responsive { overflow-x: hidden; }
/* "Show N more" fills its whole row, so the row is the click target. */
.table-card table td.side-panel-more { padding: 0; }
.side-panel-more > .btn { display: flex; width: 100%; height: 100%; min-height: 2.75rem; justify-content: center; border-radius: 0; }

/* Toast with an action: text and button centred on one row. */
.toast-actionable { align-items: center; }
.toast-actionable .toast-text { flex: 1; min-width: 0; }
.toast-actionable .toast-body { overflow-wrap: anywhere; }
.toast-actionable .btn { flex: none; }

/* A URL or an SP message has no spaces to break at. */
.alert, .page-header-meta { overflow-wrap: anywhere; }

/* Account chooser: sign in to an application as someone who shared their account */
.dlg-choices { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.dlg-choice {
  display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4); cursor: pointer;
  border: 1px solid var(--color-border); background: var(--color-surface);
}
.dlg-choice:hover { border-color: var(--color-border-strong); }
.dlg-choice:has(input:checked) { border-color: var(--color-fg); box-shadow: 0 0 0 3px var(--color-accent-ring); }
.dlg-choice:has(input:focus-visible) { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.dlg-choice:has(input:disabled) { cursor: not-allowed; background: var(--color-surface-subtle); }
.dlg-choice:has(input:disabled) .dlg-choice-name { color: var(--color-fg-muted); }
.dlg-choice input { width: 1rem; height: 1rem; margin: 0; accent-color: var(--color-fg); }
.dlg-choice-name { font-weight: 500; display: block; }
.dlg-choice-sub { display: block; font-size: var(--text-xs); color: var(--color-fg-muted); }
.dlg-choice-sub-warn { color: var(--color-warn-fg); }
.dlg-fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.dlg-fieldset > legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.dlg-choice-list { display: flex; flex-direction: column; gap: var(--space-2); }
.dlg-choices-scroll { max-height: 19rem; overflow-y: auto; overflow-x: hidden; padding: 4px; margin: -4px;
  scrollbar-width: thin; scrollbar-color: var(--color-border-strong) transparent; }
.dlg-choice > :last-child { min-width: 0; }
.dlg-choice-name, .dlg-choice-sub { overflow-wrap: anywhere; }

/* Shared accounts (profile): lists, inline confirms, share dialog */
.dlg-tabs { margin-top: calc(var(--space-2) * -1); }
.dlg-who { display: flex; align-items: center; gap: var(--space-2); }
.dlg-sub { display: block; font-size: var(--text-xs); color: var(--color-fg-muted); }
.dlg-bar { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; justify-content: space-between; }
.dlg-bar-spaced { margin-bottom: var(--space-3); }
.dlg-empty { padding: var(--space-6); text-align: center; color: var(--color-fg-muted); font-size: var(--text-sm); }
.dlg-actions { text-align: right; white-space: nowrap; }
.dlg-confirm { display: inline-flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; justify-content: flex-end; font-size: var(--text-sm); }
.dlg-confirm[hidden] { display: none; }
.dlg-inline-error { margin-left: var(--space-2); font-size: var(--text-sm); }
.dlg-confirm .dlg-inline-error { margin-left: 0; }
.dlg-cards { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); }
.dlg-cards-wrap .dlg-cards { margin-bottom: var(--space-2); }
.dlg-card-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin-top: var(--space-3); }
.dlg-list .toolbar { align-items: center; margin-bottom: var(--space-3); }
.dlg-list td .badge { white-space: nowrap; }
/* A date stays on one line ("19 Oct, 22:25"), so From and Until never stack into three lines next to a long
   status badge. What still does not fit scrolls inside the frame instead of sticking out of the card. */
.dlg-list td.font-monospace { white-space: normal; }
.dlg-list .table-frame { overflow-x: auto; }
/* A framed table already has its border, so it does not bleed to the card edge like a bare card table. */
.card .table-frame .table-responsive { margin-inline: 0; }
.card .table-frame .table-responsive :is(th, td):first-child { padding-left: var(--space-3); }
.card .table-frame .table-responsive :is(th, td):last-child { padding-right: var(--space-3); }
.table-dlg th, .table-dlg td { padding-left: var(--space-3); padding-right: var(--space-3); }
/* A list that is reloading dims and ignores clicks: whatever started the request (search box, pager, a
   button in a row) carries .htmx-request, and the list is its ancestor. */
.dlg-list [id^="dlg-"][id$="-region"] { transition: opacity .15s ease; }
.dlg-list:has(.htmx-request) [id^="dlg-"][id$="-region"] { opacity: .5; pointer-events: none; cursor: progress; }
.table-dlg th:last-child { width: 1%; }
.dlg-list .table .dlg-who > span:last-child { min-width: 0; max-width: 7rem; }
.dlg-list .table th, .dlg-list .table td { padding-left: var(--space-2); padding-right: var(--space-2); }
.dlg-list .table .dlg-who > span:last-child, .dlg-list .table .dlg-who .dlg-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlg-cards .dlg-who > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.dlg-dialog { padding: var(--space-6); max-width: 36rem; width: calc(100% - 2rem); margin: auto; color: var(--color-fg); max-height: calc(100vh - 2rem); overflow: auto; }
.dlg-dialog .modal-body { color: var(--color-fg); }
.dlg-dialog .ts-wrapper { min-width: 0; width: 100%; }
.dlg-form { display: flex; flex-direction: column; gap: var(--space-4); }
.dlg-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
@media (max-width: 30rem) { .dlg-grid2 { grid-template-columns: 1fr; } }
.dlg-dialog .modal-footer { align-items: center; }

/* Admin delegations page: policy card, protected groups, events. */
/* .card.card-body is display:block and gives its children a bottom margin; the double class keeps the
   policy card a column with only the gap between rows. */
.dlg-policy, .card.dlg-policy { display: flex; flex-direction: column; gap: var(--space-4); }
.card.dlg-policy > * { margin-bottom: 0; }
/* What "Delegation is off" greys out; inside the policy card it also stops taking clicks. */
.dlg-dim { opacity: 0.5; }
.dlg-title { margin-bottom: var(--space-3); }
/* The delegations cards head with a card title at the size a dialog title has. */
.dlg-heading { font-size: var(--text-lg); line-height: inherit; }
.dlg-add-group { margin-top: var(--space-2); }
.dlg-policy .dlg-dim { pointer-events: none; }
.dlg-policy-opts { display: flex; flex-direction: column; gap: var(--space-3); }
.dlg-days { width: 6rem; }
.dlg-count { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-fg-subtle); font-weight: 400; margin-left: var(--space-2); }
.dlg-groups-table { width: 100%; table-layout: fixed; }
/* Fixed columns, so adding the picker row does not shift them. */
.dlg-groups-table th:nth-child(2) { width: 7rem; }
/* The fixed layout can't widen the name column, so a long unbroken group name wraps inside it, read in full. */
.dlg-groups-table tbody td:first-child { overflow-wrap: anywhere; }
@media (max-width: 720px) { .dlg-groups-table th:nth-child(2) { width: 5.25rem; } }
/* Protected groups: a framed table like the other admin lists, the add button bordered at its bottom right and
   the remove buttons the same size as in the SCIM scope table. */
#dlg-protected-region { display: flex; flex-direction: column; max-width: 34rem; }
#dlg-protected-region > form {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: clip;
}
#dlg-protected-region > form:has(.ts-wrapper.dropdown-active) { overflow: visible; }
.dlg-groups-table th { border-top: 0; }
.dlg-groups-table tbody tr:last-child td { border-bottom: 0; }
#dlg-protected-region .dlg-add-group { align-self: flex-end; margin-top: var(--space-3); }
.dlg-groups-table .row-actions { width: 3.5rem; padding-inline: var(--space-2); text-align: center; }
.dlg-groups-table .ts-wrapper { width: 100%; min-width: 0; }
.dlg-groups-table select.js-searchable + .ts-wrapper { width: 100%; min-width: 0; }
.dlg-groups-table .ts-control { overflow: hidden; flex-wrap: nowrap; }
.dlg-switch-form { display: flex; align-items: center; gap: var(--space-2); }
.dlg-list td.dlg-by { max-width: 8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlg-reason { max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlg-list .toolbar-grow { margin-left: auto; display: inline-flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.dlg-list .ts-wrapper { min-width: 14rem; }
.dlg-event { display: flex; gap: var(--space-3); padding: var(--space-2) 0; border-bottom: 1px dashed var(--color-border); font-size: var(--text-sm); flex-wrap: wrap; }
.dlg-event-when { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-fg-subtle); min-width: 6.5rem; }
/* Applications card: the switch column keeps one width, so the pill that appears after a toggle, or
   "On" turning into "Off", does not move the next row's switch. */
.table-dlg-apps th:last-child { width: 14rem; }
.table-dlg-apps [data-app-state] { display: inline-block; min-width: 2ch; }

/* --- Password manager (/vault) ------------------------------- */

/* Entry and folder icon colours: step 11 of Radix Colors 3.0.0, light first, then dark under the theme switch.
   Radix Colors, MIT License, Copyright (c) 2021 Radix. Permission is hereby granted, free of charge, to any person
   obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software
   without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute,
   sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
   subject to the following conditions: The above copyright notice and this permission notice shall be included in
   all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
   KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
   PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
   CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
   IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
:root, [data-bs-theme="light"] {
    --icon-gray: #646464; --icon-red: #ce2c31; --icon-orange: #cc4e00; --icon-yellow: #9e6c00;
    --icon-green: #218358; --icon-blue: #0d74ce; --icon-purple: #8145b5; --icon-pink: #c2298a;
}

[data-bs-theme="dark"] {
    --icon-gray: #b4b4b4; --icon-red: #ff9592; --icon-orange: #ffa057; --icon-yellow: #f5e147;
    --icon-green: #3dd68c; --icon-blue: #70b8ff; --icon-purple: #d19dff; --icon-pink: #ff8dcc;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-bs-theme]) {
    --icon-gray: #b4b4b4; --icon-red: #ff9592; --icon-orange: #ffa057; --icon-yellow: #f5e147;
    --icon-green: #3dd68c; --icon-blue: #70b8ff; --icon-purple: #d19dff; --icon-pink: #ff8dcc;
  }
}


.vault {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  width: 100%;
}

.vault__header { display: flex; flex-direction: column; gap: var(--space-1); }
.vault__title { margin: 0; }
.vault__subtitle { margin: 0; font-size: var(--text-sm); color: var(--color-fg-muted); }
.vault__body { display: flex; flex-direction: column; gap: var(--space-4); }
.vault__body .cluster .field { flex: 1; min-width: 12rem; }
.vault__line { display: block; }
.vault pre { white-space: pre-wrap; word-break: break-word; margin: 0; }
/* Shown whole on purpose: a fingerprint or recovery key is compared or copied in full, never truncated. */
.vault__code {
  font-family: var(--font-mono, monospace);
  font-size: var(--text-sm);
  letter-spacing: 0.04em;
  word-break: break-all;
  margin: 0;
}

/* Entry list rows: icon, title and subtitle, then badges; the subtitle drops to one line with an ellipsis. */
.vault-list { display: flex; flex-direction: column; border-top: 1px solid var(--color-border); }
.vault-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border);
}
.vault-row__main { display: flex; flex-direction: column; min-width: 0; }
.vault-row__title { font-weight: 500; }
.vault-row__subtitle {
  font-size: var(--text-sm);
  color: var(--color-fg-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vault-row__badges { display: flex; flex-wrap: wrap; gap: var(--space-1); justify-content: flex-end; align-items: center; }
.vault-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  color: var(--color-on-avatar);
  background: hsl(var(--vault-icon-hue, 160) 45% 42%);
}
.vault-icon--image { background: var(--color-surface-subtle); object-fit: contain; }
/* A symbol or a coloured letter: the colour on a faint tile of itself, so it reads on both themes. */
[data-colour] { --icon-colour: var(--icon-gray); }
[data-colour="red"] { --icon-colour: var(--icon-red); }
[data-colour="orange"] { --icon-colour: var(--icon-orange); }
[data-colour="yellow"] { --icon-colour: var(--icon-yellow); }
[data-colour="green"] { --icon-colour: var(--icon-green); }
[data-colour="blue"] { --icon-colour: var(--icon-blue); }
[data-colour="purple"] { --icon-colour: var(--icon-purple); }
[data-colour="pink"] { --icon-colour: var(--icon-pink); }
.vault-icon--symbol {
  color: var(--icon-colour);
  background: color-mix(in srgb, var(--icon-colour) 14%, transparent);
}

/* The entries view: the folder tree beside the list, above it on narrow screens. */
.vault-browser { display: grid; grid-template-columns: minmax(11rem, 15rem) minmax(0, 1fr); gap: var(--space-4); align-items: start; }
.vault-browser__main { min-width: 0; }
.vault-tree ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.vault-tree__node {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-1) var(--space-2);
  padding-left: calc(var(--space-2) + var(--depth, 0) * 0.875rem);
  border: 0;
  border-radius: var(--radius-md);
  background: none;
  color: var(--color-fg);
  font: inherit;
  font-size: var(--text-sm);
  text-align: left;
  cursor: pointer;
}
.vault-tree__node:hover { background: var(--color-surface-subtle); }
.vault-tree__node:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 1px; }
.vault-tree__node[aria-current="true"] { background: var(--color-surface-subtle); font-weight: 600; }
.vault-tree__glyph { display: inline-flex; color: var(--icon-colour, var(--color-fg-muted)); flex: none; }
.vault-tree__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vault-tree__count { font-size: var(--text-xs); color: var(--color-fg-subtle); font-variant-numeric: tabular-nums; }
.vault-drop { outline: 2px dashed var(--color-accent); outline-offset: -2px; }
.vault-row[draggable="true"] { cursor: grab; }
.vault-panel { padding: var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius-md); }

/* The symbol picker: colours, then the symbols drawn in the chosen colour. */
.vault-icon-picker { display: flex; flex-direction: column; gap: var(--space-2); }
.vault-icon-picker__colours, .vault-icon-picker__group { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.vault-swatch {
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid transparent;
  border-radius: 50%;
  background: var(--icon-colour);
  cursor: pointer;
}
.vault-swatch[aria-pressed="true"] { border-color: var(--color-fg); }
.vault-symbol-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 var(--space-1);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--icon-colour);
  cursor: pointer;
}
.vault-symbol-option[aria-pressed="true"] { border-color: var(--icon-colour); background: color-mix(in srgb, var(--icon-colour) 14%, transparent); }
.vault-swatch:focus-visible, .vault-symbol-option:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 1px; }
.vault-fields { display: flex; flex-direction: column; gap: var(--space-3); }
.vault-field { display: grid; grid-template-columns: minmax(8rem, 12rem) minmax(0, 1fr); gap: var(--space-1) var(--space-3); align-items: baseline; }
.vault-field__value { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; min-width: 0; overflow-wrap: anywhere; }
.vault-field__changed { grid-column: 2; }
.vault-editor {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}
.vault-editor__head { display: flex; gap: var(--space-2); align-items: center; }
.vault-editor__head .form-control { flex: 1; min-width: 0; font-weight: 500; }
.vault-editor__settings { align-items: flex-end; }
/* An input sharing a row with its checkbox keeps its own width, so the checkbox stays on the same line. */
.vault-editor .cluster > :is(.form-control, .form-select) { width: auto; }
.vault-mono { font-family: var(--font-mono); }
.vault-menu { position: relative; }
.vault-menu > summary { list-style: none; }
.vault-menu > summary::-webkit-details-marker { display: none; }
.vault-menu__list {
  position: absolute;
  z-index: 10;
  top: calc(100% + var(--space-1));
  left: 0;
  display: flex;
  flex-direction: column;
  min-width: 12rem;
  padding: var(--space-1);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.vault-menu__item {
  padding: var(--space-2) var(--space-3);
  border: 0;
  border-radius: var(--radius-md);
  font: inherit;
  font-size: var(--text-sm);
  text-align: left;
  color: var(--color-fg);
  background: transparent;
  cursor: pointer;
}
.vault-menu__item:hover, .vault-menu__item:focus-visible { background: var(--color-surface-subtle); outline: none; }
/* Full width, so a passphrase shows whole; in a row cluster it grows and wraps below 20rem. The basis applies in
   rows only: in a column container it would set the height. */
.vault-secret { position: relative; display: flex; align-items: center; width: 100%; min-width: 0; }
.cluster > .vault-secret { flex: 1 1 20rem; width: auto; }
.vault-secret > .form-control { width: 100%; padding-right: 4rem; }
.vault-secret__actions { position: absolute; top: 50%; right: var(--space-1); display: flex; gap: 2px; transform: translateY(-50%); }
.vault-secret--area > .vault-secret__actions { top: var(--space-1); transform: none; }
.vault-secret--blurred { filter: blur(5px); }
.vault-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 0;
  border-radius: var(--radius-md);
  color: var(--color-fg-muted);
  background: transparent;
  cursor: pointer;
}
.vault-icon-button:hover { background: var(--color-surface-subtle); }
.vault-icon-button:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 1px; }
.vault-icon-button[hidden] { display: none; }
/* The time zone combobox: its list floats under the input, scrolls, and marks the active and the picked zone. */
.vault-zone-picker { position: relative; display: inline-flex; }
.vault-zone-picker > .form-control { width: 16rem; max-width: 100%; }
.vault-zones {
  position: absolute;
  z-index: 10;
  top: calc(100% + var(--space-1));
  left: 0;
  width: max-content;
  min-width: 100%;
  max-height: 16rem;
  margin: 0;
  padding: var(--space-1);
  overflow-y: auto;
  list-style: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.vault-zones[hidden] { display: none; }
.vault-zones__option, .vault-zones__empty {
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.vault-zones__option { cursor: pointer; }
.vault-zones__option:hover { background: var(--color-surface-subtle); }
.vault-zones__option[aria-selected="true"] { background: var(--color-surface-subtle); outline: 2px solid var(--color-accent); outline-offset: -2px; }
.vault-zones__option--picked { font-weight: 600; }
.vault-zones__empty { color: var(--color-fg-muted); }
/* The badges under a password keep a line's height, so the rows below stay put when they appear. */
.vault-password { gap: var(--space-1); }
.vault-password__badges { min-height: 1.5rem; }
.vault-break { word-break: break-all; }
.vault-blob { max-height: 12rem; margin: 0; overflow-y: auto; white-space: pre-wrap; font-size: var(--text-sm); }
.vault-blob-input { min-height: 4.5rem; max-height: 12rem; field-sizing: content; word-break: break-all; }
.vault-blob-row > .vault-secret { flex: 1 1 20rem; }
.vault-totp { font-size: 1.25em; letter-spacing: 0.12em; }
.vault-qr { width: 12rem; height: 12rem; max-width: 100%; }
.vault-qr--large { width: 20rem; height: 20rem; }
.vault-totp-uri { overflow-wrap: anywhere; min-width: 0; }
.vault :is(.form-control-sm, .form-select-sm) { width: auto; padding-block: var(--space-1); font-size: var(--text-sm); }
.vault .text-xs { font-size: var(--text-xs); }
.vault .text-danger { color: var(--color-danger-fg); }
@media (max-width: 40rem) {
  .vault-field { grid-template-columns: minmax(0, 1fr); }
  .vault-field__changed { grid-column: 1; }
  .vault-row { grid-template-columns: auto minmax(0, 1fr); }
  .vault-browser { grid-template-columns: minmax(0, 1fr); }
  .vault-row__badges { grid-column: 2; justify-content: flex-start; }
}

/* Where a failed sign-in post puts its alert; empty, it must not add a gap to the form. */
.form-alert-slot { display: contents; }

.trial-bar { display: flex; align-items: center; justify-content: center; gap: var(--space-3); padding: var(--space-2) var(--space-4); background: var(--color-warn-bg); border-bottom: 1px solid var(--color-warn-border); color: var(--color-warn-fg); font-size: var(--text-sm); }
.trial-bar a { color: inherit; font-weight: 600; }
.trial-bar-ending { background: var(--color-danger-bg); border-bottom-color: var(--color-danger-border); color: var(--color-danger-fg); }
.trial-bar-form { margin: 0; display: inline-flex; }
.trial-bar-close { appearance: none; background: transparent; border: 0; color: inherit; font: inherit; font-size: var(--text-lg, 1.25rem); line-height: 1; padding: 0 var(--space-1); cursor: pointer; opacity: .7; }
.trial-bar-close:hover, .trial-bar-close:focus-visible { opacity: 1; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(18rem, .7fr); gap: var(--space-5); align-items: start; }
.detail-grid > * { min-width: 0; }
.detail-grid.detail-grid-halves { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.cluster-end { justify-content: flex-end; }
.notice { padding: var(--space-3) var(--space-4); border-radius: var(--radius-lg); background: var(--color-notice-bg); font-size: var(--text-sm); overflow-wrap: anywhere; }
.notice-danger { color: var(--color-danger-fg); background: var(--color-danger-bg); }
.notice-success { color: var(--color-success-fg); background: var(--color-success-bg); }
.card-compact { padding: 0; }
.card-compact > .card-header { margin: 0; padding: var(--space-3) var(--space-5); }
.card-compact > .card-body { padding: var(--space-4) var(--space-5); }
.kv { display: grid; grid-template-columns: fit-content(10rem) minmax(0, 1fr); margin: 0; font-size: var(--text-sm); }
.kv dd { min-width: 0; overflow-wrap: anywhere; }
.kv dt, .kv dd { margin: 0; padding: var(--space-2) 0; border-bottom: 1px solid var(--color-divider); }
.kv dt { padding-right: var(--space-4); color: var(--color-fg-subtle); font-family: var(--font-mono); font-size: var(--text-xs); }
.release { display: grid; grid-template-columns: auto 1fr auto; gap: var(--space-5); align-items: center; padding: var(--space-4) var(--space-5); border: 1px solid var(--color-border); border-radius: var(--radius-xl); background: var(--color-surface-subtle); }
.release-current { display: flex; flex-direction: column; gap: var(--space-1); }
.release-version { font-size: var(--text-xl); font-weight: 600; background: none; padding: 0; }
.release-state { display: flex; flex-direction: column; gap: var(--space-1); padding-left: var(--space-5); border-left: 1px solid var(--color-border); }
.status-line { display: inline-flex; align-items: center; gap: var(--space-2); font-weight: 500; }
.license-lock { min-height: 100vh; display: grid; place-items: center; padding: var(--space-5); background: var(--color-surface-sunken); }
.license-lock-card { width: 100%; max-width: 32rem; }
@media (max-width: 900px) { .detail-grid, .detail-grid.detail-grid-halves { grid-template-columns: 1fr; } }
/* The template gives the group select width:auto, so it resized with every picked name. A fixed
   width keeps the row still; a long name is cut with an ellipsis. */
#add-group-form > .ts-wrapper,
#add-group-form > input[name="role"] { width: 14rem !important; }
#add-group-form > .ts-wrapper .ts-control > .item { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.billing-form { gap: var(--space-5); }
.billing-form .seat-choice, .license-form .seat-choice { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.billing-form .seat-choice label, .license-form .seat-choice label { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border: 1px solid var(--color-border); border-radius: 8px; cursor: pointer; min-width: 0; }
.billing-form .seat-choice input[type=radio], .license-form .seat-choice input[type=radio] { position: absolute; opacity: 0; pointer-events: none; }
.billing-form .seat-choice label:has(input:checked), .license-form .seat-choice label:has(input:checked) { border-color: var(--color-accent); background: var(--color-accent-wash); }
.billing-form .seat-choice label:has(input:focus-visible), .license-form .seat-choice label:has(input:focus-visible) { outline: 2px solid var(--color-accent-ring); }
.billing-form .seat-choice small, .license-form .seat-choice small { color: var(--color-fg-muted); }
.license-form .seat-choice-compact { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; }
.license-form .seat-choice-compact label { padding: 6px 10px; border-radius: 6px; font-size: var(--text-xs); line-height: 1.35; }
.license-form .seat-choice-compact strong { font-size: var(--text-sm); }
.license-form .license-start legend { margin-bottom: var(--space-2); }
.notice-seats { color: var(--color-fg); background: var(--color-accent-wash); border: 1px solid var(--color-accent); font-weight: 500; }
.price-summary { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); border: 1px solid var(--color-border); border-radius: var(--radius-lg); background: var(--color-surface-subtle); }
.price-rate { display: flex; align-items: flex-end; gap: var(--space-2); }
.price-amount { font-size: 40px; font-weight: 700; line-height: 1; letter-spacing: -0.02em; color: var(--color-fg-strong); }
.price-unit { padding-bottom: 2px; font-size: var(--text-xs); line-height: 1.3; color: var(--color-fg-muted); }
.price-lines { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-1) var(--space-4); margin: 0; font-size: var(--text-sm); }
.price-lines dt { font-weight: 400; color: var(--color-fg-muted); }
.price-lines dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

/* Profile and user page: the photo beside its upload form. */
.photo-card { display: flex; gap: var(--space-4); align-items: flex-start; }
.photo-card-form { display: flex; gap: var(--space-2); align-items: center; }
.photo-crop { display: flex; flex-direction: column; gap: var(--space-2); width: 200px; }
.photo-crop-frame { position: relative; width: 200px; height: 200px; overflow: hidden; border-radius: 50%; box-shadow: 0 0 0 1px var(--color-border); background: var(--color-surface-subtle); cursor: grab; touch-action: none; }
.photo-crop-frame:active { cursor: grabbing; }
.photo-crop-frame img { position: absolute; top: 0; left: 0; max-width: none; transform-origin: 0 0; pointer-events: none; user-select: none; }
.avatar-style-picker { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.avatar-style-option { display: flex; flex-direction: column; align-items: center; gap: var(--space-1); font-size: var(--text-xs); cursor: pointer; }
.avatar-style-option input { position: absolute; opacity: 0; }
.avatar-style-option .avatar { overflow: hidden; box-shadow: 0 0 0 1px var(--color-border); }
.avatar-style-option .avatar > svg { width: 100%; height: 100%; }
.avatar-style-option input:checked + .avatar { box-shadow: 0 0 0 2px var(--color-accent); }
.avatar-style-option input:focus-visible + .avatar { outline: 2px solid var(--color-accent); outline-offset: 2px; }
