/* @ekm-tags: style, billing */
/* Billing Document Generator (js/ekm-billing-docs.js): the "Billing documents" block on the chart's Billing page and its
   full-screen panel. Scoped under .pch-root, chart tokens only, so light and dark both inherit the chart's ink and surfaces.
   Warnings and blocks are marked by a left border and words, never by colour alone. Buttons and checkboxes are 44px targets. */
.pch-root .bdg { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--pch-border); }
.pch-root .bdg-title { margin: 0 0 6px; font-size: 13px; font-weight: 700; color: var(--pch-ink); }
.pch-root .bdg-sub { margin: 0 0 10px; font-size: 12px; color: var(--pch-muted); line-height: 1.5; }
.pch-root .bdg-btn { min-height: 44px; padding: 0 16px; border-radius: 12px; font-size: 14px; font-weight: 500; background: var(--pch-card); color: var(--pch-ink); }
.pch-root .bdg-primary { font-weight: 700; border-width: 2px; }
.pch-root .bdg-btn[disabled] { opacity: .55; cursor: not-allowed; }
.pch-root .bdg-link { background: none; border: 0; padding: 0 4px; min-height: 32px; color: var(--pch-ink); font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer; }
/* The panel is a solid sheet in every theme. Redesign 2030 (css/ekm-2030-chart.css) sets --pch-bg to transparent under Pearl /
   Pearl Night (the chart paints its own ombre), so the panel paints the same ombre over the kit's opaque ground instead —
   never see-through (owner 2026-11-10: the open chart showed through the panel). */
.pch-root .bdg-overlay { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .45); display: flex; justify-content: center; align-items: stretch; padding: 16px; box-sizing: border-box; }
.pch-root .bdg-panel { width: min(1180px, 100%); max-height: 100%; overflow: auto; background: var(--pch-bg); color: var(--pch-ink); border: 1px solid var(--pch-border); border-radius: 14px; padding: 18px 22px 22px; box-sizing: border-box; }
.pch-root .bdg-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.pch-root .bdg-head h3 { margin: 0; font-size: 18px; font-weight: 700; }
.pch-root .bdg-steps { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; margin: 10px 0 14px; padding: 0; font-size: 12px; color: var(--pch-muted); }
.pch-root .bdg-steps .is-on { color: var(--pch-ink); font-weight: 700; text-decoration: underline; text-underline-offset: 4px; }
.pch-root .bdg-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.pch-root .bdg-type { min-height: 72px; text-align: left; padding: 12px 14px; border: 1px solid var(--pch-border); border-radius: 12px; background: var(--pch-card); color: var(--pch-ink); cursor: pointer; display: grid; gap: 4px; }
.pch-root .bdg-type.is-off { cursor: not-allowed; opacity: .6; }
.pch-root .bdg-type-t { font-size: 14px; font-weight: 700; }
.pch-root .bdg-type-s { font-size: 12px; color: var(--pch-muted); }
.pch-root .bdg-filters { display: flex; flex-wrap: wrap; gap: 10px 14px; padding: 12px; background: var(--pch-card); border: 1px solid var(--pch-border); border-radius: 12px; }
.pch-root .bdg-f { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--pch-ink); min-width: 150px; }
.pch-root .bdg-f em { font-weight: 400; color: var(--pch-muted); }
.pch-root .bdg-f select, .pch-root .bdg-f input[type="date"], .pch-root .bdg-f input[type="text"] { min-height: 40px; padding: 4px 8px; font: inherit; font-size: 13px; color: var(--pch-ink); background: var(--pch-bg); border: 1px solid var(--pch-border); border-radius: 8px; }
.pch-root .bdg-f.is-off { color: var(--pch-muted); }
.pch-root .bdg-f-why { font-weight: 400; font-size: 11px; max-width: 220px; line-height: 1.4; }
.pch-root .bdg-f-check { display: flex; align-items: center; gap: 6px; align-self: end; min-height: 40px; }
.pch-root .bdg-bar { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin: 12px 0 6px; }
.pch-root .bdg-count { font-size: 12px; color: var(--pch-muted); }
.pch-root .bdg-table-wrap { overflow-x: auto; border: 1px solid var(--pch-border); border-radius: 12px; }
.pch-root .bdg-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.pch-root .bdg-table th { text-align: left; font-size: 11px; font-weight: 700; color: var(--pch-muted); padding: 8px; border-bottom: 1px solid var(--pch-border); background: var(--pch-card); position: sticky; top: 0; }
.pch-root .bdg-table td { padding: 8px; border-bottom: 1px solid var(--pch-border); vertical-align: top; }
.pch-root .bdg-table .n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pch-root .bdg-table input[type="checkbox"] { width: 20px; height: 20px; margin: 2px; }
.pch-root .bdg-table tr.is-void td { color: var(--pch-muted); text-decoration: line-through; }
.pch-root .bdg-sub-row td { font-size: 12px; color: var(--pch-ink-soft); background: var(--pch-card); }
.pch-root .bdg-chip { display: inline-block; margin: 2px 4px 0 0; padding: 1px 7px; font-size: 11px; border: 1px solid var(--pch-border); border-radius: 999px; color: var(--pch-ink-soft); background: var(--pch-bg); }
.pch-root .bdg-chip-ins { font-weight: 600; color: var(--pch-ink); }
.pch-root .bdg-totals { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 12px 0; padding: 10px 12px; background: var(--pch-card); border: 1px solid var(--pch-border); border-radius: 12px; font-size: 13px; position: sticky; bottom: 0; }
.pch-root .bdg-totals b { font-variant-numeric: tabular-nums; }
.pch-root .bdg-inc { flex-basis: 100%; font-size: 12px; color: var(--pch-ink-soft); }
.pch-root .bdg-sections { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--pch-border); border-radius: 12px; font-size: 13px; }
.pch-root .bdg-sections label { display: flex; align-items: center; gap: 6px; min-height: 32px; }
.pch-root .bdg-block, .pch-root .bdg-warn, .pch-root .bdg-err, .pch-root .bdg-ok { margin: 10px 0; padding: 8px 12px; font-size: 13px; background: var(--pch-card); border: 1px solid var(--pch-border); border-left-width: 5px; border-radius: 8px; }
.pch-root .bdg-block, .pch-root .bdg-err { border-left-color: var(--pch-ink); font-weight: 600; }
.pch-root .bdg-warn { border-left-style: dashed; }
.pch-root .bdg-block ul, .pch-root .bdg-warn ul { margin: 4px 0 0 18px; padding: 0; font-weight: 400; }
.pch-root .bdg-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 12px; }
.pch-root .bdg-ins { margin: 0 0 12px; padding: 10px 12px; font-size: 13px; border: 1px solid var(--pch-border); border-left-width: 5px; border-radius: 8px; background: var(--pch-card); }
.pch-root .bdg-ins .bdg-filters { margin-top: 10px; }
.pch-root .bdg-ins-choose { justify-content: flex-start; margin-top: 8px; }
.pch-root .bdg-confirm { display: flex; align-items: flex-start; gap: 8px; margin: 10px 0; padding: 8px 12px; font-size: 13px; font-weight: 600; border: 1px solid var(--pch-border); border-left-width: 5px; border-radius: 8px; }
.pch-root .bdg-confirm input { width: 20px; height: 20px; margin: 0; flex: none; }
.pch-root .bdg-cred { min-height: 40px; width: 100%; min-width: 220px; padding: 4px 8px; font: inherit; font-size: 13px; color: var(--pch-ink); background: var(--pch-bg); border: 1px solid var(--pch-border); border-radius: 8px; box-sizing: border-box; }
.pch-root .bdg-frame { width: 100%; height: 70vh; border: 1px solid var(--pch-border); border-radius: 12px; background: #fff; }
html:is([data-theme="pearl"], [data-theme="pearl_night"]) .pch-root .bdg-panel { background: var(--pch-ombre, none) no-repeat; background-color: var(--k-on-ink); border-color: var(--k-rule, var(--pch-border)); }
html:is([data-theme="pearl"], [data-theme="pearl_night"]) .pch-root .bdg-table th { background-color: var(--k-on-ink); }
html:is([data-theme="pearl"], [data-theme="pearl_night"]) .pch-root :is(.bdg-filters, .bdg-totals, .bdg-type, .bdg-block, .bdg-warn, .bdg-err, .bdg-ok, .bdg-sub-row td, .bdg-btn, .bdg-ins, .bdg-confirm) { background-color: var(--k-well); color: var(--k-ink); }
html:is([data-theme="pearl"], [data-theme="pearl_night"]) .pch-root .bdg-totals { background-color: var(--k-on-ink); box-shadow: inset 0 0 0 999px var(--k-well); }
html:is([data-theme="pearl"], [data-theme="pearl_night"]) .pch-root :is(.bdg-f select, .bdg-f input[type="date"], .bdg-f input[type="text"], .bdg-cred) { background-color: var(--k-on-ink); color: var(--k-ink); }
/* One-click superbill (2026-11-19): the visit-row button, the viewer's links styled as buttons, one tab per clinician */
.pch-root .pch-billing-table td.pch-sb { white-space: nowrap; text-align: right; width: 1%; }
/* the visit's document buttons: short labels stacked in one narrow column, so the table fits its column (owner 2026-11-26) */
.pch-root .pch-sb-acts { display: inline-flex; flex-direction: column; align-items: stretch; gap: 6px; vertical-align: top; }
.pch-root .pch-sb-acts .pch-btn { justify-content: center; text-align: center; padding-left: 10px; padding-right: 10px; }
/* narrower screens: the visits table fits its column instead of cutting off its last column (owner 2026-11-26): headers, the date
   and the status may wrap, cells sit closer, and the visit's tick box sits above its two buttons. Phone width keeps the table's
   own sideways scroll (ten columns cannot fit 390px) */
@media (max-width: 1200px) {
  .pch-root .pch-billing-table th { white-space: normal; vertical-align: bottom; padding-left: 4px; padding-right: 4px; }
  .pch-root .pch-billing-table td { padding-left: 4px; padding-right: 4px; }
  .pch-root .pch-billing-table td.dos, .pch-root .pch-billing-table .status, .pch-root .pch-billing-table .status * { white-space: normal; }
  .pch-root .pch-billing-table td.pch-sb .pch-sb-pick-l { display: flex; justify-content: flex-end; margin: 0 0 6px; }
}
.pch-root .pch-btn.pch-btn--sm { padding: 4px 10px; font-size: 12px; }
.pch-root a.pch-btn.bdg-btn { display: inline-flex; align-items: center; text-decoration: none; }
.pch-root .bdg-chip--ok { border-color: var(--pch-gold); color: var(--pch-ink); }
.pch-root .bdg-cred--tax { width: 9em; text-transform: uppercase; }
.pch-root .pch-sb-pick-l { display: inline-flex; align-items: center; margin-right: 8px; vertical-align: middle; }
.pch-root .pch-sb-auto { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 6px 0 2px; }
.pch-root .pch-sb-auto-l { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.pch-root .pch-sb-auto-note { font-size: 12px; color: var(--pch-muted); }
.pch-root .pch-sb-pick { width: 16px; height: 16px; }
.pch-root .bdg-qs-sent { display: inline-flex; align-items: center; margin: 0; }
.pch-root .bdg-qs-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 10px; }
.pch-root .bdg-qs .bdg-block .bdg-link, .pch-root .bdg-qs .bdg-warn .bdg-link { margin-left: 4px; }
@media (max-width: 640px) { .pch-root .bdg-overlay { padding: 0; } .pch-root .bdg-panel { border-radius: 0; padding: 14px 16px; } .pch-root .bdg-f { min-width: 100%; } }
