/* TNSuite Portal Build88 Hotfix5 rebuilt replacement — single full-canvas Popup contract. */
.tn-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 2200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 3vw, 32px);
  visibility: hidden;
  opacity: 0;
  pointer-events: none !important;
  transition: opacity .2s ease, visibility .2s ease;
}

.tn-popup-overlay.is-open,
.tn-popup-overlay.show {
  visibility: visible;
  opacity: 1;
  pointer-events: auto !important;
}

.tn-popup-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: rgba(8, 15, 31, .64);
  backdrop-filter: blur(12px) saturate(112%);
  cursor: default;
}

.tn-popup-dialog {
  position: relative;
  z-index: 1;
  isolation: isolate;
  display: flex;
  width: min(var(--tn-popup-width, 640px), 100%);
  max-width: 100%;
  min-height: var(--tn-popup-height, auto);
  max-height: min(88dvh, 820px);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--tn-line, hsl(var(--tn-border))) 82%, transparent);
  border-radius: var(--tn-popup-radius, 24px);
  background: var(--tn-card, hsl(var(--tn-surface)));
  color: inherit;
  box-shadow: 0 32px 96px rgba(2, 6, 23, .32), 0 8px 26px rgba(2, 6, 23, .12);
  transform: translateY(8px) scale(.988);
  transition: transform .2s ease;
}

.tn-popup-overlay.is-open .tn-popup-dialog,
.tn-popup-overlay.show .tn-popup-dialog {
  transform: translateY(0) scale(1);
}

.tn-popup-dialog::before {
  position: absolute;
  z-index: 4;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  content: '';
  background: linear-gradient(90deg, var(--tn-blue, #2563eb), color-mix(in srgb, var(--tn-blue, #2563eb) 48%, #7c3aed));
  pointer-events: none !important;
}

.tn-popup-dialog::after,
.tn-popup-scroll,
.tn-popup-header,
.tn-popup-footer,
.tn-popup-close,
.tn-popup-dismiss,
.tn-popup-action {
  pointer-events: auto !important;
}

.tn-popup-header {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 24px 18px;
  border-bottom: 1px solid color-mix(in srgb, var(--tn-line, hsl(var(--tn-border))) 72%, transparent);
  background: color-mix(in srgb, var(--tn-card, hsl(var(--tn-surface))) 97%, transparent);
}

.tn-popup-header--titleless {
  justify-content: flex-end;
  padding-block: 14px 12px;
}

.tn-popup-title {
  min-width: 0;
  margin: 0;
  padding-top: 2px;
  overflow-wrap: anywhere;
  font-size: clamp(21px, 2.2vw, 27px);
  font-weight: 900;
  line-height: 1.22;
  letter-spacing: -.035em;
}

.tn-popup-close,
.tn-popup-dismiss {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 42px;
  border: 1px solid color-mix(in srgb, var(--tn-line, hsl(var(--tn-border))) 86%, transparent);
  background: color-mix(in srgb, var(--tn-card, hsl(var(--tn-surface))) 86%, rgba(127, 127, 127, .1));
  color: inherit;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, transform .18s ease, opacity .18s ease;
}

.tn-popup-close {
  width: 42px;
  padding: 0;
  border-radius: 999px;
}

.tn-popup-close:hover,
.tn-popup-dismiss:hover {
  border-color: color-mix(in srgb, var(--tn-blue, #2563eb) 35%, var(--tn-line, hsl(var(--tn-border))));
  background: color-mix(in srgb, var(--tn-blue, #2563eb) 10%, var(--tn-card, hsl(var(--tn-surface))));
  transform: translateY(-1px);
}

.tn-popup-close:focus-visible,
.tn-popup-dismiss:focus-visible,
.tn-popup-action:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--tn-blue, #2563eb) 42%, transparent);
  outline-offset: 3px;
}

.tn-popup-scroll {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px 24px 24px;
  scrollbar-gutter: stable;
}

.tn-popup-body {
  font-size: 15px;
  line-height: 1.72;
  overflow-wrap: anywhere;
}

.tn-popup-body > :first-child { margin-top: 0; }
.tn-popup-body > :last-child { margin-bottom: 0; }
.tn-popup-body img { display: block; max-width: 100%; height: auto; border-radius: 16px; }
.tn-popup-body a { text-decoration: underline; text-underline-offset: 3px; }
.tn-popup-body ul,
.tn-popup-body ol { padding-left: 1.35rem; }

.tn-popup-highlight {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--tn-line, hsl(var(--tn-border)));
  border-radius: 16px;
  background: rgba(127, 127, 127, .07);
}

.tn-popup-highlight > :last-child { margin-bottom: 0; }

.tn-popup-footer {
  position: relative;
  z-index: 30;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 20px 18px 24px;
  border-top: 1px solid color-mix(in srgb, var(--tn-line, hsl(var(--tn-border))) 74%, transparent);
  background: color-mix(in srgb, var(--tn-card, hsl(var(--tn-surface))) 92%, rgba(127, 127, 127, .08));
}

.tn-popup-preferences {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  align-items: flex-start;
  flex-direction: column;
  gap: 7px;
}

.tn-popup-day-dismiss {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  color: inherit;
  cursor: pointer;
  font-size: 13px;
  font-weight: 780;
  line-height: 1.4;
  user-select: none;
}

.tn-popup-day-dismiss input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.tn-popup-day-dismiss-box {
  position: relative;
  display: inline-flex;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--tn-line, hsl(var(--tn-border))) 92%, transparent);
  border-radius: 6px;
  background: var(--tn-card, hsl(var(--tn-surface)));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .03);
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.tn-popup-day-dismiss:hover .tn-popup-day-dismiss-box {
  border-color: color-mix(in srgb, var(--tn-blue, #2563eb) 48%, var(--tn-line, hsl(var(--tn-border))));
}

.tn-popup-day-dismiss input:checked + .tn-popup-day-dismiss-box {
  border-color: var(--tn-blue, #2563eb);
  background: var(--tn-blue, #2563eb);
}

.tn-popup-day-dismiss input:checked + .tn-popup-day-dismiss-box::after {
  content: '';
  width: 9px;
  height: 5px;
  margin-top: -2px;
  border-bottom: 2px solid #fff;
  border-left: 2px solid #fff;
  transform: rotate(-45deg);
}

.tn-popup-day-dismiss input:focus-visible + .tn-popup-day-dismiss-box {
  outline: 3px solid color-mix(in srgb, var(--tn-blue, #2563eb) 42%, transparent);
  outline-offset: 3px;
}

.tn-popup-day-dismiss-label { overflow-wrap: anywhere; }



.tn-popup-footer--custom .tn-popup-footer-actions {
  margin-left: auto;
  justify-content: flex-end;
}


.tn-popup-footer-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-left: auto;
}

.tn-popup-action {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0 19px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--tn-blue, #2563eb);
  color: #fff;
  font-size: 14px;
  font-weight: 850;
  line-height: 1.2;
  text-decoration: none !important;
  cursor: pointer;
  box-shadow: 0 10px 24px color-mix(in srgb, var(--tn-blue, #2563eb) 25%, transparent);
  transition: transform .18s ease, opacity .18s ease, box-shadow .18s ease;
  pointer-events: auto !important;
}

.tn-popup-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px color-mix(in srgb, var(--tn-blue, #2563eb) 30%, transparent);
}

.tn-popup-dismiss {
  padding: 0 18px;
  border-radius: 12px;
}

body.tn-popup-open { overflow: hidden; }

@media (max-width: 720px) {
  .tn-popup-footer {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
  }
  .tn-popup-footer-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .tn-popup-action,
  .tn-popup-dismiss { flex: 0 1 auto; }
}

@media (max-width: 640px) {
  .tn-popup-overlay { align-items: flex-end; padding: 0; }
  .tn-popup-dialog {
    width: 100%;
    max-width: none;
    max-height: min(92dvh, calc(100dvh - env(safe-area-inset-top)));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: var(--tn-popup-radius, 24px) var(--tn-popup-radius, 24px) 0 0;
    transform: translateY(18px);
  }
  .tn-popup-header { padding: 19px 16px 15px; }
  .tn-popup-header--titleless { padding-block: 12px 10px; }
  .tn-popup-scroll { padding: 18px 16px 20px; }
  .tn-popup-footer { padding: 14px 16px max(14px, env(safe-area-inset-bottom)); }
  .tn-popup-preferences { width: 100%; }
  .tn-popup-day-dismiss { width: 100%; align-items: flex-start; }
  .tn-popup-footer-actions {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .tn-popup-action,
  .tn-popup-dismiss { width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .tn-popup-overlay,
  .tn-popup-dialog,
  .tn-popup-close,
  .tn-popup-dismiss,
  .tn-popup-action { transition-duration: .01ms !important; }
}

/* Build88 Hotfix5 final: single custom HTML canvas, protected shell and configurable radius. */
.tn-popup-dialog--custom {
  width: min(var(--tn-popup-width, 860px), 100%);
  min-height: 0;
  max-height: min(92dvh, 900px);
  border-radius: var(--tn-popup-radius, 24px);
  background: var(--tn-card, hsl(var(--tn-surface)));
}

.tn-popup-dialog--custom::before { display: none; }

.tn-popup-close--floating {
  position: absolute;
  z-index: 40;
  top: 12px;
  right: 12px;
  border-color: rgba(255, 255, 255, .58);
  background: rgba(255, 255, 255, .9);
  color: #111827;
  box-shadow: 0 8px 24px rgba(2, 6, 23, .2);
  backdrop-filter: blur(12px);
}

.tn-popup-custom-scroll {
  position: relative;
  z-index: 1;
  min-height: 0;
  flex: 1 1 auto;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.tn-popup-body--custom {
  position: relative;
  z-index: 1;
  min-height: 1px;
  font-size: inherit;
  line-height: normal;
  overflow: hidden;
}

.tn-popup-body--custom > :first-child { margin-top: 0; }
.tn-popup-body--custom > :last-child { margin-bottom: 0; }
.tn-popup-body--custom img {
  max-width: 100%;
  border-radius: 0;
}
.tn-popup-body--custom > a:only-child {
  display: block;
  color: inherit;
  text-decoration: none;
}
.tn-popup-body--custom > a:only-child > img {
  display: block;
  width: 100%;
  height: auto;
}

.tn-popup-footer--custom {
  min-height: 0;
  padding: 12px 18px 14px;
  background: color-mix(in srgb, var(--tn-card, hsl(var(--tn-surface))) 96%, rgba(127, 127, 127, .06));
}
.tn-popup-footer--custom .tn-popup-preferences { width: 100%; }

@media (max-width: 640px) {
  [data-popup-layout="custom_html"].tn-popup-overlay {
    align-items: center;
    padding: 12px;
  }
  .tn-popup-dialog--custom {
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - 24px);
    border: 1px solid color-mix(in srgb, var(--tn-line, hsl(var(--tn-border))) 78%, transparent);
    border-radius: var(--tn-popup-radius, 24px);
    transform: translateY(8px) scale(.988);
  }
  .tn-popup-overlay.is-open .tn-popup-dialog--custom,
  .tn-popup-overlay.show .tn-popup-dialog--custom {
    transform: translateY(0) scale(1);
  }
  .tn-popup-close--floating {
    top: 10px;
    right: 10px;
    width: 38px;
    min-width: 38px;
    min-height: 38px;
  }
  .tn-popup-footer--custom {
    padding: 12px 14px max(12px, env(safe-area-inset-bottom));
  }
}

/* Starter-template responsiveness for the safe custom HTML canvas. */
.tn-popup-body--custom .tn-popup-template { width: 100%; }
.tn-popup-body--custom .tn-popup-template--image-link > img { display: block; width: 100%; height: auto; }

@media (max-width: 760px) {
  .tn-popup-body--custom .tn-popup-template--split,
  .tn-popup-body--custom .tn-popup-template--spotlight {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .tn-popup-body--custom .tn-popup-template--split > :last-child,
  .tn-popup-body--custom .tn-popup-template--spotlight > :last-child {
    min-height: 240px !important;
  }
  .tn-popup-body--custom .tn-popup-template--full-bleed {
    min-height: min(520px, calc(100dvh - 48px)) !important;
  }
}


/* System controls always stay above custom-canvas content. */
.tn-popup-body--custom [style*="position:absolute"],
.tn-popup-body--custom [style*="position: absolute"] { max-width: 100%; }
.tn-popup-footer--custom .tn-popup-footer-actions {
  width: auto;
  margin-left: auto;
  display: flex;
  justify-content: flex-end;
}
@media (max-width: 640px) {
  .tn-popup-footer--custom { align-items: stretch; }
  .tn-popup-footer--custom .tn-popup-footer-actions { width: 100%; margin-left: auto; justify-content: flex-end; }
  .tn-popup-body--custom .tn-popup-template--image-top > div { padding: 22px !important; }
  .tn-popup-body--custom .tn-popup-template--legacy-converted { padding: 26px 20px !important; }
}
