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

    :root {
        --font-display: 'Outfit', sans-serif;
        --font-mono: 'JetBrains Mono', monospace;

        /* Refined Cyber-Dark Palette */
        --bg-hsl: 220, 24%, 6%;
        --bg: hsl(var(--bg-hsl));
        --bg-panel-hsl: 220, 24%, 9%;
        --bg-panel: hsl(var(--bg-panel-hsl));
        --bg-node-hsl: 220, 24%, 12%;
        --bg-node: hsl(var(--bg-node-hsl));

        --border-hsl: 220, 20%, 18%;
        --border-transparent: 1px solid;
        --border: hsla(var(--border-hsl), 0.8);
        --border-bright: hsla(var(--border-hsl), 1);

        --text-dim: #4a5a72;
        --text-mid: #7a8aab;
        --text-main: #a5b4cc;
        --text-bright: #e2e8f0;

        --accent-hsl: 161, 69%, 37%;
        --accent: hsl(var(--accent-hsl));
        --accent-glow: hsla(var(--accent-hsl), 0.3);

        --sb-left-w: 240px;
        --sb-right-w: 320px;
        --base-font: 14px;
        --transparent: rgba(255, 255, 255, 0);
    }

    html,
    body {
        margin: 0;
        padding: 0;
        height: 100%;
        width: 100%;
        overflow: hidden;
        background: var(--bg);
        font-family: var(--font-display);
        font-size: var(--base-font);
        color: var(--text-main);
        -webkit-font-smoothing: antialiased;
    }

    /* ── Custom Scrollbar ── */
    ::-webkit-scrollbar {
        width: 6px;
        height: 6px;
    }

    ::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.05);
    }

    ::-webkit-scrollbar-thumb {
        background: hsla(220, 20%, 30%, 0.5);
        border-radius: 10px;
    }

    ::-webkit-scrollbar-thumb:hover {
        background: var(--accent);
    }

    /* For Firefox */
    * {
        scrollbar-width: thin;
        scrollbar-color: hsla(220, 20%, 30%, 0.5) rgba(0, 0, 0, 0.05);
    }

    h2.sr-only {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
    }

    /* ── Layout ── */
    .fw-wrap {
        display: flex;
        height: 100vh;
        width: 100vw;
        background: var(--bg);
        overflow: hidden;
        font-family: var(--font-display);
        position: relative;
    }

    /* ── Custom Modal ── */
    .modal-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.7);
        backdrop-filter: blur(4px);
        display: none;
        align-items: center;
        justify-content: center;
        z-index: 9999;
    }

    .modal-overlay.open {
        display: flex;
    }

    .modal-card {
        background: var(--bg-panel);
        width: 100%;
        max-width: 380px;
        padding: 24px;
        border-radius: 12px;
        border: 1px solid var(--border);
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
        animation: modalSlide 0.3s ease-out;
    }

    @keyframes modalSlide {
        from {
            transform: translateY(20px);
            opacity: 0;
        }

        to {
            transform: translateY(0);
            opacity: 1;
        }
    }

    .modal-title {
        font-size: 16px;
        font-weight: 700;
        color: var(--text-bright);
        margin-bottom: 12px;
        font-family: var(--font-display);
    }

    .modal-body {
        font-size: 13px;
        color: var(--text-main);
        margin-bottom: 24px;
        line-height: 1.5;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .modal-input {
        width: 100%;
        background: var(--bg);
        border: 1px solid var(--border);
        padding: 10px 12px;
        border-radius: 6px;
        color: var(--text-bright);
        font-family: var(--font-display);
        margin-bottom: 20px;
        outline: none;
    }

    .modal-input:focus {
        border-color: var(--accent);
    }

    .modal-actions {
        display: flex;
        justify-content: flex-end;
        gap: 12px;
    }

    .btn {
        padding: 8px 16px;
        border-radius: 6px;
        font-size: 12px;
        font-weight: 600;
        cursor: pointer;
        font-family: var(--font-display);
        transition: all 0.2s;
    }

    .btn-secondary {
        background: transparent;
        border: 1px solid var(--border);
        color: var(--text-mid);
    }

    .btn-secondary:hover {
        background: rgba(255, 255, 255, 0.05);
        color: var(--text-bright);
    }

    .btn-primary {
        background: var(--accent);
        border: none;
        color: #fff;
    }

    .btn-primary:hover {
        filter: brightness(1.1);
        box-shadow: 0 0 12px var(--accent-glow);
    }

    /* ── Sidebar tabs ── */
    .fw-sidebar {
        width: var(--sb-left-w);
        background: hsla(var(--bg-panel-hsl), 0.7);
        backdrop-filter: blur(12px) saturate(180%);
        border-right: 1px solid var(--border);
        display: flex;
        flex-direction: column;
        flex-shrink: 0;
        z-index: 10;
    }

    .fw-sidebar-top {
        padding: 16px 20px;
        border-bottom: 1px solid var(--border);
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .logo-sq {
        width: 36px;
        height: 36px;
        background: var(--bg-node);
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
        border: 1px solid var(--border);
        overflow: hidden;
        transition: transform 0.3s ease;
    }

    .logo-sq:hover {
        transform: scale(1.05);
        border-color: var(--accent);
    }

    .logo-label {
        font-size: 20px;
        font-weight: 700;
        color: var(--text-bright);
        letter-spacing: -0.03em;
        font-family: var(--font-display);
        background: linear-gradient(to right, var(--text-bright), #7a15ff87);
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
    }

    .sb-section {
        padding: 12px 16px;
        border-bottom: 1px solid var(--border);
    }

    .sb-cat {
        font-size: 10px;
        letter-spacing: .12em;
        color: var(--text-dim);
        text-transform: uppercase;
        margin-bottom: 10px;
        font-weight: 600;
    }

    .sb-pill {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 8px 12px;
        border-radius: 8px;
        color: var(--text-mid);
        cursor: grab;
        margin-bottom: 4px;
        border: 1px solid transparent;
        font-size: 13px;
        user-select: none;
        transition: all 0.2s;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }

    .sb-pill:hover {
        background: hsla(220, 24%, 15%, 0.5);
        border-color: var(--border-bright);
        color: var(--text-bright);
        transform: translateX(2px);
    }

    /* ── Tabs ── */
    .sb-tabs {
        padding: 12px 16px;
        border-bottom: 1px solid var(--border);
    }

    .sb-tab {
        font-size: 15px;
        font-weight: 700;
        text-align: center;
        color: var(--text-bright);
        text-transform: uppercase;
        letter-spacing: 0.1em;
        font-family: var(--font-display);
    }

    .sb-tab-panel {
        display: none;
        flex: 1;
        flex-direction: column;
        overflow: hidden;
    }

    .sb-tab-panel.active {
        display: flex;
    }

    /* ── Project Card ── */
    .proj-card {
        padding: 16px 20px;
        border-bottom: 1px solid var(--border);
        cursor: pointer;
        position: relative;
        transition: all 0.2s;
        border-left: 3px solid transparent;
    }

    .proj-card:hover {
        background: hsla(220, 24%, 15%, 0.4);
    }

    .proj-card.active {
        background: hsla(var(--accent-hsl), 0.05);
        border-left-color: var(--accent);
    }

    .proj-name {
        font-size: 18px;
        font-weight: 600;
        color: var(--text-bright);
        margin-bottom: 6px;
        font-family: var(--font-display);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .proj-meta {
        display: flex;
        gap: 12px;
        font-size: 12px;
        color: var(--text-dim);
        font-family: var(--font-display);
    }

    .proj-meta span {
        display: flex;
        align-items: center;
        gap: 4px;
    }



    @keyframes logo-pulse {
        0% {
            box-shadow: 0 0 0 0 hsla(var(--accent-hsl), 0.4);
        }

        70% {
            box-shadow: 0 0 0 10px hsla(var(--accent-hsl), 0);
        }

        100% {
            box-shadow: 0 0 0 0 hsla(var(--accent-hsl), 0);
        }
    }

    .logo-sq img {
        animation: logo-pulse 3s infinite;
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

    .nd {
        width: 10px;
        height: 10px;
        border-radius: 50%;
        flex-shrink: 0;
        box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
    }

    /* ── Canvas ── */
    .fw-canvas {
        flex: 1;
        position: relative;
        overflow: hidden;
        cursor: default;
        background: var(--bg);
    }

    .fw-canvas.panning {
        cursor: grabbing !important;
    }

    .grid-dots {
        position: absolute;
        inset: 0;
        pointer-events: none;
        background-image: radial-gradient(circle, var(--border) 1px, transparent 1px);
        background-size: 24px 24px;
    }

    /* ── Canvas World (zoom/pan target) ── */
    #canvas-world {
        position: absolute;
        top: 0;
        left: 0;
        transform-origin: 0 0;
        width: 3000px;
        height: 3000px;
    }

    /* ── SVG connector layer ── */
    .conn-svg {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        pointer-events: none;
        overflow: visible;
    }

    /* ── Toolbar ── */
    .fw-toolbar {
        position: absolute;
        top: 20px;
        left: 50%;
        transform: translateX(-50%);
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 6px;
        background: hsla(var(--bg-panel-hsl), 0.6);
        backdrop-filter: blur(10px);
        border: 1px solid var(--border);
        border-radius: 12px;
        z-index: 30;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    }

    .tb {
        background: transparent;
        border: 1px solid transparent;
        color: var(--text-mid);
        padding: 8px 14px;
        border-radius: 8px;
        cursor: pointer;
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 13px;
        font-family: var(--font-display);
        font-weight: 500;
        transition: all 0.2s ease;
    }

    .tb:hover {
        background: hsla(220, 24%, 20%, 0.6);
        color: var(--text-bright);
        border-color: var(--border);
    }

    .tb.run {
        background: hsla(161, 69%, 37%, 0.15);
        color: var(--accent);
    }

    .tb.run:hover {
        background: hsla(161, 69%, 37%, 0.25);
        border-color: var(--accent);
    }

    .tb-sep {
        width: 1px;
        height: 18px;
        background: var(--border);
        margin: 0 4px;
    }

    .tb i {
        font-size: 16px;
    }

    /* ── Node ── */
    .node {
        position: absolute;
        width: 220px;
        background: hsla(var(--bg-node-hsl), 0.85);
        backdrop-filter: blur(16px);
        border: 1px solid var(--border);
        border-radius: 12px;
        cursor: grab;
        user-select: none;
        z-index: 2;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
        transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
    }

    .node:hover {
        border-color: var(--border-bright);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    }

    .node.sel {
        border-color: var(--accent);
        box-shadow: 0 0 0 0px var(--accent), 0 12px 48px hsla(var(--accent-hsl), 0.2);
    }

    .nh {
        padding: 12px 14px;
        display: flex;
        align-items: center;
        gap: 10px;
        border-bottom: 1px solid var(--border);
        font-family: var(--font-display);
        font-weight: 500;
        border-top-left-radius: 12px;
        border-top-right-radius: 12px;
    }

    .nt {
        font-size: 15px;
        color: var(--text-bright);
        letter-spacing: -0.01em;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1;
    }



    .nb {
        padding: 12px 14px;
    }

    .fw-canvas.compact .nb {
        display: none !important;
    }

    .fw-canvas.compact .nh {
        border-bottom: none;
        border-bottom-left-radius: 12px;
        border-bottom-right-radius: 12px;
    }

    .nd-desc {
        font-size: 15px;
        color: var(--text-bright);
        margin-bottom: 10px;
        line-height: 1.5;
        font-family: var(--font-display);
        word-break: break-word;
        display: -webkit-box;
        line-clamp: 3;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

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

    .nr {
        display: none;
        align-items: center;
        gap: 8px;
        margin-bottom: 8px;
        font-size: 12px;
        color: var(--text-mid);
        font-family: var(--font-mono);
    }

    .nk {
        font-size: 11px;
        color: var(--text-dim);
        min-width: 65px;
    }

    .nv {
        color: var(--text-main);
        cursor: text;
        padding: 2px 4px;
        border-radius: 4px;
        transition: background 0.2s;
    }

    .nv:hover {
        background: hsla(var(--accent-hsl), 0.1);
    }

    /* ── Inline edit field ── */
    .edit-field {
        background: #080c12;
        border: 0.5px solid var(--accent);
        border-radius: 3px;
        color: #e8f4ff;
        font-size: 10px;
        font-family: var(--font-mono);
        padding: 1px 4px;
        width: 100%;
        box-sizing: border-box;
        outline: none;
    }

    /* ── Ports ── */
    .port {
        position: absolute;
        width: 12px;
        height: 12px;
        background: var(--bg-node);
        border: 2px solid var(--border-bright);
        border-radius: 50%;
        cursor: crosshair;
        z-index: 10;
        transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }

    .port:hover {
        transform: scale(1.5);
        border-color: var(--accent);
        box-shadow: 0 0 12px var(--accent-glow);
    }

    .port-i {
        left: -7px;
        top: 50%;
        transform: translateY(-50%);
    }

    .port-o {
        right: -7px;
        top: 50%;
        transform: translateY(-50%);
    }

    .port.connecting {
        border-color: var(--accent);
        background: #1d9e7540;
    }

    .port.drop-target {
        border-color: #5dcaa5;
        background: #1d9e7560;
        transform: scale(1.4) translateY(-50%) !important;
    }

    /* ── Tags ── */
    .tag {
        font-size: 10px;
        font-weight: 600;
        padding: 2px 8px;
        border-radius: 6px;
        font-family: var(--font-display);
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: inline-block;
    }

    .t-teal {
        background: hsla(161, 69%, 37%, 0.15);
        color: #4fd1a5;
        border: 1px solid hsla(161, 69%, 37%, 0.3);
    }

    .t-purp {
        background: hsla(245, 58%, 66%, 0.15);
        color: #a78bfa;
        border: 1px solid hsla(245, 58%, 66%, 0.3);
    }

    .t-amb {
        background: hsla(36, 85%, 55%, 0.15);
        color: #fbbf24;
        border: 1px solid hsla(36, 85%, 55%, 0.3);
    }

    .t-cor {
        background: hsla(16, 69%, 52%, 0.15);
        color: #f87171;
        border: 1px solid hsla(16, 69%, 52%, 0.3);
    }

    .t-red {
        background: hsla(0, 72%, 51%, 0.15);
        color: #fca5a5;
        border: 1px solid hsla(0, 72%, 51%, 0.3);
    }

    /* ── Notecard ── */
    .notecard {
        position: absolute;
        background: rgba(15, 20, 28, 0.5);
        /* 0.5 opacity dark background */
        backdrop-filter: blur(16px) saturate(140%);
        border: 1px solid rgba(255, 255, 255, 0.08);
        /* Subtle border */
        border-radius: 16px;
        /* slightly more rounded */
        width: 180px;
        padding: 12px;
        cursor: grab;
        user-select: none;
        word-wrap: break-word;
        overflow-wrap: break-word;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
        transition: all 0.3s ease;
    }



    .node.dragging {
      z-index: 1000;
      cursor: grabbing !important;
      opacity: 0.9;
      transition: none !important;
    }

    .notecard.dragging {
        cursor: grabbing !important;
        z-index: 100;
        transform: scale(1.02);
        transition: none !important; /* Disable lag during drag */
    }

    .nc-head {
        font-size: 11px;
        color: var(--accent);
        /* Use accent color for the icon */
        margin-bottom: 6px;
        display: flex;
        align-items: center;
        justify-content: center;
        /* Center the icon */
        opacity: 0.6;
    }

    .nc-body {
        font-size: 15px;
        color: var(--text-main);
        line-height: 1.6;
        font-family: var(--font-display);
        white-space: pre-wrap;
    }

    .notecard .edit-field {
        background: rgba(0, 0, 0, 0.2);
        border: 1px solid var(--accent);
        color: var(--text-bright);
        font-size: 13px;
        line-height: 1.6;
        padding: 4px;
        border-radius: 6px;
    }

    /* ── Right Panel ── */
    .fw-rp {
        width: var(--sb-right-w);
        background: hsla(var(--bg-panel-hsl), 0.7);
        backdrop-filter: blur(16px);
        border-left: 1px solid var(--border);
        display: flex;
        flex-direction: column;
        flex-shrink: 0;
        overflow-y: auto;
        z-index: 10;
    }

    .rp-empty {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        flex: 1;
        color: var(--text-dim);
        font-size: 14px;
        gap: 12px;
        padding: 40px;
        text-align: center;
        font-family: var(--font-display);
    }

    .rp-empty i {
        font-size: 32px;
        opacity: .3;
        color: var(--accent);
    }

    .rp-sec {
        padding: 20px 24px;
        border-bottom: 1px solid var(--border);
        box-sizing: border-box;
    }

    .rp-lbl {
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: .12em;
        color: var(--text-dim);
        font-weight: 600;
        margin-bottom: 14px;
    }

    .rp-field-row {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 8px 0;
        border-bottom: 1px solid hsla(var(--border-hsl), 0.4);
    }

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

    .rp-fk {
        font-size: 13px;
        color: var(--text-mid);
        min-width: 80px;
        flex-shrink: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        padding-right: 4px;
    }

    .rp-fv {
        font-size: 13px;
        color: var(--text-bright);
        font-family: var(--font-mono);
        cursor: text;
        flex: 1;
        border-radius: 6px;
        padding: 4px 8px;
        background: hsla(var(--bg-hsl), 0.5);
        border: 1px solid transparent;
        transition: all 0.2s;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        min-width: 0;
    }

    .rp-fv:hover {
        background: hsla(var(--accent-hsl), 0.1);
        border-color: hsla(var(--accent-hsl), 0.3);
    }

    .conn-chip {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 4px 10px;
        border-radius: 8px;
        font-size: 11px;
        background: hsla(var(--bg-hsl), 0.6);
        border: 1px solid var(--border);
        color: var(--text-main);
        margin: 0 6px 6px 0;
        max-width: 140px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .conn-chip i {
        font-size: 12px;
        color: var(--accent);
    }

    .ask-btn {
        margin: 10px 12px;
        padding: 7px 8px;
        background: var(--bg-panel);
        border: .5px solid #1c2c42;
        border-radius: 5px;
        color: var(--text-mid);
        font-size: 10px;
        cursor: pointer;
        text-align: left;
        display: flex;
        align-items: center;
        gap: 5px;
        font-family: var(--font-mono);
        width: calc(100% - 24px);
    }

    .ask-btn:hover {
        background: #111c2a;
        color: var(--text-main);
    }

    /* ── Status bar ── */
    .fw-status {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 32px;
        background: hsla(var(--bg-hsl), 0.9);
        border-top: 1px solid var(--border);
        display: flex;
        align-items: center;
        padding: 0 20px;
        gap: 20px;
        font-size: 11px;
        color: var(--text-dim);
        z-index: 10;
        font-family: var(--font-display);
        font-weight: 500;
    }

    .s-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
    }

    /* ── Preview edge animation ── */
    @keyframes dash-anim {
        to {
            stroke-dashoffset: -12;
        }
    }

    .preview-edge {
        animation: dash-anim .4s linear infinite;
    }

    /* ── Context Menu ── */
    .ctx-menu {
        position: fixed;
        background: hsla(var(--bg-panel-hsl), 0.85);
        backdrop-filter: blur(12px);
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: 8px 0;
        min-width: 200px;
        z-index: 1000;
        box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
        display: none;
    }

    .ctx-menu.open {
        display: block;
    }

    .ctx-item {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 10px 18px;
        color: var(--text-mid);
        cursor: pointer;
        font-size: 14px;
        font-family: var(--font-display);
        transition: all 0.15s;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .ctx-item:hover {
        background: hsla(220, 24%, 18%, 0.8);
        color: var(--text-bright);
    }

    .ctx-item.danger {
        color: #e24b4a;
    }

    .ctx-item.danger:hover {
        background: #2a0e0e;
    }

    .ctx-sep {
        height: .5px;
        background: var(--border);
        margin: 4px 0;
    }

    .ctx-item i {
        font-size: 12px;
        flex-shrink: 0;
    }

    /* ── Colour swatches ── */
    .colour-row {
        display: flex;
        gap: 6px;
        padding: 6px 14px;
        flex-wrap: wrap;
    }

    .swatch {
        width: 16px;
        height: 16px;
        border-radius: 50%;
        cursor: pointer;
        border: 1.5px solid transparent;
        transition: transform .12s, border-color .12s;
    }

    .swatch:hover {
        transform: scale(1.25);
        border-color: #fff4;
    }

    .swatch.active {
        border-color: #fff8;
        transform: scale(1.15);
    }

    /* ── Selected edge highlight ── */
    .edge-sel {
        stroke: #fff !important;
        opacity: .85;
    }

    .edge-hit {
        fill: none;
        stroke: transparent;
        stroke-width: 14;
        cursor: pointer;
        pointer-events: stroke;
    }

    /* ── Project cards ── */
    .proj-card {
        margin: 8px 10px 0;
        padding: 9px 10px;
        background: #0d1520;
        border: 0.5px solid var(--border-bright);
        border-radius: 7px;
        cursor: pointer;
        transition: border-color .12s, background .12s;
    }

    .proj-card:hover {
        background: #111c2a;
        border-color: #2d4060;
    }

    .proj-card.active {
        border-color: var(--accent);
        background: #091a14;
    }

    .proj-name {
        font-size: 18px;
        font-weight: 500;
        color: var(--text-bright);
        margin-bottom: 4px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .proj-meta {
        font-size: 12px;
        color: var(--text-dim);
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
    }


    /* ── Right panel dynamic ── */
    .fw-rp {
        width: var(--sb-right-w);
        background: hsla(var(--bg-panel-hsl), 0.7);
        backdrop-filter: blur(16px);
        border-left: 1px solid var(--border);
        display: flex;
        flex-direction: column;
        flex-shrink: 0;
        z-index: 10;
        transition: width 0.2s, border-left 0.2s;
        position: relative;
    }

    .fw-rp.collapsed {
        width: 0 !important;
        border-left: none !important;
    }

    /* Drag resize handle */
    .rp-resizer {
        position: absolute;
        left: 0;
        top: 0;
        width: 5px;
        height: 100%;
        cursor: ew-resize;
        z-index: 12;
        background: transparent;
        transition: background 0.2s;
    }

    .rp-resizer:hover,
    .rp-resizer.dragging {
        background: var(--accent);
        opacity: 0.5;
    }

    .fw-rp.collapsed #rp-body {
        display: none;
    }

    #rp-toggle-btn {
        position: absolute;
        left: -12px;
        top: 50%;
        transform: translateY(-50%);
        width: 24px;
        height: 24px;
        background: var(--bg-panel);
        border: 1px solid var(--border);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        z-index: 20;
        /* High z-index to stay on top */
        color: #ffffff;
        background: #1a1a1a;
        transition: all 0.2s, top 0s, transform 0.2s;
        box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
        opacity: 1 !important;
        /* Ensure always solid */
    }

    #rp-toggle-btn:hover {
        color: var(--accent);
        border-color: var(--accent);
        box-shadow: 0 2px 12px hsla(var(--accent-hsl), 0.3);
        transform: translateY(-50%) scale(1.1);
    }

    .fw-rp.collapsed #rp-toggle-btn {
        left: -24px;
        /* Anchor firmly to the right screen border as a tab */
        border-radius: 4px 0 0 4px;
        /* Shift to a tab shape when collapsed? Or keep circle? */
        width: 24px;
        height: 48px;
        /* Making it more tab-like when minimized */
    }

    #rp-body {
        flex: 1;
        overflow-y: auto;
    }

    /* ── Canvas empty state ── */
    .canvas-empty {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 12px;
        color: var(--text-dim);
        pointer-events: none;
        user-select: none;
    }

    .canvas-empty p {
        font-size: 13px;
        font-family: var(--font-display);
        letter-spacing: 0.04em;
        opacity: 0.5;
    }

    /* ── Rich Notepad Editor ── */
    .rp-editor-toolbar {
        display: flex;
        gap: 4px;
        padding: 6px 12px;
        border-top: 1px solid var(--border);
        background: hsla(var(--bg-panel-hsl), 0.5);
        flex-wrap: wrap;
        z-index: 2;
    }

    .rp-editor-toolbar button {
        background: none;
        border: 1px solid transparent;
        border-radius: 6px;
        color: var(--text-dim);
        cursor: pointer;
        font-size: 12px;
        font-family: var(--font-display);
        font-weight: 600;
        padding: 3px 7px;
        transition: all 0.15s;
        line-height: 1;
    }

    .rp-editor-toolbar button:hover,
    .rp-editor-toolbar button.active {
        background: var(--accent);
        color: #fff;
        border-color: transparent;
    }

    .rp-editor-toolbar .tb-sep {
        width: 1px;
        background: var(--border);
        margin: 2px 2px;
        align-self: stretch;
    }

    #rp-editor {
        flex: 1;
        min-height: 300px;
        padding: 0px 0px;
        outline: none;
        color: var(--text-bright);
        font-family: var(--font-display);
        font-size: 15px;
        line-height: 1.85;
        caret-color: var(--accent);
        letter-spacing: 0.01em;
    }

    #rp-editor:empty::before {
        content: attr(data-placeholder);
        color: var(--text-dim);
        pointer-events: none;
    }

    #rp-editor ul {
        padding-left: 20px;
        margin: 4px 0;
    }

    #rp-editor li {
        margin: 2px 0;
    }

    #rp-editor strong {
        color: var(--text-bright);
    }

    #rp-editor em {
        color: #a5b4c8;
        font-style: italic;
    }

    #rp-editor pre {
        background: #0d1117;
        border: 1px solid #2a3042;
        border-radius: 8px;
        margin: 8px 0;
        padding: 12px;
        overflow-x: auto;
        font-size: 12px;
        position: relative;
    }

    #rp-editor pre code {
        font-family: var(--font-mono, 'JetBrains Mono', monospace);
        font-size: 12px;
        background: none !important;
        padding: 0 !important;
    }

    #rp-editor .rp-check {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 3px 0;
    }

    #rp-editor .rp-check input[type="checkbox"] {
        width: 14px;
        height: 14px;
        accent-color: var(--accent);
        cursor: pointer;
    }

    #rp-editor .rp-check.done span {
        text-decoration: line-through;
        color: var(--text-dim);
    }

    .rp-editor-wrap {
        display: flex;
        flex-direction: column;
        border: 0px solid var(--border);
        overflow: hidden;
        margin: 0 0 8px;
    }

    .rp-empty {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        flex: 1;
        color: var(--text-dim);
        font-size: 14px;
        gap: 12px;
        padding: 40px;
        text-align: center;
        font-family: var(--font-display);
    }

    .rp-empty i {
        font-size: 32px;
        opacity: .3;
        color: var(--accent);
    }



    .rp-lbl {
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: .12em;
        color: var(--text-dim);
        font-weight: 600;
        margin-bottom: 14px;
    }

    .rp-field-row {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 8px 0;
        border-bottom: 1px solid hsla(var(--border-hsl), 0.4);
    }

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

    .rp-fk {
        font-size: 13px;
        color: var(--text-mid);
        min-width: 80px;
        flex-shrink: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        padding-right: 4px;
    }

    .rp-fv {
        font-size: 13px;
        color: var(--text-bright);
        font-family: var(--font-mono);
        cursor: text;
        flex: 1;
        border-radius: 6px;
        padding: 4px 8px;
        background: hsla(var(--bg-hsl), 0.5);
        border: 1px solid transparent;
        transition: all 0.2s;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        min-width: 0;
    }

    .rp-fv:hover {
        background: hsla(var(--accent-hsl), 0.1);
        border-color: hsla(var(--accent-hsl), 0.3);
    }

    .conn-chip {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 4px 10px;
        border-radius: 8px;
        font-size: 11px;
        background: hsla(var(--bg-hsl), 0.6);
        border: 1px solid var(--border);
        color: var(--text-main);
        margin: 0 6px 6px 0;
        max-width: 140px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .conn-chip i {
        font-size: 12px;
        color: var(--accent);
    }

    .fw-status {
        display: flex;
        align-items: center;
        gap: 20px;
        padding: 0 20px;
        height: 32px;
        background: hsla(var(--bg-hsl), 0.9);
        border-top: 1px solid var(--border);
        font-size: 11px;
        color: var(--text-dim);
        font-family: var(--font-display);
        font-weight: 500;
    }
/* ── Loading Animation ── */
#loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.8s;
}

#loading-overlay.loader-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    animation: loaderIn 0.6s ease-out;
}

.loader-logo {
    width: 80px;
    height: 80px;
    position: relative;
}

.loader-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    animation: loaderPulse 2s infinite ease-in-out;
}

.loader-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-mid);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-family: var(--font-display);
    opacity: 0.8;
}

.loader-bar-container {
    width: 200px;
    height: 2px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 1px;
    overflow: hidden;
    position: relative;
}

.loader-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 40%;
    background: linear-gradient(to right, transparent, var(--accent), transparent);
    animation: loaderSlide 1.5s infinite ease-in-out;
}

@keyframes loaderPulse {
    0%, 100% { transform: scale(1); filter: brightness(1) drop-shadow(0 0 0px var(--accent-glow)); }
    50% { transform: scale(1.05); filter: brightness(1.2) drop-shadow(0 0 15px var(--accent-glow)); }
}

@keyframes loaderSlide {
    0% { left: -40%; }
    100% { left: 100%; }
}

@keyframes loaderIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
