.theme-controller-trigger {
  position: fixed;
  bottom: 22px;
  left: 22px;
  z-index: 1040;
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--theme-border);
  border-radius: 50%;
  color: var(--theme-primary);
  background: var(--theme-surface-elevated);
  box-shadow: 0 10px 32px var(--theme-shadow);
}

.theme-controller-trigger:hover {
  color: var(--theme-on-primary);
  border-color: var(--theme-primary);
  background: var(--theme-primary);
  transform: translateY(-2px);
}

.theme-controller-trigger svg {
  width: 21px;
  height: 21px;
}

.theme-controller {
  --bs-offcanvas-width: min(430px, 100vw);
  color: var(--theme-text);
  background: var(--theme-surface);
}

.theme-controller-header {
  min-height: 92px;
  padding: 20px 26px;
  border-bottom: 1px solid var(--theme-border);
}

.theme-controller-header h2 {
  margin: 0;
  font-size: var(--type-22);
}

.theme-controller-kicker {
  margin-bottom: 5px;
  color: var(--theme-primary);
  font-family: var(--font-heading);
  font-size: var(--type-11);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-control);
  text-transform: uppercase;
}

.theme-controller-body {
  padding: 0 26px 30px;
}

.theme-control-group {
  margin: 0;
  padding: 25px 0;
  border: 0;
  border-bottom: 1px solid var(--theme-border);
}

.theme-control-group legend,
.theme-control-heading > label {
  width: auto;
  margin: 0 0 14px;
  color: var(--theme-heading);
  font-family: var(--font-heading);
  font-size: var(--type-13);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-control);
}

.theme-control-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}

.theme-control-heading > label {
  margin: 0;
}

.theme-segmented {
  display: grid;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--theme-border);
  background: var(--theme-surface-muted);
}

.theme-segmented-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.theme-segmented-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.theme-segmented label {
  display: flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 9px;
  color: var(--theme-text-muted);
  background: transparent;
  font-size: var(--type-12);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-control);
  text-align: center;
  cursor: pointer;
}

.theme-segmented label svg {
  width: 16px;
  height: 16px;
}

.theme-segmented input:checked + label {
  color: var(--theme-heading);
  background: var(--theme-surface-elevated);
  box-shadow: 0 2px 10px var(--theme-shadow-soft);
}

.theme-segmented input:focus-visible + label,
.theme-palette-grid input:focus-visible + label {
  outline: 3px solid var(--theme-focus);
  outline-offset: 2px;
}

.theme-palette-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.theme-palette-option {
  display: flex;
  min-height: 72px;
  flex-direction: column;
  justify-content: center;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--theme-border);
  color: var(--theme-heading);
  background: var(--theme-surface-elevated);
  font-size: var(--type-12);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
}

.theme-palette-grid input:checked + .theme-palette-option {
  border-color: var(--theme-primary);
  box-shadow: inset 0 0 0 1px var(--theme-primary);
}

.theme-palette-swatches {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
}

.theme-palette-swatches i {
  height: 12px;
  background: var(--swatch);
}

.theme-custom-colors {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  align-items: center;
  gap: 10px 15px;
  transition: opacity var(--transition);
}

.theme-custom-colors.disabled {
  opacity: 0.42;
}

.theme-custom-colors label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--theme-heading);
  font-size: var(--type-12);
}

.theme-custom-colors output {
  color: var(--theme-text-subtle);
  font-family: var(--font-family-system);
  font-size: var(--type-11);
}

.theme-custom-colors input[type="color"] {
  width: 48px;
  height: 38px;
  padding: 3px;
  border: 1px solid var(--theme-border);
  background: var(--theme-input-background);
  cursor: pointer;
}

.theme-controller .form-check-input {
  border-color: var(--theme-border);
  background-color: var(--theme-surface-muted);
  box-shadow: none;
}

.theme-controller .form-check-input:checked {
  border-color: var(--theme-primary);
  background-color: var(--theme-primary);
}

.theme-select-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
}

.theme-select-grid label {
  color: var(--theme-text-muted);
  font-size: var(--type-12);
}

.theme-select-grid select {
  width: 100%;
  min-height: 44px;
  margin-bottom: 8px;
  padding: 9px 12px;
  border: 1px solid var(--theme-border);
  border-radius: 0;
  color: var(--theme-heading);
  background: var(--theme-input-background);
  font-size: var(--type-14);
}

.theme-reset-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 9px;
  margin-top: 24px;
  padding: 10px 15px;
  border: 1px solid var(--theme-border);
  color: var(--theme-heading);
  background: var(--theme-surface-elevated);
  font-size: var(--type-13);
  font-weight: var(--font-weight-semibold);
}

.theme-reset-button:hover {
  color: var(--theme-on-primary);
  border-color: var(--theme-primary);
  background: var(--theme-primary);
}

.theme-reset-button svg {
  width: 17px;
  height: 17px;
}

@media (max-width: 479.98px) {
  .theme-controller-trigger {
    bottom: 14px;
    left: 14px;
    width: 44px;
    height: 44px;
  }

  .theme-controller-header,
  .theme-controller-body {
    padding-right: 20px;
    padding-left: 20px;
  }

  .theme-palette-grid {
    grid-template-columns: 1fr;
  }
}
