/* Updated: 2026-02-26 - Professional list styling v2 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#app {
    width: 95%;
    max-width: 1800px;
    height: 95vh;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 24px;
}

#header-right {
    display: flex;
    gap: 15px;
    align-items: center;
}


/* Model Selector (Sandbox only) */
.model-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.15);
    padding: 4px 10px;
    border-radius: 8px;
}

.model-selector label {
    font-size: 12px;
    opacity: 0.9;
    white-space: nowrap;
}

.model-selector select {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    min-width: 120px;
}

.model-selector select:hover {
    background: rgba(255,255,255,0.3);
}

.model-selector select option {
    background: #667eea;
    color: white;
}

/* Model Selector (Sandbox only) */
.model-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.15);
    padding: 4px 10px;
    border-radius: 8px;
}

.model-selector label {
    font-size: 12px;
    opacity: 0.9;
    white-space: nowrap;
}

.model-selector select {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    min-width: 120px;
}

.model-selector select:hover {
    background: rgba(255,255,255,0.3);
}

.model-selector select option {
    background: #667eea;
    color: white;
}

.model-selector select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(100,100,100,0.3);
}

#environment-badge {
    background: rgba(255,255,255,0.2);
    padding: 5px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

#user-info {
    font-size: 14px;
    opacity: 0.9;
}

#logout-btn {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

#logout-btn:hover {
    background: rgba(255,255,255,0.3);
}

#rebuild-btn {#d97706;
    border: none;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

#rebuild-btn:hover {
    background: #b45309
    background: rgba(255,165,0,0.5);
}

#rebuild-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

#messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    padding: 12px 16px;
    border-radius: 8px;
    max-width: 90%;
    word-wrap: break-word;
    line-height: 1.5;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-user {
    background: #667eea;
    color: white;
    align-self: flex-end;
    margin-left: auto;
}

.message-assistant {
    background: white;
    color: #333;
    align-self: flex-start;
    border: 1px solid #e0e0e0;
    position: relative;
}

.message-assistant.warning {
    background: #fff8e1;
    border-color: #ffc107;
    border-left: 4px solid #ff9800;
}

.message-assistant.warning a {
    color: #f57c00;
    text-decoration: underline;
    cursor: pointer;
}

.message-assistant.warning a:hover {
    color: #e65100;
}

.message-assistant .message-content {
    padding-right: 30px;
}

/* Professional list styling */
.message-content ul,
.message-content ol {
    margin: 12px 0;
    padding-left: 24px;
}

.message-content ul {
    list-style: disc;
}

.message-content ul li {
    padding: 4px 0;
    margin: 4px 0;
    background: #f8f9fa;
    padding: 6px 10px;
    border-radius: 4px;
}

.message-content ul li::marker {
    color: #667eea;
}

.message-content ol {
    list-style: decimal;
}

.message-content ol li {
    padding: 4px 0;
    margin: 4px 0;
    background: #f8f9fa;
    padding: 6px 10px;
    border-radius: 4px;
}

.message-content ol li::marker {
    color: #667eea;
    font-weight: 600;
}

.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    color: #888;
    opacity: 0.6;
    transition: opacity 0.2s, background 0.2s, color 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.copy-btn:hover {
    opacity: 1;
    background: #e8e8e8;
    color: #667eea;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.copy-btn.copied {
    color: #4caf50;
    opacity: 1;
}

.message-error {
    background: linear-gradient(135deg, #fff5f5 0%, #ffe8e8 100%);
    color: #c41e3a;
    align-self: flex-start;
    max-width: 80%;
    border-left: 4px solid #dc3545;
    border-radius: 8px;
    padding: 16px 20px;
}

.message-error strong {
    color: #a71d2a;
    font-size: 1.1em;
}

.message-error a {
    color: #0066cc;
    text-decoration: underline;
}

.message-error a:hover {
    color: #0052a3;
}

.message-typing {
    background: white;
    color: #666;
    align-self: flex-start;
    border: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
}

.thinking-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
}

.thinking-text {
    font-style: italic;
    color: #666;
}

.thinking-dots {
    display: flex;
    gap: 4px;
}

.thinking-dots span {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.thinking-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.thinking-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

.thinking-dots span:nth-child(3) {
    animation-delay: 0s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.tool-call {
    padding: 8px 12px;
    background: #fff3e0;
    border-left: 3px solid #ff9800;
    border-radius: 4px;
    font-size: 14px;
    color: #666;
    align-self: flex-start;
    font-family: 'Courier New', monospace;
}

#input-container {
    display: flex;
    gap: 10px;
    padding: 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
    flex-wrap: wrap;
    align-items: center;
}

#attach-btn {
    padding: 10px 12px;
    background: #f5f5f5;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}

#attach-btn:hover:not(:disabled) {
    background: #e8e8e8;
    border-color: #667eea;
    color: #667eea;
}

#attach-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#attach-btn.has-file {
    background: #e8f5e9;
    border-color: #4caf50;
    color: #4caf50;
}

#attach-btn.uploading {
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

#attached-files {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

#attached-files:empty {
    display: none;
}

.attached-file-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #e8f5e9;
    border: 1px solid #4caf50;
    border-radius: 16px;
    font-size: 13px;
    color: #2e7d32;
}

.attached-file-chip .file-icon {
    font-size: 14px;
}

.attached-file-chip .file-name {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attached-file-chip .remove-file {
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    color: #666;
    padding: 0 2px;
    line-height: 1;
}

.attached-file-chip .remove-file:hover {
    color: #d32f2f;
}

#user-input {
    flex: 1;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
}

#user-input:focus {
    outline: none;
    border-color: #667eea;
}

#send-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s;
    font-weight: 600;
}

#send-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

#send-btn:active:not(:disabled) {
    transform: translateY(0);
}

#send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Attachment Button and Preview */
.attach-btn {
    padding: 12px;
    background: #f0f0f0;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 48px;
}

.attach-btn:hover:not(:disabled) {
    background: #e0e0e0;
    border-color: #667eea;
}

.attach-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.attach-btn.has-file {
    background: #e8f5e9;
    border-color: #4caf50;
}

#attachment-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #e8f5e9;
    border: 1px solid #4caf50;
    border-radius: 8px;
    font-size: 14px;
    max-width: 200px;
}

#attachment-filename {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #2e7d32;
    font-weight: 500;
}

#remove-attachment-btn {
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    color: #666;
    padding: 2px 6px;
    border-radius: 4px;
}

#remove-attachment-btn:hover {
    background: rgba(0,0,0,0.1);
    color: #d32f2f;
}

/* Attachment in message */
.message-attachment {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f0f4ff;
    border: 1px solid #667eea;
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 13px;
    color: #667eea;
}

.message-attachment::before {
    content: '??';
}

/* Attachment banner in sent messages - more prominent display */
.message-attachment-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    border: 1px solid #90caf9;
    border-radius: 8px;
    margin-bottom: 10px;
}

.message-attachment-banner .attachment-icon {
    font-size: 24px;
    line-height: 1;
}

.message-attachment-banner .attachment-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.message-attachment-banner .attachment-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
    font-weight: 600;
}

.message-attachment-banner .attachment-name {
    font-size: 14px;
    font-weight: 500;
    color: #1565c0;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message-user .user-text {
    margin-top: 4px;
}

.message-user .user-text em {
    color: #666;
    font-style: italic;
}

#loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
    z-index: 1000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#loading p {
    font-size: 18px;
    color: #667eea;
    font-weight: 500;
}

#chat-container::-webkit-scrollbar {
    width: 8px;
}

#chat-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#chat-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

#chat-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Main content layout */
#main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

#chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Diagnostics Panel */
#diagnostics-panel {
    width: 350px;
    background: #1e1e1e;
    color: #d4d4d4;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #333;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
}

#diagnostics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #252526;
    border-bottom: 1px solid #333;
}

#diagnostics-header h3 {
    margin: 0;
    font-size: 14px;
    color: #fff;
}

#diagnostics-header button {
    background: transparent;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 14px;
    padding: 4px 8px;
}

#diagnostics-header button:hover {
    color: #fff;
}

#diagnostics-actions {
    padding: 10px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    background: #2d2d2d;
    border-bottom: 1px solid #333;
}

.diag-btn {
    background: #0e639c;
    border: none;
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    flex: 1;
    min-width: 120px;
}

.diag-btn:hover {
    background: #1177bb;
}

.diag-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#diagnostics-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 15px;
    padding: 8px 15px;
    background: #252526;
    border-bottom: 1px solid #333;
    font-size: 11px;
    color: #888;
}

#diagnostics-stats span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Prompts Section */
#prompts-section {
    background: #1e1e1e;
    border-bottom: 1px solid #333;
    max-height: 50%;
    display: flex;
    flex-direction: column;
}

#prompts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #252526;
    border-bottom: 1px solid #333;
}

#prompts-header h4 {
    margin: 0;
    font-size: 12px;
    color: #d4d4d4;
}

#close-prompts-btn {
    background: transparent;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
    border-radius: 3px;
}

#close-prompts-btn:hover {
    background: #333;
    color: #fff;
}

#prompts-content {
    padding: 10px;
    overflow-y: auto;
    flex: 1;
    font-size: 11px;
    line-height: 1.5;
}

.prompts-section-title {
    font-weight: bold;
    color: #569cd6;
    margin: 10px 0 5px 0;
    padding-bottom: 3px;
    border-bottom: 1px solid #333;
}

.prompts-section-title:first-child {
    margin-top: 0;
}

.prompt-text {
    background: #252526;
    padding: 8px;
    border-radius: 4px;
    margin-bottom: 10px;
    white-space: pre-wrap;
    color: #d4d4d4;
    border-left: 3px solid #569cd6;
}

.tool-item {
    background: #252526;
    padding: 8px;
    border-radius: 4px;
    margin-bottom: 6px;
    border-left: 3px solid #4ec9b0;
}

.tool-name {
    font-weight: bold;
    color: #4ec9b0;
}

.tool-desc {
    color: #9cdcfe;
    margin-top: 4px;
    font-size: 10px;
}

.tool-params {
    color: #888;
    margin-top: 4px;
    font-size: 10px;
    font-style: italic;
}

.mcp-servers {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 5px;
}

.mcp-server-tag {
    background: #0e639c;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
}

#diagnostics-log {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.log-entry {
    margin-bottom: 10px;
    padding: 8px;
    background: #252526;
    border-radius: 4px;
    border-left: 3px solid #0e639c;
}

.log-entry.tool-call {
    border-left-color: #4ec9b0;
}

.log-entry.error {
    border-left-color: #f14c4c;
}

.log-entry.success {
    border-left-color: #89d185;
}

.log-time {
    color: #666;
    font-size: 10px;
    margin-bottom: 4px;
}

.log-title {
    color: #fff;
    font-weight: bold;
    margin-bottom: 4px;
}

.log-details {
    color: #9cdcfe;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 150px;
    overflow-y: auto;
}

.log-args {
    color: #ce9178;
    font-size: 11px;
    margin-top: 4px;
}

#diagnostics-log::-webkit-scrollbar {
    width: 6px;
}

#diagnostics-log::-webkit-scrollbar-track {
    background: #1e1e1e;
}

#diagnostics-log::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px;
}

#diagnostics-toggle {
    background: rgba(100,100,100,0.3);
    border: 1px solid rgba(150,150,150,0.3);
}

#diagnostics-toggle.active {
    background: rgba(14,99,156,0.5);
    border-color: rgba(14,99,156,0.8);
}

/* ============================================================================
   Session History Sidebar (Left Panel)
   ============================================================================ */

#sessions-panel {
    width: 280px;
    background: #f8f9fa;
    color: #333;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e0e0e0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 13px;
}

#sessions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
}

#sessions-header h3 {
    margin: 0;
    font-size: 14px;
    color: #333;
    font-weight: 600;
}

#sessions-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

#close-sessions-btn {
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 16px;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
}

#close-sessions-btn:hover {
    background: #f0f0f0;
    color: #333;
}

#new-chat-btn {
    background: #667eea;
    border: none;
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
}

#new-chat-btn:hover {
    background: #5a6fd6;
}

#sessions-search {
    padding: 10px 12px;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
}

#session-search-input {
    width: 100%;
    padding: 8px 12px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #333;
    font-size: 12px;
}

#session-search-input:focus {
    outline: none;
    border-color: #667eea;
    background: #fff;
}

#session-search-input::placeholder {
    color: #999;
}

#sessions-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.sessions-loading {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

.sessions-empty {
    text-align: center;
    padding: 30px 20px;
    color: #666;
}

.sessions-empty-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.session-item {
    padding: 12px;
    margin-bottom: 6px;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
    border-left: 3px solid transparent;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.session-item:hover {
    background: #f0f4ff;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.15);
}

.session-item.active {
    background: #f0f4ff;
    border-left-color: #667eea;
}

.session-title {
    font-weight: 500;
    color: #333;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-preview {
    font-size: 11px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 6px;
}

.session-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10px;
    color: #888;
}

.session-date {
    color: #667eea;
}

.session-count {
    background: #e8edff;
    color: #667eea;
    padding: 2px 6px;
    border-radius: 10px;
}

.session-item-actions {
    display: none;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
}

.session-item:hover .session-item-actions {
    display: flex;
    gap: 4px;
}

.session-item {
    position: relative;
}

.session-delete-btn {
    background: transparent;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 3px;
    font-size: 12px;
}

.session-delete-btn:hover {
    background: #f14c4c;
    color: white;
}

#sessions-list::-webkit-scrollbar {
    width: 6px;
}

#sessions-list::-webkit-scrollbar-track {
    background: #f0f0f0;
}

#sessions-list::-webkit-scrollbar-thumb {
    background: #e8e8e8;
    border-radius: 3px;
}

#sessions-footer {
    font-size: 11px;
    color: #666;
    text-align: center;
    padding: 8px;
    border-top: 1px solid #e0e0e0;
    background: #eef0f2;
}

#sessions-toggle {
    background: rgba(100,100,100,0.3);
    border: 1px solid rgba(150,150,150,0.3);
}

#sessions-toggle.active {
    background: rgba(14,99,156,0.5);
    border-color: rgba(14,99,156,0.8);
}

/* Today/Yesterday/Older section headers */
.session-date-group {
    font-size: 11px;
    color: #888;
    padding: 8px 12px 4px 12px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}
/* ============================================
   Table Styling for Markdown Tables
   ============================================ */
.message table {
    border-collapse: collapse;
    width: 100%;
    margin: 12px 0;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
}

.message thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.message th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
    border: none;
}

.message td {
    padding: 10px 16px;
    border-bottom: 1px solid #e0e0e0;
}

.message tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.message tbody tr:nth-child(odd) {
    background-color: #ffffff;
}

.message tbody tr:hover {
    background-color: #e8f4f8;
}

.message tbody tr:last-child td {
    border-bottom: none;
}

/* ============================================================================
   Feedback Dialog Modal (Sandbox)
   ============================================================================ */

#feedback-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.feedback-dialog-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

.feedback-dialog-content {
    position: relative;
    background: white;
    border-radius: 12px;
    padding: 24px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 2001;
}

#feedback-dialog-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

#feedback-dialog-subtitle {
    font-size: 14px;
    color: #666;
    margin-bottom: 16px;
}

#feedback-text {
    width: 100%;
    min-height: 52px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    margin-bottom: 16px;
}

#feedback-text:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.feedback-dialog-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

#feedback-skip-btn {
    padding: 10px 20px;
    border: 1px solid #ddd;
    background: white;
    color: #666;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

#feedback-skip-btn:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

#feedback-submit-btn {
    padding: 10px 20px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

#feedback-submit-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* AI Disclaimer (Sandbox) */
#ai-disclaimer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    padding: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 12px;
    z-index: 100;
}

/* Copy button styling for user messages (Sandbox) */
.message-user {
    position: relative;
    padding-right: 36px;
}

.message-user .copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    padding: 4px;
    transition: color 0.2s;
    opacity: 0;
}

.message-user:hover .copy-btn {
    opacity: 1;
}

.message-user .copy-btn:hover {
    background: transparent;
    border: none;
    color: white;
}

.message-user .copy-btn.copied {
    color: #90EE90;
    background: transparent;
    border: none;
    opacity: 1;
}

/* ============================================================================
   Message Actions (Feedback + Copy buttons) - Sandbox
   ============================================================================ */

.message-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #eee;
}

.message-actions .feedback-btn,
.message-actions .copy-btn,
.message-actions .excel-btn {
    position: relative;
    top: auto;
    right: auto;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    color: #888;
    opacity: 0.6;
    transition: opacity 0.2s, background 0.2s, color 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.message-actions .feedback-btn:hover,
.message-actions .copy-btn:hover,
.message-actions .excel-btn:hover {
    opacity: 1;
    background: #e8e8e8;
    color: #667eea;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.message-actions .copy-btn.copied {
    color: #4caf50;
    opacity: 1;
}

.message-actions .excel-btn:hover {
    color: #217346; /* Excel green */
}

.message-actions .excel-btn.exported {
    color: #217346;
    opacity: 1;
}

.message-actions .feedback-btn.thumbs-up.selected {
    background: #e8f5e9;
    border-color: #4caf50;
    color: #4caf50;
    opacity: 1;
}

.message-actions .feedback-btn.thumbs-down.selected {
    background: #ffebee;
    border-color: #f44336;
    color: #f44336;
    opacity: 1;
}

.message-actions .feedback-btn.feedback-submitted {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Chart Styling */
.chart-container {
    background: #2d2d2d;
    border-radius: 8px;
    padding: 16px;
    margin: 12px 0;
    max-width: 600px;
    min-height: 300px;
}

.chart-container.chart-rendered {
    min-height: auto;
}

.chart-container canvas {
    max-width: 100%;
    height: auto !important;
}

.chart-error {
    color: #ff6b6b;
    padding: 16px;
    text-align: center;
    font-style: italic;
}
