/* CAEL 0.5.93 — deliberate dark surfaces and interaction states.
   Loaded after the legacy adapters. Screen-only: light mode and printed
   documents retain their original palette. No layout or business-state rules. */
@media screen {
  html[data-theme=dark] {
    --ui67-canvas:#111923;
    --ui67-paper:#18232f;
    --ui67-ink:#e5edf5;
    --ui67-muted:#a8b8c8;
    --ui67-line:#324657;
    --ui67-line-strong:#496175;
    --ui67-action:#82cbd3;
    --ui67-action-hover:#a8e1e7;
    --ui67-action-soft:#193c46;
    --ui67-navy:#152c39;
    --ui67-focus:#87d3e2;
    --ui67-ok:#a2d7bb;
    --ui67-ok-soft:#1d342e;
    --ui67-warn:#e8c18b;
    --ui67-warn-soft:#352d21;
    --ui67-danger:#f2a0ac;
    --ui67-danger-soft:#38242e;
    --ui67-shadow:0 3px 14px #00000020;
    --ui593-sidebar:#101820;
    --ui593-raised:#1e2c3a;
    --ui593-input:#131e2a;
    --ui593-hover:#293b4d;
    --ui593-hover-border:#577087;
    --ui593-pressed:#223344;
    --ui593-selected:#193c46;
    --ui593-selected-hover:#224b55;
    --ui593-selected-border:#4a818c;
    --ui593-calculated:#24323f;
    --ui593-calculated-hover:#2c4050;
    --ui593-disabled:#202b37;
    --ui593-placeholder:#8fa4b7;
    --ui593-primary:#176b78;
    --ui593-primary-hover:#207b88;
    --ui593-primary-pressed:#115864;
    --ui593-danger-hover:#4a2c36;
    --ui593-success-border:#426c59;
    --ui593-warning-border:#6e5b3c;
    --ui593-danger-border:#7b505c;
    --bg:var(--ui67-canvas);
    --paper:var(--ui67-paper);
    --ink:var(--ui67-ink);
    --muted:var(--ui67-muted);
    --line:var(--ui67-line);
    --teal:var(--ui67-action);
    --teal-soft:var(--ui67-action-soft);
    --amber:var(--ui67-warn);
    --amber-soft:var(--ui67-warn-soft);
    --red:var(--ui67-danger);
    --sidebar:var(--ui593-sidebar);
    --theme592-canvas:var(--ui67-canvas);
    --theme592-paper:var(--ui67-paper);
    --theme592-ink:var(--ui67-ink);
    --theme592-line:var(--ui67-line);
    --f586-ink:var(--ui67-ink);
    --f586-muted:var(--ui67-muted);
    --f586-line:var(--ui67-line);
    --f586-teal:var(--ui67-action);
    --f586-error:var(--ui67-danger);
  }

  /* Neutral foundations. Accent is reserved for actions and selected items. */
  html[data-theme=dark] body,
  html[data-theme=dark][data-interface567] :is(.dept-shell,.ux667-shell) {
    background:var(--ui67-canvas);color:var(--ui67-ink);
  }
  html[data-theme=dark][data-interface567] :is(.dept-sidebar,.ux667-sidebar) {
    background:var(--ui593-sidebar);border-color:var(--ui67-line);
  }
  html[data-theme=dark][data-interface567] .ux667-shell>.topbar,
  html[data-theme=dark] :is(.panel,.nf-table,.fin52-table,.e559-plan,.c561-page,.c563-sidebar,.c563-detail,.c563-empty,.ct592-workspace,.ws591-card,.ws591-kpi,.op592-card,.op592-dialog,.login-form) {
    background:var(--ui67-paper);color:var(--ui67-ink);border-color:var(--ui67-line);
  }
  html[data-theme=dark] :is(dialog,dialog>.modal-header,dialog>.modal-footer,#modal,dialog .modal-body) {
    background:var(--ui67-paper);color:var(--ui67-ink);border-color:var(--ui67-line);
  }
  html[data-theme=dark] dialog::backdrop {background:#050a12bd;}
  html[data-theme=dark] :is(.ux667-brand-fallback,.ux667-breadcrumbs [aria-current=page]) {color:var(--ui67-ink);}
  html[data-theme=dark] :is(.ux667-task,.ux667-department,.module-card,.quick-action,.e559-work-card,.w531-item,.activity) {
    background:var(--ui67-paper);border-color:var(--ui67-line);
  }
  html[data-theme=dark] :is(.c561-metric,.c563-metric,.c563-item-head,.op592-metric,.ct592-filters,.ux667-sidebar-search,.ux667-panel-link) {
    background:var(--ui593-raised);border-color:var(--ui67-line);
  }
  html[data-theme=dark] :is(.e559,.ws591,.ws591-dialog) {
    --e-ink:var(--ui67-ink);--e-muted:var(--ui67-muted);--e-line:var(--ui67-line);
    --e-bg:var(--ui593-raised);--e-teal:var(--ui67-action);
    --ws-ink:var(--ui67-ink);--ws-muted:var(--ui67-muted);--ws-line:var(--ui67-line);
    --ws-teal:var(--ui67-action);--ws-surface:var(--ui593-raised);
  }
  html[data-theme=dark] :is(.op592,.op592-dialog) {
    --op-bg:var(--ui593-raised);--op-paper:var(--ui67-paper);--op-ink:var(--ui67-ink);
    --op-muted:var(--ui67-muted);--op-line:var(--ui67-line);--op-soft:var(--ui593-selected);
    --op-action:var(--ui67-action);--op-ok:var(--ui67-ok);--op-warn:var(--ui67-warn);--op-danger:var(--ui67-danger);
  }
  html[data-theme=dark] :is(.et587,.et587-dialog) {
    --et587-ink:var(--ui67-ink);--et587-muted:var(--ui67-muted);--et587-line:var(--ui67-line);--et587-teal:var(--ui67-action);
  }
  html[data-theme=dark] .fw585 {--fw585-text:var(--ui67-ink);--fw585-muted:var(--ui67-muted);--fw585-line:var(--ui67-line);}
  html[data-theme=dark] .c563-workbench {--track-edge:var(--ui67-line);--track-teal:var(--ui67-action);color:var(--ui67-ink);}

  /* Focus is an independent signal, visible over both hover and selection. */
  html[data-theme=dark] :is(button,a,input,select,textarea,summary,[tabindex]):focus-visible {
    outline:2px solid var(--ui67-focus)!important;outline-offset:3px;
  }
  html[data-theme=dark] :is(.b582-local-dialog,.b582-editor,.b582-cpu-picker) :is(input,select,button):focus-visible:not([aria-invalid=true]) {
    outline-color:var(--ui67-focus)!important;
  }
  html[data-theme=dark] :is(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=hidden]),select,textarea) {
    background:var(--ui593-input);color:var(--ui67-ink);border-color:var(--ui67-line-strong);box-shadow:none;
  }
  html[data-theme=dark][data-interface567] :is(.ct592-composition,.ct592-workspace,.commercial593-workspace,.op592,.op592-dialog) :is(input:not([type=checkbox]):not([type=radio]),select,textarea) {
    background:var(--ui593-input);color:var(--ui67-ink);border-color:var(--ui67-line-strong);
  }
  html[data-theme=dark] :is(input,select,textarea):focus:not(:disabled):not([readonly]):not([aria-invalid=true]),
  html[data-theme=dark] :is(.ct592-composition,#ct592-editor,#commercial593-editor) :is(input,select,textarea):focus:not(:disabled):not([readonly]):not([aria-invalid=true]) {
    border-color:var(--ui67-focus)!important;
  }
  html[data-theme=dark] :is(input[readonly],textarea[readonly],input:disabled,select:disabled,textarea:disabled) {
    background:var(--ui593-calculated)!important;color:#b8c8d7!important;
    -webkit-text-fill-color:#b8c8d7;border-color:var(--ui67-line)!important;box-shadow:none;
  }
  html[data-theme=dark] :is(input,select,textarea)[aria-invalid=true],
  html[data-theme=dark] :is(.b582-local-dialog,.b582-editor,.b582-cpu-picker,#ct592-editor,#commercial593-editor,#modal) :is(input,select,textarea)[aria-invalid=true] {
    background:var(--ui67-danger-soft)!important;border-color:var(--ui67-danger)!important;
    outline-color:var(--ui67-danger)!important;
  }
  html[data-theme=dark] :is(input,textarea)::placeholder {color:var(--ui593-placeholder);opacity:1;}
  html[data-theme=dark] :is(input[type=checkbox],input[type=radio]) {accent-color:#62bac6;}
  html[data-theme=dark] .theme592-control {background:var(--ui67-paper);border-color:var(--ui67-line);color:var(--ui67-muted);}
  html[data-theme=dark] .theme592-control select {background:transparent!important;color:var(--ui67-ink)!important;}
  html[data-theme=dark] .theme592-control:focus-within {outline-color:var(--ui67-focus);}
  html[data-theme=dark] ::selection {background:#366375;color:#fff;}
  html[data-theme=dark] :is(table,section,dialog,aside,div) {scrollbar-color:#526b80 var(--ui67-paper);}

  /* Buttons: surface, hover and pressed each have their own shade. */
  html[data-theme=dark][data-interface567] :is(.btn,.icon-btn,.dept-top-action,.ux667-help) {
    background:var(--ui67-paper);color:var(--ui67-ink);border-color:var(--ui67-line);filter:none;
  }
  html[data-theme=dark] :is(.btn.primary,.e559 .btn.primary,#modal .btn.primary,#cpu527-root .btn.primary,dialog .btn.primary) {
    background:var(--ui593-primary)!important;border-color:#408793!important;color:#fff!important;
  }
  html[data-theme=dark] :is(.btn.danger,.btn.r586-destructive,.ct592-delete) {
    color:var(--ui67-danger)!important;border-color:var(--ui593-danger-border);
  }
  html[data-theme=dark][data-interface567] .btn.danger {background:var(--ui67-danger-soft);}
  html[data-theme=dark] :is(.btn,.icon-btn,button):disabled {
    opacity:1;background:var(--ui593-disabled)!important;color:#8296a8!important;
    border-color:var(--ui67-line)!important;box-shadow:none!important;
  }
  html[data-theme=dark] :is(.btn.primary,.e559 .btn.primary,#modal .btn.primary,#cpu527-root .btn.primary,dialog .btn.primary):disabled {
    background:var(--ui593-disabled)!important;color:#8296a8!important;border-color:var(--ui67-line)!important;
  }

  /* Table colors retain the difference between entered and calculated data. */
  html[data-theme=dark] :is(.b575-table,.ct592-component-grid,.c561-table,.c563-table,.ws591-table,.op592-table) th {
    background:var(--ui593-raised);color:#c1d0de;border-color:var(--ui67-line);
  }
  html[data-theme=dark] :is(.b575-table,.ct592-component-grid,.c561-table,.c563-table,.ws591-table,.op592-table) td {
    border-color:var(--ui67-line);
  }
  html[data-theme=dark] :is(.b575-table .b575-name,.c561-table td,.c563-table td,.ct592-component-grid td) {
    background:var(--ui67-paper);
  }
  html[data-theme=dark] .b575-table tbody:nth-of-type(2n)>tr:first-child>td {background:var(--ui593-raised);}
  html[data-theme=dark] :is(.b575-table .b575-calculated,.c561-calc,.ct592-composition .ct592-calculated,.ct592-composition [data-component-coefficient],.op592-calculated,.ws591-computed,.ws591-calculated,.e559-calculated) {
    background:var(--ui593-calculated)!important;color:#d3e0ec;
  }
  html[data-theme=dark] :is(.c561-positive,.c563-positive) {color:var(--ui67-ok)!important;}
  html[data-theme=dark] :is(.c561-negative,.c563-negative) {color:var(--ui67-danger)!important;}
  html[data-theme=dark] .c561-metric.c561-positive {background:var(--ui67-ok-soft);border-color:var(--ui593-success-border);}
  html[data-theme=dark] .c561-metric.c561-negative {background:var(--ui67-danger-soft);border-color:var(--ui593-danger-border);}

  /* Persistent selection survives pointer movement. */
  html[data-theme=dark][data-interface567] :is(.ux667-sidebar,.dept-sidebar) .nav-item {color:#b9c9d7;}
  html[data-theme=dark][data-interface567] :is(.ux667-sidebar,.dept-sidebar) .dept-toggle {color:#c9d6e2;}
  html[data-theme=dark][data-interface567] :is(.ux667-sidebar,.dept-sidebar) .nav-item.active,
  html[data-theme=dark] .c563-sidebar a.selected {
    background:var(--ui593-selected);color:#a8e1e7;border-color:var(--ui593-selected-border);
    box-shadow:inset 3px 0 var(--ui67-action);
  }
  html[data-theme=dark][data-interface567] :is(.e559-area,.e559-subtab,.e559-family,.nf-tabs button,.tab).selected,
  html[data-theme=dark][data-interface567] :is(.tab,.dept-top-action).active,
  html[data-theme=dark][data-interface567] :is(.w531-tabs,.h54-tabs) [aria-selected=true],
  html[data-theme=dark] :is(.ws591-status-tabs,.ws591-segmented,.ux667-list-mode) button[aria-pressed=true],
  html[data-theme=dark] :is(.nf-pick-item,.b57-choice).selected {
    background:var(--ui593-selected);color:#a8e1e7;border-color:var(--ui593-selected-border);box-shadow:none;
  }

  @media (hover:hover) {
    html[data-theme=dark][data-interface567] :is(.btn,.icon-btn,.dept-top-action,.ux667-help):hover:not(:disabled):not([aria-disabled=true]):not(.primary):not(.danger):not(.active):not([aria-pressed=true]) {
      background:var(--ui593-hover);color:var(--ui67-ink);border-color:var(--ui593-hover-border);filter:none;
    }
    html[data-theme=dark] :is(.btn.primary,.e559 .btn.primary,#modal .btn.primary,#cpu527-root .btn.primary,dialog .btn.primary):hover:not(:disabled):not([aria-disabled=true]) {
      background:var(--ui593-primary-hover)!important;border-color:#64a9b4!important;color:#fff!important;
    }
    html[data-theme=dark] :is(.btn.danger,.btn.r586-destructive):hover:not(:disabled) {
      background:var(--ui593-danger-hover)!important;color:#ffc0c9!important;border-color:#ac7484!important;
    }
    html[data-theme=dark][data-interface567] :is(.ux667-sidebar,.dept-sidebar) :is(.nav-item,.dept-toggle):hover,
    html[data-theme=dark] :is(.ux667-department>nav>a,.ux667-related>a,.ux667-sidebar-search,.ux667-panel-link,.w531-item,.activity,.e559-family,.c563-sidebar a):hover,
    html[data-theme=dark] #ux667-finder-results>a:hover {
      background:var(--ui593-hover);color:var(--ui67-ink);border-color:var(--ui593-hover-border);
    }
    html[data-theme=dark] :is(.ux667-task,.module-card,.quick-action,.e559-work-card):hover {
      background:var(--ui593-hover);border-color:var(--ui593-hover-border);
    }
    html[data-theme=dark] :is(.e559-area,.e559-subtab,.nf-tabs button,.tab,[role=tab]):hover,
    html[data-theme=dark] :is(.ws591-status-tabs,.ws591-segmented,.ux667-list-mode) button:hover {
      background:var(--ui593-hover);color:var(--ui67-ink);
    }
    html[data-theme=dark][data-interface567] :is(.ux667-sidebar,.dept-sidebar) .nav-item.active:hover,
    html[data-theme=dark] .c563-sidebar a.selected:hover,
    html[data-theme=dark][data-interface567] :is(.e559-area,.e559-subtab,.e559-family,.nf-tabs button,.tab).selected:hover,
    html[data-theme=dark][data-interface567] :is(.tab,.dept-top-action).active:hover,
    html[data-theme=dark][data-interface567] :is(.w531-tabs,.h54-tabs) [aria-selected=true]:hover,
    html[data-theme=dark] :is(.ws591-status-tabs,.ws591-segmented,.ux667-list-mode) button[aria-pressed=true]:hover {
      background:var(--ui593-selected-hover);color:#b4e9ee;border-color:var(--ui593-selected-border);
    }
    html[data-theme=dark] :is(.b574-candidate,.cpu527-option,.nf-pick-item,.b57-choice,.ct592-input-choice,.ws591-source-choice):hover:not(:has(input:disabled)) {
      background:var(--ui593-hover);border-color:var(--ui593-hover-border);
    }
    html[data-theme=dark] :is(.nf-pick-item,.b57-choice).selected:hover {
      background:var(--ui593-selected-hover);border-color:var(--ui593-selected-border);
    }
    html[data-theme=dark] :is(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=hidden]),select,textarea):hover:not(:disabled):not([readonly]):not([aria-invalid=true]) {
      border-color:#6f879b;
    }
    html[data-theme=dark] :is(.r522-table,.nf-table table,.fin52-table table,.e559-table,.c561-table,.c563-table,.ct592-component-grid,.ws591-table,.op592-table) tbody>tr:hover>td,
    html[data-theme=dark] .b575-table tbody>tr:first-child:hover>td,
    html[data-theme=dark] table.v565-data tbody>tr:hover>td {
      background-color:var(--ui593-hover);
    }
    html[data-theme=dark] :is(.r522-table,.nf-table table) tbody>tr[data-nf-row]:hover>td {
      background-color:var(--ui593-hover)!important;
    }
    html[data-theme=dark] :is(.b575-table,.c561-table,.ws591-table) tbody>tr:hover>:is(.b575-calculated,.c561-calc,.ws591-calculated) {
      background-color:var(--ui593-calculated-hover)!important;
    }
    html[data-theme=dark] :is(.b575-service-link,.ct592-cpu-link,.ct592-text-button,.op592-link,.e559-text-button,.c563-inline):hover:not(.ct592-delete) {
      color:var(--ui67-action-hover);text-decoration-color:var(--ui67-action-hover);
    }
  }

  html[data-theme=dark][data-interface567] :is(.btn,.icon-btn):active:not(:disabled):not(.primary):not(.danger) {
    background:var(--ui593-pressed);border-color:var(--ui593-hover-border);
  }
  html[data-theme=dark] :is(.btn.primary,.e559 .btn.primary,#modal .btn.primary,#cpu527-root .btn.primary,dialog .btn.primary):active:not(:disabled) {
    background:var(--ui593-primary-pressed)!important;
  }
}
