/* PVT3 PDF PREPARE & SEND — FULL-SCREEN TABLETOP (2026-08-24, third version).
   Mounted as its OWN backdrop+modal (reuses .p3-record-viewer-backdrop's
   fixed/centered/dim-background rules from record-document-viewer.css, but
   .p3-tt-modal itself is deliberately near-full-viewport, not the plain
   viewer's modest modal size). The WHITE HAND cursor guard (CLAUDE.md 5.21)
   applies here too — nothing below sets cursor:pointer anywhere; buttons get
   the plain arrow, draggable cards get the OS move cursor. */

.p3-tt-modal{width:98vw;height:96vh;background:#f8fafc;border-radius:16px;box-shadow:0 30px 90px rgba(15,23,42,.34);overflow:hidden;display:flex;flex-direction:column;cursor:default}
.p3-tt-head{display:flex;align-items:center;justify-content:space-between;padding:14px 20px;border-bottom:1px solid #dbe3ee;background:#fff;flex:0 0 auto}
.p3-tt-head h2{margin:0;font-size:16px;color:#17233b}
.p3-tt-head button{width:32px;height:32px;border-radius:8px;border:1px solid #dbe3ee;background:#fff;font-size:16px;line-height:1;color:#3e4d67}

.p3-tt-loading{margin:auto;display:flex;flex-direction:column;align-items:center;gap:12px;padding:40px}
.p3-tt-loading span{width:34px;height:34px;border:4px solid #dbe8fb;border-top-color:#3678e8;border-radius:50%;animation:p3ViewerSpin .8s linear infinite}

.p3-tt-body{flex:1;min-height:0;display:grid;grid-template-columns:88px minmax(0,1fr) 220px}

/* ── LEFT — TOOLS ─────────────────────────────────────────────────────── */
.p3-tt-tools{display:flex;flex-direction:column;gap:10px;padding:16px 10px;background:#f1f4f8;border-right:1px solid #dbe3ee;align-items:stretch}
.p3-tt-tool{display:flex;flex-direction:column;align-items:center;gap:6px;padding:12px 4px;border-radius:10px;border:1px solid #dbe3ee;background:#fff;color:#3e4d67;font-size:11px;font-weight:600}
.p3-tt-tool:disabled{opacity:.4}
.p3-tt-tool svg{color:#5f6368}

/* ── CENTER — THE WORK ROW ────────────────────────────────────────────── */
/* PROBLEM 2 FIX (2026-08-24) — flex-wrap, NEVER a horizontal scrollbar.
   --tt-card-w is set by combine-mode.js's applyAutoFit() after every paint,
   shrinking every card just enough to keep the current card count on one
   row; once that would go below the legible floor, additional cards wrap
   onto new rows instead (overflow-y:auto covers that; overflow-x is never
   allowed to trigger). */
.p3-tt-row{padding:24px;overflow-x:hidden;overflow-y:auto;display:flex;flex-wrap:wrap;align-content:flex-start;align-items:flex-start;gap:14px;background:#e8edf3;min-height:0;--tt-card-w:170px}
/* #420 — a file that could not be added is SAID on the table, and stays until dismissed (law 4.27) */
.p3-tt-intake-problem{flex:0 0 auto;display:flex;align-items:flex-start;justify-content:space-between;gap:14px;margin:0;padding:10px 20px;background:#fef2f2;border-bottom:1px solid #fecaca;color:#991b1b;font-size:13px;font-weight:600;line-height:1.45}
.p3-tt-intake-problem button{flex:0 0 auto;border:1px solid #fca5a5;background:#fff;color:#991b1b;border-radius:8px;padding:5px 12px;font-weight:600;cursor:default}
.p3-tt-row-empty{margin:auto;color:#94a3b8;font-size:14px;text-align:center;padding:40px;border:2px dashed #cbd5e1;border-radius:12px}
.p3-tt-row.drag-over-file{box-shadow:inset 0 0 0 3px #2f72e5}
/* #418 — drop anywhere on the modal, not only the row */
.p3-tt-modal.drag-over-file{box-shadow:0 30px 90px rgba(15,23,42,.34),inset 0 0 0 4px #2f72e5}
/* #418 — source tag on every card (from computer · from chart · this document) */
.p3-tt-card-src{width:100%;font-size:9px;color:#94a3b8;text-align:center;text-transform:uppercase;letter-spacing:.04em}
/* #418 — the header's patient chooser (Email Patient finder's pattern) */
.p3-tt-head{position:relative}
.p3-tt-patient{display:flex;align-items:center;gap:8px;margin-left:auto;margin-right:12px;position:relative}
.p3-tt-patient-name{font-size:13px;font-weight:700;color:#17233b}
.p3-tt-head .p3-tt-patient-pick,.p3-tt-head .p3-tt-patient-change{width:auto;height:30px;padding:0 12px;font-size:12px;font-weight:700;color:#2f5fbf;border-color:#c7d7f5;background:#f3f7ff}
.p3-tt-finder{position:absolute;top:36px;right:0;z-index:5;width:min(360px,80vw);background:#fff;border:1px solid #dbe3ee;border-radius:12px;box-shadow:0 14px 40px rgba(15,23,42,.18);padding:10px;display:grid;gap:8px}
.p3-tt-finder input{width:100%;box-sizing:border-box;padding:8px 10px;border:1px solid #cbd5e1;border-radius:8px;font-size:13px}
.p3-tt-finder .pe-finder-hits{display:grid;gap:4px;max-height:240px;overflow:auto}
.p3-tt-finder .pe-finder-hits button{text-align:left;padding:7px 9px;border:1px solid #e2e8f0;border-radius:8px;background:#f8fafc;font-size:13px;width:auto;height:auto}
.p3-tt-finder .pe-finder-hits button small{color:#94a3b8;margin-left:6px}
.p3-tt-finder .ghost{justify-self:end;width:auto;height:28px;padding:0 10px;font-size:12px}

.p3-tt-unit{position:relative;display:flex;gap:6px;flex:0 0 auto;border-radius:10px;cursor:move}   /* #456: a draggable thing shows the OS move cursor (5.21 — never the hand) */
.p3-tt-unit.dragging{opacity:.4}
/* #456 — the drag cue appears on hover; the arrange controls (◀ ▶ ✕) are the visible primary pair, the zoom (− +) a smaller secondary pair */
.p3-tt-drag-cue{position:absolute;left:50%;bottom:-16px;transform:translateX(-50%);opacity:0;pointer-events:none;white-space:nowrap;border-radius:999px;background:rgba(15,23,42,.72);color:#fff;font-size:9.5px;padding:2px 8px;transition:opacity .12s}
.p3-tt-unit:hover .p3-tt-drag-cue{opacity:1}
.p3-tt-arrange{position:absolute;top:4px;right:4px;z-index:2;display:flex;gap:3px}
.p3-tt-arrange-btn{width:22px;height:22px;border-radius:5px;border:1px solid #c7d2e3;background:#fff;font-size:10px;line-height:1;color:#1f2f4a;display:flex;align-items:center;justify-content:center;padding:0;cursor:default}
.p3-tt-arrange-btn:hover{background:#eaf1ff;border-color:#8ab4f8}
.p3-tt-arrange-btn:disabled{opacity:.35}
.p3-tt-arrange-remove{color:#b3261e}.p3-tt-arrange-remove.on{background:#fdecea;border-color:#f0b4b4}
.p3-tt-card .p3-tt-zoom-group{top:auto;bottom:34px;right:4px;opacity:.75}
.p3-tt-card .p3-tt-zoom{width:18px;height:18px;font-size:12px}
/* the four-step arc strip — the tabletop's header and the viewer's header at the sign step */
.p3-tt-steps{display:flex;align-items:center;gap:6px;margin:0 16px;font-size:11.5px;color:#7b8699;white-space:nowrap}
.p3-tt-step{display:inline-flex;align-items:center;gap:5px;padding:3px 9px;border-radius:999px;border:1px solid transparent}
.p3-tt-step b{display:inline-grid;place-items:center;width:17px;height:17px;border-radius:50%;background:#e3e8ef;color:#5c6a80;font-size:10px}
.p3-tt-step.done{color:#188045}.p3-tt-step.done b{background:#dff5eb;color:#188045}
.p3-tt-step.current{color:#1a73e8;border-color:#c3d7fb;background:#eaf1ff;font-weight:700}.p3-tt-step.current b{background:#1a73e8;color:#fff}
.p3-tt-step-arrow{color:#b8c2d3;font-style:normal}
.p3-record-viewer-head .p3-tt-steps{margin:0 10px}
.p3-act-group-label{align-self:center;margin:0 4px 0 10px;font-size:10.5px;font-weight:800;letter-spacing:.05em;text-transform:uppercase;color:#7b8699}
.p3-tt-unit.p3-tt-group{padding:8px;background:#eef4ff;border:1.5px solid #8ab4f8}

.p3-tt-card{position:relative;flex:0 0 auto;width:var(--tt-card-w);display:flex;flex-direction:column;align-items:center;gap:6px;transition:width .12s ease}
/* Manual shrink (Problem 1's "-") is RELATIVE to the current auto-fit size,
   not a fixed pixel value — it always shrinks further than whatever the row
   has already auto-fit to, and helps make room independent of that
   automatic reflow (per the order). */
.p3-tt-card.small{width:calc(var(--tt-card-w) * .55)}
.p3-tt-card-image{display:block;width:100%;aspect-ratio:3/4;border-radius:6px;border:2px solid #dbe3ee;background:#fff;overflow:hidden;box-shadow:0 2px 8px rgba(15,23,42,.1)}
.p3-tt-card.selected .p3-tt-card-image{border-color:#1a73e8;box-shadow:0 0 0 3px rgba(26,115,232,.25)}
.p3-tt-card.excluded{opacity:.4;filter:grayscale(1)}
.p3-tt-card-image img,.p3-tt-card-image canvas{width:100%;height:100%;object-fit:contain}
.p3-tt-card-num{position:absolute;top:4px;left:4px;z-index:1;min-width:20px;height:20px;padding:0 5px;border-radius:999px;background:rgba(15,23,42,.72);color:#fff;font-size:11px;font-weight:700;display:flex;align-items:center;justify-content:center}
.p3-tt-zoom-group{position:absolute;top:4px;right:4px;z-index:1;display:flex;gap:3px}
.p3-tt-zoom{width:20px;height:20px;border-radius:5px;border:1px solid #dbe3ee;background:#fff;font-size:13px;line-height:1;color:#3e4d67;display:flex;align-items:center;justify-content:center;padding:0}
.p3-tt-zoom.on{background:#1a73e8;border-color:#1a73e8;color:#fff}
.p3-tt-card-label{width:100%;font-size:11px;color:#475569;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

/* ── GROW OVERLAY — a floating spot-check preview, deliberately OUTSIDE the
   row's flow so growing a card can never widen the row or reintroduce the
   horizontal scrollbar (Problem 2). Sized ~2.5-3x the row's current
   per-card width by combine-mode.js (a real, legible spot-check size, not a
   marginal increase). */
.p3-tt-grow-backdrop{position:fixed;inset:0;z-index:12800;background:rgba(15,23,42,.55);display:flex;align-items:center;justify-content:center}
.p3-tt-grow-card{position:relative;display:flex;flex-direction:column;align-items:center;gap:10px;background:#fff;border-radius:12px;padding:20px;box-shadow:0 24px 60px rgba(15,23,42,.4)}
.p3-tt-grow-card .p3-tt-card-image{border-width:0;box-shadow:none;aspect-ratio:3/4}
.p3-tt-grow-card .p3-tt-card-label{font-size:13px;color:#1e293b;font-weight:600}
.p3-tt-grow-close{position:absolute;top:-14px;right:-14px;width:32px;height:32px;border-radius:50%;border:1px solid #dbe3ee;background:#fff;font-size:16px;color:#3e4d67;box-shadow:0 4px 10px rgba(15,23,42,.2)}
.p3-tt-grow-loading{display:flex;align-items:center;justify-content:center;height:100%;color:#94a3b8;font-size:12px}

.p3-tt-drop-indicator{display:inline-block;flex:0 0 auto;width:3px;align-self:stretch;background:#1a73e8;border-radius:2px}

/* ── RIGHT — DOCUMENT SHELF ───────────────────────────────────────────── */
.p3-tt-shelf{display:flex;flex-direction:column;gap:10px;padding:16px;background:#f8fafc;border-left:1px solid #dbe3ee;overflow-y:auto;min-height:0}
.p3-tt-shelf-add{display:flex;gap:8px}
.p3-tt-shelf-list{display:flex;flex-direction:column;gap:6px}
.p3-tt-shelf-item{display:flex;align-items:center;gap:7px;padding:8px 9px;border-radius:8px;border:1.5px solid #dbe3ee;background:#fff;font-size:12.5px;color:#1e293b}
.p3-tt-shelf-item.dragging{opacity:.4}
.p3-tt-shelf-item svg{flex:0 0 auto;color:#64748b}
.p3-tt-shelf-item span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* From Chart / From Computer buttons — shared with the shelf's add row */
.p3-combine-add-btn{flex:1;display:flex;align-items:center;justify-content:center;gap:6px;text-align:center;padding:8px;border-radius:8px;border:1px solid #cbd5e1;background:#fff;font-size:12px;font-weight:600;color:#1e293b;position:relative;overflow:hidden}
.p3-combine-add-btn svg{flex:0 0 auto;color:#64748b}
.p3-combine-add-file input{position:absolute;inset:0;opacity:0;width:100%;height:100%}
.p3-combine-add-panel{display:flex;flex-direction:column;gap:8px;padding:10px;border-radius:10px;background:#fff;border:1px solid #e2e8f0}
.p3-combine-add-panel label{display:flex;flex-direction:column;gap:4px;font-size:12px;color:#475569}
.p3-combine-add-panel input[type=text]{padding:7px 9px;border-radius:7px;border:1px solid #cbd5e1;font-size:13px}
.p3-combine-ask-rows{display:flex;flex-direction:column;gap:6px;max-height:220px;overflow-y:auto}
.p3-combine-ask-row{display:flex;align-items:center;gap:8px;font-size:12.5px}
.p3-combine-ask-row small{color:#94a3b8;margin-left:auto}
.p3-combine-empty{color:#94a3b8;font-size:12.5px;padding:14px;text-align:center;border:1.5px dashed #cbd5e1;border-radius:10px}
.p3-combine-error{color:#b42318;font-size:12.5px;padding:8px;background:#fef2f1;border-radius:8px}
.p3-combine-loading{display:flex;align-items:center;gap:8px;color:#64748b;font-size:12.5px}

/* ── BOTTOM CONTROLS ──────────────────────────────────────────────────── */
.p3-tt-bottom{display:flex;align-items:center;gap:10px;padding:14px 20px;border-top:1px solid #dbe3ee;background:#fff;flex:0 0 auto}
.p3-tt-bottom-spacer{flex:1}
.p3-tt-bottom button{padding:9px 16px;border-radius:8px;border:1px solid #cbd5e1;background:#fff;font-weight:700;font-size:13px;color:#1e293b}
.p3-tt-bottom button:disabled{opacity:.45}
.p3-tt-bottom button.danger{border-color:#f2b8b5;color:#b42318;background:#fef2f1}
/* THE one rose button — same exact tint as .p3-act-prepare
   (record-document-viewer.css), Button Color Law, reused not reinvented. */
.p3-tt-preview.primary{background:#fdf1f5;border-color:#f3c9dc;color:#a23a6e}
.p3-tt-bottom-confirm{background:#fff7ed;border-top-color:#fdba74}
.p3-tt-bottom-confirm span{flex:1;font-size:13px;color:#7c2d12;font-weight:600}

/* ── #470 (David, 2026-09-17) ─────────────────────────────────────────────
   PART B — each intake door says in plain words WHERE its document comes
   from, on a second line under its own label. One definition of the words
   (combine-mode.js ADD_BUTTONS_HTML / doorWords), two surfaces. */
.p3-combine-add-btn>span{display:flex;flex-direction:column;align-items:flex-start;line-height:1.15}
.p3-combine-add-btn>span small{font-weight:500;font-size:10.5px;color:#64748b;letter-spacing:.1px}
.p3-combine-add-btn>small{display:block;font-weight:500;font-size:10.5px;color:#64748b;letter-spacing:.1px;margin-top:2px}
.p3-combine-add-btn{justify-content:flex-start;text-align:left;padding:8px 10px}
/* PART A — the chart's documents list themselves; the count says how many
   there are before you read a single row. */
.p3-combine-add-count{font-size:11px;font-weight:700;color:#475569;letter-spacing:.2px}
.p3-combine-more{font-size:11px;color:#94a3b8;margin:0}
.p3-combine-empty strong{color:#475569}
:root[data-theme="dark"] .p3-combine-add-btn>span small,:root[data-theme="dark"] .p3-combine-add-btn>small{color:#94a3b8}
:root[data-theme="dark"] .p3-combine-add-count{color:#cbd5e1}
:root[data-theme="dark"] .p3-combine-empty strong{color:#e2e8f0}
