.theme-palette-btn {
  margin-inline-start: 2px;
  border-inline-start: 1px solid var(--bs-border-color);
}

.nimrod-theme-modal .modal-content {
  border: 1px solid var(--bs-border-color);
  border-radius: 12px;
  box-shadow: 0 18px 60px rgba(15, 17, 21, 0.16);
}

.nimrod-theme-modal .modal-header,
.nimrod-theme-modal .modal-footer {
  border-color: var(--bs-border-color);
}

.theme-pref-section {
  margin-bottom: 1rem;
}

.theme-pref-section__label {
  color: var(--bs-heading-color);
  font-size: 0.8rem;
  font-weight: 800;
  margin-bottom: 0.45rem;
}

.theme-mode-grid {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.theme-mode-option {
  align-items: center;
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
  color: var(--bs-body-color);
  cursor: pointer;
  display: inline-flex;
  font-size: 0.82rem;
  font-weight: 800;
  gap: 0.35rem;
  justify-content: center;
  min-block-size: 42px;
  padding: 0.5rem 0.65rem;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.theme-mode-option:hover,
.theme-mode-option:focus {
  border-color: rgba(var(--user-primary-rgb, 236, 106, 74), 0.45);
  color: var(--user-primary, var(--bs-primary));
  outline: none;
}

.theme-mode-option.active {
  background: rgba(var(--user-primary-rgb, 236, 106, 74), 0.1);
  border-color: var(--user-primary, var(--bs-primary));
  box-shadow: 0 0 0 3px rgba(var(--user-primary-rgb, 236, 106, 74), 0.12);
  color: var(--user-primary, var(--bs-primary));
}

.theme-preset-grid {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.theme-preset-swatch {
  --swatch-color: var(--user-primary, #EC6A4A);
  align-items: center;
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
  color: var(--bs-body-color);
  cursor: pointer;
  display: flex;
  gap: 0.55rem;
  min-block-size: 44px;
  padding: 0.6rem 0.75rem;
  position: relative;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.theme-preset-swatch input {
  inset: 0;
  opacity: 0;
  pointer-events: none;
  position: absolute;
}

.theme-preset-swatch__dot {
  background: var(--swatch-color);
  block-size: 1.15rem;
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(15, 17, 21, 0.12);
  flex: 0 0 1.15rem;
  inline-size: 1.15rem;
}

.theme-preset-swatch__text {
  font-size: 0.8rem;
  font-weight: 800;
  min-inline-size: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-preset-swatch:hover,
.theme-preset-swatch:focus-within {
  border-color: var(--swatch-color);
}

.theme-preset-swatch.active {
  background: rgba(var(--user-primary-rgb, 236, 106, 74), 0.06);
  background: color-mix(in srgb, var(--swatch-color) 10%, var(--bs-body-bg));
  border-color: var(--swatch-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--swatch-color) 18%, transparent);
}

.theme-custom-row {
  align-items: center;
  border: 1px dashed var(--bs-border-color);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin: 0;
  padding: 0.75rem;
}

.theme-custom-row:hover {
  border-color: rgba(var(--user-primary-rgb, 236, 106, 74), 0.45);
}

.theme-custom-row__control {
  align-items: center;
  display: inline-flex;
  flex: 0 0 auto;
  gap: 0.65rem;
}

.theme-custom-row .form-control-color {
  block-size: 2.25rem;
  inline-size: 3rem;
  padding: 0.25rem;
}

.theme-preview {
  background: rgba(var(--user-primary-rgb, 236, 106, 74), 0.06);
  background: color-mix(in srgb, var(--preview-primary, var(--user-primary, #EC6A4A)) 8%, var(--bs-body-bg));
  border: 1px solid rgba(var(--user-primary-rgb, 236, 106, 74), 0.25);
  border: 1px solid color-mix(in srgb, var(--preview-primary, var(--user-primary, #EC6A4A)) 35%, var(--bs-border-color));
  border-radius: 8px;
  padding: 0.9rem;
}

.theme-preview__badge {
  color: var(--preview-primary, var(--user-primary, #EC6A4A));
  font-size: 0.68rem;
  font-weight: 900;
  margin-bottom: 0.35rem;
}

.theme-preview__title {
  color: var(--bs-heading-color);
  font-size: 0.92rem;
  font-weight: 900;
  margin-bottom: 0.75rem;
}

.theme-preview__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.theme-preview__button,
.theme-preview__pill {
  align-items: center;
  border-radius: 8px;
  display: inline-flex;
  font-size: 0.76rem;
  font-weight: 900;
  min-block-size: 32px;
  padding: 0.35rem 0.75rem;
}

.theme-preview__button {
  background: var(--preview-primary, var(--user-primary, #EC6A4A));
  color: #fff;
}

.theme-preview__pill {
  background: var(--bs-body-bg);
  border: 1px solid var(--preview-primary, var(--user-primary, #EC6A4A));
  color: var(--preview-primary, var(--user-primary, #EC6A4A));
}

@media (max-width: 575.98px) {
  .nimrod-theme-modal .modal-dialog {
    margin-inline: 0.75rem;
  }

  .theme-mode-grid,
  .theme-preset-grid {
    grid-template-columns: 1fr;
  }

  .theme-custom-row {
    align-items: flex-start;
  }
}
