#admin-review-root { font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; }
  #admin-review-root .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* REQ-292: constrain both panes; table/overflow ancestors cannot break independent scrolling. */
.cv-document-grid {
  height: clamp(240px, calc(100dvh - 180px), 920px);
  min-height: 0;
}
.cv-document-fields {
  min-height: 0;
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
}
.cv-document-fields:focus-visible { outline: 2px solid #2563eb; outline-offset: -2px; }
.cv-source-pdf { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.cv-source-pdf-frame { display: block; width: 100%; flex: 1 1 auto; min-height: 0; height: 100%; }
.cv-source-pdf > a { flex-shrink: 0; }
.cv-source-preview {
  position: static;
  align-self: stretch;
  min-height: 0;
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
}


.cv-source-preview-link {
  display: flex;
  width: 100%;
  justify-content: center;
}

.cv-source-preview-image {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: calc(100vh - 56px);
  object-fit: contain;
}

@media (max-width: 767px) {
  .cv-document-grid { height: auto; }
  .cv-document-fields { height: auto; overflow: visible; }
  .cv-source-pdf { height: auto; }
  .cv-source-pdf-frame { flex: none; height: 75vh; }
  .cv-source-preview {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .cv-source-preview-image {
    max-height: 75vh;
  }
}

/* Only the review view uses the full available detail width. */
#client-detail.review-wide { max-width: none; }
#admin-review-root { min-width: 0; overflow-wrap: anywhere; }
#admin-review-root table { max-width: 100%; }
.detail-view-tabs { flex-wrap: wrap; }

/* REQ-275: the sidebar can leave a narrow workspace even on a wide screen. */
#admin-review-root { container: cv-review / inline-size; }
.cv-document-grid > * { min-width: 0; }
#admin-review-root .doc-chip { max-width: 100%; flex-wrap: wrap; }
#admin-review-root .doc-chip > span:is(.text-xs:not(.mono), .text-sm) {
  flex: 1 1 auto; min-width: 0; white-space: normal; overflow-wrap: anywhere;
}
#admin-review-root .doc-chip > span:not(.text-xs):not(.text-sm),
#admin-review-root .doc-chip > span.mono { flex-shrink: 0; white-space: nowrap; }

@container cv-review (max-width: 900px) {
  .doc-chip > span:is(.text-xs:not(.mono), .text-sm) { flex-basis: 12rem; }
  .cv-document-grid { grid-template-columns: minmax(0, 1fr); height: auto; }
  .cv-source-preview { height: auto; max-height: none; overflow: visible; }
  .cv-document-fields { height: auto; overflow: visible; }
  .cv-source-pdf { height: auto; }
  .cv-source-pdf-frame { flex: none; height: 75vh; }
  .cv-source-preview-image { max-height: 75vh; }
}

@container cv-review (max-width: 600px) {
  /* Keep native rows/cells and their order; scroll each table, not the page.
     Separate row groups use the same fixed-width layout for aligned headers. */
  table { display: block; width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
  table > thead, table > tbody { display: table; width: 100%; min-width: 640px; table-layout: fixed; }
  table::before {
    content: "← 左右滑动查看完整资料 →";
    display: block; position: sticky; left: 0; padding: 6px 12px;
    color: #52647a; background: #f8fafc; font-size: 12px;
  }
  /* Two-column document fields fit when stacked, without nested scrollers. */
  .cv-document-grid table { display: table; table-layout: fixed; overflow: visible; }
  .cv-document-grid table::before { content: none; }
  .cv-document-grid table > tbody { display: table-row-group; min-width: 0; }
  .cv-document-grid table td { width: 50%; }
}
