/* RPC – Left sidebar: sections, tabs, comp-cards, size-grid */

        /* Hover highlight for collapsible left sidebar section headers —
           extends to full sidebar-section width (sidebar-section has padding:20px) */
        .dropdown-header {
            transition: background 0.15s;
            margin: -12px -12px;
            padding: 12px 12px !important;
            border-radius: 0;
        }
        .dropdown-header:hover {
            background: rgba(255,255,255,0.04);
        }

        /* ── Left sidebar tabs ───────────────────────────────────────────── */
        .sb-tabs {
            display: flex;
            border-bottom: 2px solid var(--border);
            background: var(--bg-panel);
            flex-shrink: 0;
            padding: 0 4px;
        }
        .sb-tab {
            flex: 1;
            padding: 14px 4px 12px;
            font-size: 11px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            color: var(--text-dim);
            background: none;
            border: none;
            cursor: pointer;
            border-bottom: 2px solid transparent;
            margin-bottom: -2px;
            transition: color 0.15s, border-color 0.15s;
            user-select: none;
        }
        .sb-tab:hover { color: var(--text); background: rgba(255,255,255,0.04); }
        .sb-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
        .sb-panel { display: none; width: 100%; box-sizing: border-box; }
        .sb-panel.active { display: block; }

        /* ── Component cards in sidebar accordions ──────────────────────── */
        .comp-card {
            display: flex;
            align-items: center;
            gap: 14px;
            padding: 6px 8px;
            border-radius: 6px;
            cursor: pointer;
            background: var(--bg-surface);
            border: 1px solid transparent;
            transition: background 0.15s, border-color 0.15s;
            user-select: none;
        }
        .comp-card:hover {
            background: var(--bg-dark);
            border-color: var(--accent);
        }
        .comp-card-img {
            width: 96px;
            height: 44px;
            object-fit: contain;
            flex-shrink: 0;
            border-radius: 4px;
        }
        .comp-card-name {
            font-size: 12px;
            font-weight: 700;
            color: var(--text);
            line-height: 1.3;
        }
        .comp-card-sub {
            font-size: 11px;
            color: var(--text-dim);
            opacity: 0.40;
            line-height: 1.3;
            margin-top: 2px;
        }
        .comp-card-list {
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        /* Suppress Chrome autofill styling on promptInput */
        #promptInput:-webkit-autofill,
        #promptInput:-webkit-autofill:hover,
        #promptInput:-webkit-autofill:focus {
            -webkit-box-shadow: 0 0 0 100px rgba(20,20,24,0.92) inset !important;
            -webkit-text-fill-color: #e8e8e8 !important;
            caret-color: #e8e8e8;
        }
        /* Hide the native search clear button */
        #promptInput::-webkit-search-cancel-button { display: none; }

        .size-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 8px;
            width: 100%;
            box-sizing: border-box;
        }

        .size-btn {
            padding: 10px;
            background: var(--bg-surface);
            border: 2px solid transparent;
            border-radius: 6px;
            color: var(--text);
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
        }

        .size-btn:hover { background: var(--bg-dark); border-color: var(--accent); }
        .size-btn.active { background: var(--accent); color: white; }

        .component-grid { display: grid; gap: 8px; }

        .component-btn {
            padding: 5px 12px;
            background: var(--bg-surface);
            border: 2px solid transparent;
            border-radius: 6px;
            color: var(--text);
            font-size: 13px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s;
        }

        .component-btn:hover {
            background: var(--bg-dark);
            border-color: var(--accent);
            transform: translateX(4px);
        }

        .action-buttons { display: grid; gap: 8px; margin-top: 12px; }

        .action-btn {
            padding: 10px;
            background: var(--bg-surface);
            border: 2px solid var(--border);
            border-radius: 6px;
            color: var(--text);
            font-size: 13px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s;
        }

        .action-btn:hover { background: var(--bg-dark); border-color: var(--accent); }
        .action-btn.danger:hover { border-color: #ff4444; color: #ff4444; }

        .label-inputs { display: grid; gap: 8px; }

        .label-input-group {
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .label-input-group label {
            font-size: 11px;
            color: var(--text-dim);
        }

        .label-input-group input {
            padding: 8px;
            background: var(--bg-surface);
            border: 1px solid var(--border);
            border-radius: 4px;
            color: var(--text);
            font-size: 13px;
        }

        .label-input-group input:focus {
            outline: none;
            border-color: var(--accent);
        }

        .price-section {
            padding: 20px;
            background: var(--bg-panel);
        }

        .right-section {
            border-bottom: 1px solid var(--border);
        }

        .right-section-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 12px 20px;
            cursor: pointer;
            user-select: none;
        }

        .right-section-header:hover {
            background: rgba(255,255,255,0.03);
        }

        .right-section-title {
            font-size: 11px;
            font-weight: 700;
            color: var(--text);
            text-transform: uppercase;
            letter-spacing: 0.07em;
        }

        .right-section-arrow {
            font-size: 14px;
            transition: transform 0.2s;
            color: var(--text-dim);
        }

        .price-section h3 {
            font-size: 12px;
            font-weight: 600;
            color: var(--text-dim);
            text-transform: uppercase;
            margin-bottom: 12px;
        }

        .price-category-row {
            display: flex; justify-content: space-between; align-items: center;
            padding: 7px 0 5px; font-size: 12px; font-weight: 700;
            color: var(--text); cursor: pointer; border-bottom: 1px solid rgba(255,255,255,0.06);
            user-select: none; opacity: 0.6;
        }
        .price-category-row:last-of-type { border-bottom: none; }
        .price-sub { padding-left: 10px; color: var(--text-dim); }
        .price-line {
            display: flex;
            justify-content: space-between;
            padding: 4px 0;
            font-size: 12px;
            color: var(--text-dim);
            opacity: 0.6;
        }

        .price-total {
            display: flex;
            justify-content: space-between;
            padding: 12px 0;
            margin-top: 8px;
            border-top: 1px solid var(--border);
            font-size: 18px;
            font-weight: 700;
            color: var(--accent);
        }

        .submit-btn {
            width: 100%;
            padding: 8px 10px;
            border: none;
            border-radius: 6px;
            font-size: 14px;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.2s;
            background: var(--accent);
            color: white;
        }

        .submit-btn:disabled {
            background: #666;
            cursor: not-allowed;
            opacity: 0.5;
        }
        .submit-btn.dim {
            background: var(--bg-surface);
            color: var(--text-dim);
            border: 1.5px solid rgba(255,255,255,0.12);
        }
        .submit-btn:not(.dim):hover {
            filter: brightness(1.1);
        }
        .submit-btn:not(.dim):active {
            transform: scale(0.98);
            filter: brightness(0.95);
        }

        .main-content {
            position: relative;
            overflow: hidden;
            background: var(--canvas-bg);
        }

        canvas { display: block; }

        .help-overlay {
            position: absolute;
            bottom: 20px;
            right: 20px;
            background: rgba(42, 42, 42, 0.95);
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 16px 20px;
            font-size: 12px;
            color: var(--text-dim);
            line-height: 1.8;
            pointer-events: none;
        }

        .font-status {
            padding: 8px 12px;
            margin: 12px 20px;
            border-radius: 4px;
            font-size: 11px;
            text-align: center;
        }

        .font-status.loading {
            background: #fff3cd;
            color: #856404;
        }

        .font-status.ready {
            background: #d4edda;
            color: #155724;
        }

        .font-status.error {
            background: #f8d7da;
            color: #721c24;
        }

        /* Modal Styles */
        .modal-overlay {
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.8);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 10000;
            backdrop-filter: blur(4px);
        }

        .modal-content {
            background: var(--bg-panel);
            border-radius: 8px;
            padding: 32px;
            max-width: 700px;
            width: 90%;
            max-height: 85vh;
            overflow-y: auto;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
        }

        .modal-content h2 {
            margin: 0 0 24px 0;
            font-size: 24px;
            color: var(--accent);
        }

        .modal-body {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 24px;
            margin-bottom: 24px;
        }

        .modal-actions {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 12px;
            margin-top: 24px;
        }

        .modal-btn {
            padding: 14px 20px;
            border: none;
            border-radius: 6px;
            font-size: 15px;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.2s;
        }

        .modal-btn.primary {
            background: var(--accent);
            color: white;
        }

        .modal-btn.primary:hover {
            background: #0a7ec4;
        }

        .modal-btn.secondary {
            background: var(--bg-surface);
            color: var(--text);
            border: 1px solid var(--border);
        }

        .modal-btn.secondary:hover {
            background: var(--bg-dark);
        }

        @media (max-width: 768px) {
            .modal-body {
                grid-template-columns: 1fr;
            }
        }
