.nx-pdf-viewer {
  --nx-pdf-bg: #e9eef3;
  --nx-pdf-ink: #17212b;
  width: 100%;
  min-width: 0;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(148, 163, 184, .35);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .08);
}

.nx-pdf-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .65rem .75rem;
  border-bottom: 1px solid rgba(148, 163, 184, .28);
  background: linear-gradient(180deg, #fff, #f8fafc);
  color: var(--nx-pdf-ink);
}

.nx-pdf-toolbar-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .4rem;
}

.nx-pdf-btn {
  min-width: 42px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  border-radius: 11px;
  font-weight: 750;
}

.nx-pdf-page-control {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  margin: 0;
}

.nx-pdf-page-input {
  width: 66px;
  min-height: 40px;
  text-align: center;
  font-weight: 800;
}

.nx-pdf-page-total,
.nx-pdf-source-label {
  color: #64748b;
  font-size: .76rem;
  font-weight: 700;
}

.nx-pdf-source-label {
  max-width: 34%;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nx-pdf-stage {
  position: relative;
  min-height: 0;
  flex: 1 1 auto;
  max-height: 76vh;
  overflow: auto;
  padding: 12px;
  background:
    linear-gradient(45deg, rgba(255,255,255,.22) 25%, transparent 25%) 0 0/22px 22px,
    linear-gradient(-45deg, rgba(255,255,255,.22) 25%, transparent 25%) 0 0/22px 22px,
    var(--nx-pdf-bg);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  text-align: center;
}

.nx-pdf-page-image {
  display: block;
  max-width: none;
  height: auto;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 5px 20px rgba(15, 23, 42, .22);
  transition: opacity .18s ease;
  user-select: none;
  -webkit-user-drag: none;
}

.nx-pdf-page-image.is-loading { opacity: .45; }

.nx-pdf-loading {
  position: sticky;
  z-index: 3;
  top: 12px;
  left: 50%;
  width: max-content;
  max-width: calc(100% - 24px);
  margin: 0 auto -42px;
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .55rem .8rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, .88);
  color: #fff;
  font-size: .78rem;
  font-weight: 750;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .22);
}

.nx-pdf-status {
  padding: .55rem .25rem .1rem;
  font-size: .75rem;
  color: #64748b;
  text-align: center;
}

.nx-pdf-viewer:fullscreen,
.nx-pdf-viewer.nx-pdf-expanded {
  position: fixed;
  inset: 0;
  z-index: 10050;
  border-radius: 0;
  display: flex;
  flex-direction: column;
}

.nx-pdf-viewer:fullscreen .nx-pdf-stage,
.nx-pdf-viewer.nx-pdf-expanded .nx-pdf-stage {
  max-height: none;
  height: 100%;
  flex: 1 1 auto;
}

@media (max-width: 767.98px) {
  .nx-pdf-viewer {
    border-radius: 13px;
  }
  .nx-pdf-toolbar {
    align-items: flex-start;
    padding: .55rem;
  }
  .nx-pdf-toolbar-group {
    width: 100%;
    gap: .3rem;
  }
  .nx-pdf-btn {
    min-width: 44px;
    min-height: 44px;
    padding: .35rem .55rem;
  }
  .nx-pdf-btn-label {
    display: none;
  }
  .nx-pdf-page-input {
    min-height: 44px;
    width: 58px;
  }
  .nx-pdf-source-label {
    display: none;
  }
  .nx-pdf-stage {
    min-height: 56vh;
    max-height: 68vh;
    padding: 8px;
  }
}


/* M31 mobile/landscape compaction for source scan previews inside Finance Review/PV/LPO screens. */
@media (max-width: 991.98px), (max-height: 620px) and (orientation: landscape) {
  .nx-pdf-viewer {
    border-radius: 13px;
    min-height: 0;
  }
  .nx-pdf-toolbar {
    display: block;
    padding: .5rem;
  }
  .nx-pdf-toolbar-group {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(5, minmax(44px, 1fr));
    gap: .38rem;
  }
  .nx-pdf-btn {
    min-width: 0;
    width: 100%;
    min-height: 42px;
    padding: .32rem .35rem;
    border-radius: 12px;
    font-size: .86rem;
  }
  .nx-pdf-btn-label {
    display: none !important;
  }
  .nx-pdf-page-control {
    width: 100%;
    justify-content: center;
    gap: .22rem;
  }
  .nx-pdf-page-input {
    width: 54px;
    min-height: 42px;
    padding-left: .2rem;
    padding-right: .2rem;
  }
  .nx-pdf-page-total {
    font-size: .7rem;
  }
  .nx-pdf-source-label {
    display: none !important;
  }
  .nx-pdf-stage {
    min-height: 48vh;
    max-height: 64vh;
    padding: 7px;
  }
}
@media (max-width: 430px) {
  .nx-pdf-toolbar-group {
    grid-template-columns: repeat(4, minmax(44px, 1fr));
  }
  .nx-pdf-stage {
    min-height: 46vh;
  }
}
