#source-dialog {
  inset: 20px;
  margin: auto;
  width: min(1100px, calc(100vw - 40px));
  height: calc(100dvh - 40px);
  max-height: none;
  border-radius: 10px;
}
.source-reader .dialog-header {
  padding: 18px 22px;
  align-items: center;
}
.source-reader .dialog-header > div {
  min-width: 0;
}
.source-reader .dialog-header h2 {
  font-size: 17px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.source-reader .dialog-header .eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  letter-spacing: 0.035em;
}
.source-reader .dialog-header .icon-button {
  flex: 0 0 44px;
  margin: 0 -7px 0 0;
}
.source-reader-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-bottom: 1px solid var(--line);
}
.source-view-switch {
  display: flex;
  gap: 2px;
  margin-right: auto;
  padding: 3px;
  background: var(--mint);
  border-radius: 8px;
}
.source-view-switch button {
  border: 0;
  background: transparent;
  padding: 9px 16px;
  font: inherit;
  font-size: 13px;
  border-radius: 6px;
  min-height: 40px;
  color: var(--muted);
  cursor: pointer;
}
.source-view-switch button.active {
  background: #fff;
  color: var(--ink);
  font-weight: 600;
}
.source-reader-actions .source-publisher {
  font-size: 13px;
  min-height: 44px;
  padding: 9px 13px;
}
.source-download {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}
.source-reader [hidden] {
  display: none !important;
}
.source-capture-label {
  padding: 9px 22px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.source-reader-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.source-evidence-scroll {
  overflow: auto;
  padding: 24px;
  flex: 1;
  overscroll-behavior: contain;
}
.source-evidence-scroll h3 {
  font-size: 14px;
  margin: 0 0 12px;
}
.source-evidence-scroll .source-quote {
  font-size: 15px;
  color: var(--ink);
  line-height: 1.7;
}
.retained-source-text summary {
  cursor: pointer;
  padding: 10px 0;
  font-size: 14px;
  font-weight: 600;
}
.retained-source-text .source-full-text {
  padding: 14px 0;
  font-size: 14px;
  color: var(--ink);
}
.native-fragment-text {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.native-evidence-context {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  margin: 12px 0;
}
.native-evidence > .btn {
  margin-bottom: 16px;
}
.source-xml,
.native-fragment-locator {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.native-fragment-locator {
  color: var(--muted);
}
.source-original-empty {
  margin: auto;
  padding: 30px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 450px;
}
.source-original-empty > svg {
  width: 44px;
  height: 44px;
  color: var(--muted);
  margin-bottom: 4px;
}
.source-original-empty h3 {
  font-size: 19px;
  margin: 0 0 6px;
}
.source-original-empty p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}
.source-original-empty .btn {
  min-height: 44px;
}
.saved-page-frame {
  width: 100%;
  flex: 1;
  min-height: 0;
  border: 0;
  background: white;
}
.pdf-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.pdf-pagination {
  display: flex;
  gap: 5px;
  align-items: center;
}
.pdf-pagination button {
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  width: 40px;
  height: 40px;
  cursor: pointer;
}
:where(:root:not([data-input-method="touch"])) .pdf-pagination button:hover {
  background: var(--mint);
}
.pdf-pagination button:disabled {
  opacity: 0.35;
  cursor: default;
}
.pdf-pagination button svg {
  width: 18px;
  height: 18px;
}
.pdf-pagination button:first-child svg {
  transform: rotate(180deg);
}
.pdf-pagination input {
  width: 43px;
  height: 35px;
  text-align: center;
  padding: 4px;
  border: 1px solid var(--field-border);
  border-radius: 6px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  appearance: textfield;
  -moz-appearance: textfield;
}
.pdf-pagination input::-webkit-inner-spin-button {
  appearance: none;
}
.pdf-page-count {
  font-size: 13px;
  color: var(--muted);
  min-width: 27px;
}
.pdf-zoom select {
  height: 37px;
  padding: 6px 25px 6px 10px;
  border: 1px solid var(--field-border);
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: white;
  max-width: 118px;
}
.pdf-scroll {
  flex: 1;
  overflow: auto;
  padding: 12px;
  background: var(--mint);
  overscroll-behavior: contain;
  min-height: 0;
  touch-action: pan-x pan-y pinch-zoom;
}
.pdf-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 70px 20px;
  font-size: 14px;
  color: var(--teal);
}
.pdf-sheet {
  position: relative;
  margin: 0 auto;
  box-shadow: 0 2px 12px #22363824;
  background: white;
}
.pdf-sheet canvas {
  display: block;
}
/* PDF.js text layer: selectable text over the original page rendering. */
.pdf-sheet .textLayer {
  color-scheme: only light;
  position: absolute;
  text-align: initial;
  inset: 0;
  overflow: clip;
  line-height: 1;
  letter-spacing: normal;
  word-spacing: normal;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  forced-color-adjust: none;
  transform-origin: 0 0;
  z-index: 0;
  --min-font-size: 1;
  --text-scale-factor: calc(var(--total-scale-factor) * var(--min-font-size));
  --min-font-size-inv: calc(1 / var(--min-font-size));
}
.textLayer :is(span, br) {
  color: transparent;
  position: absolute;
  white-space: pre;
  cursor: text;
  transform-origin: 0% 0%;
  user-select: text;
  -webkit-user-select: text;
}
.textLayer > :not(.markedContent),
.textLayer .markedContent span:not(.markedContent) {
  z-index: 1;
  --font-height: 0;
  font-size: calc(var(--text-scale-factor) * var(--font-height));
  --scale-x: 1;
  --rotate: 0deg;
  transform: rotate(var(--rotate)) scaleX(var(--scale-x))
    scale(var(--min-font-size-inv));
}
.textLayer .markedContent {
  display: contents;
}
.textLayer ::selection {
  background: #2236384d;
  color: transparent;
}
@media (max-width: 640px) {
  #source-dialog {
    inset: 0;
    width: 100%;
    height: 100dvh;
    border-radius: 0;
    max-width: 100%;
  }
  .source-reader .dialog-header {
    padding: calc(12px + env(safe-area-inset-top)) 15px 12px;
  }
  .source-reader .dialog-header h2 {
    font-size: 15px;
  }
  .source-reader .dialog-header .eyebrow {
    font-size: 10px;
  }
  .source-reader-actions {
    padding: 7px 10px;
    gap: 4px;
  }
  .source-view-switch button {
    padding: 8px 12px;
    min-height: 40px;
    font-size: 13px;
  }
  .source-reader-actions .source-publisher {
    font-size: 12px;
    padding: 8px 9px;
  }
  .source-capture-label {
    padding: 7px 15px;
    font-size: 11px;
  }
  .source-evidence-scroll {
    padding: 18px;
  }
  .source-original-empty {
    padding: 24px 20px;
  }
  .pdf-toolbar {
    padding: 5px 10px;
    gap: 4px;
  }
  .pdf-pagination button {
    height: 44px;
    width: 36px;
  }
  .pdf-pagination input {
    font-size: 16px;
    height: 37px;
  }
  .pdf-zoom select {
    height: 40px;
    font-size: 13px;
  }
  .pdf-scroll {
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
}
