.agent-dialogue-entry {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.agent-dialogue-hint {
    color: var(--color-text-light);
    font-size: 12px;
    line-height: 1.5;
}

.agent-dialogue-panel {
    display: none;
    margin-top: 14px;
}

.agent-dialogue-card {
    border: 1px solid var(--color-border-light);
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.agent-dialogue-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--color-border-light);
    background: #fbfaf7;
}

.agent-dialogue-title {
    color: var(--color-text);
    font-size: 14px;
    font-weight: 700;
}

.agent-dialogue-subtitle,
.agent-dialogue-evidence {
    color: var(--color-text-light);
    font-size: 11px;
    line-height: 1.4;
}

.agent-dialogue-close {
    width: 26px;
    height: 26px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: #fff;
    color: var(--color-text-light);
    cursor: pointer;
}

.agent-dialogue-notice {
    margin: 12px 14px 0;
    padding: 8px 10px;
    border-left: 3px solid var(--color-memory);
    background: var(--color-memory-light);
    color: var(--color-text);
    font-size: 12px;
    line-height: 1.5;
}

.agent-dialogue-turns {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
}

.agent-dialogue-turn {
    display: flex;
    gap: 10px;
}

.agent-dialogue-turn.host,
.agent-dialogue-turn.user {
    flex-direction: row-reverse;
}

.agent-dialogue-avatar {
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--color-memory);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
}

.agent-dialogue-turn.host .agent-dialogue-avatar {
    background: #7a5cff;
}

.agent-dialogue-turn.user .agent-dialogue-avatar {
    background: #2563eb;
}

.agent-dialogue-bubble {
    max-width: calc(100% - 44px);
    padding: 9px 11px;
    border: 1px solid var(--color-border-light);
    border-radius: 8px;
    background: #fff;
}

.agent-dialogue-turn.host .agent-dialogue-bubble {
    background: #f7f5ff;
}

.agent-dialogue-turn.user .agent-dialogue-bubble {
    background: #eef6ff;
}

.agent-dialogue-speaker {
    margin-bottom: 4px;
    color: var(--color-text);
    font-size: 12px;
    font-weight: 700;
}

.agent-dialogue-content {
    color: var(--color-text);
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.agent-dialogue-loading,
.agent-dialogue-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--color-border-light);
    border-radius: 8px;
    background: #fff;
    color: var(--color-text);
    font-size: 13px;
}

.agent-dialogue-error {
    color: #b42318;
    background: #fff5f5;
}

.agent-dialogue-history {
    margin-top: 10px;
}

.agent-dialogue-history-title {
    margin-bottom: 6px;
    color: var(--color-text-light);
    font-size: 12px;
}

.agent-dialogue-history-item {
    width: 100%;
    display: flex;
    align-items: stretch;
    gap: 6px;
    margin-top: 6px;
    border: 1px solid var(--color-border-light);
    border-radius: 6px;
    background: #fff;
    color: var(--color-text);
    font-size: 12px;
    overflow: hidden;
}

.agent-dialogue-history-item:hover {
    border-color: var(--color-memory);
}

.agent-dialogue-history-open {
    min-width: 0;
    flex: 1;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.agent-dialogue-history-open span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agent-dialogue-history-delete {
    width: 30px;
    min-width: 30px;
    border: 0;
    border-left: 1px solid var(--color-border-light);
    background: #fff;
    color: var(--color-text-light);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

.agent-dialogue-history-delete:hover {
    background: #fff5f5;
    color: #b42318;
}

.agent-dialogue-status {
    min-height: 20px;
    margin: 10px 14px 0;
    color: var(--color-text-light);
    font-size: 12px;
    line-height: 1.5;
}

.agent-dialogue-status.streaming::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 6px;
    border-radius: 50%;
    background: var(--color-memory);
    vertical-align: middle;
    animation: agent-dialogue-pulse 1s ease-in-out infinite;
}

.agent-dialogue-status.error {
    color: #b42318;
}

.agent-dialogue-round {
    margin-left: 8px;
    color: var(--color-text-light);
    font-size: 11px;
    font-weight: 500;
}

@keyframes agent-dialogue-pulse {
    0%, 100% { opacity: 0.35; }
    50% { opacity: 1; }
}
.agent-dialogue-controls {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 0 14px 14px;
}

.agent-dialogue-chatbar {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.agent-dialogue-chat-input {
    min-width: 0;
    flex: 1;
    min-height: 44px;
    max-height: 90px;
    padding: 8px 10px;
    border: 1px solid var(--color-border-light);
    border-radius: 6px;
    resize: vertical;
    color: var(--color-text);
    font: inherit;
    font-size: 13px;
    line-height: 1.45;
}

.agent-dialogue-chat-input:focus {
    outline: none;
    border-color: var(--color-memory);
    box-shadow: 0 0 0 2px var(--color-memory-light);
}

.agent-dialogue-chat-input:disabled {
    background: #f6f6f6;
    color: var(--color-text-light);
    cursor: not-allowed;
}

.agent-dialogue-action-btn {
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid var(--color-memory);
    border-radius: 6px;
    background: var(--color-memory);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.agent-dialogue-action-btn.secondary {
    background: #fff;
    color: var(--color-memory);
}

.agent-dialogue-action-btn:disabled {
    border-color: var(--color-border);
    background: #f4f4f4;
    color: var(--color-text-light);
    cursor: not-allowed;
}

.agent-dialogue-turn.typing .agent-dialogue-bubble {
    border-style: dashed;
    background: #fffdf8;
}

.agent-dialogue-turn.typing.host .agent-dialogue-bubble {
    background: #f7f5ff;
}

.agent-dialogue-typing-text {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--color-text-light);
}

.agent-dialogue-typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding-left: 1px;
}

.agent-dialogue-typing-dots span {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.35;
    animation: agent-dialogue-dot 1s ease-in-out infinite;
}

.agent-dialogue-typing-dots span:nth-child(2) {
    animation-delay: 0.14s;
}

.agent-dialogue-typing-dots span:nth-child(3) {
    animation-delay: 0.28s;
}

@keyframes agent-dialogue-dot {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.35; }
    40% { transform: translateY(-3px); opacity: 1; }
}

@media (max-width: 480px) {
    .agent-dialogue-chatbar {
        flex-direction: column;
        align-items: stretch;
    }

    .agent-dialogue-chatbar .agent-dialogue-action-btn {
        width: 100%;
    }
}
.agent-dialogue-setup-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 14px;
}

.agent-dialogue-setup-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.agent-dialogue-setup-label {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: var(--color-text);
    font-size: 12px;
    font-weight: 700;
}

.agent-dialogue-setup-label span,
.agent-dialogue-setup-hint {
    color: var(--color-text-light);
    font-size: 11px;
    font-weight: 400;
}

.agent-dialogue-picker-list,
.agent-dialogue-mode-grid {
    display: grid;
    gap: 8px;
}

.agent-dialogue-persona-option,
.agent-dialogue-mode-option {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 9px 10px;
    border: 1px solid var(--color-border-light);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
}

.agent-dialogue-persona-option:has(input:checked),
.agent-dialogue-mode-option:has(input:checked) {
    border-color: var(--color-memory);
    background: var(--color-memory-light);
}

.agent-dialogue-persona-option input,
.agent-dialogue-mode-option input {
    flex: 0 0 auto;
}

.agent-dialogue-persona-avatar {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-memory);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.agent-dialogue-persona-option.self .agent-dialogue-persona-avatar {
    background: #2563eb;
}

.agent-dialogue-persona-main,
.agent-dialogue-mode-option span {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.agent-dialogue-persona-name,
.agent-dialogue-mode-option strong {
    color: var(--color-text);
    font-size: 13px;
    line-height: 1.3;
}

.agent-dialogue-persona-source,
.agent-dialogue-mode-option small {
    color: var(--color-text-light);
    font-size: 11px;
    line-height: 1.35;
}

.agent-dialogue-setup-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 2px;
}

.agent-dialogue-meta {
    margin-top: 8px;
    border-top: 1px dashed var(--color-border-light);
    padding-top: 7px;
}

.agent-dialogue-meta summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: var(--color-text-light);
    font-size: 11px;
    cursor: pointer;
    list-style: none;
}

.agent-dialogue-meta summary::-webkit-details-marker {
    display: none;
}

.agent-dialogue-meta-group {
    margin-top: 8px;
}

.agent-dialogue-meta-title {
    margin-bottom: 4px;
    color: var(--color-text);
    font-size: 11px;
    font-weight: 700;
}

.agent-dialogue-meta ul {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    padding-left: 16px;
    color: var(--color-text);
    font-size: 12px;
    line-height: 1.45;
}

.agent-dialogue-meta small {
    display: block;
    margin-top: 2px;
    color: var(--color-text-light);
    line-height: 1.35;
}

.agent-dialogue-memory-id {
    display: inline-block;
    margin-bottom: 2px;
    color: var(--color-text-light);
    font-size: 10px;
    font-family: monospace;
}

.agent-dialogue-confidence {
    flex: 0 0 auto;
    padding: 2px 6px;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-size: 10px;
    font-weight: 700;
}

.agent-dialogue-confidence.high {
    background: #ecfdf3;
    color: #027a48;
}

.agent-dialogue-confidence.low {
    background: #fff7ed;
    color: #c2410c;
}


.agent-dialogue-analysis-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 10px;
    padding-top: 9px;
    border-top: 1px solid rgba(122, 92, 255, 0.16);
}

.agent-dialogue-analysis-block {
    min-width: 0;
    padding: 8px 9px;
    border: 1px solid var(--color-border-light);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.72);
}

.agent-dialogue-analysis-title {
    margin-bottom: 5px;
    color: var(--color-text);
    font-size: 11px;
    font-weight: 700;
}

.agent-dialogue-analysis-block ul {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin: 0;
    padding-left: 15px;
    color: var(--color-text);
    font-size: 12px;
    line-height: 1.45;
}

.agent-dialogue-analysis-empty {
    color: var(--color-text-light);
    font-size: 12px;
    line-height: 1.4;
}

.agent-dialogue-question-chip {
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--color-memory);
    cursor: pointer;
    font: inherit;
    line-height: 1.45;
    padding: 0;
    text-align: left;
}

.agent-dialogue-question-chip:hover {
    text-decoration: underline;
}

.agent-dialogue-settle-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.agent-dialogue-candidates {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0 14px 14px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border-light);
}

.agent-dialogue-candidates-title {
    color: var(--color-text);
    font-size: 12px;
    font-weight: 700;
}

.agent-dialogue-candidate {
    padding: 9px 10px;
    border: 1px solid var(--color-border-light);
    border-radius: 6px;
    background: #fff;
}

.agent-dialogue-candidate.confirmed {
    border-color: #bbf7d0;
    background: #f7fef9;
}

.agent-dialogue-candidate.dismissed {
    opacity: 0.72;
    background: #f7f7f7;
}

.agent-dialogue-candidate-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: var(--color-text-light);
    font-size: 11px;
    line-height: 1.35;
}

.agent-dialogue-candidate-title {
    margin-top: 4px;
    color: var(--color-text);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
}

.agent-dialogue-candidate-relation {
    margin-top: 3px;
    color: var(--color-memory);
    font-size: 12px;
    line-height: 1.4;
}

.agent-dialogue-candidate-body {
    max-height: 96px;
    overflow: auto;
    margin-top: 6px;
    color: var(--color-text);
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.agent-dialogue-candidate-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

.agent-dialogue-candidate-actions button {
    min-height: 28px;
    padding: 0 10px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: #fff;
    color: var(--color-text);
    cursor: pointer;
    font-size: 12px;
}

.agent-dialogue-candidate-actions button:first-child {
    border-color: var(--color-memory);
    color: var(--color-memory);
}

@media (min-width: 560px) {
    .agent-dialogue-mode-grid,
    .agent-dialogue-analysis-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .agent-dialogue-settle-actions {
        grid-template-columns: 1fr;
    }
}

.agent-workbench {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}

.agent-workbench-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--color-border-light);
}

.agent-workbench-title {
    color: var(--color-text);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
}

.agent-workbench-subtitle {
    margin-top: 3px;
    color: var(--color-text-light);
    font-size: 12px;
    line-height: 1.45;
}

.agent-workbench-search input {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--color-border-light);
    border-radius: 6px;
    background: #fff;
    color: var(--color-text);
    font: inherit;
    font-size: 13px;
}

.agent-workbench-search input:focus {
    outline: none;
    border-color: var(--color-memory);
    box-shadow: 0 0 0 2px var(--color-memory-light);
}

.agent-workbench-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.agent-workbench-memory,
.agent-workbench-change {
    width: 100%;
    border: 1px solid var(--color-border-light);
    border-radius: 8px;
    background: #fff;
    color: var(--color-text);
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.agent-workbench-memory {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 11px;
}

.agent-workbench-memory:hover,
.agent-workbench-change:hover {
    border-color: var(--color-memory);
    background: var(--color-memory-light);
}

.agent-workbench-memory-title {
    color: var(--color-text);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.45;
}

.agent-workbench-memory-meta {
    color: var(--color-text-light);
    font-size: 11px;
    line-height: 1.35;
}

.agent-workbench-selected-card {
    padding: 10px 11px;
    border: 1px solid var(--color-memory);
    border-radius: 8px;
    background: var(--color-memory-light);
}

.agent-workbench-selected-label {
    color: var(--color-text-light);
    font-size: 11px;
    line-height: 1.35;
}

.agent-workbench-selected-title {
    margin-top: 3px;
    color: var(--color-text);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.45;
}

.agent-workbench-selected-meta {
    margin-top: 4px;
    color: var(--color-text-light);
    font-size: 11px;
}

.agent-workbench-change {
    padding: 8px 10px;
    color: var(--color-memory);
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}

.agent-workbench-empty,
.agent-workbench-loading {
    margin-top: 10px;
    padding: 14px 12px;
    border: 1px dashed var(--color-border-light);
    border-radius: 8px;
    background: #fff;
    color: var(--color-text-light);
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
}

#panel-agent-dialogue .agent-dialogue-card {
    margin-top: 0;
}

#panel-agent-dialogue .agent-dialogue-turns {
    max-height: 44vh;
    overflow-y: auto;
}

