/* Semantiva Studio Color Palette - Professional & Intuitive */
    :root {
      /* Core Channel Colors */
      --config-primary: #8e8e93;
      --config-light: #f2f2f7;
      --config-border: #d1d1d6;
      
      --data-primary: #007aff;
      --data-light: #e8f4fd;
      --data-border: #c7e0f4;
      
      --context-primary: #af52de;
      --context-light: #f5e6ff;
      --context-border: #e6ccff;
      
      /* I/O Flow Colors */
      --input-primary: #34c759;
      --input-light: #e8f5ea;
      --input-border: #c3e6cd;
      
      --output-primary: #ff9500;
      --output-light: #fff4e6;
      --output-border: #ffe0b3;
      
      /* Sweep/Derived Colors */
      --sweep-primary: #00b3b3;
      --sweep-light: #e6fbfb;
      --sweep-border: #6bd6d6;
      
      /* System Colors */
      --neutral-primary: #48484a;
      --neutral-light: #f8f9fa;
      --neutral-border: #e5e5ea;
      
      --success-primary: #30d158;
      --warning-primary: #ff9f0a;
      --error-primary: #ff3b30;
      
      /* Semantic Colors for Data Types */
      --type-primary: #5856d6;
      --type-light: #eeecff;
      --type-border: #d4d2ff;
    }

    body, html { 
      margin:0; 
      height:100%; 
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
      background: var(--neutral-light);
    }
    #root { display:flex; height:100%; width:100%; }
    #sidebar { 
      width: 400px;
      min-width: 40px;
      max-width: 800px;
      border-right:1px solid var(--neutral-border); 
      overflow:auto; 
      padding:4px; 
      background: white;
      position: relative;
    }
    #details { 
      width:700px; 
      min-width: 200px;
      max-width: 1000px;
      border-left:1px solid var(--neutral-border); 
      overflow:auto; 
      padding:20px; 
      background: #fafbfc;
      word-wrap: break-word;
      overflow-wrap: break-word;
      background: white;
      position: relative;
    }
    #graph { flex:1; overflow: auto; position: relative; }
    
    /* Resize handles */
    .resize-handle {
      position: absolute;
      background: transparent;
      transition: background-color 0.2s ease;
      z-index: 1000;
    }
    
    .resize-handle:hover {
      background-color: var(--data-primary);
    }
    
    .resize-handle-right {
      top: 0;
      right: -2px;
      width: 4px;
      height: 100%;
      cursor: ew-resize;
    }
    
    .resize-handle-left {
      top: 0;
      left: -2px;
      width: 4px;
      height: 100%;
      cursor: ew-resize;
    }
    
    .resize-handle:active,
    .resize-handle.resizing {
      background-color: var(--data-primary);
    }
    pre { white-space:pre-wrap; }
    .node-item { 
      cursor: pointer; 
      padding: 8px; 
      border: 1px solid var(--neutral-border); 
      margin: 2px; 
      border-radius: 8px;
      background: white;
      word-wrap: break-word;
      word-break: break-word;
      overflow-wrap: break-word;
      hyphens: auto;
      transition: all 0.2s ease;
    }
    .node-item:hover { 
      background: var(--neutral-light);
      border-color: var(--data-primary);
      transform: translateY(-1px);
      box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    /* Wrapping container enabling horizontal scroll */
    .custom-graph-wrapper {
      overflow-x: auto;
      width: 100%;
      background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    }

    /* Basic styles for our custom graph grid */
    .custom-graph {
      position: relative;
      background: transparent;
      min-width: 800px;
      padding: 0px;
      transform-origin: 0 0;
      transition: transform 0.2s ease;
      display: grid;
    }
    
    /* Zoom controls */
    .zoom-controls {
      position: absolute;
      top: 20px;
      right: 20px;
      z-index: 100;
      display: flex;
      flex-direction: column;
      gap: 5px;
    }
    
    .zoom-btn {
      width: 40px;
      height: 40px;
      border: 1px solid var(--neutral-border);
      background: white;
      border-radius: 10px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
      font-weight: bold;
      box-shadow: 0 2px 8px rgba(0,0,0,0.1);
      transition: all 0.2s ease;
      color: var(--neutral-primary);
    }
    
    .zoom-btn:hover {
      background: var(--neutral-light);
      box-shadow: 0 4px 12px rgba(0,0,0,0.15);
      transform: scale(1.05);
    }
    
    .zoom-btn:active {
      transform: scale(0.95);
    }
    
    /* Dual channel background*/
    
    .channel-label {
      position: absolute;
      top: 15px;
      left: 50%;
      transform: translateX(-50%);
      font-weight: 600;
      font-size: 14px;
      color: var(--neutral-primary);
      z-index: 1;
      background: white;
      padding: 4px 12px;
      border-radius: 20px;
      box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    
    .custom-node {
      position: absolute;
      background: white;
      border: 2px solid var(--data-primary);
      border-radius: 12px;
      padding: 16px;
      text-align: center;
      cursor: pointer;
      box-shadow: 0 4px 12px rgba(0,0,0,0.08);
      font-size: 13px;
      line-height: 1.4;
      z-index: 10;
      transition: all 0.3s ease;
      backdrop-filter: blur(10px);
    }
    
    /* Data processor nodes (middle channel) */
    .custom-node.data-processor {
      border-color: var(--data-primary);
      background: linear-gradient(135deg, white 0%, var(--data-light) 100%);
    }
    .custom-node.data-processor:hover {
      background: linear-gradient(135deg, var(--data-light) 0%, white 100%);
      border-color: var(--data-primary);
      box-shadow: 0 8px 20px rgba(0, 122, 255, 0.2);
      transform: translateY(-2px);
    }
    
    /* Context processor nodes (right channel) */
    .custom-node.context-processor {
      border-color: var(--context-primary);
      background: linear-gradient(135deg, white 0%, var(--context-light) 100%);
    }
    .custom-node.context-processor:hover {
      background: linear-gradient(135deg, var(--context-light) 0%, white 100%);
      border-color: var(--context-primary);
      box-shadow: 0 8px 20px rgba(175, 82, 222, 0.2);
      transform: translateY(-2px);
    }
    
    /* Source and sink nodes (span channels) */
    .custom-node.source-sink {
      border-color: var(--type-primary);
      background: linear-gradient(90deg, var(--data-light) 0%, var(--context-light) 100%);
    }
    .custom-node.source-sink:hover {
      background: linear-gradient(90deg, var(--data-light) 0%, var(--context-light) 100%);
      border-color: var(--type-primary);
      box-shadow: 0 8px 20px rgba(88, 86, 214, 0.2);
      transform: translateY(-2px);
    }
    
    .custom-node:hover {
      box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    }
    .custom-node.selected {
      border-color: var(--success-primary);
      box-shadow: 0 8px 20px rgba(48, 209, 88, 0.3);
      transform: translateY(-2px);
    }
    
    /* Error nodes (override other styles) */
    .custom-node.error {
      border-color: var(--error-primary) !important;
      background: linear-gradient(135deg, white 0%, #ffebee 100%) !important;
    }
    .custom-node.error:hover {
      background: linear-gradient(135deg, #ffebee 0%, white 100%) !important;
      border-color: var(--error-primary) !important;
      box-shadow: 0 8px 20px rgba(255, 59, 48, 0.3) !important;
    }
    
    /* Trace overlay styles */
    .custom-node.trace-success {
      border-width: 3px;
      border-color: var(--success-primary) !important;
      box-shadow: 0 4px 12px rgba(48, 209, 88, 0.2), inset 0 0 0 1px rgba(48, 209, 88, 0.1);
    }
    .custom-node.trace-success:hover {
      box-shadow: 0 8px 20px rgba(48, 209, 88, 0.3), inset 0 0 0 1px rgba(48, 209, 88, 0.2);
    }
    
    .custom-node.trace-error {
      border-width: 3px;
      border-color: var(--error-primary) !important;
      box-shadow: 0 4px 12px rgba(255, 59, 48, 0.2), inset 0 0 0 1px rgba(255, 59, 48, 0.1);
    }
    .custom-node.trace-error:hover {
      box-shadow: 0 8px 20px rgba(255, 59, 48, 0.3), inset 0 0 0 1px rgba(255, 59, 48, 0.2);
    }
    
    .custom-node.trace-neutral {
      border-width: 3px;
      border-color: var(--neutral-primary) !important;
      box-shadow: 0 4px 12px rgba(72, 72, 74, 0.2), inset 0 0 0 1px rgba(72, 72, 74, 0.1);
    }
    .custom-node.trace-neutral:hover {
      box-shadow: 0 8px 20px rgba(72, 72, 74, 0.3), inset 0 0 0 1px rgba(72, 72, 74, 0.2);
    }
    .custom-edge {
      position: absolute;
      z-index: 5;
    }
    .arrow-line {
      background: var(--neutral-primary);
      position: absolute;
    }
    .arrow-head {
      position: absolute;
      width: 0;
      height: 0;
      border-left: 8px solid transparent;
      border-right: 8px solid transparent;
      border-top: 12px solid var(--neutral-primary);
      border-bottom: 0;
    }

    /* Invisible anchor points around nodes for arrows */
    .anchor {
      position: absolute;
      width: 8px;
      height: 8px;
      pointer-events: none;
    }
    .anchor.top {
      top: -4px;
      left: 50%;
      transform: translateX(-50%);
    }
    .anchor.bottom {
      bottom: -4px;
      left: 50%;
      transform: translateX(-50%);
    }
    .anchor.left {
      left: -4px;
      top: 50%;
      transform: translateY(-50%);
    }
    .anchor.right {
      right: -4px;
      top: 50%;
      transform: translateY(-50%);
    }

    .context-params {
      position: absolute;
      right: -4px;
      top: 50%;
      transform: translate(100%, -50%);
      display: flex;
      flex-direction: column;
      gap: 2px;
    }

    .config-params {
      position: absolute;
      left: -4px;
      top: 50%;
      transform: translate(-100%, -50%);
      display: flex;
      flex-direction: column;
      gap: 2px;
    }

    /* Context parameters (right side) */
    .param-label.right-anchor {
      background: var(--context-light);
      border: 1px solid var(--context-primary);
      border-radius: 6px;
      padding: 3px 6px;
      font-size: 11px;
      font-weight: 500;
      white-space: nowrap;
      position: relative;
      box-shadow: 0 2px 4px rgba(175, 82, 222, 0.1);
    }
    
    .param-label.right-anchor::before {
      content: '';
      position: absolute;
      left: -6px;
      top: 50%;
      transform: translateY(-50%);
      width: 0;
      height: 0;
      border-top: 6px solid transparent;
      border-bottom: 6px solid transparent;
      border-right: 6px solid var(--context-primary);
    }
    
    .param-label.right-anchor::after {
      content: '';
      position: absolute;
      left: -5px;
      top: 50%;
      transform: translateY(-50%);
      width: 0;
      height: 0;
      border-top: 5px solid transparent;
      border-bottom: 5px solid transparent;
      border-right: 5px solid var(--context-light);
    }

    /* Config parameters (left side - from pipeline) */
    .param-label.left-anchor {
      background: var(--config-light);
      border: 1px solid var(--config-primary);
      border-radius: 6px;
      padding: 3px 6px;
      font-size: 11px;
      font-weight: 500;
      white-space: nowrap;
      position: relative;
      box-shadow: 0 2px 4px rgba(142, 142, 147, 0.1);
    }
    
    .param-label.left-anchor::before {
      content: '';
      position: absolute;
      right: -6px;
      top: 50%;
      transform: translateY(-50%);
      width: 0;
      height: 0;
      border-top: 6px solid transparent;
      border-bottom: 6px solid transparent;
      border-left: 6px solid var(--config-primary);
    }
    
    .param-label.left-anchor::after {
      content: '';
      position: absolute;
      right: -5px;
      top: 50%;
      transform: translateY(-50%);
      width: 0;
      height: 0;
      border-top: 5px solid transparent;
      border-bottom: 5px solid transparent;
      border-left: 5px solid var(--config-light);
    }

    /* Default parameters (left side - from processor defaults) */
    .param-label.left-anchor-default {
      background: white;
      border: 1px solid var(--warning-primary);
      border-radius: 6px;
      padding: 3px 6px;
      font-size: 11px;
      font-weight: 500;
      white-space: nowrap;
      position: relative;
      box-shadow: 0 2px 4px rgba(255, 159, 10, 0.1);
    }
    
    .param-label.left-anchor-default::before {
      content: '';
      position: absolute;
      right: -6px;
      top: 50%;
      transform: translateY(-50%);
      width: 0;
      height: 0;
      border-top: 6px solid transparent;
      border-bottom: 6px solid transparent;
      border-left: 6px solid var(--warning-primary);
    }
    
    .param-label.left-anchor-default::after {
      content: '';
      position: absolute;
      right: -5px;
      top: 50%;
      transform: translateY(-50%);
      width: 0;
      height: 0;
      border-top: 5px solid transparent;
      border-bottom: 5px solid transparent;
      border-left: 5px solid white;
    }

    /* Created keys (right side) */
    .param-label.created-key {
      background: var(--input-light);
      border: 1px solid var(--input-primary);
      border-radius: 6px;
      padding: 3px 6px;
      font-size: 11px;
      font-weight: 500;
      white-space: nowrap;
      position: relative;
      box-shadow: 0 2px 4px rgba(52, 199, 89, 0.1);
    }
    
    .param-label.created-key::before {
      content: '';
      position: absolute;
      right: -6px;
      top: 50%;
      transform: translateY(-50%);
      width: 0;
      height: 0;
      border-top: 6px solid transparent;
      border-bottom: 6px solid transparent;
      border-left: 6px solid var(--input-primary);
    }
    
    .param-label.created-key::after {
      content: '';
      position: absolute;
      right: -5px;
      top: 50%;
      transform: translateY(-50%);
      width: 0;
      height: 0;
      border-top: 5px solid transparent;
      border-bottom: 5px solid transparent;
      border-left: 5px solid var(--input-light);
    }

    /* Text wrapping improvements for details panel */
    #details h3 {
      word-wrap: break-word;
      word-break: break-word;
      overflow-wrap: break-word;
      hyphens: auto;
      line-height: 1.3;
    }

    /* Improve wrapping for long parameter names and values */
    #details .parameter-content {
      word-wrap: break-word;
      word-break: break-word;
      overflow-wrap: break-word;
    }

    /* Card-like sections styling */
    .details-section {
      margin: 16px 0;
      padding: 16px;
      background: white;
      border: 1px solid #e8e9ea;
      border-radius: 8px;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
      transition: box-shadow 0.2s ease;
    }
    
    .details-section:hover {
      box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    }
    
    .details-section:first-child {
      margin-top: 0;
    }

    /* Subheader styling for detail sections */
    .details-subheader {
      margin: 0 0 12px 0;
      color: var(--neutral-primary);
      font-size: 16px;
      font-weight: 700;
      border-bottom: 2px solid #e8e9ea;
      padding-bottom: 8px;
    }

    /* Contract items styling (Input Type, Output Type, Role) */
    .contract-item {
      margin: 8px 0;
      padding: 10px 12px;
      background: #f8f9fa;
      border-radius: 6px;
      border-left: 3px solid #dee2e6;
      font-size: 14px;
      line-height: 1.4;
    }
    
    .contract-item strong {
      font-weight: 600;
      color: var(--neutral-primary);
    }

    /* Provenance box styling - Card-compatible, simplified */
    .prov-box {
      margin: 8px 0;
      padding: 12px;
      border-radius: 6px;
      border: 1px solid #dee2e6;
      background: #f8f9fa;
      font-size: 12px;
      line-height: 1.4;
    }
    
    .prov-box-config .prov-header,
    .prov-box-default .prov-header,
    .prov-box-context .prov-header {
      font-weight: 600;
      margin-bottom: 6px;
      color: var(--neutral-primary);
    }

    /* Trace and context item styling */
    .trace-item {
      margin: 6px 0;
      font-size: 12px;
      line-height: 1.4;
      color: var(--neutral-primary);
    }
    
    .trace-item strong {
      font-weight: 600;
      color: var(--neutral-primary);
    }

    /* Invalid parameter styling */
    .trace-item-invalid {
      background: #fee;
      border-left: 3px solid #dc3545;
      padding: 8px;
      border-radius: 4px;
      margin: 8px 0;
    }

    .trace-item-invalid strong {
      color: #dc3545;
    }

    .invalid-param-badge {
      display: inline-block;
      margin-left: 8px;
      padding: 2px 6px;
      background: #dc3545;
      color: white;
      border-radius: 3px;
      font-size: 11px;
      font-weight: 600;
    }

    /* Mobile Responsive Styles */
    @media (max-width: 768px) {
      /* Override the main container's inline flex styles */
      #root > div {
        flex-direction: column !important;
        height: auto !important;
        min-height: 100vh !important;
      }
      
      #root { 
        flex-direction: column;
        height: auto;
        min-height: 100vh;
      }
      
      /* Force all children to be visible and properly ordered */
      #root > div > * {
        flex-shrink: 0 !important;
      }
      
      #sidebar { 
        width: 100% !important;
        min-width: unset !important;
        max-width: unset !important;
        border-right: none;
        border-bottom: 1px solid var(--neutral-border);
        order: 1;
        max-height: 200px;
        overflow-y: auto;
        transition: max-height 0.3s ease;
      }
      
      /* Collapsed sidebar on mobile */
      #sidebar.collapsed {
        max-height: 50px !important;
        overflow: hidden;
      }
      
      /* Improve sidebar header on mobile */
      #sidebar h3 {
        writing-mode: horizontal-tb !important;
        transform: none !important;
        text-align: center;
        padding: 10px;
        margin: 0;
        font-size: 16px;
      }
      
      #graph { 
        flex: none;
        order: 2;
        min-height: 400px;
        overflow-x: auto;
      }
      
      #details { 
        width: 100% !important;
        min-width: unset !important;
        max-width: unset !important;
        border-left: none;
        border-top: 1px solid var(--neutral-border);
        order: 3;
        max-height: 400px;
        overflow-y: auto;
        display: block !important;
        position: relative !important;
        background: white;
        min-height: 200px;
        border-top: 3px solid var(--data-primary);
        padding: 15px !important;
        margin: 10px 0 !important;
      }
      
      /* Hide resize handles on mobile */
      .resize-handle {
        display: none;
      }
      
      /* Improve touch targets */
      .node-item {
        padding: 12px;
        margin: 4px 2px;
        min-height: 44px;
        display: flex;
        align-items: center;
      }
      
      .custom-node {
        min-width: 200px;
        padding: 12px;
        font-size: 14px;
        line-height: 1.5;
      }
      
      /* Make zoom controls more mobile-friendly */
      .zoom-controls {
        top: 10px;
        right: 10px;
      }
      
      .zoom-btn {
        width: 44px;
        height: 44px;
        font-size: 20px;
      }
      
      /* Improve readability */
      .details-section {
        margin: 12px 0;
        padding: 12px;
        font-size: 14px;
      }
      
      .contract-item {
        padding: 12px;
        font-size: 14px;
      }
      
      .trace-item {
        font-size: 13px;
        margin: 8px 0;
      }
      
      /* Make the details panel more visible on mobile */
      #details h4 {
        font-size: 18px;
        margin-bottom: 10px;
        color: var(--type-primary);
      }
      
      #details p {
        font-size: 14px;
        line-height: 1.5;
        color: var(--neutral-primary);
      }
      
      /* Ensure details content is visible */
      #details > div {
        min-height: 100px;
        padding: 15px !important;
      }
      
      /* Make parameter labels more readable */
      .param-label {
        font-size: 12px;
        padding: 4px 8px;
        min-height: 28px;
        display: flex;
        align-items: center;
      }
    }

    /* Small mobile devices */
    @media (max-width: 480px) {
      #sidebar {
        max-height: 150px;
      }
      
      #details {
        padding: 15px;
        max-height: 40vh;
        min-height: 120px !important;
        background: white !important;
        border-top: 2px solid var(--data-primary) !important;
      }
      
      /* Ensure details content is visible on small screens */
      #details > div {
        padding: 12px !important;
        min-height: 80px;
      }
      
      #details h4 {
        font-size: 16px;
        color: var(--data-primary) !important;
      }
      
      #details p {
        font-size: 13px;
      }
      
      .custom-graph {
        min-width: 400px;
      }
      
      .custom-node {
        min-width: 160px;
        padding: 10px;
        font-size: 13px;
      }
      
      .zoom-btn {
        width: 40px;
        height: 40px;
        font-size: 18px;
      }
      
      .details-section h3 {
        font-size: 16px;
      }
      
      .details-subheader {
        font-size: 14px;
      }
    }

    /* New standardized card pieces reused by Trace cards */
    .sv-card {
      background: #fff;
      border: 1px solid var(--neutral-border);
      border-radius: 8px;
      margin-bottom: 12px;
      box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    }
    .sv-card-title {
      font-size: 12px;
      font-weight: 600;
      padding: 8px 10px;
      color: #374151;
      background: #f9fafb;
      border-bottom: 1px solid var(--neutral-border);
    }
    .sv-kv-grid {
      display: block;
      padding: 10px;
      font-size: 12px;
    }
    .sv-kv-grid .kv {
      margin-bottom: 8px;
      line-height: 1.4;
    }
    .sv-kv-grid .k { color: #6b7280; }
    .sv-kv-grid .v { color: #111827; word-break: break-word; }
    .sv-kv-grid .v.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }

    .pill { padding: 2px 6px; border-radius: 999px; font-size: 11px; border: 1px solid transparent; }
    .pill.ok { background:#e6ffed; color:#065f46; border-color:#b7f7cc; }
    .pill.bad { background:#ffeeee; color:#7f1d1d; border-color:#f9c2c2; }
    .pill.warn { background:#fff7ed; color:#7c2d12; border-color:#fcd4a5; }
    .pill-row { padding: 0 10px 8px 10px; display:flex; flex-wrap:wrap; gap:6px; }

    .chip { display:inline-block; background:#eef2ff; color:#3730a3; border:1px solid #e0e7ff; border-radius: 6px; padding:1px 6px; margin-right:4px; margin-bottom:2px; font-size:11px; }
    .sv-details { padding: 6px 10px 10px 10px; }
    .sv-details > summary { cursor: pointer; color:#4b5563; font-size:12px; }
    .sv-json { background:#f9fafb; border:1px solid var(--neutral-border); padding:8px; border-radius:6px; max-height:180px; overflow:auto; font-size:11px; }
    .sv-subtitle { font-size:11px; color:#6b7280; padding: 0 10px; }

    /* Run-Space selector styles */
    select {
      text-overflow: ellipsis;
      max-width: 100%;
    }

    select option {
      text-overflow: ellipsis;
      overflow: hidden;
      white-space: nowrap;
    }

