.asm-chat-wrap {
    font-family: system-ui, -apple-system, sans-serif;
    max-width: 1100px;
    margin: 1rem 0;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.asm-chat-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.asm-marathon-select {
    min-width: 200px;
    padding: 6px 10px;
}

.asm-chat-layout {
    display: flex;
    min-height: 420px;
}

.asm-main {
    min-height: 280px;
}

.asm-messages {
    min-height: 200px;
}

.asm-sidebar {
    width: 220px;
    border-right: 1px solid #e2e8f0;
    padding: 12px;
    background: #f1f5f9;
    flex-shrink: 0;
}

.asm-sidebar h3 {
    margin: 0 0 8px;
    font-size: 13px;
    text-transform: uppercase;
    color: #64748b;
}

.asm-conversation-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.asm-conversation-list li {
    margin-bottom: 4px;
}

.asm-conversation-list button {
    width: 100%;
    text-align: left;
    padding: 8px 10px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-height: 44px;
    line-height: 1.35;
}

.asm-conversation-list .asm-conv-title {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
    color: #1e293b;
}

.asm-conversation-list .asm-conv-time {
    display: block;
    font-size: 11px;
    font-weight: 400;
    color: #64748b;
}

.asm-conversation-list button:hover,
.asm-conversation-list button.active {
    background: #e2e8f0;
}

.asm-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.asm-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    max-height: 400px;
}

.asm-msg {
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    max-width: 90%;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.asm-msg-user {
    margin-left: auto;
    background: #2563eb;
    color: #fff;
}

.asm-msg-assistant {
    background: #f1f5f9;
    color: #1e293b;
}

.asm-msg-system {
    background: #fef3c7;
    font-size: 13px;
}

.asm-plan-panel {
    margin: 0 16px 12px;
    padding: 12px;
    border: 2px solid #f59e0b;
    border-radius: 8px;
    background: #fffbeb;
}

.asm-plan-panel h3 {
    margin: 0 0 8px;
    font-size: 15px;
}

.asm-plan-steps {
    font-size: 12px;
    max-height: 160px;
    overflow: auto;
    background: #fff;
    padding: 8px;
    border-radius: 4px;
}

.asm-plan-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.asm-input-row {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #e2e8f0;
}

.asm-input-row textarea {
    flex: 1;
    resize: vertical;
    padding: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
}

.asm-btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 14px;
}

.asm-btn-primary {
    background: #2563eb;
    color: #fff;
}

.asm-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.asm-btn-secondary {
    background: #e2e8f0;
    color: #334155;
}

.asm-notice {
    padding: 16px;
}

.asm-notice.asm-error {
    color: #b91c1c;
}

.asm-loading {
    opacity: 0.6;
    pointer-events: none;
}

.asm-input-row.asm-input-blocked {
    opacity: 0.65;
    background: #f8fafc;
}

.asm-input-row.asm-input-blocked textarea:disabled,
.asm-input-row.asm-input-blocked button:disabled {
    cursor: not-allowed;
}

@media (max-width: 640px) {
    .asm-chat-layout {
        flex-direction: column;
    }
    .asm-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
        max-height: 120px;
        overflow-y: auto;
    }
}
