/* Document Intelligence surfaces. Document text sits on its own surface token so pages stay
 * readable in both themes without becoming a bright white sheet in dark mode. */
:root {
  --doc-surface: #1b1e22;
  --doc-text: #e9e9e5;
  --doc-line: #33373c;
  --doc-muted: #9aa0a7;
}
:root[data-theme="light"] {
  --doc-surface: #ffffff;
  --doc-text: #172230;
  --doc-line: #d3dae4;
  --doc-muted: #526177;
}
.stage:has(.document-stage) .target {
  display: none;
}
/* =========================================================
   DOCUMENT STAGE CARD
   Stands in for the camera frame when a PDF or Word file is uploaded.
   ========================================================= */
.document-stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
  padding: 24px;
}
.document-stage .document-kind {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--blue);
}
.document-stage .document-name {
  font-size: 18px;
  overflow-wrap: anywhere;
  max-width: 34ch;
}
.document-stage .document-pages {
  font-size: 12px;
  color: var(--muted);
}
.has-result .document-meta {
  margin-bottom: 14px;
}
.document-summary-text {
  font-size: 17px;
  line-height: 1.55;
  color: var(--secondary);
  margin: 0 0 18px;
  max-width: 60ch;
}
.document-field-list {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr);
  gap: 6px 16px;
  margin: 0 0 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.document-field-list div {
  display: contents;
}
.document-field-list dt {
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--muted);
  line-height: 1.6;
}
.document-field-list dd {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  overflow-wrap: anywhere;
}
.document-field-list .uncertain dd {
  color: var(--secondary);
}
.uncertain-mark {
  font-size: 12px;
  color: var(--muted);
}
.document-viewer {
  margin: 0 0 18px;
}
.document-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.document-tab {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--secondary);
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
}
.document-tab[aria-selected="true"] {
  color: var(--text);
  border-color: var(--blue);
  box-shadow: inset 0 -2px 0 var(--blue);
}
.document-tab:focus-visible,
.document-page:focus-visible,
.document-nav button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}
.document-page {
  background: var(--doc-surface);
  color: var(--doc-text);
  border: 1px solid var(--doc-line);
  padding: 16px 18px;
  max-height: 320px;
  overflow: auto;
  font-size: 15px;
  line-height: 1.65;
  scrollbar-width: thin;
  overflow-wrap: anywhere;
}
.document-page p {
  margin: 0 0 12px;
  white-space: pre-wrap;
}
.document-page h4 {
  font-size: 15px;
  margin: 14px 0 6px;
}
.document-page table {
  border-collapse: collapse;
  margin: 0 0 12px;
  font-size: 14px;
}
.document-page td {
  border: 1px solid var(--doc-line);
  padding: 4px 8px;
  vertical-align: top;
}
.document-page[dir="rtl"] {
  text-align: right;
  font-family: "Segoe UI", "Noto Naskh Arabic", Tahoma, Arial, sans-serif;
  font-size: 16px;
}
.document-page[data-script="cjk"] {
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans", "Yu Gothic", "Malgun Gothic", "Noto Sans CJK SC", sans-serif;
  line-height: 1.8;
}
.document-empty {
  color: var(--doc-muted);
}
.document-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.document-where {
  font-size: 12px;
  color: var(--muted);
  flex: 1;
  text-align: center;
}
.document-note {
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  margin: 8px 0 0;
}
.document-note:empty {
  display: none;
}
.document-warnings {
  margin: 0 0 12px;
  padding-left: 18px;
}
@media (max-width: 480px) {
  .document-page {
    max-height: 240px;
    padding: 12px 14px;
    font-size: 14px;
  }
  .document-field-list {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .document-field-list dd {
    margin-bottom: 8px;
  }
  .document-summary-text {
    font-size: 16px;
  }
  .document-tab {
    flex: 1;
  }
}
