/* Isolated dashboard editor surface for SuperViz. Dark canvas, #141414 cards,
   quiet #303030 borders, Totaly blue #2196F3 controls, system font stack. */
.de-root {
  --de-bg: #000;
  --de-surface: #141414;
  --de-raised: #1d1d1d;
  --de-border: #303030;
  --de-muted: #a0a0a0;
  --de-text: #dedede;
  --de-link: #2196F3;
  --de-primary: #1976D2;
  --de-xs: 12px;
  --de-sm: 14px;
  --de-lg: 18px;
  --de-title: 20px;
  --de-gap: 12px;
  min-height: calc(100vh - 49px);
  background: var(--de-bg);
  color: var(--de-text);
  font: 400 var(--de-sm)/1.45 var(--font, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif);
}
.de-root *, .de-dialog * { box-sizing: border-box; }
.de-root [hidden] { display: none !important; }
.de-root button, .de-root input, .de-root textarea, .de-root select,
.de-dialog button, .de-dialog input { font: inherit; color: inherit; }
.de-root button, .de-dialog button { cursor: pointer; }
.de-root button:disabled, .de-dialog button:disabled { opacity: .43; cursor: not-allowed; }
.de-root button, .de-root a, .de-root input, .de-root select { transition: border-color 120ms, background-color 120ms, color 120ms; }
.de-root a { color: var(--de-link); text-decoration: none; }
.de-root a:hover { color: #64B5F6; }
.de-root :focus-visible, .de-dialog :focus-visible { outline: 2px solid #2196F3; outline-offset: 2px; }
.de-root input, .de-root textarea, .de-root select, .de-dialog input {
  display: block;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--de-border, #303030);
  border-radius: 5px;
  background: var(--de-surface, #141414);
  color: var(--de-text, #dedede);
  padding: 8px 10px;
  line-height: 20px;
}
.de-root input::placeholder { color: #888; opacity: 1; }
.de-root input:hover, .de-root select:hover, .de-root textarea:hover { border-color: #505050; }
.de-root select { height: 38px; text-overflow: ellipsis; }
.de-root textarea { resize: vertical; min-height: 68px; }
.de-root svg, .de-dialog svg { flex-shrink: 0; display: inline-block; vertical-align: middle; }
.de-root .de-icon, .de-dialog .de-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  padding: 0;
  color: #aaa;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
}
.de-root .de-icon:not(:disabled):hover, .de-dialog .de-icon:hover { background: #262626; color: #eee; }
.de-root .de-button, .de-dialog .de-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 12px;
  min-height: 34px;
  border: 1px solid #3b3b3b;
  background: #1d1d1d;
  color: #ddd;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.de-root .de-button:not(:disabled):hover, .de-dialog .de-button:hover { border-color: #777; background: #292929; }
.de-root .de-primary, .de-dialog .de-primary { background: #1976D2; border-color: #1976D2; color: #fff; }
.de-root .de-primary:not(:disabled):hover, .de-dialog .de-primary:hover { background: #1565C0; border-color: #2196F3; }
.de-root .de-primary:disabled { background: #292929; border-color: #414141; color: #a0a0a0; opacity: .6; }
.de-root .de-tertiary { color: #64B5F6; background: #12293A; border-color: #1B4059; }
.de-root .de-tertiary:not(:disabled):hover { color: #90CAF9; background: #17344A; border-color: #22557A; }
.de-root .de-danger, .de-dialog .de-danger { color: #f19a9f; }
.de-root .de-small { min-height: 30px; padding: 5px 10px; }
.de-head {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--de-border);
  background: var(--de-surface);
  position: sticky;
  top: var(--nav-h, 49px);
  z-index: 30;
}
.de-head h1 { font: 500 var(--de-title)/1.2 var(--font, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif); margin: 0; overflow-wrap: anywhere; }
.de-favorite { color: #eda515; display: flex; }
.de-favorite svg { fill: currentColor; stroke-width: 1.2; }
.de-head-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0; }
.de-badge { color: #aaa; border: 1px solid #414141; background: #242424; padding: 2px 9px; border-radius: 12px; font-size: var(--de-xs); }
.de-published { color: #64B5F6; border-color: #1B4059; background: #12222E; }
.de-metadata { font-size: var(--de-xs); color: var(--de-muted); }
.de-meta-divider { margin: 0 8px; color: #666; }
.de-status { font-size: var(--de-xs); color: #8f8f8f; margin-right: 4px; }
.de-unsaved { color: #c6b689; }
.de-shell { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; }
.de-editing .de-shell { grid-template-columns: minmax(0, 1fr) 376px; }
.de-canvas { min-height: calc(100vh - 114px); min-width: 0; padding: 32px; }
.de-editing .de-canvas { padding: 32px 20px 48px 32px; }
.de-children { position: relative; min-width: 0; width: 100%; }
.de-flow-row { display: flex; flex-flow: row wrap; gap: var(--de-gap); align-items: flex-start; }
.de-flow-column { display: flex; flex-direction: column; gap: var(--de-gap); }
.de-node { position: relative; min-width: 0; flex-shrink: 0; isolation: auto; }
.de-flow-row > .de-node { flex: 0 0 calc((100% + var(--de-gap)) * var(--de-span, 12) / 12 - var(--de-gap)); width: calc((100% + var(--de-gap)) * var(--de-span, 12) / 12 - var(--de-gap)); }
.de-flow-column > .de-node { width: calc(100% * var(--de-span, 12) / 12); }
.de-row, .de-column { background: transparent; border: 1px solid transparent; }
.de-editing .de-row, .de-editing .de-column { border-color: #282828; border-style: dashed; }
.de-editing .de-row > .de-children, .de-editing .de-column > .de-children { min-height: 72px; }
.de-row > .de-children, .de-column > .de-children { min-height: inherit; }
.de-editing .de-row:hover, .de-editing .de-column:hover { border-color: #484848; }
.de-editing .de-node.de-selected { outline: 1px solid var(--de-link); outline-offset: 2px; }
.de-chart-card { min-width: 0; min-height: 180px; display: flex; flex-direction: column; border: 1px solid var(--de-border); border-radius: 8px; background: var(--de-surface); }
.de-chart-head { display: flex; align-items: flex-start; gap: 4px; min-height: 50px; padding: 16px 12px 8px 18px; flex-shrink: 0; }
.de-chart-head .de-icon { width: 23px; height: 24px; flex-basis: 23px; margin-top: -2px; }
.de-chart-head .de-chart-title { flex: 1 1 auto; min-width: 0; font-size: var(--de-sm); line-height: 24px; font-weight: 500; color: #ccc; overflow-wrap: anywhere; }
.de-chart-head .de-chart-title:hover { color: var(--de-link); }
.de-editing .de-chart-head { padding-left: 12px; }
.de-chart-head > .de-drag-handle { margin-left: -8px; width: 16px; flex-basis: 16px; }
.de-drag-handle, .de-element-grip, .de-library-preview { cursor: grab; touch-action: none; }
.de-drag-handle:active, .de-element-grip:active, .de-library-preview:active { cursor: grabbing; }
.de-chart-body { flex: 1 1 auto; height: 0; min-height: 0; width: calc(100% - 20px); margin: 0 10px 12px; position: relative; overflow: hidden; }
.de-chart-body > .ec { width: 100%; height: 100%; }
.de-chart-message { width: 100%; height: 100%; min-height: 80px; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 8px; padding: 20px; text-align: center; font-size: var(--de-xs); color: var(--de-muted); }
.de-chart-message strong { font-weight: 500; color: #bcbcbc; }
.de-chart-message > span { max-width: 320px; }
.de-chart-message.de-preview-only { background: #161616; }
.de-preview-only > svg { width: 24px; height: 24px; color: #737373; }
.de-chart-message a { margin-top: 4px; }
.de-node-tools { display: flex; align-items: center; gap: 4px; min-height: 26px; padding: 0 4px; color: #929292; background: #171717; border-bottom: 1px solid #292929; }
.de-row > .de-node-tools, .de-column > .de-node-tools { position: absolute; z-index: 8; top: -28px; left: -1px; right: -1px; border: 1px solid #3b3b3b; opacity: 0; pointer-events: none; min-width: 130px; }
.de-row:hover > .de-node-tools, .de-column:hover > .de-node-tools,
.de-row:focus-within > .de-node-tools, .de-column:focus-within > .de-node-tools,
.de-row.de-selected > .de-node-tools, .de-column.de-selected > .de-node-tools { opacity: 1; pointer-events: auto; }
.de-node-kind { font-size: var(--de-xs); text-transform: capitalize; }
.de-tools-spacer { flex: 1; }
.de-node-tools .de-icon { height: 24px; width: 24px; flex-basis: 24px; }
.de-header, .de-markdown { background: var(--de-surface); }
.de-editing .de-header, .de-editing .de-markdown, .de-editing .de-divider { border: 1px solid var(--de-border); }
.de-text-body { padding: 16px 20px; overflow-wrap: anywhere; }
.de-text-body h2, .de-text-body h3, .de-text-body h4 { line-height: 1.4; font-weight: 500; margin: 0 0 12px; }
.de-text-body h2 { font-size: 20px; }
.de-text-body h3 { font-size: 18px; }
.de-text-body h4 { font-size: 16px; }
.de-header .de-text-body { display: flex; align-items: center; }
.de-header .de-text-body > * { margin: 0; white-space: pre-wrap; }
.de-markdown p { margin: 0 0 8px; max-width: none; }
.de-markdown ul { padding-left: 24px; margin: 4px 0 12px; }
.de-markdown li { margin: 2px 0; }
.de-markdown code { font: 12px var(--mono, monospace); padding: 2px 4px; background: #282828; border: 1px solid #3b3b3b; border-radius: 3px; }
.de-text-space { height: 8px; }
.de-divider-body { display: flex; align-items: center; padding: 0 4px; min-height: 16px; }
.de-divider-body hr { width: 100%; border: 0; border-top: 1px solid #3b3b3b; margin: 0; }
.de-tabs { border: 1px solid var(--de-border); background: var(--de-bg); min-height: 96px; }
.de-tabs-bar { display: flex; align-items: center; flex-wrap: wrap; min-height: 42px; background: #141414; border-bottom: 1px solid var(--de-border); padding: 0 8px; }
.de-tab-wrap { display: inline-flex; align-items: center; min-width: 0; border-bottom: 2px solid transparent; }
.de-tabs-bar [role="tab"] { background: transparent; border: 0; padding: 12px; min-height: 42px; font-size: var(--de-sm); max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.de-tab-wrap.de-tab-active { color: var(--de-link); border-bottom-color: var(--de-link); }
.de-tab-wrap .de-icon { flex-basis: 22px; width: 22px; }
.de-tabs [role="tabpanel"] { padding: 16px; min-height: 96px; }
.de-empty-container { color: #848484; padding: 24px 16px; font-size: var(--de-xs); }
.de-root .de-dropzone {
  position: absolute;
  z-index: 12;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  pointer-events: auto;
}
.de-dropzone > span { display: flex; align-items: center; justify-content: center; gap: 4px; white-space: nowrap; font-size: var(--de-xs); pointer-events: none; }
.de-dropzone > span > svg { width: 12px; height: 12px; }
.de-flow-column > .de-node > .de-zone-before { top: -8px; height: 14px; left: -1px; right: -1px; }
.de-flow-column > .de-node > .de-zone-after { bottom: -8px; height: 14px; left: -1px; right: -1px; }
.de-flow-row > .de-node > .de-zone-before { top: -1px; bottom: -1px; left: -8px; width: 14px; }
.de-flow-row > .de-node > .de-zone-after { top: -1px; bottom: -1px; right: -8px; width: 14px; }
.de-flow-row > .de-node > .de-dropzone > span { writing-mode: vertical-rl; }
.de-root .de-dropzone.de-zone-empty { position: relative; width: 100%; min-height: 96px; padding: 20px; border: 1px dashed #454545; color: #9f9f9f; background: #0c0c0c; }
.de-root .de-dropzone:not(.de-zone-empty) > span { opacity: 0; }
.de-root .de-dropzone:hover, .de-root .de-dropzone:focus-visible, .de-root .de-dropzone.de-zone-chosen { background: #12293A; border-color: #1976D2; color: #BBDEFB; }
.de-root .de-dropzone:hover > span, .de-root .de-dropzone:focus-visible > span, .de-root .de-dropzone.de-drop-active > span { opacity: 1; }
.de-dragging .de-dropzone { background: #0E2232; border-color: #1B5E8A; }
.de-root .de-drop-active { outline: 2px solid #42A5F5 !important; outline-offset: 1px; background-color: #143247 !important; color: #D6EAFB !important; z-index: 16; }
.de-root .de-dropzone.de-drop-active { min-height: 14px; }
.de-resize-handle { position: absolute; z-index: 15; right: -1px; bottom: -1px; width: 18px; height: 18px; cursor: nwse-resize !important; border: 0; background: transparent; touch-action: none; opacity: 0; }
.de-resize-handle::before, .de-resize-handle::after { content: ''; position: absolute; width: 9px; height: 1px; right: 2px; bottom: 5px; background: #aaa; transform: rotate(-45deg); }
.de-resize-handle::after { width: 5px; right: 1px; bottom: 3px; }
.de-node:hover > .de-resize-handle, .de-selected > .de-resize-handle, .de-resizing > .de-resize-handle { opacity: 1; }
.de-resizing { outline: 2px solid #2196F3 !important; }
.de-pointer-active, .de-pointer-active * { user-select: none !important; }
.de-drag-ghost { position: fixed; z-index: 10000; pointer-events: none; max-width: 250px; padding: 8px 12px; background: #1d1d1d; color: #eee; font: 12px/1.4 var(--font, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif); border: 1px solid #2196F3; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.de-sidebar { position: sticky; top: calc(var(--nav-h, 49px) + 64px); height: calc(100vh - var(--nav-h, 49px) - 64px); display: flex; flex-direction: column; min-height: 240px; min-width: 0; background: #000; border-left: 1px solid #232323; padding: 16px 16px 0 12px; }
.de-sidebar-tabs { display: flex; align-items: center; flex-shrink: 0; gap: 24px; border-bottom: 1px solid var(--de-border); min-height: 44px; }
.de-sidebar-tabs button { border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 12px 2px; color: #ccc; background: transparent; font-size: var(--de-xs); }
.de-sidebar-tabs button.de-active { color: var(--de-link); border-bottom-color: var(--de-link); }
.de-sidebar-scroll { min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 12px 0 24px; scrollbar-width: thin; scrollbar-color: #424242 #141414; }
.de-insertion { border-bottom: 1px solid #252525; margin: 0 0 12px; padding: 0 0 12px; }
.de-insertion label { display: flex; align-items: center; gap: 8px; font-size: var(--de-xs); color: #aaa; white-space: nowrap; }
.de-insertion select { flex: 1; font-size: var(--de-xs); height: 32px; padding: 4px 8px; }
.de-help { font-size: var(--de-xs); line-height: 1.5; color: #929292; margin: 8px 0 0; }
.de-create-chart { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin: 4px 0 14px; font-size: var(--de-xs); font-weight: 500; padding-right: 4px; }
.de-library-filters { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 8px; margin-bottom: 16px; }
.de-library-filters input, .de-library-filters select { height: 40px; font-size: var(--de-xs); }
.de-library { display: flex; flex-direction: column; gap: 12px; }
.de-library-card { display: grid; grid-template-columns: minmax(0, 44%) minmax(0, 1fr); gap: 12px; padding: 14px; background: #030303; border: 1px solid #252525; border-radius: 7px; min-height: 120px; }
.de-library-card:hover { border-color: #494949; }
.de-library-preview { height: 82px; position: relative; align-self: center; background: #141414; overflow: hidden; }
.de-mini-chart { width: 100%; height: 82px; pointer-events: none; }
.de-mini-chart .de-chart-message { font-size: 12px; padding: 4px; min-height: 0; gap: 4px; }
.de-mini-chart .de-chart-message svg { width: 18px; height: 18px; }
.de-added { position: absolute; right: 4px; bottom: 4px; color: #ddd; background: #333c; border: 1px solid #777; border-radius: 12px; padding: 0 5px; font-size: var(--de-xs); pointer-events: none; line-height: 18px; }
.de-library-info { min-width: 0; }
.de-library-info > strong { display: block; font-size: var(--de-xs); line-height: 18px; font-weight: 500; color: #ccc; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 5px; }
.de-library-info dl { display: grid; grid-template-columns: 50px minmax(0, 1fr); gap: 2px 4px; margin: 0; font-size: var(--de-xs); line-height: 16px; }
.de-library-info dt { color: #838383; margin: 0; }
.de-library-info dd { color: #aaa; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.de-root .de-library-add { padding: 2px 0; display: flex; align-items: center; gap: 4px; border: 0; background: transparent; color: var(--de-link); font-size: var(--de-xs); line-height: 18px; margin-top: 4px; }
.de-library-add svg { width: 12px; height: 12px; }
.de-root .de-library-add:disabled { opacity: 1; color: #818181; }
.de-elements { background: #141414; border: 1px solid #303030; }
.de-element { display: flex; align-items: center; gap: 20px; min-height: 72px; padding: 16px 16px 16px 24px; }
.de-element:hover { background: #1b1b1b; }
.de-element > .de-icon:last-child { margin-left: auto; color: #64B5F6; }
.de-element-grip { display: inline-flex; padding: 8px 0; color: #aaa; }
.de-inspector { background: #141414; border: 1px solid #353535; padding: 12px; margin-bottom: 12px; }
.de-inspector > header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -4px -4px 8px 0; }
.de-inspector > header strong { font-weight: 500; font-size: var(--de-xs); color: #c9c9c9; }
.de-size-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.de-size-fields label, .de-editor-label, .de-inline-label { font-size: var(--de-xs); color: #ccc; }
.de-size-fields label span { color: #929292; }
.de-size-fields input { height: 32px; margin-top: 4px; padding: 4px 8px; font-size: var(--de-xs); background: #0b0b0b; }
.de-editor-label { display: block; margin-top: 12px; }
.de-editor-label textarea, .de-editor-label select { margin-top: 4px; font-size: var(--de-xs); background: #0b0b0b; }
.de-editor-label textarea { font-family: var(--mono, monospace); }
.de-inline-label { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.de-inline-label select { width: auto; flex: 1; height: 30px; font-size: var(--de-xs); padding: 4px 8px; }
.de-inspector .de-help { margin-bottom: 8px; }
.de-inspector .de-tertiary { margin-top: 8px; }
.de-order-controls { display: flex; align-items: center; gap: 4px; margin-top: 12px; padding-top: 8px; border-top: 1px solid #303030; font-size: var(--de-xs); }
.de-order-controls > span { margin-right: auto; }
.de-inspector-bottom { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; }
.de-root .de-text-button { color: #2196F3; background: transparent; border: 0; font-size: var(--de-xs); padding: 4px 0; margin-top: 4px; }
.de-menu { position: relative; flex-shrink: 0; }
.de-menu summary { list-style: none; cursor: pointer; }
.de-menu summary::-webkit-details-marker { display: none; }
.de-menu-content { display: flex; flex-direction: column; position: absolute; z-index: 60; right: 0; top: calc(100% + 5px); min-width: 210px; max-width: 290px; padding: 4px 0; background: #1d1d1d; border: 1px solid #444; border-radius: 4px; box-shadow: 0 4px 10px #0008; }
.de-menu:not([open]) .de-menu-content { display: none; }
.de-menu-content > a, .de-menu-content > button { display: flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 10px 12px; text-align: left; white-space: nowrap; font-size: var(--de-xs); color: #ddd; }
.de-menu-content > a:hover, .de-menu-content > button:not(:disabled):hover { color: #eee; background: #2a2a2a; }
.de-dashboard-menu > summary { border-color: #1B5E8A; }
.de-dialog { color: #ddd; background: #141414; border: 1px solid #444; border-radius: 7px; padding: 0; width: min(500px, calc(100vw - 32px)); font: 14px/1.5 var(--font, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif); box-shadow: 0 12px 48px #0008; }
.de-dialog::backdrop { background: #000b; }
.de-dialog form { margin: 0; }
.de-dialog header { padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #303030; }
.de-dialog h2 { margin: 0; font-size: 18px; font-weight: 500; }
.de-dialog-body { padding: 20px; }
.de-dialog-body p { margin: 0; color: #bbb; }
.de-dialog-body label { display: block; font-size: 12px; }
.de-dialog-body input { margin-top: 8px; background: #0b0b0b; }
.de-dialog footer { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 20px; border-top: 1px solid #303030; flex-wrap: wrap; }
.de-error { color: #efa1a5; }
.de-save-error { padding: 12px 20px; background: #2b1517; border-bottom: 1px solid #6b3238; font-size: var(--de-xs); }
.de-empty-dashboard { padding: 64px 24px; text-align: center; color: #b3b3b3; }
.de-empty-dashboard h1, .de-empty-dashboard h2 { font-size: 20px; font-weight: 500; margin: 0 0 12px; color: #ddd; }
.de-empty-dashboard p { margin: 0 auto 20px; max-width: 380px; }
.de-empty-search { padding: 32px 12px; text-align: center; font-size: var(--de-xs); color: var(--de-muted); }
.de-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.de-saving .de-canvas, .de-saving .de-sidebar { pointer-events: none; opacity: .65; }
@media (max-width: 1180px) {
  .de-metadata { display: none; }
  .de-status { max-width: 100px; text-align: right; }
  .de-library-card { padding: 12px; gap: 8px; }
}
@media (max-width: 960px) {
  .de-editing .de-shell { grid-template-columns: minmax(0, 1fr) 320px; }
  .de-sidebar { padding-right: 12px; }
  .de-canvas, .de-editing .de-canvas { padding: 28px 16px; }
  .de-library-card { grid-template-columns: minmax(0, 40%) minmax(0, 1fr); }
  .de-chart-head { padding-left: 10px; }
  .de-chart-head .de-chart-title { font-size: 12px; }
  .de-editing .de-flow-row > .de-node { flex-basis: calc((100% + var(--de-gap)) * max(6, var(--de-span, 12)) / 12 - var(--de-gap)); width: calc((100% + var(--de-gap)) * max(6, var(--de-span, 12)) / 12 - var(--de-gap)); }
}
@media (max-width: 760px) {
  .de-head { position: relative; top: auto; flex-wrap: wrap; row-gap: 8px; min-height: 64px; }
  .de-head h1 { font-size: 18px; }
  .de-head-actions { gap: 4px; }
  .de-editing .de-head-actions { width: 100%; justify-content: flex-end; }
  .de-status { margin-right: auto; max-width: none; font-size: 12px; }
  .de-editing .de-shell { grid-template-columns: minmax(0, 1fr); }
  .de-editing .de-sidebar { position: relative; top: auto; height: auto; max-height: 650px; border-top: 1px solid #303030; border-left: 0; grid-row: 1; padding: 8px 16px 0; }
  .de-sidebar-scroll { max-height: 440px; }
  .de-library { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .de-library-card { grid-template-columns: minmax(0, 1fr); }
  .de-library-preview, .de-mini-chart { height: 90px; }
  .de-elements { display: grid; grid-template-columns: 1fr 1fr; }
  .de-element { padding: 12px; min-height: 52px; gap: 12px; }
  .de-insertion .de-help { display: none; }
  .de-chart-head .de-chart-title { font-size: 14px; }
  .de-flow-row > .de-node, .de-editing .de-flow-row > .de-node { flex-basis: 100%; width: 100%; }
  .de-flow-column > .de-node { width: 100%; }
  .de-flow-row > .de-node > .de-zone-before { top: -8px; height: 14px; bottom: auto; left: -1px; right: -1px; width: auto; }
  .de-flow-row > .de-node > .de-zone-after { bottom: -8px; height: 14px; top: auto; left: -1px; right: -1px; width: auto; }
  .de-flow-row > .de-node > .de-dropzone > span { writing-mode: horizontal-tb; }
  .de-chart-card { min-height: 260px; }
  .de-resize-handle { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .de-root *, .de-dialog * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ------------------------------------------------------------------------ */
/* Bridge: SuperViz grid <-> dashboard editor                               */
/*                                                                          */
/* dashboard-editor.js layers edit mode over the .sv-grid that              */
/* superviz_page.js already renders, so the .de-* rules above have to reach  */
/* .sv-card without .de-root taking over the page. .de-root goes on          */
/* .sv-section purely to carry the custom properties and scope the button    */
/* and drop-target rules; this block cancels the surface it would impose.    */
/* ------------------------------------------------------------------------ */

.sv-section.de-root {
  min-height: 0;
  background: transparent;
  color: inherit;
  font: inherit;
}

/* The dialog is portalled to <body>, outside any .de-root, so it needs the
   custom properties declared on itself. */
.de-dialog {
  --de-bg: #000;
  --de-surface: #141414;
  --de-raised: #1d1d1d;
  --de-border: #303030;
  --de-muted: #a0a0a0;
  --de-text: #dedede;
  --de-link: #2196F3;
  --de-primary: #1976D2;
  --de-xs: 12px;
  --de-sm: 14px;
  --de-lg: 18px;
  --de-title: 20px;
  --de-gap: 12px;
}

/* Toolbar that hosts Edit layout / Add chart / Reset / status. */
.de-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}
.sv-section-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.sv-section-head .sv-section-blurb { flex-basis: 100%; }

.de-root .de-button.de-primary {
  color: #fff;
  background: var(--de-primary);
  border-color: var(--de-primary);
}
.de-root .de-button.de-primary:not(:disabled):hover {
  background: #2196F3;
  border-color: #2196F3;
}

/* Positioning context for .de-node-tools and .de-resize-handle. */
.sv-grid.de-editing .sv-card {
  position: relative;
  cursor: default;
}
.sv-grid.de-editing .sv-card:focus-visible {
  outline: 2px solid #2196F3;
  outline-offset: 2px;
}
.sv-grid.de-editing .sv-card.de-selected {
  border-color: #2196F3;
}
.sv-grid.de-editing .sv-card-head {
  cursor: grab;
  user-select: none;
}
.sv-grid.de-editing .sv-card.de-dragging {
  opacity: .45;
}
.sv-grid.de-editing .de-node-tools {
  border-radius: 7px 7px 0 0;
}

/* Map division: replaces the chart grid with a full-viewport map host. */
.sv-map-host {
  width: 100%;
  min-height: 640px;
  height: calc(100vh - 220px);
  padding: 0;
  margin: 0;
  border-radius: 8px;
  overflow: hidden;
  background: transparent;
}
.sv-map-host.pred-view {
  padding: 0 !important;
  margin: 0 !important;
  max-width: none !important;
}
.sv-map-host > .pred-section-head,
.sv-map-host > .pred-label {
  /* Section title and description already come from the SuperViz section head;
     the map module renders its own copies at the top of pred-view which we
     hide here. Controls are their own inline flex divs and stay visible. */
  display: none !important;
}
.sv-map-host .pred-card {
  padding: 8px !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  /* v42.3.74: give the card an explicit height so the absolute-positioned
     mapbox-map fills real pixels. Without this the card collapses to just
     the status label height (48px) and the map renders as a thin bar. */
  height: calc(100vh - 260px) !important;
  min-height: 640px !important;
  position: relative !important;
  overflow: hidden !important;
}

/* v42.3.74: pin every internal mapbox wrapper to fill the card.
   The default mapbox-gl v3 stylesheet says .mapboxgl-canvas-container is
   absolute+inset:0, but a page rule wins the specificity race and it ends
   up static height:0, leaving the canvas stuck at its 400x300 default. */
.sv-map-host .mapboxgl-map {
  position: absolute !important;
  top: 30px !important; /* leave room for the status label above */
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: calc(100% - 30px) !important;
}
.sv-map-host .mapboxgl-canvas-container {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
}
.sv-map-host .mapboxgl-canvas {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
}

/* ------------------------------------------------------------------------ */
/* Dashboard builder overlay (dashboard-builder.js)                         */
/*                                                                          */
/* The builder is not a route. It mounts a full bleed overlay on            */
/* document.body carrying "de-root de-builder de-editing sv-page", so the   */
/* .de-* vocabulary above applies unchanged and only the page level         */
/* assumptions need cancelling: no sticky offset for the app nav, no page   */
/* scroll, and an internal scroller per pane instead.                       */
/* ------------------------------------------------------------------------ */

.de-builder {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: var(--de-bg, #000);
  /* The .de-head and .de-sidebar rules offset themselves by the app nav
     height. Inside the overlay there is no nav, so zero it out. */
  --nav-h: 0px;
}
.de-builder > .de-head {
  position: static;
  top: auto;
  flex: 0 0 auto;
}
.de-builder > .de-save-error { flex: 0 0 auto; }
.de-builder > .de-shell {
  flex: 1 1 auto;
  min-height: 0;
  align-items: stretch;
}
.de-builder .de-canvas {
  min-height: 0;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #424242 #141414;
}
.de-builder .de-sidebar {
  position: static;
  top: auto;
  height: 100%;
  min-height: 0;
}

/* Library grouping heading, one per division. */
.de-library-group {
  margin: 4px 0 0;
  font-size: var(--de-xs);
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #8f8f8f;
}
.de-library-group:not(:first-child) { margin-top: 10px; }

/* "Create chart" is a button here, not the static row the grid editor uses,
   so the shared .de-create-chart layout needs the button chrome removed. */
.de-root button.de-create-chart {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--de-link);
  text-align: right;
}
.de-root button.de-create-chart:hover { color: #64B5F6; }
.de-root button.de-create-chart svg { width: 12px; height: 12px; }

/* Placeholder that mountChartHosts swaps for the cached .de-chart-body host.
   It carries the same geometry so the swap causes no reflow jump. */
.de-chart-slot {
  flex: 1 1 auto;
  height: 0;
  min-height: 0;
  width: calc(100% - 20px);
  margin: 0 10px 12px;
  position: relative;
  overflow: hidden;
}

/* Per chart overflow menu in the card head. */
.de-chart-menu { margin-left: 2px; }
.de-chart-menu > summary { display: inline-flex; }

/* Tab strip field editor in the inspector. */
.de-tab-fields { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.de-tab-fields > .de-editor-label { margin-top: 0; }
.de-tab-fields input { height: 32px; margin-top: 4px; padding: 4px 8px; font-size: var(--de-xs); background: #0b0b0b; }

/* A library card whose chart is already on the dashboard dims its metadata so
   the "added" badge reads as the primary signal. */
.de-added-info > strong { color: #9a9a9a; }

/* Open dashboard picker list, inside the shared .de-dialog. */
.de-dash-list {
  display: flex;
  flex-direction: column;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid #303030;
  border-radius: 5px;
}
.de-dash-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border: 0;
  border-bottom: 1px solid #262626;
  background: transparent;
  text-align: left;
  color: #ddd;
  font-size: var(--de-sm);
}
.de-dash-item:last-child { border-bottom: 0; }
.de-dash-item:hover { background: #1f1f1f; }
.de-dash-name { min-width: 0; overflow-wrap: anywhere; }
.de-dash-when { flex: 0 0 auto; font-size: var(--de-xs); color: #8f8f8f; }

@media (max-width: 850px) {
  /* One column below the sidebar breakpoint: the overlay itself scrolls and
     each pane grows to its content instead of owning a scroller. */
  .de-builder { overflow-y: auto; }
  .de-builder > .de-shell {
    display: flex;
    flex-direction: column;
    flex: 1 0 auto;
  }
  .de-builder .de-sidebar {
    order: -1;
    height: auto;
    max-height: 46vh;
    border-left: 0;
    border-bottom: 1px solid #303030;
  }
  .de-builder .de-canvas { height: auto; overflow: visible; }
  .de-builder .de-inspector-bottom {
    position: sticky;
    bottom: 0;
    background: #141414;
    padding-top: 8px;
  }
}

/* The tabs inspector puts "Add tab" next to "Delete the open tab" with no
   separation, so the two controls read as one target. Give them a gap and a
   shared baseline. */
.de-builder .de-tab-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.de-builder .de-inspector .de-button + .de-text-button,
.de-builder .de-inspector .de-small + .de-text-button {
  margin-left: 12px;
}
