:root, body {
  color-scheme: dark;
  --bg:#1b1d20; --paper:#25282c; --ink:#edf0f3; --text:var(--ink);
  --muted:#abb3bf; --line:#41464d; --nav:#17191c; --nav2:#30343b;
  --mint:#84c9ab; --blue:#a8c8f1; --amber:#e6c382; --red:#ff9ca7;
  --shadow:0 10px 30px #0003;
  background:var(--bg); color:var(--ink);
}
body .sidebar, body .scanner-topbar { background:var(--nav); color:var(--ink); }
body .nav-item:hover, body .nav-item.active { background:var(--nav2); }
body :is(.topbar,.panel,.table-panel,.catalog-panel,.catalog-notice,.catalog-drawer,.catalog-drawer-head,.catalog-form-footer,.tr,.task-toolbar,.task-card,.kanban-card,.quick-row,.quick-modal,.scanner-dialog,.login-card,.view-editor,.view-column-chooser,.calendar,.day,.review-item,.comparison,.matrix-wrap,.modal,.drawer,.system-summary>div,.catalog-wide-row,.custom-view-row) {
  background:var(--paper); color:var(--ink); border-color:var(--line);
}
body :is(.tr.th,.tr:hover,.catalog-wide-row.head,.custom-view-row.head,.catalog-view-switch,.catalog-view-switch .secondary.active,.calendar-grid>b,.matrix-row.head) {
  background:var(--nav2); color:var(--ink); border-color:var(--line);
}
body :is(input:not([type=checkbox]):not([type=radio]),select,textarea,.secondary,.quick-toggle,.quick-filters button) {
  background:var(--nav2); color:var(--ink); border-color:var(--line);
}
body :is(.primary,.login-card button,.quick-filters .active) { background:var(--blue); color:#192536; }
body :is(.primary,.login-card button):hover { background:#c1d7f4; }
body :is(.login-card p,.login-card label,.catalog-head p,.quick-description,.catalog-notice span) { color:var(--muted); }
body .login-card output { color:var(--red); }
body .catalog-shell .status-settings .status-option { grid-template-columns:minmax(0,1fr) auto auto; }
.status-option[hidden] { display:none; }
.matrix-strip { overflow:hidden; color:#84c9ab; background:#17191c; border:1px solid #41464d; border-radius:8px; margin-bottom:10px; padding:7px 10px; }
.matrix-strip span { display:block; width:max-content; font:12px monospace; letter-spacing:.12em; }
@media (prefers-reduced-motion:no-preference) {
  .matrix-strip span { animation:matrix-strip-slide 18s linear 2 alternate; }
}
@keyframes matrix-strip-slide { to { transform:translateX(-45%); } }

/* Shared surfaces, including components inherited from the original light theme. */
body :is(.catalog-stat,.catalog-column-panel,.catalog-wide-wrap,.catalog-row,.view-settings,.view-editor.new,.quick-summary article,.quick-list,.quick-row.child,.quick-row.is-done,.scanner-content,.barcode-card,.barcode-empty,.loading-state,.queue-filters,.assignment-row,.robot-row,.system-catalog article,.systems-only,.system-picker,.system-picker fieldset,.system-group-row,.document-list li,.stage-field-grid section,.workflow-settings article,.assignment-type-grid article,.reference-card,.stage-work,.stage-work li,.creation-entry>button,.robot-guide>button,.linked-task-button,.pnl-workspace,.pnl-data-row,.pnl-robots,.pnl-robot-row,.annual-card,.chart-catalog,.absence-approvals article,.signal,.metric,.column) {
  background:var(--paper); color:var(--ink); border-color:var(--line);
}
body :is(header,thead,th,.catalog-filters,.catalog-row.head,.catalog-column-panel>header,.catalog-field-group h3,.view-settings>h2,.status-row.head,.pnl-grid-head,.pnl-robot-head,.system-group-row.head,.matrix-head>*,.task-head,.view-column-chooser,.pnl-workspace>footer) {
  background:var(--nav2); color:var(--ink); border-color:var(--line);
}
body :is(.catalog-wide-row.head>span,.custom-view-row.head>span,.catalog-row.head,.status-row.head,.pnl-robot-head,.catalog-filters label,.catalog-column-panel header) {
  color:var(--muted); border-color:var(--line);
}
body :is(.catalog-wide-row>span,.custom-view-row>span,.catalog-wide-row,.custom-view-row,.view-editor,.status-option,.catalog-pager,.catalog-field-group) { border-color:var(--line); }
body :is(.catalog-wide-row:not(.head):hover,.catalog-row:not(.head):hover,.custom-view-row:not(.head):hover,.robot-row:hover,.tr:hover:not(.th),.pnl-data-row:hover,.pnl-robot-row:not(.pnl-robot-head):hover,.stage-work li.done,.checklist label.done,.live-checklist li.done label,.task-comments li,.drawer-grid div,.drawer-summary,.description-block dl>div,.description-sections section,.description-sections .completed-data,.support-facts>div,.pnl-row-detail div,.pnl-robot-kpis>div) {
  background:var(--nav2); color:var(--ink); border-color:var(--line);
}
body :is(.quick-filters,.quick-tag,.quick-tag.inherited,.quick-close,.drawer-close,.scanner-close,.catalog-notice em,.segmented,.chip,.tag-cloud span,.reference-status>span,.barcode-notes b,.barcode-scan-status,.barcode-result,.focus-notice,.active-filter,.system-source-note,.next-action,.next-action.done-action) {
  background:var(--nav2); color:var(--ink); border-color:var(--line);
}
body :is(.catalog-pager button,.pager button,.icon-button,.chart-catalog button,.attention-side button,.document-actions button,.full-document-actions button,.system-picker label:hover) { background:var(--nav2); color:var(--ink); border-color:var(--line); }
body :is(.catalog-wide-row>span.is-dev-factor,.custom-view-row>span.is-dev-factor) { background:#393426; color:#e2cea0; }
body :is(.catalog-wide-row.head>span.is-dev-factor,.custom-view-row.head>span.is-dev-factor) { background:#463d2a; color:#ead8aa; }
body :is(.catalog-wide-row>span.is-dev-coefficient,.custom-view-row>span.is-dev-coefficient) { background:#283b49; color:#c1d9ec; }
body :is(.catalog-wide-row.head>span.is-dev-coefficient,.custom-view-row.head>span.is-dev-coefficient) { background:#304656; color:#d3e5f3; }
body .catalog-wide-row .column-7.is-live,body .catalog-status.is-live { background:#293f36; color:#bbdfca; }
body .catalog-wide-row .column-7.is-off,body .catalog-status.is-off { background:#34363c; color:#bcc2cd; }
body .catalog-wide-row .column-7.is-work,body .catalog-status.is-work { background:#2b3b51; color:#c4d9f2; }
body :is(.catalog-code,.catalog-row .catalog-code,.custom-view-row .column-0,.status-row b,.scanner-topbar a) { color:var(--blue); }
body :is(.catalog-drawer-head,.catalog-form-footer) { background:var(--paper); backdrop-filter:none; }
body :is(.quick-inherit,.quick-parent,.scanner-dialog .hint,.barcode-help,.barcode-notes,.task-card p,.card-meta,.check-line) { color:var(--muted); }
body :is(.summary-panel,.pnl-alert,.draft-warning,.attention-side,.description-sections .needs-data,.stage-field-grid section.needs-data,.absence-approvals,.period-current,.finance-month.current) { background:#393326; color:#e1cd9f; border-color:#675b40; }
body :is(.year-total,.effect-block,.matrix-cell.linked,.stage-field-grid section.completed-data) { background:#293c35; color:#bfd9c9; }
body .period-forecast { background:#302d3b; color:#d1c9e4; }
body .donut:before { background:var(--paper); }
body.barcode-standalone { background:var(--bg); }
