        /* クラスで適用する場合 */
        .narrow-input {
            font-family: monospace;
            /* 文字幅を安定させる */
            width: 6em;
            /* 約4文字分 */
            box-sizing: border-box;
            /* padding を幅に含める */
            padding: 2px 4px;
            text-align: right;
        }

        .custom-canvas {
            border: 1px solid black;
            position: absolute;
            top: 0;
            left: 0;
        }

        html {
            font-size: 14px;
        }

        html,
        body {
            background: #dfe3e8;
            margin: 0;
            color: #222;
        }

        .header {
            margin: 10px 0;
            padding: 10px;
            background-color: #e7e9ec;
            display: flex;
            align-items: center;
            gap: 10px;
            color: #333;
            border-radius: 8px;
            border: 1px solid #d7dbe0;
        }

        /* ステータスパネルのスタイル */
        .status-panel {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            margin-bottom: 6px;
            background: #f1f3f5;
            padding: 4px 8px;
            border-radius: 6px;
            border: 1px solid #d7dbe0;
        }

        .status-panel-summary {
            width: 100%;
            font-size: 0.9rem;
            font-weight: 600;
            color: #333;
            margin-bottom: 4px;
            padding-bottom: 4px;
            border-bottom: 1px solid #e2e5ea;
        }

        .status-item {
            flex: 1;
            min-width: 50px;
            text-align: center;
        }

        .status-label {
            font-size: 0.65rem;
            color: #666;
            margin-bottom: 1px;
        }

        .status-value {
            font-size: 0.85rem;
            font-weight: bold;
            color: #007bff;
        }

        .progress-bar-container {
            width: 100%;
            height: 6px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 3px;
            margin-top: 10px;
            overflow: hidden;
        }

        .progress-bar-fill {
            width: 0%;
            height: 100%;
            background: linear-gradient(90deg, #00d2ff 0%, #3a7bd5 100%);
            transition: width 0.3s ease;
        }

        button {
            margin: 10px 0;
            padding: 10px;
            background-color: #f5f6f8;
            border: 1px solid #d7dbe0;
            border-radius: 5px;
            cursor: pointer;
            transition: background-color 80ms ease, transform 80ms ease, box-shadow 120ms ease, opacity 120ms ease;
        }

        button:active {
            background-color: #e2e5ea;
            transform: translateY(1px);
            box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12);
        }

        button:disabled {
            opacity: 0.6;
            cursor: not-allowed;
        }

        button.btn-busy {
            cursor: progress;
            position: relative;
            padding-right: 32px;
        }

        button.btn-busy:active {
            transform: none;
            box-shadow: none;
        }

        button.btn-busy::after {
            content: "";
            position: absolute;
            right: 10px;
            top: 50%;
            width: 12px;
            height: 12px;
            margin-top: -6px;
            border: 2px solid rgba(0, 123, 255, 0.25);
            border-top-color: rgba(0, 123, 255, 0.95);
            border-radius: 50%;
            animation: btnSpin 700ms linear infinite;
            pointer-events: none;
        }

        @keyframes btnSpin {
            to {
                transform: rotate(360deg);
            }
        }

        button.btn-flash,
        input.btn-flash {
            animation: btnFlash 160ms ease-out;
        }

        @keyframes btnFlash {
            0% {
                box-shadow: 0 0 0 0 rgba(0, 123, 255, 0);
            }
            30% {
                box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.35);
            }
            100% {
                box-shadow: 0 0 0 0 rgba(0, 123, 255, 0);
            }
        }

        .header label {
            display: inline-block;
            margin-right: 10px;
            font-weight: bold;
        }

        .header select {
            padding: 5px 10px;
            border: 1px solid #ccc;
            border-radius: 3px;
            background-color: #f1f3f5;
            font-size: 14px;
        }

        .header select:focus {
            outline: none;
            border-color: #007bff;
            box-shadow: 0 0 5px rgba(0, 123, 255, 0.3);
        }

        /* シナリオ一覧テーブルのスタイル */
        .scenario-table-container {
            margin-top: 15px;
            max-height: 300px;
            overflow-y: auto;
            border: 1px solid #ccc;
            border-radius: 5px;
            background-color: #f1f3f5;
        }

        .scenario-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 0.9rem;
        }

        .scenario-table th,
        .scenario-table td {
            border: 1px solid #ddd;
            padding: 6px 8px;
            text-align: right;
        }

        .scenario-table th {
            text-align: center;
            background-color: #f0f0f0;
            position: sticky;
            top: 0;
            z-index: 1;
        }

        .scenario-table tr:nth-child(even) {
            background-color: #fafafa;
        }

        .scenario-table tr:hover {
            background-color: #e8f4ff;
        }

        /* 実行中の行をハイライト */
        .scenario-table tr.active-row {
            background-color: #fff3cd;
            /* 薄い黄色 */
            font-weight: bold;
            color: #856404;
            transition: background-color 0.2s ease;
        }

        .task-exec-options {
            margin: 0 0 8px 0;
        }

        .task-exec-options label {
            font-size: 0.9rem;
            cursor: pointer;
        }

        /* タスク実行状況テーブル */
        .task-exec-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 0.85rem;
        }

        .task-exec-table th,
        .task-exec-table td {
            border: 1px solid #ddd;
            padding: 6px 8px;
            text-align: left;
            font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
            white-space: nowrap;
        }

        .task-exec-table th {
            background-color: #f0f0f0;
            position: sticky;
            top: 0;
            z-index: 1;
        }

        .task-exec-ok {
            color: #0a7;
            font-weight: bold;
        }

        .task-exec-err {
            color: #c00;
            font-weight: bold;
        }

        .task-exec-detail {
            font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
            white-space: normal;
        }

        .task-exec-lamp-cell {
            text-align: center;
            padding: 4px 6px;
        }

        .task-exec-lamp {
            display: inline-block;
            width: 8px;
            height: 8px;
            border-radius: 50%;
            border: 1px solid #6c757d;
            background: #adb5bd;
            box-sizing: border-box;
            flex-shrink: 0;
        }

        .task-exec-lamp.is-send {
            background: #ff9f1c;
            box-shadow: 0 0 0 2px rgba(255, 159, 28, 0.25);
            border-color: #d9800f;
        }

        .task-exec-lamp.is-recv {
            background: #2ecc71;
            box-shadow: 0 0 0 2px rgba(46, 204, 113, 0.22);
            border-color: #1f9e55;
        }

        .msg-traffic-actions {
            display: flex;
            align-items: center;
            gap: 10px;
            margin: 0 0 6px 0;
        }

        .msg-traffic-actions button {
            margin: 0;
            padding: 6px 10px;
        }

        .msg-traffic-hint {
            font-size: 0.75rem;
            color: #555;
            user-select: none;
        }

        /* メッセージ通信テーブル/ログ */
        .msg-traffic-log {
            font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
            font-size: 0.8rem;
            border: 1px solid #ddd;
            border-radius: 6px;
            padding: 8px 10px;
            background: #f1f3f5;
            max-height: 160px;
            overflow: auto;
            white-space: pre;
        }

        .msg-traffic-log-cell {
            font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
            font-size: 0.8rem;
            white-space: pre;
        }

        /* デバッグ情報追加レイアウト (CSS Grid) */
        .debug-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 8px;
            font-size: 0.8rem;
            margin-top: 10px;
            max-width: 1100px;
        }

        .debug-group {
            background: #f1f3f5;
            border: 1px solid #cfd4da;
            border-radius: 6px;
            padding: 6px 10px;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
        }

        .debug-group h4 {
            margin: 0 0 6px 0;
            font-size: 0.9rem;
            color: #444;
            border-bottom: 2px solid #e9ecef;
            padding-bottom: 3px;
        }

        .debug-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 3px;
        }

        .debug-item label {
            color: #555;
            flex: 1;
        }

        .debug-item input {
            width: 70px;
            text-align: right;
            font-family: monospace;
            border: 1px solid #ccc;
            border-radius: 3px;
            padding: 1px 3px;
            font-size: 0.8rem;
            background-color: #f8f9fa;
        }

        .debug-item input:read-only {
            background-color: #eef;
            color: #333;
        }

        .full-width {
            grid-column: 1 / -1;
        }

        /* タブ画面用のスタイル */
        .tabs {
            display: flex;
            margin-bottom: 15px;
            border-bottom: 2px solid #ddd;
        }

        .tab-button {
            background-color: transparent;
            border: none;
            outline: none;
            cursor: pointer;
            padding: 8px 16px;
            transition: 0.3s;
            font-size: 0.9rem;
            font-weight: bold;
            color: #555;
            border-bottom: 3px solid transparent;
            margin-right: 10px;
        }

        .tab-button:hover {
            color: #007bff;
        }

        .tab-button.active-tab {
            color: #007bff;
            border-bottom: 3px solid #007bff;
        }

        .tab-content {
            display: none;
            animation: fadeEffect 0.3s;
        }

        .tab-content.active-content {
            display: block;
        }

        @keyframes fadeEffect {
            from {
                opacity: 0;
            }

            to {
                opacity: 1;
            }
        }

        /* シナリオ入力欄の改善 */
        #scenarioInput {
            width: 100%;
            height: 400px;
            font-family: monospace;
            padding: 10px;
            box-sizing: border-box;
            border-radius: 5px;
            border: 1px solid #ccc;
            resize: vertical;
        }

        /* 左ペイン（シナリオ/コース選択） */
        .app-layout {
            display: grid;
            grid-template-columns: 240px 1fr;
            gap: 8px;
            align-items: start;
            --sidebar-w: 240px;
        }

        .app-layout.sidebar-collapsed {
            /* 折りたたみ時はカラムを消し、トグルをコース（canvas）に被せる */
            grid-template-columns: 0 1fr;
            --sidebar-w: 0px;
        }

        .main-area {
            display: flex;
            align-items: flex-start;
            gap: 8px;
        }

        .canvas-stack {
            position: relative;
            flex: 0 0 auto;
        }

        .left-panel {
            width: 100%;
            max-height: calc(100vh - 20px);
            overflow: auto;
            position: sticky;
            top: 10px;
            background: #f1f3f5;
            border: 1px solid #cfd4da;
            border-radius: 6px;
            padding: 6px 8px;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
        }

        .left-panel.is-hidden {
            display: none;
        }

        .left-panel-show-button {
            display: none;
        }

        /* ComfyUI風: 折りたたみ時は細いバーだけ残す */
        .left-panel.collapsed {
            padding: 0;
            width: 0;
            border: 0;
            background: transparent;
            box-shadow: none;
            /* トグルボタンをコース側に被せて表示する */
            overflow: visible;
        }

        .left-panel.collapsed #leftSelectorBody {
            display: none;
        }

        .left-panel.collapsed .section-title {
            display: none;
        }

        .left-panel.collapsed .left-panel-header {
            justify-content: center;
            margin-bottom: 0;
        }

        .left-panel-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
            margin-bottom: 6px;
        }

        .left-panel .section-title {
            font-weight: bold;
            color: #333;
            font-size: 0.85rem;
        }

        /* ツリー（接続線＋アイコン＋開閉） */
        .tree {
            --tree-line: #c3c9d1;
            --tree-text: #2b2f36;
            --tree-muted: #6b7280;
        }

        .tree details {
            margin: 0;
            position: relative;
            padding-left: 14px; /* 接続線分 */
            margin-left: 10px;  /* インデント */
        }

        .tree > details {
            margin-left: 0;
            padding-left: 0;
        }

        /* ネストされたツリー（例: ローカル内の年度ツリー）は1段下げて見せる */
        #scenarioTree.tree,
        #scenarioTreeActionCheck.tree {
            margin-left: 10px;
            padding-left: 14px;
        }

        .tree-caption {
            font-size: 0.8rem;
            color: var(--tree-muted, #6b7280);
            margin: 4px 0 2px 22px;
        }

        /* 縦線 */
        .tree details::before {
            content: "";
            position: absolute;
            left: 6px;
            top: 0;
            bottom: 0;
            width: 1px;
            background: var(--tree-line);
            opacity: 0.85;
        }

        .tree > details::before {
            display: none;
        }

        /* 横線は誤認しやすいので非表示（必要なら右向き版に差し替え可能） */
        .tree details > summary::after {
            display: none;
        }

        .tree summary {
            cursor: pointer;
            user-select: none;
            font-weight: 600;
            color: var(--tree-text);
            font-size: 0.85rem;
            list-style: none;
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 4px 6px;
            border-radius: 6px;
            width: 100%;
            box-sizing: border-box;
        }

        .tree summary:hover {
            background: rgba(0, 0, 0, 0.04);
        }

        .tree summary::-webkit-details-marker {
            display: none;
        }

        /* 開閉アイコン */
        .tree details > summary::before {
            content: "▸";
            color: var(--tree-muted);
            width: 12px;
            display: inline-block;
            transform-origin: center;
            transition: transform 0.12s ease;
        }

        .tree details[open] > summary::before {
            transform: rotate(90deg);
        }

        .tree .tree-item {
            display: flex;
            align-items: center;
            gap: 6px;
            margin: 2px 0 2px 22px; /* summaryアイコン分+インデント */
            position: relative;
        }

        /* leaf（ファイル）横線も非表示 */
        .tree .tree-item::before {
            display: none;
        }

        .tree .tree-item button {
            margin: 0;
            padding: 3px 6px;
            background: #f8f9fa;
            border: 1px solid #cfd4da;
            border-radius: 5px;
            cursor: pointer;
            font-size: 0.8rem;
            width: 100%;
            text-align: left;
        }

        .tree .tree-item button:hover {
            background: #e8f4ff;
            border-color: #b7d9ff;
        }

        .tree .tree-item button::before {
            content: "📄";
            margin-right: 6px;
            opacity: 0.75;
        }

        .tree-row {
            display: flex;
            align-items: center;
            gap: 6px;
            width: 100%;
        }

        .tree-result {
            flex-shrink: 0;
            width: 2.0em;
            text-align: center;
            font-size: 0.9rem;
        }

        .tree-result.qc-ok {
            color: #0a0;              /* 文字色はグリーン系のまま */
            margin: 0 7px 0 -1.0em;
            font-weight: 800;         /* 太字で強調 */
            padding: 1px 4px;         /* OKテキスト用に少し余白 */
            border-radius: 4px;       /* 角丸のバッジ風 */
            background-color: rgba(0, 160, 0, 0.14); /* 薄い背景で視認性アップ */
            box-shadow: 0 0 0 1px rgba(0, 160, 0, 0.25); /* うっすら枠線風 */
        }
        .tree-result.qc-ng {
            color: #c00;
            margin: 0 7px 0 -1.0em;
            font-weight: 800;         /* 太字で強調 */
            padding: 1px 4px;         /* OKテキスト用と同程度 */
            border-radius: 4px;       /* 角丸のバッジ風 */
            background-color: rgba(200, 0, 0, 0.14);
            box-shadow: 0 0 0 1px rgba(200, 0, 0, 0.25);
        }
        .tree-result.qc-run { color: #f80; }

        .tree-folder-label {
            flex: 1;
            min-width: 0;
        }

        .tree-run-btn {
            flex-shrink: 0;
            margin: 0;
            padding: 2px 6px;
            background: #e8f4ff;
            border: 1px solid #b7d9ff;
            border-radius: 4px;
            cursor: pointer;
            font-size: 0.75rem;
            color: #06c;
        }

        .tree-run-btn:hover {
            background: #cce8ff;
        }

        .tree-run-btn:disabled {
            opacity: 0.6;
            cursor: not-allowed;
        }

        .tree summary.scenario-folder-row {
            padding: 4px 8px;
            border: 1px solid #cfd4da;
            border-radius: 5px;
            background: #f8f9fa;
        }

        .tree summary.scenario-folder-row:hover {
            background: #e8f4ff;
            border-color: #b7d9ff;
        }

        .left-panel .small {
            font-size: 0.75rem;
            color: #666;
            margin: 3px 0;
        }

        .left-panel input[type="text"] {
            width: 100%;
            padding: 5px 6px;
            border: 1px solid #ccc;
            border-radius: 6px;
            font-family: ui-monospace, Menlo, Monaco, Consolas, monospace;
            box-sizing: border-box;
        }

        .left-panel .row {
            display: flex;
            gap: 6px;
            align-items: center;
            flex-wrap: wrap;
            margin: 4px 0;
        }

        .left-panel .row button {
            margin: 0;
            padding: 5px 8px;
            font-size: 0.8rem;
        }

        .left-panel .row label {
            font-size: 0.8rem;
            color: #333;
        }

        .left-panel-header button {
            margin: 0;
            padding: 5px 8px;
            font-size: 0.8rem;
        }

        /* サイドバー切替ボタン（折りたたみ時はコースに被せる） */
        #toggleLeftPanelButton {
            position: fixed;
            /* 展開時: サイドバー右上（見出し文字と被せない） */
            left: calc(var(--sidebar-w) - 34px);
            top: 12px;
            z-index: 999;
            margin: 0;
        }

        /* 折りたたみ時: コース側に被せてOK */
        #appLayout.sidebar-collapsed #toggleLeftPanelButton {
            left: 8px;
        }

        .left-panel-header {
            position: relative;
        }

        /* 動作確認（簡易テスト）結果表示 */
        .quickcheck-results {
            width: 100%;
            max-height: 260px;
            overflow: auto;
            border: 1px solid #ddd;
            border-radius: 6px;
            background: #f1f3f5;
            padding: 6px;
            box-sizing: border-box;
        }

        .quickcheck-table th,
        .quickcheck-table td {
            text-align: left;
            white-space: normal;
        }

        .quickcheck-list {
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .quickcheck-suites {
            display: flex;
            flex-direction: column;
            gap: 4px;
            padding: 2px 0 2px 22px; /* treeのインデントと合わせる */
        }

        .quickcheck-suite-item {
            display: flex;
            align-items: center;
            gap: 8px;
            font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
            font-size: 0.8rem;
            color: #333;
        }

        .quickcheck-suite-item input[type="checkbox"] {
            margin: 0;
        }

        .quickcheck-item {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 4px 6px;
            border: 1px solid #ddd;
            border-radius: 6px;
            background: #f8f9fa;
            font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
            font-size: 0.8rem;
            box-sizing: border-box;
        }

        .quickcheck-item .qc-label {
            flex: 1 1 auto;
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .qc-mark {
            font-weight: 800;
            font-size: 1rem;
            display: inline-block;
            min-width: 1.2em;
            text-align: center;
        }
        .qc-ok { color: #0a7; }
        .qc-ng { color: #c00; }
        .qc-run { color: #d9800f; }
