#flow-messages-wrapper {
    display: flex;
    width: 100%;
    height: calc(100vh - 105px);
    min-height: 560px;
    overflow: hidden;
}

#flow-messages-chat {
    flex: 1 1 auto;
    min-width: 0;
}

#flow-messages-isa-panel {
    flex: 0 0 390px;
    width: 390px;
    max-width: 390px;
    height: 100%;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border-left: 1px solid #dfe5ec;
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 24px rgba(15, 23, 42, 0.08);
    z-index: 3;
}

.isa-panel-collapsed #flow-messages-isa-panel {
    display: none;
}

.isa-panel-header {
    padding: 14px 16px;
    border-bottom: 1px solid #e2e8f0;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
}

.isa-panel-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.isa-panel-title {
    font-weight: 700;
    color: #172033;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.isa-panel-title i {
    color: #2563eb;
}

.isa-panel-subtitle {
    color: #64748b;
    font-size: 12px;
    margin-top: 3px;
}

#toggle-isa-panel,
#toggle-isa-panel-floating,
.isa-panel-quick-actions .btn,
.isa-panel-send-actions .btn {
    border-radius: 12px;
    font-weight: 600;
    transition: all .18s ease;
}

#toggle-isa-panel {
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid #dbe4ef;
    background: #ffffff;
    color: #2563eb;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
}

#toggle-isa-panel:hover {
    transform: translateY(-1px);
    background: #eff6ff;
    border-color: #bfdbfe;
}

.isa-panel-context {
    padding: 12px 16px 14px;
    border-bottom: 1px solid #e2e8f0;
    background: rgba(241, 245, 249, 0.92);
}

.isa-panel-context-label {
    display: block;
    font-size: 11px;
    color: #64748b;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 700;
}

.isa-panel-context-value {
    font-size: 12px;
    color: #334155;
    line-height: 1.35;
}

.isa-panel-channel-wrap {
    margin-bottom: 9px;
}

.isa-panel-channel-context-wrap {
    margin-top: 12px;
    margin-bottom: 0;
}

.isa-panel-channel-wrap label {
    display: block;
    font-size: 12px;
    color: #475569;
    margin-bottom: 5px;
    font-weight: 600;
}

#isa-panel-channel-select {
    width: 100%;
}

.isa-panel-channel-context-wrap .select2-container,
.isa-panel-channel-context-wrap .select2-selection--single {
    font-size: 13px;
}

.isa-panel-channel-context-wrap .select2-selection--single {
    border-radius: 12px !important;
    border-color: #dbe4ef !important;
    min-height: 40px;
    padding-top: 4px;
}

.isa-panel-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 14px 16px;
}

.isa-panel-empty {
    background: rgba(255, 255, 255, 0.92);
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    padding: 15px;
    color: #64748b;
    font-size: 13px;
    line-height: 1.5;
    box-shadow: 0 6px 18px rgba(148, 163, 184, 0.08);
}

.isa-panel-message {
    margin-bottom: 12px;
}

.isa-panel-message-question,
.isa-panel-message-answer,
.isa-panel-message-error {
    border-radius: 14px;
    padding: 11px 12px;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.05);
}

.isa-panel-message-question {
    background: linear-gradient(180deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e3a8a;
    margin-left: 26px;
}

.isa-panel-message-answer {
    background: #ffffff;
    color: #1f2937;
    border: 1px solid #e2e8f0;
    margin-right: 18px;
}

.isa-panel-message-answer-formatted {
    white-space: normal;
}

.isa-panel-message-answer-formatted p {
    margin: 0 0 8px;
}

.isa-panel-message-answer-formatted p:last-child,
.isa-panel-message-answer-formatted ul:last-child,
.isa-panel-message-answer-formatted .isa-panel-answer-heading:last-child {
    margin-bottom: 0;
}

.isa-panel-answer-heading {
    font-weight: 700;
    color: #111827;
    margin: 8px 0 4px;
}

.isa-panel-answer-heading:first-child {
    margin-top: 0;
}

.isa-panel-answer-list {
    margin: 0 0 10px 18px;
    padding: 0;
}

.isa-panel-answer-list li {
    margin-bottom: 4px;
    padding-left: 2px;
}

.isa-panel-message-error {
    background: linear-gradient(180deg, #fff1f2 0%, #ffe4e6 100%);
    color: #991b1b;
    border: 1px solid #fecaca;
}

.isa-panel-message-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #94a3b8;
    font-size: 11px;
    margin-top: 5px;
    padding: 0 2px;
}

.isa-panel-footer {
    padding: 14px 16px;
    border-top: 1px solid #e2e8f0;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
}

.isa-panel-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.isa-panel-quick-actions .btn {
    font-size: 12px;
    padding: 7px 11px;
    border-width: 1px;
    box-shadow: 0 6px 14px rgba(148, 163, 184, 0.12);
}

.isa-panel-quick-actions .btn:hover,
.isa-panel-send-actions .btn:hover,
#toggle-isa-panel-floating:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.12);
}

.isa-panel-quick-actions .btn-outline-primary {
    color: #1d4ed8;
    border-color: #bfdbfe;
    background: linear-gradient(180deg, #ffffff 0%, #eff6ff 100%);
}

.isa-panel-quick-actions .btn-outline-primary:hover {
    color: #1e40af;
    border-color: #93c5fd;
    background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
}

.isa-panel-quick-actions .btn-outline-secondary {
    color: #475569;
    border-color: #dbe4ef;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.isa-panel-quick-actions .btn-outline-secondary:hover {
    color: #334155;
    border-color: #cbd5e1;
    background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
}

.isa-panel-quick-actions .btn-outline-success {
    color: #047857;
    border-color: #a7f3d0;
    background: linear-gradient(180deg, #ffffff 0%, #ecfdf5 100%);
}

.isa-panel-quick-actions .btn-outline-success:hover {
    color: #065f46;
    border-color: #6ee7b7;
    background: linear-gradient(180deg, #ecfdf5 0%, #d1fae5 100%);
}

#isa-panel-question {
    min-height: 92px;
    resize: vertical;
    font-size: 13px;
    border-radius: 14px;
    border: 1px solid #cbd5e1;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
    padding: 11px 12px;
}

#isa-panel-question:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
}

.isa-panel-audio-status {
    min-height: 18px;
    margin-top: 7px;
    font-size: 11px;
    line-height: 1.35;
    font-weight: 500;
}

.isa-panel-send-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
}

.isa-panel-compliance-note {
    color: #64748b;
    font-size: 11px;
    line-height: 1.35;
    max-width: 150px;
}

.isa-panel-send-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex: 0 0 auto;
}

.isa-audio-record-btn,
#isa-panel-send {
    min-height: 40px;
    padding: 0 14px;
}

.isa-audio-record-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    border-color: #dbe4ef;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    color: #334155;
    box-shadow: 0 6px 14px rgba(148, 163, 184, 0.12);
}

.isa-audio-record-btn:hover {
    background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
    color: #0f172a;
}

.isa-audio-record-btn.is-recording {
    color: #ffffff;
    border-color: #dc3545;
    background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 10px 18px rgba(220, 38, 38, 0.22);
}

#isa-panel-send {
    border: none;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 10px 18px rgba(37, 99, 235, 0.22);
}

#isa-panel-send:hover,
#isa-panel-send:focus {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
}

#isa-panel-send[disabled] {
    opacity: .72;
    box-shadow: none;
}

#toggle-isa-panel-floating {
    position: fixed;
    right: 18px;
    bottom: 88px;
    z-index: 1040;
    border-radius: 999px;
    border: none;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 12px 24px rgba(37, 99, 235, .24);
    display: none;
}

.isa-panel-collapsed #toggle-isa-panel-floating {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

@media (max-width: 1199px) {
    #flow-messages-isa-panel {
        position: fixed;
        top: 58px;
        right: 0;
        bottom: 0;
        height: calc(100vh - 58px);
        z-index: 1035;
    }

    .isa-panel-collapsed #flow-messages-isa-panel {
        display: none;
    }
}

@media (max-width: 575px) {
    #flow-messages-isa-panel {
        width: 100%;
        max-width: 100%;
        flex-basis: 100%;
    }

    .isa-panel-send-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .isa-panel-compliance-note {
        max-width: 100%;
    }

    .isa-panel-send-actions {
        width: 100%;
    }

    .isa-panel-send-actions .btn {
        flex: 1 1 auto;
    }
}

.isa-panel-workflow-confirmation {
    padding: 12px;
    border: 1px solid #a7f3d0;
    border-radius: 14px;
    background: linear-gradient(180deg, #f0fdf4 0%, #ecfdf5 100%);
    box-shadow: 0 8px 18px rgba(16, 185, 129, 0.09);
}

.isa-panel-confirmation-title {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 9px;
    color: #166534;
    font-size: 13px;
    font-weight: 700;
}

.isa-panel-confirmation-summary {
    margin-bottom: 10px;
    color: #334155;
    font-size: 12px;
    line-height: 1.5;
}

.isa-panel-confirmation-label {
    display: block;
    margin-bottom: 4px;
    color: #475569;
    font-size: 11px;
    font-weight: 600;
}

.isa-panel-confirmation-form {
    margin-bottom: 9px;
    border-color: #bbf7d0;
    background: #ffffff;
}

.isa-panel-confirmation-warning {
    margin: 8px 0;
    padding: 8px 9px;
    border: 1px solid #fde68a;
    border-radius: 9px;
    background: #fffbeb;
    color: #92400e;
    font-size: 11px;
    line-height: 1.4;
}

.isa-panel-confirmation-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 9px;
}

.isa-panel-confirm-demand {
    border: none;
    border-radius: 9px;
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    box-shadow: 0 7px 14px rgba(22, 163, 74, 0.18);
}

.isa-panel-created-demand {
    border-left: 3px solid #22c55e;
}


.isa-panel-checklist-confirmation {
    border: 1px solid #bbf7d0;
    border-radius: 14px;
    padding: 12px;
    background: #f8fffb;
    margin-bottom: 12px;
}

.isa-panel-checklist-group {
    margin-top: 12px;
    padding: 10px;
    border: 1px solid #dcfce7;
    border-radius: 10px;
    background: #fff;
}

.isa-panel-checklist-item-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.isa-panel-checklist-item-row .isa-panel-checklist-item-input {
    flex: 1 1 auto;
    min-width: 0;
}

.isa-panel-checklist-remove-item {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    padding: 0;
}

.isa-panel-checklist-add-item {
    font-size: 12px;
    font-weight: 600;
}

.isa-panel-checklist-confirmation .isa-panel-confirmation-actions {
    gap: 8px;
}
