/* Automatic OS theme: light styles remain authoritative outside this media query.
   Dark mappings preserve component-specific selectors and existing state styles.
   The PDF preview iframe is deliberately not recolored: exported documents stay white. */
@media (prefers-color-scheme: dark) {
:root { color-scheme:dark; --ui-page-bg:#141920; --ui-text:#edf1f6; --ui-border:#3b4655; --muted:#adbac9; }
html, body {background:#141920;color:#edf1f6;}
input, select, textarea, button {color:#edf1f6;}
input::placeholder, textarea::placeholder {color:#9daaba;opacity:1;}
input:disabled, select:disabled, textarea:disabled, button:disabled {opacity:.65;}
/* Keep the PDF document and bright action buttons visibly distinct. */
.preview {}
.active, .primary, .directory-delete, .danger-button {color:#fff;}
:root{color:#edf1f6; }
header span{color:#f3ad70;}
nav{background:#1d232c; border-bottom:1px solid #3b4655;}
button{border:1px solid #3b4655; background:#1d232c;}
button:hover{background:#2a333f;}
.card{background:#1d232c; border:1px solid #3b4655;}
label{color:#edf1f6;}
input,select,textarea{border:1px solid #3b4655; background:#1d232c;}
.muted{color:#c5cfdb;}
.preview{border:1px solid #3b4655; }
td,th{border-bottom:1px solid #3b4655;}
th{background:#252d38;}
.drop{background:#252d38;}
.delete-icon{color:#f3ad70;}
.delete-icon:hover{background:#252d38; color:#f3ad70;}
.vendor-options{border:1px solid #3b4655; background:#1d232c;}
#orders .pricing-toggle{border-top:1px solid #3b4655;}
.vendor-form .form-section{border-bottom:1px solid #3b4655;}
.price-group{border-bottom:1px solid #3b4655;}
.price-version{border-top:1px solid #3b4655;}
.price-badge{background:#2a333f; color:#8bd6a7;}
.vendor-tile{border-bottom:1px solid #3b4655; background:#1d232c;}
.vendor-tile:hover{background:#252d38;}
.vendor-meta{color:#c5cfdb;}
.profile-block{border-bottom:1px solid #3b4655;}
.chip{border:1px solid #3b4655;}
.chip button{color:#f3ad70;}
.modal-card{background:#1d232c;}
.mapping-table td{border-bottom:1px solid #3b4655;}
.drag-handle{color:#c5cfdb;}
#items tr.dragging{background:#2a333f;}
.product-table tr.dragging{background:#2a333f;}
.save-error{color:#f3ad70;}
.drag-overlay{background:#1d232c;}
.drag-overlay td{background:#252d38;}
#items tr.drag-placeholder{background:#2a333f;}
.match-review-row{border-bottom:1px solid #3b4655;}
.match-manual-search summary{color:#edf1f6;}
#shippingReviewWarning{color:#f3ad70;}
.directory-entry{border-bottom:1px solid #3b4655;}
.directory-entry .vendor-tile:hover{background:#2a333f;}
.directory-edit{  }
.directory-edit:hover{}
.directory-edit{border:1px solid #3b4655 !important; background:#252d38 !important; color:#edf1f6 !important;}
.directory-edit:hover{background:#2a333f !important;}
.brand-home #headerCompany:not(:empty)::after{color:#f3ad70;}
.info-grid>div{border-bottom:1px solid #3b4655;}
.info-grid span{color:#c5cfdb;}
.logo-preview{background:#1d232c; border:1px dashed #3b4655;}
.danger-card{border-color:#735037;}
.settings-grid hr{border-top:1px solid #3b4655;}
.brand-home .brand-divider{color:#f3ad70;}
#settings .danger-card{border:1px solid #3b4655; background:#1d232c;}
.vendor-price-warning{border:1px solid #735037; background:#2a333f; color:#f3ad70;}

#orders .discount-input-wrap span{color:#edf1f6;}
#orders .pricing-hide small{color:#c5cfdb;}
#orders .discount-input-wrap input{background:#1d232c;}
#orders .pricing-show-text strong{color:#edf1f6;}
#orders .pricing-show-text small{color:#c5cfdb;}
#orders .switch-track:before{background:#1d232c;}
#orders .pricing-show input:checked+.switch-track{background:#253348;}
#orders #sections>.order-custom-section{background:#1d232c; border:1px solid #3b4655;}
.product-table .drag-handle{color:#c5cfdb;}
.product-table .drag-handle:hover{color:#edf1f6;}
#vendorContact .profile-block{border-top:1px solid #3b4655;}
.import-busy-panel{background:#1d232c;}
.import-busy-panel p{color:#c5cfdb;}
.import-spinner{border:4px solid #735037;}
.price-review-danger,.vendor-price-warning{background:#252d38; color:#f3ad70;}
.price-review-status{color:#edf1f6;}
.price-outdated-badge{background:#2a333f; color:#f3ad70;}
.document-import-dialog{background:#252d38;}
.document-import-dialog>.grid,.di-section{background:#1d232c; border:1px solid #3b4655;}
.di-summary{background:#2a333f; color:#f3ad70; border:1px solid #735037;}
.di-match{ }
.di-match .candidate-list button{border:1px solid #3b4655; background:#1d232c;}
.di-match .candidate-list button:hover{background:#2a333f; border-color:#735037;}
.di-match-status{background:#2a333f; color:#f3ad70;}
.di-match-status.verified{background:#2a333f; color:#8bd6a7;}
.portal-drop.drag-over,.portal-drop:focus-visible{background:#2a333f;}
.portal-drop-icon{color:#f3ad70;}
.portal-drop button{background:#1d232c; color:#f3ad70;}
.portal-summary{border:1px solid #3b4655; background:#1d232c;}
.di-status{background:#252d38; color:#c5cfdb;}
.di-status.matched{background:#2a333f; color:#8bd6a7;}
.di-status.review{background:#2a333f; color:#f3ad70;}
.di-status.unmatched{background:#252d38; color:#c5cfdb;}
.di-match{border:1px solid #3b4655; background:#1d232c;}
.di-match-head small{color:#c5cfdb;}
.di-match-options{border-top:1px solid #3b4655; background:#1d232c;}
.di-candidate{border:1px solid #3b4655; background:#1d232c;}
.di-candidate span{color:#edf1f6;}
.di-candidate small{color:#c5cfdb;}
.di-status.dismissed{background:#2a333f; color:#edf1f6;}
.document-import-dialog .di-product-row td{background:#1d232c; }
.document-import-dialog .di-product-row td:first-child{border-left:1px solid #3b4655;}
.document-import-dialog .di-product-row td:last-child{border-right:1px solid #3b4655;}
.document-import-dialog .di-match{border:1px solid #3b4655; background:#1d232c;}
.document-import-dialog .di-match-context{color:#c5cfdb;}
.document-import-dialog .di-match-options{background:#252d38;}
.drag-overlay.po-readonly td{background:#252d38;}
.document-import-dialog .di-match-detail .di-match{border:1px solid #3b4655;}
.document-import-dialog .di-match-detail:has(+ .di-product-row) + .di-product-row td{border-bottom:1px solid #3b4655 !important;}
.document-import-dialog .di-match-options{border-bottom:1px solid #3b4655; border-top:1px solid #3b4655;}
.document-import-dialog .di-product-row td{ }
.document-import-dialog .di-match-options{border:1px solid #3b4655;}
.document-import-dialog .di-billing-message{border:1px solid #3b4655; background:#252d38; color:#c5cfdb;}
.document-import-dialog .di-product-row td{border-top:1px solid #3b4655 !important; border-bottom:1px solid #3b4655 !important;}
.di-price-source{}
.di-price-menu{background:#1d232c; border:1px solid #3b4655;}
.di-price-option{background:#1d232c !important;}
.di-price-option:hover{background:#252d38 !important;}
.di-price-source{color:#c5cfdb !important;}
.di-price-source[data-source="pdf"]{color:#8bd6a7 !important;}
.di-price-source[data-source="manual"]{color:#f3ad70 !important;}
.document-import-dialog .di-price-wrap .di-price-source{border:1px solid #3b4655 !important; background:#1d232c !important;}
.order-header-actions .order-sort-label{color:var(--muted,#c5cfdb);}
.update-history-item{border:1px solid #3b4655; }
.update-history-title{}
.update-history-meta{color:#c5cfdb;}
.update-history-modules{color:#edf1f6;}
.update-history-no-rollback{color:#c5cfdb;}
#orders #poActionsWrap #poActionsMenu{border:1px solid #3b4655; }
#orders #poActionsWrap #downloadOriginalAction{}
#orders #poActionsWrap #downloadOriginalAction:hover,
#orders #poActionsWrap #downloadOriginalAction:focus-visible{background:#2a333f;}
#orders #poActionsWrap .po-actions-pricing{color:#edf1f6;}
#orders #poActionsWrap .po-actions-pricing > .switch-track::before{background:#1d232c;}
#orders #poActionsWrap .po-actions-pricing > input#hide_totals:checked + .switch-track{background:#253348;}
#settings .settings-section-header{border-top:1px solid #3b4655;}
/* A handful of interaction states use semantic colors rather than neutrals. */
button:hover:not(.primary):not(.active):not(.directory-delete):not(.danger-button) {background:#352c25;}
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {outline-color:#ff9b48;}
#settings .settings-section-header {border-color:#3b4655;}
.preview {background:#fff;}
.update-history-item {background:#1d232c;border-color:#3b4655;}
:root {background:#141920;}
nav, .card, button, input, select, textarea {color:#edf1f6;}
.update-history-title {color:#edf1f6;}
.update-history-meta, .update-history-modules {color:#adbac9;}
#orders #poActionsWrap #poActionsMenu {background:#1d232c;border-color:#3b4655;}
#orders #poActionsWrap #downloadOriginalAction {color:#edf1f6;}
}
