* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #0f0f1a;
    color: #e0e0e0;
    height: 100vh;
}

.layout {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 280px;
    background: #141422;
    border-right: 1px solid #1e1e3a;
    padding: 16px;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar h2 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #6b6b8a;
    margin-bottom: 14px;
    font-weight: 600;
}

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    color: #6b6b8a;
}

.welcome h1 {
    font-size: 22px;
    margin-bottom: 8px;
    color: #c0c0e0;
    font-weight: 500;
}

.welcome p {
    font-size: 14px;
}

.hidden {
    display: none !important;
}

.btn-primary {
    background: #4a6cf7;
    color: white;
    border: none;
    padding: 9px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    width: 100%;
    margin-bottom: 14px;
    transition: background 0.15s;
}

.btn-primary:hover {
    background: #5b7bf8;
}

.btn-danger {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: background 0.15s;
}

.btn-danger:hover {
    background: #c82333;
}

.session-item {
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 2px;
    font-size: 13px;
    color: #b0b0cc;
    transition: background 0.12s;
}

.session-item:hover {
    background: #1c1c34;
}

.session-item.active {
    background: #222244;
    border-left: 3px solid #4a6cf7;
    padding-left: 9px;
}

.session-item .session-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.session-item .session-id {
    font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
    font-size: 12px;
    color: #9090b0;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: all 0.2s;
    max-width: 120px;
}

.session-item .session-id.expanded {
    max-width: none;
    white-space: normal;
    word-break: break-all;
    font-size: 11px;
}

.session-item:hover .session-id {
    color: #c0c0e0;
}

.session-item .session-id::before {
    content: "#";
    color: #5b5b7a;
    margin-right: 2px;
}

.session-item .session-meta {
    font-size: 11px;
    color: #5b5b7a;
    margin-top: 3px;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    border-bottom: 1px solid #1e1e3a;
    background: #141422;
}

.status-badge {
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.queued { background: #f5a62320; color: #f5a623; border: 1px solid #f5a62340; }
.status-badge.running { background: #3498db20; color: #5bb8f7; border: 1px solid #3498db40; }
.status-badge.completed { background: #27ae6020; color: #4cda80; border: 1px solid #27ae6040; }
.status-badge.failed { background: #e74c3c20; color: #f07070; border: 1px solid #e74c3c40; }
.status-badge.aborted { background: #95a5a620; color: #a0b0b8; border: 1px solid #95a5a640; }

.step-badge {
    font-size: 12px;
    color: #6b6b8a;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.message {
    margin-bottom: 16px;
    max-width: 75%;
}

.message.user {
    margin-left: auto;
    background: #262650;
    padding: 12px 16px;
    border-radius: 14px 14px 4px 14px;
    border: 1px solid #32326a;
}

.message.assistant {
    background: #181830;
    padding: 12px 16px;
    border-radius: 14px 14px 14px 4px;
    border: 1px solid #1e1e3a;
}

.message.error-notice {
    background: #2a1520;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid #4a2030;
    color: #f07070;
    font-size: 13px;
}

.message .content {
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.6;
    font-size: 14px;
}

.tool-block {
    margin: 8px 0;
    border: 1px solid #2a2a4a;
    border-radius: 8px;
    overflow: hidden;
}

.tool-header {
    padding: 8px 12px;
    background: #1a1a34;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.12s;
}

.tool-header:hover {
    background: #202044;
}

.tool-header .tool-name {
    font-weight: 600;
    color: #7aa2f7;
}

.tool-header .tool-status {
    margin-left: auto;
    font-size: 11px;
    color: #8a8aac;
}

.tool-body {
    background: #12121e;
    max-height: 280px;
    overflow-y: auto;
    display: none;
    border-top: 1px solid #2a2a4a;
}

.tool-block.expanded .tool-body {
    display: block;
}

.tool-section {
    padding: 10px 14px;
}

.tool-section + .tool-section {
    border-top: 1px solid #1e1e3a;
}

.tool-section-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #6b6b8a;
    margin-bottom: 6px;
    font-weight: 500;
}

.tool-args-content {
    font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
    font-size: 12px;
    color: #b0b0cc;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.5;
}

.tool-result-content {
    font-size: 13px;
    color: #d0d0e0;
    line-height: 1.55;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.tool-result-content.error {
    color: #f0a0a0;
}

.spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid #4a6cf7;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.input-area {
    padding: 16px 20px;
    border-top: 1px solid #1e1e3a;
    background: #141422;
}

.input-area form {
    display: flex;
    gap: 8px;
}

.input-area input {
    flex: 1;
    padding: 11px 14px;
    border: 1px solid #2a2a4a;
    border-radius: 8px;
    background: #0f0f1a;
    color: #e0e0e0;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
}

.input-area input:focus {
    border-color: #4a6cf7;
}

.input-area select {
    padding: 10px 12px;
    border: 1px solid #2a2a4a;
    border-radius: 8px;
    background: #0f0f1a;
    color: #e0e0e0;
    font-size: 13px;
    outline: none;
}

.input-area select:focus {
    border-color: #4a6cf7;
}

.input-area button[type="submit"] {
    width: auto;
    margin-bottom: 0;
}

.reconnecting {
    text-align: center;
    padding: 8px;
    background: #f5a62320;
    color: #f5a623;
    font-size: 13px;
    border-bottom: 1px solid #f5a62340;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #2a2a4a;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #3a3a5a;
}
