/* * ========================================
         * 1. ボタン & UI カラー
         * ========================================
         */
/* メインボタンカラー (元のスタイル) */
.gradient-button {
    background-color: #4f46e5;
    /* indigo-600 */
    color: white;
}

.gradient-button:hover {
    background-color: #4338ca;
    /* indigo-700 */
}

/* [変更] ログアウトボタン (アイコンのみ・透明BG) */
.logout-button-icon {
    background-color: transparent;
    color: #4b5563;
    /* gray-600 - ユーザー名と同じ色 */
    transition: background-color 0.2s, color 0.2s;
    /* [最適化] */
    width: 2.5rem;
    /* w-10 */
    height: 2.5rem;
    /* h-10 */
    border-radius: 9999px;
    /* rounded-full */
    display: flex;
    align-items: center;
    justify-content: center;
}

.logout-button-icon:hover {
    background-color: #f3f4f6;
    /* gray-100 (Hover BG) */
    color: #374151;
    /* gray-700 */
}

/* [変更] 送信ボタン (グレー) */
.send-play-button {
    background-color: #6b7280;
    /* gray-500 */
    color: white;
    width: 3rem;
    /* w-12 */
    height: 3rem;
    /* h-12 */
    border-radius: 9999px;
    /* rounded-full */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s;
    /* [最適化] */
}

.send-play-button:hover {
    background-color: #4b5563;
    /* gray-600 */
    color: white;
}

/* [変更] 停止ボタン (グレー) */
.stop-button {
    background-color: #9ca3af;
    /* gray-400 */
    color: white;
    width: 3rem;
    height: 3rem;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s;
    /* [最適化] */
}

.stop-button:hover {
    background-color: #6b7280;
    /* gray-500 */
    color: white;
}

.stop-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* 編集・削除アイコンのサイズ (1.56x = 1.3 × 1.2倍) */
.fa-trash,
.fa-trash-alt,
.fa-edit {
    font-size: 1.56em !important;
}

/* *========================================
         * 2. チャットバブル (吹き出し) スタイル
         * ========================================
         */
/* * ========================================
 * 0. Global Theme & Variables (Faithful Modern)
 * ========================================
 */
:root {
    /* Fonts: Clean Modern Stack */
    --font-sans: 'Inter', 'Noto Sans JP', sans-serif;

    /* Colors: STRICTLY ORIGINAL */
    --bg-main: #f8f8ff;
    --bg-sidebar: #faf0e6;

    /* Shadows: Modern Diffuse */
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.02);
    --shadow-float: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
}

body {
    font-family: var(--font-sans);
    color: #334155;
    /* Slate-700 */
}

/* *========================================
 * 2. チャットバブル (吹き出し) スタイル - Modern Cards
 * ========================================
 */

/* AIメッセージ（カードスタイル・Ghost） */
.message-assistant {
    position: relative;
    background-color: transparent;
    /* Blend with bg */
    color: #1e293b;
    margin-right: auto;
    max-width: 90%;
    /* No border radius needed for ghost text mostly, but good for hover */
    border-radius: 1rem;
    padding: 0.5rem 1rem;
    box-shadow: none;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    line-height: 1.7;
}

.message-assistant:hover {
    background-color: rgba(255, 255, 255, 0.5);
    box-shadow: var(--shadow-card);
}

/* ユーザーメッセージ（カードスタイル・白） */
.message-user {
    position: relative;
    background-color: #ffffff;
    color: #1e293b;
    margin-left: auto;
    margin-right: 0;
    max-width: 80%;
    width: fit-content;

    /* Modern Card Shape */
    border-radius: 1.25rem;
    border-bottom-right-radius: 0.25rem;
    padding: 0.85rem 1.5rem;

    /* Soft Shadow instead of border */
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(226, 232, 240, 0.6);
    /* Slate-200 very light */

    font-size: 0.95rem;
    line-height: 1.6;
    letter-spacing: 0.01em;
}

.message-user a {
    color: #4f46e5 !important;
    text-decoration: underline;
}

.message-user a:hover {
    color: #4338ca !important;
}

/* Force Hide System Support Message (As requested) */
#system-support-message {
    display: none !important;
}

/* テーブル表示の改善 (Card Style) */
.message-assistant table,
.markdown-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    max-width: 100%;
    margin: 1.5rem 0;
    background-color: #ffffff !important;
    box-shadow: var(--shadow-card);
    border-radius: 0.75rem;
    overflow: hidden;
    transform: translateZ(0);
    table-layout: fixed;
    border: 1px solid #e2e8f0;
}

.message-assistant table th,
.markdown-table th {
    border: none !important;
    border-bottom: 1px solid #e2e8f0 !important;
    padding: 12px 16px !important;
    background-color: #f8fafc !important;
    /* Slate-50 */
    color: #475569 !important;
    font-weight: 600 !important;
    font-size: 0.875rem;
    text-align: left !important;
    white-space: normal;
}

.message-assistant table td,
.markdown-table td {
    border: none !important;
    border-bottom: 1px solid #f1f5f9 !important;
    padding: 12px 16px !important;
    background-color: #ffffff !important;
    color: #334155 !important;
    font-size: 0.9rem;
    text-align: left !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.message-assistant table tr:last-child td {
    border-bottom: none !important;
}


.message-assistant a:hover {
    text-decoration: underline;
    color: #1d4ed8 !important;
    /* 濃い青（Tailwind blue-700相当） */
}

/* アコーディオンメニュー（details/summary）のスタイル */
.message-assistant details {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0.5rem;
    margin: 1rem 0;
    background-color: #f9f9f9;
}

.message-assistant summary {
    cursor: pointer;
    font-weight: 600;
    padding: 0.5rem;
    color: #333;
    user-select: none;
}

.message-assistant summary:hover {
    background-color: #e8e8e8;
    border-radius: 4px;
}

.message-assistant details[open] summary {
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #ddd;
}

/* テーブル内のdetails（マッチング結果の詳細列）専用スタイル */
.message-assistant table td details,
.markdown-content table td details {
    border: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
    background-color: transparent;
    position: relative;
    display: inline-block;
}

.message-assistant table td details summary,
.markdown-content table td details summary {
    padding: 6px 12px;
    font-weight: normal;
    color: #2563eb;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    background: #f0f7ff;
    border-radius: 4px;
    border: 1px solid #bfdbfe;
    transition: all 0.2s ease;
}

.message-assistant table td details summary:hover,
.markdown-content table td details summary:hover {
    background: #dbeafe;
    border-color: #93c5fd;
}

.message-assistant table td details[open] summary,
.markdown-content table td details[open] summary {
    margin-bottom: 0;
    border-bottom: none;
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

/* テーブル内のdetails展開時のコンテンツ - ポップアップ表示（左側に開く） */
.message-assistant table td details>div,
.markdown-content table td details>div,
.message-assistant table td details .details-popup-content,
.markdown-content table td details .details-popup-content {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 600px;
    max-width: 50vw;
    max-height: 80vh;
    overflow-y: auto;
    padding: 16px;
    background: white;
    border: 2px solid #2563eb;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    font-size: 13px;
    line-height: 1.6;
    white-space: normal;
    word-wrap: break-word;
}

/* 詳細ポップアップ内の項目ラベル */
.details-popup-content strong {
    color: #374151;
    display: inline-block;
    min-width: 160px;
    font-weight: 600;
}

/* 詳細ポップアップ内のボタン */
.details-popup-content button {
    margin-top: 8px;
    padding: 8px 16px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

.details-popup-content button:hover {
    background: #1d4ed8;
}

/* 詳細内のpre要素（本文表示用） */
.message-assistant table td details pre,
.markdown-content table td details pre,
.details-popup-content pre {
    white-space: pre-wrap;
    font-family: inherit;
    margin: 12px 0 0 0;
    padding: 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    max-height: 400px;
    overflow-y: auto;
    font-size: 12px;
    line-height: 1.6;
}

/* テーブルセルにposition relativeを設定 */
.message-assistant table td:last-child,
.markdown-content table td:last-child {
    position: relative;
    overflow: visible;
}

/* ★ 添付ファイルリンクのスタイル */
.att-link {
    color: #2563eb;
    text-decoration: underline;
    cursor: pointer;
    font-size: 13px;
    transition: color 0.2s ease;
}

.att-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* ドロップダウンメニュー（select）のスタイル */
.message-assistant select {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
    color: #333;
    font-size: 14px;
    cursor: pointer;
    min-width: 150px;
}

.message-assistant select:hover {
    border-color: #999;
}

.message-assistant select:focus {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

/* 画像のスタイル */
.message-assistant img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1rem 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 動画のスタイル */
.message-assistant video {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1rem 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* iframeのスタイル（レスポンシブ対応） */
.message-assistant iframe {
    max-width: 100%;
    border: none;
    border-radius: 8px;
    margin: 1rem 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    min-height: 400px;
}

/* [削除] 吹き出し内のヘッダー (font-bold) は不要 */

/* *========================================
         * 3. サイドバー & タブ スタイル
         * ========================================
         */
.history-container {
    /* スクロールは親コンテナに任せる */
}

/* ボットリスト (クリック領域を全体に拡大) */
.bot-item {
    transition: background-color 0.2s ease, color 0.2s ease;
    /* [最適化] */
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-radius: 0.5rem;
    color: #1f2937;
    user-select: none;
    /* クリック可能な見た目 */
    background: transparent;
    border: 1px solid transparent;
}

.bot-item.history-item {
    /* [追加] 履歴アイテム用 */
    padding-left: 0;
}

.bot-item:hover {
    transform: translateX(5px);
    background: rgba(99, 102, 241, 0.08);
    /* 薄い indigo */
    border-color: rgba(99, 102, 241, 0.2);
}

.bot-item:active {
    transform: translateX(3px);
    background: rgba(99, 102, 241, 0.15);
}

.bot-actions {
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s;
    margin-left: 0.5rem;
    /* ボタンとテキストの間隔 */
}

.bot-item:hover .bot-actions {
    opacity: 1;
}

.bot-actions button {
    transition: opacity 0.15s, transform 0.15s;
    /* [最適化] */
    flex-shrink: 0;
    /* ボタンのサイズを固定 */
}

/* [変更] 縦書きメニューテキスト (削除) */
/* .vertical-text { ... } */

/* [変更] タブのスタイル (Chrome風) - 複数タブ対応 */
.tab-container {
    transition: background-color 0.2s ease, color 0.2s ease;
    padding: 0.5rem 0.75rem;
    font-weight: 500;
    color: #6b7280;
    border: none;
    background-color: transparent;
    border-radius: 8px 8px 0 0;
    white-space: nowrap;
    height: 100%;
    display: inline-flex;
    align-items: center;
    position: relative;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
    min-width: 120px;
    max-width: 250px;
    margin-right: 2px;
}

.tab-container:hover {
    background-color: rgba(248, 248, 255, 0.5);
}

.tab-container.tab-active {
    background-color: #f8f8ff;
    color: #1f2937;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.tab-container.tab-active::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background-color: #f8f8ff;
}

.tab-name {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.tab-save-btn,
.tab-close-btn {
    flex-shrink: 0;
}

/* 後方互換性のため .tab-button も維持 */
.tab-button {
    transition: background-color 0.2s ease, color 0.2s ease;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    color: #6b7280;
    border: none;
    background-color: transparent;
    border-radius: 8px 8px 0 0;
    white-space: nowrap;
    height: 100%;
    display: inline-flex;
    align-items: center;
    position: relative;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
    flex: 1;
    max-width: calc(100% - 200px);
    justify-content: space-between;
}

.tab-button:hover {
    transform: none;
    background-color: rgba(248, 248, 255, 0.5);
}

.tab-button.tab-active,
.tab-active {
    background-color: #f8f8ff;
    color: #1f2937;
    border: none;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.tab-button.tab-active::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background-color: #f8f8ff;
}

/* [追加] RAGタブ (admin.htmlからコピー) */
.rag-tab-btn {
    transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
    /* [最適化] */
}

.rag-tab-btn-active {
    border-color: #4f46e5 !important;
    color: #4f46e5 !important;
    background-color: #eef2ff;
    /* indigo-50 */
}

/* スクロールバー (グレー) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f5f5f5;
}

::-webkit-scrollbar-thumb {
    background: #888888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555555;
}

/* *========================================
         * 4. その他 (元のスタイルをすべて維持)
         * ========================================
         */
.message-actions {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.message-assistant:hover .message-actions {
    opacity: 1;
}

.message-action-btn {
    background-color: rgba(255, 255, 255, 0.8);
    border: 1px solid #ddd;
    border-radius: 0.375rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    color: #4b5563;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    /* [最適化] */
}

.message-action-btn:hover {
    background-color: #f3f4f6;
    color: #000;
}

.message-action-btn .fa-check {
    color: #10b981;
}

#reply-to-container {
    display: none;
    background: #f3e8ff;
    border: 1px solid #d8b4fe;
    border-radius: 0.75rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: #5b21b6;
    position: relative;
}

#reply-to-container p {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 90%;
}

#reply-to-container button {
    position: absolute;
    top: 50%;
    right: 0.5rem;
    transform: translateY(-50%);
    font-size: 1.25rem;
    font-weight: bold;
    color: #9333ea;
    background: none;
    border: none;
    cursor: pointer;
}

.markdown-content {
    line-height: 1.7;
    color: #111827;
}

.markdown-content p {
    margin-bottom: 0.5rem;
}

.markdown-content ul,
.markdown-content ol {
    margin-left: 1.5rem;
    margin-bottom: 0.5rem;
}

.markdown-content li {
    margin-bottom: 0.25rem;
}

.markdown-content pre {
    background: transparent !important;
    color: inherit !important;
    padding: 0;
    border-radius: 0;
    overflow-x: auto;
    margin-bottom: 0.5rem;
    border: none;
    font-family: inherit;
    white-space: pre-wrap;
}

.markdown-content code {
    background: transparent;
    color: inherit;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
    font-family: inherit;
}

.markdown-content pre code {
    background: transparent;
    padding: 0;
}

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    transform: translateZ(0);
    /* [最適化] GPU加速を有効化 */
}

.markdown-content th,
.markdown-content td {
    border: 1px solid #ddd;
    padding: 0.75rem;
    text-align: left;
}

.markdown-content th {
    background-color: #f9fafb;
    font-weight: 600;
}

.markdown-content tr:nth-child(even) {
    background-color: #f9fafb;
    will-change: auto;
    /* [最適化] 不要なwill-changeを防止 */
}

.markdown-content details {
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    background: #f9fafb;
}

.markdown-content summary {
    font-weight: 600;
    padding: 0.75rem;
    cursor: pointer;
    outline: none;
}

.markdown-content details[open] summary {
    border-bottom: 1px solid #ddd;
}

.markdown-content .details-content {
    padding: 0.75rem;
    background: #fff;
    border-radius: 0 0 8px 8px;
}

.markdown-content a {
    color: #4f46e5;
    text-decoration: underline;
    font-weight: 500;
}

.markdown-content a:hover {
    color: #3730a3;
}

.file-support {
    font-size: 0.7rem;
    line-height: 1rem;
    color: #6d28d9;
    margin-top: 4px;
}

.file-support i {
    margin-right: 2px;
}

.permanent-file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #e9d5ff;
    color: #5b21b6;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

/* * ========================================
         * Phase 9: スケッチブック専用スタイル
         * ========================================
         */
.sketch-item-content {
    /* 長い文字列を折り返し */
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;

    /* 横スクロールを防止 */
    max-width: 100%;
    overflow-x: hidden;

    /* 通常の折り返し（HTMLレンダリング用） */
    white-space: normal;

    /* テキストの基本スタイル */
    font-size: 0.875rem;
    line-height: 1.5;
    color: #374151;

    /* PowerPoint風: コンテンツ領域を伸縮可能に */
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

/* テキストタイプは改行を保持 */
.sketch-item-content.text-content {
    white-space: pre-wrap;
}

/* スケッチアイテム内のテーブル */
.sketch-item-content table {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    display: block;
}

/* スケッチアイテム内のコードブロック */
.sketch-item-content pre {
    max-width: 100%;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* スケッチアイテム内の画像 */
.sketch-item-content img {
    max-width: 100%;
    height: auto;
}

/* スケッチコンテナのラッパー（スクロール可能） */
#sketch-items-container {
    position: relative;
    /* サイズはJavaScriptで動的に設定 */
}

/* 用紙サイズ表示ボタン（キャンバス左上にオーバーレイ） */
#paper-size-display {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.75rem;
    color: #4b5563;
    cursor: pointer;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
    /* [最適化] */
}

#paper-size-display:hover {
    background: rgba(255, 255, 255, 1);
    border-color: #4f46e5;
    color: #4f46e5;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* スケッチコンテナの親要素（スクロールエリア） */
.sketch-scroll-container {
    flex: 1;
    overflow: auto;
    background-color: #e8e8e8;
    padding: 20px;
    position: relative;
    /* 用紙サイズボタンの基準位置 */
}

/* スケッチアイテムを絶対配置可能に */
.sketch-canvas-item {
    position: absolute !important;
    border: 2px solid transparent !important;
    transition: box-shadow 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
}

/* ヘッダー部分のみドラッグ可能 */
.sketch-canvas-item header {
    cursor: move;
}

/* テキスト編集エリアはテキストカーソル */
.sketch-canvas-item [contenteditable="true"] {
    cursor: text !important;
}

.sketch-canvas-item:hover {
    border-color: #4f46e5 !important;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2) !important;
}

.sketch-canvas-item.selected {
    border-color: #4f46e5 !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1) !important;
}

/* リサイズハンドル */
.resize-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #4f46e5;
    border: 2px solid white;
    border-radius: 50%;
    display: none;
}

.sketch-canvas-item.selected .resize-handle {
    display: block;
}

.resize-handle-nw {
    top: -5px;
    left: -5px;
    cursor: nw-resize;
}

.resize-handle-ne {
    top: -5px;
    right: -5px;
    cursor: ne-resize;
}

.resize-handle-sw {
    bottom: -5px;
    left: -5px;
    cursor: sw-resize;
}

.resize-handle-se {
    bottom: -5px;
    right: -5px;
    cursor: se-resize;
}

.resize-handle-n {
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    cursor: n-resize;
}

.resize-handle-s {
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    cursor: s-resize;
}

.resize-handle-w {
    top: 50%;
    left: -5px;
    transform: translateY(-50%);
    cursor: w-resize;
}

.resize-handle-e {
    top: 50%;
    right: -5px;
    transform: translateY(-50%);
    cursor: e-resize;
}

/* PDF出力・印刷時のスタイル：枠線・影・スクロールバーを非表示 */
@media print {

    /* スケッチアイテムの枠線・影を完全に非表示 */
    .sketch-canvas-item {
        border: none !important;
        box-shadow: none !important;
    }

    /* 選択時の枠線・影も非表示 */
    .sketch-canvas-item.selected {
        border: none !important;
        box-shadow: none !important;
    }

    /* ホバー時の枠線・影も非表示 */
    .sketch-canvas-item:hover {
        border: none !important;
        box-shadow: none !important;
    }

    /* リサイズハンドルを非表示 */
    .resize-handle {
        display: none !important;
    }

    /* スクロールバーを非表示 */
    * {
        overflow: visible !important;
    }

    #sketch-canvas-container {
        overflow: visible !important;
    }

    /* パディングと影（二重枠効果）を削除 */
    .sketch-canvas-item.bg-white {
        box-shadow: none !important;
    }
}

/* コンテキストメニュー */
#sketch-context-menu {
    position: fixed;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    min-width: 180px;
    display: none;
}

#sketch-context-menu.show {
    display: block;
}

/* 背景コンテキストメニュー */
#sketch-background-context-menu {
    position: fixed;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    min-width: 180px;
    display: none;
}

#sketch-background-context-menu.show {
    display: block;
}

.context-menu-item {
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background-color 0.2s;
    font-size: 0.875rem;
}

.context-menu-item:hover,
.context-menu-item.hovered {
    background-color: #e0e7ff;
}

.context-menu-item:first-child {
    border-radius: 8px 8px 0 0;
}

.context-menu-item:last-child {
    border-radius: 0 0 8px 8px;
}

.context-menu-divider {
    height: 1px;
    background-color: #e5e7eb;
    margin: 4px 0;
}

.context-menu-item.danger {
    color: #dc2626;
}

.context-menu-item.danger:hover {
    background-color: #fee2e2;
}

/* カスタムカラークラス（チャットバブル用） */
.bg-lightgreen {
    background-color: lightgreen !important;
}

.bg-lavender {
    background-color: lavender !important;
}

.bg-deepskyblue {
    background-color: deepskyblue !important;
}

.bg-wheat {
    background-color: wheat !important;
}

/* ========================================
         * ワークスペース AI演出用CSS
         * ======================================== */

/* Excelセルハイライト */
.ai-focus-col {
    background-color: rgba(59, 130, 246, 0.2) !important;
    transition: background-color 0.3s ease;
}

.ai-focus-cell {
    background-color: rgba(34, 197, 94, 0.3) !important;
    animation: cellFlash 0.5s ease-in-out;
    border: 2px solid rgba(34, 197, 94, 0.6) !important;
}

@keyframes cellFlash {
    0% {
        background-color: rgba(34, 197, 94, 0);
        transform: scale(1);
    }

    50% {
        background-color: rgba(34, 197, 94, 0.5);
        transform: scale(1.05);
    }

    100% {
        background-color: rgba(34, 197, 94, 0.3);
        transform: scale(1);
    }
}

/* PDFスキャンエフェクト */
.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #3b82f6, transparent);
    animation: scan 2s linear infinite;
    z-index: 10;
    pointer-events: none;
}

@keyframes scan {
    0% {
        top: 0;
        opacity: 1;
    }

    100% {
        top: 100%;
        opacity: 0.5;
    }
}

/* AI思考中エフェクト */
.ai-thinking-pulse {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ワークスペースファイルカードホバー */
.workspace-file-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* コンソールログアニメーション */
@keyframes fadeInLog {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

#workspace-console-output>div {
    animation: fadeInLog 0.3s ease-out;
}

/* ============================================
           Workspace Panel Styles (チャット欄統合型)
           ============================================ */

/* パネル本体 */
.workspace-panel {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 300px;
    min-width: 200px;
    height: 400px;
    min-height: 150px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 40;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}


/* ヘッダー */
.workspace-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}


.workspace-btn {
    padding: 4px 8px;
    border-radius: 6px;
    color: #6b7280;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
}

.workspace-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

/* メインコンテンツ（左右2カラム） */
.workspace-main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* 左カラム: ファイル一覧 */
.workspace-files-column {
    width: 70px;
    min-width: 70px;
    max-width: 70px;
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid #e5e7eb;
    padding: 4px;
    background: #fafafa;
    transition: width 0.2s ease, min-width 0.2s ease, max-width 0.2s ease;
    z-index: 5;
}

/* ホバー時にファイル一覧を拡張 */
.workspace-files-column:hover {
    width: 180px;
    min-width: 180px;
    max-width: 180px;
    box-shadow: 2px 0 8px rgba(0,0,0,0.1);
}

/* ファイル一覧（縦並び） */
.workspace-files-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* 右カラム: プレビュー/ライブビュー */
.workspace-preview-column {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px;
    background: #fff;
}

.workspace-preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #9ca3af;
}

/* ファイルアイテム（小さめ） */
.workspace-file-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 58px;
    height: 58px;
    box-sizing: border-box;
    border: 2px solid transparent;
    background: #fff;
}

/* ホバー時：横並びリスト表示に切替 */
.workspace-files-column:hover .workspace-file-item {
    flex-direction: row;
    justify-content: flex-start;
    width: 100%;
    height: auto;
    min-height: 32px;
    padding: 4px 8px;
    gap: 6px;
}

.workspace-files-column:hover .workspace-file-item .workspace-file-icon {
    font-size: 1rem !important;
    margin-bottom: 0 !important;
    flex-shrink: 0;
}

.workspace-files-column:hover .workspace-file-item .workspace-file-name {
    font-size: 0.7rem !important;
    max-width: none !important;
    -webkit-line-clamp: 1 !important;
    max-height: none !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.workspace-file-item:hover {
    background: #f3f4f6;
}

.workspace-file-item.selected {
    background: #dbeafe;
    border-color: #3b82f6;
}

.workspace-file-item.processing {
    opacity: 0.7;
    position: relative;
}

.workspace-file-item.processing::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 8px;
    height: 8px;
    border: 2px solid #3b82f6;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.workspace-file-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    border-radius: 6px;
    margin-bottom: 4px;
}

.workspace-file-name {
    font-size: 10px;
    color: #374151;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 56px;
}

/* 空状態 */
.workspace-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    color: #9ca3af;
}

/* ドロップオーバーレイ */
.workspace-drop-overlay {
    position: absolute;
    inset: 0;
    background: rgba(238, 242, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed #6366f1;
    border-radius: 8px;
    z-index: 5;
}

/* 作業状況エリア */
.workspace-status {
    border-top: 1px solid #e5e7eb;
    max-height: 150px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}


.workspace-status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: #f9fafb;
    flex-shrink: 0;
}

.workspace-status-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    font-size: 11px;
    background: #1f2937;
    color: #10b981;
    font-family: 'Consolas', monospace;
}

/* ファイルタイプ別色 */
.file-icon-excel {
    background: #dcfce7;
    color: #16a34a;
}

.file-icon-word {
    background: #dbeafe;
    color: #1e40af;
}

.file-icon-pdf {
    background: #fee2e2;
    color: #dc2626;
}

.file-icon-image {
    background: #fef3c7;
    color: #d97706;
}

.file-icon-text {
    background: #f3f4f6;
    color: #6b7280;
}

.file-icon-default {
    background: #e5e7eb;
    color: #4b5563;
}

/* リサイズ中のカーソル */
body.workspace-resizing {
    cursor: ew-resize !important;
    user-select: none;
}

body.workspace-resizing * {
    cursor: ew-resize !important;
}

/* ========================================
         * 問い合わせフォーム自動入力 承認カード
         * ======================================== */

.approval-card {
    animation: slideInUp 0.3s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.approval-card img {
    max-height: 300px;
    object-fit: contain;
}

.approval-card button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 通知カード */
.notification-card {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* スクリーンショットモーダル */
#screenshot-modal {
    animation: fadeIn 0.2s ease-out;
}

#screenshot-modal img {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* 一括送信ボタン */
#batch-submit-btn {
    animation: pulse 2s infinite;
}

#batch-submit-btn:hover {
    animation: none;
}

/* ========================================
         * スマートフォン対応（レスポンシブデザイン）
         * ======================================== */

/* モバイル基本設定 */
@media (max-width: 768px) {

    /* 左サイドバー: オーバーレイ表示 */
    #left-menu {
        position: fixed !important;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 1000;
        width: 16px !important;
        /* 閉じている時は細いバー */
        transition: width 0.3s ease;
    }

    #left-menu.mobile-expanded {
        width: 85vw !important;
        max-width: 320px;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
    }

    #left-menu-icon {
        width: 16px;
    }

    #left-menu.mobile-expanded #left-menu-icon {
        display: none;
    }

    #left-menu.mobile-expanded #left-menu-content {
        display: flex !important;
    }

    /* メニュー展開時の背景オーバーレイ */
    .mobile-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
        pointer-events: none;
        /* デフォルトではクリックを透過 */
    }

    .mobile-overlay.active {
        display: block;
        pointer-events: auto;
        /* アクティブ時のみクリックをブロック */
    }

    /* メインコンテンツ: フル幅 */
    #main-chat {
        width: 100vw !important;
        margin-left: 16px;
        /* 閉じたサイドバー分 */
    }

    /* ヘッダー調整 */
    #main-chat-header {
        padding: 0.5rem 0.75rem;
        height: auto;
        min-height: 56px;
    }

    #chat-header-title {
        font-size: 1.25rem !important;
    }

    /* タブコンテナ: 横スクロール */
    #tabs-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    #tabs-container::-webkit-scrollbar {
        display: none;
    }

    /* タブボタン: コンパクト化 */
    .tab-button,
    .tab-container {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
        min-width: 80px;
        max-width: 150px;
        flex: none;
    }

    .tab-name {
        max-width: 80px;
    }

    .tab-save-btn,
    .tab-close-btn {
        padding: 0.25rem;
    }

    .tab-save-btn i,
    .tab-close-btn i {
        font-size: 0.625rem;
    }

    /* ユーザー表示エリア */
    #user-display-name {
        font-size: 0.75rem;
    }

    /* ログアウトボタン */
    .logout-button-icon {
        width: 2rem;
        height: 2rem;
    }

    /* チャットメッセージエリア */
    #chat-messages {
        padding: 0.75rem;
    }

    .message-user,
    .message-assistant {
        max-width: 92%;
        font-size: 0.875rem;
        padding: 0.625rem 0.875rem;
    }

    /* 入力エリア */
    .p-6 {
        padding: 0.75rem !important;
    }

    #message-input {
        font-size: 16px !important;
        /* iOS ズーム防止 */
        min-height: 44px;
    }

    /* 送信ボタン */
    .send-play-button {
        width: 44px;
        height: 44px;
    }

    /* ファイル添付セクション */
    #file-attach-section {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    #file-attach-section button {
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
    }

    /* ワークスペースパネル: フルスクリーン */
    .workspace-panel {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        border-radius: 0;
        z-index: 1001;
    }

    .workspace-files-column {
        width: 60px;
        min-width: 60px;
        max-width: 60px;
    }

    /* ボット編集モーダル */
    .modal-content,
    [class*="modal"]>div {
        width: 95vw !important;
        max-width: none !important;
        margin: 0.5rem;
        max-height: 90vh;
        overflow-y: auto;
    }

    /* 文字起こしUI */
    #transcription-ui {
        padding: 0.75rem;
    }

    #transcription-ui .grid {
        grid-template-columns: 1fr !important;
    }

    /* 話者入力: 縦並び */
    .speaker-row {
        grid-template-columns: 1fr !important;
        gap: 0.5rem !important;
    }

    .speaker-row input {
        width: 100%;
    }

    /* ボタン全般: タップしやすく */
    button {
        min-height: 44px;
        min-width: 44px;
    }

    /* 小さいボタンは例外 */
    .bot-actions button,
    .message-action-btn,
    .context-menu-item {
        min-height: auto;
        min-width: auto;
    }
}

/* 縦向きスマートフォン専用（より狭い画面） */
@media (max-width: 480px) {
    #left-menu.mobile-expanded {
        width: 90vw !important;
    }

    .tab-button,
    .tab-container {
        min-width: 70px;
        padding: 0.5rem;
    }

    /* メッセージ幅を広げる */
    .message-user,
    .message-assistant {
        max-width: 95%;
    }

    /* ファイル添付ボタン: アイコンのみ */
    #file-attach-section button span:not(.sr-only) {
        display: none;
    }

    #file-attach-section button i {
        margin-right: 0;
    }
}

/* タブレット対応 */
@media (min-width: 769px) and (max-width: 1024px) {
    #left-menu-content {
        padding: 1rem;
    }

    .tab-button,
    .tab-container {
        max-width: 200px;
    }
}

/* 横向きスマートフォン */
@media (max-height: 500px) and (orientation: landscape) {
    #main-chat-header {
        min-height: 48px;
    }

    .workspace-panel {
        height: 100vh !important;
    }
}

/* タッチデバイス用ホバー無効化 */
@media (hover: none) and (pointer: coarse) {
    .bot-item:hover {
        transform: none;
        background: transparent;
        border-color: transparent;
    }

    .bot-item:active {
        transform: translateX(3px);
        background: rgba(99, 102, 241, 0.15);
    }

    .message-assistant:hover {
        box-shadow: none;
    }

    /* ホバーで表示されるアクションは常に表示 */
    .bot-actions {
        opacity: 1;
    }

    .message-actions {
        opacity: 0.7;
    }
}

/* Utility to force hide elements */
.hidden {
    display: none !important;
}

/* ========================================
 * Phase 4: モバイル対応フッター
 * ========================================
 */

/* オーバーレイ */
.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 9998;
    pointer-events: auto;
}

/* スポットライト */
.tutorial-spotlight {
    position: fixed;
    border-radius: 8px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
    z-index: 9999;
    pointer-events: none;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.1);
}

/* ツールチップ */
.tutorial-tooltip {
    position: fixed;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 24px;
    max-width: 400px;
    min-width: 320px;
    z-index: 10000;
    animation: tooltipFadeIn 0.3s ease;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.tutorial-tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.tutorial-step-counter {
    font-size: 12px;
    color: #6b7280;
    background: #f3f4f6;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
}

.tutorial-close-btn {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.tutorial-close-btn:hover {
    background: #f3f4f6;
    color: #4b5563;
}

.tutorial-tooltip-title {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 16px 0;
}

.tutorial-tooltip-content {
    font-size: 14px;
    color: #4b5563;
    line-height: 1.7;
    margin-bottom: 20px;
    white-space: pre-line;
}

.tutorial-tooltip-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.tutorial-btn {
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tutorial-btn-primary {
    background: #4f46e5;
    color: white;
    border: none;
}

.tutorial-btn-primary:hover {
    background: #4338ca;
    transform: translateY(-1px);
}

.tutorial-btn-secondary {
    background: white;
    color: #4b5563;
    border: 1px solid #e5e7eb;
}

.tutorial-btn-secondary:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

/* レスポンシブ対応 */
@media (max-width: 640px) {
    .tutorial-tooltip {
        max-width: calc(100vw - 32px);
        min-width: auto;
        margin: 16px;
    }

    .tutorial-tooltip-title {
        font-size: 18px;
    }

    .tutorial-tooltip-content {
        font-size: 13px;
    }
}

/* クリック待機時のヒント */
.tutorial-click-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
    border-radius: 8px;
    color: #92400E;
    font-weight: 600;
    font-size: 14px;
    animation: pulse-hint 2s ease-in-out infinite;
}

.tutorial-click-hint i {
    font-size: 18px;
    animation: point-animation 1s ease-in-out infinite;
}

@keyframes pulse-hint {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.8;
    }
}

@keyframes point-animation {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-3px);
    }
}

/* UI Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 20px, 0);
    }

    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.5s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease-out forwards;
}