/* BDTLab Operate workbench: existing Segoe UI, restrained green, semantic surfaces. */
:root {
  color-scheme: light;
  --bg: #f4f6f5;
  --surface: #ffffff;
  --ink: #202c28;
  --muted: #53625b;
  --line: #ccd6d0;
  --green: #176a3e;
  --red: #ac2834;
  --mint: #e6f1e9;
  --amber: #80520a;
  --soft: #edf1ee;
  --canvas: #f7f9f7;
  --dot: #b9c9be;
  --on-accent: #ffffff;
  --focus: #215fb6;
  --radius: 9px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101318;
  --surface: #1b222b;
  --ink: #e8edf5;
  --muted: #a9b5c5;
  --line: #394555;
  --green: #92b8ea;
  --red: #ffacb3;
  --mint: #283548;
  --amber: #f0cb83;
  --soft: #202a36;
  --canvas: #151c26;
  --dot: #3d4d62;
  --on-accent: #101a29;
  --focus: #9bc5ff;
}
body {
  color: var(--ink);
  font-size: 14px;
}
body:before {
  display: none;
}
h1 {
  font-size: 28px;
  letter-spacing: -0.7px;
}
h2 {
  font-size: 18px;
}
p {
  line-height: 1.5;
}
.eyebrow {
  letter-spacing: 1.5px;
}
.quiet,
small {
  font-size: 12px;
}
.page-heading {
  margin-bottom: 20px;
}
.workspace {
  max-width: 1680px;
}
.panel {
  border-radius: var(--radius);
  box-shadow: none;
  background: var(--surface);
  border-color: var(--line);
}
.panel-heading {
  align-items: center;
}
.topbar {
  padding-right: 140px;
  background: var(--surface);
  color: var(--muted);
  border-color: var(--line);
}
.theme-toggle {
  position: fixed;
  right: 14px;
  top: 10px;
  z-index: 50;
  min-height: 44px;
  min-width: 104px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
}
.theme-toggle:hover {
  background: var(--soft);
}
:where(button, input, select, textarea, a, summary):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
button:disabled {
  opacity: 1;
  color: var(--muted) !important;
  background: var(--soft) !important;
  border-color: var(--line) !important;
  cursor: not-allowed;
}
input,
select,
textarea {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
  font: inherit;
}
input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}
label {
  color: var(--muted);
}
button {
  color: var(--ink);
}
.primary,
#batch-run:not(:disabled) {
  background: var(--green);
  color: var(--on-accent);
  font-weight: 650;
}
.secondary,
.date-trigger,
.calendar-picker,
.calendar-day,
.floating-handle button {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}
.text-btn,
.history-row button {
  color: var(--green);
}
.sidebar {
  background: var(--surface);
  border-color: var(--line);
}
.nav {
  color: var(--muted);
  min-height: 44px;
}
.nav.active,
.nav:hover {
  background: var(--mint);
  color: var(--green);
}
.brand img {
  mix-blend-mode: normal;
}
.badge,
.pill,
.small-tag {
  background: var(--mint);
  color: var(--green);
  border-color: var(--line);
}
.error,
.error-banner,
.recipe-invalid,
.negative {
  color: var(--red);
}
.error-banner {
  background: var(--surface);
  border-color: var(--red);
}
.positive,
.recipe-valid {
  color: var(--green);
}
#batch-drop {
  padding: 20px;
  border: 1px dashed var(--green);
  background: var(--canvas);
}
#batch-drop label {
  color: var(--ink);
  font-weight: 600;
}
#batch-drop input {
  margin-top: 12px;
}
#batch-scope,
#batch-status {
  padding: 12px 14px;
  background: var(--soft);
  border-radius: 6px;
  color: var(--ink);
}
.batch-toolbar {
  gap: 12px;
  align-items: end;
}
.batch-toolbar button,
.batch-toolbar a {
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 6px;
}
.batch-toolbar a {
  border: 1px solid var(--line);
  color: var(--green);
}
.batch-toolbar label {
  max-width: 440px;
  flex: 1;
}
.batch-toolbar select {
  max-width: 100%;
}
.batch-table-wrap {
  border: 1px solid var(--line);
  border-radius: 7px;
}
table {
  font-variant-numeric: tabular-nums;
}
th {
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.02em;
}
td {
  color: var(--ink);
  border-color: var(--line);
  font-size: 13px;
  line-height: 1.5;
  vertical-align: top;
}
#batch-results td:nth-child(n + 4):nth-child(-n + 8) {
  text-align: right;
}
#batch-results td:last-child {
  min-width: 260px;
  max-width: 460px;
  overflow-wrap: anywhere;
}
#batch-results td:first-child {
  max-width: 220px;
  overflow-wrap: anywhere;
}
#single-hash {
  overflow-wrap: anywhere;
  font-family: Consolas, monospace;
}
#single-strategy {
  display: grid;
  gap: 8px;
}
#single-strategy p,
#single-strategy h2,
#single-strategy h3 {
  margin: 0;
}
.metrics article {
  background: var(--surface);
}
.chart.empty,
.chart-footer,
.run-notice,
.history-row,
.calendar-day.closed,
.audit,
.workspace-footer {
  background: var(--surface);
  color: var(--muted);
  border-color: var(--line);
}
.chart svg text {
  fill: var(--muted);
}
.chart svg line {
  stroke: var(--line);
}
/* Explicit graph surfaces: no inversion/filtering of canvas or data. */
html body #research-view .graph-mode {
  background: var(--canvas);
}
html body:has(.graph-mode) .topbar {
  background: var(--surface);
}
.graph-mode .maker-toolbar,
.graph-mode .flow-navigation,
.atomic-controls,
.graph-mode .block-shelf,
.graph-mode .recipe-guide,
.graph-mode .flow-node,
.graph-mode .atomic-empty,
.graph-mode .flow-hint {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}
.graph-mode .flow-scroll {
  background-color: var(--canvas);
  background-image: radial-gradient(var(--dot) 1px, transparent 1px);
}
.graph-mode .flow-handle,
.graph-mode .floating-handle,
.graph-mode .flow-routing,
.graph-mode .flow-edit-actions,
.graph-mode .flow-modifier .flow-handle {
  background: var(--soft);
  color: var(--ink);
  border-color: var(--line);
}
.graph-mode .flow-modifier {
  background: var(--surface);
}
.graph-mode .flow-node input,
.graph-mode .flow-node select,
.graph-mode .flow-node textarea {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}
.graph-mode .flow-node button,
.atomic-controls button,
.flow-navigation button,
.tool-tabs button {
  background: var(--soft);
  color: var(--ink);
  border: 1px solid var(--line);
}
.tool-tabs button[aria-selected="true"] {
  background: var(--green);
  color: var(--on-accent);
}
.graph-mode .shelf-block[class],
.graph-mode .shelf-block[data-reference],
.graph-mode .shelf-block[data-function],
.graph-mode .shelf-block[data-logic],
.graph-mode .shelf-block[data-flow-add] {
  background: var(--soft);
  color: var(--ink);
  border-color: var(--line);
}
.graph-mode .shelf-block span,
.graph-mode .flow-node small,
.graph-mode .flow-sentence,
.graph-mode .shelf-help {
  color: var(--muted);
}
.graph-mode .flow-mobile-editor[open],
.graph-mode .flow-mobile-editor .flow-node.is-editing,
.graph-mode .flow-mobile-editor .mobile-editor-actions {
  background: var(--surface);
  color: var(--ink);
}
.graph-mode [data-edit-error] {
  color: var(--red);
}
.graph-mode .flow-sentence .flow-summary,
.graph-mode .flow-summary {
  color: var(--ink);
}
.graph-mode .flow-edge-label {
  fill: var(--ink);
}
.graph-mode .flow-edge-label-bg {
  fill: var(--surface);
}
@media (max-width: 900px) {
  .theme-toggle {
    top: 5px;
    right: 6px;
    min-width: 94px;
    padding: 6px 10px;
  }
  .topbar {
    padding-right: 110px;
  }
  .topbar #clock {
    display: none;
  }
  body:has(.graph-mode) .sidebar nav {
    padding-right: 108px;
  }
  body:has(.graph-mode) .sidebar {
    background: var(--surface) !important;
  }
  body:has(.graph-mode) .sidebar nav:after {
    content: "";
    min-width: 108px;
  }
  .workspace {
    padding: 18px 12px;
  }
  .batch-toolbar > * {
    max-width: 100%;
    flex-basis: 100%;
  }
  .batch-toolbar label {
    min-width: 0;
  }
  .batch-toolbar select {
    width: 100%;
  }
  h1 {
    font-size: 24px;
  }
  button,
  input,
  select,
  summary {
    min-height: 44px;
  }
  .two-col {
    gap: 12px;
  }
}
/* Contrast regression fixes for legacy fixed-color rules. */
:root[data-theme] .nav-label,
:root[data-theme] .nav span,
:root[data-theme] .divider,
:root[data-theme] .section-no {
  color: var(--muted);
}
:root[data-theme]
  body:has(#research-view:not([hidden]) .graph-mode:not(.research-details))
  .topbar {
  background: var(--surface);
  color: var(--muted);
}
:root[data-theme] .graph-mode .flow-node {
  --node-tint: var(--soft);
  --node-accent: var(--green);
}
:root[data-theme] .graph-mode .flow-node h4 {
  background: var(--soft);
  color: var(--ink);
  border-color: var(--line);
}
:root[data-theme] .graph-mode .flow-modifier [data-port="attach"] {
  color: var(--focus);
}
:root[data-theme] .tool-description,
:root[data-theme] .graph-mode .flow-node .flow-ports span {
  color: var(--muted);
}
:root[data-theme] .rule-note {
  background: var(--soft);
  border-color: var(--line);
  color: var(--ink);
}
:root[data-theme] .secondary,
:root[data-theme] .maker-toolbar .secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
}
:root[data-theme] .primary,
:root[data-theme] .maker-toolbar .primary {
  background: var(--green);
  color: var(--on-accent);
}
:root[data-theme] button,
:root[data-theme] input,
:root[data-theme] select {
  transition: none;
}
:root[data-theme] #flow-edges text {
  fill: var(--ink);
  stroke: var(--canvas);
}
:root[data-theme="dark"] #flow-edges path {
  stroke: var(--green);
}
:root[data-theme="dark"] #flow-edges path[stroke-dasharray="7 5"] {
  stroke: var(--focus);
}
@media (max-width: 900px) {
  body .sidebar {
    padding-right: 110px;
  }
  body:has(.graph-mode) .sidebar {
    padding-right: 110px !important;
  }
  .theme-toggle {
    border-width: 1px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
