/* Receipt / invoice controls are opaque UI chrome; original PDF/XML sheets stay unchanged. */
@media screen {
html[data-theme=dark] #root .receipt-workspace,
html[data-theme=dark] #root .invoice-pdf-capture,
html[data-theme=dark] #root .invoice-quantity-ledger--compact,
html[data-theme=dark] #root .dossier-invoices :is(.dossier-cfdi-card,.dossier-fiscal-allocation,.dossier-document-list,.dossier-inline-select,.dossier-detected-supplier) {
  --surface:#101827;--surface-soft:#141e30;--surface-strong:#1a273b;
  --surface-alt:#141e30;--surface-muted:#141e30;
  --text:#f5f7fb;--text-soft:#c6d1df;--muted:#b4c1d6;--border:#40516c;--border-strong:#526582;--accent:#c8aff8;--action:#8b6df6;--action-soft:#2b214e;
  color:#f5f7fb;color-scheme:dark;
}
/* The glass dossier defines light surfaces locally, including in dark theme. */
html[data-theme=dark] #root .receipt-workspace :is(.receipt-materials,.receipt-date,.receipt-proof,.receipt-comments,.receipt-search,.receipt-order-select select,.receipt-quantity-control),
html[data-theme=dark] #root .receipt-workspace .receipt-materials>header,
html[data-theme=dark] #root .receipt-workspace .receipt-comments textarea,
html[data-theme=dark] #root .receipt-submit-bar {
  background:#101827!important;color:#f5f7fb!important;border-color:#40516c!important;
}
html[data-theme=dark] #root .receipt-submit-bar {--text:#f5f7fb;--muted:#b4c1d6;--border:#40516c;color-scheme:dark}
html[data-theme=dark] #root .receipt-workspace :is(.receipt-context p,.receipt-material-amount>span,.receipt-quantity-control>span,.receipt-evidence-limits,.receipt-proof>header>span,.receipt-empty),
html[data-theme=dark] #root .receipt-submit-bar small {color:#b4c1d6!important}
html[data-theme=dark] #root .receipt-workspace :is(.receipt-material-identity>strong,.receipt-fill-all,.receipt-quantity-control>button) {color:#c8aff8!important}
html[data-theme=dark] #root .receipt-workspace .receipt-complete-mark {color:#80e1bc!important}
html[data-theme=dark] #root .receipt-workspace .receipt-filter-tabs>button[aria-pressed=true] {background:#35264f!important;color:#dccbfc!important}
html[data-theme=dark] #root .receipt-workspace .receipt-message.is-error {background:#3c2330!important;color:#ffc2d1!important;border-color:#8b4a61!important}
html[data-theme=dark] #root .receipt-workspace .receipt-message.is-success {background:#143c34!important;color:#b2ead7!important;border-color:#3e806c!important}
html[data-theme=dark] #root .dossier-invoices .dossier-dropzone,
html[data-theme=dark] #root .dossier-fiscal-workspace.is-empty .dossier-dropzone {
  background:#241c38!important;color:#dccbfc!important;border-color:#80699f!important;
}
html[data-theme=dark] #root .dossier-invoices .dossier-dropzone--secondary,
html[data-theme=dark] #root .dossier-fiscal-workspace.is-empty .dossier-dropzone--secondary {background:#101827!important;color:#b4c1d6!important;border-color:#40516c!important}
html[data-theme=dark] #root .dossier-invoices .dossier-dropzone:hover {background:#35264f!important;color:#e7ddff!important;border-color:#b89ae9!important}
html[data-theme=dark] #root .dossier-invoices :is(.invoice-pdf-capture,.invoice-quantity-ledger--compact,.dossier-cfdi-card,.dossier-fiscal-allocation,.dossier-document-list) {background:#101827!important;border-color:#40516c!important}
html[data-theme=dark] #root .dossier-invoices :is(.dossier-fiscal-allocation>header,.invoice-quantity-ledger--compact th) {background:#141e30!important;color:#f5f7fb!important}
html[data-theme=dark] #root .dossier-invoices :is(.invoice-pdf-capture input,.invoice-pdf-capture select,.dossier-allocation-fields input,.dossier-inline-select select) {background:#141e30!important;color:#f5f7fb!important;border-color:#40516c!important;color-scheme:dark}
html[data-theme=dark] #root .dossier-invoices :is(.invoice-material>strong,.dossier-document-row span) {color:#c8aff8!important}
html[data-theme=dark] #root .invoice-quantity-ledger--compact .invoice-quantity-difference {background:#42321a;color:#ffd184}
html[data-theme=dark] #root .invoice-pdf-capture [role=alert] {color:#ffc2d1}
/* Native date trigger only; leave calendar dropdown styling and behavior intact. */
html[data-theme=dark] #root .receipt-workspace .receipt-date .portal-date-picker,
html[data-theme=dark] #root .receipt-workspace .receipt-date .portal-date-picker>.portal-date-trigger {
  background:var(--rx-surface-2,#141e30)!important;color:#f5f7fb!important;border-color:#40516c!important;
}
/* Explicit operational rows prevent inherited glass/striped surfaces from leaking in. */
html[data-theme=dark] #root .receipt-workspace :is(.receipt-material,.receipt-proof-list li),
html[data-theme=dark] #root .dossier-invoices :is(.dossier-allocation-order,.dossier-allocation-line,.invoice-pdf-line,.dossier-document-row),
html[data-theme=dark] #root .invoice-quantity-ledger--compact :is(tbody,tr,td) {
  background:#101827!important;color:#f5f7fb!important;border-color:#40516c!important;
}
html[data-theme=dark] #root .dossier-invoices .dossier-allocation-order>header {background:#1c2139!important;color:#f5f7fb!important;border-color:#40516c!important}
html[data-theme=dark] #root .dossier-invoices .dossier-allocation-order>header strong {color:#c8aff8!important}
html[data-theme=dark] #root .dossier-invoices :is(.dossier-inline-select,.dossier-allocation-fields label,.invoice-pdf-capture label) {color:#c6d1df!important}
html[data-theme=dark] #root .dossier-invoices :is(.dossier-allocation-line small,.dossier-stage-hint,.dossier-document-row small,.dossier-cfdi-card dt,.dossier-cfdi-card>header span) {color:#b4c1d6!important}
html[data-theme=dark] #root .receipt-workspace :is(.receipt-filter-tabs>button:not([aria-pressed=true]),.receipt-order-select,.receipt-date label,.receipt-proof h3,.receipt-comments summary) {color:#c6d1df!important}
html[data-theme=dark] #root :is(.receipt-workspace,.dossier-invoices) .portal-calendar-menu {
 --pc-bg:#111b2c;--pc-text:#edf2fa;--pc-muted:#b4c1d6;--pc-soft:#213047;
 background:#111b2c!important;color:#edf2fa!important;border-color:#40516c!important;
}
html[data-theme=dark] #root :is(.receipt-workspace,.dossier-invoices) .portal-calendar-menu :is(.portal-calendar-head,.portal-calendar-footer) {background:transparent!important;color:#edf2fa!important;border-color:#40516c!important}
html[data-theme=dark] #root :is(.receipt-workspace,.dossier-invoices) .portal-calendar-menu button {background:transparent!important;color:#edf2fa!important}
html[data-theme=dark] #root :is(.receipt-workspace,.dossier-invoices) .portal-calendar-menu button:hover {background:#213047!important}
html[data-theme=dark] #root :is(.receipt-workspace,.dossier-invoices) .portal-calendar-menu button.is-selected {background:#7547e8!important;color:#fff!important}
html[data-theme=dark] #root :is(.receipt-workspace,.dossier-invoices) .portal-calendar-menu button.is-outside {color:#b4c1d6!important}
#root .receipt-workspace :is(.receipt-material-amount>span,.receipt-quantity-control>span,.receipt-context p) {font-size:12px!important}
/* Linked invoice navigation and preview toolbar, outside the document page. */
html[data-theme=dark] #root :is(.invoice-inline-list,.invoice-inline-main,.invoice-inline-toolbar,.invoice-inline-detail) {background:#101827!important;color:#f5f7fb!important;border-color:#40516c!important}
html[data-theme=dark] #root .invoice-inline-list nav>button[aria-current] {background:#35264f!important;border-color:#b89ae9!important}
html[data-theme=dark] #root :is(.invoice-inline-list nav span,.invoice-inline-toolbar span,.invoice-inline-facts dt) {color:#b4c1d6!important}
html[data-theme=dark] #root .invoice-inline-toolbar :is(button,a) {color:#f5f7fb!important}
html[data-theme=dark] #root .invoice-inline-toolbar button[aria-pressed=true] {background:#35264f!important;color:#dccbfc!important}
html[data-theme=dark] #root .invoice-inline-table th {background:#141e30!important;color:#f5f7fb!important}
html[data-theme=dark] #root .invoice-inline-status {background:#143c34!important;color:#b2ead7!important}
html[data-theme=dark] #root .invoice-inline-alerts {color:#ffd184!important}
html[data-theme=dark] #root .invoice-inline-alerts summary span {background:#42321a!important;color:#ffd184!important}
#root :is(.invoice-inline-toolbar,.invoice-inline-list>header,.invoice-inline-alerts) :is(button,a,summary) {min-height:44px!important}
#root .invoice-inline-workspace :is(button,a,summary):focus-visible {outline:2px solid var(--focus-ring,#a98ff8)!important;outline-offset:3px!important}
/* Small labels and controls remain usable in either theme. */
#root .dossier-invoices :is(.invoice-quantity-ledger--compact>summary>small,.invoice-quantity-ledger--compact th,.invoice-material>strong,.invoice-quantity-value>small,.invoice-quantity-difference) {font-size:12px!important}
#root .dossier-invoices :is(.button,.dossier-inline-select select,.dossier-allocation-fields input,.invoice-quantity-ledger--compact>summary) {min-height:44px!important}
#root :is(.receipt-workspace,.dossier-invoices) :is(button,a,input,select,textarea,summary,[role=button]):focus-visible,
#root .receipt-submit-bar button:focus-visible {outline:2px solid var(--focus-ring,#a98ff8)!important;outline-offset:3px!important}
}
/* Scope the entire active invoice/receipt dossier, including its shared chrome. */
@media screen {
html[data-theme=dark] #root .dossier-shell:has(:is(#dossier-panel-invoices,#dossier-panel-receipts)) {
 --surface:#101827;--surface-soft:#141e30;--surface-alt:#141e30;--surface-strong:#1a273b;--surface-muted:#141e30;--surface-card:#101827;
 --text:#f5f7fb;--text-soft:#c5d1e4;--muted:#b4c1d6;--border:#40516c;--border-strong:#526681;--action:#bda2ff;--action-soft:#302343;
 background:#0d1421!important;color:#f5f7fb!important;border-color:#40516c!important;color-scheme:dark;
}
html[data-theme=dark] #root .dossier-shell:has(:is(#dossier-panel-invoices,#dossier-panel-receipts)) :is(.dossier-header,.dossier-tabs,.dossier-progress-footer,.dossier-body,.lifecycle-content) {
 background:#101827!important;color:#f5f7fb!important;border-color:#40516c!important;
}
html[data-theme=dark] #root .dossier-shell:has(:is(#dossier-panel-invoices,#dossier-panel-receipts)) :is(.dossier-header-metrics li,.dossier-summary-stats>div,.dossier-header-controls .button--secondary,.dossier-header-controls .button--ghost,.lifecycle-header-buttons .button--secondary,.lifecycle-header-buttons .button--ghost) {
 background:#141e30!important;color:#f5f7fb!important;border-color:#40516c!important;
}
html[data-theme=dark] #root .dossier-shell:has(:is(#dossier-panel-invoices,#dossier-panel-receipts)) .dossier-tabs button {
 background:transparent!important;color:#c5d1e4!important;
}
html[data-theme=dark] #root .dossier-shell:has(:is(#dossier-panel-invoices,#dossier-panel-receipts)) .dossier-tabs button:is(:hover,:focus-visible,.is-active) {
 background:#231d36!important;color:#cdb8ff!important;
}
html[data-theme=dark] #root .dossier-shell:has(:is(#dossier-panel-invoices,#dossier-panel-receipts)) :is(.dossier-header small,.dossier-header p,.dossier-progress-footer>span) {color:#b4c1d6!important}
}
@media screen {
html[data-theme=dark] #root .dossier-shell:has(:is(#dossier-panel-invoices,#dossier-panel-receipts)) .button--primary {
 background:#7543dd!important;color:#fff!important;border-color:#9369e9!important;
}
}
