/* UPA — Forms: inputs, labels, switches, type-options, delivery options, notice */
body.upa-page .tg-form-group,
body.upa-page .mb-3 {
  margin-bottom: 0.95rem;
}

body.upa-page .tg-form-label,
body.upa-page .form-label {
  color: var(--upa-text);
  font-size: 0.92rem;
  font-weight: 600;
}

body.upa-page .tg-form-input,
body.upa-page .form-control,
body.upa-page .telegram-form input,
body.upa-page .telegram-form textarea,
body.upa-page .telegram-form select {
  background: #fff;
  border: 1px solid var(--upa-border);
  border-radius: 10px;
  min-height: 2.6rem;
  padding: 0.6rem 0.7rem;
  color: var(--upa-text);
  box-shadow: none;
}

body.upa-page .tg-form-input:focus,
body.upa-page .form-control:focus,
body.upa-page textarea:focus,
body.upa-page select:focus,
body.upa-page input:focus {
  border-color: color-mix(in srgb, var(--upa-primary) 65%, white 35%);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.14);
  outline: none;
}

.upa-hosting-option--disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* Form-type / hosting-type option cards */
body.upa-page .upa-type-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

body.upa-page .upa-type-option {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1.1rem 1.15rem 1.15rem;
  border: 1.5px solid var(--upa-border);
  border-radius: 14px;
  background: var(--upa-surface-soft);
  cursor: pointer;
  transition:
    border-color 140ms ease,
    background 140ms ease,
    box-shadow 140ms ease;
}

body.upa-page .upa-type-option:hover {
  border-color: color-mix(in srgb, var(--upa-primary) 40%, white 60%);
  background: #f5f9ff;
}

body.upa-page .upa-type-option:has(input[type="radio"]:checked) {
  border-color: var(--upa-primary);
  background: #f0f6ff;
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.1);
}

body.upa-page .upa-type-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

body.upa-page .upa-type-option__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 10px;
  background: var(--upa-border);
  transition: background 140ms ease;
  flex-shrink: 0;
}

body.upa-page .upa-type-option:has(input[type="radio"]:checked) .upa-type-option__icon {
  background: color-mix(in srgb, var(--upa-primary) 16%, white 84%);
}

body.upa-page .upa-type-option__icon .upa-icon-symbol img {
  width: 1.25rem;
  height: 1.25rem;
  display: block;
  opacity: 0.55;
  transition: opacity 140ms ease, filter 140ms ease;
}

body.upa-page .upa-type-option:has(input[type="radio"]:checked) .upa-type-option__icon .upa-icon-symbol img {
  opacity: 1;
  filter: invert(34%) sepia(88%) saturate(1516%) hue-rotate(198deg) brightness(99%) contrast(92%);
}

body.upa-page .upa-type-option__icon img.upa-type-option__brand-icon {
  width: 1.5rem;
  height: 1.5rem;
  display: block;
  filter: grayscale(1);
  opacity: 0.5;
  transition: filter 140ms ease, opacity 140ms ease;
}

body.upa-page .upa-type-option:has(input[type="radio"]:checked) .upa-type-option__icon img.upa-type-option__brand-icon {
  filter: none;
  opacity: 1;
}

body.upa-page .upa-type-option__title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--upa-text);
  line-height: 1.2;
}

body.upa-page .upa-type-option:has(input[type="radio"]:checked) .upa-type-option__title {
  color: var(--upa-primary);
}

body.upa-page .upa-type-option__hint {
  font-size: 0.82rem;
  color: var(--upa-muted);
  line-height: 1.45;
  margin: 0;
}

body.upa-page .upa-type-option--disabled {
  opacity: 0.5;
  pointer-events: none;
}

body.upa-page .tg-form-input--error {
  border-color: var(--upa-danger) !important;
  box-shadow: 0 0 0 3px rgba(207, 51, 77, 0.1) !important;
}

body.upa-page .tg-form-error-message {
  color: var(--upa-danger);
  font-size: 0.8rem;
  margin-top: 0.3rem;
}

.upa-notice-warning {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: #fff8ed;
  border: 1px solid #f6ad55;
  border-radius: 10px;
  color: #7b4500;
}

.upa-notice-warning__icon {
  flex-shrink: 0;
  color: #d97706;
  margin-top: 0.05rem;
}

.upa-notice-warning__title {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.upa-notice-warning__body {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.45;
}

body.upa-page .upa-delivery-options {
  display: grid;
  gap: 0.6rem;
}

body.upa-page .upa-delivery-option {
  position: relative;
  display: flex;
  align-items: start;
  gap: 0.6rem;
  border: 1px solid var(--upa-border);
  border-radius: 12px;
  background: #fff;
  padding: 0.7rem 0.75rem;
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

body.upa-page .upa-delivery-option:hover {
  border-color: #9cc0e9;
  background: #f8fbff;
}

body.upa-page .upa-delivery-option.is-active {
  border-color: #75a8e4;
  box-shadow: inset 0 0 0 1px rgba(31, 111, 235, 0.14);
  background: #f4f9ff;
}

body.upa-page .upa-delivery-option input[type="radio"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

body.upa-page .upa-delivery-option__icon {
  flex: 0 0 auto;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.5rem;
  border: 1px solid #c6d7ea;
  background: #f2f7ff;
  color: #5b7da6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

body.upa-page .upa-delivery-option__content {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
}

body.upa-page .upa-delivery-option__icon svg {
  width: 1.05rem;
  height: 1.05rem;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body.upa-page .upa-delivery-option.is-active .upa-delivery-option__icon {
  color: #1f6feb;
  border-color: #99c0f0;
  background: #eaf2ff;
}

body.upa-page .upa-delivery-option strong {
  display: block;
  color: #223146;
  font-size: 0.93rem;
}

body.upa-page .upa-delivery-option small {
  display: block;
  margin-top: 0.18rem;
  color: var(--upa-muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

body.upa-page .upa-settings-tabs--sub {
  margin-bottom: 0.55rem;
}

body.upa-page .upa-example-panel:not(.is-active) {
  display: none;
}

body.upa-page .upa-empty-setup {
  margin: 0;
  border: 1px dashed #c6d7ea;
  border-radius: 10px;
  background: #f8fbff;
  padding: 0.8rem;
}

body.upa-page .upa-setup-link-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

body.upa-page .upa-setup-link-row .tg-form-input {
  flex: 1 1 auto;
}

body.upa-page .upa-code-snippet {
  margin: 0.55rem 0;
  border: 1px solid var(--upa-border);
  border-radius: 0.7rem;
  background: #0f172a;
  color: #d8e4ff;
  padding: 0.75rem 0.8rem;
  overflow-x: auto;
  font-size: 0.78rem;
  line-height: 1.45;
}

body.upa-page .upa-code-snippet--light {
  background: #f8fbff;
  color: #24344b;
  border-color: #cbdbee;
}

body.upa-page .upa-code-snippet .py-keyword {
  color: #f777a0;
  font-weight: 600;
}

body.upa-page .upa-code-snippet .py-name {
  color: #cce2ff;
}

body.upa-page .upa-code-snippet .py-fn {
  color: #85d4ff;
}

body.upa-page .upa-code-snippet .py-string {
  color: #9ad27f;
}

body.upa-page .upa-code-snippet .py-number {
  color: #f9c46b;
}

body.upa-page .upa-code-snippet .py-const {
  color: #b5b7ff;
}

body.upa-page .upa-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 52px;
  height: 30px;
  cursor: pointer;
}

body.upa-page .upa-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

body.upa-page .upa-switch__track {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: #cfdaea;
  transition: background-color 150ms ease;
}

body.upa-page .upa-switch__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  transition: transform 150ms ease;
}

body.upa-page .upa-switch input:checked ~ .upa-switch__track {
  background: var(--upa-primary);
}

body.upa-page .upa-switch input:checked ~ .upa-switch__thumb {
  transform: translateX(22px);
}

body.upa-page .upa-switch--sm {
  width: auto;
  height: 20px;
}

body.upa-page .upa-switch--sm .upa-switch__track {
  width: 36px;
  flex-shrink: 0;
}

body.upa-page .upa-switch--sm .upa-switch__thumb {
  width: 14px;
  height: 14px;
  top: 3px;
  left: 3px;
}

body.upa-page .upa-switch--sm input:checked ~ .upa-switch__thumb {
  transform: translateX(16px);
}

body.upa-page .upa-info-tip {
  width: 1rem;
  height: 1rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #8cb0d9;
  color: #2e5f97;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: help;
  user-select: none;
}

body.upa-page .upa-required-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

body.upa-page .upa-field-edit-form .tg-checkbox-label {
  color: #223954 !important;
  font-weight: 600;
}

body.upa-page .upa-strong-label {
  color: #223954 !important;
  font-weight: 600;
}

body.upa-page .tg-checkbox-label,
body.upa-page .form-check-label {
  color: #223954 !important;
}

body.upa-page .upa-form-basics__switch-list {
  display: grid;
  gap: 0.9rem;
  margin-top: 0.75rem;
}

body.upa-page .upa-form-basics__switch-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

body.upa-page .upa-form-basics__switch-copy {
  display: grid;
  gap: 0.3rem;
  min-width: 0;
}

body.upa-page .upa-form-basics__switch-title {
  margin: 0;
  font-size: 0.96rem;
  line-height: 1.2;
  color: var(--upa-text);
}

body.upa-page .upa-form-basics__switch-subtitle {
  margin: 0;
  font-size: 0.85rem;
  color: var(--upa-muted);
}

body.upa-page .upa-form-basics__switch-row .upa-switch {
  flex: 0 0 auto;
}
