.portal-pdf-overlay[hidden] {
  display: none !important;
}

.portal-pdf-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(17, 24, 39, .68);
}

.portal-pdf-dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(1100px, 94vw);
  height: min(85vh, 900px);
  max-height: 85vh;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .28);
}

.portal-pdf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
}

.portal-pdf-title {
  min-width: 0;
  color: #111827;
  font-size: 16px;
  font-weight: 800;
}

.portal-pdf-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.portal-pdf-open-external,
.portal-pdf-close {
  width: auto;
  margin-top: 0;
  white-space: nowrap;
}

.portal-pdf-close {
  min-width: 40px;
  padding-left: 12px;
  padding-right: 12px;
  font-size: 18px;
  line-height: 1;
}

.portal-pdf-loading {
  position: absolute;
  top: 64px;
  left: 50%;
  z-index: 1;
  transform: translateX(-50%);
  padding: 8px 12px;
  color: #111827;
  font-size: 13px;
  font-weight: 700;
  background: rgba(255, 255, 255, .94);
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
}

.portal-pdf-loading[hidden] {
  display: none !important;
}

.portal-pdf-native,
.portal-pdf-js {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}

.portal-pdf-native[hidden],
.portal-pdf-js[hidden] {
  display: none !important;
}

.portal-pdf-native iframe {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  background: #e9edf2;
}

.portal-pdf-js {
  display: flex;
  flex-direction: column;
}

.portal-pdf-pages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  background: #e9edf2;
  overscroll-behavior: contain;
  touch-action: pan-y pinch-zoom;
  -webkit-overflow-scrolling: touch;
}

.portal-pdf-page {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 16px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .15);
}

.portal-pdf-page:last-child { margin-bottom: 0; }
.portal-pdf-page canvas { display: block; max-width: 100%; height: auto; }
.portal-pdf-fallback { padding: 16px; color: #7f1d1d; background: #fef2f2; }
.portal-pdf-fallback[hidden] { display: none !important; }
.portal-pdf-standalone { position: relative; display: flex; flex-direction: column; min-height: 70vh; max-height: calc(100vh - 220px); overflow: hidden; border: 1px solid #d1d5db; border-radius: 12px; }
.portal-pdf-standalone .portal-pdf-loading { top: 12px; }

body.portal-pdf-overlay-open {
  overflow: hidden;
}

@media (max-width: 640px) {
  .portal-pdf-overlay {
    padding: 10px;
  }

  .portal-pdf-dialog {
    width: 96vw;
    max-height: 88vh;
    border-radius: 14px;
  }

  .portal-pdf-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .portal-pdf-actions {
    width: 100%;
  }

  .portal-pdf-open-external {
    flex: 1 1 auto;
  }
}
.portal-pdf-signature-modal{position:fixed;inset:0;z-index:10010;background:rgba(0,0,0,.55);display:flex;align-items:center;justify-content:center;padding:18px}.portal-pdf-signature-modal[hidden]{display:none}.portal-pdf-signature-dialog{background:#fff;border-radius:16px;box-shadow:0 12px 40px rgba(0,0,0,.25);width:min(820px,96vw);padding:18px}.portal-pdf-signature-dialog canvas{width:100%;height:240px;border:2px dashed #bbb;border-radius:12px;touch-action:none;background:transparent}.portal-pdf-signature-actions{display:flex;gap:10px;justify-content:flex-end;margin-top:12px;flex-wrap:wrap}
