.tf-pwa-panel-open,
.tf-notifications-panel-footer .tf-pwa-panel-open {
  width: 100%;
  margin-top: 12px;
}

.tf-pwa-modal {
  position: fixed;
  inset: 0;
  z-index: 100001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  pointer-events: none;
}

.tf-pwa-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(7, 25, 37, 0.46);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.tf-pwa-modal__panel {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  margin: auto;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: 24px;
  border-radius: 28px;
  background: linear-gradient(180deg, #ffffff 0%, #f6fbfd 100%);
  box-shadow: 0 35px 100px rgba(7, 25, 37, 0.22);
  transform: translateY(24px);
  transition: transform 0.22s ease, opacity 0.22s ease;
  opacity: 0;
}

.tf-pwa-modal-open {
  overflow: hidden;
}

.tf-pwa-modal-open .tf-pwa-modal {
  pointer-events: auto;
}

.tf-pwa-modal-open .tf-pwa-modal__overlay,
.tf-pwa-modal[aria-hidden="false"] .tf-pwa-modal__overlay {
  opacity: 1;
}

.tf-pwa-modal-open .tf-pwa-modal__panel,
.tf-pwa-modal[aria-hidden="false"] .tf-pwa-modal__panel {
  opacity: 1;
  transform: translateY(0);
}

.tf-pwa-modal__head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.tf-pwa-modal__head h3,
.tf-pwa-modal__head p,
.tf-pwa-option h4,
.tf-pwa-option p,
.tf-pwa-modal__install h4,
.tf-pwa-modal__install p {
  margin: 0;
}

.tf-pwa-modal__head p {
  margin-top: 6px;
  color: #5d6e7b;
}

.tf-pwa-modal__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  padding: 0;
  border: 1px solid #d7e4eb;
  border-radius: 50%;
  background: #fff;
  box-sizing: border-box;
  aspect-ratio: 1 / 1;
  font-size: 24px;
  line-height: 1;
}

.tf-pwa-modal__body {
  display: grid;
  gap: 16px;
}

.tf-pwa-modal__status,
.tf-pwa-modal__hint,
.tf-pwa-modal__install,
.tf-pwa-option {
  border: 1px solid #dde8ef;
  border-radius: 22px;
  background: #fff;
}

.tf-pwa-modal__status,
.tf-pwa-modal__hint,
.tf-pwa-modal__install {
  padding: 16px 18px;
}

.tf-pwa-modal__status {
  color: #05568b;
  font-weight: 600;
  white-space: pre-line;
}

.tf-pwa-modal__status.is-error {
  color: #9f2d2d;
}

.tf-pwa-modal__hint {
  color: #7d5a00;
  background: #fff8de;
  border-color: #efdca6;
}

.tf-pwa-modal__install {
  display: grid;
  gap: 12px;
}

.tf-pwa-option {
  padding: 18px;
  display: grid;
  gap: 16px;
}

.tf-pwa-option__copy {
  display: grid;
  gap: 8px;
}

.tf-pwa-option__copy p {
  color: #546572;
}

.tf-pwa-option__badge {
  display: inline-flex;
  width: fit-content;
  padding: 6px 12px;
  border-radius: 999px;
  background: #eef5fb;
  color: #05568b;
  font-size: 13px;
  font-weight: 700;
}

.tf-pwa-option__actions {
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
}

.tf-pwa-option--categories {
  gap: 14px;
}

.tf-pwa-categories {
  display: grid;
  gap: 10px;
}

.tf-pwa-categories__loading,
.tf-pwa-categories__status {
  color: #546572;
  font-size: 14px;
}

.tf-pwa-categories__status {
  padding: 10px 12px;
  border-radius: 12px;
  background: #eef8f2;
  color: #247044;
  font-weight: 600;
}

.tf-pwa-categories__status.is-error {
  background: #fff0f0;
  color: #9f2d2d;
}

.tf-pwa-category-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(0, 2fr);
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid #e5edf2;
  border-radius: 14px;
  background: #fbfdfe;
}

.tf-pwa-category-row__title {
  color: #14313d;
  font-size: 14px;
}

.tf-pwa-category-row__channels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.tf-pwa-category-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: #435965;
  font-size: 12px;
  cursor: pointer;
}

.tf-pwa-category-toggle input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: #05568b;
}

.tf-pwa-category-toggle input:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.tf-pwa-category-toggle.is-disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.tf-pwa-modal .tf-pwa-option__actions .button,
.tf-pwa-modal .tf-pwa-modal__install .button {
  -webkit-appearance: none !important;
  appearance: none !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  margin: 0;
  padding: 10px 16px !important;
  border: 1px solid #05568b !important;
  border-radius: 12px !important;
  background: #fff !important;
  color: #05568b !important;
  box-shadow: none !important;
  cursor: pointer;
  font: inherit;
  font-size: 0.875rem !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  letter-spacing: normal !important;
  text-align: center;
  text-decoration: none !important;
  text-shadow: none !important;
  text-transform: none !important;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
  user-select: none;
}

.tf-pwa-modal .tf-pwa-option__actions .button:hover,
.tf-pwa-modal .tf-pwa-option__actions .button:focus-visible,
.tf-pwa-modal .tf-pwa-modal__install .button:hover,
.tf-pwa-modal .tf-pwa-modal__install .button:focus-visible {
  border-color: #05568b !important;
  background: #05568b !important;
  color: #fff !important;
  outline: none;
  transform: translateY(-1px);
}

.tf-pwa-modal .tf-pwa-option__actions .button:focus-visible,
.tf-pwa-modal .tf-pwa-modal__install .button:focus-visible {
  box-shadow: 0 0 0 3px rgba(5, 86, 139, 0.18) !important;
}

.tf-pwa-modal .tf-pwa-option__actions .button:disabled,
.tf-pwa-modal .tf-pwa-modal__install .button:disabled {
  cursor: default;
  opacity: 0.65;
  transform: none;
}

.tf-pwa-option__actions .button {
  position: relative;
}

.tf-pwa-option__actions .button.is-loading {
  pointer-events: none;
  padding-right: 42px;
}

.tf-pwa-option__actions .button.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 14px;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: tf-pwa-spin 0.7s linear infinite;
}

.tf-pwa-select {
  display: grid;
  gap: 6px;
  min-width: 170px;
  color: #546572;
  font-size: 14px;
}

.tf-pwa-select select {
  min-height: 42px;
  max-width: 125px;
  padding: 0 12px;
  border: 1px solid #d7e4eb;
  border-radius: 14px;
  background: #fff;
}

@keyframes tf-pwa-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 767px) {
  .tf-pwa-modal {
    align-items: flex-start;
    padding: 10px;
  }

  .tf-pwa-modal__panel {
    width: 100%;
    max-height: calc(100vh - 20px);
    max-height: calc(100dvh - 20px);
    padding: 18px;
    border-radius: 24px;
  }

  .tf-pwa-option__actions {
    display: grid;
  }

  .tf-pwa-category-row {
    grid-template-columns: 1fr;
  }

  .tf-pwa-category-row__channels {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
