/* Reset and base styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    color: #e0e0e0;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.auth-panel {
    display: flex;
    align-items: center;
    gap: 10px;
}

.auth-user-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
}

h1 {
    font-size: 24px;
    font-weight: 600;
    color: #fff;
}

.status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status.connected {
    background: rgba(76, 175, 80, 0.2);
    color: #81c784;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.status.disconnected {
    background: rgba(244, 67, 54, 0.2);
    color: #e57373;
    border: 1px solid rgba(244, 67, 54, 0.3);
}

.status.connecting {
    background: rgba(255, 193, 7, 0.2);
    color: #ffd54f;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

/* Main content */
main {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Face/Avatar container */
.face-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 500px;
}

.hidden-render {
    display: none !important;
}

#avatar {
    width: 100%;
    height: 500px;
    border-radius: 20px;
    overflow: hidden;
    background: linear-gradient(180deg, #2a2a4a 0%, #1a1a2e 100%);
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.3),
        0 0 100px rgba(79, 172, 254, 0.1);
}

#avatar canvas {
    width: 100% !important;
    height: 100% !important;
    border-radius: 20px;
}

#waveformView {
    width: 100%;
    height: 500px;
    border-radius: 20px;
    overflow: hidden;
    background: radial-gradient(circle at 20% 15%, rgba(79, 172, 254, 0.18), transparent 55%), linear-gradient(160deg, #0f1f3d 0%, #1a1a2e 45%, #0d1828 100%);
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.3),
        0 0 80px rgba(79, 172, 254, 0.08);
}

#waveformCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 15px 30px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 10px;
    font-size: 14px;
    color: #fff;
    z-index: 10;
}

.loading.hidden {
    display: none;
}

/* Controls */
.controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: rgba(255, 255, 255, 0.05);
    padding: 25px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.input-group {
    display: flex;
    gap: 10px;
}

#textInput {
    flex: 1;
    padding: 12px 18px;
    font-size: 16px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#textInput:focus {
    border-color: rgba(79, 172, 254, 0.5);
    box-shadow: 0 0 20px rgba(79, 172, 254, 0.2);
}

#textInput::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

#speakBtn {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
}

#speakBtn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

#speakBtn:active:not(:disabled) {
    transform: translateY(0);
}

#speakBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#speakBtn.speaking {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(245, 87, 108, 0.4);
    }
    50% {
        box-shadow: 0 0 20px 10px rgba(245, 87, 108, 0);
    }
}

/* Microphone button */
.mic-btn {
    padding: 12px;
    font-size: 16px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: #fff;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mic-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(56, 239, 125, 0.4);
}

.mic-btn:active:not(:disabled) {
    transform: translateY(0);
}

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

.mic-btn.recording {
    background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
    animation: mic-pulse 1s ease-in-out infinite;
}

@keyframes mic-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(245, 87, 108, 0.6);
    }
    50% {
        box-shadow: 0 0 25px 15px rgba(245, 87, 108, 0);
    }
}

/* Stream controls */
.stream-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stream-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.stream-btn {
    padding: 8px 16px;
    font-size: 13px;
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 20px;
    background: rgba(255, 193, 7, 0.1);
    color: #ffd54f;
    cursor: pointer;
    transition: all 0.2s;
}

.stream-btn:hover {
    background: rgba(255, 193, 7, 0.2);
    border-color: rgba(255, 193, 7, 0.5);
}

.stream-btn.active {
    background: rgba(76, 175, 80, 0.2);
    border-color: rgba(76, 175, 80, 0.5);
    color: #81c784;
}

.stream-status {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.6;
}

.stream-status code {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    color: #4facfe;
}

/* Presentation mode styles */
body.presentation-mode {
    background: #000;
}

body.presentation-mode .container {
    max-width: 100%;
    padding: 0;
}

body.presentation-mode header,
body.presentation-mode .controls {
    display: none;
}

body.presentation-mode .face-container {
    min-height: 100vh;
    border-radius: 0;
}

body.presentation-mode #avatar {
    height: 100vh;
    border-radius: 0;
    background: #000;
}

/* Meeting controls */
.meeting-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.meeting-input-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.meeting-controls-help {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.62);
    line-height: 1.4;
}

.meeting-input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.meeting-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.meeting-field-wide {
    grid-column: 1 / -1;
}

.meeting-field label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(255, 255, 255, 0.58);
}

.meeting-field input,
.meeting-field select {
    flex: 1;
    padding: 10px 14px;
    font-size: 14px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    outline: none;
    transition: border-color 0.2s;
}

.meeting-field input:focus,
.meeting-field select:focus {
    border-color: rgba(66, 133, 244, 0.5);
}

.meeting-field input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.meeting-field-hint {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.48);
}

.meeting-actions-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.meeting-btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #4285f4 0%, #34a853 100%);
    color: #fff;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.meeting-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(66, 133, 244, 0.4);
}

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

.meeting-btn.active {
    background: linear-gradient(135deg, #ea4335 0%, #fbbc05 100%);
}

.meeting-status {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    padding: 8px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.2);
    display: none;
}

.meeting-status.visible {
    display: block;
}

.desktop-control-observability {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.22);
}

.desktop-control-observability-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.desktop-console-header {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(255, 255, 255, 0.68);
}

.desktop-pill-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: rgba(255, 255, 255, 0.6);
}

.desktop-pill {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: rgba(255, 255, 255, 0.82);
    background: rgba(255, 255, 255, 0.08);
}

.desktop-pill.ok {
    color: #7ee787;
    border-color: rgba(126, 231, 135, 0.4);
    background: rgba(40, 100, 50, 0.35);
}

.desktop-pill.warn {
    color: #ffd479;
    border-color: rgba(255, 212, 121, 0.4);
    background: rgba(110, 82, 28, 0.35);
}

.desktop-pill.err {
    color: #ff9b9b;
    border-color: rgba(255, 155, 155, 0.4);
    background: rgba(105, 37, 37, 0.35);
}

.desktop-control-console {
    min-height: 180px;
    max-height: 260px;
    overflow-y: auto;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid rgba(86, 175, 120, 0.28);
    background: #0b1110;
    box-shadow: inset 0 0 0 1px rgba(40, 90, 60, 0.25);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    line-height: 1.35;
    white-space: pre-wrap;
    color: #98f5b2;
}

@media (max-width: 768px) {
    .meeting-input-grid {
        grid-template-columns: 1fr;
    }

    .meeting-actions-row {
        justify-content: stretch;
    }

    .meeting-actions-row .meeting-btn {
        width: 100%;
    }
}

.meeting-audit-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.2);
}

.meeting-audit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.meeting-audit-header label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.5);
}

.meeting-audit-session {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.meeting-audit-table-wrap {
    max-height: 300px;
    overflow: auto;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.25);
}

.meeting-audit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.meeting-audit-table th,
.meeting-audit-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    vertical-align: top;
}

.meeting-audit-table th {
    position: sticky;
    top: 0;
    background: #121825;
    color: rgba(255, 255, 255, 0.82);
    z-index: 1;
}

.meeting-audit-table tbody tr {
    cursor: pointer;
    transition: background 0.15s ease;
}

.meeting-audit-table tbody tr:hover {
    background: rgba(102, 126, 234, 0.12);
}

.meeting-audit-table td {
    color: rgba(255, 255, 255, 0.85);
}

.meeting-audit-modal-content {
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
}

.meeting-audit-transcript {
    margin: 0;
    margin-top: 10px;
    padding: 12px;
    min-height: 180px;
    max-height: 55vh;
    overflow: auto;
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.3);
    color: rgba(255, 255, 255, 0.88);
}

.meeting-mcp-export {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.24);
}

.meeting-mcp-export-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.meeting-mcp-config {
    width: 100%;
    min-height: 120px;
    max-height: 220px;
    resize: vertical;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.92);
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    padding: 10px;
    outline: none;
}

.meeting-mcp-config::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.design-playbook-summary {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.design-playbook-meta {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.design-playbook-pending {
    font-size: 12px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.9);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.22);
    white-space: pre-wrap;
}

.design-playbook-inputs {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.design-playbook-definition-tools {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.design-playbook-definition-form-host {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.design-playbook-definition-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}

.design-playbook-definition-form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.design-playbook-definition-form-field label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.7);
}

.design-playbook-definition-form-field textarea,
.design-playbook-definition-form-field input,
.design-playbook-definition-form-field select {
    width: 100%;
}

.design-playbook-definition-form-help {
    font-size: 12px;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.6);
}

.design-playbook-definition-form-errors {
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(229, 115, 115, 0.12);
    border: 1px solid rgba(229, 115, 115, 0.35);
    color: #ffb4b4;
    font-size: 12px;
    line-height: 1.45;
    white-space: pre-wrap;
}

.design-playbook-definition-json-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.7);
}

.design-playbook-definition-editor {
    min-height: 220px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.design-playbook-answer {
    min-height: 90px;
}

.design-playbook-checklist {
    min-height: 70px;
}

/* System Prompt controls */
.system-prompt-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.system-prompt-controls label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.5);
}

#systemPrompt {
    padding: 12px 14px;
    font-size: 14px;
    font-family: inherit;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    outline: none;
    resize: vertical;
    min-height: 80px;
    transition: border-color 0.2s;
}

#systemPrompt:focus {
    border-color: rgba(156, 39, 176, 0.5);
}

#systemPrompt::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.prompt-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.prompt-btn {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #9c27b0 0%, #673ab7 100%);
    color: #fff;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.prompt-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(156, 39, 176, 0.4);
}

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

.prompt-status {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

.prompt-status.success {
    color: #81c784;
}

.prompt-status.error {
    color: #e57373;
}

/* Transcript */
.transcript-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.transcript-container label,
.avatar-mode-controls label,
.avatar-controls label,
.mood-controls label,
.view-controls label,
.debug-info label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.5);
}

.transcript {
    min-height: 60px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 14px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.8);
}

.transcript:empty::before {
    content: 'Response will appear here...';
    color: rgba(255, 255, 255, 0.3);
    font-style: italic;
}

/* Realtime test chat */
.realtime-chat-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.realtime-chat-controls > label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.5);
}

.realtime-chat-messages {
    min-height: 140px;
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.25);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.realtime-chat-empty {
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
    font-style: italic;
}

.realtime-chat-msg {
    padding: 8px 10px;
    border-radius: 8px;
    max-width: 90%;
    line-height: 1.35;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 13px;
}

.realtime-chat-msg.user {
    align-self: flex-end;
    background: rgba(102, 126, 234, 0.25);
    border: 1px solid rgba(102, 126, 234, 0.5);
}

.realtime-chat-msg.assistant {
    align-self: flex-start;
    background: rgba(56, 239, 125, 0.14);
    border: 1px solid rgba(56, 239, 125, 0.35);
}

.realtime-chat-msg .meta {
    display: block;
    font-size: 10px;
    opacity: 0.7;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.realtime-chat-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

#realtimeChatInput {
    flex: 1;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    outline: none;
}

#realtimeChatInput:focus {
    border-color: rgba(102, 126, 234, 0.5);
}

/* Avatar, Mood, View controls */
.avatar-mode-controls,
.avatar-controls,
.mood-controls,
.view-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.avatar-mode-buttons,
.avatar-buttons,
.mood-buttons,
.view-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.avatar-mode-btn,
.avatar-btn,
.mood-btn,
.view-btn {
    padding: 8px 16px;
    font-size: 13px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.2s;
}

.avatar-btn:hover,
.avatar-mode-btn:hover,
.mood-btn:hover,
.view-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.avatar-mode-btn.active,
.avatar-btn.active,
.mood-btn.active,
.view-btn.active {
    background: rgba(79, 172, 254, 0.2);
    border-color: rgba(79, 172, 254, 0.5);
    color: #4facfe;
}

/* Debug info */
.debug-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.debug-content {
    display: flex;
    gap: 20px;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

.debug-content span {
    display: flex;
    gap: 5px;
}

.debug-content span span {
    color: #4facfe;
    font-weight: 500;
}

.render-validation-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.render-validation-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.render-validation-preview-wrap {
    width: 100%;
    min-height: 180px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    overflow: hidden;
}

#renderDebugPreview {
    width: 100%;
    height: auto;
    min-height: 180px;
    display: block;
    object-fit: contain;
    background: #0b1524;
}

#desktopControlPreview {
    width: 100%;
    height: auto;
    min-height: 180px;
    display: block;
    object-fit: contain;
    background: #0b1524;
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 15px;
    }

    .face-container {
        min-height: 350px;
    }

    #avatar {
        height: 350px;
    }

    #waveformView {
        height: 350px;
    }

    .input-group {
        flex-direction: column;
    }

    #speakBtn {
        width: 100%;
    }

    .avatar-mode-buttons,
    .avatar-buttons,
    .mood-buttons,
    .view-buttons {
        justify-content: center;
    }

    .debug-content {
        flex-wrap: wrap;
        gap: 10px;
    }

    .render-validation-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .meeting-mcp-export-actions .settings-btn {
        width: 100%;
    }
}

/* Credential Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}

.modal-body {
    padding: 25px;
}

.modal-body p {
    margin: 0 0 20px 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    line-height: 1.5;
}

.auth-status {
    min-height: 20px;
    margin-bottom: 8px;
    font-size: 13px;
    color: #ffd54f;
}

#credentialFields {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.credential-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.credential-field label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.5);
}

.credential-field input {
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.credential-field input:focus {
    border-color: rgba(79, 172, 254, 0.5);
    box-shadow: 0 0 20px rgba(79, 172, 254, 0.2);
}

.credential-field input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.modal-btn {
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.modal-btn.cancel {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.7);
}

.modal-btn.cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.modal-btn.submit {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.modal-btn.submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.modal-btn.submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.admin-modal-content {
    max-width: 760px;
}

.desktop-control-modal-content {
    max-width: 760px;
}

.admin-modal-body {
    max-height: 68vh;
    overflow-y: auto;
}

.admin-inline-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.admin-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
}

.admin-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.admin-users-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.admin-user-row {
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.22);
}

.admin-user-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.admin-user-email {
    color: #fff;
    font-size: 13px;
    word-break: break-all;
}

.admin-user-meta {
    color: rgba(255, 255, 255, 0.65);
    font-size: 11px;
    white-space: nowrap;
}

.admin-user-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.admin-user-actions input[type="password"] {
    min-width: 170px;
    flex: 1;
}

@media (max-width: 700px) {
    .admin-modal-content {
        max-width: 94%;
    }

    .admin-inline-row {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-user-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .admin-user-actions {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Join Status Modal - Terminal Style */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(8px);
}

.join-status-content {
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 8px;
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 16px 70px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.terminal-header {
    background: #161b22;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #30363d;
}

.terminal-title {
    color: #c9d1d9;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 13px;
    font-weight: 600;
}

.terminal-close {
    background: #f85149;
    border: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 10px;
    line-height: 14px;
    color: transparent;
    transition: all 0.2s;
}

.terminal-close:hover {
    background: #da3633;
    color: #0d1117;
}

.terminal-output {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 12px;
    line-height: 1.6;
    color: #c9d1d9;
    min-height: 300px;
    max-height: 500px;
}

.terminal-output::-webkit-scrollbar {
    width: 8px;
}

.terminal-output::-webkit-scrollbar-track {
    background: #161b22;
}

.terminal-output::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 4px;
}

.terminal-output::-webkit-scrollbar-thumb:hover {
    background: #484f58;
}

.terminal-line {
    white-space: pre-wrap;
    word-break: break-word;
    margin-bottom: 2px;
}

.terminal-line.command {
    color: #58a6ff;
    margin-bottom: 8px;
}

.terminal-line.command .prompt {
    color: #7ee787;
    margin-right: 8px;
}

.terminal-line .timestamp {
    color: #6e7681;
    margin-right: 8px;
}

.terminal-line .step-name {
    color: #d2a8ff;
    font-weight: 600;
}

.terminal-line.detail {
    color: #8b949e;
    padding-left: 20px;
}

.terminal-line.summary {
    text-align: center;
    margin-top: 8px;
}

.terminal-line .success {
    color: #7ee787;
}

.terminal-line .error {
    color: #f85149;
}

.terminal-line .pending {
    color: #d29922;
}

.terminal-line .info {
    color: #58a6ff;
}

/* =============================================================================
   Rebecca Settings Section
   ============================================================================= */

.settings-section {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    cursor: pointer;
    transition: background 0.2s;
}

.settings-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.settings-header label {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    text-transform: none;
    letter-spacing: 0;
}

.settings-toggle-icon {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.5);
    transition: transform 0.3s;
}

.settings-section.open .settings-toggle-icon {
    transform: rotate(45deg);
}

.settings-content {
    padding: 0 20px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.settings-tabs {
    display: flex;
    gap: 8px;
}

.settings-tab-btn {
    padding: 6px 14px;
    font-size: 12px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.75);
    cursor: pointer;
    transition: all 0.2s;
}

.settings-tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.settings-tab-btn.active {
    background: rgba(102, 126, 234, 0.25);
    border-color: rgba(102, 126, 234, 0.5);
    color: #fff;
}

.settings-tab-panel {
    display: none;
    flex-direction: column;
    gap: 25px;
}

.settings-tab-panel.active {
    display: flex;
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.settings-group > label {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.settings-description {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin: 0;
    line-height: 1.4;
}

.settings-group textarea,
.settings-group input[type="text"],
.settings-group input[type="password"] {
    padding: 12px 14px;
    font-size: 14px;
    font-family: inherit;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.settings-group textarea:focus,
.settings-group input[type="text"]:focus,
.settings-group input[type="password"]:focus {
    border-color: rgba(102, 126, 234, 0.5);
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.15);
}

.settings-group textarea::placeholder,
.settings-group input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.settings-group textarea {
    resize: vertical;
    min-height: 80px;
}

.settings-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 5px;
}

.settings-btn {
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
}

.settings-btn.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.settings-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.settings-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
}

.settings-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

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

.settings-status {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

.settings-status.success {
    color: #7ee787;
}

.settings-status.error {
    color: #f85149;
}

/* Reference Documents */
.reference-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.reference-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    gap: 10px;
}

.reference-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.reference-item-name {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reference-item-type {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
}

.reference-item-delete {
    padding: 4px 10px;
    font-size: 12px;
    background: rgba(248, 81, 73, 0.2);
    border: 1px solid rgba(248, 81, 73, 0.3);
    border-radius: 6px;
    color: #f85149;
    cursor: pointer;
    transition: all 0.2s;
}

.reference-item-delete:hover {
    background: rgba(248, 81, 73, 0.3);
    border-color: rgba(248, 81, 73, 0.5);
}

.reference-empty {
    padding: 15px;
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    font-size: 13px;
    font-style: italic;
}

.add-reference {
    display: flex;
    gap: 10px;
}

.add-reference-content {
    margin-top: 10px;
}

.ref-input {
    flex: 1;
}

.ref-input.full {
    width: 100%;
}

.ref-select {
    padding: 10px 14px;
    font-size: 14px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    outline: none;
    cursor: pointer;
}

.ref-select:focus {
    border-color: rgba(102, 126, 234, 0.5);
}

.ref-select.full {
    width: 100%;
}

.ref-textarea {
    width: 100%;
    min-height: 60px;
}

/* MCP Gateway */
.mcp-inputs {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mcp-input {
    width: 100%;
}

/* MCP Tools Discovery */
.mcp-tools-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.mcp-tools-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.mcp-tools-label {
    font-weight: 600;
    color: var(--text-primary);
}

.mcp-tools-count {
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 10px;
}

.mcp-tools-count.connected {
    color: #4caf50;
    background: rgba(76, 175, 80, 0.15);
}

.mcp-tools-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    max-height: 150px;
    overflow-y: auto;
}

.mcp-tool-tag {
    font-size: 11px;
    padding: 3px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: default;
}

.mcp-tool-tag.browser {
    border-color: #2196f3;
    color: #2196f3;
    background: rgba(33, 150, 243, 0.1);
}

.mcp-tools-empty {
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
}

.settings-btn.small {
    font-size: 11px;
    padding: 4px 10px;
}

/* Tool Whitelist Access */
.whitelist-tools-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 0 0 0;
}

.whitelist-tool-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.whitelist-tool-name {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.86);
    font-family: monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.whitelist-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.72);
    white-space: nowrap;
}

.whitelist-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #7ee787;
}

/* Meeting Checklist */
.checklist-upload {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
}

.checklist-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 10px;
}

.checklist-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
    max-height: 300px;
    overflow-y: auto;
}

.checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: background 0.2s;
}

.checklist-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.checklist-item.checked {
    opacity: 0.6;
}

.checklist-item.checked .checklist-item-content {
    text-decoration: line-through;
}

.checklist-checkbox {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    cursor: pointer;
    accent-color: #7ee787;
}

.checklist-item-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.checklist-item-content {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.4;
}

.checklist-item-notes {
    font-size: 12px;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.7);
    font-family: inherit;
    resize: vertical;
    min-height: 24px;
    outline: none;
}

.checklist-item-notes:focus {
    border-color: rgba(102, 126, 234, 0.4);
}

.checklist-item-notes::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.checklist-item-delete {
    padding: 4px 8px;
    font-size: 11px;
    background: transparent;
    border: 1px solid rgba(248, 81, 73, 0.3);
    border-radius: 4px;
    color: rgba(248, 81, 73, 0.7);
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0;
}

.checklist-item:hover .checklist-item-delete {
    opacity: 1;
}

.checklist-item-delete:hover {
    background: rgba(248, 81, 73, 0.2);
    border-color: rgba(248, 81, 73, 0.5);
    color: #f85149;
}

.checklist-empty {
    padding: 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    font-size: 13px;
    font-style: italic;
}

/* RFHL */
.rfhl-add-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.rfhl-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rfhl-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rfhl-item {
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.rfhl-item-controls {
    display: flex;
    gap: 6px;
    align-items: center;
}

.rfhl-item-actions {
    display: flex;
    gap: 6px;
}

.rfhl-empty {
    padding: 16px;
    text-align: center;
    color: rgba(255, 255, 255, 0.45);
    font-size: 13px;
    font-style: italic;
}

.design-playbook-module-panels {
    display: grid;
    gap: 10px;
    margin: 10px 0;
}

.design-playbook-module-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.design-playbook-module-card {
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.03);
}

.design-playbook-module-card h4 {
    margin: 0 0 6px 0;
    font-size: 13px;
}

.design-playbook-module-card pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 12px;
    line-height: 1.4;
    color: rgba(255,255,255,0.82);
}

.design-playbook-module-input {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.design-playbook-module-input label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.5);
}
