@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800;900&family=IBM+Plex+Mono:ital,wght@0,300;0,400;0,500;1,400&display=swap');
@import url('myflowty-manager.css');

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

/* ═══════════════════════════════════════════════════════
   CSS VARIABLES
   ═══════════════════════════════════════════════════════ */
:root {
    --bg: #0d0d0d;
    --surface: #161616;
    --surface2: #1e1e1e;
    --surface3: #272727;
    --border: #2c2c2c;
    --border2: #3c3c3c;
    --text: #e4e1da;
    --text2: #9a9690;
    --text3: #5c5a56;
    --accent: #e8a020;
    --accent2: #c07010;
    --accent-dim: rgba(232,160,32,0.10);
    --accent-glow: 0 0 16px rgba(232,160,32,0.25);
    --red: #e05050;
    --green: #50b878;
    --topbar-h: 54px;
    --secondary-h: 40px;
    --r: 7px;
    --r-sm: 4px;
    --ease: cubic-bezier(0.16,1,0.3,1);
    --ease-std: cubic-bezier(0.4,0,0.2,1);
    --font-main: 'Outfit', system-ui, sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;
}

[data-theme="light"] {
    --bg: #c9c6be;
    --surface: #c0bdb5;
    --surface2: #d4d1c8;
    --surface3: #b8b5ad;
    --border: #aaa79f;
    --border2: #96938c;
    --text: #0f0e0c;
    --text2: #3e3c39;
    --text3: #7a7874;
    --accent: #d88820;
    --accent-dim: rgba(216,136,32,0.12);
    --accent-glow: 0 0 16px rgba(216,136,32,0.25);
}

/* ═══════════════════════════════════════════════════════
   BASE LAYOUT
   ═══════════════════════════════════════════════════════ */
html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-main);
    font-size: 12px;
    transition: background .35s var(--ease), color .35s var(--ease);
}

    /* Grid dots moved to #canvas-wrap to avoid being covered */
    body::before {
        content: '';
        position: fixed;
        inset: 0;
        pointer-events: none;
        z-index: 0;
    }

/* Grid dots styling moved to #canvas-wrap */

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: relative;
    z-index: 1;
}

/* ═══════════════════════════════════════════════════════
   PRIMARY NAVIGATION BAR
   ═══════════════════════════════════════════════════════ */
.primary-topbar {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    padding: 0 18px;
    gap: 14px;
    flex-shrink: 0;
    position: relative;
    z-index: 100;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    animation: slideDown .45s var(--ease) both;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }

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

.logo {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -.04em;
    color: var(--text);
    flex-shrink: 0;
    user-select: none;
}

    .logo svg {
        width: 22px;
        height: 22px;
        color: var(--accent);
    }

    .logo span {
        color: var(--accent);
    }

.nav-tabs {
    display: flex;
    gap: 2px;
    background: var(--surface3);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 3px;
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 13px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .01em;
    color: var(--text2);
    cursor: pointer;
    border: none;
    background: none;
    font-family: var(--font-main);
    transition: all .2s var(--ease);
}

    .nav-tab svg {
        width: 13px;
        height: 13px;
        flex-shrink: 0;
    }

    .nav-tab:hover {
        color: var(--text);
    }

    .nav-tab.active {
        background: var(--surface2);
        color: var(--accent);
        box-shadow: 0 1px 6px rgba(0,0,0,.25);
    }

    .nav-tab.locked {
        opacity: 0.5;
        cursor: not-allowed;
    }

        .nav-tab.locked:hover {
            color: var(--text2);
        }

/* Topbar search */
.topbar-search {
    flex: 1;
    max-width: 280px;
    position: relative;
}

    .topbar-search svg {
        position: absolute;
        left: 9px;
        top: 50%;
        transform: translateY(-50%);
        width: 13px;
        height: 13px;
        color: var(--text3);
        pointer-events: none;
    }

    .topbar-search input {
        width: 100%;
        padding: 6px 10px 6px 30px;
        background: var(--surface3);
        border: 1px solid var(--border);
        border-radius: var(--r-sm);
        color: var(--text);
        font-family: var(--font-mono);
        font-size: 12px;
        outline: none;
        transition: border-color .2s;
    }

        .topbar-search input::placeholder {
            color: var(--text3);
        }

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

/* Topbar buttons */
.icon-btn {
    width: 30px;
    height: 30px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: var(--surface3);
    color: var(--text2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .2s var(--ease);
    flex-shrink: 0;
}

    .icon-btn svg {
        width: 14px;
        height: 14px;
    }

    .icon-btn:hover {
        color: var(--text);
        border-color: var(--border2);
        background: var(--surface2);
    }

.btn-new {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 13px;
    background: var(--accent);
    color: #0d0d0d;
    border: none;
    border-radius: var(--r-sm);
    font-family: var(--font-main);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: all .2s var(--ease);
    flex-shrink: 0;
}

    .btn-new svg {
        width: 13px;
        height: 13px;
    }

    .btn-new:hover {
        filter: brightness(1.12);
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(232,160,32,.3);
    }

    .btn-new:active {
        transform: translateY(0);
    }

.topbar-right {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-left: auto;
}

/* ═══════════════════════════════════════════════════════
   VIEW CONTAINERS
   ═══════════════════════════════════════════════════════ */
.view {
    display: none !important; /* Force hide by default */
    flex: 1;
    overflow: hidden;
    flex-direction: column;
}

    .view.active {
        display: flex !important; /* Force show when active */
    }

.view-content {
    flex: 1;
    overflow-y: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Placeholder content for coming soon views */
.placeholder-content {
    text-align: center;
    max-width: 400px;
    padding: 40px;
}

    .placeholder-content svg {
        width: 80px;
        height: 80px;
        color: var(--text3);
        margin-bottom: 20px;
    }

    .placeholder-content h2 {
        font-size: 28px;
        font-weight: 700;
        color: var(--text);
        margin-bottom: 12px;
    }

    .placeholder-content p {
        font-size: 14px;
        color: var(--text2);
        line-height: 1.6;
        margin-bottom: 8px;
    }

    .placeholder-content .coming-soon {
        margin-top: 20px;
        font-size: 12px;
        color: var(--text3);
        text-transform: uppercase;
        letter-spacing: 1px;
        font-weight: 600;
    }

/* ═══════════════════════════════════════════════════════
   FLOWCHART VIEW LAYOUT
   ═══════════════════════════════════════════════════════ */
#view-flows {
    display: flex;
    flex-direction: column;
}

#flowchart-toolbar {
    display: flex;
    align-items: center;
    height: var(--secondary-h);
    background: var(--surface2);
    border-bottom: 1px solid var(--border);
    padding: 0 12px;
    gap: 10px;
    flex-shrink: 0;
    z-index: 50;
}

#flowchart-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ═══════════════════════════════════════════════════════
   SECONDARY TOOLBAR (Flowchart tools)
   ═══════════════════════════════════════════════════════ */
.tb-sep {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 2px;
}

.tb-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    color: var(--text2);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .5px;
    transition: all .15s;
    white-space: nowrap;
}

    .tb-btn:hover {
        background: var(--surface3);
        color: var(--text);
    }

    .tb-btn.active {
        color: var(--accent);
        background: var(--accent-dim);
    }

#tb-tool-group {
    display: flex;
    gap: 2px;
}

#tb-zoom {
    color: var(--text2);
    font-size: 11px;
    min-width: 48px;
    text-align: center;
    font-family: var(--font-mono);
}

#tb-spacer {
    flex: 1;
}

/* ═══════════════════════════════════════════════════════
   LEFT SIDEBAR (Component Palette)
   ═══════════════════════════════════════════════════════ */
#sidebar {
    width: 200px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#sidebar-header {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    font-size: 10px;
    letter-spacing: 1.5px;
    color: var(--text3);
    font-weight: 600;
    text-transform: uppercase;
    font-family: var(--font-mono);
}

#node-set-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px;
    border-bottom: 1px solid var(--border);
    background: var(--surface2);
    gap: 6px;
}

#node-set-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.02em;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#node-set-switch-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--surface3, #2a2a2a);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text2);
    cursor: pointer;
    font-size: 10px;
    font-family: var(--font-mono);
    font-weight: 600;
    padding: 3px 7px;
    transition: color .15s, border-color .15s, background .15s;
    white-space: nowrap;
    flex-shrink: 0;
}

    #node-set-switch-btn:hover {
        color: var(--accent);
        border-color: var(--accent);
        background: var(--surface2);
    }

#search-wrap {
    padding: 8px;
    border-bottom: 1px solid var(--border);
}

#search {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 5px 8px;
    border-radius: 3px;
    outline: none;
}

    #search:focus {
        border-color: var(--accent);
    }

#palette {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

    #palette::-webkit-scrollbar {
        width: 4px;
    }

    #palette::-webkit-scrollbar-thumb {
        background: var(--border2);
        border-radius: 2px;
    }

.cat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px 4px;
    cursor: pointer;
    font-size: 10px;
    letter-spacing: 1px;
    color: var(--text3);
    font-weight: 600;
    text-transform: uppercase;
    transition: color .15s;
    font-family: var(--font-mono);
}

    .cat-header:hover {
        color: var(--text2);
    }

.cat-arrow {
    transition: transform .2s;
    font-size: 9px;
}

.cat-collapsed .cat-arrow {
    transform: rotate(-90deg);
}

.cat-items {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 0 6px 4px;
}

.palette-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 6px;
    border-radius: 3px;
    cursor: grab;
    border: 1px solid transparent;
    transition: all .15s;
    user-select: none;
}

    .palette-item:hover {
        background: var(--surface3);
        border-color: var(--border);
    }

    .palette-item:active {
        cursor: grabbing;
        border-color: var(--accent);
        background: var(--accent-dim);
    }

.palette-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.palette-label {
    font-size: 11px;
    color: var(--text2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.palette-item:hover .palette-label {
    color: var(--text);
}

/* ═══════════════════════════════════════════════════════
   CANVAS
   ═══════════════════════════════════════════════════════ */
#canvas-wrap {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: var(--bg);
    background-image: radial-gradient(circle, rgba(255,255,255,.08) 1px, transparent 1px);
    background-size: 22px 22px;
    cursor: default;
}

[data-theme="light"] #canvas-wrap {
    background-image: radial-gradient(circle, rgba(0,0,0,.05) 1px, transparent 1px);
}

#svg-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Floating label editor */
#label-editor {
    position: absolute;
    display: none;
    z-index: 200;
}

#label-input {
    background: var(--surface2);
    border: 2px solid var(--accent);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 3px;
    outline: none;
    min-width: 120px;
}

/* Keyboard hints */
#hints {
    position: absolute;
    bottom: 12px;
    left: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    pointer-events: none;
    opacity: 0.6;
}

.hint {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text3);
}

    .hint kbd {
        background: var(--surface2);
        border: 1px solid var(--border);
        padding: 2px 5px;
        border-radius: 2px;
        font-family: var(--font-mono);
        font-size: 9px;
        color: var(--text2);
    }

/* Minimap */
#minimap {
    position: absolute;
    bottom: 12px;
    right: 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    opacity: 0.8;
    cursor: pointer;
}

    #minimap:hover {
        opacity: 1;
    }

/* ═══════════════════════════════════════════════════════
   RIGHT PROPERTIES PANEL
   ═══════════════════════════════════════════════════════ */
#props {
    width: 210px;
    flex-shrink: 0;
    background: var(--surface);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

#props-header {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    font-size: 10px;
    letter-spacing: 1.5px;
    color: var(--text3);
    font-weight: 600;
    text-transform: uppercase;
    font-family: var(--font-mono);
}

#props-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

    #props-body::-webkit-scrollbar {
        width: 4px;
    }

    #props-body::-webkit-scrollbar-thumb {
        background: var(--border2);
        border-radius: 2px;
    }

.props-empty {
    color: var(--text3);
    font-size: 11px;
    text-align: center;
    padding-top: 30px;
    font-family: var(--font-mono);
}

.prop-group {
    margin-bottom: 13px;
}

.prop-label {
    font-size: 10px;
    letter-spacing: .8px;
    color: var(--text3);
    text-transform: uppercase;
    margin-bottom: 5px;
    font-family: var(--font-mono);
}

.prop-input {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 5px 7px;
    border-radius: 3px;
    outline: none;
}

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

.prop-textarea {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 5px 7px;
    border-radius: 3px;
    outline: none;
    resize: vertical;
    min-height: 56px;
    line-height: 1.4;
}

    .prop-textarea:focus {
        border-color: var(--accent);
    }

/* ─── Rich text editor (description) ─────────────────────────────────────── */
.prop-rt-toolbar {
    display: flex;
    align-items: center;
    gap: 1px;
    background: var(--surface3);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 3px 3px 0 0;
    padding: 3px;
}

    .prop-rt-toolbar button {
        background: transparent;
        border: none;
        color: var(--text2);
        font-family: var(--font-mono);
        font-size: 11px;
        line-height: 1;
        width: 22px;
        height: 22px;
        cursor: pointer;
        border-radius: 2px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

        .prop-rt-toolbar button:hover {
            background: var(--surface2);
            color: var(--accent);
        }

        .prop-rt-toolbar button b,
        .prop-rt-toolbar button i,
        .prop-rt-toolbar button u {
            font-style: inherit;
            font-weight: inherit;
            text-decoration: inherit;
        }

        .prop-rt-toolbar button b {
            font-weight: 700;
        }

        .prop-rt-toolbar button i {
            font-style: italic;
        }

        .prop-rt-toolbar button u {
            text-decoration: underline;
        }

.rt-sep {
    width: 1px;
    align-self: stretch;
    background: var(--border);
    margin: 2px 3px;
}

.prop-rt-edit {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 0 0 3px 3px;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 6px 7px;
    outline: none;
    min-height: 56px;
    max-height: 240px;
    overflow-y: auto;
    line-height: 1.4;
    word-break: break-word;
    overflow-wrap: break-word;
}

    .prop-rt-edit:focus {
        border-color: var(--accent);
    }

    .prop-rt-edit:empty:before {
        content: attr(data-placeholder);
        color: var(--text3);
        pointer-events: none;
    }

    .prop-rt-edit ul,
    .prop-rt-edit ol {
        margin: 2px 0;
        padding-left: 18px;
    }

    .prop-rt-edit li {
        margin: 0;
    }

    .prop-rt-edit p,
    .prop-rt-edit div {
        margin: 0;
    }

.prop-select {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 5px 7px;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    appearance: none;
}

    .prop-select:focus {
        border-color: var(--accent);
    }

.prop-colors {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.prop-color-swatch {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all .15s;
}

    .prop-color-swatch:hover,
    .prop-color-swatch.active {
        border-color: var(--text);
    }

/* ═══════════════════════════════════════════════════════
   STATUS BAR
   ═══════════════════════════════════════════════════════ */
#statusbar {
    display: flex;
    align-items: center;
    height: 24px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 0 12px;
    gap: 16px;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text3);
    flex-shrink: 0;
}

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

.sb-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.sb-item span {
    color: var(--text2);
}

/* ═══════════════════════════════════════════════════════
   CONTEXT MENU
   ═══════════════════════════════════════════════════════ */
#ctx-menu {
    position: fixed;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    z-index: 1000;
    display: none;
    min-width: 140px;
}

.ctx-item {
    padding: 6px 10px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text);
    cursor: pointer;
    border-radius: 3px;
    transition: all .15s;
}

    .ctx-item:hover {
        background: var(--surface3);
        color: var(--accent);
    }

    .ctx-item.danger:hover {
        background: rgba(224, 80, 80, 0.15);
        color: var(--red);
    }

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

/* ═══════════════════════════════════════════════════════
   NODE & EDGE STYLES (SVG)
   ═══════════════════════════════════════════════════════ */
.node {
    cursor: move;
    transition: filter .15s;
}

    .node:hover {
        filter: brightness(1.1);
    }

    .node.selected rect,
    .node.selected circle,
    .node.selected ellipse,
    .node.selected path {
        stroke: var(--accent);
        stroke-width: 2;
    }

.node-label {
    font-family: var(--font-mono);
    font-size: 11px;
    fill: #d8d8d8;
    pointer-events: none;
    user-select: none;
}

/* Node card strokes - theme aware */
.node-card {
    stroke: #363636;
}

.node-selected .node-card {
    stroke: #e8a020;
}

.node-port {
    fill: #fff;
    stroke: #fff;
    stroke-width: 1.5;
    cursor: crosshair;
    transition: all .15s;
}

    .node-port:hover {
        fill: #e8a020;
        stroke: #e8a020;
        r: 5;
    }

/* Light theme ports - GRAY */
[data-theme="light"] .node-port {
    fill: #666 !important;
    stroke: #999 !important;
}

    [data-theme="light"] .node-port:hover {
        fill: #e8a020 !important;
        stroke: #e8a020 !important;
    }

.edge {
    fill: none;
    stroke: #ccc;
    stroke-width: 2;
    cursor: pointer;
    transition: stroke .15s;
}

    .edge:hover {
        stroke: #fff;
    }

    .edge.selected {
        stroke: #e8a020;
        stroke-width: 2.5;
    }

.edge-label {
    font-family: var(--font-mono);
    font-size: 10px;
    fill: #999;
    pointer-events: none;
    user-select: none;
}

.edge-label-bg {
    fill: #1a1a1a;
    stroke: #3a3a3a;
    stroke-width: 1;
}

.arrow-marker {
    fill: #ccc;
}

.arrow-marker-selected {
    fill: #e8a020;
}

/* ═══════════════════════════════════════════════════════
   NODE INTERNALS (foreignObject HTML content)
   ═══════════════════════════════════════════════════════ */
.node-fo-inner {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
    overflow: hidden;
    padding: 4px 6px;
}

.node-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    color: #e0e0e0;
    line-height: 1.3;
    word-break: break-word;
    overflow-wrap: break-word;
}

.node-desc {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    font-weight: 400;
    color: #888;
    line-height: 1.3;
    margin-top: 2px;
    word-break: break-word;
    overflow-wrap: break-word;
}

    .node-desc ul,
    .node-desc ol {
        margin: 1px 0;
        padding-left: 13px;
    }

    .node-desc li {
        margin: 0;
    }

    .node-desc p,
    .node-desc div {
        margin: 0;
    }

/* Traditional view — rich description rendered inside foreignObject */
.node-desc-traditional {
    font-family: 'JetBrains Mono', monospace;
    font-size: 8.5px;
    font-weight: 400;
    color: #777;
    line-height: 1.3;
    text-align: center;
    word-break: break-word;
    overflow-wrap: break-word;
    overflow: hidden;
    pointer-events: none;
}

    .node-desc-traditional ul,
    .node-desc-traditional ol {
        margin: 1px 0;
        padding-left: 13px;
        text-align: left;
    }

    .node-desc-traditional li {
        margin: 0;
    }

    .node-desc-traditional p,
    .node-desc-traditional div {
        margin: 0;
    }

[data-theme="light"] .node-desc-traditional {
    color: #555;
}

/* Node backgrounds and text for light theme */
[data-theme="light"] .node-title {
    color: #1a1a1a;
}

[data-theme="light"] .node-desc {
    color: #555;
}

/* Node shape fills for light theme - only background rects, not icons.
   .bg-node-group is excluded — it uses node.color intentionally. */
[data-theme="light"] .node rect:first-child,
[data-theme="light"] .node-group:not(.bg-node-group) rect:first-child {
    fill: #f8f8f8 !important;
}

[data-theme="light"] .node rect,
[data-theme="light"] .node-group:not(.bg-node-group) rect {
    stroke: #aaa !important;
}

/* Node labels for light theme */
[data-theme="light"] .node-label {
    fill: #1a1a1a;
}

/* Node card strokes for light theme */
[data-theme="light"] .node-card {
    stroke: #bbb !important;
}

[data-theme="light"] .node-selected .node-card {
    stroke: #d87800 !important;
    stroke-width: 2.5 !important;
}

[data-theme="light"] .edge-label {
    fill: #555;
}

[data-theme="light"] .edge-label-bg {
    fill: #f5f5f5;
    stroke: #ccc;
}

[data-theme="light"] .arrow-marker {
    fill: #666;
}

/* Resize handles - theme aware */
.resize-handle {
    fill: #999;
    stroke: #aaa;
    stroke-width: 1.2;
    cursor: nwse-resize;
}

    .resize-handle:hover {
        fill: #e8a020;
        stroke: #e8a020;
    }

[data-theme="light"] .resize-handle {
    fill: #888 !important;
    stroke: #aaa !important;
}

    [data-theme="light"] .resize-handle:hover {
        fill: #e8a020 !important;
        stroke: #e8a020 !important;
    }

/* Light theme edges - darker for visibility */
[data-theme="light"] .edge {
    stroke: #666;
}

    [data-theme="light"] .edge:hover {
        stroke: #333;
    }

    [data-theme="light"] .edge.selected {
        stroke: #e8a020;
    }

/* ═══════════════════════════════════════════════════════
   EXPORT MODAL
   ═══════════════════════════════════════════════════════ */
.export-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: background .2s;
    margin-bottom: 8px;
}

    .export-option:hover {
        background: var(--surface2);
    }

    .export-option svg {
        flex-shrink: 0;
        color: var(--text2);
    }

.export-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 2px;
}

.export-desc {
    font-size: 11px;
    color: var(--text3);
}

.export-sep {
    height: 1px;
    background: var(--border);
    margin: 8px 0;
}

/* ═══════════════════════════════════════════════════════
   MY FLOWS PANEL (slide-out)
   ═══════════════════════════════════════════════════════ */
#my-flows-panel {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    background: var(--surface);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: transform .3s var(--ease);
    z-index: 10;
}

    #my-flows-panel.hidden {
        transform: translateX(100%);
    }

#my-flows-header {
    height: 40px;
    padding: 0 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}

.panel-close {
    background: none;
    border: none;
    color: var(--text3);
    cursor: pointer;
    font-size: 16px;
    padding: 4px 6px;
    line-height: 1;
    transition: color .2s;
}

    .panel-close:hover {
        color: var(--text);
    }

#my-flows-actions {
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

.btn-new-flow {
    width: 100%;
    padding: 8px 12px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--r-sm);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: opacity .2s;
}

    .btn-new-flow:hover {
        opacity: 0.9;
    }

    .btn-new-flow svg {
        flex-shrink: 0;
    }

#my-flows-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.my-flows-empty {
    text-align: center;
    color: var(--text3);
    font-size: 12px;
    padding: 40px 20px;
}

.flow-item {
    padding: 10px 12px;
    background: var(--surface2);
    border-radius: var(--r-sm);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all .2s;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 8px;
}

    .flow-item:hover {
        background: var(--surface3);
        border-color: var(--border2);
    }

    .flow-item.active {
        border-color: var(--accent);
        background: var(--accent-dim);
    }

.flow-item-content {
    flex: 1;
    min-width: 0;
}

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

.flow-item-meta {
    font-size: 10px;
    color: var(--text3);
}

.flow-item-delete {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text3);
    cursor: pointer;
    padding: 4px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all .2s;
}

.flow-item:hover .flow-item-delete {
    opacity: 1;
}

.flow-item-delete:hover {
    background: var(--red);
    color: white;
}

.logo-icon {
    width: 24px;
    height: 21px;
}

/* ── NODE SET PANEL ──────────────────────────────────────────────────────────── */
#node-set-panel {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 240px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: transform .3s var(--ease);
    z-index: 10;
}

    #node-set-panel.hidden {
        transform: translateX(-100%);
    }

#node-set-panel-header {
    height: 40px;
    padding: 0 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    flex-shrink: 0;
}

#node-set-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nsp-intro {
    font-size: 11px;
    color: var(--text3);
    line-height: 1.5;
    padding: 4px 2px 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}

.nsp-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--r-sm);
    border: 1px solid transparent;
    background: var(--surface2);
    transition: border-color .15s, background .15s;
}

    .nsp-row.nsp-active {
        border-color: var(--accent);
        background: var(--accent-dim, rgba(232,160,32,0.08));
    }

.nsp-icon {
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
    width: 22px;
    text-align: center;
}

.nsp-info {
    flex: 1;
    min-width: 0;
}

.nsp-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nsp-tier {
    font-size: 10px;
    color: var(--text3);
    margin-top: 2px;
}

    .nsp-tier.is-pro {
        color: var(--accent);
    }

    .nsp-tier.is-cooldown {
        color: #60a5fa;
    }

.nsp-btn {
    flex-shrink: 0;
    font-size: 10px;
    font-family: var(--font-mono);
    font-weight: 600;
    padding: 4px 9px;
    border-radius: 3px;
    border: 1px solid var(--border2);
    background: var(--surface3, #2a2a2a);
    color: var(--text2);
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
}

    .nsp-btn:hover:not(:disabled) {
        border-color: var(--accent);
        color: var(--accent);
    }

    .nsp-btn:disabled {
        opacity: 0.5;
        cursor: default;
    }

    .nsp-btn.is-active {
        border-color: var(--accent);
        color: var(--accent);
        background: var(--accent-dim, rgba(232,160,32,0.08));
    }

    .nsp-btn.is-upgrade {
        border-color: var(--accent);
        color: var(--accent);
    }

.nsp-footer-note {
    font-size: 10.5px;
    color: var(--text3);
    line-height: 1.5;
    padding: 10px 2px 4px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
}

    .nsp-footer-note a {
        color: var(--accent);
        cursor: pointer;
    }

        .nsp-footer-note a:hover {
            text-decoration: underline;
        }

/* ═══════════════════════════════════════════════════════
   BETA TESTING BANNER (topbar overlay)
   ═══════════════════════════════════════════════════════ */
.beta-banner {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 14px;
    background: linear-gradient(90deg, rgba(232, 160, 32, 0.18) 0%, rgba(232, 160, 32, 0.28) 50%, rgba(232, 160, 32, 0.18) 100%);
    border: 1px solid var(--accent);
    border-radius: 999px;
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 0 14px rgba(232, 160, 32, 0.18);
    user-select: none;
    z-index: 1;
}

    .beta-banner svg {
        width: 13px;
        height: 13px;
        flex-shrink: 0;
        animation: betaPulse 2.4s ease-in-out infinite;
    }

@keyframes betaPulse {
    0%, 100% {
        opacity: 0.7;
    }

    50% {
        opacity: 1;
    }
}

/* Hide banner on narrow screens to avoid layout collision */
@media (max-width: 1100px) {
    .beta-banner {
        display: none;
    }
}
