/* Ed 2026-11-14: the modal opens width:'full' (96vw wrapper); the content fills it, so a wide screen never leaves a growing blank column. */
.billing-docs { box-sizing: border-box; display: flex; flex-direction: column; width: 100%; max-width: 100%; min-width: 0; height: min(88vh, 960px); min-height: 0; color: var(--text, #20252b); background: var(--bg2, #fff); }
.billing-docs__header { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border, #d9dde2); }
.billing-docs__header h2 { flex: 1; margin: 0; font-size: 16px; }
.billing-docs__header button, .billing-docs-button { padding: 4px 10px; border: 1px solid var(--border, #c7ccd2); border-radius: 4px; color: inherit; background: var(--bg2, #fff); cursor: pointer; }
.billing-docs__body { flex: 1; display: grid; grid-template-columns: minmax(0, 4fr) minmax(120px, 1fr) minmax(300px, 360px); min-height: 0; }
/* Ed 2026-11-14 07:01Z: the email feature lives on the RIGHT of the modal, always visible (select docs → recipients → + Add contact → Send). */
.billing-docs__side { display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0; overflow-y: auto; padding: 12px; border-left: 1px solid var(--border, #d9dde2); }
.billing-docs__side h3 { margin: 0; font-size: 14px; }
.billing-docs__side .billing-docs__panel { border: 0; padding: 0; }
/* 60 #4108 change 1: the toolbar's .billing-docs__panel rule (flex 1 1 100%, row-wrap, centred) must not apply in the side column — short states
   (held, pending, confirm, failed read) would grow to the full height and float mid-column. Stack them under the heading instead. */
.billing-docs__side .billing-docs__panel { flex: 0 0 auto; flex-direction: column; flex-wrap: nowrap; align-items: stretch; }
.billing-docs__side .billing-docs__msg { flex: 0 0 auto; }
.billing-docs__off { font-size: 13px; color: var(--text2, #3d4652); }
.billing-docs__fielderr { font-size: 13px; color: var(--danger, #b42318); }
.billing-docs__preview { min-width: 0; min-height: 0; height: 100%; overflow: hidden; }
.billing-docs__rail { display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow-y: auto; padding: 12px; border-left: 1px solid var(--border, #d9dde2); }
/* narrow override AFTER the base .billing-docs__preview / __rail rules (Astra P2 B1-STACKED-PREVIEW-MEDIA-OVERRIDDEN-BY-LATER-BASE) */
@media (max-width: 900px) { .billing-docs__body { grid-template-columns: minmax(0, 1fr); grid-auto-rows: max-content; overflow-y: auto; } .billing-docs__preview { height: auto; min-height: 60vh; } .billing-docs__side, .billing-docs__rail { border-left: 0; border-top: 1px solid var(--border, #d9dde2); } }
.billing-docs__tile { flex: 0 0 auto; padding: 7px; border: 1px solid var(--border, #d9dde2); border-radius: 4px; color: inherit; background: var(--bg2, #fff); cursor: pointer; text-align: left; overflow-wrap: anywhere; }
.billing-docs__tile[aria-pressed="true"] { outline: 2px solid var(--accent, #a77b20); outline-offset: 1px; }
.billing-docs__tile img { display: block; width: 100%; height: 125px; object-fit: contain; margin-bottom: 6px; }
/* S1C-PERF 1.1 (60 #3882 nit): a deferred thumbnail has no src yet; show a calm placeholder, no browser border. */
.billing-docs__tile img:not([src]) { background: var(--bg3, #eef0f3); border: 0; }
.billing-docs__tile span { display: block; font-size: 12px; }
.billing-docs-button:focus-visible, .billing-docs__tile:focus-visible, .billing-docs__header button:focus-visible { outline: 2px solid var(--accent, #a77b20); outline-offset: 2px; }
@media (max-width: 900px) { .emr-bill-table td[data-acct-col="docs"]::before { content: "Docs"; } }
/* 3b #3939 (Ed 17:29Z): the list's Docs cell is ONE line at a fixed narrow width — an icon button plus compact state
   icons. Sentences live in title/aria-label and visually hidden text, so a long hold reason never widens the row. */
/* Shots 0ce7beec: New's td padding (8px each side) left 60px for 62px of content → 2px overflow; 84px fits both
   layouts. Fixed width only on the table layout: the ≤900px card layout adds a "Docs" ::before label and must not clip. */
/* Per-document chips (Ed 11-13): 28px button + 4px + 4 chips x 32px + 3 x 2px gaps = 166px + 16px td padding -> 184px. */
@media (min-width: 901px) { td[data-acct-col="docs"], td.run-td-docs { white-space: nowrap; width: 184px; max-width: 184px; overflow: hidden; } }
@media (max-width: 900px) { td[data-acct-col="docs"], td.run-td-docs { white-space: nowrap; } }
td[data-acct-col="docs"] > .billing-docs-button, td.run-td-docs > .billing-docs-button { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 24px; padding: 0; vertical-align: middle; }
.billing-docs-icon { display: block; }
td[data-acct-col="docs"] [data-invoice-packet-readiness], td.run-td-docs [data-invoice-packet-readiness] { display: inline-flex; align-items: center; gap: 2px; margin-left: 4px; vertical-align: middle; white-space: nowrap; }
/* Astra 432bd41b P2s: (1) the compact parent must not keep the panel's grid/gap; (2) a compact icon must not inherit the
   full-panel badge box (.invoice-packet-badge / .invoice-packet-marked: 8px 12px padding + border in invoice-packet.css).
   Two-class selectors outrank those one-class panel rules; full panel badges (no --compact parent) are unchanged. */
.invoice-packet-status.invoice-packet-status--compact { display: inline-flex; align-items: center; gap: 2px; max-width: none; overflow-wrap: normal; white-space: nowrap; }
.invoice-packet-status--compact .invoice-packet-icon { box-sizing: border-box; margin: 0; padding: 0; border: 0; border-radius: 0; min-width: 0; min-height: 0; background: none; box-shadow: none; }
.invoice-packet-status--compact .invoice-packet-icon { display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; font-size: 12px; line-height: 1; cursor: default; }
.invoice-packet-icon.is-ready { color: var(--ink-ok, #15803d); }
.invoice-packet-icon.is-held { color: var(--ink-bad, #b91c1c); }
.invoice-packet-marked { color: var(--ink-gold, #b45309); }
.invoice-packet-unavailable { color: var(--text3, #5b6573); font-weight: 700; }
.invoice-packet-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.invoice-packet-legend { font-weight: 400; font-size: 10px; letter-spacing: 1px; color: var(--text3, #5b6573); }

/* B1 action bar (60 #709 must-fix 3): theme tokens only, so dark and light follow the app theme; 44px targets. */
.billing-docs__actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; padding: 8px 16px; border-bottom: 1px solid var(--border, #d9dde2); background: var(--bg2, #fff); }
.billing-docs__act, .billing-docs__undo, .billing-docs__cancel, .billing-docs__move, .billing-docs__msg button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; min-width: 44px; padding: 0 14px;
  border: 1px solid var(--border, #c7ccd2); border-radius: 6px; color: var(--text, #20252b); background: var(--bg3, #f4f6f8);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.billing-docs__act:hover, .billing-docs__undo:hover, .billing-docs__cancel:hover, .billing-docs__move:hover { border-color: var(--accent, #a77b20); }
.billing-docs__act:disabled, .billing-docs__move:disabled, .billing-docs__undo:disabled { opacity: .5; cursor: not-allowed; }
.billing-docs__act--danger { border-color: var(--status-red, #b91c1c); color: var(--status-red-text, #b91c1c); }
/* Ed 2026-11-17: send actions in our yellow — the same --emr-gold primary pattern as .ds-btn.primary, dark text on solid gold. */
.billing-docs__act--send { background: var(--emr-gold, #F5A800); border-color: var(--emr-gold, #F5A800); color: var(--emr-text-on-gold, #1a1a1a); }
.billing-docs__act--send:hover:not(:disabled) { background: var(--emr-gold-hover, #e89a1a); border-color: var(--emr-gold-hover, #e89a1a); }
/* Ed 2026-11-17: small red × in the contact row's top-right corner; a real button, so keyboard removal works too. */
.billing-docs__mergelist li { position: relative; }
.billing-docs__mergelist .billing-docs__mergeitem { padding-right: 32px; }
.billing-docs__remove { position: absolute; top: 2px; right: 2px; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--danger, #b42318); font: inherit; font-size: 16px; font-weight: 700; line-height: 1; cursor: pointer; }
.billing-docs__remove:hover { background: var(--bg3, #f4f6f8); }
.billing-docs__group { flex: 1 1 100%; margin-top: 6px; font-size: 13px; font-weight: 600; color: var(--text2, #3d4652); }
.billing-docs__notice { font-weight: 600; color: var(--text2, #3d4652); }
.billing-docs__act:focus-visible, .billing-docs__undo:focus-visible, .billing-docs__cancel:focus-visible, .billing-docs__move:focus-visible, .billing-docs__remove:focus-visible,
.billing-docs__msg button:focus-visible, .billing-docs__file:focus-within, .billing-docs__page:focus-within, .billing-docs__mergeitem:focus-within,
.billing-docs__panel select:focus-visible { outline: 2px solid var(--accent, #a77b20); outline-offset: 2px; }
/* The native file input stays in the DOM for keyboard + screen readers, but is drawn behind the button-style label. */
.billing-docs__file { position: relative; overflow: hidden; }
.billing-docs__file input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.billing-docs__file.is-busy { opacity: .6; pointer-events: none; }
.billing-docs__panel { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--border, #d9dde2); border-radius: 6px; background: var(--bg3, #f4f6f8); }
.billing-docs__picker, .billing-docs__merge, .billing-docs__replace { max-height: 40vh; overflow-y: auto; }
.billing-docs__thumb { display: block; width: 72px; height: auto; max-height: 96px; object-fit: contain; border: 1px solid var(--border, #d9dde2); border-radius: 3px; background: var(--bg2, #fff); }
.billing-docs__pages {display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 100%; }
.billing-docs__page, .billing-docs__mergeitem { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; border: 1px solid var(--border, #c7ccd2); border-radius: 6px; background: var(--bg2, #fff); cursor: pointer; }
.billing-docs__page input, .billing-docs__mergeitem input { width: 18px; height: 18px; }
.billing-docs__confirm { flex: 1 1 100%; font-size: 13px; color: var(--text2, #3d4652); }
.billing-docs__filename { flex: 1 1 100%; font-size: 12px; color: var(--text3, #5b6573); overflow-wrap: anywhere; }
.billing-docs__mergelist { flex: 1 1 100%; display: flex; flex-direction: column; gap: 6px; margin: 0; padding-left: 22px; }
.billing-docs__mergelist li { display: flex; align-items: center; gap: 6px; }
.billing-docs__mergeitem { flex: 1; min-width: 0; }
.billing-docs__mergeitem span { overflow-wrap: anywhere; }
.billing-docs__panel select { min-height: 44px; padding: 0 10px; border: 1px solid var(--border, #c7ccd2); border-radius: 6px; color: var(--text, #20252b); background: var(--bg2, #fff); font: inherit; }
.billing-docs__msg { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--text, #20252b); }
@media (max-width: 600px) { .billing-docs__actions { padding: 8px; } .billing-docs__act { flex: 1 1 auto; } }
/* Per-document Docs chips (Ed 11-13 "yes the icons in the docs column"; 60 #4086): short label + status badge INSIDE the
   chip's top-right corner (never clipped by the cell); the cell's one document glyph is the Docs button before the chips.
   Colour AND shape carry the state; colours are the theme tokens (--ink-ok / --ink-bad / --ink-gold), defined in every skin
   and both themes; square corners per the skin rule. Label room = 32 - 2 border - 2x2 padding = 26px. */
.invoice-packet-status--chips { gap: 2px; }
.invoice-packet-status--compact .invoice-packet-chip { position: relative; display: inline-flex; align-items: center; justify-content: flex-start; box-sizing: border-box; width: 32px; height: 18px; padding: 0 2px; border: 1px solid var(--border, #c7ccd2); border-radius: 0; font-size: 9px; font-weight: 600; line-height: 1; color: var(--text2, #3d4652); background: var(--bg2, #fff); cursor: default; }
.invoice-packet-chip-label { overflow: hidden; white-space: nowrap; letter-spacing: -0.2px; }
.invoice-packet-chip-badge { position: absolute; top: 1px; right: 1px; font-size: 7px; font-weight: 700; line-height: 1; }
.invoice-packet-chip.is-on_file .invoice-packet-chip-badge { color: var(--ink-ok, #15803d); }
.invoice-packet-chip.is-missing { border-color: var(--ink-bad, #b91c1c); }
.invoice-packet-chip.is-missing .invoice-packet-chip-badge { color: var(--ink-bad, #b91c1c); }
.invoice-packet-chip.is-marked_no_file { border-style: dashed; border-color: var(--ink-gold, #b45309); }
.invoice-packet-chip.is-marked_no_file .invoice-packet-chip-badge { color: var(--ink-gold, #b45309); }
.invoice-packet-chip.is-unknown { border-style: dotted; }
.invoice-packet-chip.is-unknown .invoice-packet-chip-badge { color: var(--text3, #5b6573); }
.invoice-packet-chip.is-more { justify-content: center; }   /* same 32px as a chip: at most 4 chip-sized elements per row */
/* Email documents (step 2b): labelled text fields in the panel, same 44px targets and theme tokens as the selects. */
.billing-docs__field { flex: 1 1 100%; display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text2, #3d4652); }
.billing-docs__field input, .billing-docs__field textarea { min-height: 44px; padding: 8px 10px; border: 1px solid var(--border, #c7ccd2); border-radius: 6px; color: var(--text, #20252b); background: var(--bg2, #fff); font: inherit; }
.billing-docs__field textarea { min-height: 72px; resize: vertical; }
.billing-docs__field input:focus-visible, .billing-docs__field textarea:focus-visible { outline: 2px solid var(--accent, #a77b20); outline-offset: 2px; }
