/* ── Reset & Variables ───────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --tb-h: 52px;
  --panel-w: 340px;
  --tb-bg: #1a1b2e;
  --accent: #6366f1;
  --accent2: #818cf8;
  --node-shadow: 0 2px 14px rgba(0,0,0,0.13);
  --node-r: 9px;
  --edge-col: #94a3b8;
  --border: #e2e8f0;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  font-family: -apple-system, 'Segoe UI', system-ui, sans-serif;
}

#app { width: 100%; height: 100%; display: flex; flex-direction: column; }

/* ── Toolbar ─────────────────────────────────────────────── */
#toolbar {
  flex-shrink: 0;
  height: var(--tb-h);
  background: var(--tb-bg);
  display: flex; align-items: center;
  padding: 0 16px; gap: 6px;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(255,255,255,0.07);
}

.tb-brand {
  color: #e2e8f0;
  font-size: 15px; font-weight: 700; letter-spacing: .5px;
  margin-right: 8px; white-space: nowrap;
}

.tb-sep { width: 1px; height: 24px; background: rgba(255,255,255,0.1); margin: 0 4px; }

.tb-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 7px 13px; border: none; border-radius: 6px;
  background: transparent; color: #cbd5e1;
  font-size: 13px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s;
}
.tb-btn:hover { background: rgba(255,255,255,0.09); color: #e2e8f0; }
.tb-btn.active { background: var(--accent); color: #fff; }
.tb-btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.tb-space { flex: 1; }
.tb-hint { color: rgba(255,255,255,0.3); font-size: 11px; margin-left: 4px; }

/* ── Layout ──────────────────────────────────────────────── */
#main { flex: 1; display: flex; overflow: hidden; position: relative; }

/* ── Canvas ──────────────────────────────────────────────── */
#canvas-vp {
  flex: 1; position: relative; overflow: hidden;
  background: #f8fafc;
  background-image: radial-gradient(circle, #d1d5db 1px, transparent 1px);
  background-size: 28px 28px;
  cursor: default;
}
#canvas-vp.mode-place { cursor: crosshair; }

#canvas-world {
  position: absolute; top: 0; left: 0;
  transform-origin: 0 0;
  width: 0; height: 0;
}

#edges-svg {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  overflow: visible;
  pointer-events: none;
}

#nodes-layer { position: absolute; top: 0; left: 0; width: 0; height: 0; }

/* ── Nodes ───────────────────────────────────────────────── */
.node {
  position: absolute;
  background: #fff;
  border-radius: var(--node-r);
  box-shadow: var(--node-shadow);
  border: 1.5px solid var(--border);
  min-width: 110px; max-width: 260px;
  cursor: grab; user-select: none;
  display: flex; overflow: hidden;
  transition: box-shadow .15s, border-color .15s;
}
.node:hover         { box-shadow: 0 4px 22px rgba(0,0,0,0.17); border-color: #cbd5e1; }
.node.sel           { border-color: var(--nc, var(--accent)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--nc, var(--accent)) 22%, transparent), var(--node-shadow); }
.node.conn-src      { border-color: #22c55e;        box-shadow: 0 0 0 3px rgba(34,197,94,0.22),  var(--node-shadow); }
.node:active        { cursor: grabbing; }

.node-bar  { width: 4px; flex-shrink: 0; }
.node-body { flex: 1; padding: 10px 12px; min-width: 0; }

.node-title   { font-size: 13px; font-weight: 600; color: #1e293b; word-break: break-word; line-height: 1.45; overflow: hidden; }
.node-title .katex { font-size: 1em; }
.node-preview { font-size: 11px; color: #94a3b8; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 230px; }

/* ── Panel ───────────────────────────────────────────────── */
#panel {
  position: absolute; right: 0; top: 0; bottom: 0;
  width: var(--panel-w); background: #fff;
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .2s ease;
  z-index: 50;
  box-shadow: -4px 0 20px rgba(0,0,0,0.07);
}
#panel.open { transform: translateX(0); }

/* ── Panel resize handle ─────────────────────────────────── */
#panel-resize-handle {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 8px;
  cursor: ew-resize;
  z-index: 10;
  transition: background .15s;
}
#panel-resize-handle::before {
  content: '';
  position: absolute;
  left: 3px; top: 50%; transform: translateY(-50%);
  width: 2px; height: 36px;
  border-radius: 1px;
  background: transparent;
  transition: background .15s;
}
#panel-resize-handle:hover::before,
#panel-resize-handle.dragging::before {
  background: var(--accent);
  opacity: 0.55;
}
#panel-resize-handle:hover,
#panel-resize-handle.dragging {
  background: rgba(99,102,241,0.07);
}

.panel-hd {
  padding: 15px 16px 12px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.panel-hd-title { font-size: 14px; font-weight: 600; color: #0f172a; }

.panel-close {
  width: 28px; height: 28px; border: none; background: none;
  border-radius: 6px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #94a3b8; font-size: 19px; line-height: 1;
  transition: background .15s, color .15s;
}
.panel-close:hover { background: #f1f5f9; color: #1e293b; }

.panel-bd  { flex: 1; overflow-y: auto; padding: 15px; display: flex; flex-direction: column; gap: 13px; }
.panel-ft  { padding: 12px 15px; border-top: 1px solid var(--border); display: flex; gap: 8px; flex-shrink: 0; }

.pf       { display: flex; flex-direction: column; gap: 6px; }
.pf-label { font-size: 10.5px; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: .5px; }

.pi {
  width: 100%; border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 10px; font-size: 13px; color: #1e293b;
  outline: none; transition: border-color .15s;
  font-family: inherit; background: #fff;
}
.pi:focus { border-color: var(--accent); }
textarea.pi {
  resize: vertical; min-height: 96px;
  font-family: 'Consolas', 'Fira Code', monospace;
  font-size: 12px; line-height: 1.5;
}

/* ── Content editor: line-number gutter + resizable textarea ── */
.pf-editor {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  height: 160px;       /* fixed initial height */
  min-height: 72px;
  resize: vertical;    /* user drags the wrapper, not the textarea */
}
.pf-ln-gutter {
  flex-shrink: 0;
  width: 36px;
  padding: 8px 6px 8px 0;
  background: #f1f5f9;
  border-right: 1px solid var(--border);
  color: #94a3b8;
  font-family: 'Consolas', 'Fira Code', monospace;
  font-size: 12px;
  line-height: 1.5;
  text-align: right;
  white-space: pre;
  overflow-y: hidden;
  user-select: none;
  pointer-events: none;
}
.pf-editor textarea.pi {
  flex: 1;
  height: 100%;        /* fill wrapper */
  border: none;
  border-radius: 0;
  resize: none;        /* wrapper handles resize */
  min-height: 0;
  padding-left: 8px;
  box-shadow: none;
}
.pf-editor textarea.pi:focus { border-color: transparent; }

.preview-box {
  background: #f8fafc; border: 1px solid var(--border); border-radius: 6px;
  padding: 12px; height: 160px; min-height: 60px; font-size: 14px; line-height: 1.7;
  overflow: auto;
  resize: vertical;
}

.pf-label-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; width: 100%;
}
.align-btn {
  padding: 2px 8px; font-size: 11px; font-weight: 500; cursor: pointer;
  background: #e0e7ff; color: #3730a3; border: 1px solid #c7d2fe;
  border-radius: 4px; white-space: nowrap; flex-shrink: 0;
  transition: background .15s;
}
.align-btn:hover { background: #c7d2fe; }
.para-hl { background: #fef08a; border-radius: 2px; }

.color-row { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.cswatch {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid transparent; cursor: pointer; flex-shrink: 0;
  transition: border-color .15s, transform .1s;
}
.cswatch.active { border-color: #1e293b; transform: scale(1.15); }
.cswatch:hover  { transform: scale(1.1); }

.btn-del {
  flex: 1; padding: 8px; background: #fee2e2; color: #dc2626;
  border: none; border-radius: 6px; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: background .15s;
}
.btn-del:hover { background: #fecaca; }

.edge-info-box {
  font-size: 13px; color: #475569; padding: 8px 10px;
  background: #f8fafc; border-radius: 6px; border: 1px solid var(--border);
  display: flex; align-items: center; gap: 6px;
}
.edge-arrow-sym { color: var(--accent); font-weight: 700; }

/* ── Inline Prompt ───────────────────────────────────────── */
#ip { position: absolute; z-index: 200; display: none; }
#ip.show { display: block; }

.ip-box {
  background: #fff; border: 2px solid var(--accent); border-radius: 9px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  padding: 11px; display: flex; flex-direction: column;
  gap: 7px; min-width: 210px;
}
.ip-lbl  { font-size: 10.5px; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: .4px; }
.ip-in   { border: 1px solid var(--border); border-radius: 5px; padding: 7px 10px; font-size: 13px; outline: none; font-family: inherit; width: 100%; transition: border-color .15s; }
.ip-in:focus { border-color: var(--accent); }
.ip-hint { font-size: 10px; color: #94a3b8; }

/* ── Status bar ──────────────────────────────────────────── */
#status {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  background: rgba(15,23,42,0.82); backdrop-filter: blur(8px);
  color: #e2e8f0; font-size: 12px; padding: 6px 15px; border-radius: 20px;
  pointer-events: none; opacity: 0; transition: opacity .2s; white-space: nowrap;
}
#status.on { opacity: 1; }

/* ── Search-match highlight ──────────────────────────────── */
.node.search-match {
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245,158,11,0.28), var(--node-shadow);
}

/* ── Search Widget (toolbar-embedded) ────────────────────── */
#sm-widget {
  position: relative;   /* dropdown anchors to this */
  display: flex;
  align-items: center;
  flex-shrink: 0;
  width: 230px;
  font-family: inherit;
}

#sm-bar {
  display: flex;
  align-items: center;
  width: 100%;
  background: rgba(255,255,255,0.08);
  border: 1.5px solid rgba(255,255,255,0.13);
  border-radius: 7px;
  padding: 0 5px 0 9px;
  height: 32px;
  gap: 3px;
  transition: border-color .15s, background .15s;
}
#sm-bar:focus-within {
  background: rgba(255,255,255,0.13);
  border-color: var(--accent2);
}

.sm-icon {
  width: 13px; height: 13px;
  flex-shrink: 0;
  color: rgba(255,255,255,0.4);
  pointer-events: none;
}

#sm-input {
  flex: 1;
  border: none; outline: none;
  font-size: 12.5px;
  color: #e2e8f0;
  background: transparent;
  font-family: inherit;
  min-width: 0;
}
#sm-input::placeholder { color: rgba(255,255,255,0.30); }

.sm-icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 24px; height: 24px;
  border: none; background: transparent; border-radius: 5px;
  cursor: pointer; color: rgba(255,255,255,0.40);
  transition: background .13s, color .13s;
  flex-shrink: 0;
  padding: 0;
}
.sm-icon-btn svg { width: 12px; height: 12px; }
.sm-icon-btn:hover { background: rgba(255,255,255,0.10); color: #e2e8f0; }

/* Clear button: hidden by default */
#sm-clear { display: none; }
#sm-clear.visible { display: flex; }

.sm-divider {
  width: 1px; height: 16px;
  background: rgba(255,255,255,0.13);
  flex-shrink: 0;
  margin: 0 1px;
}

.sm-go:hover { background: rgba(99,102,241,0.25); color: var(--accent2); }

/* ── Search Dropdown ─────────────────────────────────────── */
#sm-dropdown {
  position: absolute;
  top: calc(100% + 7px);
  left: 0;
  width: 100%;
  min-width: 220px;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.15);
  overflow: hidden;
  display: none;
  z-index: 300;
}
#sm-dropdown.open { display: block; }

.sd-item {
  padding: 9px 12px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  transition: background .12s;
}
.sd-item:last-child { border-bottom: none; }
.sd-item:hover { background: #f8fafc; }

.sd-title {
  font-size: 13px; font-weight: 600; color: #1e293b;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sd-sub {
  font-size: 11px; color: #94a3b8; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Highlight matched text inside suggestions */
.sd-title mark,
.sd-sub   mark {
  background: rgba(245,158,11,0.22);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

/* ── Edge labels layer (HTML div inside #canvas-world) ───── */
#edge-labels { position: absolute; top: 0; left: 0; pointer-events: none; }

/* ── Edge label ──────────────────────────────────────────── */
.e-lbl {
  position: absolute;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  color: #475569;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  pointer-events: none;
}

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* ── Secure Save / Load toolbar buttons ──────────────────── */
.tb-btn-enc {
  color: #a5b4fc;
}
.tb-btn-enc:hover {
  background: rgba(99,102,241,0.15);
  color: #c7d2fe;
}

/* ── CryptoIO Modal backdrop ─────────────────────────────── */
.cio-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(10, 12, 28, 0.55);
  backdrop-filter: blur(3px);
  z-index: 900;
}
.cio-backdrop.open { display: block; }

/* ── CryptoIO Modal ──────────────────────────────────────── */
.cio-modal {
  display: none;
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 910;
  width: 520px; max-width: calc(100vw - 32px);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.22), 0 2px 8px rgba(0,0,0,0.08);
  flex-direction: column;
  overflow: hidden;
  animation: cio-pop .18s ease;
}
.cio-modal.open { display: flex; }

@keyframes cio-pop {
  from { opacity: 0; transform: translate(-50%, -48%) scale(.96); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.cio-modal-hd {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 15px; font-weight: 700; color: #0f172a;
  flex-shrink: 0;
}

.cio-modal-icon {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px;
  background: rgba(99,102,241,0.1);
  color: var(--accent); flex-shrink: 0;
}
.cio-modal-icon svg { width: 18px; height: 18px; }

.cio-modal-bd {
  padding: 18px 20px 14px;
  display: flex; flex-direction: column; gap: 16px;
}

.cio-modal-ft {
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
  flex-shrink: 0;
}

.cio-desc {
  font-size: 13px; color: #475569; line-height: 1.6;
}
.cio-desc strong { color: #1e293b; }

/* ── N input row ─────────────────────────────────────────── */
.cio-field { display: flex; flex-direction: column; gap: 6px; }

.cio-label {
  font-size: 10.5px; font-weight: 700;
  color: #64748b; text-transform: uppercase; letter-spacing: .5px;
}

.cio-n-row {
  display: flex; align-items: center; gap: 12px;
}

.cio-n-inp {
  width: 72px;
  border: 1.5px solid var(--border); border-radius: 7px;
  padding: 7px 10px; font-size: 15px; font-weight: 600;
  color: #1e293b; outline: none; font-family: inherit;
  text-align: center;
  transition: border-color .15s;
}
.cio-n-inp:focus { border-color: var(--accent); }

.cio-n-hint {
  font-size: 12px; color: #94a3b8;
}

/* ── Status line ─────────────────────────────────────────── */
.cio-status {
  font-size: 12px; color: var(--accent);
  min-height: 18px; font-weight: 500;
}

/* ── Drop zones ──────────────────────────────────────────── */
.cio-zones {
  display: flex; align-items: center; gap: 10px;
}

.cio-zone-wrap { flex: 1; }

.cio-zone-sep {
  font-size: 18px; font-weight: 300; color: #cbd5e1;
  flex-shrink: 0; padding-top: 8px;
}

.cio-drop-zone {
  border: 2px dashed #cbd5e1;
  border-radius: 10px;
  padding: 20px 14px 16px;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-align: center;
  transition: border-color .15s, background .15s;
  user-select: none;
}
.cio-drop-zone:hover,
.cio-drop-zone:focus { border-color: var(--accent); background: rgba(99,102,241,0.04); outline: none; }

.cio-drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(99,102,241,0.08);
}

.cio-drop-zone.loaded {
  border-color: #22c55e;
  background: rgba(34,197,94,0.04);
}

.cio-drop-zone svg {
  width: 28px; height: 28px;
  color: #94a3b8;
  flex-shrink: 0;
}
.cio-drop-zone.loaded svg { color: #22c55e; }

.cio-zone-label {
  font-size: 12px; font-weight: 700; color: #475569;
}
.cio-zone-sub {
  font-size: 11px; color: #94a3b8;
  word-break: break-all; max-width: 100%;
}
.cio-drop-zone.loaded .cio-zone-sub { color: #16a34a; font-weight: 600; }

.cio-zone-ext {
  font-size: 10px; color: #cbd5e1;
  font-family: 'Consolas', 'Fira Code', monospace;
  margin-top: 2px;
}

/* ── Modal buttons ───────────────────────────────────────── */
.cio-btn-ghost {
  padding: 8px 16px;
  border: 1.5px solid var(--border); border-radius: 7px;
  background: none; color: #64748b;
  font-size: 13px; font-weight: 500; font-family: inherit;
  cursor: pointer;
  transition: background .13s, color .13s, border-color .13s;
}
.cio-btn-ghost:hover { background: #f8fafc; color: #1e293b; border-color: #cbd5e1; }

.cio-btn-primary {
  padding: 8px 18px;
  border: none; border-radius: 7px;
  background: var(--accent); color: #fff;
  font-size: 13px; font-weight: 600; font-family: inherit;
  cursor: pointer;
  transition: background .13s, opacity .13s;
}
.cio-btn-primary:hover:not(:disabled) { background: #4f46e5; }
.cio-btn-primary:disabled {
  opacity: .45; cursor: not-allowed;
}

/* ══════════════════════════════════════════════════════════
   Dark Mode  —  applied via  body.dark
   ══════════════════════════════════════════════════════════ */

/* ── Dark mode palette variables ─────────────────────────── */
body.dark {
  --border:      #252845;
  --node-shadow: 0 2px 16px rgba(0,0,0,0.45);
  color-scheme: dark;
}

/* ── Dark mode toggle button ─────────────────────────────── */
#btn-dark {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border: none; border-radius: 7px;
  background: transparent; color: rgba(255,255,255,0.45);
  cursor: pointer;
  transition: background .15s, color .15s;
  flex-shrink: 0; padding: 0;
}
#btn-dark:hover { background: rgba(255,255,255,0.09); color: #e2e8f0; }
#btn-dark svg { width: 16px; height: 16px; }

/* Show moon in light mode, sun in dark mode */
#btn-dark .icon-moon { display: block; }
#btn-dark .icon-sun  { display: none;  }
body.dark #btn-dark .icon-moon { display: none;  }
body.dark #btn-dark .icon-sun  { display: block; }

/* ── Canvas ──────────────────────────────────────────────── */
body.dark #canvas-vp {
  background-color: #0c0e1a;
  background-image: radial-gradient(circle, #191c30 1px, transparent 1px);
}

/* ── Nodes ───────────────────────────────────────────────── */
body.dark .node {
  background: #181b2e;
  border-color: #252845;
  box-shadow: 0 2px 16px rgba(0,0,0,0.45);
}
body.dark .node:hover {
  border-color: #363964;
  box-shadow: 0 4px 24px rgba(0,0,0,0.55);
}
body.dark .node.sel {
  border-color: var(--nc, var(--accent));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--nc, var(--accent)) 28%, transparent), 0 2px 16px rgba(0,0,0,0.45);
}
body.dark .node.conn-src {
  border-color: #22c55e;
  box-shadow: 0 0 0 3px rgba(34,197,94,0.25), 0 2px 16px rgba(0,0,0,0.45);
}
body.dark .node.search-match {
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245,158,11,0.3), 0 2px 16px rgba(0,0,0,0.45);
}
body.dark .node-title   { color: #dde1f0; }
body.dark .node-preview { color: #4a5070; }
body.dark .cswatch.active { border-color: #e2e8f0; }

/* ── Side Panel ──────────────────────────────────────────── */
body.dark #panel          { background: #12152a; box-shadow: -4px 0 24px rgba(0,0,0,0.4); }
body.dark #panel-resize-handle:hover,
body.dark #panel-resize-handle.dragging { background: rgba(99,102,241,0.18); }
body.dark .panel-hd-title { color: #dde1f0; }
body.dark .panel-close    { color: #4a5070; }
body.dark .panel-close:hover { background: #1e2138; color: #dde1f0; }
body.dark .pf-label       { color: #4a5070; }
body.dark .pi {
  background: #0c0e1a; color: #dde1f0;
  border-color: #252845;
}
body.dark .pf-editor { background: #0c0e1a; border-color: #252845; }
body.dark .pf-ln-gutter { background: #08090f; color: #3a3f60; border-right-color: #252845; }
body.dark .pi:focus { border-color: var(--accent); }
body.dark textarea.pi { color: #c8ccdf; }
body.dark .preview-box {
  background: #0c0e1a; border-color: #252845;
  color: #b8bcd0;
}
body.dark .align-btn { background: #1e2040; color: #818cf8; border-color: #2e3260; }
body.dark .align-btn:hover { background: #2e3260; }
body.dark .para-hl { background: #713f12; }
body.dark .btn-del       { background: #2b1515; color: #f87171; }
body.dark .btn-del:hover { background: #3a1a1a; }
body.dark .edge-info-box { background: #0c0e1a; border-color: #252845; color: #7a80a0; }

/* ── Inline Prompt ───────────────────────────────────────── */
body.dark .ip-box  { background: #181b2e; box-shadow: 0 8px 32px rgba(0,0,0,0.5); }
body.dark .ip-lbl  { color: #4a5070; }
body.dark .ip-in   { background: #0c0e1a; color: #dde1f0; border-color: #252845; }

/* ── Edge label ──────────────────────────────────────────── */
body.dark .e-lbl {
  background: #181b2e;
  border-color: #252845;
  color: #7a80a0;
  box-shadow: 0 1px 6px rgba(0,0,0,0.3);
}

/* ── Search dropdown ─────────────────────────────────────── */
body.dark #sm-dropdown {
  background: #181b2e;
  border-color: #252845;
  box-shadow: 0 8px 28px rgba(0,0,0,0.45);
}
body.dark .sd-item            { border-bottom-color: #1a1e33; }
body.dark .sd-item:hover      { background: #1e2138; }
body.dark .sd-title           { color: #dde1f0; }
body.dark .sd-sub             { color: #4a5070; }
body.dark .sd-title mark,
body.dark .sd-sub   mark      { background: rgba(245,158,11,0.18); }

/* ── Scrollbar ───────────────────────────────────────────── */
body.dark ::-webkit-scrollbar-thumb { background: #252845; }

/* ── CryptoIO Modals ─────────────────────────────────────── */
body.dark .cio-modal {
  background: #181b2e;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 2px 8px rgba(0,0,0,0.3);
}
body.dark .cio-modal-hd { border-bottom-color: #252845; color: #dde1f0; }
body.dark .cio-modal-ft { border-top-color: #252845; }
body.dark .cio-desc          { color: #7a80a0; }
body.dark .cio-desc strong   { color: #b8bcd0; }
body.dark .cio-label         { color: #4a5070; }
body.dark .cio-n-inp {
  background: #0c0e1a; color: #dde1f0; border-color: #252845;
}
body.dark .cio-n-hint        { color: #4a5070; }
body.dark .cio-zone-sep      { color: #252845; }
body.dark .cio-drop-zone     { border-color: #252845; }
body.dark .cio-drop-zone:hover,
body.dark .cio-drop-zone:focus { background: rgba(99,102,241,0.07); border-color: var(--accent); }
body.dark .cio-drop-zone.drag-over { background: rgba(99,102,241,0.12); }
body.dark .cio-drop-zone svg { color: #4a5070; }
body.dark .cio-zone-label    { color: #7a80a0; }
body.dark .cio-zone-sub      { color: #4a5070; }
body.dark .cio-zone-ext      { color: #252845; }
body.dark .cio-status        { color: var(--accent2); }
body.dark .cio-btn-ghost {
  border-color: #252845; color: #7a80a0;
}
body.dark .cio-btn-ghost:hover {
  background: #0c0e1a; color: #dde1f0; border-color: #363964;
}
