.preview-scroll {
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding-right: 0.25rem;
  overscroll-behavior: contain;
}

.pdf-pages { display: grid; gap: 1rem; }

.pdf-page {
  position: relative;
  margin: 0;
  padding: 1.75rem 0.55rem 0.55rem;
  border: 1px solid #d5e0e5;
  border-radius: 0.62rem;
  background: #eef3f5;
  box-shadow: 0 0.5rem 1rem rgba(22, 37, 52, 0.06);
}

.pdf-page figcaption {
  position: absolute;
  top: 0.55rem;
  left: 0.65rem;
  color: #5d7381;
  font-size: 0.68rem;
  font-weight: 760;
}

.pdf-page:not(.is-ready):not(.has-error) figcaption::after { content: " · wird vorbereitet"; color: #7b909c; font-weight: 600; }

.pdf-page-image {
  display: block;
  width: 100%;
  min-height: 12rem;
  border-radius: 0.2rem;
  background: #d9e1e5;
  object-fit: contain;
}

.pdf-page-error { display: none; margin: 0.5rem 0 0; color: var(--red); font-size: 0.78rem; }
.pdf-page.has-error .pdf-page-error { display: block; }

.xml-view pre {
  min-height: 0;
  flex: 1;
  white-space: pre;
}

.invoice-data { display: grid; align-content: start; gap: 0.75rem; }
.source-notice { display: grid; grid-template-columns: 2rem minmax(0, 1fr); gap: 0.7rem; padding: 0.9rem; border: 1px solid #f1d29a; border-radius: 0.7rem; background: var(--orange-bg); }
.source-notice > span { display: grid; width: 1.65rem; height: 1.65rem; place-items: center; border-radius: 50%; color: var(--orange); background: #ffecbf; font-size: 0.85rem; font-weight: 850; }
.source-notice h3 { margin: 0 0 0.2rem; color: #70400c; font-size: 0.88rem; }
.source-notice p { margin: 0; color: #76572e; font-size: 0.8rem; line-height: 1.45; }
.data-block { overflow: hidden; border: 1px solid #dbe5e9; border-radius: 0.68rem; background: #fff; }
.data-block h3 { margin: 0; padding: 0.72rem 0.8rem; border-bottom: 1px solid #e3ebee; color: #405866; background: #f7fafb; font-size: 0.84rem; }
.data-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.data-value { min-width: 0; padding: 0.7rem 0.8rem; border-right: 1px solid #e8eef0; border-bottom: 1px solid #e8eef0; }
.data-value:nth-child(2n) { border-right: 0; }
.data-value:nth-last-child(-n + 2) { border-bottom: 0; }
.data-value span, .data-value b { display: block; }
.data-value span { margin-bottom: 0.2rem; color: var(--muted); font-size: 0.67rem; }
.data-value b { overflow-wrap: anywhere; color: #2b4756; font-size: 0.8rem; line-height: 1.4; }
.data-lines .line-table-wrap { border: 0; }
.technical-details { border: 1px solid #cfdee4; border-radius: 0.68rem; background: #f7fafb; }
.technical-details summary { padding: 0.78rem 0.8rem; color: #405866; cursor: pointer; font-size: 0.8rem; font-weight: 750; }
.technical-details > p { margin: 0 0.75rem 0.75rem; color: var(--muted); font-size: 0.74rem; line-height: 1.45; }
.technical-details .xml-view { height: 22rem; margin: 0 0.75rem 0.75rem; }

.preview-dialog {
  width: min(94rem, calc(100vw - 2rem));
  height: calc(100dvh - 2rem);
  max-height: calc(100dvh - 2rem);
  padding: 0;
  border: 0;
  border-radius: 1rem;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 2rem 6rem rgba(5, 23, 37, 0.35);
}

.preview-dialog::backdrop { background: rgba(10, 31, 43, 0.6); backdrop-filter: blur(3px); }
.expanded-viewer { display: flex; height: 100%; min-height: 0; flex-direction: column; }
.preview-dialog .dialog-heading { flex: 0 0 auto; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.preview-dialog .panel-kicker { margin-bottom: 0.18rem; }
.expanded-content { display: flex; min-height: 0; flex: 1; flex-direction: column; padding: 1.1rem; background: #eef3f5; }
.expanded-content > .preview-scroll, .expanded-content > .xml-view { height: 100%; }
.expanded-content .invoice-paper { max-width: 68rem; margin: 0 auto; }
.expanded-content .pdf-pages { width: min(100%, 58rem); margin: 0 auto; }

@media (max-width: 760px) {
  .preview-dialog { width: calc(100vw - 1rem); height: calc(100dvh - 1rem); max-height: calc(100dvh - 1rem); }
  .expanded-content { padding: 0.7rem; }
  .data-grid { grid-template-columns: 1fr; }
  .data-value, .data-value:nth-child(2n), .data-value:nth-last-child(-n + 2) { border-right: 0; border-bottom: 1px solid #e8eef0; }
  .data-value:last-child { border-bottom: 0; }
}
