/* ABYA Platform Styles */

/* ===================== GLOBAL RESET ===================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }
  
  html,
  body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #0d0d0d;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  }

  :root {
    --abya-accent: #0066cc;
    --abya-accent-hover: #0073e6;
  }
  
  
/* ===================== HEADER BAR (THIN) ===================== */

.header {
    position: fixed; top: 0; left: 0; right: 0;
    height: 48px;
    background: #111;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 16px;
    z-index: 99999;
  }
    
  
/* ===================== LOGO + HOME BUTTON ===================== */

.logo {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
  }
  
  .logo img {
    height: 24px; width: auto;
  }
  



.home-btn {
    height: 28px;
    padding: 0 12px;
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.65);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    font-size: 12px;
    display: flex; align-items: center; justify-content: center;
    white-space: nowrap; cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  }
  .home-btn:hover {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.85);
    border-color: rgba(255,255,255,0.14);
  }
  .home-btn:active { background: rgba(255,255,255,0.08); }
  .home-icon {
    font-size: 12px; color: inherit;
    pointer-events: none; font-weight: 500;
  }

  
  /* ===================== SHARED ROUND HEADER BUTTONS ===================== */
  
  /* Use this for BOTH home and profile buttons */
  .header-round-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;                  /* perfect circle */
    border: 1px solid #444;
    background: #2a2a2a;
  
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
  }
  
  .header-round-btn:hover {
    background: #3a3a3a;
    border-color: #555;
    transform: scale(1.05);
  }
  
  .header-round-btn:active {
    background: #343434;
    transform: scale(0.96);
  }
  
  .header-round-btn-icon {
    font-size: 18px;
    color: #f5f5f7;
  }
  
  
  
/* ===================== PROFILE BUTTON + DROPDOWN ===================== */

.profile-section {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-btn {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.06);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.profile-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.15);
}
.profile-btn:active { background: rgba(255,255,255,0.08); }
.profile-avatar {
  font-size: 11px; font-weight: 600;
  color: rgba(255,255,255,0.65);
  line-height: 1; pointer-events: none;
}

/* Profile dropdown — compact (file-pill size), right edge aligned under profile icon */
.profile-content {
  position: fixed;
  top: 52px;
  right: 16px;
  min-width: 100px;
  width: max-content;
  background: #1c1c1e;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4), 0 0 0 1px rgba(0,0,0,0.15);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 4px;
  overflow: visible;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.96) translateY(-6px);
  transition: opacity 0.2s cubic-bezier(0.23, 1, 0.32, 1),
              transform 0.2s cubic-bezier(0.23, 1, 0.32, 1),
              visibility 0.2s ease;
  z-index: 999999;
}
.profile-content.expanded {
  opacity: 1;
  visibility: visible;
  transform: scale(1) translateY(0);
}

/* Compact rows — file-pill style (tight fit) */
.profile-item {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 6px 10px;
  background: none;
  border: none;
  border-radius: 6px;
  color: rgba(255,255,255,0.88);
  font-size: 11px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
  transition: background 0.12s ease, color 0.12s ease;
}
.profile-item:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.95);
}
/* Profile icons: invert black→white in dark mode at muted opacity */
.profile-item img.profile-item-icon {
  flex-shrink: 0;
  filter: invert(1);
  opacity: 0.6;
  transition: opacity 0.12s ease;
}
.profile-item:hover img.profile-item-icon { opacity: 0.9; }
[data-theme="light"] .profile-item img.profile-item-icon { filter: none; opacity: 0.5; }
[data-theme="light"] .profile-item:hover img.profile-item-icon { opacity: 0.75; }

/* Danger (logout) hover — swap to pre-coloured SVG; fade via opacity to avoid snap */
.profile-item-danger img.profile-item-icon {
  transition: opacity 0.12s ease;
}
.profile-item-danger:hover img.profile-item-icon {
  content: url('/imgs/logout-red-dark.svg');
  filter: none;
  opacity: 1;
}
[data-theme="light"] .profile-item-danger:hover img.profile-item-icon {
  content: url('/imgs/logout-red-light.svg');
  filter: none;
  opacity: 1;
}
.profile-item-danger:hover {
  color: rgba(255,120,120,0.95);
}

/* ===================== FLOATING TOOLBAR (CENTER) ===================== */
  #container {
    position: relative;
    width: 100%;
    height: 100%;
    padding-top: 0;          /* header is fixed */
  }
  
  #toolbar {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    height: 38px;
    background: rgba(20,20,20,0.8);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    padding: 0 6px;
    display: flex; align-items: center; gap: 6px;
    z-index: 9999;
    box-shadow: 0 2px 12px rgba(0,0,0,0.25);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }
  
  #toolbar input {
    height: 26px;
    padding: 0 10px;
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.6);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    font-size: 13px;
  }
  
  #run-btn {
    width: 28px; height: 28px;
    background: var(--abya-accent);
    color: white; border: none;
    border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: bold; padding: 0; line-height: 0;
    transition: background 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 1px 6px rgba(0,102,204,0.25);
  }
  #run-btn img.run-btn-icon,
  #run-btn .run-btn-icon {
    display: block;
    margin: 0;
    object-position: center center;
  }
  #run-btn:hover { background: var(--abya-accent-hover); box-shadow: 0 2px 10px rgba(0,102,204,0.35); }
  #run-btn:disabled { opacity: 0.4; box-shadow: none; cursor: not-allowed; }

  @keyframes toolbarRunPulse {
    0%, 100% { box-shadow: 0 1px 6px rgba(0,102,204,0.25); }
    50%      { box-shadow: 0 2px 14px rgba(0,102,204,0.5); }
  }
  #run-btn.running {
    animation: toolbarRunPulse 2.2s ease-in-out infinite;
  }
  #run-btn.running img { display: none; }
  #run-btn.running::after {
    content: '';
    width: 10px; height: 10px;
    background: #fff;
    border-radius: 2px;
    display: block;
  }
  
  #toolbar button:not(#run-btn):not(.toolbar-icon-btn) {
    width: auto; height: 26px;
    padding: 0 10px;
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.65);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 13px; font-size: 11px; font-weight: 500;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  }
  #toolbar button:not(#run-btn):not(.toolbar-icon-btn):hover {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.85);
    border-color: rgba(255,255,255,0.14);
  }
  
  #status {
    color: rgba(255,255,255,0.45);
    font-size: 11px;
    white-space: nowrap;
    margin-left: 0;
  }
  

#toolbar .toolbar-file-btn {
    width: auto; height: 26px;
    padding: 0 10px;
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.65);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 13px; font-size: 11px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
  }
  #toolbar .toolbar-file-btn:hover {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.85);
  }
  
  /* ===================== CANVAS (BEHIND EVERYTHING) ===================== */
  
  #graphcanvas { 
    position: absolute;
    top: 48px;                            /* match new header height */
    left: 0;
    width: 100%;
    height: calc(100% - 48px);
    z-index: 1;
    pointer-events: auto;
  }

  /* ===================== NODE CANVAS (#graphRoot) ===================== */
  #graphRoot {
    position: absolute;
    top: 48px; left: 0;
    width: 100%; height: calc(100% - 48px);
    z-index: 1; overflow: auto;
    background: #1a1a1a; cursor: grab;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  #graphRoot::-webkit-scrollbar { display: none; }
  #graphRoot.graph-canvas { padding: 0; box-sizing: border-box; }
  #graphRoot .graph-empty {
    display: flex; align-items: center; justify-content: center;
    height: 100%; min-height: 200px;
    color: rgba(255,255,255,0.65); font-size: 15px; padding: 24px; text-align: center;
  }
  #graphRoot .graph-node-list { position: relative; }
  #graphRoot .graph-pan-backdrop {
    position: absolute; left: 0; top: 0; width: 100%; height: 100%; z-index: 0;
  }

  /* ─── Wires (curved Bezier) ─── */
  #graphRoot .graph-edges-layer {
    position: absolute; left: 0; top: 0; z-index: 1; pointer-events: none;
  }
  #graphRoot .graph-wire {
    stroke-width: 2; fill: none; pointer-events: none;
  }
  #graphRoot .graph-wire-suggested { stroke: #555; }
  #graphRoot .graph-wire-real { stroke: #fff; }
  #graphRoot .graph-wire-dragging {
    stroke: rgba(255,255,255,0.35); stroke-width: 2;
    fill: none; pointer-events: none;
  }

  /* ─── Node card ─── */
  #graphRoot .graph-node-card {
    position: absolute; left: 0; top: 0;
    width: 300px;
    background: #252525;
    border: 1px solid #3a3a3a;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.35);
    user-select: none;
    display: flex; flex-direction: column;
    overflow: visible; z-index: 2;
    outline: none;
    transition: box-shadow 0.18s ease, border-color 0.18s ease;
  }
  #graphRoot .graph-node-card:hover {
    border-color: #484848;
  }
  #graphRoot .graph-node-card.dragging {
    z-index: 100;
    box-shadow: 0 14px 36px rgba(0,0,0,0.55);
    border-color: #0066cc;
  }

  /* ─── AI Suggesting snake-glow ─── */
  @property --glow-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
  }
  @keyframes snakeGlow {
    to { --glow-angle: 360deg; }
  }
  @keyframes snakeGlowOnceDeploy {
    0% { --glow-angle: 0deg; opacity: 1; }
    85% { --glow-angle: 360deg; opacity: 1; }
    100% { --glow-angle: 360deg; opacity: 0; }
  }
  #graphRoot .graph-node-card.ai-suggesting {
    border-color: transparent;
  }
  #graphRoot .graph-node-card.ai-suggesting::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 14px;
    padding: 2px;
    background: conic-gradient(
      from var(--glow-angle),
      transparent 0%,
      transparent 55%,
      #0066cc 70%,
      #4a9eff 80%,
      #0066cc 90%,
      transparent 100%
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    animation: snakeGlow 1.8s linear infinite;
    pointer-events: none;
    z-index: 10;
  }
  #graphRoot .graph-node-card.ai-suggesting::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 18px;
    background: conic-gradient(
      from var(--glow-angle),
      transparent 0%,
      transparent 55%,
      rgba(0,102,204,0.15) 70%,
      rgba(74,158,255,0.2) 80%,
      rgba(0,102,204,0.15) 90%,
      transparent 100%
    );
    filter: blur(8px);
    animation: snakeGlow 1.8s linear infinite;
    pointer-events: none;
    z-index: 11;
  }

  /* ─── Node running: blue border (same as AI suggestion) + light snake, no blur ─── */
  #graphRoot .graph-node-card.node-running {
    border-color: #0066cc;
  }
  #graphRoot .graph-node-card.node-running::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 14px;
    padding: 2px;
    background: conic-gradient(
      from var(--glow-angle),
      transparent 0%,
      transparent 55%,
      #7eb8f7 70%,
      #c8e4ff 80%,
      rgba(255,255,255,0.9) 85%,
      #7eb8f7 90%,
      transparent 100%
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    animation: snakeGlow 1.8s linear infinite;
    pointer-events: none;
    z-index: 10;
  }
  [data-theme="light"] #graphRoot .graph-node-card.node-running {
    border-color: #0066cc;
  }
  [data-theme="light"] #graphRoot .graph-node-card.node-running::before {
    background: conic-gradient(
      from var(--glow-angle),
      transparent 0%,
      transparent 55%,
      #5a9fd4 70%,
      #a8d4f0 80%,
      rgba(255,255,255,0.95) 85%,
      #5a9fd4 90%,
      transparent 100%
    );
  }
  #graphRoot .graph-node-run-btn.running svg { display: none; }
  #graphRoot .graph-node-run-btn.running::after {
    content: '';
    width: 10px; height: 10px;
    background: #fff;
    border-radius: 2px;
    display: block;
  }

  /* ─── Header ─── */
  #graphRoot .graph-node-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px;
    background: #2a2a2a;
    border-bottom: 1px solid #333;
    border-radius: 12px 12px 0 0;
    cursor: grab; flex-shrink: 0;
  }
  #graphRoot .graph-node-card.dragging .graph-node-header { cursor: grabbing; }
  #graphRoot .graph-node-header-left { flex: 1; min-width: 0; overflow: hidden; }
  #graphRoot .graph-node-header-right {
    display: flex; align-items: center; gap: 6px; flex-shrink: 0;
  }
  #graphRoot .graph-node-title {
    font-weight: 600; font-size: 12px; color: #f0f0f0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    display: block; max-width: 100%;
  }
  #graphRoot .graph-node-expand-btn {
    background: none; border: none; color: rgba(255,255,255,0.45);
    cursor: pointer; padding: 2px; line-height: 1;
    display: flex; align-items: center;
    outline: none;
    transition: color 0.15s ease;
  }
  #graphRoot .graph-node-expand-btn:hover { color: rgba(255,255,255,0.7); }
  #graphRoot .graph-node-card.expanded .graph-node-expand-btn svg {
    transform: rotate(180deg);
  }
  #graphRoot .graph-node-delete-btn {
    background: none; border: none; color: rgba(255,255,255,0.45);
    cursor: pointer; padding: 2px; line-height: 1;
    display: flex; align-items: center;
    outline: none;
    transition: color 0.15s ease;
  }
  #graphRoot .graph-node-delete-btn:hover { color: rgba(255,255,255,0.7); }

  /* ─── Slot area ─── */
  #graphRoot .graph-slot-area {
    display: flex; justify-content: space-between;
    padding: 8px 0; border-bottom: 1px solid #2a2a2a;
    background: #232323;
  }
  #graphRoot .graph-slot-col {
    display: flex; flex-direction: column; gap: 4px; padding: 0 8px;
    min-width: 0;
  }
  #graphRoot .graph-slot-col-in { align-items: flex-start; flex: 1; }
  #graphRoot .graph-slot-col-out { align-items: flex-end; flex: 1; }

  #graphRoot .graph-slot {
    display: flex; align-items: center; gap: 6px;
    padding: 3px 6px; position: relative;
    border-radius: 6px;
    background: rgba(255,255,255,0.03);
    transition: background 0.15s ease;
    cursor: crosshair;
  }
  #graphRoot .graph-slot:hover { background: rgba(255,255,255,0.06); }
  #graphRoot .graph-slot.slot-empty {
    background: transparent;
  }
  #graphRoot .graph-slot.slot-empty .graph-slot-label {
    color: rgba(255,255,255,0.18);
    font-style: italic;
  }
  #graphRoot .graph-slot.slot-no-file {
    cursor: default; opacity: 0.45;
  }
  #graphRoot .graph-slot.slot-no-file .graph-port-dot {
    cursor: default;
  }
  #graphRoot .graph-slot.slot-locked {
    pointer-events: none;
    cursor: not-allowed;
    opacity: 0.7;
  }

  /* Port dots: solid fill, minimal hover */
  #graphRoot .graph-port-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: #4a4a4a;
    cursor: crosshair; flex-shrink: 0; z-index: 10;
    transition: background 0.15s ease, box-shadow 0.15s ease;
    pointer-events: auto;
    border: none;
  }
  #graphRoot .graph-port-dot:hover {
    background: #0066cc;
    box-shadow: 0 0 0 3px rgba(0,102,204,0.25);
  }
  #graphRoot .graph-port-dot.connected {
    background: #0066cc;
  }

  /* Slot labels */
  #graphRoot .graph-slot-label {
    font-size: 11px; color: rgba(255,255,255,0.65);
    max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  #graphRoot .graph-slot-label.slot-label-real {
    color: #e0e0e0; font-weight: 500;
  }

  /* ─── Upload progress ring ─── */
  #graphRoot .slot-progress {
    width: 18px; height: 18px; border-radius: 50%;
    background:
      conic-gradient(
        #0066cc calc(var(--prog, 0) * 1%),
        #333 calc(var(--prog, 0) * 1%)
      );
    cursor: pointer; flex-shrink: 0;
    position: relative;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s ease;
    border: none;
  }
  #graphRoot .slot-progress svg {
    opacity: 0;
    color: #888;
    transition: opacity 0.15s ease, color 0.15s ease;
  }
  #graphRoot .slot-progress:hover svg {
    opacity: 1; color: #999;
  }
  #graphRoot .slot-progress.done {
    background: #0066cc;
  }

  /* ─── Body (hidden — tool type removed from visible card) ─── */
  #graphRoot .graph-node-body { display: none; }

  /* ─── Expand panel ─── */
  #graphRoot .graph-node-expand-panel {
    max-height: 0; overflow: hidden;
    padding: 0 12px;
    transition: max-height 0.25s ease, padding 0.25s ease;
  }
  #graphRoot .graph-node-card.expanded .graph-node-expand-panel {
    max-height: 800px;
    padding: 10px 12px;
    border-top: 1px solid #2a2a2a;
    overflow-y: auto;
  }
  #graphRoot .graph-expand-label {
    font-size: 10px; color: rgba(255,255,255,0.45);
    text-transform: uppercase; letter-spacing: 0.5px;
    margin-bottom: 4px; margin-top: 8px;
  }
  #graphRoot .graph-expand-label:first-child { margin-top: 0; }
  #graphRoot .graph-node-params {
    width: 100%; min-height: 36px; max-height: 120px;
    padding: 6px 8px;
    background: #1a1a1a; border: 1px solid #333; border-radius: 6px;
    color: #e0e0e0; font-size: 11px;
    font-family: 'SF Mono', 'Menlo', monospace;
    box-sizing: border-box; resize: vertical;
  }
  #graphRoot .graph-node-params.has-error { border-color: #a44; }

  /* ─── Files dropdown section in expand panel ─── */
  #graphRoot .graph-expand-files-section {
    margin-top: 8px;
  }
  #graphRoot .graph-expand-files-toggle {
    display: flex; align-items: center; gap: 5px;
    background: none; border: none; cursor: pointer;
    color: rgba(255,255,255,0.4);
    font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
    padding: 0; transition: color 0.15s ease;
  }
  #graphRoot .graph-expand-files-toggle:hover { color: rgba(255,255,255,0.6); }
  #graphRoot .graph-expand-files-toggle svg {
    transition: transform 0.2s ease;
  }
  #graphRoot .graph-expand-files-section.open .graph-expand-files-toggle svg,
  #graphRoot .graph-expand-params-section.open .graph-expand-files-toggle svg {
    transform: rotate(180deg);
  }
  #graphRoot .graph-expand-files-body {
    max-height: 0; overflow: hidden;
    transition: max-height 0.2s ease, margin-top 0.2s ease;
    margin-top: 0;
  }
  #graphRoot .graph-expand-files-section.open .graph-expand-files-body {
    max-height: 300px;
    margin-top: 8px;
  }
  #graphRoot .graph-files-table {
    display: flex; gap: 10px;
  }
  #graphRoot .graph-files-col {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; gap: 4px;
    align-items: stretch;
  }
  #graphRoot .graph-files-col-header {
    font-size: 10px; color: rgba(255,255,255,0.45);
    text-transform: uppercase; letter-spacing: 0.4px;
    padding-bottom: 3px; border-bottom: 1px solid #333;
    margin-bottom: 2px;
  }

  /* ─── File pills (Cursor-style rounded rectangles) ─── */
  #graphRoot .graph-file-pill {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 8px;
    border-radius: 5px;
    font-size: 11px; line-height: 1;
    max-width: 100%;
    transition: background 0.15s ease;
  }
  #graphRoot .graph-files-empty {
    font-size: 10px; color: rgba(255,255,255,0.2);
    font-style: italic; padding: 2px 0;
  }
  #graphRoot .graph-file-pill.pill-uploaded {
    background: rgba(0,102,204,0.18);
    color: #8ac4ff;
  }
  #graphRoot .graph-file-pill.pill-suggested {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.65);
  }
  #graphRoot .graph-file-pill-name {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    min-width: 0; flex: 1;
  }
  #graphRoot .graph-file-pill-upload-in {
    display: flex; align-items: center; justify-content: center;
    background: none; border: none; cursor: pointer;
    color: transparent;
    width: 14px; height: 14px; flex-shrink: 0;
    border-radius: 3px;
    transition: color 0.12s ease, background 0.12s ease;
    padding: 0;
  }
  #graphRoot .graph-file-pill.pill-suggested:hover .graph-file-pill-upload-in {
    color: rgba(255,255,255,0.5);
  }
  #graphRoot .graph-file-pill-upload-in:hover {
    color: rgba(255,255,255,0.85) !important;
    background: rgba(255,255,255,0.08);
  }
  #graphRoot .graph-file-pill-upload-in:disabled {
    opacity: 0.35; cursor: not-allowed; pointer-events: none;
  }
  #graphRoot .graph-file-pill-x {
    display: flex; align-items: center; justify-content: center;
    background: none; border: none; cursor: pointer;
    color: transparent;
    width: 14px; height: 14px; flex-shrink: 0;
    border-radius: 3px;
    transition: color 0.12s ease, background 0.12s ease;
    padding: 0;
  }
  #graphRoot .graph-file-pill:hover .graph-file-pill-x {
    color: rgba(255,255,255,0.5);
  }
  #graphRoot .graph-file-pill-x:hover {
    color: rgba(255,255,255,0.85) !important;
    background: rgba(255,255,255,0.08);
  }
  #graphRoot .graph-file-pill-x:disabled {
    opacity: 0.35; cursor: not-allowed; pointer-events: none;
  }

  /* ─── Footer ─── */
  #graphRoot .graph-node-footer {
    display: flex; align-items: center;
    gap: 8px; padding: 7px 12px 9px;
    border-top: 1px solid #2a2a2a;
  }
  #graphRoot .graph-node-upload-btn {
    flex: 1;
    padding: 5px 0;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    background: rgba(30,30,30,0.75);
    color: rgba(255,255,255,0.55);
    font-size: 11px; font-weight: 500;
    cursor: pointer; text-align: center;
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 1px 8px rgba(0,0,0,0.25);
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  }
  #graphRoot .graph-node-upload-btn:hover {
    background: rgba(50,50,50,0.85);
    border-color: rgba(255,255,255,0.14);
    color: rgba(255,255,255,0.8);
  }
  #graphRoot .graph-node-upload-btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
  #graphRoot .graph-node-card.node-running .widget-control select:disabled,
  #graphRoot .graph-node-card.node-running .widget-control input:disabled,
  #graphRoot .graph-node-card.node-running .graph-node-params:disabled,
  #graphRoot .graph-node-card.ai-suggesting .widget-control select:disabled,
  #graphRoot .graph-node-card.ai-suggesting .widget-control input:disabled,
  #graphRoot .graph-node-card.ai-suggesting .graph-node-params:disabled {
    opacity: 0.6; cursor: not-allowed;
  }
  #graphRoot .graph-node-run-btn {
    width: 30px; height: 30px;
    border-radius: 50%; border: none;
    background: var(--abya-accent);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; flex-shrink: 0;
    transition: background 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 2px 8px rgba(0,102,204,0.25);
    line-height: 0; padding: 0;
  }
  #graphRoot .graph-node-run-btn svg {
    display: block;
    margin: 0;
  }
  #graphRoot .graph-node-run-btn:hover {
    background: var(--abya-accent-hover);
    box-shadow: 0 3px 12px rgba(0,102,204,0.4);
  }
  #graphRoot .graph-node-run-btn:disabled { opacity: 0.4; cursor: not-allowed; }

  /* ─── Suggest with agent button ─── */
  #graphRoot .graph-node-deploy-btn {
    position: relative;
    overflow: visible;
    width: 30px; height: 30px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(30,30,30,0.75);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; flex-shrink: 0;
    color: rgba(255,255,255,0.55);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 1px 8px rgba(0,0,0,0.25);
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    line-height: 0; padding: 0;
    outline: none;
  }
  #graphRoot .graph-node-deploy-btn::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    padding: 2px;
    background: conic-gradient(
      from var(--glow-angle),
      transparent 0%,
      transparent 40%,
      #7eb8f7 55%,
      #c8e4ff 70%,
      rgba(255,255,255,0.9) 78%,
      #7eb8f7 88%,
      transparent 100%
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transition: opacity 0.35s ease;
  }
  #graphRoot .graph-node-deploy-btn:hover::before {
    opacity: 1;
    animation: snakeGlowOnceDeploy 0.85s linear 1 forwards;
  }
  #graphRoot .graph-node-deploy-btn.suggesting:hover::before {
    opacity: 0;
    animation: none;
  }
  #graphRoot .graph-node-deploy-btn > * {
    position: relative;
    z-index: 1;
  }
  [data-theme="light"] #graphRoot .graph-node-deploy-btn::before {
    background: conic-gradient(
      from var(--glow-angle),
      transparent 0%,
      transparent 40%,
      #5a9fd4 55%,
      #a8d4f0 70%,
      rgba(255,255,255,0.95) 78%,
      #5a9fd4 88%,
      transparent 100%
    );
  }
  #graphRoot .graph-node-deploy-btn:hover {
    background: rgba(50,50,50,0.85);
    color: rgba(255,255,255,0.85);
    border-color: rgba(255,255,255,0.14);
  }
  #graphRoot .graph-node-deploy-btn .deploy-beams {
    transition: opacity 0.2s ease;
  }
  #graphRoot .graph-node-deploy-btn:hover .deploy-beams {
    opacity: 0 !important;
  }
  #graphRoot .graph-node-deploy-btn.suggesting {
    background: rgba(0,102,204,0.15);
    border-color: rgba(0,102,204,0.3);
    color: rgba(255,255,255,0.85);
  }
  [data-theme="light"] #graphRoot .graph-node-deploy-btn.suggesting {
    background: rgba(0,102,204,0.08);
    border-color: rgba(0,102,204,0.2);
    color: rgba(0,102,204,0.7);
  }
  #graphRoot .graph-node-deploy-btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

  /* ─── Canvas scale wrapper ─── */
  .graph-scale-wrapper { position: relative; }

  /* ─── Minimap (view-only, auto-hides) ─── */
  .graph-minimap {
    position: absolute;
    bottom: 58px; left: 16px;
    width: 120px; height: 120px;
    background: rgba(30,30,30,0.82);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    z-index: 50;
    overflow: hidden;
    pointer-events: none;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 16px rgba(0,0,0,0.35);
    opacity: 0.9;
    transition: opacity 0.35s ease;
    will-change: opacity;
  }
  .graph-minimap.graph-minimap-hidden { opacity: 0; pointer-events: none; }
  .graph-minimap-dots { position: absolute; inset: 0; }
  .graph-minimap-node {
    position: absolute;
    height: 2.5px;
    background: rgba(255,255,255,0.45);
    border-radius: 1px;
    min-width: 2px;
  }
  .graph-minimap-viewport {
    position: absolute;
    border: 1.5px solid rgba(0,102,204,0.65);
    border-radius: 2px;
    background: rgba(0,102,204,0.06);
    pointer-events: none;
  }

  /* ─── Zoom control (persistent) ─── */
  .graph-zoom-bar {
    position: absolute;
    bottom: 16px; left: 16px;
    display: flex; align-items: center; gap: 6px;
    height: 32px; padding: 0 10px;
    background: rgba(30,30,30,0.75);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    z-index: 50;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 1px 12px rgba(0,0,0,0.3);
    user-select: none;
    -webkit-user-select: none;
  }
  .graph-zoom-btn {
    width: 22px; height: 22px;
    display: flex; align-items: center; justify-content: center;
    border: none; background: none;
    color: rgba(255,255,255,0.65);
    cursor: pointer; border-radius: 50%;
    padding: 0; line-height: 0;
    transition: color 0.15s ease, background 0.15s ease;
  }
  .graph-zoom-btn:hover {
    color: rgba(255,255,255,0.85);
    background: rgba(255,255,255,0.08);
  }
  .graph-zoom-btn:active { background: rgba(255,255,255,0.12); }
  .graph-zoom-track {
    position: relative;
    width: 80px; height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    cursor: pointer;
  }
  .graph-zoom-fill {
    position: absolute; left: 0; top: 0;
    height: 100%; border-radius: 2px;
    background: var(--abya-accent);
    pointer-events: none;
    transition: width 0.08s ease;
  }
  .graph-zoom-thumb {
    position: absolute; top: 50%;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--abya-accent);
    box-shadow: 0 0.5px 3px rgba(0,0,0,0.3);
    transform: translate(-50%, -50%);
    pointer-events: none;
    transition: left 0.08s ease;
  }
  .graph-zoom-label {
    font-size: 10px; font-weight: 500;
    color: rgba(255,255,255,0.6);
    min-width: 30px; text-align: center;
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
  }

  /* ─── Minimap + Zoom light theme ─── */
  [data-theme="light"] .graph-minimap {
    background: rgba(245,245,245,0.85);
    border-color: rgba(0,0,0,0.07);
    box-shadow: 0 2px 16px rgba(0,0,0,0.08);
  }
  [data-theme="light"] .graph-minimap-node { background: rgba(0,0,0,0.22); }
  [data-theme="light"] .graph-minimap-viewport {
    border-color: rgba(0,102,204,0.5);
    background: rgba(0,102,204,0.04);
  }
  [data-theme="light"] .graph-zoom-bar {
    background: rgba(255,255,255,0.8);
    border-color: rgba(0,0,0,0.08);
    box-shadow: 0 1px 12px rgba(0,0,0,0.1);
  }
  [data-theme="light"] .graph-zoom-btn { color: rgba(0,0,0,0.35); }
  [data-theme="light"] .graph-zoom-btn:hover {
    color: rgba(0,0,0,0.7); background: rgba(0,0,0,0.05);
  }
  [data-theme="light"] .graph-zoom-track { background: rgba(0,0,0,0.08); }
  [data-theme="light"] .graph-zoom-fill { background: var(--abya-accent); opacity: 0.85; }
  [data-theme="light"] .graph-zoom-thumb {
    background: var(--abya-accent); box-shadow: 0 0.5px 4px rgba(0,0,0,0.15);
  }
  [data-theme="light"] .graph-zoom-label { color: rgba(0,0,0,0.35); }

  /* ─── Light theme overrides ─── */
  [data-theme="light"] #graphRoot { background: #e8e8e8; }
  [data-theme="light"] #graphRoot .graph-node-card {
    background: #fff; border-color: #d0d0d0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  }
  [data-theme="light"] #graphRoot .graph-node-card:hover { border-color: #b0b0b0; }
  [data-theme="light"] #graphRoot .graph-node-card.ai-suggesting { border-color: transparent; }
  [data-theme="light"] #graphRoot .graph-node-card.ai-suggesting::after {
    background: conic-gradient(
      from var(--glow-angle),
      transparent 0%,
      transparent 55%,
      rgba(0,102,204,0.1) 70%,
      rgba(74,158,255,0.15) 80%,
      rgba(0,102,204,0.1) 90%,
      transparent 100%
    );
  }
  [data-theme="light"] #graphRoot .graph-node-header {
    background: #f7f7f7; border-bottom-color: #e0e0e0;
  }
  [data-theme="light"] #graphRoot .graph-node-title { color: #222; }
  [data-theme="light"] #graphRoot .graph-slot-area {
    background: #f2f2f2; border-bottom-color: #e0e0e0;
  }
  [data-theme="light"] #graphRoot .graph-slot { background: rgba(0,0,0,0.02); }
  [data-theme="light"] #graphRoot .graph-slot:hover { background: rgba(0,0,0,0.04); }
  [data-theme="light"] #graphRoot .graph-slot.slot-empty { background: transparent; }
  [data-theme="light"] #graphRoot .graph-node-body { display: none; }
  [data-theme="light"] #graphRoot .graph-node-params {
    background: #fafafa; border-color: #ddd; color: #333;
  }
  [data-theme="light"] #graphRoot .graph-node-footer { border-top-color: #e0e0e0; }
  [data-theme="light"] #graphRoot .graph-node-upload-btn {
    background: rgba(255,255,255,0.8);
    border-color: rgba(0,0,0,0.08);
    color: rgba(0,0,0,0.4);
    box-shadow: 0 1px 8px rgba(0,0,0,0.1);
  }
  [data-theme="light"] #graphRoot .graph-node-upload-btn:hover {
    background: rgba(255,255,255,0.95);
    border-color: rgba(0,0,0,0.12);
    color: rgba(0,0,0,0.65);
  }
  [data-theme="light"] #graphRoot .graph-node-deploy-btn {
    background: rgba(255,255,255,0.8);
    border-color: rgba(0,0,0,0.08);
    color: rgba(0,0,0,0.4);
    box-shadow: 0 1px 8px rgba(0,0,0,0.1);
  }
  [data-theme="light"] #graphRoot .graph-node-deploy-btn:hover {
    background: rgba(255,255,255,0.95);
    color: rgba(0,0,0,0.65);
    border-color: rgba(0,0,0,0.12);
  }
  [data-theme="light"] #graphRoot .graph-wire-suggested { stroke: #c0c0c0; }
  [data-theme="light"] #graphRoot .graph-wire-real { stroke: #0066cc; }
  [data-theme="light"] #graphRoot .graph-wire-dragging { stroke: rgba(0,102,204,0.35); }
  [data-theme="light"] #graphRoot .graph-port-dot { background: #bbb; }
  [data-theme="light"] #graphRoot .graph-port-dot.connected { background: #0066cc; }
  [data-theme="light"] #graphRoot .graph-port-dot:hover { background: #0066cc; box-shadow: 0 0 0 3px rgba(0,102,204,0.15); }
  [data-theme="light"] #graphRoot .graph-slot-label { color: rgba(0,0,0,0.45); }
  [data-theme="light"] #graphRoot .graph-slot-label.slot-label-real { color: #222; }
  [data-theme="light"] #graphRoot .graph-slot.slot-empty .graph-slot-label { color: rgba(0,0,0,0.2); }
  [data-theme="light"] #graphRoot .graph-file-pill.pill-uploaded {
    background: rgba(0,102,204,0.1); color: #0066cc;
  }
  [data-theme="light"] #graphRoot .graph-file-pill.pill-suggested {
    background: rgba(0,0,0,0.05); color: rgba(0,0,0,0.5);
  }
  [data-theme="light"] #graphRoot .graph-file-pill:hover .graph-file-pill-x { color: rgba(0,0,0,0.3); }
  [data-theme="light"] #graphRoot .graph-file-pill-x:hover { color: rgba(0,0,0,0.7) !important; background: rgba(0,0,0,0.06); }
  [data-theme="light"] #graphRoot .graph-file-pill.pill-suggested:hover .graph-file-pill-upload-in { color: rgba(0,0,0,0.35); }
  [data-theme="light"] #graphRoot .graph-file-pill-upload-in:hover { color: rgba(0,0,0,0.7) !important; background: rgba(0,0,0,0.06); }
  [data-theme="light"] #graphRoot .graph-file-pill-upload-in:disabled { opacity: 0.4; }
  [data-theme="light"] #graphRoot .graph-file-pill-x:disabled { opacity: 0.4; }
  [data-theme="light"] #graphRoot .graph-expand-files-toggle { color: rgba(0,0,0,0.4); }
  [data-theme="light"] #graphRoot .graph-expand-files-toggle:hover { color: rgba(0,0,0,0.6); }
  [data-theme="light"] #graphRoot .graph-files-col-header { color: rgba(0,0,0,0.35); border-bottom-color: #ddd; }
  [data-theme="light"] #graphRoot .graph-node-delete-btn { color: rgba(0,0,0,0.25); }
  [data-theme="light"] #graphRoot .graph-node-delete-btn:hover { color: rgba(0,0,0,0.5); }
  [data-theme="light"] #graphRoot .graph-node-expand-btn { color: rgba(0,0,0,0.25); }
  [data-theme="light"] #graphRoot .graph-node-expand-btn:hover { color: rgba(0,0,0,0.5); }
  [data-theme="light"] #graphRoot .graph-files-empty { color: rgba(0,0,0,0.2); }
  [data-theme="light"] #graphRoot .slot-progress svg { color: #888; }
  [data-theme="light"] #graphRoot .slot-progress:hover svg { color: #666; }

  /* ===================== DYNAMIC WIDGET CONTROLS ===================== */

  /* Parameters collapsible — mirrors Files section exactly */
  #graphRoot .graph-expand-params-section {
    margin-bottom: 6px;
  }
  #graphRoot .graph-expand-params-body {
    max-height: 0; overflow: hidden;
    transition: max-height 0.2s ease, margin-top 0.2s ease;
    margin-top: 0;
  }
  #graphRoot .graph-expand-params-section.open .graph-expand-params-body {
    max-height: 2000px;
    margin-top: 8px;
  }
  #graphRoot .graph-expand-params-section.open .graph-expand-files-toggle svg {
    transform: rotate(180deg);
  }

  #graphRoot .graph-widget-container {
    display: flex; flex-direction: column; gap: 0;
  }

  #graphRoot .widget-row {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 3px 0;
    min-height: 26px;
  }
  #graphRoot .widget-row.widget-hidden,
  #graphRoot .widget-section.widget-hidden,
  #graphRoot .widget-repeat-group.widget-hidden {
    display: none;
  }

  #graphRoot .widget-label {
    flex: 0 0 42%;
    font-size: 10.5px;
    color: rgba(255,255,255,0.55);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: default;
  }

  #graphRoot .widget-control {
    flex: 0 1 auto; min-width: 0; max-width: 60%;
  }

  /* Unified input style — same border as file pills */
  #graphRoot .widget-combo,
  #graphRoot .widget-text,
  #graphRoot .widget-number {
    width: 100%;
    padding: 4px 8px;
    background: #141414;
    border: 1px solid #2e2e2e;
    border-radius: 6px;
    color: #d8d8d8;
    font-size: 11px;
    font-family: -apple-system, 'SF Pro Text', 'Helvetica Neue', sans-serif;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s ease;
  }
  #graphRoot .widget-combo:focus,
  #graphRoot .widget-text:focus,
  #graphRoot .widget-number:focus {
    border-color: #4a8cff;
    box-shadow: 0 0 0 2px rgba(74,140,255,0.15);
  }
  #graphRoot .widget-combo {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23666' fill='none' stroke-width='1.3' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 22px;
    cursor: pointer;
  }
  #graphRoot .widget-file-combo:focus {
    border-color: rgba(74,140,255,0.5);
  }
  /* Number input — rounded, no spinner arrows */
  #graphRoot .widget-number {
    max-width: 100px;
    border-radius: 6px;
    -moz-appearance: textfield;
  }
  #graphRoot .widget-number::-webkit-inner-spin-button,
  #graphRoot .widget-number::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
  }
  #graphRoot .widget-color {
    width: 28px; height: 22px;
    border: 1px solid #2e2e2e; border-radius: 6px;
    background: none; cursor: pointer;
    padding: 0;
  }

  /* Toggle — Apple-style, blue */
  #graphRoot .widget-toggle-wrap {
    position: relative;
    display: inline-block;
    width: 34px; height: 20px;
    cursor: pointer;
    flex-shrink: 0;
  }
  #graphRoot .widget-toggle {
    opacity: 0; width: 0; height: 0; position: absolute;
  }
  #graphRoot .widget-toggle-slider {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 10px;
    transition: background 0.2s ease, border-color 0.2s ease;
  }
  #graphRoot .widget-toggle-slider::before {
    content: '';
    position: absolute; top: 2px; left: 2px;
    width: 14px; height: 14px;
    background: #555;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
    transition: transform 0.2s ease, background 0.2s ease;
  }
  #graphRoot .widget-toggle:checked + .widget-toggle-slider {
    background: var(--abya-accent);
    border-color: var(--abya-accent);
  }
  #graphRoot .widget-toggle:checked + .widget-toggle-slider::before {
    transform: translateX(14px);
    background: #fff;
  }
  #graphRoot .widget-toggle:focus-visible + .widget-toggle-slider {
    box-shadow: 0 0 0 2px rgba(0,102,204,0.4);
  }

  /* Section groups — unified box, same style as file section header */
  #graphRoot .widget-section {
    margin: 3px 0;
    border: 1px solid #252525;
    border-radius: 8px;
    overflow: hidden;
    background: #181818;
  }
  /* Nested sections: spacing so rounded corners are visible, keep rounded */
  #graphRoot .widget-section .widget-section {
    margin: 6px 0;
    border-radius: 8px;
  }
  #graphRoot .widget-section-summary {
    display: flex; align-items: center; gap: 5px;
    font-size: 10px;
    font-family: -apple-system, 'SF Pro Text', 'Helvetica Neue', sans-serif;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 5px 8px;
    cursor: pointer;
    background: transparent;
    user-select: none;
    list-style: none;
    border-radius: 8px 8px 0 0;
  }
  #graphRoot .widget-section:not([open]) > .widget-section-summary {
    border-radius: 8px;
  }
  #graphRoot .widget-section[open] > .widget-section-summary {
    border-radius: 8px 8px 0 0;
    border-bottom: none;
  }
  #graphRoot .widget-section[open] {
    padding-bottom: 6px;
  }
  #graphRoot .widget-section-summary::-webkit-details-marker { display: none; }
  #graphRoot .widget-section-summary::before {
    content: '';
    display: inline-block;
    width: 10px; height: 10px;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='10' viewBox='0 0 10 10' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 3.5l3 3 3-3' stroke='%23666' fill='none' stroke-width='1.2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    transition: transform 0.18s ease;
    flex-shrink: 0;
  }
  #graphRoot .widget-section[open] > .widget-section-summary::before {
    transform: rotate(180deg);
  }
  #graphRoot .widget-section > .widget-row,
  #graphRoot .widget-section > .widget-section,
  #graphRoot .widget-section > .widget-repeat-group {
    padding-left: 10px;
    padding-right: 8px;
  }
  /* Round bottom of section when last child is row/repeat so no sharp inner edge */
  #graphRoot .widget-section > .widget-row:last-child,
  #graphRoot .widget-section > .widget-repeat-group:last-child {
    padding-bottom: 4px;
  }
  #graphRoot .widget-section > .widget-section:last-child {
    margin-bottom: 4px;
  }
  #graphRoot .widget-section > .widget-section:first-child {
    margin-top: 4px;
  }

  /* Repeat groups — simple text label, no box */
  #graphRoot .widget-repeat-group {
    margin: 2px 0;
    padding-left: 2px;
  }
  #graphRoot .widget-repeat-label {
    font-size: 10px;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 2px 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #graphRoot .widget-repeat-group > .widget-row {
    padding-left: 4px;
    padding-right: 2px;
  }

  /* Fallback textarea (when no widget def exists) */
  #graphRoot .graph-widget-container .graph-node-params {
    width: 100%; min-height: 36px; max-height: 120px;
    padding: 6px 8px;
    background: #141414; border: 1px solid #2e2e2e; border-radius: 6px;
    color: #d8d8d8; font-size: 11px;
    font-family: 'SF Mono', 'Menlo', monospace;
    resize: vertical;
  }

  /* Light theme overrides for widgets */
  [data-theme="light"] #graphRoot .graph-expand-params-body { }
  [data-theme="light"] #graphRoot .widget-label { color: rgba(0,0,0,0.55); }
  [data-theme="light"] #graphRoot .widget-combo,
  [data-theme="light"] #graphRoot .widget-text,
  [data-theme="light"] #graphRoot .widget-number {
    background: #f5f5f7; border-color: #d2d2d7; color: #1d1d1f;
  }
  [data-theme="light"] #graphRoot .widget-combo {
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23555' fill='none' stroke-width='1.3' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
  }
  [data-theme="light"] #graphRoot .widget-combo:focus,
  [data-theme="light"] #graphRoot .widget-text:focus,
  [data-theme="light"] #graphRoot .widget-number:focus {
    border-color: #4a8cff;
    box-shadow: 0 0 0 2px rgba(74,140,255,0.15);
  }
  [data-theme="light"] #graphRoot .widget-toggle-slider {
    background: #d1d1d6; border-color: #c7c7cc;
  }
  [data-theme="light"] #graphRoot .widget-toggle-slider::before { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
  [data-theme="light"] #graphRoot .widget-toggle:checked + .widget-toggle-slider {
    background: var(--abya-accent);
    border-color: var(--abya-accent);
  }
  [data-theme="light"] #graphRoot .widget-toggle:checked + .widget-toggle-slider::before { background: #fff; }
  [data-theme="light"] #graphRoot .widget-section { border-color: #e0e0e5; border-radius: 8px; background: #f0f0f5; }
  [data-theme="light"] #graphRoot .widget-section .widget-section { border-radius: 8px; }
  [data-theme="light"] #graphRoot .widget-section-summary { background: transparent; color: rgba(0,0,0,0.45); border-radius: 8px 8px 0 0; }
  [data-theme="light"] #graphRoot .widget-section:not([open]) > .widget-section-summary { border-radius: 8px; }
  [data-theme="light"] #graphRoot .widget-section-summary::before {
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='10' viewBox='0 0 10 10' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 3.5l3 3 3-3' stroke='%23555' fill='none' stroke-width='1.2' stroke-linecap='round'/%3E%3C/svg%3E");
  }
  [data-theme="light"] #graphRoot .widget-repeat-label { color: rgba(0,0,0,0.4); }
  [data-theme="light"] #graphRoot .graph-widget-container .graph-node-params {
    background: #f5f5f7; border-color: #d2d2d7; color: #1d1d1f;
  }
  [data-theme="light"] #graphRoot .widget-file-combo:focus { border-color: rgba(74,140,255,0.5); }

  /* ===================== CUSTOM TOOLTIP ===================== */
  .abya-tooltip {
    position: fixed;
    display: none;
    padding: 6px 10px;
    background: #1a1a1a;
    color: #e0e0e0;
    font-size: 11px;
    font-family: -apple-system, 'SF Pro Text', 'Helvetica Neue', sans-serif;
    border: 1px solid #333;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    z-index: 99999;
    pointer-events: none;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.35;
  }
  [data-theme="light"] .abya-tooltip {
    background: #fff;
    color: #222;
    border-color: #d0d0d0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  }

  /* ===================== CUSTOM CONFIRM MODAL ===================== */
  .abya-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99999;
    display: flex; align-items: center; justify-content: center;
    animation: abyaFadeIn 0.15s ease;
  }
  @keyframes abyaFadeIn { from { opacity: 0; } to { opacity: 1; } }
  .abya-modal-box {
    background: #1e1e1e;
    border: 1px solid #3a3a3a;
    border-radius: 14px;
    padding: 24px 28px;
    min-width: 320px;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    animation: abyaScaleIn 0.15s ease;
  }
  @keyframes abyaScaleIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
  .abya-modal-title {
    font-size: 14px; font-weight: 600;
    color: #f0f0f0;
    margin-bottom: 8px;
    font-family: -apple-system, 'SF Pro Text', 'Helvetica Neue', sans-serif;
  }
  .abya-modal-message {
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    line-height: 1.5;
    margin-bottom: 20px;
    white-space: pre-wrap;
    font-family: -apple-system, 'SF Pro Text', 'Helvetica Neue', sans-serif;
  }
  .abya-modal-actions {
    display: flex; gap: 10px; justify-content: flex-end;
  }
  .abya-modal-btn {
    padding: 7px 18px;
    border-radius: 8px;
    font-size: 12px; font-weight: 500;
    cursor: pointer; border: none;
    font-family: -apple-system, 'SF Pro Text', 'Helvetica Neue', sans-serif;
    transition: background 0.15s ease, opacity 0.15s ease;
    outline: none;
  }
  .abya-modal-btn:focus-visible {
    box-shadow: 0 0 0 2px rgba(74,140,255,0.5);
  }
  .abya-modal-btn-cancel {
    background: #333; color: #ccc;
  }
  .abya-modal-btn-cancel:hover { background: #444; }
  .abya-modal-btn-confirm {
    background: #c33; color: #fff;
  }
  .abya-modal-btn-confirm:hover { background: #d44; }

  [data-theme="light"] .abya-modal-overlay { background: rgba(0,0,0,0.3); }
  [data-theme="light"] .abya-modal-box {
    background: #fff; border-color: #d0d0d0;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  }
  [data-theme="light"] .abya-modal-title { color: #111; }
  [data-theme="light"] .abya-modal-message { color: rgba(0,0,0,0.55); }
  [data-theme="light"] .abya-modal-btn-cancel { background: #e8e8e8; color: #333; }
  [data-theme="light"] .abya-modal-btn-cancel:hover { background: #ddd; }

  /* ===================== THEME TOGGLE (SUN/MOON CIRCLE) ===================== */

  .theme-toggle-circle {
    width: 28px; height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.06);
    cursor: pointer; outline: none;
    display: flex; align-items: center; justify-content: center;
    padding: 0; color: rgba(255,255,255,0.65);
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  }
  .theme-toggle-circle:hover {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.85);
    border-color: rgba(255,255,255,0.15);
  }
  .theme-icon {
    display: none;
    width: 14px !important;
    height: 14px !important;
    max-width: 14px !important;
    max-height: 14px !important;
    object-fit: contain;
    filter: invert(1);
    opacity: 0.65;
  }
  .theme-icon-moon { display: block; }
  .theme-toggle-circle.is-light .theme-icon-moon { display: none; }
  .theme-toggle-circle.is-light .theme-icon-sun { display: block; }
  .theme-toggle-circle:hover .theme-icon { opacity: 0.85; }
  :root[data-theme="light"] .theme-icon { filter: none !important; opacity: 0.45; }
  :root[data-theme="light"] .theme-toggle-circle:hover .theme-icon { opacity: 0.7; }

  [data-theme="light"] .theme-toggle-circle {
    background: rgba(0,0,0,0.05);
    border-color: rgba(0,0,0,0.1);
    color: rgba(0,0,0,0.45);
  }
  [data-theme="light"] .theme-toggle-circle:hover {
    background: rgba(0,0,0,0.08);
    color: rgba(0,0,0,0.7);
  }

/* === UNDO / REDO CIRCLE BUTTONS ===================== */
#toolbar .toolbar-icon-btn {
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.65);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 0;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

#toolbar .toolbar-icon-btn:hover:not(:disabled) {
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.9);
  border-color: rgba(255,255,255,0.14);
}

#toolbar .toolbar-icon-btn:active:not(:disabled) {
  background: rgba(255,255,255,0.08);
}

#toolbar .toolbar-icon-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

#toolbar .toolbar-icon-btn img.toolbar-icon-img {
  display: block;
  filter: invert(1);
  opacity: 0.65;
  transition: opacity 0.15s ease;
}
#toolbar .toolbar-icon-btn:hover:not(:disabled) img.toolbar-icon-img { opacity: 0.9; }
#toolbar .toolbar-icon-btn:disabled img.toolbar-icon-img { opacity: 0.3; }
[data-theme="light"] #toolbar .toolbar-icon-btn img.toolbar-icon-img { filter: none; opacity: 0.5; }
[data-theme="light"] #toolbar .toolbar-icon-btn:hover:not(:disabled) img.toolbar-icon-img { opacity: 0.75; }


/* =============== BOTTOM LIBRARY POPOVER =============== */
.bottom-library {
  position: fixed;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.bottom-library.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.bottom-library-inner {
  width: 680px; height: 600px; max-width: 96vw;
  background: rgba(24,24,24,0.92);
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 8px 32px rgba(0,0,0,0.45);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  display: flex; flex-direction: column;
  padding: 16px 18px;
  overflow: hidden;
}
.bottom-library-header {
  font-size: 12px; font-weight: 600;
  color: rgba(255,255,255,0.65);
  margin-bottom: 10px; flex-shrink: 0;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.bottom-library-list {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
  padding-right: 8px; box-sizing: border-box;
}

.bottom-library-list .tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 190px);
  gap: 14px;
  justify-content: start;
  padding: 6px 0;
}
.bottom-library-list .tool-item {
  width: 190px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px; padding: 14px;
  cursor: pointer; text-align: center;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
  display: flex; flex-direction: column; justify-content: flex-start;
  box-shadow: none;
}
.bottom-library-list .tool-item:hover {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.1);
  transform: translateY(-1px);
}
.bottom-library-list .tool-icon {
  width: 36px; height: 36px;
  margin: 0 auto 10px;
  background: rgba(255,255,255,0.06);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: rgba(255,255,255,0.5);
}
.bottom-library-list .tool-name {
  font-size: 12px; font-weight: 600;
  color: rgba(255,255,255,0.85);
  margin-bottom: 6px; word-wrap: break-word;
}
.bottom-library-list .tool-desc {
  font-size: 11px; color: rgba(255,255,255,0.5);
  line-height: 1.4; flex-grow: 1;
}
.bottom-library-list .tool-version {
  font-size: 10px; font-weight: 400; opacity: 0.45;
  margin-left: 4px;
}
.bottom-library-item {
  padding: 8px 12px; font-size: 12px;
  color: rgba(255,255,255,0.65);
  background: rgba(255,255,255,0.04);
  border: none; border-radius: 8px;
  text-align: left; cursor: pointer;
  transition: background 0.13s ease, color 0.13s ease;
  width: 100%; margin-bottom: 4px;
}
.bottom-library-item:hover {
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.85);
}

.current-project-display {
  margin-left: 12px;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,0.65);
  background: none; border: none; padding: 0;
  white-space: nowrap; display: inline-block; vertical-align: middle;
}
[data-theme="light"] .current-project-display { color: rgba(0,0,0,0.45); }

.library-search-container {
  padding: 6px 0 12px 0;
}
.search-wrapper {
  position: relative; display: flex; align-items: center;
}
.search-icon {
  position: absolute; left: 12px;
  font-size: 11px; opacity: 0.3; pointer-events: none;
}
#librarySearch {
  width: 100%; height: 32px;
  padding: 0 14px 0 32px;
  border-radius: 16px; font-size: 12px;
  font-family: inherit; outline: none;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.85);
  transition: background 0.15s ease, border-color 0.15s ease;
}
#librarySearch::placeholder { color: rgba(255,255,255,0.4); }
#librarySearch:focus {
  background: rgba(255,255,255,0.08);
  border-color: rgba(0,102,204,0.4);
  box-shadow: none;
}
[data-theme="light"] #librarySearch {
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.08);
  color: rgba(0,0,0,0.7);
}
[data-theme="light"] #librarySearch::placeholder { color: rgba(0,0,0,0.3); }
[data-theme="light"] #librarySearch:focus {
  background: #fff;
  border-color: rgba(0,102,204,0.35);
  box-shadow: none;
}

.back-btn {
  font-weight: 600; font-size: 11px;
  color: rgba(0,102,204,0.7) !important;
  margin-bottom: 8px;
}



/* Container: Matches Node Background */
.graphdialog.rounded {
  background: #353535 !important; 
  border: 1px solid #666 !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
  padding: 12px !important;
  color: #AAA !important;
  font-family: Arial, sans-serif;
  border-radius: 8px !important;
  min-width: 180px !important;
}

/* Title Label */
.graphdialog .name {
  font-size: 11px;
  color: #999;
  display: block;
  margin-bottom: 6px;
}

/* Input Box: Matches Widget Background */
.graphdialog input.value, .graphdialog textarea.value {
  background: #1a1a1a !important;
  border: 1px solid #444 !important;
  color: #EEE !important;
  padding: 6px 10px !important;
  border-radius: 4px !important;
  outline: none !important;
  width: 100% !important;
  box-sizing: border-box !important;
  font-size: 13px !important;
}

/* Button: Blue and Rounded */
.graphdialog button {
  background: #0066cc !important;
  color: white !important;
  border: none !important;
  padding: 6px 18px !important;
  margin-top: 10px !important;
  border-radius: 20px !important; /* Round corners */
  cursor: pointer !important;
  font-size: 11px !important;
  font-weight: bold !important;
  float: right;
  transition: background 0.2s;
}

.graphdialog button:hover {
  background: #2563eb !important;
}


/* =========================== Light theme override ========================== */
[data-theme="light"] #toolbar .toolbar-icon-btn {
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.08);
  color: rgba(0,0,0,0.5);
}

[data-theme="light"] #toolbar .toolbar-icon-btn:hover:not(:disabled) {
  background: rgba(0,0,0,0.07);
  color: rgba(0,0,0,0.7);
  border-color: rgba(0,0,0,0.12);
}

[data-theme="light"] #toolbar .toolbar-icon-btn:active:not(:disabled) {
  background: rgba(0,0,0,0.06);
}

:root {
  --accent-blue: #0066cc;
}

/* Global background / text */
[data-theme="light"] body {
  background: #f5f5f7;
  color: #111;
}

[data-theme="light"] .header {
  background: #f5f5f7;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}

/* Canvas area stays neutral, only header + chrome change
[data-theme="light"] #graphcanvas {
  background-color: #00fafa !important;
}  */

[data-theme="light"] #toolbar {
  background: rgba(255,255,255,0.85);
  border-color: rgba(0,0,0,0.08);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

/* Toolbar input */
[data-theme="light"] #toolbar input {
  background: #f2f2f7;
  color: #111;
  border-color: #d1d1d6;
}

[data-theme="light"] #toolbar button:not(#run-btn):not(.toolbar-icon-btn),
[data-theme="light"] #toolbar .toolbar-file-btn {
  background: rgba(0,0,0,0.04);
  color: rgba(0,0,0,0.45);
  border-color: rgba(0,0,0,0.08);
}
[data-theme="light"] #toolbar button:not(#run-btn):not(.toolbar-icon-btn):hover,
[data-theme="light"] #toolbar .toolbar-file-btn:hover {
  background: rgba(0,0,0,0.07);
  color: rgba(0,0,0,0.65);
  border-color: rgba(0,0,0,0.12);
}
[data-theme="light"] .home-btn {
  background: rgba(0,0,0,0.04);
  color: rgba(0,0,0,0.45);
  border-color: rgba(0,0,0,0.08);
}
[data-theme="light"] .home-btn:hover {
  background: rgba(0,0,0,0.07);
  color: rgba(0,0,0,0.65);
}
/* Run button keeps same accent blue */
[data-theme="light"] #run-btn {
  background: var(--abya-accent);
}

[data-theme="light"] .profile-btn {
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.08);
}
[data-theme="light"] .profile-btn:hover {
  background: rgba(0,0,0,0.07);
}
[data-theme="light"] .profile-avatar { color: rgba(0,0,0,0.45); }
[data-theme="light"] .profile-content {
  background: #f5f5f7;
  border-color: rgba(0,0,0,0.08);
  box-shadow: 0 12px 40px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.06);
}
[data-theme="light"] .profile-item {
  color: rgba(0,0,0,0.85);
}
[data-theme="light"] .profile-item:hover {
  background: rgba(0,0,0,0.05);
  color: rgba(0,0,0,0.95);
}
[data-theme="light"] .profile-item-danger:hover {
  color: rgba(220,50,50,0.9);
}
/* light-mode danger icon filter defined above */

[data-theme="light"] .logo img {
  filter: invert(1);
}

/* =============== LIGHT THEME OVERRIDES =============== */
[data-theme="light"] .bottom-library-inner {
  background: rgba(255,255,255,0.92);
  border-color: rgba(0,0,0,0.08);
  box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}
[data-theme="light"] .bottom-library-header { color: rgba(0,0,0,0.4); }
[data-theme="light"] .bottom-library-item {
  background: rgba(0,0,0,0.03); color: rgba(0,0,0,0.5);
}
[data-theme="light"] .bottom-library-item:hover { background: rgba(0,0,0,0.06); color: rgba(0,0,0,0.7); }
[data-theme="light"] .tool-item {
  background: rgba(0,0,0,0.03);
  border-color: rgba(0,0,0,0.06);
  box-shadow: none;
}
[data-theme="light"] .tool-item:hover {
  background: rgba(0,0,0,0.05); border-color: rgba(0,0,0,0.1);
}
[data-theme="light"] .tool-name { color: rgba(0,0,0,0.65); }
[data-theme="light"] .tool-desc { color: rgba(0,0,0,0.35); }
[data-theme="light"] .tool-icon { background: rgba(0,0,0,0.05); color: rgba(0,0,0,0.3); }

/* Responsive fallback */
@media (max-width: 800px) {
  .bottom-library-inner { width: 96vw; height: 80vh; }
  .tool-item { width: 100%; max-width: 280px; }
}
/* ===================== BOTTOM TOOLBAR ===================== */

#bottomToolbar {
  position: fixed;
  bottom: 16px; left: 50%;
  transform: translateX(-50%);
  height: 38px; padding: 0 10px;
  display: flex; align-items: center; gap: 6px;
  z-index: 99999;
}

/* ===================== BOTTOM TOOLBAR BUTTONS (DARK MODE) ===================== */

.toolbar-bottom-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(30,30,30,0.75);
  color: rgba(255,255,255,0.65);
  font-size: 14px; font-weight: 500; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 1px 8px rgba(0,0,0,0.25);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.toolbar-bottom-btn:hover {
  background: rgba(50,50,50,0.85);
  color: rgba(255,255,255,0.85);
  border-color: rgba(255,255,255,0.14);
}
.toolbar-bottom-btn:active { background: rgba(40,40,40,0.85); }
[data-theme="light"] .toolbar-bottom-btn {
  background: rgba(255,255,255,0.8);
  border-color: rgba(0,0,0,0.08);
  color: rgba(0,0,0,0.4);
  box-shadow: 0 1px 8px rgba(0,0,0,0.1);
}
[data-theme="light"] .toolbar-bottom-btn:hover {
  background: rgba(255,255,255,0.95);
  color: rgba(0,0,0,0.65);
}














/* Wrapper for the iframe */
.ketcher-node-overlay {
    background: white;
    /* Optional: Rounded corners bottom to match node style */
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
    overflow: hidden;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.2); /* Inner shadow for depth */
    pointer-events: auto; /* Enable clicking inside */
}

/* The actual iframe */
.ketcher-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}


/* (duplicate header/logo/zoom rules removed — defined above) */








/* ==================== NOTIFICATION BELL BUTTON ==================== */
.notification-bell-btn {
  background: none;
  border: none;
  width: 20px; height: 20px;
  cursor: pointer;
  position: relative;
  margin-right: 10px;
  padding: 0;
  transition: opacity 0.15s ease;
}
.notification-bell-btn:hover { opacity: 1; }

.notification-bell-btn::before {
  content: '';
  position: absolute; inset: 0;
  background-image: url('/imgs/bell.svg');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  filter: brightness(0) invert(1);
  opacity: 0.65;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.notification-bell-btn:hover::before { opacity: 0.85; }
[data-theme="light"] .notification-bell-btn::before { filter: brightness(0) invert(0); opacity: 0.65; }
[data-theme="light"] .notification-bell-btn:hover::before { opacity: 0.85; }

/* ==================== BADGE - OUR BLUE (same as run/send/accents) ==================== */
.notification-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background-color: var(--abya-accent) !important;
  color: #ffffff !important;
  font-size: 8px;
  font-weight: 700;
  min-width: 14px;
  height: 14px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  box-shadow: 0 0 0 1.5px #111;
  z-index: 20;
  pointer-events: none;
}

/* Light mode badge shadow */
[data-theme="light"] .notification-count {
  box-shadow: 0 0 0 1.5px #ffffff !important;
}

/* ==================== DROPDOWN - APPLE-STYLE GREY + PLACEMENT ==================== */
/* Right edge aligned under notification bell (bell is left of profile icon) */
.notification-dropdown {
  position: fixed;
  top: 52px;
  right: 56px;
  width: 360px;
  max-width: calc(100vw - 72px);
  max-height: 65vh;
  background: #1c1c1e;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4), 0 0 0 1px rgba(0,0,0,0.15);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 100000;
  overflow: hidden;
  opacity: 0;
  transform: scale(0.96) translateY(-6px);
  pointer-events: none;
  transition: opacity 0.2s cubic-bezier(0.23, 1, 0.32, 1),
              transform 0.2s cubic-bezier(0.23, 1, 0.32, 1);
}

.notification-dropdown.show {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

.notification-header {
  padding: 14px 16px 12px;
  font-weight: 600;
  font-size: 13px;
  color: rgba(255,255,255,0.9);
  letter-spacing: -0.01em;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.02);
  flex-shrink: 0;
}

/* List - scrollable, thin scrollbar; rows extend under scrollbar for full-width hover */
.notification-list {
  max-height: 420px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 6px 0 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.12) transparent;
}
.notification-list::-webkit-scrollbar { width: 6px; }
.notification-list::-webkit-scrollbar-track { background: transparent; }
.notification-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }

.notification-row {
  padding: 12px 22px 12px 16px;
  margin-right: -6px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  display: flex;
  gap: 12px;
  align-items: center;
  overflow: hidden;
  transition: background 0.12s ease;
  box-sizing: border-box;
  position: relative;
}
.notification-row:hover {
  background: rgba(255,255,255,0.03);
}
.notification-row.unread {
  background: transparent;
}
.notification-row.unread:hover {
  background: rgba(255,255,255,0.03);
}
.notification-row.unread::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 10px;
  border-radius: 2px;
  background: rgba(255,255,255,0.35);
}

.notification-row:last-child {
  border-bottom: none;
}

/* Symbol - aligned with first line */
.notif-symbol {
  width: 20px;
  height: 20px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  flex-shrink: 0;
  font-size: 0;
}

/* Text block - flex, truncate */
.notif-main {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.notif-text {
  color: rgba(255,255,255,0.88);
  font-size: 13px;
  line-height: 1.4;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.notif-project {
  color: rgba(255,255,255,0.45);
  font-size: 11px;
  margin-top: 3px;
}

/* Time - right-aligned, vertically centered */
.notif-time {
  flex-shrink: 0;
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.no-notifs {
  padding: 40px 24px;
  text-align: center;
  color: rgba(255,255,255,0.45);
  font-size: 13px;
  line-height: 1.5;
}

/* Notification type icons */
.notification-row.success .notif-symbol { background-image: url('/imgs/success.svg'); }
.notification-row.error .notif-symbol { background-image: url('/imgs/error.svg'); }
.notification-row .notif-symbol { background-image: url('/imgs/info.svg'); }

/* ==================== LIGHT THEME OVERRIDES (ALL HARDCODED) ==================== */
[data-theme="light"] .notification-dropdown {
  background: #f5f5f7;
  border-color: rgba(0,0,0,0.08);
  box-shadow: 0 12px 40px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.06);
}

[data-theme="light"] .notification-header {
  background: rgba(0,0,0,0.03);
  border-bottom-color: rgba(0,0,0,0.06);
  color: rgba(0,0,0,0.9);
}

[data-theme="light"] .notification-row {
  border-bottom-color: rgba(0,0,0,0.05);
}
[data-theme="light"] .notification-row:hover {
  background: rgba(0,0,0,0.03);
}
[data-theme="light"] .notification-row.unread {
  background: transparent;
}
[data-theme="light"] .notification-row.unread:hover {
  background: rgba(0,0,0,0.03);
}
[data-theme="light"] .notification-row.unread::before {
  background: rgba(0,0,0,0.35);
}

[data-theme="light"] .notif-text {
  color: rgba(0,0,0,0.85);
}

[data-theme="light"] .notif-project {
  color: rgba(0,0,0,0.5);
}

[data-theme="light"] .notif-time {
  color: rgba(0,0,0,0.45);
}

[data-theme="light"] .no-notifs {
  color: rgba(0,0,0,0.5);
}

[data-theme="light"] .notification-list::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.15);
}

/* ==================== TOAST NOTIFICATION BUBBLE (next to zoom bar) ==================== */
/* Round when short, expands upward with fixed width; thin border, grey; icon + message + project */
.notification-bubble {
  position: fixed;
  z-index: 10000;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 320px;
  width: max-content;
  padding: 12px 14px;
  background: #1c1c1e;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35), 0 0 0 1px rgba(0,0,0,0.08);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease, transform 0.35s ease;
  box-sizing: border-box;
}
.notification-bubble .notif-bubble-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  margin-top: 1px;
}
/* Error/success/unclassified (info) each use their own SVG */
.notification-bubble .notif-bubble-icon.error { background-image: url('/imgs/error.svg'); }
.notification-bubble .notif-bubble-icon.success { background-image: url('/imgs/success.svg'); }
.notification-bubble .notif-bubble-icon.info { background-image: url('/imgs/info.svg'); }
.notification-bubble .notif-bubble-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.notification-bubble .notif-bubble-msg {
  font-size: 13px;
  line-height: 1.4;
  color: rgba(255,255,255,0.9);
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
}
.notification-bubble .notif-bubble-project {
  font-size: 11px;
  color: rgba(255,255,255,0.45);
}
[data-theme="light"] .notification-bubble {
  background: #f5f5f7;
  border-color: rgba(0,0,0,0.1);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.06);
}
[data-theme="light"] .notification-bubble .notif-bubble-msg { color: rgba(0,0,0,0.85); }
[data-theme="light"] .notification-bubble .notif-bubble-project { color: rgba(0,0,0,0.5); }