.settings-modal__body {
  display: grid;
  grid-template-columns: 12rem 1fr;
  gap: 1.5rem;
  height: 90vh;
  padding: 1.5rem;
  overflow: hidden;
}

.settings-modal__sidebar {
  border-right: 1px solid var(--border-muted, var(--border));
  padding-right: 1rem;
}

.settings-modal__sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.settings-modal__sidebar button {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.4rem;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  padding: 0.45rem 0.6rem;
  border-radius: 0.35rem;
  cursor: pointer;
}

.settings-modal__sidebar button:hover,
.settings-modal__sidebar button:focus-visible {
  background: var(--sidebar-hover-bg);
}

.settings-modal__sidebar button.active {
  background: var(--accent-soft);
  font-weight: 600;
}

.settings-modal__content {
  overflow-y: auto;
  padding-bottom: 1rem;
}

.settings-section h4 {
  margin-top: 0;
}

.settings-section {
  display: flex;
  flex-direction: column;
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1rem;
}

.settings-actions .secondary {
  min-width: 7rem;
}

.settings-form {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 0.75rem;
}

.settings-form__field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 14rem;
}

.settings-form__field--full {
  flex: 1 1 100%;
  min-width: 100%;
}

fieldset.settings-form__field {
  border: 1px solid var(--border-muted, var(--border));
  border-radius: 0.5rem;
  padding: 0.75rem 0.9rem 0.85rem;
  background: var(--surface-soft);
}

fieldset.settings-form__field legend {
  padding: 0 0.35rem;
  font-weight: 600;
  color: var(--muted-strong, inherit);
}

.settings-form__field input[type='text'],
.settings-form__field input[type='datetime-local'] {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 0.35rem;
  background: var(--surface-soft);
  color: inherit;
}

.settings-form__choices {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: flex-start;
}

.settings-capability-picker {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.capability-dropdown {
  position: relative;
  width: 100%;
}

.capability-dropdown__trigger {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  background: var(--surface-soft);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.capability-dropdown__trigger:hover:not(:disabled),
.capability-dropdown__trigger:focus-visible {
  border-color: var(--accent);
  background: var(--surface);
  outline: none;
}

.capability-dropdown__trigger:disabled {
  cursor: not-allowed;
  color: var(--muted);
  background: var(--surface-muted, var(--surface-soft));
}

.capability-dropdown__chevron {
  flex-shrink: 0;
  opacity: 0.8;
}

.capability-dropdown__menu {
  margin-top: 0.35rem;
  max-height: 18rem;
  overflow-y: auto;
  padding: 0.25rem 0;
  width: 100%;
}

.capability-dropdown__option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
}

.capability-dropdown__option-icon {
  width: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.capability-dropdown__option:not(.is-selected) .capability-dropdown__option-icon {
  color: transparent;
}

.capability-dropdown__option-label {
  flex: 1;
  text-align: left;
}

.capability-dropdown__empty {
  padding: 0.6rem 0.8rem;
  color: var(--muted);
}

.settings-capability-picker__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.settings-capability-picker__chips--inline {
  margin-top: 0.35rem;
}

.settings-capabilities-summary {
  display: inline-block;
  margin-top: 0.4rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.settings-capability-picker__placeholder {
  color: var(--muted);
  font-size: 0.9rem;
}

.settings-capability-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.settings-capability-list--compact {
  margin-top: 0.2rem;
  gap: 0.25rem;
}

.settings-capability-list__item {
  display: inline-flex;
  align-items: center;
}

.settings-choice {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: inherit;
}

.settings-choice input[type='checkbox'] {
  width: 1.05rem;
  height: 1.05rem;
  cursor: pointer;
  accent-color: var(--accent);
}

.settings-choice input[type='checkbox']:disabled + span {
  color: var(--muted);
}

.settings-form__actions {
  display: flex;
  gap: 0.5rem;
}

.settings-form__error {
  color: var(--danger);
  font-size: 0.85rem;
  margin: 0 0 0.75rem;
}

.settings-empty {
  margin: 1rem 0;
  color: var(--muted);
}

.settings-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
}

.settings-table th,
.settings-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border-muted, var(--border));
  text-align: left;
  font-size: 0.9rem;
}

.settings-table tr:last-child td {
  border-bottom: none;
}

.settings-table__actions {
  white-space: nowrap;
}

.settings-status {
  color: var(--muted);
  font-size: 0.9rem;
}

.settings-table tr.is-revoked {
  opacity: 0.65;
}

.settings-notice {
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  padding: 0.9rem 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
}

.token-display {
  background: var(--surface-ink-soft);
  padding: 0.5rem 0.65rem;
  border-radius: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  overflow-x: auto;
}

.settings-notice__actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.settings-notice__actions button {
  flex: 0 0 auto;
}
