/* Invoice review: document on the left, extracted data on the right. */
#status { color: var(--muted); margin: var(--space-1) 0 0; overflow-wrap: anywhere; }
#status:empty { margin: 0; }
#review-title, #review-crumb, #dupes, #warnings { overflow-wrap: anywhere; }
#status.error { color: var(--err); }
#dupes button { margin-left: var(--space-2); }
#doctype { margin-bottom: var(--space-3); }
#doctype.hidden + .meta-group { margin-top: 0; }
.disc { color: var(--muted); font-size: var(--text-xs); white-space: nowrap; }
.disc-cell { display: flex; gap: var(--space-1); align-items: center; }
#dlhint { color: var(--err); margin: 0; }
/* Uploaded document (left) next to the results (right); stacks on narrow screens. */
.workspace { display: grid; grid-template-columns: minmax(380px, 1fr) minmax(0, 1.6fr); gap: var(--space-4); align-items: start; }
.viewer { min-width: 0; position: sticky; top: 16px; padding: var(--space-3); }
.viewer-head { display: flex; gap: var(--space-3); align-items: center; margin-bottom: var(--space-2); font-size: var(--text-sm); color: var(--muted); }
#viewer-name { flex-grow: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#viewer-open { color: var(--accent-text); white-space: nowrap; }
#viewer-body iframe { display: block; width: 100%; height: calc(100vh - 100px); min-height: 480px;
                      border: 0; border-radius: var(--radius-md); background: var(--bg); }
#viewer-body .imgbox { max-height: calc(100vh - 100px); min-height: 200px; overflow: auto; border-radius: var(--radius-md); background: var(--bg); }
#viewer-body img { display: block; max-width: 100%; margin: 0 auto; }
/* pdf.js pages (static/pdfview.mjs) and the highlight of the hovered table line. */
.pdfscroll { height: calc(100vh - 130px); min-height: 480px; overflow: auto; border-radius: var(--radius-md); background: var(--bg); }
.pdfpages { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); padding: var(--space-2); width: max-content; min-width: 100%; }
.pdfpage { position: relative; background: var(--page); box-shadow: var(--shadow-page); }
.pdfpage canvas { display: block; width: 100%; height: 100%; }
.pdfhl { position: absolute; pointer-events: none; border-radius: 3px;
         background: var(--highlight-bg); outline: 2px solid var(--highlight-line); mix-blend-mode: multiply; }
.viewer-tools { display: flex; gap: var(--space-1); align-items: center; }
.viewer-tools button { background: var(--panel); color: var(--text); border: 1px solid var(--border);
                       padding: 0; width: 28px; height: 28px; line-height: 1; font-size: var(--text-lg); }
.viewer-tools button.fit { width: auto; padding: 0 var(--space-2); font-size: var(--text-sm); }
#viewer-zoom { min-width: 40px; text-align: center; }
#viewer-hint { font-size: var(--text-sm); color: var(--muted); margin: 6px 0 0; min-height: calc(var(--leading) * 1em); }
#viewer-hint.miss { color: var(--warn-text); }
#result { min-width: 0; }
#result table { min-width: 640px; }
.meta-group { margin-top: var(--space-3); }
.meta-group:first-child { margin-top: 0; }
.meta-group h3 { font-size: var(--text-sm); font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 var(--space-2); }
.meta input.amount { text-align: right; font-variant-numeric: tabular-nums; }
/* "Line 2" of a warning: a button that looks like a link (it moves the focus, it isn't a route). */
.warn-line { background: none; color: inherit; border-radius: 0; padding: 0; min-height: 0; font-weight: 600; text-decoration: underline; }
#result td.total { color: var(--muted); }
/* The data stays in its column while the document is loading or can't be shown. */
#viewer { grid-column: 1; }
#result { grid-column: 2; }
select.cat, select.unit { padding: 2px var(--space-1); min-height: 28px; font-size: var(--text-sm); }
/* A focused cell isn't left under the sticky action bar. */
#rows :is(input, select) { scroll-margin-bottom: calc(var(--space-6) * 5); }
#rows td:nth-child(2) { min-width: 160px; }
#savehint.error { color: var(--err); }
@media (max-width: 1100px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  #result { order: -1; }
  .viewer { position: static; }
  #viewer-body iframe, .pdfscroll { height: 70vh; }
  #viewer-body .imgbox { max-height: 70vh; }
  #viewer, #result { grid-column: auto; }
}
