/* ==========================================================================
   Projekt-Atlas — Obsidian Dark Cockpit Whiteboard (matches board.vjbackhaus.de)
   ========================================================================== */

:root {
  --bg-base: #07090f;
  --bg-surface: #0d111d;
  --bg-elevated: rgba(16, 21, 34, 0.86);
  --bg-card: rgba(19, 25, 40, 0.88);
  --bg-card-hover: rgba(27, 35, 56, 0.96);
  --bg-glass-strong: rgba(11, 14, 24, 0.92);
  --bg-input: rgba(8, 11, 19, 0.78);

  --text-primary: #f3f6fc;
  --text-secondary: #a2acc4;
  --text-muted: #68738e;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(255, 255, 255, 0.18);
  --shadow-card: 0 14px 36px -10px rgba(0, 0, 0, 0.65), 0 2px 10px rgba(0, 0, 0, 0.4);
  --shadow-glow-cyan: 0 0 24px rgba(56, 189, 248, 0.25);

  --accent-cyan: #38bdf8;
  --accent-emerald: #10b981;
  --accent-gold: #f5b82e;
  --accent-crimson: #ff2a5c;
  --accent-violet: #a78bfa;
  --accent-pink: #f472b6;

  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-md: 11px;
  --radius-sm: 8px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  touch-action: none;
}

button, input, select, textarea {
  font-family: inherit;
  color: inherit;
}

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 10%, rgba(56, 189, 248, 0.08), transparent 36%),
    radial-gradient(circle at 86% 14%, rgba(16, 185, 129, 0.07), transparent 34%),
    radial-gradient(circle at 75% 88%, rgba(255, 42, 92, 0.06), transparent 36%),
    var(--bg-base);
}

/* ==========================================================================
   Top Command Bar
   ========================================================================== */
.topbar {
  position: relative;
  z-index: 40;
  background: var(--bg-glass-strong);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-subtle);
  padding: calc(10px + env(safe-area-inset-top)) 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.topbar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.topbar-main {
  justify-content: space-between;
  flex-wrap: nowrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.16);
}

.brand-title-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand h1 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.version-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.34);
  letter-spacing: 0.02em;
}

.brand-sub {
  font-size: 0.74rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Search Box */
.search-box {
  position: relative;
  flex: 1 1 280px;
  max-width: 420px;
  min-width: 150px;
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.95rem;
  pointer-events: none;
}

.search-box input {
  width: 100%;
  height: 36px;
  padding: 0 32px 0 32px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  font-size: 0.84rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.search-box input:focus {
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.14);
}

.search-clear {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

/* Action Buttons */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.view-switch {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 2px;
}

.view-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.view-btn.active {
  background: rgba(56, 189, 248, 0.18);
  color: var(--text-primary);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.35);
}

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 34px;
  padding: 0 11px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.11);
  border-color: var(--border-highlight);
}

.action-btn.primary {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.24), rgba(16, 185, 129, 0.22));
  border-color: rgba(56, 189, 248, 0.45);
  color: #e0f2fe;
}

.action-btn.primary:hover {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.34), rgba(16, 185, 129, 0.32));
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.22);
}

.action-btn.active-mode {
  background: rgba(245, 184, 46, 0.2);
  border-color: rgba(245, 184, 46, 0.55);
  color: #fde68a;
}

.action-btn.danger {
  background: rgba(255, 42, 92, 0.14);
  border-color: rgba(255, 42, 92, 0.38);
  color: #fda4af;
}

.action-btn.danger:hover {
  background: rgba(255, 42, 92, 0.26);
}

.action-btn.icon-only {
  width: 34px;
  padding: 0;
}

.action-btn.small {
  height: 30px;
  padding: 0 10px;
  font-size: 0.76rem;
}

.action-btn.full-width {
  width: 100%;
}

/* Filter Strip */
.topbar-filters {
  justify-content: space-between;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.topbar-filters::-webkit-scrollbar { display: none; }

.filter-group, .island-jumps {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.pill {
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-secondary);
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.pill:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.pill.active {
  color: #e0f2fe;
  background: rgba(56, 189, 248, 0.2);
  border-color: rgba(56, 189, 248, 0.52);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.18);
}

.pill-auto.active {
  color: #d1fae5;
  background: rgba(16, 185, 129, 0.22);
  border-color: rgba(16, 185, 129, 0.58);
}

.pill-idea.active {
  color: #fce7f3;
  background: rgba(244, 114, 182, 0.22);
  border-color: rgba(244, 114, 182, 0.55);
}

.island-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-secondary);
  padding: 3px 7px;
  border-radius: 8px;
  font-size: 0.7rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.island-chip:hover {
  color: var(--text-primary);
  border-color: var(--chip-color, var(--accent-cyan));
  background: rgba(255, 255, 255, 0.07);
}

.island-chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--chip-color, var(--accent-cyan));
  box-shadow: 0 0 8px var(--chip-color, var(--accent-cyan));
}

/* Connect Mode Banner */
.connect-banner {
  position: relative;
  z-index: 35;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 7px 14px;
  background: linear-gradient(90deg, rgba(245, 184, 46, 0.18), rgba(56, 189, 248, 0.18));
  border-bottom: 1px solid rgba(245, 184, 46, 0.4);
  font-size: 0.82rem;
  color: #fef3c7;
}

/* ==========================================================================
   Main Workspace & Interactive Whiteboard
   ========================================================================== */
.workspace {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
}

.board-viewport {
  position: relative;
  flex: 1;
  width: 100%;
  height: 100%;
  overflow: hidden;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.board-viewport.panning {
  cursor: grabbing;
}

.board-viewport.connect-cursor {
  cursor: crosshair;
}

/* Dot Grid Background */
.board-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(148, 163, 184, 0.22) 1.25px, transparent 1.25px);
  background-size: 28px 28px;
  opacity: 0.72;
}

.board-world {
  position: absolute;
  top: 0;
  left: 0;
  width: 3200px;
  height: 2200px;
  transform-origin: 0 0;
  will-change: transform;
}

/* Topic Islands */
.islands-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.island-zone {
  position: absolute;
  border-radius: 26px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--island-color) 9%, rgba(13, 18, 30, 0.62)), rgba(10, 14, 24, 0.42));
  border: 1.5px dashed color-mix(in srgb, var(--island-color) 36%, transparent);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--island-color) 25%, transparent),
    0 0 60px -20px color-mix(in srgb, var(--island-color) 30%, transparent);
  transition: opacity 0.22s ease, border-color 0.22s ease;
}

.island-zone.dimmed {
  opacity: 0.28;
}

.island-header {
  position: absolute;
  top: -15px;
  left: 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(9, 13, 22, 0.94);
  border: 1px solid color-mix(in srgb, var(--island-color) 55%, transparent);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45), 0 0 18px color-mix(in srgb, var(--island-color) 24%, transparent);
  pointer-events: auto;
  cursor: pointer;
}

.island-header-icon {
  font-size: 1rem;
}

.island-header-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.island-header-count {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--island-color);
  background: color-mix(in srgb, var(--island-color) 16%, transparent);
  padding: 1px 6px;
  border-radius: 999px;
}

/* SVG Glowing Connection Lines */
.edges-layer {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  overflow: visible;
}

.edge-path-glow {
  fill: none;
  stroke-width: 5.5;
  opacity: 0.16;
  transition: opacity 0.2s ease, stroke-width 0.2s ease;
}

.edge-path {
  fill: none;
  stroke-width: 2.1;
  stroke-linecap: round;
  opacity: 0.72;
  transition: opacity 0.2s ease, stroke-width 0.2s ease;
}

.edge-path.kind-auto {
  stroke-dasharray: 8 6;
  animation: flowDash 1.4s linear infinite;
}

.edge-path.kind-planned {
  stroke-dasharray: 5 6;
  opacity: 0.55;
}

.edge-group.highlighted .edge-path {
  opacity: 1;
  stroke-width: 2.9;
}

.edge-group.highlighted .edge-path-glow {
  opacity: 0.42;
  stroke-width: 8;
}

.edge-group.dimmed {
  opacity: 0.12;
}

.edge-label-pill {
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.edge-label-pill.dimmed {
  opacity: 0.12;
}

.edge-label-bg {
  fill: rgba(9, 13, 22, 0.92);
  stroke-width: 1;
  rx: 7;
  ry: 7;
}

.edge-label-text {
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 600;
  fill: #dbe4f6;
  text-anchor: middle;
  dominant-baseline: central;
}

@keyframes flowDash {
  from { stroke-dashoffset: 28; }
  to { stroke-dashoffset: 0; }
}

/* ==========================================================================
   Project / Automation Nodes (Obsidian Glass Cards)
   ========================================================================== */
.nodes-layer {
  position: absolute;
  inset: 0;
}

.node-card {
  position: absolute;
  width: 274px;
  border-radius: 15px;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-top: 2.5px solid var(--node-color, var(--accent-cyan));
  box-shadow: var(--shadow-card);
  padding: 12px 13px 11px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  cursor: pointer;
  transition: box-shadow 0.18s ease, border-color 0.18s ease, opacity 0.2s ease, transform 0.15s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.node-card:hover {
  background: var(--bg-card-hover);
  border-color: color-mix(in srgb, var(--node-color, var(--accent-cyan)) 55%, rgba(255, 255, 255, 0.2));
  box-shadow:
    0 18px 40px -10px rgba(0, 0, 0, 0.72),
    0 0 24px color-mix(in srgb, var(--node-color, var(--accent-cyan)) 26%, transparent);
  z-index: 12;
}

.node-card.selected {
  border-color: var(--node-color, var(--accent-cyan));
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--node-color, var(--accent-cyan)) 48%, transparent),
    0 0 34px color-mix(in srgb, var(--node-color, var(--accent-cyan)) 35%, transparent),
    var(--shadow-card);
  z-index: 18;
}

.node-card.connected-highlight {
  border-color: color-mix(in srgb, var(--node-color, var(--accent-cyan)) 70%, white 20%);
  box-shadow: 0 0 24px color-mix(in srgb, var(--node-color, var(--accent-cyan)) 28%, transparent);
  z-index: 14;
}

.node-card.connect-source {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 3px rgba(245, 184, 46, 0.45), 0 0 30px rgba(245, 184, 46, 0.35);
  z-index: 20;
}

.node-card.dragging {
  cursor: grabbing;
  transform: scale(1.025);
  box-shadow: 0 26px 56px rgba(0, 0, 0, 0.8), 0 0 32px color-mix(in srgb, var(--node-color) 40%, transparent);
  z-index: 30;
  transition: none;
}

.node-card.dimmed {
  opacity: 0.2;
  filter: saturate(0.45);
}

.node-card.search-match {
  box-shadow: 0 0 0 2px rgba(245, 184, 46, 0.75), 0 0 28px rgba(245, 184, 46, 0.3);
}

.node-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.node-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.node-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 1.02rem;
  flex-shrink: 0;
  background: color-mix(in srgb, var(--node-color, var(--accent-cyan)) 14%, rgba(255, 255, 255, 0.04));
  border: 1px solid color-mix(in srgb, var(--node-color, var(--accent-cyan)) 34%, transparent);
}

.node-title {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
}

.node-open-btn {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  text-decoration: none;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  font-size: 0.76rem;
  transition: all 0.14s ease;
}

.node-open-btn:hover {
  color: #fff;
  background: color-mix(in srgb, var(--node-color) 32%, transparent);
  border-color: var(--node-color);
}

.node-desc {
  font-size: 0.75rem;
  line-height: 1.42;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.node-trigger-line {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: #a7f3d0;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.24);
  border-radius: 7px;
  padding: 3px 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.node-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 2px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.node-badges {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.66rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
}

.badge-type {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.badge-status-auto {
  background: rgba(16, 185, 129, 0.16);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.42);
}

.badge-status-active {
  background: rgba(56, 189, 248, 0.15);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.36);
}

.badge-status-wip {
  background: rgba(245, 184, 46, 0.16);
  color: #fcd34d;
  border: 1px solid rgba(245, 184, 46, 0.4);
}

.badge-status-idea {
  background: rgba(244, 114, 182, 0.16);
  color: #f9a8d4;
  border: 1px solid rgba(244, 114, 182, 0.4);
}

.badge-status-archive {
  background: rgba(148, 163, 184, 0.14);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.node-count-chip {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Floating HUD: Legend, Zoom Controls, Minimap
   ========================================================================== */
.hud-legend {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: 11px;
  background: var(--bg-glass-strong);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  font-size: 0.71rem;
  color: var(--text-secondary);
  pointer-events: auto;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-sep { color: var(--text-muted); }

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.dot-auto { background: var(--accent-emerald); box-shadow: 0 0 8px var(--accent-emerald); }
.dot-active { background: var(--accent-cyan); box-shadow: 0 0 8px var(--accent-cyan); }
.dot-wip { background: var(--accent-gold); }
.dot-idea { background: var(--accent-pink); }

.line-sample {
  width: 16px;
  height: 0;
  display: inline-block;
  border-top: 2px solid var(--accent-cyan);
}
.line-sample.dashed {
  border-top-style: dashed;
  border-color: var(--accent-pink);
}

.hud-controls {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 14px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--bg-glass-strong);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-card);
}

.hud-btn {
  height: 30px;
  min-width: 30px;
  padding: 0 8px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.14s ease;
}

.hud-btn:hover {
  background: rgba(56, 189, 248, 0.22);
}

.hud-btn.wide {
  font-size: 0.76rem;
  padding: 0 10px;
}

.zoom-readout {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-secondary);
  min-width: 46px;
  text-align: center;
}

.minimap-wrap {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 20;
  border-radius: 14px;
  background: var(--bg-glass-strong);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-card);
  padding: 7px 8px 6px;
}

.minimap-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.66rem;
  color: var(--text-secondary);
  margin-bottom: 5px;
  padding: 0 2px;
}

.minimap-hint {
  color: var(--text-muted);
}

#minimapCanvas {
  display: block;
  border-radius: 8px;
  background: rgba(5, 7, 13, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: crosshair;
}

/* ==========================================================================
   Slide-Over Inspector / Editor Drawer
   ========================================================================== */
.inspector {
  position: absolute;
  top: 12px;
  right: 12px;
  bottom: 12px;
  width: 390px;
  max-width: calc(100vw - 24px);
  z-index: 32;
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  background: rgba(12, 16, 28, 0.95);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border: 1px solid var(--border-highlight);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.75);
  overflow: hidden;
  touch-action: pan-y;
}

.inspector[hidden] {
  display: none;
}

.inspector-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.02);
}

.inspector-title-wrap {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.inspector-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  flex-shrink: 0;
}

.inspector-header h2 {
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.25;
}

.inspector-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 5px;
}

.close-btn {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}

.inspector-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.insp-summary {
  font-size: 0.86rem;
  line-height: 1.55;
  color: #dbe4f6;
}

.insp-actions-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.insp-actions-bar a.action-btn {
  text-decoration: none;
}

.insp-section {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.insp-section h3 {
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 700;
}

.insp-trigger-box {
  font-family: var(--font-mono);
  font-size: 0.77rem;
  line-height: 1.5;
  color: #a7f3d0;
  background: rgba(16, 185, 129, 0.11);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 10px;
  padding: 9px 11px;
}

.shortcut-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.shortcut-tag {
  font-size: 0.74rem;
  padding: 4px 9px;
  border-radius: 8px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.24);
  color: #bae6fd;
}

.meta-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  font-size: 0.79rem;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-subtle);
  border-radius: 11px;
  padding: 10px 12px;
}

.meta-grid dt {
  color: var(--text-muted);
  font-weight: 600;
}

.meta-grid dd {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  word-break: break-word;
}

.conn-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.conn-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  font-size: 0.78rem;
}

.conn-jump {
  border: none;
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  flex: 1;
  font-size: 0.78rem;
}

.conn-jump:hover {
  color: var(--accent-cyan);
}

.conn-label-sub {
  display: block;
  font-size: 0.69rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.conn-remove {
  border: none;
  background: rgba(255, 42, 92, 0.12);
  color: #fda4af;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}

.insp-notes {
  font-size: 0.81rem;
  line-height: 1.55;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 10px 12px;
  white-space: pre-wrap;
}

.inspector-footer-actions {
  display: flex;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
  margin-top: auto;
}

.inspector-footer-actions .action-btn {
  flex: 1;
}

/* Edit Form */
#inspEditForm label, .modal-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.76rem;
  color: var(--text-secondary);
  font-weight: 600;
}

#inspEditForm input,
#inspEditForm select,
#inspEditForm textarea,
.modal-form input,
.modal-form select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.83rem;
  outline: none;
}

#inspEditForm input:focus,
#inspEditForm select:focus,
#inspEditForm textarea:focus,
.modal-form input:focus,
.modal-form select:focus {
  border-color: rgba(56, 189, 248, 0.58);
}

.form-row.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ==========================================================================
   Compact List View (great for iPhone & scanning)
   ========================================================================== */
.list-view {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px 40px;
  touch-action: pan-y;
}

.list-view[hidden] {
  display: none;
}

.list-container {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.list-island-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.list-island-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 700;
  padding-bottom: 8px;
  border-bottom: 1px solid color-mix(in srgb, var(--island-color) 35%, transparent);
}

.list-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 12px;
}

.list-card {
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--node-color, var(--accent-cyan));
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease;
}

.list-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--node-color) 60%, transparent);
}

/* ==========================================================================
   Status Footer (with Mandatory Version Number)
   ========================================================================== */
.statusbar {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 16px calc(6px + env(safe-area-inset-bottom));
  background: rgba(8, 10, 17, 0.94);
  border-top: 1px solid var(--border-subtle);
  font-size: 0.72rem;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.status-left, .status-right {
  display: flex;
  align-items: center;
  gap: 7px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
}

.sep { color: var(--text-muted); }

.footer-link {
  color: var(--accent-cyan);
  text-decoration: none;
  font-weight: 600;
}
.footer-link:hover { text-decoration: underline; }

.hint-text { color: var(--text-muted); }

/* ==========================================================================
   Modals & Toast
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(3, 5, 10, 0.72);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  width: 100%;
  max-width: 440px;
  border-radius: 18px;
  background: #0e1322;
  border: 1px solid var(--border-highlight);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.8);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.modal-desc {
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.modal-actions.inline {
  flex-direction: row;
  justify-content: flex-end;
  margin-top: 6px;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 4px 0;
}

.file-btn {
  cursor: pointer;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 58px;
  transform: translateX(-50%);
  z-index: 80;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(56, 189, 248, 0.48);
  color: #e0f2fe;
  font-size: 0.8rem;
  font-weight: 600;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65), 0 0 20px rgba(56, 189, 248, 0.22);
}

/* ==========================================================================
   Responsive Adjustments (Tablet & iPhone)
   ========================================================================== */
@media (max-width: 1020px) {
  .btn-label { display: none; }
  .hud-legend { display: none; }
  .minimap-wrap { display: none; }
  .hint-text { display: none; }
}

@media (max-width: 720px) {
  .topbar {
    padding: calc(8px + env(safe-area-inset-top)) 10px 7px;
  }
  .topbar-main {
    flex-wrap: wrap;
    gap: 8px;
  }
  .search-box {
    order: 3;
    flex: 1 1 100%;
    max-width: none;
  }
  .brand-sub { display: none; }
  .hide-sm { display: none; }

  .inspector {
    top: auto;
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    max-width: none;
    height: 72dvh;
    border-radius: 20px;
  }

  .hud-controls {
    bottom: 10px;
  }

  .list-view {
    padding: 12px 12px 28px;
  }
}
