.map-theme-toggle { display: none; }
.map-focus .map-theme-toggle {
  display: inline-flex;
  position: absolute;
  top: 24px;
  left: 24px;
  width: 40px;
  height: 40px;
  border: 1px solid #dfe6e9;
  background: #fff;
  color: #627d8b;
  box-shadow: 0 2px 7px #16334405;
  z-index: 4;
}
.map-focus .map-theme-toggle:hover { background: #edf5f5; color: #008e94; }
:root[data-theme="dark"] {
  --ink: #e4edf4;
  --teal: #52c6c7;
  --line: #2b3b49;
  --muted: #a0b3c2;
  --shadow: 0 12px 42px #0003;
  color: #c9d9e4;
  background: #101923;
}
[data-theme="dark"] body { background: #101923; }
[data-theme="dark"] .app-header,
[data-theme="dark"] .map-toolbar,
[data-theme="dark"] .drawer,
[data-theme="dark"] .drawer-footer,
[data-theme="dark"] .dropdown,
[data-theme="dark"] dialog,
[data-theme="dark"] .library-card { background: #172430; color: #c9d9e4; }
[data-theme="dark"] .canvas {
  background-color: #101c27;
  background-image: radial-gradient(#344959 .7px, transparent .7px);
}
[data-theme="dark"] .workspace { background: #101c27; border-color: #2d4050; }
[data-theme="dark"] .node {
  background: #1c2c39;
  border-color: #3b5263;
  box-shadow: 0 4px 14px #0002;
}
[data-theme="dark"] .node:hover { border-color: #58b7ba; box-shadow: 0 5px 18px #0004; }
[data-theme="dark"] .node.selected { border-color: #58d0cb; box-shadow: 0 0 0 3px #58d0cb20; }
[data-theme="dark"] .node.dark { background: #183e50; border-color: #42758a; }
[data-theme="dark"] .node-title { color: #e4edf4; }
[data-theme="dark"] .node-category,
[data-theme="dark"] .node-meta { color: #9db5c5; }
[data-theme="dark"] .node-icon { background: #213f49; color: #7ad1d0; }
[data-theme="dark"] .node[data-category="commercial"] .node-icon { background: #284357; color: #abcce8; }
[data-theme="dark"] .node[data-category="support"] .node-icon { background: #36344d; color: #c1afe0; }
[data-theme="dark"] .node[data-category="transverse"] .node-icon { background: #403d31; color: #ddc48e; }
[data-theme="dark"] .node-status { background: #688d99; }
[data-theme="dark"] .port { background: #1c2c39; border-color: #7593a5; }
[data-theme="dark"] .port:hover { background: #52c6c7; border-color: #52c6c7; }
[data-theme="dark"] .edge-line { stroke: #728e9f; }
[data-theme="dark"] #arrow path { stroke: #8caaba; }
[data-theme="dark"] .edge-label rect { fill: #172a37; stroke: #3a5162; }
[data-theme="dark"] .edge-label text { fill: #bfd0db; }
[data-theme="dark"] .edge-group:hover .edge-line,
[data-theme="dark"] .edge-group.selected .edge-line { stroke: #62d0cd; }
[data-theme="dark"] .edge-group:hover .edge-label rect { fill: #203f48; stroke: #62d0cd; }
[data-theme="dark"] .edge-delete circle { fill: #29333c; stroke: #a87070; }
[data-theme="dark"] .edge-delete text { fill: #edaaa4; }
[data-theme="dark"] .zoom-tools,
[data-theme="dark"] .focus-actions .icon-button,
[data-theme="dark"] .map-theme-toggle,
[data-theme="dark"] .button.secondary { background: #1b2c39; border-color: #3a5061; color: #bed0dc; }
[data-theme="dark"] .map-theme-toggle { color: #e5cc88; }
[data-theme="dark"] .icon-button { color: #9ab2c2; }
[data-theme="dark"] .icon-button:hover,
[data-theme="dark"] .button.secondary:hover,
[data-theme="dark"] .dropdown button:hover { background: #293f4e; color: #e6f2f7; }
[data-theme="dark"] .button.primary { background: #3d9da3; color: #071d25; }
[data-theme="dark"] .button.primary:hover { background: #65c5c7; }
[data-theme="dark"] .button.subtle { background: #233d48; color: #a3d3d4; }
[data-theme="dark"] .button.danger { background: #402d32; border-color: #6a444b; color: #f1b0a9; }
[data-theme="dark"] .danger-text { color: #f1b0a9 !important; }
[data-theme="dark"] .segmented { background: #101d28; }
[data-theme="dark"] .segmented button.active { background: #304856; color: #d2e5ec; }
[data-theme="dark"] .map-path strong,
[data-theme="dark"] .field > span,
[data-theme="dark"] .detail-value,
[data-theme="dark"] .step-body h4,
[data-theme="dark"] .related-item .related-open { color: #c8dbe5; }
[data-theme="dark"] .count-pill,
[data-theme="dark"] .nav-button span { background: #223643; color: #afc4d0; border-color: #344b5c; }
[data-theme="dark"] .field input,
[data-theme="dark"] .field textarea,
[data-theme="dark"] .field select,
[data-theme="dark"] .library-toolbar select,
[data-theme="dark"] .library-toolbar .search-wrap { background: #111f2b; border-color: #3a5060; color: #d1e2eb; }
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder { color: #849eaf; }
[data-theme="dark"] .search-wrap input { color: #cee0eb; }
[data-theme="dark"] .step-editor,
[data-theme="dark"] .empty-detail,
[data-theme="dark"] .empty-search { background: #182b38; border-color: #3b5363; color: #b1c7d4; }
[data-theme="dark"] .step-num,
[data-theme="dark"] .help-row > span,
[data-theme="dark"] .category-badge { background: #21424a; color: #91d6d0; }
[data-theme="dark"] .resource-link { background: #16363e; border-color: #33545c; color: #99d7d4; }
[data-theme="dark"] .legend { background: #101c27e8; color: #a8bfce; }
[data-theme="dark"] .avatar { background: #21463f; color: #b2d8c9; }
[data-theme="dark"] .form-error { background: #412e31; color: #f0b4a5; }
[data-theme="dark"] .drawer-backdrop { background: #0006; }
[data-theme="dark"] dialog::backdrop { background: #0008; }
[data-theme="dark"] .page-heading p,
[data-theme="dark"] .drawer-description,
[data-theme="dark"] .section-caption,
[data-theme="dark"] .step-body p,
[data-theme="dark"] .modal-body p,
[data-theme="dark"] .library-card p { color: #9db4c4; }
@media (max-width: 760px) {
  .map-focus .map-theme-toggle { top: 15px; left: 15px; }
}
