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

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

.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 1100px;
    margin: 0 auto;
}

/* Header */
.header {
    background: linear-gradient(135deg, #1a5276, #2e86c1);
    color: #fff;
    padding: 14px 24px;
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.header h1 {
    font-size: 18px;
    font-weight: 600;
}

.subtitle {
    font-size: 14px;
    opacity: 0.8;
}

/* Main layout */
.main {
    display: flex;
    flex: 1;
    min-height: 0;
    gap: 0;
}

/* Chat panel */
.chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #fff;
}

/* Provider selectors */
.provider-selectors {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 16px;
    border-bottom: 1px solid #e5e9ed;
    background: #eef3f8;
    font-size: 12px;
    color: #5a6c7d;
    flex-wrap: wrap;
}

.provider-selectors label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

.provider-selectors label[hidden] {
    display: none;
}

.provider-selectors select {
    padding: 3px 6px;
    border: 1px solid #d5dce4;
    border-radius: 4px;
    font-size: 12px;
    background: #fff;
    color: #1a2332;
    cursor: pointer;
}

.provider-selectors select:disabled {
    background: #f0f0f0;
    cursor: not-allowed;
    opacity: 0.6;
}

.chat-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid #e5e9ed;
    background: #f8fafc;
}

.btn {
    padding: 6px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    font-weight: 500;
    transition: opacity 0.15s;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-start {
    background: #27ae60;
    color: #fff;
}

.btn-start:hover:not(:disabled) {
    background: #219a52;
}

.btn-end {
    background: #c0392b;
    color: #fff;
}

.btn-end:hover:not(:disabled) {
    background: #a93226;
}

.timer {
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    color: #5a6c7d;
    margin-left: auto;
}

.latency {
    font-size: 12px;
    color: #7f8c9b;
}

.cost {
    font-size: 12px;
    color: #e8a030;
    font-weight: 600;
}

/* Messages */
.messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

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

.message.bot {
    align-self: flex-start;
    background: #eef3f8;
    border-bottom-left-radius: 4px;
}

.message.user {
    align-self: flex-end;
    background: #2e86c1;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.message.system {
    align-self: center;
    background: #fef9e7;
    color: #7d6608;
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 8px;
}

.typing {
    align-self: flex-start;
    color: #7f8c9b;
    font-size: 13px;
    font-style: italic;
    padding: 6px 0;
}

/* Input */
.input-area {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #e5e9ed;
    background: #f8fafc;
}

.input-area[hidden] {
    display: none;
}

.input-area input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #d5dce4;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
}

.input-area input:focus {
    border-color: #2e86c1;
}

.input-area input:disabled {
    background: #f0f0f0;
}

.input-area button {
    padding: 8px 20px;
    background: #2e86c1;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 500;
}

.input-area button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Lead panel */
.lead-panel {
    width: 280px;
    background: #f8fafc;
    border-left: 1px solid #e5e9ed;
    padding: 16px;
    overflow-y: auto;
    flex-shrink: 0;
}

.lead-panel h2 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #1a5276;
}

.lead-empty {
    font-size: 13px;
    color: #7f8c9b;
}

.lead-field {
    margin-bottom: 8px;
}

.lead-field .label {
    font-size: 11px;
    text-transform: uppercase;
    color: #7f8c9b;
    letter-spacing: 0.5px;
}

.lead-field .value {
    font-size: 14px;
    font-weight: 500;
    margin-top: 2px;
}

.lead-phase {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #e5e9ed;
    font-size: 12px;
    color: #7f8c9b;
}

/* Mic button */
.btn-mic {
    background: #27ae60;
    color: #fff;
    font-size: 16px;
    padding: 6px 12px;
    line-height: 1;
}

.btn-mic:hover:not(:disabled) {
    background: #219a52;
}

.btn-mic.active {
    background: #c0392b;
    animation: pulse-mic 1.2s infinite;
}

@keyframes pulse-mic {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Mute button */
.btn-mute {
    background: #7f8c9b;
    color: #fff;
    font-size: 16px;
    padding: 6px 12px;
    line-height: 1;
}

.btn-mute:hover {
    background: #5a6c7d;
}

.btn-mute.muted {
    background: #bdc3c7;
}

.voice-status {
    font-size: 12px;
    color: #7f8c9b;
}

/* Live transcript bar */
.live-transcript {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #fef9e7;
    border-top: 1px solid #f0e6b2;
    font-size: 13px;
    min-height: 36px;
}

.transcript-label {
    flex-shrink: 0;
    color: #7d6608;
    font-weight: 500;
}

.transcript-text {
    color: #4a4a4a;
    font-style: italic;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* Responsive */
@media (max-width: 700px) {
    .main {
        flex-direction: column;
    }

    .lead-panel {
        width: 100%;
        border-left: none;
        border-top: 1px solid #e5e9ed;
        max-height: 200px;
    }

    .message {
        max-width: 90%;
    }
}
