.mod-ksti,
.mod-ksti * {
  box-sizing: border-box;
}

/* Keep the compact control above overlapping Helix / SP Page Builder columns. */
#sp-header:has(.mod-ksti) {
  position: relative;
  z-index: 1000;
}

#sp-menu:has(.mod-ksti) {
  position: relative;
  z-index: 1001;
}

#sp-menu .sp-module:has(.mod-ksti) {
  position: relative;
  z-index: 1002;
  flex: 0 0 210px !important;
  width: 210px;
  max-width: calc(100vw - 24px);
}

#sp-menu .sp-module:has(.mod-ksti) .sp-module-content {
  width: 100%;
}

.mod-ksti {
  --ksti-accent: #ff792d;
  position: relative;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: min(100%, 210px);
  max-width: 210px;
  min-width: 0;
  padding: 4px;
  color: #20242b;
  background: #fff;
  border: 1px solid #e2e4e8;
  border-radius: 7px;
  box-shadow: 0 2px 8px rgba(24, 31, 42, .08);
  font: inherit;
}

.mod-ksti__label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.mod-ksti__controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px;
  align-items: center;
  gap: 5px;
  width: 100%;
}

.mod-ksti__select,
.mod-ksti__button {
  min-width: 0;
  min-height: 36px;
  font: inherit;
}

.mod-ksti__select {
  width: 100%;
  height: 36px;
  padding: 5px 20px 5px 8px;
  color: #292d33;
  background-color: #fff;
  border: 1px solid #e2e4e8;
  border-radius: 5px;
  box-shadow: none;
  font-size: .76rem;
  font-weight: 600;
}

.mod-ksti__button {
  display: inline-flex;
  width: 88px;
  height: 36px;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  cursor: pointer;
  color: #fff;
  background: var(--ksti-accent);
  border: 0;
  border-radius: 5px;
  font-size: .7rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  transition: background-color .16s ease, transform .16s ease;
}

.mod-ksti__original {
  color: #333942;
  background: #f0f1f3;
  box-shadow: inset 0 0 0 1px #e0e2e5;
}

.mod-ksti__button:hover {
  background: #e96720;
  transform: translateY(-1px);
}

.mod-ksti__original:hover {
  background: #e5e7ea;
}

.mod-ksti__button:focus-visible,
.mod-ksti__select:focus-visible {
  outline: 2px solid rgba(255, 121, 45, .5);
  outline-offset: 2px;
}

.mod-ksti__button[disabled],
.mod-ksti__select[disabled] {
  cursor: wait;
  opacity: .65;
}

.mod-ksti [hidden] {
  display: none !important;
}

.mod-ksti__status {
  display: block;
  min-height: 0;
  margin: 1px 4px 2px;
  color: #626a75;
  font-size: .66rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

@media (max-width: 767px) {
  .mod-ksti--hide-mobile,
  .sp-module:has(.mod-ksti--hide-mobile) {
    display: none !important;
  }

  #sp-menu .sp-module:has(.mod-ksti) {
    flex-basis: min(210px, calc(100vw - 24px)) !important;
    width: min(210px, calc(100vw - 24px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .mod-ksti__button {
    transition: none;
  }
}
