/* Screen-only: exported files and label artwork are never recolored. */
.v2-rail-tools{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:-8px 8px 0;flex:none;}
.v2-rail-tools .v2-old-link{margin:0;}
.v2-theme-toggle{display:inline-grid;place-items:center;width:32px;height:32px;min-width:32px;padding:0;border:1px solid var(--line);border-radius:6px;background:var(--surface);color:var(--muted);cursor:pointer;}
.v2-theme-toggle:hover{background:var(--surface-2);color:var(--ink);}
.v2-theme-toggle:focus-visible{outline:2px solid var(--accent);outline-offset:3px;}
.v2-theme-toggle svg{display:block;width:18px;height:18px;}
.v2-theme-toggle .v2-theme-sun{display:none;}
html[data-theme="dark"] .v2-theme-toggle .v2-theme-sun{display:block;}
html[data-theme="dark"] .v2-theme-toggle .v2-theme-moon{display:none;}
@media(max-width:1100px){.v2-rail-tools{margin:0;justify-content:center;}}
@media print{.v2-rail-tools{display:none;}}

@media screen{
  :root[data-theme="light"]{color-scheme:light;}
  :root[data-theme="dark"]{
    color-scheme:dark;
    --bg:#17191c;--surface:#202327;--surface-2:#282c31;--line:#3c424a;
    --ink:#edf0f4;--muted:#b4becb;--faint:#96a2b2;
    --accent:#89adff;--accent-soft:#29384f;--on-accent:#ffffff;
    --good:#83d7ac;--good-soft:#1d382e;--good-line:#3b6a53;
    --info:#9ac3ff;--info-soft:#23374e;
    --v2-warn:#f4ca7b;--v2-warn-soft:#3d3222;--warn:#f4ca7b;
    --bad:#ffa7ab;--bad-soft:#42292d;--bad-line:#80515a;
    --panel:var(--surface);--panel2:var(--surface);--text:var(--ink);
    --chip:var(--surface-2);--btn:var(--surface);--btn2:var(--surface-2);
    --input:var(--surface);--input-focus:var(--accent);
    --input-readonly:var(--surface-2);--input-readonly-border:var(--line);--input-readonly-text:var(--muted);
    --low-stock-error:var(--bad);--low-stock-info:var(--info);--low-stock-changed:var(--v2-warn-soft);
    background:var(--bg);
  }
  html[data-theme="dark"] body{background:var(--bg);color:var(--ink);}
  html[data-theme="dark"] ::selection{background:#4167ac;color:#fff;}
  html[data-theme="dark"] ::placeholder{color:var(--faint);opacity:1;}
  html[data-theme="dark"] .v2-rail{background:#111315;}
  html[data-theme="dark"] :is(.v2-brand-mark,.v2-task.is-now .v2-task-num),
  html[data-theme="dark"] .v2-flow>li::before{background:#3867e8;color:#fff;}
  html[data-theme="dark"] :is(input,select,textarea,option){color:var(--ink);}
  html[data-theme="dark"] :is(.input,select,textarea,option){background-color:var(--surface);border-color:var(--line);}
  html[data-theme="dark"] :is(.input:disabled,.input[readonly],select:disabled){background-color:var(--surface-2);color:var(--muted);}
  html[data-theme="dark"] body.v2 .asset-path-wrap .input[readonly].is-empty{background:var(--surface);color:var(--muted);}
  html[data-theme="dark"] body.v2 :is(.btn,.btn:hover){background:var(--surface-2);border-color:var(--line);color:var(--ink);}
  html[data-theme="dark"] body.v2 :is(.btn.primary,label.btn[for],.btn.v2-pick){background:#3867e8;border-color:#638cfa;color:#fff;}
  html[data-theme="dark"] body.v2 :is(.btn.primary:hover,label.btn[for]:hover,.btn.v2-pick:hover){background:#4574f2;border-color:#89adff;}
  html[data-theme="dark"] body.v2 :is(.btn.danger,.btn.copy-error){background:var(--bad-soft);color:var(--bad);border-color:var(--bad-line);}
  html[data-theme="dark"] body.v2 .btn.good{background:var(--good-soft);color:var(--good);border-color:var(--good-line);}
  html[data-theme="dark"] body.v2 .btn.v2-ghost{background:transparent;color:var(--accent);border-color:transparent;}
  html[data-theme="dark"] :is(th,.cfg-table th,.erp-full-head,.policy-reconcile-preview-head,.sales-controls-summary-table th){background:var(--surface-2);color:var(--muted);}
  html[data-theme="dark"] .pane table thead th,
  html[data-theme="dark"] #matchTable.dynamic-cols thead th,
  html[data-theme="dark"] #view-mapping #matchTable.dynamic-cols thead th{background:var(--surface-2) !important;}
  html[data-theme="dark"] :is(.erp-full-panel,.erp-full-body,.policy-filter-combo,.policy-filter-combo-menu,.policy-filter-combo-tool,.policy-warehouse-diff-scroll,.policy-warehouse-diff-chips,.policy-warehouse-diff-guide,.policy-reconcile-preview,.policy-reconcile-summary,.policy-reconcile-preview-grid,.policy-reconcile-preview-badge,.daily-stock-mismatch-scroll,.label-bulk-preview-scroll,.sales-controls-dialog){background:var(--surface);color:var(--ink);border-color:var(--line);}
  html[data-theme="dark"] :is(.hint,.policy-price-summary-top,.policy-warehouse-diff-chip,.policy-reconcile-summary span,.label-preview-stage,.label-ezpx-canvas){background:var(--surface-2);color:var(--muted);border-color:var(--line);}
  html[data-theme="dark"] :is(.policy-google-master-toolbar,.google-source-panel,.policy-warehouse-diff-panel){background:var(--info-soft);border-color:var(--line);}
  html[data-theme="dark"] :is(.erp-config-accordion>summary,.erp-config-header,.erp-config-accordion[open]>summary){background:var(--surface-2);}
  html[data-theme="dark"] :is(.policy-filter-combo-item,.policy-filter-combo-tool,.policy-filter-combo-toggle){color:var(--ink);}
  html[data-theme="dark"] :is(.policy-filter-combo-item:hover,.policy-filter-combo-item.active,.policy-filter-combo-check:hover,.policy-warehouse-diff-chip.active,.label-file-row-selected td,.erp-row-worked td){background:var(--accent-soft);color:var(--ink);}
  html[data-theme="dark"] :is(.policy-reconcile-preview-head p,.policy-reconcile-block-desc,.label-file-sub,.label-print-mode-hint,.sales-controls-code,.sales-controls-status){color:var(--muted);}
  html[data-theme="dark"] :is(.label-file-main,.label-file-doc-name,.sales-controls-summary-table caption){color:var(--ink);}
  html[data-theme="dark"] :is(.sales-controls-header,.sales-controls-option,.sales-controls-product,.sales-controls-footer,.sales-controls-summary-table td,.sales-controls-summary-table th,.policy-reconcile-preview-head,.policy-reconcile-preview-block,.policy-reconcile-summary,.policy-reconcile-preview-table td,.policy-reconcile-preview-table th,.policy-warehouse-diff-table td,.policy-warehouse-diff-head,.policy-warehouse-diff-guide,.policy-warehouse-diff-chips,.daily-stock-mismatch-table td){border-color:var(--line);}
  html[data-theme="dark"] :is(.policy-warehouse-diff-head,.policy-master-source-status.is-google,.dashboard-source-meta.is-id){color:var(--info);}
  html[data-theme="dark"] :is(.run-notice.info,.policy-price-badge.is-period1){background:var(--info-soft);color:var(--info);border-color:#426489;}
  html[data-theme="dark"] .policy-price-badge.is-period2{background:#352c49;color:#d7b5ff;border-color:#67507d;}
  html[data-theme="dark"] :is(.run-notice.warn,.refchk-pill.is-warn,.policy-reconcile-summary span.is-urgent,.label-bulk-preview-table .status-pill.warn){background:var(--v2-warn-soft);color:var(--v2-warn);border-color:#78603c;}
  html[data-theme="dark"] :is(.daily-stock-mismatch-panel.is-ok,.refchk-pill.is-ok,.policy-price-badge.is-always,.label-bulk-preview-table .status-pill.good){background:var(--good-soft);color:var(--good);border-color:var(--good-line);}
  html[data-theme="dark"] :is(.daily-stock-mismatch-panel,.policy-warehouse-diff-panel.is-error,.policy-price-badge.is-list,.label-bulk-preview-table .status-pill.bad){background:var(--bad-soft);color:var(--bad);border-color:var(--bad-line);}
  html[data-theme="dark"] :is(.daily-stock-mismatch-head,.daily-stock-mismatch-table th,.policy-warehouse-diff-panel.is-error .policy-warehouse-diff-head,.policy-warehouse-diff-table td.is-diff,.policy-reconcile-preview-table .is-diff,.sales-controls-summary-error){color:var(--bad);border-color:var(--bad-line);}
  html[data-theme="dark"] .daily-stock-mismatch-table th{background:var(--bad-soft);}
  html[data-theme="dark"] .daily-stock-mismatch-panel.is-ok :is(.daily-stock-mismatch-head,th){color:var(--good);background:var(--good-soft);border-color:var(--good-line);}
  html[data-theme="dark"] :is(.policy-master-source-status.is-manual,.label-bulk-month-value.missing){color:var(--v2-warn);}
  html[data-theme="dark"] :is(.policy-master-source-status.is-error,.refchk-pill.is-error){color:var(--bad);}
  html[data-theme="dark"] #policySalesIssueBox{background:var(--bad-soft) !important;color:var(--bad) !important;border-color:var(--bad-line) !important;}
  html[data-theme="dark"] #policyRestockCard>div:not(:has(details)),
  html[data-theme="dark"] #policyRestockCard details:first-child>summary{color:var(--v2-warn) !important;}
  html[data-theme="dark"] #policyRestockCard details:last-child>summary{color:var(--bad) !important;}
  html[data-theme="dark"] #transferPanel :is(#transferSummary.is-warn,tr.is-stale td){color:var(--v2-warn);background:var(--v2-warn-soft);}
  html[data-theme="dark"] .fm{--fm-stock:var(--good);--fm-stock-bg:var(--good-soft);--fm-match:var(--info);--fm-match-bg:var(--info-soft);--fm-tpl:#d7b5ff;--fm-tpl-bg:#352c49;--fm-master:var(--v2-warn);--fm-master-bg:var(--v2-warn-soft);}
  html[data-theme="dark"] .sales-controls-dialog::backdrop{background:rgba(0,0,0,.65);}
  html[data-theme="dark"] .label-file-doc-icon{background:var(--surface-2);color:var(--ink);}
  html[data-theme="dark"] .low-stock-error{color:var(--bad) !important;}
  html[data-theme="dark"] .v2-login .btn{background:#3867e8;border-color:#638cfa;color:#fff;}
}
