
        :root {
            --bg: #0f0f13;
            --surface: #16161d;
            --surface2: #1c1c25;
            --border: #2a2a38;
            --border2: #323244;
            --text: #e2e2ec;
            --text-dim: #7a7a9a;
            --text-mute: #44445a;
            --accent: #7c5cbf;
            --accent-hi: #9b7ce0;
            --accent-lo: #3d2d6b;
            --green: #4caf82;
            --green-bg: #0d2218;
            --green-bd: #1a3d2a;
            --red: #e06070;
            --red-bg: #1f0d16;
            --red-bd: #3a1a26;
            --blue: #7090e0;
            --blue-bg: #0d1428;
            --blue-bd: #1a2445;
            --mono: 'JetBrains Mono', monospace;
            --sans: 'JetBrains Mono', monospace;
        }
        
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: var(--sans);
            background: var(--bg);
            color: var(--text);
            min-height: 100vh;
            padding: clamp(16px, 4vw, 48px) clamp(10px, 3vw, 20px) 80px;
            line-height: 1.6;
        }
        
        .container {
            max-width: 760px;
            margin: 0 auto;
            width: 100%;
        }
        
        .header {
            margin-bottom: 36px;
        }
        
        .header h1 {
            font-family: var(--mono);
            font-size: 0.85rem;
            font-weight: 600;
            color: var(--text);
            letter-spacing: -0.02em;
            margin-bottom: 4px;
        }
        
        .header h1 span {
            color: var(--accent-hi);
        }
        
        .header p {
            font-size: 0.85rem;
            color: var(--text-dim);
        }
        
        .card {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 0px;
            overflow: hidden;
        }
        
        .tabs {
            display: flex;
            border-bottom: 1px solid var(--border);
            overflow-x: auto;
            flex-wrap: nowrap;
            scrollbar-width: none;
            padding: 0 4px;
        }
        
        .tabs::-webkit-scrollbar {
            display: none;
        }
        
        .tab {
            padding: 14px 18px;
            background: none;
            border: none;
            border-bottom: 2px solid transparent;
            margin-bottom: -1px;
            color: var(--text-dim);
            font-family: var(--sans);
            font-size: 0.85rem;
            font-weight: 500;
            cursor: pointer;
            white-space: nowrap;
            flex-shrink: 0;
            transition: color 0.15s;
            outline: none;
        }
        
        .tab:hover {
            color: var(--text);
        }
        
        .tab:focus {
            outline: none;
        }
        
        .tab:focus-visible {
            outline: none;
        }
        
        .tab.active {
            color: var(--accent-hi);
            border-bottom-color: var(--accent);
            background: none;
        }
        
        .panel {
            display: none;
        }
        
        .panel.active {
            display: block;
        }
        
        .panel-body {
            padding: 28px;
        }
        
        .divider {
            height: 1px;
            background: var(--border);
            margin: 0 28px;
        }
        
        .field {
            margin-bottom: 16px;
        }
        
        label {
            display: block;
            margin-bottom: 7px;
            color: var(--text-dim);
            font-size: 0.78rem;
            font-weight: 500;
            text-transform: uppercase;
            letter-spacing: 0.06em;
        }
        
        textarea {
            width: 100%;
            min-height: 148px;
            padding: 13px 14px;
            background: var(--bg);
            border: 1px solid var(--border);
            border-radius: 0px;
            color: var(--text);
            font-family: var(--mono);
            font-size: 0.82rem;
            line-height: 1.65;
            resize: vertical;
            transition: border-color 0.15s;
        }
        
        textarea:focus {
            outline: none;
            border-color: var(--accent);
        }
        
        textarea[readonly] {
            color: var(--text-dim);
            cursor: default;
        }
        
        textarea::placeholder {
            color: var(--text-mute);
        }
        
        .button-group {
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
        }
        
        button {
            padding: 9px 18px;
            border: none;
            border-radius: 0px;
            font-family: var(--sans);
            font-size: 0.85rem;
            font-weight: 500;
            cursor: pointer;
            transition: background 0.15s, opacity 0.15s;
            outline: none;
        }
        
        .btn-primary {
            background: var(--accent);
            color: #fff;
        }
        
        .btn-primary:hover {
            background: var(--accent-hi);
        }
        
        .btn-primary:active {
            background: var(--accent-lo);
        }
        
        .btn-secondary {
            background: var(--surface2);
            color: var(--text-dim);
            border: 1px solid var(--border);
        }
        
        .btn-secondary:hover {
            background: var(--border);
            color: var(--text);
        }
        
        .toggle-row {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-top: 10px;
        }
        
        .toggle-label {
            font-size: 0.7rem;
            color: var(--text-dim);
            user-select: none;
            cursor: pointer;
            text-transform: uppercase;
            letter-spacing: 0.06em;
        }
        
        .toggle-box {
            position: relative;
            width: 16px;
            height: 16px;
            flex-shrink: 0;
            cursor: pointer;
        }
        
        .toggle-box input {
            opacity: 0;
            position: absolute;
            inset: 0;
            margin: 0;
            cursor: pointer;
        }
        
        .toggle-box .box {
            position: absolute;
            inset: 0;
            background: var(--bg);
            border: 1px solid var(--border2);
        }
        
        .toggle-box input:checked+.box {
            background: var(--accent);
            border-color: var(--accent-hi);
        }
        
        .toggle-box input:checked+.box::after {
            content: '';
            position: absolute;
            left: 4px;
            top: 1px;
            width: 4px;
            height: 8px;
            border-right: 2px solid #fff;
            border-bottom: 2px solid #fff;
            transform: rotate(45deg);
        }
        
        button:disabled {
            opacity: 0.4;
            cursor: not-allowed;
        }
        
        .message {
            margin-top: 14px;
        }
        
        .msg {
            padding: 11px 14px;
            border-radius: 0px;
            font-size: 0.84rem;
            line-height: 1.5;
        }
        
        .success {
            background: var(--green-bg);
            border: 1px solid var(--green-bd);
            color: var(--green);
        }
        
        .error {
            background: var(--red-bg);
            border: 1px solid var(--red-bd);
            color: var(--red);
        }
        
        .loading {
            background: var(--blue-bg);
            border: 1px solid var(--blue-bd);
            color: var(--blue);
        }
        
        .footer {
            margin-top: 20px;
            text-align: center;
            font-size: 0.8rem;
            color: var(--text-mute);
        }
        
        .footer a {
            color: var(--text-dim);
            text-decoration: none;
        }
        
        .footer a:hover {
            color: var(--text);
        }
        
        @media (max-width: 520px) {
            body {
                padding: 24px 12px 60px;
            }
            
            .header {
                margin-bottom: 22px;
            }
            
            .header h1 {
                font-size: 0.72rem;
            }
            
            .header p {
                font-size: 0.72rem;
            }
            
            .tab {
                padding: 12px 13px;
                font-size: 0.72rem;
            }
            
            .panel-body {
                padding: 18px 14px;
            }
            
            .divider {
                margin: 0 14px;
            }
            
            textarea {
                font-size: 0.75rem;
                min-height: 120px;
            }
            
            button {
                font-size: 0.72rem;
                padding: 9px 13px;
            }
            
            .button-group {
                flex-direction: column;
            }
            
            .button-group button {
                width: 100%;
            }
            
            .msg {
                font-size: 0.72rem;
            }
            
            .settings-panel {
                padding: 16px 14px;
            }
            
            .settings-row {
                flex-wrap: wrap;
                gap: 8px;
            }
            
            .settings-input {
                width: 100%;
                flex: unset;
            }
            
            .settings-apply {
                width: 100%;
            }
            
            .settings-label {
                font-size: 0.65rem;
            }
        }
        
        .settings-bar {
            display: flex;
            justify-content: flex-end;
            margin-bottom: 14px;
        }
        
        .settings-btn {
            background: none;
            border: 1px solid var(--border);
            color: var(--text-mute);
            padding: 6px 13px;
            font-family: var(--sans);
            font-size: 0.68rem;
            cursor: pointer;
            transition: color 0.15s, border-color 0.15s;
            letter-spacing: 0.04em;
        }
        
        .settings-btn:hover {
            color: var(--text-dim);
            border-color: var(--border2);
        }
        
        .settings-btn.open {
            color: var(--accent-hi);
            border-color: var(--accent);
        }
        
        .settings-panel {
            background: var(--surface);
            border: 1px solid var(--border);
            padding: 22px 24px;
            margin-bottom: 16px;
            display: none;
        }
        
        .settings-panel.visible {
            display: block;
        }
        
        .settings-title {
            font-size: 0.68rem;
            color: var(--text-mute);
            text-transform: uppercase;
            letter-spacing: 0.1em;
            margin-bottom: 20px;
        }
        
        .settings-row {
            display: flex;
            align-items: center;
            gap: 12px;
            margin-bottom: 14px;
        }
        
        .settings-row:last-child {
            margin-bottom: 0;
        }
        
        .settings-label {
            font-size: 0.7rem;
            color: var(--text-dim);
            text-transform: uppercase;
            letter-spacing: 0.06em;
            min-width: 80px;
            flex-shrink: 0;
        }
        
        .settings-input {
            flex: 1;
            padding: 7px 10px;
            background: var(--bg);
            border: 1px solid var(--border);
            color: var(--text);
            font-family: var(--mono);
            font-size: 0.78rem;
            outline: none;
            transition: border-color 0.15s;
            min-width: 0;
        }
        
        .settings-input:focus {
            border-color: var(--accent);
        }
        
        .settings-input::placeholder {
            font-family: var(--mono);
            font-size: 0.62rem;
        }
        
        .settings-apply {
            padding: 7px 14px;
            background: var(--accent);
            color: #fff;
            border: none;
            font-family: var(--sans);
            font-size: 0.7rem;
            cursor: pointer;
            flex-shrink: 0;
            transition: background 0.15s;
        }
        
        .settings-apply:hover {
            background: var(--accent-hi);
        }
    


        .vsai-login {
            display: flex;
            flex-direction: column;
            gap: 14px;
            max-width: 340px;
            margin: 0 auto;
        }
        
        .vsai-login-title {
            font-size: 0.78rem;
            color: var(--text-dim);
            text-transform: uppercase;
            letter-spacing: 0.08em;
            margin-bottom: 4px;
        }
        
        .vsai-login input {
            width: 100%;
            padding: 11px 13px;
            background: var(--bg);
            border: 1px solid var(--border);
            border-radius: 0;
            color: var(--text);
            font-family: var(--mono);
            font-size: 0.82rem;
            outline: none;
            transition: border-color 0.15s;
        }
        
        .vsai-login input:focus {
            border-color: var(--accent);
        }
        
        .vsai-login input::placeholder {
            color: var(--text-mute);
        }
        
        .vsai-login-err {
            font-size: 0.78rem;
            color: var(--red);
            min-height: 1.2em;
        }
        
        .vsai-chat {
            display: flex;
            flex-direction: column;
            height: clamp(320px, 60vh, 520px);
        }
        
        .vsai-chat-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 0 14px;
            border-bottom: 1px solid var(--border);
            margin-bottom: 12px;
        }
        
        .vsai-chat-header span {
            font-size: 0.78rem;
            color: var(--text-dim);
        }
        
        .vsai-chat-header button {
            background: none;
            border: 1px solid var(--border);
            color: var(--text-dim);
            font-family: var(--mono);
            font-size: 0.72rem;
            padding: 4px 10px;
            cursor: pointer;
            transition: color 0.15s, border-color 0.15s;
        }
        
        .vsai-chat-header button:hover {
            color: var(--red);
            border-color: var(--red-bd);
        }
        
        .vsai-messages {
            flex: 1;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            gap: 10px;
            padding-right: 4px;
            margin-bottom: 12px;
            scrollbar-width: thin;
            scrollbar-color: var(--border) transparent;
        }
        
        .vsai-messages::-webkit-scrollbar {
            width: 4px;
        }
        
        .vsai-messages::-webkit-scrollbar-thumb {
            background: var(--border);
        }
        
        .vsai-msg {
            padding: 10px 13px;
            font-size: 0.80rem;
            line-height: 1.6;
            white-space: pre-wrap;
            word-break: break-word;
            max-width: 88%;
        }
        
        .vsai-msg.user {
            background: var(--accent-lo);
            border: 1px solid var(--accent);
            align-self: flex-end;
            color: var(--text);
        }
        
        .vsai-msg.ai {
            background: var(--surface2);
            border: 1px solid var(--border);
            align-self: flex-start;
            color: var(--text);
        }
        
        .vsai-msg.ai.streaming {
            border-color: var(--accent);
        }
        
        .cursor {
            animation: blink 0.7s step-end infinite;
        }
        
        @keyframes blink {
            50% {
                opacity: 0;
            }
        }
        
        .vsai-layout {
            display: flex;
            gap: 0;
            height: clamp(320px, 60vh, 520px);
        }
        
        .vsai-sidebar {
            width: clamp(120px, 25vw, 180px);
            flex-shrink: 0;
            border-right: 1px solid var(--border);
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }
        
        .vsai-sidebar-header {
            font-size: 0.66rem;
            color: var(--text-dim);
            text-transform: uppercase;
            letter-spacing: 0.1em;
            padding: 10px 12px 8px;
            border-bottom: 1px solid var(--border);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .vsai-sidebar-header button {
            background: none;
            border: 1px solid var(--border);
            color: var(--text-dim);
            font-family: var(--mono);
            font-size: 0.66rem;
            padding: 2px 7px;
            cursor: pointer;
        }
        
        .vsai-sidebar-header button:hover {
            color: var(--accent-hi);
            border-color: var(--accent);
        }
        
        .vsai-history-list {
            flex: 1;
            overflow-y: auto;
            scrollbar-width: thin;
            scrollbar-color: var(--border) transparent;
        }
        
        .vsai-history-item {
            padding: 9px 12px;
            font-size: 0.72rem;
            color: var(--text-dim);
            cursor: pointer;
            border-bottom: 1px solid rgba(255, 255, 255, 0.04);
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            transition: background 0.1s, color 0.1s;
        }
        
        .vsai-history-item:hover {
            background: var(--surface2);
            color: var(--text);
        }
        
        .vsai-history-item.active {
            background: var(--accent-lo);
            color: var(--accent-hi);
            border-left: 2px solid var(--accent);
        }
        
        .vsai-history-empty {
            padding: 16px 12px;
            font-size: 0.70rem;
            color: #444455;
        }
        
        .vsai-main {
            flex: 1;
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }
        
        .vsai-chat {
            display: flex;
            flex-direction: column;
            height: 100%;
        }
        
        .vsai-msg.ai {
            white-space: normal;
        }
        
        .vsai-msg.ai p {
            margin: 0 0 8px;
        }
        
        .vsai-msg.ai p:last-child {
            margin-bottom: 0;
        }
        
        .vsai-msg.ai h1,
        .vsai-msg.ai h2,
        .vsai-msg.ai h3 {
            font-family: var(--mono);
            font-weight: bold;
            margin: 10px 0 6px;
        }
        
        .vsai-msg.ai h1 {
            font-size: 1rem;
        }
        
        .vsai-msg.ai h2 {
            font-size: 0.92rem;
        }
        
        .vsai-msg.ai h3 {
            font-size: 0.86rem;
        }
        
        .vsai-msg.ai ul,
        .vsai-msg.ai ol {
            padding-left: 18px;
            margin: 4px 0 8px;
        }
        
        .vsai-msg.ai li {
            margin-bottom: 3px;
        }
        
        .vsai-msg.ai code {
            background: rgba(0, 0, 0, 0.35);
            border: 1px solid var(--border);
            padding: 1px 5px;
            font-family: var(--mono);
            font-size: 0.78rem;
            border-radius: 2px;
        }
        
        .vsai-pre-wrap {
            position: relative;
            margin: 8px 0;
            border: 1px solid var(--border);
            background: #0d0d10;
        }
        
        .vsai-pre-titlebar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 7px 10px 6px;
            border-bottom: 1px solid var(--border);
            background: #111116;
        }
        
        .vsai-pre-dots {
            display: flex;
            gap: 5px;
            align-items: center;
        }
        
        .vsai-pre-dots span {
            width: 10px;
            height: 10px;
            border-radius: 50%;
            display: inline-block;
        }
        
        .vsai-pre-dots span:nth-child(1) {
            background: #e06c75;
        }
        
        .vsai-pre-dots span:nth-child(2) {
            background: #e5c07b;
        }
        
        .vsai-pre-dots span:nth-child(3) {
            background: #4caf82;
        }
        
        .vsai-msg.ai pre {
            background: #0d0d10;
            border: none;
            padding: 12px;
            margin: 0;
            overflow-x: auto;
            font-size: 0.76rem;
        }
        
        .vsai-copy-btn {
            background: none;
            border: none;
            color: var(--text-mute);
            padding: 2px 4px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: color 0.15s;
            z-index: 2;
        }
        
        .vsai-copy-btn:hover {
            color: var(--accent-hi);
        }
        
        .vsai-copy-btn.copied {
            color: var(--green);
        }
        
        .vsai-msg.ai pre code {
            background: none;
            border: none;
            padding: 0;
        }
        
        .vsai-msg.ai strong {
            color: var(--accent-hi);
            font-weight: bold;
        }
        
        .vsai-msg.ai em {
            opacity: 0.85;
            font-style: italic;
        }
        
        .vsai-msg.ai hr {
            border: none;
            border-top: 1px solid var(--border);
            margin: 10px 0;
        }
        
        .vsai-msg.ai blockquote {
            border-left: 3px solid var(--accent);
            margin: 6px 0;
            padding: 4px 12px;
            opacity: 0.8;
        }
        
        .vsai-msg.ai table {
            border-collapse: collapse;
            width: 100%;
            margin: 8px 0;
            font-size: 0.76rem;
        }
        
        .vsai-msg.ai th,
        .vsai-msg.ai td {
            border: 1px solid var(--border);
            padding: 5px 10px;
            text-align: left;
        }
        
        .vsai-msg.ai th {
            background: rgba(124, 58, 237, 0.15);
        }
        
        .vsai-msg.ai a {
            color: var(--accent-hi);
            text-decoration: underline;
        }
        
        .vsai-input-row {
            display: flex;
            gap: 8px;
        }
        
        .vsai-input-row textarea {
            flex: 1;
            min-height: 58px;
            max-height: 120px;
            resize: vertical;
        }
        
        .vsai-send {
            align-self: flex-end;
            padding: 11px 18px;
            background: var(--accent);
            border: none;
            color: #fff;
            font-family: var(--mono);
            font-size: 0.80rem;
            cursor: pointer;
            transition: background 0.15s;
            white-space: nowrap;
        }
        
        .vsai-send:hover {
            background: var(--accent-hi);
        }
        
        .vsai-send:disabled {
            background: var(--accent-lo);
            cursor: not-allowed;
        }
    


        .vsp-body {
            display: flex;
            height: clamp(300px, 65vh, 560px);
            overflow: hidden;
        }
        
        .vsp-sidebar {
            width: clamp(150px, 28vw, 230px);
            flex-shrink: 0;
            border-right: 1px solid var(--border);
            display: flex;
            flex-direction: column;
            background: var(--surface);
            overflow: hidden;
        }
        
        .vsp-sidebar-title {
            font-size: 0.66rem;
            text-transform: uppercase;
            letter-spacing: 0.1em;
            color: var(--text-mute);
            font-family: var(--mono);
            padding: 10px 16px 8px;
            border-bottom: 1px solid var(--border);
            flex-shrink: 0;
        }
        
        .vsp-sidebar-inner {
            padding: 16px 14px;
            display: flex;
            flex-direction: column;
            gap: 12px;
            flex: 1;
            overflow-y: auto;
        }
        
        .vsp-field {
            display: flex;
            flex-direction: column;
            gap: 4px;
        }
        
        .vsp-label {
            font-size: 0.67rem;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            color: var(--text-dim);
            font-family: var(--mono);
        }
        
        .vsp-select,
        .vsp-textinput {
            padding: 6px 9px;
            background: var(--bg);
            border: 1px solid var(--border);
            color: var(--text);
            font-family: var(--mono);
            font-size: 0.77rem;
            outline: none;
            transition: border-color 0.15s;
        }
        
        .vsp-select:focus,
        .vsp-textinput:focus {
            border-color: var(--accent);
        }
        
        .vsp-select option {
            background: var(--surface);
        }
        
        .vsp-textarea {
            padding: 9px;
            background: var(--bg);
            border: 1px solid var(--border);
            color: var(--text);
            font-family: var(--mono);
            font-size: 0.73rem;
            resize: vertical;
            min-height: 100px;
            outline: none;
            transition: border-color 0.15s;
            width: 100%;
            box-sizing: border-box;
        }
        
        .vsp-textarea:focus {
            border-color: var(--accent);
        }
        
        .vsp-textarea::placeholder {
            color: var(--text-mute);
            font-size: 0.69rem;
        }
        
        .vsp-info-box {
            font-size: 0.64rem;
            font-family: var(--mono);
            color: var(--text-mute);
            background: var(--surface2);
            border: 1px solid var(--border);
            padding: 6px 9px;
            line-height: 1.6;
        }
        
        .vsp-meta-bar {
            padding: 7px 14px;
            border-top: 1px solid var(--border);
            font-size: 0.64rem;
            color: var(--text-mute);
            font-family: var(--mono);
            flex-shrink: 0;
        }
        
        
        .vsp-canvas-wrap {
            flex: 1;
            position: relative;
            overflow: hidden;
            background: var(--bg);
            cursor: grab;
            user-select: none;
            touch-action: none;
        }
        
        .vsp-canvas-wrap.panning {
            cursor: grabbing;
        }
        
        .vsp-canvas-inner {
            position: absolute;
            top: 0;
            left: 0;
            transform-origin: 0 0;
            will-change: transform;
        }
        
        .vsp-svg-layer {
            position: absolute;
            top: 0;
            left: 0;
            pointer-events: none;
            overflow: visible;
        }
        
        .vsp-node {
            position: absolute;
            width: 200px;
            border: 2px solid;
            padding: 0;
            cursor: pointer;
            transition: filter 0.1s;
            font-family: var(--mono);
            
        }
        
        .vsp-node:hover {
            filter: brightness(1.12);
        }
        
        .vsp-node.vsp-sel {
            outline: 2px solid #fff;
            outline-offset: 2px;
            filter: brightness(1.15);
            z-index: 10;
        }
        
        .vsp-node-head {
            padding: 5px 9px 4px;
            display: flex;
            flex-direction: column;
            gap: 1px;
        }
        
        .vsp-node-cat {
            font-size: 0.57rem;
            font-weight: 700;
            letter-spacing: 0.1em;
            text-transform: uppercase;
            opacity: 0.8;
        }
        
        .vsp-node-name {
            font-size: 0.78rem;
            font-weight: 700;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        
        .vsp-node-type {
            font-size: 0.62rem;
            opacity: 0.65;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        
        .vsp-node-body {
            padding: 5px 9px 6px;
            border-top: 1px solid rgba(255, 255, 255, 0.12);
            font-size: 0.63rem;
        }
        
        .vsp-node-io {
            display: flex;
            gap: 4px;
            flex-wrap: wrap;
            margin-top: 4px;
        }
        
        .vsp-io-pill {
            font-size: 0.56rem;
            padding: 1px 5px;
            border-radius: 2px;
            opacity: 0.8;
        }
        
        .vsp-port-bottom {
            position: absolute;
            width: 10px;
            height: 10px;
            border-radius: 50%;
            border: 2px solid rgba(0, 0, 0, 0.5);
            bottom: -5px;
            transform: translateX(-50%);
            z-index: 3;
            pointer-events: none;
        }
        
        .vsp-port-right {
            position: absolute;
            width: 10px;
            height: 10px;
            border-radius: 50%;
            border: 2px solid rgba(0, 0, 0, 0.5);
            right: -5px;
            transform: translateY(-50%);
            z-index: 3;
            pointer-events: none;
        }
        
        
        .vsp-detail {
            width: clamp(180px, 30vw, 270px);
            flex-shrink: 0;
            border-left: 1px solid var(--border);
            background: var(--surface);
            display: none;
            flex-direction: column;
            overflow: hidden;
        }
        
        .vsp-detail.open {
            display: flex;
        }
        
        .vsp-detail-header {
            padding: 14px 14px 12px;
            border-bottom: 1px solid var(--border);
            flex-shrink: 0;
        }
        
        .vsp-det-header-top {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 8px;
            margin-bottom: 10px;
        }
        
        .vsp-detail-close {
            background: none;
            border: none;
            color: var(--text-mute);
            cursor: pointer;
            font-size: 0.9rem;
            padding: 0;
            line-height: 1;
            flex-shrink: 0;
            margin-top: 1px;
            transition: color 0.15s;
        }
        
        .vsp-detail-close:hover {
            color: var(--text);
        }
        
        .vsp-det-cat-pill {
            display: inline-flex;
            align-items: center;
            font-size: 0.6rem;
            font-family: var(--mono);
            font-weight: 700;
            letter-spacing: 0.1em;
            text-transform: uppercase;
            padding: 2px 7px;
            border-radius: 2px;
        }
        
        .vsp-det-name {
            font-size: 0.9rem;
            font-weight: 700;
            font-family: var(--mono);
            color: var(--text);
            line-height: 1.3;
            word-break: break-word;
        }
        
        .vsp-det-type {
            font-size: 0.65rem;
            color: var(--text-mute);
            font-family: var(--mono);
            margin-top: 2px;
        }
        
        .vsp-detail-body {
            padding: 0;
            overflow-y: auto;
            flex: 1;
            scrollbar-width: thin;
            scrollbar-color: var(--border) transparent;
        }
        
        .vsp-detail-body::-webkit-scrollbar {
            width: 3px;
        }
        
        .vsp-detail-body::-webkit-scrollbar-thumb {
            background: var(--border);
        }
        
        .vsp-det-section {
            border-bottom: 1px solid var(--border);
        }
        
        .vsp-det-section-header {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 8px 14px 7px;
            background: var(--surface2);
        }
        
        .vsp-det-section-icon {
            font-size: 0.7rem;
            opacity: 0.7;
        }
        
        .vsp-det-section-label {
            font-size: 0.62rem;
            font-family: var(--mono);
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.1em;
            color: var(--text-mute);
        }
        
        .vsp-det-section-count {
            margin-left: auto;
            font-size: 0.58rem;
            font-family: var(--mono);
            background: var(--border);
            color: var(--text-dim);
            padding: 1px 5px;
            border-radius: 8px;
        }
        
        .vsp-det-section-body {
            padding: 8px 14px 10px;
        }
        
        .vsp-inp-card {
            background: var(--bg);
            border: 1px solid var(--border);
            border-left: 3px solid;
            padding: 7px 9px 6px;
            margin-bottom: 6px;
        }
        
        .vsp-inp-card:last-child {
            margin-bottom: 0;
        }
        
        .vsp-inp-label {
            font-size: 0.62rem;
            font-family: var(--mono);
            text-transform: uppercase;
            letter-spacing: 0.07em;
            color: var(--text-mute);
            margin-bottom: 3px;
            display: flex;
            align-items: center;
            gap: 4px;
        }
        
        .vsp-inp-dtype {
            font-size: 0.55rem;
            padding: 1px 4px;
            border-radius: 2px;
            font-family: var(--mono);
        }
        
        .vsp-inp-value {
            font-size: 0.78rem;
            font-family: var(--mono);
            color: var(--text);
            font-weight: 500;
            word-break: break-all;
            line-height: 1.4;
        }
        
        .vsp-inp-toggle {
            display: flex;
            align-items: center;
            gap: 5px;
            margin-top: 6px;
            pointer-events: none;
            user-select: none;
        }
        
        .vsp-inp-toggle-box {
            position: relative;
            width: 12px;
            height: 12px;
            flex-shrink: 0;
            border: 1px solid;
        }
        
        .vsp-inp-toggle-check {
            position: absolute;
            left: 2px;
            top: -1px;
            width: 4px;
            height: 7px;
            border-right: 2px solid #fff;
            border-bottom: 2px solid #fff;
            transform: rotate(45deg);
        }
        
        .vsp-inp-toggle-label {
            font-size: 0.6rem;
            font-family: var(--mono);
            text-transform: uppercase;
            letter-spacing: 0.06em;
        }
        
        .vsp-out-chip {
            display: inline-flex;
            flex-direction: row;
            align-items: center;
            gap: 6px;
            padding: 3px 9px 3px 7px;
            border: 1px solid;
            font-size: 0.71rem;
            font-family: var(--mono);
            margin: 0 4px 4px 0;
        }
        
        .vsp-out-chip-dot {
            display: block;
            width: 6px;
            height: 6px;
            min-width: 6px;
            min-height: 6px;
            border-radius: 50%;
            flex-shrink: 0;
            align-self: center;
        }
        
        .vsp-conn-chip {
            display: flex;
            align-items: center;
            gap: 7px;
            padding: 5px 9px;
            border: 1px solid var(--border);
            background: var(--bg);
            margin-bottom: 5px;
            font-size: 0.71rem;
            font-family: var(--mono);
        }
        
        .vsp-conn-chip:last-child {
            margin-bottom: 0;
        }
        
        .vsp-conn-arrow {
            font-size: 0.75rem;
            flex-shrink: 0;
        }
        
        .vsp-conn-name {
            color: var(--text-dim);
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        
        .vsp-conn-tag {
            margin-left: auto;
            font-size: 0.55rem;
            padding: 1px 5px;
            flex-shrink: 0;
        }
        
        .vsp-desc-text {
            font-size: 0.7rem;
            font-family: var(--mono);
            color: var(--text-dim);
            line-height: 1.6;
        }
        
        .vsp-badge {
            display: inline-block;
            font-size: 0.57rem;
            padding: 1px 4px;
            font-family: var(--mono);
            margin-left: 4px;
            vertical-align: middle;
        }
        
        
        .vsp-zoom-bar {
            position: absolute;
            bottom: 12px;
            right: 12px;
            display: flex;
            align-items: center;
            gap: 6px;
            background: var(--surface);
            border: 1px solid var(--border);
            padding: 5px 9px;
            font-family: var(--mono);
            font-size: 0.68rem;
            color: var(--text-dim);
            pointer-events: auto;
            z-index: 20;
        }
        
        .vsp-zoom-btn {
            background: var(--surface2);
            border: 1px solid var(--border);
            color: var(--text);
            width: 20px;
            height: 20px;
            cursor: pointer;
            font-size: 14px;
            line-height: 1;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .vsp-zoom-btn:hover {
            background: var(--border);
        }
        
        .vsp-fit-btn {
            background: var(--surface2);
            border: 1px solid var(--border);
            color: var(--text-dim);
            padding: 1px 6px;
            cursor: pointer;
            font-family: var(--mono);
            font-size: 0.63rem;
        }
        
        .vsp-fit-btn:hover {
            color: var(--text);
        }
        
        
        .vsp-placeholder {
            font-size: 0.76rem;
            font-family: var(--mono);
            text-align: center;
            padding: 60px 24px;
            color: var(--text-mute);
            line-height: 1.8;
            pointer-events: none;
        }
        
        .vsp-status {
            font-size: 0.76rem;
            font-family: var(--mono);
            text-align: center;
            padding: 40px 24px;
        }
        
        .vsp-status.ok {
            color: var(--text-dim);
        }
        
        .vsp-status.err {
            color: var(--red);
        }
    


        .vstj-subtabs {
            display: flex;
            border-bottom: 1px solid var(--border);
            padding: 0 4px;
        }
        
        .vstj-subtab {
            padding: 10px 16px;
            background: none;
            border: none;
            border-bottom: 2px solid transparent;
            margin-bottom: -1px;
            color: var(--text-dim);
            font-family: var(--sans);
            font-size: 0.78rem;
            font-weight: 500;
            cursor: pointer;
            white-space: nowrap;
            transition: color 0.15s;
            outline: none;
        }
        
        .vstj-subtab:hover {
            color: var(--text);
        }
        
        .vstj-subtab:focus,
        .vstj-subtab:focus-visible {
            outline: none;
        }
        
        .vstj-subtab.active {
            color: var(--accent-hi);
            border-bottom-color: var(--accent);
        }
        
        .vstj-subpanel {
            display: none;
        }
        
        .vstj-subpanel.active {
            display: block;
        }
        
        .vstj-info {
            font-size: 0.72rem;
            color: var(--text-mute);
            margin-top: 8px;
            line-height: 1.6;
        }

        @media (max-width: 640px) {

            
            body { padding: 16px 10px 60px !important; }
            .container { width: 100% !important; padding: 0 !important; }
            .card { border-radius: 0; }

            
            .tabs { padding: 0 2px; }
            .tab { padding: 10px 11px; font-size: 0.70rem; }

            
            .panel-body { padding: 16px 12px !important; }
            .divider { margin: 0 12px !important; }

            
            .button-group { flex-direction: column; }
            .button-group button,
            .btn-primary,
            .btn-secondary { width: 100%; min-height: 44px; touch-action: manipulation; }
            button { touch-action: manipulation; }

            
            textarea { font-size: 0.78rem; min-height: 110px; }

            
            .msg { font-size: 0.75rem; }

    
            .settings-panel { padding: 14px 12px; }
            .settings-row { flex-direction: column; align-items: stretch; gap: 6px; }
            .settings-input, .settings-apply { width: 100%; }

            
            .vsai-layout {
                flex-direction: column !important;
                height: auto !important;
                min-height: 0 !important;
            }
            .vsai-sidebar {
                width: 100% !important;
                max-height: 110px !important;
                border-right: none !important;
                border-bottom: 1px solid var(--border) !important;
                flex-shrink: 0;
            }
            .vsai-history-list {
                display: flex !important;
                flex-direction: row !important;
                overflow-x: auto !important;
                overflow-y: hidden !important;
                scrollbar-width: none;
            }
            .vsai-history-list::-webkit-scrollbar { display: none; }
            .vsai-history-item {
                white-space: nowrap;
                border-bottom: none !important;
                border-right: 1px solid rgba(255,255,255,0.04);
                flex-shrink: 0;
            }
            .vsai-main { flex: 1; min-height: 0; overflow: hidden; }
            .vsai-chat {
                height: auto !important;
                min-height: 400px !important;
                display: flex;
                flex-direction: column;
            }
            .vsai-messages { flex: 1; min-height: 200px; }
            .vsai-msg { max-width: 96%; font-size: 0.78rem; }
            .vsai-input-row { flex-direction: column; }
            .vsai-send { align-self: stretch; min-height: 44px; }
            .vsai-input-row textarea { max-height: 80px; }

            
            .vsp-body {
                flex-direction: column !important;
                height: auto !important;
            }
            .vsp-sidebar {
                width: 100% !important;
                max-height: 200px;
                border-right: none !important;
                border-bottom: 1px solid var(--border) !important;
                flex-shrink: 0;
            }
            .vsp-sidebar-inner {
                flex-direction: row;
                flex-wrap: wrap;
                gap: 8px;
                padding: 10px 12px;
                overflow-x: auto;
            }
            .vsp-field { min-width: 130px; flex: 1; }
            .vsp-canvas-wrap { min-height: 300px; }
            .vsp-detail {
                width: 100% !important;
                border-left: none !important;
                border-top: 1px solid var(--border);
                max-height: 280px;
            }

            
            .vstj-subtabs { overflow-x: auto; scrollbar-width: none; }
            .vstj-subtabs::-webkit-scrollbar { display: none; }
        }
    
/* ── VSAI file card (Discord-style) ───────────────────────── */
.vsai-file-card {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    max-width: 340px;
    position: relative;
}
.vsai-file-card:hover {
    background: rgba(255,255,255,0.09);
    border-color: rgba(255,255,255,0.18);
}
.vsai-file-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: rgba(139,92,246,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a78bfa;
}
.vsai-file-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.vsai-file-name {
    font-size: 0.83rem;
    font-weight: 600;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.vsai-file-sub {
    font-size: 0.72rem;
    color: #64748b;
}
.vsai-file-dl-btn {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    background: rgba(139,92,246,0.15);
    border: 1px solid rgba(139,92,246,0.25);
    color: #a78bfa;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}
.vsai-file-dl-btn:hover {
    background: rgba(139,92,246,0.30);
    border-color: rgba(139,92,246,0.45);
    color: #c4b5fd;
}

