/* ============================================
   TalkSheet - Comprehensive Stylesheet
   Green primary (#10b981), no indigo/blue
   ============================================ */

/* ---------- CSS Variables ---------- */
:root {
    --green-50: #ecfdf5;
    --green-100: #d1fae5;
    --green-200: #a7f3d0;
    --green-300: #6ee7b7;
    --green-400: #34d399;
    --green-500: #10b981;
    --green-600: #059669;
    --green-700: #047857;
    --green-800: #065f46;
    --green-900: #064e3b;

    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    --white: #ffffff;
    --black: #000000;
    --red-500: #ef4444;
    --red-50: #fef2f2;
    --yellow-500: #eab308;
    --yellow-50: #fefce8;

    /* Alias variables (Edge compatibility) */
    --primary: #10b981;
    --primary-light: #d1fae5;
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    --text-secondary: #6b7280;

    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
    --shadow: 0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);

    --radius-sm: 4px;
    --radius: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    --navbar-height: 56px;
    --sidebar-width: 380px;
    --transition: 150ms ease;
    --transition-slow: 300ms ease;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
                 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
    color: var(--gray-800);
    background-color: var(--gray-50);
    line-height: 1.6;
    overflow: hidden;
    height: 100vh;
}

a {
    color: var(--green-600);
    text-decoration: none;
    transition: color var(--transition);
}
a:hover {
    color: var(--green-700);
}

/* ---------- Custom Scrollbar ---------- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background-color: var(--gray-300);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background-color: var(--gray-400);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--gray-300) transparent;
}

/* ---------- Animations ---------- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30%            { transform: translateY(-6px); }
}

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

@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.5; }
}

@keyframes overlayFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    user-select: none;
    font-family: inherit;
    outline: none;
}

.btn:focus-visible {
    box-shadow: 0 0 0 2px var(--green-200);
}

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

.btn-primary {
    background-color: var(--green-500);
    color: var(--white);
    border-color: var(--green-500);
}
.btn-primary:hover {
    background-color: var(--green-600);
    border-color: var(--green-600);
}
.btn-primary:active {
    background-color: var(--green-700);
}

.btn-outline {
    background-color: var(--white);
    color: var(--gray-700);
    border-color: var(--gray-300);
}
.btn-outline:hover {
    background-color: var(--gray-50);
    border-color: var(--gray-400);
    color: var(--gray-800);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 0.8125rem;
    border-radius: var(--radius-sm);
}

.btn-block {
    display: flex;
    width: 100%;
    padding: 10px 16px;
    font-size: 0.9375rem;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--gray-400);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 1rem;
    line-height: 1;
}
.btn-icon:hover {
    background-color: var(--gray-100);
    color: var(--gray-600);
}

/* ---------- Form Inputs ---------- */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-group input {
    display: block;
    width: 100%;
    padding: 9px 12px;
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: var(--gray-800);
    background-color: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    transition: all var(--transition);
    outline: none;
    font-family: inherit;
}

.form-group input:focus {
    border-color: var(--green-500);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.form-group input::placeholder {
    color: var(--gray-400);
}

.form-error {
    color: var(--red-500);
    font-size: 0.8125rem;
    margin-bottom: 12px;
    padding: 8px 12px;
    background-color: var(--red-50);
    border-radius: var(--radius);
    border: 1px solid #fecaca;
    display: none;
}
.form-error.visible {
    display: block;
}

.form-footer {
    text-align: center;
    font-size: 0.8125rem;
    color: var(--gray-500);
    margin-top: 16px;
}

/* ---------- Navbar ---------- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-height);
    background-color: var(--white);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
    cursor: default;
}

.logo-icon {
    font-size: 1.5rem;
}

.logo-text {
    background: linear-gradient(135deg, var(--green-600), var(--green-500));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-info {
    font-size: 0.8125rem;
    color: var(--gray-500);
    margin-right: 4px;
}

/* ---------- Main Layout ---------- */
.main-container {
    display: flex;
    height: calc(100vh - var(--navbar-height));
    margin-top: var(--navbar-height);
    overflow: hidden;
}

/* ---------- Left Sidebar ---------- */
.sidebar-left {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    background-color: var(--white);
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100);
    flex-shrink: 0;
}

.panel-header h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--gray-800);
}

/* ---------- Upload Area ---------- */
.upload-area {
    margin: 16px;
    padding: 32px 16px;
    text-align: center;
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-slow);
    flex-shrink: 0;
}

.upload-area:hover {
    border-color: var(--green-400);
    background-color: var(--green-50);
}

.upload-area.drag-active {
    border-color: var(--green-500);
    background-color: var(--green-50);
    transform: scale(1.01);
}

.upload-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.upload-area p {
    font-size: 0.875rem;
    color: var(--gray-600);
    margin-bottom: 4px;
}

.upload-hint {
    font-size: 0.75rem !important;
    color: var(--gray-400) !important;
}

.upload-area.hidden {
    display: none;
}

/* ---------- File Info ---------- */
.file-info {
    padding: 0 16px;
    flex-shrink: 0;
}

.file-info-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background-color: var(--green-50);
    border: 1px solid var(--green-200);
    border-radius: var(--radius-md);
}

.file-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--green-800);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 280px;
}

.file-info-details {
    font-size: 0.75rem;
    color: var(--gray-500);
    padding: 8px 12px;
}

/* ---------- Sheet Tabs ---------- */
.sheet-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px 0;
}

.sheet-tab {
    padding: 4px 12px;
    font-size: 0.75rem;
    color: var(--gray-600);
    background-color: var(--gray-100);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    user-select: none;
}

.sheet-tab:hover {
    background-color: var(--gray-200);
    color: var(--gray-700);
}

.sheet-tab.active {
    background-color: var(--green-500);
    color: var(--white);
    border-color: var(--green-500);
}

/* ---------- Data Table ---------- */
.table-container {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--gray-100);
}

.table-scroll {
    flex: 1;
    overflow: auto;
    overflow-x: auto;
    overflow-y: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}

.data-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table thead th {
    background-color: var(--gray-100);
    color: var(--gray-700);
    font-weight: 600;
    text-align: left;
    padding: 7px 10px;
    border-bottom: 2px solid var(--gray-300);
    white-space: nowrap;
    font-size: 0.75rem;
    text-transform: none;
    user-select: none;
}

.data-table tbody td {
    padding: 5px 10px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.data-table tbody tr:hover {
    background-color: var(--green-50);
}

.table-info {
    padding: 6px 12px;
    font-size: 0.75rem;
    color: var(--gray-400);
    border-top: 1px solid var(--gray-100);
    background-color: var(--gray-50);
    flex-shrink: 0;
    text-align: center;
}

/* ---------- Chat Section ---------- */
.chat-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background-color: var(--gray-50);
}

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

/* ---------- Welcome Message ---------- */
.welcome-message {
    text-align: center;
    padding: 40px 20px;
    animation: fadeIn 0.4s ease;
}

.welcome-message h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 8px;
}

.welcome-message > p {
    color: var(--gray-500);
    font-size: 0.9375rem;
    margin-bottom: 24px;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.quick-btn {
    padding: 10px 18px;
    font-size: 0.8125rem;
    color: var(--gray-700);
    background-color: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.quick-btn:hover {
    border-color: var(--green-300);
    background-color: var(--green-50);
    color: var(--green-700);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* ---------- Chat Bubbles ---------- */
.chat-bubble-wrapper {
    display: flex;
    animation: fadeIn 0.3s ease;
    max-width: 85%;
}

.chat-bubble-wrapper.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-bubble-wrapper.assistant {
    align-self: flex-start;
}

.chat-bubble {
    padding: 10px 14px;
    font-size: 0.875rem;
    line-height: 1.65;
    border-radius: var(--radius-lg);
    word-break: break-word;
    position: relative;
}

.chat-bubble-wrapper.user .chat-bubble {
    background-color: var(--green-500);
    color: var(--white);
    border-bottom-right-radius: var(--radius-sm);
    box-shadow: 0 1px 4px rgba(16, 185, 129, 0.25);
}

.chat-bubble-wrapper.assistant .chat-bubble {
    background-color: var(--white);
    color: var(--gray-800);
    border: 1px solid var(--gray-200);
    border-bottom-left-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}

.chat-bubble .bubble-time {
    font-size: 0.6875rem;
    color: var(--gray-400);
    margin-top: 6px;
    text-align: right;
}

.chat-bubble-wrapper.user .chat-bubble .bubble-time {
    color: rgba(255,255,255,0.7);
}

/* ---------- Streaming Cursor ---------- */
.streaming-cursor::after {
    content: '▌';
    display: inline;
    color: var(--green-500);
    animation: cursorBlink 0.8s infinite;
    font-weight: 300;
}

/* ---------- Typing Indicator ---------- */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background-color: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    border-bottom-left-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    align-self: flex-start;
    animation: fadeIn 0.3s ease;
    width: fit-content;
}

.typing-indicator span {
    display: inline-block;
    width: 7px;
    height: 7px;
    background-color: var(--gray-400);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

/* ---------- System Message ---------- */
.system-message {
    text-align: center;
    padding: 4px 12px;
    font-size: 0.75rem;
    color: var(--gray-400);
    align-self: center;
    animation: fadeIn 0.3s ease;
}

/* ---------- Chat Input Area ---------- */
.chat-input-area {
    padding: 12px 20px 16px;
    background-color: var(--white);
    border-top: 1px solid var(--gray-200);
    flex-shrink: 0;
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background-color: var(--gray-50);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-lg);
    padding: 8px 12px;
    transition: all var(--transition);
}

.input-wrapper:focus-within {
    border-color: var(--green-500);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
    background-color: var(--white);
}

.input-wrapper textarea {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--gray-800);
    outline: none;
    max-height: 120px;
    min-height: 21px;
    font-family: inherit;
    padding: 2px 0;
}

.input-wrapper textarea::placeholder {
    color: var(--gray-400);
}

.btn-send {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    min-width: 34px;
    border: none;
    background-color: var(--green-500);
    color: var(--white);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
}

.btn-send:hover {
    background-color: var(--green-600);
}

.btn-send:active {
    background-color: var(--green-700);
    transform: scale(0.95);
}

.btn-send:disabled {
    background-color: var(--gray-300);
    cursor: not-allowed;
    transform: none;
}

.input-hint {
    text-align: center;
    font-size: 0.6875rem;
    color: var(--gray-400);
    margin-top: 6px;
}

/* ---------- Modals ---------- */
.modal {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: overlayFadeIn 0.2s ease;
}

.modal-overlay {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background-color: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 28px 32px;
    width: 100%;
    max-width: 420px;
    margin: 16px;
    animation: modalIn 0.3s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--gray-900);
}

.modal-body {
    margin-bottom: 20px;
}

.modal-body p {
    font-size: 0.875rem;
    color: var(--gray-600);
    margin-bottom: 8px;
    line-height: 1.6;
}

.modal-body strong {
    color: var(--green-600);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ---------- Drag Overlay ---------- */
.drag-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 2000;
    background-color: rgba(16, 185, 129, 0.05);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: overlayFadeIn 0.2s ease;
}

.drag-content {
    text-align: center;
    padding: 60px 80px;
    border: 3px dashed var(--green-400);
    border-radius: var(--radius-xl);
    background-color: rgba(16, 185, 129, 0.05);
}

.drag-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.drag-content p {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--green-600);
}

/* ---------- Spinner ---------- */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--gray-200);
    border-top-color: var(--green-500);
    border-radius: 50%;
    animation: spinner 0.6s linear infinite;
}

.spinner-white {
    border-color: rgba(255,255,255,0.3);
    border-top-color: var(--white);
}

/* ---------- Error message in bubble ---------- */
.chat-bubble.error-bubble {
    border-color: #fecaca;
    background-color: var(--red-50);
}

.chat-bubble.error-bubble .bubble-content {
    color: var(--red-500);
}

/* ---------- Formatted content inside bubbles ---------- */
.bubble-content {
    overflow-wrap: break-word;
}

.bubble-content p {
    margin-bottom: 8px;
}

.bubble-content p:last-child {
    margin-bottom: 0;
}

.bubble-content strong {
    font-weight: 700;
    color: var(--gray-900);
}

.bubble-content code {
    font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', Consolas, monospace;
    font-size: 0.8125em;
    background-color: var(--gray-100);
    padding: 1px 5px;
    border-radius: 3px;
    color: var(--green-700);
}

.bubble-content pre {
    background-color: var(--gray-800);
    color: var(--gray-100);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin: 8px 0;
    font-size: 0.8125em;
    line-height: 1.5;
}

.bubble-content pre code {
    background: transparent;
    padding: 0;
    color: inherit;
    font-size: inherit;
    border-radius: 0;
}

.bubble-content ul, .bubble-content ol {
    padding-left: 20px;
    margin-bottom: 8px;
}

.bubble-content li {
    margin-bottom: 4px;
}

.bubble-content h1, .bubble-content h2, .bubble-content h3,
.bubble-content h4, .bubble-content h5 {
    font-weight: 600;
    margin: 12px 0 6px;
    color: var(--gray-900);
}

.bubble-content h1 { font-size: 1.25rem; }
.bubble-content h2 { font-size: 1.125rem; }
.bubble-content h3 { font-size: 1rem; }

.bubble-content table {
    border-collapse: collapse;
    margin: 8px 0;
    width: 100%;
    font-size: 0.8125em;
}

.bubble-content table th,
.bubble-content table td {
    border: 1px solid var(--gray-300);
    padding: 4px 8px;
    text-align: left;
}

.bubble-content table th {
    background-color: var(--gray-100);
    font-weight: 600;
}

/* ---------- Auth Pages ---------- */
body.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--green-50) 0%, #f0fdf4 30%, var(--gray-50) 70%, var(--green-50) 100%);
    overflow: auto;
}

.auth-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.auth-card {
    background-color: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 36px 32px;
    animation: modalIn 0.4s ease;
}

.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-header .logo-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 8px;
}

.auth-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.auth-header p {
    color: var(--gray-500);
    font-size: 0.875rem;
}

/* ---------- Loading overlay ---------- */
.loading-overlay {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background-color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
    z-index: 5;
}

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

    .sidebar-left {
        width: 100%;
        min-width: unset;
        max-width: unset;
        max-height: 45vh;
        border-right: none;
        border-bottom: 1px solid var(--gray-200);
    }

    .upload-area {
        margin: 12px;
        padding: 20px 16px;
    }

    .upload-area .upload-icon {
        font-size: 1.5rem;
    }

    .chat-messages {
        padding: 14px;
    }

    .chat-input-area {
        padding: 10px 14px 12px;
    }

    .welcome-message {
        padding: 24px 12px;
    }

    .welcome-message h2 {
        font-size: 1.25rem;
    }

    .quick-btn {
        padding: 8px 14px;
        font-size: 0.75rem;
    }

    .modal-content {
        padding: 24px 20px;
        margin: 10px;
    }

    .navbar {
        padding: 0 12px;
    }

    .navbar-brand {
        font-size: 1.1rem;
    }
}

/* ===== Result Table (pandasai DataFrame output) ===== */
.result-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--green-600);
    margin-bottom: 8px;
}

.result-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    margin: 8px 0;
}

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

.result-table thead {
    background: #f0fdf4;
    position: sticky;
    top: 0;
}

.result-table th {
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--green-700);
    border-bottom: 2px solid var(--green-200);
    white-space: nowrap;
}

.result-table td {
    padding: 6px 12px;
    border-bottom: 1px solid var(--gray-100);
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-table tbody tr:hover {
    background: #f8fafc;
}

.result-table tbody tr:nth-child(even) {
    background: #f9fafb;
}

.result-table tbody tr:nth-child(even):hover {
    background: #f0fdf4;
}

/* ===== Chart Image (pandasai plot output) ===== */
.chart-image {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    border: 1px solid var(--gray-200);
    margin: 8px 0;
    display: block;
}

/* ===== Error Bubble ===== */
.error-bubble {
    background: #fef2f2 !important;
    border-color: #fecaca !important;
    color: #dc2626 !important;
}

/* ===== Loading text ===== */
.loading-text {
    color: var(--gray-500);
    font-size: 13px;
    margin-left: 8px;
}

@media (max-width: 480px) {
    .navbar-actions .btn {
        padding: 6px 10px;
        font-size: 0.8125rem;
    }

    .user-info {
        display: none;
    }

    .chat-bubble-wrapper {
        max-width: 95%;
    }

    .panel-header h3 {
        font-size: 0.875rem;
    }

    .drag-content {
        padding: 40px 48px;
    }
}

/* ---------- Utility ---------- */
.text-center { text-align: center; }
.text-muted { color: var(--gray-500); }
.text-sm { font-size: 0.75rem; }
.text-green { color: var(--green-600); }
.text-red { color: var(--red-500); }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mb-2 { margin-bottom: 8px; }
.hidden { display: none !important; }
