/* Dark appearance for ExtJS 3 and ACP controls. Light keeps the original palette. */
@media screen {
html[data-acp-theme="dark"] {
    color-scheme: dark;
    --acp-bg: #121a26; --acp-surface: #1c2634; --acp-raised: #263447;
    --acp-hover: #304760; --acp-selected: #254f76; --acp-border: #52647b;
    --acp-text: #e6edf6; --acp-muted: #b2c1d3; --acp-link: #8cc7ff;
    --acp-error: #ffabb2; --acp-success: #99e0b3; --acp-focus: #a5d4ff;
    background: var(--acp-bg); color: var(--acp-text);
}
html[data-acp-theme="dark"] body { background:var(--acp-bg); color:var(--acp-text); }
html[data-acp-theme="dark"] :is(.x-panel-body,.x-tab-panel-body,.x-window-body,.x-layout-collapsed,.x-tree,.x-grid3,.x-grid3-scroller,.x-grid3-viewport,.x-combo-list,.x-combo-list-inner,.x-combo-list-small,.x-combo-list-inner,.x-list-body,.x-editor .x-form-check-wrap,.x-tip-ml,.x-tip-mr,.x-tip-mc,.x-menu,.x-tip,.x-date-picker,.ux-mselect,#img-chooser-view,.x-html-editor-wrap) {
    background-color:var(--acp-surface)!important; color:var(--acp-text)!important; border-color:var(--acp-border)!important;
}
html[data-acp-theme="dark"] :is(.x-panel-header,.x-panel-footer,.x-panel-tl,.x-panel-tr,.x-panel-tc,.x-panel-ml,.x-panel-mr,.x-panel-mc,.x-panel-bl,.x-panel-br,.x-panel-bc,.x-window-tl,.x-window-tr,.x-window-tc,.x-window-ml,.x-window-mr,.x-window-mc,.x-window-bl,.x-window-br,.x-window-bc,.x-window-header,.x-window-footer,.x-toolbar,.x-tab-panel-header,.x-tab-panel-footer,.x-tab-strip-spacer,.x-grid3-header,.x-grid3-hd-row td,.x-grid3-hd-inner,.x-grid3-summary-row,.x-grid-group-hd,.x-tree-headers,.x-tree-hd,.x-date-middle,.x-date-left,.x-date-right,.x-date-bottom,.x-date-mp,.x-date-mp-btns,.x-date-inner th,.x-row-editor-body,.x-row-editor-header,.x-row-editor-footer,.x-row-editor .x-btns,.x-row-editor .x-plain-bwrap,.x-row-editor .x-plain-body,.head,#header,#overlayLabel,.mimicTable thead tr) {
    background-color:var(--acp-raised)!important; background-image:none!important;
    color:var(--acp-text)!important; border-color:var(--acp-border)!important;
}
html[data-acp-theme="dark"] :is(.x-panel-header-text,.x-window-header-text,.x-form-item,.x-form-item-label,.x-fieldset-header,.x-fieldset legend,.x-toolbar label,.x-toolbar .xtb-text,.x-grid-group-title,.x-grid3-hd,.x-grid3-cell-inner,.x-tree-col-text,.x-tree-hd-text,.x-menu-item-text,.x-tip-header-text,.x-tip-body,.ext-mb-text,.x-combo-list-item,.x-combo-list-group,.x-date-inner th,.x-progress-text,.x-form-cb-label,.mimicTable thead td,.mimicTable tbody td) {
    color:var(--acp-text)!important;
}
html[data-acp-theme="dark"] :is(a,.x-tree-node a,.x-tree-node a span,.x-form-attachment a,.x-date-inner a,.x-date-mp a) {color:var(--acp-link);}
html[data-acp-theme="dark"] :is(.x-tree-node,.x-tree-node-el,.x-tree-node .x-tree-node-leaf) {color:var(--acp-text);}
html[data-acp-theme="dark"] :is(.x-tree-node-over,.x-grid3-row-over,.x-combo-list .x-combo-selected,.x-menu-item-active,.x-view-over,.x-date-inner a:hover,.x-date-mp a:hover,.invoice-item:hover) {
    background:var(--acp-hover)!important; border-color:var(--acp-focus)!important; color:var(--acp-text)!important;
}
html[data-acp-theme="dark"] :is(.x-tree-selected,.x-grid3-row-selected,.x-grid3-cell-selected,.x-view-selected,.ux-mselect-selected,.x-date-selected a,.x-date-mp-sel a) {
    background:var(--acp-selected)!important; border-color:var(--acp-focus)!important; color:var(--acp-text)!important;
}
html[data-acp-theme="dark"] :is(.x-tree-node .x-tree-selected a span,.x-menu-item-active a.x-menu-item,.x-menu-item-active .x-menu-item-text) {color:var(--acp-text)!important;}
html[data-acp-theme="dark"] .x-grid3-row {background:var(--acp-surface);border-color:#344359;color:var(--acp-text);}
html[data-acp-theme="dark"] .x-grid3-row-alt {background:#222f40;}
html[data-acp-theme="dark"] :is(.x-grid3-row td,.x-grid3-row-body,.x-grid3-row-body p,.x-grid3-cell-inner a) {color:inherit;}
html[data-acp-theme="dark"] :is(.x-grid3-row-checker,.x-grid3-hd-checker,.x-grid3-row-expander,.x-grid3-row-numberer) {background-color:transparent!important;}
html[data-acp-theme="dark"] :is(.x-grid3-col,.x-grid3-hd,.x-grid3-hd-row td,.x-column-tree .x-tree-hd,.x-form-item-editable,.x-form-item-viewable,fieldset,.x-fieldset,.mimicTable,.mimicTable td,.x-combo-list-group,hr,.invoice-item) {border-color:var(--acp-border)!important;}
html[data-acp-theme="dark"] :is(.x-grid3-cell-inner,.x-grid3-hd-inner) {text-shadow:none;}
html[data-acp-theme="dark"] :is(input.x-form-text,textarea.x-form-field,select,.x-form-select-one,.x-form-field,.x-form-editable,.x-form-editable-value-dirty) {
    background-color:#121c2a!important; background-image:none!important; color:var(--acp-text)!important; border-color:var(--acp-border)!important; caret-color:var(--acp-text);
}
html[data-acp-theme="dark"] :is(input,textarea)::placeholder {color:var(--acp-muted);opacity:1;}
html[data-acp-theme="dark"] :is(.x-form-empty-field,.x-form-editable-value-empty,.x-form-viewable-value-empty,.x-form-editable-value-disabled,.x-item-disabled,.x-item-disabled label,.x-item-disabled .x-form-field,.x-toolbar .x-item-disabled,.x-date-prevday a,.x-date-nextday a,.x-date-disabled a,.x-grid-empty,.x-form-attachment small,.invoice-item .date,.invoice-item .sum,#img-chooser-dlg .details-info b) {color:var(--acp-muted)!important;}
html[data-acp-theme="dark"] .x-date-inner td {border-color:var(--acp-surface);}
html[data-acp-theme="dark"] .x-date-today a {border-color:var(--acp-focus)!important;}
html[data-acp-theme="dark"] .x-date-disabled a {background:#26303d!important;}
html[data-acp-theme="dark"] :is(.x-form-invalid,textarea.x-form-invalid,.x-form-editable-value-invalid) {border-color:var(--acp-error)!important;color:var(--acp-error)!important;}
html[data-acp-theme="dark"] :is(.x-form-invalid-msg,.error,.invoice-item .overdue,.mimicTable .error) {color:var(--acp-error)!important;}
html[data-acp-theme="dark"] :is(.x-form-focus,textarea.x-form-focus,.x-btn-focus) {border-color:var(--acp-focus)!important;outline:2px solid var(--acp-focus);outline-offset:1px;}
html[data-acp-theme="dark"] :is(button,a,input,select,textarea):focus-visible {outline:2px solid var(--acp-focus)!important;outline-offset:2px;}
html[data-acp-theme="dark"] .x-btn {background:var(--acp-raised);border:1px solid var(--acp-border);border-radius:3px;}
html[data-acp-theme="dark"] :is(.x-btn-tl,.x-btn-tr,.x-btn-tc,.x-btn-ml,.x-btn-mr,.x-btn-mc,.x-btn-bl,.x-btn-br,.x-btn-bc) {background:none!important;}
html[data-acp-theme="dark"] .x-btn button {color:var(--acp-text)!important;}
html[data-acp-theme="dark"] :is(.x-btn-over,.x-btn-click,.x-btn-pressed,.x-btn-menu-active) {background:var(--acp-selected)!important;border-color:var(--acp-focus)!important;}
html[data-acp-theme="dark"] .x-btn-disabled {opacity:.65;}
html[data-acp-theme="dark"] :is(.x-menu,.x-menu-list,.x-menu-item,.x-tip-tl,.x-tip-tr,.x-tip-tc,.x-tip-ml,.x-tip-mr,.x-tip-mc,.x-tip-bl,.x-tip-br,.x-tip-bc) {background-image:none!important;}
html[data-acp-theme="dark"] :is(.x-menu-list-item,.x-menu-item,.x-menu a.x-menu-item,.x-menu-text) {color:var(--acp-text)!important;}
html[data-acp-theme="dark"] .x-menu-sep {background:var(--acp-border)!important;border-color:var(--acp-border)!important;}
html[data-acp-theme="dark"] :is(.x-tab-strip,.x-tab-strip .x-tab-right,.x-tab-strip .x-tab-left,.x-tab-strip .x-tab-strip-inner,.x-tab-strip-wrap) {background-image:none!important;}
html[data-acp-theme="dark"] .x-tab-strip li {background:var(--acp-raised);border-radius:4px 4px 0 0;}
html[data-acp-theme="dark"] :is(.x-tab-strip span.x-tab-strip-text,.x-tab-strip-over span.x-tab-strip-text,.x-tab-strip-active span.x-tab-strip-text) {color:var(--acp-text)!important;}
html[data-acp-theme="dark"] .x-tab-strip .x-tab-strip-active {background:var(--acp-selected)!important;box-shadow:inset 0 3px var(--acp-focus);}
html[data-acp-theme="dark"] .x-tab-strip .x-tab-edge {background:transparent;}
html[data-acp-theme="dark"] :is(.x-tool,.x-tree-ec-icon,.x-tab-strip-close,.x-tab-scroller-left,.x-tab-scroller-right,.x-layout-mini,.x-grid3-hd-btn,.x-tbar-page-first,.x-tbar-page-last,.x-tbar-page-next,.x-tbar-page-prev,.x-tbar-loading) {filter:invert(.85) hue-rotate(180deg);}
html[data-acp-theme="dark"] .x-form-field-wrap .x-form-trigger {filter:invert(.85) hue-rotate(180deg);border-color:var(--acp-border);}
html[data-acp-theme="dark"] :is(.x-progress-wrap,.x-progress-inner) {background:var(--acp-bg)!important;border-color:var(--acp-border)!important;}
html[data-acp-theme="dark"] .x-progress-bar {background:var(--acp-selected)!important;border-color:var(--acp-focus)!important;}
html[data-acp-theme="dark"] .ext-el-mask {background:#060b13;opacity:.65;}
html[data-acp-theme="dark"] .ext-el-mask-msg {background:var(--acp-raised);border-color:var(--acp-border);}
html[data-acp-theme="dark"] .ext-el-mask-msg div {background-color:var(--acp-surface);color:var(--acp-text);border-color:var(--acp-border);}
html[data-acp-theme="dark"] :is(.mimicTable,.mimicTable tbody tr,#img-chooser-view .thumb) {background:var(--acp-surface)!important;}
html[data-acp-theme="dark"] #acp-responsive-navigation {background:var(--acp-selected);color:var(--acp-text);border-color:var(--acp-focus);}
html[data-acp-theme="dark"] ::selection {background:#476a96;color:#fff;}
html[data-acp-theme="dark"] * {scrollbar-color:#657994 #182230;}
html[data-acp-theme="dark"] .x-menu-item-arrow {background-image:none!important;position:relative;}
html[data-acp-theme="dark"] .x-menu-item-arrow::after {content:"";position:absolute;right:5px;top:50%;margin-top:-4px;border:4px solid transparent;border-left-color:var(--acp-text);}
html[data-acp-theme="dark"] .x-border-layout-ct {background:var(--acp-bg)!important;}
html[data-acp-theme="dark"] .x-props-grid .x-grid3-body .x-grid3-td-name {background:var(--acp-surface)!important;border-color:var(--acp-border)!important;}
html[data-acp-theme="dark"] :is(.x-combo-list-hd,.x-combo-list-ft,.x-list-header,.x-list-header-inner,.x-panel-ghost,.x-window-proxy) {background:var(--acp-raised)!important;color:var(--acp-text)!important;border-color:var(--acp-border)!important;}
html[data-acp-theme="dark"] .x-list-selected {background:var(--acp-selected)!important;}
/* ACP dashboard tiles, invoice previews and less common ExtJS controls. */
html[data-acp-theme="dark"] .homeBtn h4 {color:var(--acp-text)!important;}
html[data-acp-theme="dark"] .homeBtn span {color:var(--acp-muted)!important;}
html[data-acp-theme="dark"] .homeBtn .acp1 {border-top-color:#99e0b3!important;}
html[data-acp-theme="dark"] .homeBtn .acp2 {border-top-color:#ffabb2!important;}
html[data-acp-theme="dark"] .homeBtn .acp3 {border-top-color:#8cc7ff!important;}
html[data-acp-theme="dark"] .homeBtn .acp4 {border-top-color:#b2c1d3!important;}
html[data-acp-theme="dark"] :is(.iTpl,.x-dd-drag-ghost,.x-box-mc,.x-pivotgrid .x-grid3-row-headers,.x-pivotgrid .x-grid3-row-headers td,.x-pivotgrid .x-grid3-header-offset td) {background:var(--acp-raised)!important;color:var(--acp-text)!important;border-color:var(--acp-border)!important;}
html[data-acp-theme="dark"] :is(.iTpl:hover,.x-view-selected .iTpl) {background:var(--acp-selected)!important;}
html[data-acp-theme="dark"] :is(.x-grid3-td-numberer,.x-grid3-td-checker,.x-grid3-td-expander,.x-btn-group-tl,.x-btn-group-tr,.x-btn-group-tc,.x-btn-group-ml,.x-btn-group-mr,.x-btn-group-bl,.x-btn-group-br,.x-btn-group-bc,.x-box-tl,.x-box-tr,.x-box-tc,.x-box-ml,.x-box-mr,.x-box-bl,.x-box-br,.x-box-bc) {background-image:none!important;background-color:var(--acp-raised)!important;}
html[data-acp-theme="dark"] :is(.x-grid3-cell-inner.x-grid3-col-numberer,.x-btn-group-header,.x-box-mc h3) {color:var(--acp-text)!important;}
html[data-acp-theme="dark"] :is(.x-slider-horz,.x-slider-horz .x-slider-end,.x-slider-horz .x-slider-inner,.x-slider-vert,.x-slider-vert .x-slider-end,.x-slider-vert .x-slider-inner) {background-color:var(--acp-raised);}
html[data-acp-theme="dark"] :is(.x-btn-mc em.x-btn-arrow,.x-btn-mc em.x-btn-arrow-bottom,.x-btn-mc em.x-btn-split,.x-btn-mc em.x-btn-split-bottom) {background-image:none!important;position:relative;}
html[data-acp-theme="dark"] :is(.x-btn-arrow,.x-btn-split)::after {content:"";position:absolute;right:2px;top:50%;border:4px solid transparent;border-top-color:var(--acp-text);pointer-events:none;}
html[data-acp-theme="dark"] :is(.x-btn-arrow-bottom,.x-btn-split-bottom)::after {content:"";position:absolute;left:50%;bottom:0;border:4px solid transparent;border-top-color:var(--acp-text);pointer-events:none;}

}

body.acp-login { background:#DFE8F6; }
