/* Auto-Mate AI Assistant - Turquoise & White Theme */

:root {
    /* Light Theme (default) */
    --primary: #00B4B4;
    --primary-dark: #009999;
    --primary-light: #33CCCC;
    --primary-pale: #E6F7F7;
    --secondary: #2D3748;
    --accent: #00D4AA;
    --white: #FFFFFF;
    --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;
    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    /* Theme-aware colors */
    --bg-primary: var(--white);
    --bg-secondary: var(--gray-50);
    --bg-tertiary: var(--gray-100);
    --text-primary: var(--gray-900);
    --text-secondary: var(--gray-700);
    --text-muted: var(--gray-500);
    --border-color: var(--gray-200);
    --card-bg: var(--white);
    --input-bg: var(--white);
    --chat-assistant-bg: var(--gray-100);
}

/* Dark Theme */
[data-theme="dark"] {
    --gray-50: #1a1a2e;
    --gray-100: #16213e;
    --gray-200: #1f2937;
    --gray-300: #374151;
    --gray-400: #4B5563;
    --gray-500: #6B7280;
    --gray-600: #9CA3AF;
    --gray-700: #D1D5DB;
    --gray-800: #E5E7EB;
    --gray-900: #F9FAFB;
    --white: #0f0f23;
    --primary-pale: #004d4d;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    
    --bg-primary: #0f0f23;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #16213e;
    --text-primary: #F9FAFB;
    --text-secondary: #E5E7EB;
    --text-muted: #9CA3AF;
    --border-color: #374151;
    --card-bg: #1a1a2e;
    --input-bg: #16213e;
    --chat-assistant-bg: #16213e;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--text-primary);
}

/* Theme Toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: 1rem;
}

.theme-toggle-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.theme-switch {
    position: relative;
    width: 56px;
    height: 28px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gray-300);
    transition: 0.3s;
    border-radius: 28px;
}

.theme-slider:before {
    position: absolute;
    content: "☀️";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: var(--white);
    transition: 0.3s;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.theme-switch input:checked + .theme-slider {
    background: var(--primary);
}

.theme-switch input:checked + .theme-slider:before {
    transform: translateX(28px);
    content: "🌙";
}

.theme-switch input:focus + .theme-slider {
    box-shadow: 0 0 0 3px rgba(0, 180, 180, 0.2);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    box-shadow: 0 2px 4px rgba(0, 180, 180, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #007777 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 180, 180, 0.4);
}

.btn-secondary {
    background: var(--white);
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-secondary:hover {
    background: var(--primary-pale);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover {
    background: var(--bg-tertiary);
}

/* Form Elements */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    background: var(--input-bg);
    color: var(--text-primary);
    transition: all 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 180, 180, 0.15);
}

.form-input::placeholder {
    color: var(--text-muted);
}

/* Auth Pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 50%, var(--secondary) 100%);
    padding: 2rem;
}

.auth-card {
    background: var(--white);
    border-radius: 1rem;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo h1 {
    font-size: 1.75rem;
    color: var(--primary);
    font-weight: 700;
}

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

.auth-form h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--gray-800);
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--gray-500);
    font-size: 0.875rem;
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* App Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s, border-color 0.3s;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    transition: border-color 0.3s;
    text-align: center;
}

.sidebar-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.sidebar-tagline {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    text-align: center;
    opacity: 0.8;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.875rem 1rem;
    border-radius: 0.5rem;
    color: var(--text-muted);
    text-decoration: none;
    margin-bottom: 0.25rem;
    transition: all 0.2s;
    cursor: pointer;
}

.nav-item:hover {
    background: var(--primary-pale);
    color: var(--primary);
}

.nav-item.active {
    background: var(--primary);
    color: var(--white);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    margin-right: 0.75rem;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    transition: border-color 0.3s;
}

.user-info {
    display: flex;
    align-items: center;
    padding: 0.75rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-right: 0.75rem;
}

.user-details {
    flex: 1;
}

.user-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.user-org {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.main-header {
    background: var(--card-bg);
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background-color 0.3s, border-color 0.3s;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.main-body {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: background-color 0.3s;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: border-color 0.3s;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: background-color 0.3s;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.5rem;
    background: var(--primary-pale);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Chat Interface */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: calc(100vh - 180px);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-message {
    max-width: 80%;
    padding: 1rem;
    border-radius: 1rem;
    line-height: 1.5;
}

.chat-message.user {
    background: var(--primary);
    color: var(--white);
    align-self: flex-end;
    border-bottom-right-radius: 0.25rem;
}

.chat-message.assistant {
    background: var(--chat-assistant-bg);
    color: var(--text-secondary);
    align-self: flex-start;
    border-bottom-left-radius: 0.25rem;
}

.chat-sources {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-300);
    font-size: 0.8rem;
    color: var(--gray-600);
}

.chat-input-container {
    padding: 1rem;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    transition: background-color 0.3s, border-color 0.3s;
}

.chat-input-wrapper {
    display: flex;
    gap: 0.75rem;
}

.chat-input {
    flex: 1;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    resize: none;
    background: var(--input-bg);
    color: var(--text-primary);
    transition: background-color 0.3s, border-color 0.3s, color 0.3s;
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Document List */
.doc-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.doc-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: var(--card-bg);
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.doc-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.doc-icon {
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    background: var(--primary-pale);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
}

.doc-info {
    flex: 1;
}

.doc-name {
    font-weight: 500;
    color: var(--text-secondary);
}

.doc-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.doc-actions {
    display: flex;
    gap: 0.5rem;
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: 0.75rem;
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--card-bg);
}

.upload-zone:hover {
    border-color: var(--primary);
    background: var(--primary-pale);
}

.upload-zone.drag-over {
    border-color: var(--primary);
    background: var(--primary-pale);
}

.upload-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    color: var(--gray-400);
}

.upload-text {
    color: var(--text-muted);
}

.upload-text strong {
    color: var(--primary);
}

/* Proposal Generator */
.proposal-section {
    margin-bottom: 1.5rem;
}

.proposal-preview {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1.5rem;
    max-height: 500px;
    overflow-y: auto;
    transition: background-color 0.3s, border-color 0.3s;
}

.proposal-preview h1,
.proposal-preview h2,
.proposal-preview h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.proposal-preview h1:first-child,
.proposal-preview h2:first-child {
    margin-top: 0;
}

.proposal-preview p {
    margin-bottom: 1rem;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
}

.badge-primary {
    background: var(--primary-pale);
    color: var(--primary);
}

.badge-success {
    background: #D1FAE5;
    color: #059669;
}

.badge-warning {
    background: #FEF3C7;
    color: #D97706;
}

.badge-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

/* Loading Spinner */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.alert-error {
    background: #FEE2E2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

.alert-success {
    background: #D1FAE5;
    color: #065F46;
    border: 1px solid #A7F3D0;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -280px;
        z-index: 100;
        transition: left 0.3s;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Animations */
.fade-in {
    animation: fadeIn 0.3s ease-out;
}

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

/* Tab Navigation */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
    transition: border-color 0.3s;
}

.tab {
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.tab:hover {
    color: var(--primary);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Chat Session History */
.chat-sessions-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.chat-session-item {
    padding: 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s;
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid transparent;
}

.chat-session-item:hover {
    background: var(--bg-tertiary);
}

.chat-session-item.active {
    background: var(--primary-pale);
    border-color: var(--primary);
}

[data-theme="dark"] .chat-session-item.active {
    background: rgba(0, 180, 180, 0.15);
}

.chat-session-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 1.5rem;
}

.chat-session-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.chat-session-delete {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 1.25rem;
    height: 1.25rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    border-radius: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s, background-color 0.2s;
}

.chat-session-item:hover .chat-session-delete {
    opacity: 1;
}

.chat-session-delete:hover {
    background: var(--error);
    color: white;
}


/* ─────────────────────────────────────────────────────────────────────────────
   Modal Styles
   ───────────────────────────────────────────────────────────────────────────── */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.modal-content {
    position: relative;
    background: var(--card-bg);
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    animation: modal-appear 0.2s ease-out;
}

.preview-modal-content {
    width: 90vw;
    max-width: 1200px;
}

@keyframes modal-appear {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 3rem);
}

.modal-body {
    padding: 1.5rem;
    overflow: auto;
    max-height: calc(90vh - 4rem);
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* Dialog Modal Styles */
.dialog-modal-content {
    width: 400px;
    max-width: 90vw;
}

.dialog-modal-content .modal-body p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.6;
}

.btn-danger {
    background: var(--error);
    color: white;
}

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

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--gray-300);
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--primary);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

/* Email Conversation Styles */
.email-conversation {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.email-item {
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: var(--card-bg);
    overflow: hidden;
}

.email-item.sent {
    border-left: 4px solid var(--primary);
}

.email-item.received {
    border-left: 4px solid var(--success);
}

.email-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    cursor: pointer;
}

.email-header:hover {
    background: var(--bg-tertiary);
}

.email-direction {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-weight: 600;
}

.email-direction.sent {
    background: var(--primary-pale);
    color: var(--primary-dark);
}

.email-direction.received {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.email-subject {
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
    margin-left: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.email-body {
    padding: 1rem;
    display: none;
    border-top: 1px solid var(--border-color);
}

.email-item.expanded .email-body {
    display: block;
}

.email-body-content {
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Contact Modal Tabs */
.contact-tab {
    padding: 0.75rem 1.25rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.contact-tab:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.contact-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.contact-tab-content {
    padding-top: 0.5rem;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

/* Tag Badges */
.tag-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    background: var(--primary-pale);
    color: var(--primary-dark);
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.tag-badge:hover {
    background: var(--primary);
    color: white;
}

/* Tag Filter Pills */
.tag-filter-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tag-filter-pill {
    padding: 0.375rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.tag-filter-pill:hover {
    border-color: var(--primary);
}

.tag-filter-pill.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Inbox Styles */
.inbox-email-item {
    transition: background 0.15s;
}

.inbox-email-item:hover {
    background: var(--bg-tertiary);
}

.inbox-email-item.active {
    background: var(--primary-pale);
    border-left: 3px solid var(--primary);
}

.inbox-email-item.unread {
    background: var(--bg-secondary);
}

.inbox-email-item.unread:hover {
    background: var(--bg-tertiary);
}

.email-body img {
    max-width: 100%;
    height: auto;
}

.email-body a {
    color: var(--primary);
}

.email-body blockquote {
    border-left: 3px solid var(--border-color);
    padding-left: 1rem;
    margin-left: 0;
    color: var(--text-muted);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Chat Formatting Toolbar
   ───────────────────────────────────────────────────────────────────────────── */

.fmt-btn {
    background: none;
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 0.35rem 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.875rem;
    min-width: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.fmt-btn:hover {
    background: var(--bg-primary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.fmt-btn:active {
    background: var(--primary);
    color: white;
}

/* Contenteditable placeholder */
#chat-message-input:empty:before {
    content: attr(data-placeholder);
    color: var(--text-secondary);
    pointer-events: none;
}

#chat-message-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.1);
}

/* Chat message formatting */
.chat-msg-content strong, .chat-msg-content b {
    font-weight: 600;
}

.chat-msg-content em, .chat-msg-content i {
    font-style: italic;
}

.chat-msg-content code {
    background: rgba(0, 0, 0, 0.1);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.85em;
}

.chat-msg-content pre {
    background: rgba(0, 0, 0, 0.15);
    padding: 0.75rem;
    border-radius: 6px;
    overflow-x: auto;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.85em;
    margin: 0.5rem 0;
}

.chat-msg-content blockquote {
    border-left: 3px solid var(--primary);
    padding-left: 0.75rem;
    margin: 0.5rem 0;
    opacity: 0.85;
}

.chat-msg-content a {
    color: inherit;
    text-decoration: underline;
}

.chat-msg-content .mention {
    background: rgba(var(--primary-rgb), 0.2);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-weight: 500;
}

/* Force bold/italic styling in chat messages */
.chat-msg-content strong,
.chat-msg-content b {
    font-weight: 700 !important;
}

.chat-msg-content em,
.chat-msg-content i {
    font-style: italic !important;
}

.chat-msg-content del,
.chat-msg-content s {
    text-decoration: line-through !important;
}

.chat-msg-content u {
    text-decoration: underline !important;
}

/* DEBUG: Make bold text very obvious */
.chat-msg-content strong {
    background: rgba(255, 255, 0, 0.3) !important;
    padding: 0 2px !important;
}
