/* RPC – Tab bar, canvas area, right-sidebar panel */

        /* ── TAB BAR ──────────────────────────────── */
        #tabBar {
            display: flex;
            align-items: stretch;
            gap: 0;
            padding: 5px 8px 0;
            background: var(--bg-dark);
            border-bottom: none;
            flex-shrink: 0;
            min-height: 34px;
            overflow: hidden;
        }
        /* Viewport that clips the scrollable tab strip */
        #tabViewport {
            flex: 1 1 0;
            min-width: 0;
            overflow: hidden;
            position: relative;
        }
        /* Inner scrollable strip — width determined by content */
        #tabScrollArea {
            display: flex;
            align-items: stretch;
            gap: 2px;
            height: 100%;
            /* Scrolling is driven by JS (scroll arrow buttons), not native scroll */
            overflow: hidden;
            white-space: nowrap;
        }
        /* Scroll arrows */
        .tab-scroll-btn {
            display: none; /* shown by JS when tabs overflow */
            align-items: center;
            justify-content: center;
            width: 22px;
            min-width: 22px;
            height: 34px;
            background: var(--bg-dark);
            border: none;
            border-bottom: none;
            color: #fff;
            font-size: 13px;
            cursor: pointer;
            flex-shrink: 0;
            transition: color 0.12s;
            padding: 0;
            margin-bottom: 0;
        }
        .tab-scroll-btn:hover { color: var(--accent); }
        .tab-scroll-btn.visible { display: flex; }
        /* File buttons wrapper — pinned to the right, never shrinks away */
        #tabFileActions {
            display: flex;
            align-items: center;
            gap: 6px;
            flex-shrink: 0;
            padding-left: 8px;
        }
        .tab {
            display: flex;
            align-items: center;
            background: var(--bg-dark);
            border: 1px solid #555;
            border-bottom: none;
            border-radius: 6px 6px 0 0;
            padding: 0 7px 0 12px;
            min-width: 50px;
            max-width: 200px;
            cursor: pointer;
            user-select: none;
            transition: background 0.12s, border-color 0.12s;
            position: relative;
            top: 2px;
            height: 30px;
            flex-shrink: 0;
        }
        .tab:hover { background: #2a2a2a; }
        .tab.active {
            background: #0E0E10;
            border: 1px solid #555;   /* same border as inactive */
            border-bottom: 2px solid var(--accent);
            z-index: 2;
        }
        .tab.active .tab-label { color: #fff; font-weight: 600; }
        .tab.active .tab-close { color: rgba(255,255,255,0.5); }
        .tab.active .tab-close:hover { color: #cc2222 !important; }
        .tab.active .tab-label-input { color: #fff; }
        /* Tab multi-select highlight */
        .tab.tab-selected {
            border-color: #5aabdb;
            background: #1e2e38;
        }
        .tab.tab-selected.active {
            background: #E4E5E7;
            border: 1px solid rgba(0,0,0,0.12);
            border-bottom: none;
            z-index: 2;
        }
        .tab-label {
            flex: 1;
            font-size: 11px;
            font-weight: 500;
            color: #ccc;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            padding: 0;
            min-width: 0;
            line-height: 30px;
        }

        .tab-label-input {
            flex: 1;
            background: transparent;
            border: none;
            outline: none;
            font-size: 11px;
            font-weight: 600;
            color: #fff;
            font-family: inherit;
            padding: 1px 2px;
            min-width: 30px;
            height: 16px;        /* tightly fits text, selection box stays within tab */
            line-height: 14px;
            align-self: center;
            box-sizing: content-box;
        }
        .tab-close {
            background: none;
            border: none;
            color: #bbb;
            font-size: 13px;
            line-height: 1;
            cursor: pointer;
            padding: 2px 0 2px 5px;
            border-radius: 3px;
            flex-shrink: 0;
            opacity: 0.7;
            transition: opacity 0.12s, color 0.12s;
        }
        .tab:hover .tab-close { opacity: 1; color: #fff; }
        .tab-close:hover { color: #ff5555 !important; opacity: 1; }
        .tab-add {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 28px;
            min-width: 28px;
            height: 30px;
            background: none;
            border: 1px dashed #555;
            border-bottom: none;
            border-radius: 6px 6px 0 0;
            color: #ccc;
            font-size: 18px;
            cursor: pointer;
            position: relative;
            top: 2px;
            transition: all 0.12s;
            flex-shrink: 0;
        }
        .tab-add:hover { border-color: var(--accent); color: var(--accent); }
        .tab-file-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 5px;
            padding: 0 12px;
            height: 26px;
            background: var(--bg-surface);
            border: 1px solid #666;
            border-radius: 5px;
            color: #ccc;
            font-size: 11px;
            font-weight: 500;
            cursor: pointer;
            transition: background 0.12s, border-color 0.12s, color 0.12s;
            white-space: nowrap;
            flex-shrink: 0;
            position: static;
            top: auto;
            letter-spacing: 0.01em;
        }
        .tab-file-btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
        .tab-file-sep {
            width: 1px;
            height: 16px;
            background: #444;
            align-self: center;
            flex-shrink: 0;
        }
        .tab.dragging { opacity: 0.4; }
        .tab.drag-over { border-color: var(--accent) !important; background: #3a3a3a !important; }
        .main-content {
            display: flex;
            flex-direction: column;
            transition: background 0.4s ease;
        }
        #canvas { transition: background 0.4s ease; }
        #canvasWrapper {
            flex: 1;
            position: relative;
            overflow: hidden;
        }

