body {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    background: transparent;
    margin: 0;
    overflow: hidden;
}

/* チャットボタンのスタイル */
#chat-bubble {
    position: fixed;
    bottom: 15px;
    right: 15px;
    width: 55px;
    height: 55px;
    background: #007bff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 1001;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
}

#chat-bubble:hover {
    transform: scale(1.05);
}

#chat-bubble span {
    color: white;
    font-size: 24px;
    font-weight: bold;
}

/* チャットウィンドウのスタイル */
#chat-window {
    position: fixed;
    bottom: 85px;
    right: 15px;
    width: 380px;
    max-width: calc(100vw - 24px);
    transition: width 0.2s ease, height 0.2s ease;
    height: 500px;
    display: none;
    flex-direction: column;
    background: white;
    border-radius: 12px;
    z-index: 1000;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    border: 1px solid #eee;
}

#chat-window.panel-open {
    width: 720px;
    max-width: calc(100vw - 24px);
}

.chat-example {
    margin-top: 6px;
    font-size: 13px;
    color: #64748b;
    line-height: 1.6;
}

/* 追加分3/7 */
.chat-layout {
    width: 100%;
    flex: 1;
    min-height: 0;
    display: flex;
    position: relative;
}

/* 既存チャット領域はそのまま伸縮 */
.chat-container {
    flex: 1;
    min-width: 0;
    width: auto;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* パネル本体（PCでは右ペイン） */
.panel {
    width: 320px;
    height: 100%;
    background: #ffffff;
    border-left: 1px solid #eee;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

/* hidden時は完全に非表示 */
.panel.hidden {
    display: none;
}

/* PCで閉じたときは完全非表示ではなく、右に少しだけ残す */
@media (min-width: 769px) {
    .panel.panel-collapsed-desktop {
        width: 44px;
        min-width: 44px;
        overflow: hidden;
        border-left: 1px solid #eee;
        cursor: pointer;
    }

    .panel.panel-collapsed-desktop .panel-sheet-handle::before {
        content: "◀";
        font-size: 13px;
        color: #64748b;
        display: flex;
        height: 100%;
        /* 親要素（ハンドル）と同じ高さにする */
        align-items: center;
        /* 垂直方向の真ん中 */

    }

    .panel.panel-collapsed-desktop .panel-body {
        display: none;
    }

    .panel.panel-collapsed-desktop .panel-header {
        padding: 14px 6px;
        justify-content: center;
    }

    .panel.panel-collapsed-desktop .panel-title {
        display: none;
    }

    .panel.panel-collapsed-desktop .panel-close-btn {
        display: none;
    }

    .panel.panel-collapsed-desktop .panel-sheet-handle {
        display: flex;
        height: 100%;
        min-height: 72px;
        padding: 0;
    }

    .panel.panel-collapsed-desktop .panel-sheet-bar {
        width: 5px;
        height: 44px;
    }
}

.panel-header {
    position: relative;
    z-index: 4;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #eee;
    background: #fff;
}

.panel-title {
    font-size: 14px;
    font-weight: 700;
    color: #222;
}

.panel-close-btn {
    position: relative;
    z-index: 5;
    pointer-events: auto;
    touch-action: manipulation;
    background: transparent;
    color: #666;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

.panel-close-btn:disabled {
    background: transparent;
    color: #999;
}

.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #fff;
}

.panel-placeholder {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
    color: #666;
}

.panel-sheet-handle {
    display: none;
}


.chat-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* メッセージエリア */
#messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f9f9f9;
}

.message {
    padding: 10px 14px;
    border-radius: 18px;
    max-width: 80%;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.user {
    align-self: flex-end;
    background: #007bff;
    color: white;
    border-bottom-right-radius: 4px;
}

.ai {
    align-self: flex-start;
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* タイピングアニメーションのスタイル */
.typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px !important;
}

.typing span {
    width: 8px;
    height: 8px;
    background: #ccc;
    border-radius: 50%;
    animation: blink 1.4s infinite both;
}

.typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes blink {

    0%,
    80%,
    100% {
        opacity: 0.2;
        transform: scale(0.8);
    }

    40% {
        opacity: 1;
        transform: scale(1);
    }
}

.error {
    align-self: center;
    background: #fee2e2;
    color: #dc2626;
    font-size: 12px;
    border-radius: 8px;
}

/* 入力エリア */
.input-area {
    background: white;
    border-top: 1px solid #eee;
    padding: 15px;
    display: flex;
    gap: 8px;
}

input {
    flex: 1;
    border: 1px solid #a3c8f1;
    padding: 10px 12px;
    border-radius: 20px;
    outline: none;
    font-size: 16px;
}

input:focus {
    border-color: #007bff;
}

#sendBtn {
    background: #007bff;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    flex-shrink: 0;
}

.chat-window-close {
    flex-shrink: 0;
}

#sendBtn:disabled {
    background: #ccc;
}

button:disabled {
    background: #ccc;
}

/* 追記2026/3/7 */
.panel-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.panel-description {
    margin: 0;
    font-size: 14px;
    line-height: 1.7;
    color: #333;
}

.panel-meta {
    font-size: 12px;
    color: #777;
    padding: 8px 10px;
    background: #f7f7f7;
    border-radius: 8px;
}

.panel-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 8px;
}

.panel-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.panel-label {
    font-size: 13px;
    font-weight: 700;
    color: #222;
}

.panel-required {
    display: inline-block;
    margin-left: 6px;
    font-size: 11px;
    font-weight: 700;
    color: #d14;
    background: #fff1f3;
    border-radius: 999px;
    padding: 2px 6px;
    vertical-align: middle;
}

.panel-input,
.panel-textarea,
.panel-select {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 16px;
    line-height: 1.5;
    background: #fff;
}

.panel-input:focus,
.panel-textarea:focus,
.panel-select:focus {
    outline: none;
    border-color: #999;
}

.panel-textarea {
    min-height: 96px;
    resize: vertical;
}

/* 送信ボタン */
.panel-actions {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.panel-actions-note {
    margin: 0;
    font-size: 12px;
    line-height: 1.5;
    color: #666;
}

.panel-submit-btn {
    width: 100%;
    border: none;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    background: #222;
    color: #fff;
}

.panel-submit-btn:hover {
    opacity: 0.92;
}

/* エラー見た目 */
.panel-field-error .panel-input,
.panel-field-error .panel-textarea,
.panel-field-error .panel-select {
    border-color: #d14;
    background: #fff8f8;
}

.panel-field-error-text {
    margin: 2px 0 0;
    font-size: 12px;
    line-height: 1.4;
    color: #d14;
}

/* 候補UIの見た目 */
.panel-choice-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
    margin-bottom: 6px;
}

.panel-choice-title {
    font-size: 13px;
    font-weight: 700;
    color: #222;
}

.panel-choice-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.panel-choice-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
}

.panel-choice-label {
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    min-width: 0;
    word-break: break-word;
}

.panel-choice-item:has(.panel-choice-radio:checked) {
    border-color: #222;
    background: #f7f7f7;
}

.panel-choice-radio {
    margin: 0;
}

.panel-choice-label {
    font-size: 14px;
    line-height: 1.5;
    color: #333;
}

.panel.dragging {
    transition: none;
    user-select: none;
}

.panel-sheet-handle {
    touch-action: none;
}

/* -----------------------------
   send_link / handoff 用カード
----------------------------- */
.action-card-wrap {
    max-width: 92%;
    padding: 0;
    background: transparent;
    box-shadow: none;
}

.action-card {
    width: 100%;
    box-sizing: border-box;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.action-card-icon {
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
    padding-top: 2px;
}

.action-card-content {
    flex: 1;
    min-width: 0;
}

.action-card-title {
    font-size: 14px;
    font-weight: 700;
    color: #222;
    margin-bottom: 8px;
}

.action-card-note {
    margin: 0 0 10px;
    font-size: 13px;
    line-height: 1.6;
    color: #555;
}

.action-card-contact {
    margin-bottom: 8px;
}

.action-card-contact-label {
    font-size: 12px;
    color: #777;
    margin-bottom: 2px;
}

.action-card-contact-value {
    font-size: 14px;
    font-weight: 600;
    color: #222;
    word-break: break-word;
}

.action-card-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 6px;
    padding: 10px 14px;
    border-radius: 10px;
    background: #222;
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    transition: opacity 0.2s ease;
}

.action-card-button:hover {
    opacity: 0.92;
}

.input-area {
    position: relative;
    z-index: 2;
}

.chat-window-header {
    position: sticky;
    top: 0;
    z-index: 10;
    flex-shrink: 0;
    min-height: 52px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    background: #fff;
}

.chat-window-close {
    position: relative;
    z-index: 11;
    flex-shrink: 0;
    background: transparent;
    color: #007bff;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.chat-window-title {
    font-size: 16px;
    font-weight: 700;
    color: #67a9ef;
}

.chat-window-close {
    background: transparent;
    color: #007bff;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.chat-window-close:hover {
    background: #f5f5f5;
}

@media (max-width: 768px) {
    .action-card {
        padding: 12px;
    }

    .action-card-button {
        width: 100%;
        box-sizing: border-box;
    }
}

/* スマホでは下シート化 */
@media (max-width: 768px) {
    #chat-window {
        width: min(100vw - 16px, 420px);
        height: min(80vh, 640px);
        right: 8px;
        bottom: 8px;
    }

    #chat-window.panel-open {
        width: min(100vw - 16px, 420px);
    }

    #chat-window.panel-peek .input-area {
        margin-bottom: 72px;
    }

    #chat-window.panel-peek #messages {
        padding-bottom: 12px;
    }

    .chat-layout {
        display: block;
    }

    .panel {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 45%;
        border-left: none;
        border-top: 1px solid #eee;
        border-top-left-radius: 16px;
        border-top-right-radius: 16px;
        box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.12);
        z-index: 2;
    }

    .panel-header {
        touch-action: none;
    }

    .panel-sheet-handle {
        position: relative;
        z-index: 3;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 10px 0 6px;
        cursor: pointer;
        user-select: none;
    }

    .panel-sheet-bar {
        display: block;
        width: 44px;
        height: 5px;
        border-radius: 999px;
        background: #d0d0d0;
    }

    /* スマホ下シートのサイズ3段階 */
    .panel.sheet-small {
        height: 22%;
    }

    .panel.sheet-medium {
        height: 55%;
    }

    .panel.sheet-large {
        height: 90%;
    }

    .panel.sheet-peek {
        height: 64px;
    }

    .panel.sheet-small {
        height: 22%;
    }

    .panel.sheet-medium {
        height: 55%;
    }

    .panel.sheet-large {
        height: 90%;
    }


}