/* ============================================================
   Main Stylesheet
   ============================================================ */

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

:root {
    --bg: #0f1117;
    --bg-secondary: #1a1d27;
    --bg-tertiary: #252830;
    --border: #2e3140;
    --text: #e4e4e7;
    --text-muted: #9ca3af;
    --primary: #6366f1;
    --primary-hover: #5558e6;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
    --radius: 8px;
    --radius-lg: 12px;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font);
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary { background: var(--bg-tertiary); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }

.btn-full { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon { background: none; border: none; color: var(--text-muted); font-size: 18px; cursor: pointer; padding: 8px; }
.btn-icon:hover { color: var(--text); }

/* ============================================================
   Forms
   ============================================================ */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    color: var(--text-muted);
}
.form-check label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}
.form-check input[type="checkbox"] {
    width: auto;
    margin: 0;
}

input[type="text"], input[type="email"], input[type="password"],
textarea, select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 14px;
    font-family: var(--font);
    transition: border-color 0.15s;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
}

textarea { resize: vertical; }
select { cursor: pointer; }

.inline-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.inline-form input, .inline-form select {
    width: auto;
    flex: 1;
    min-width: 150px;
}

/* ============================================================
   Alerts & Status
   ============================================================ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-error { background: rgba(239, 68, 68, 0.15); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.3); }
.alert-success { background: rgba(34, 197, 94, 0.15); color: #86efac; border: 1px solid rgba(34, 197, 94, 0.3); }

.status-message { font-size: 13px; margin-top: 8px; min-height: 20px; }
.status-message.success { color: var(--success); }
.status-message.error { color: var(--danger); }

.badge { padding: 4px 8px; border-radius: 4px; font-size: 12px; font-weight: 500; }
.badge-success { background: rgba(34, 197, 94, 0.2); color: #86efac; }

.hidden { display: none !important; }

/* ============================================================
   Auth Pages (Login / Register)
   ============================================================ */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

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

.auth-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
}

.auth-card h1 {
    font-size: 18px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.auth-card h2 {
    font-size: 24px;
    margin-bottom: 24px;
}

.auth-footer {
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    color: var(--text-muted);
}

/* ============================================================
   Onboarding
   ============================================================ */
.onboarding-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}
.onboarding-aux, .auth-aux {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}
.onboarding-aux a, .auth-aux a {
    font-size: 13px;
    color: var(--text-muted);
}
.onboarding-aux a:hover, .auth-aux a:hover { color: var(--text); text-decoration: none; }
.onboarding-aux-sep, .auth-aux-sep { color: var(--border); font-size: 13px; }

.onboarding-container { width: 100%; max-width: 600px; }

.onboarding-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
}

.progress-bar {
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    margin-bottom: 8px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
}

.step-indicator {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.onboarding-step h2 { margin-bottom: 16px; }

.question-hint {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 12px;
}

.question-input {
    margin-bottom: 16px;
}

.question-input.error { border-color: var(--danger); }

.step-desc {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 20px;
}

/* Taxonomy */
.search-input {
    margin-bottom: 12px;
}

.taxonomy-results {
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.taxonomy-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    cursor: pointer;
    font-size: 14px;
    font-family: var(--font);
}

.taxonomy-item:hover { border-color: var(--primary); }
.taxonomy-item .code { color: var(--primary); font-weight: 600; margin-right: 8px; }

.grade-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.grade-btn {
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    cursor: pointer;
    font-size: 14px;
    font-family: var(--font);
}

.grade-btn:hover { border-color: var(--primary); }

/* Followups */
.followup-group { margin-bottom: 16px; }
.followup-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
}

/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 20px auto;
}

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

/* Intro Screen (#1) */
.intro-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 20px 0;
}
.intro-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
}
.intro-card-icon { font-size: 24px; margin-bottom: 8px; }
.intro-card h3 { font-size: 15px; margin-bottom: 4px; }
.intro-card p { font-size: 13px; color: var(--text-muted); }
.intro-time {
    font-size: 14px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 16px;
}

.skip-onboarding-link {
    display: block;
    text-align: center;
    margin-top: 12px;
    font-size: 14px;
    color: var(--text-muted);
    text-decoration: none;
}
.skip-onboarding-link:hover { color: var(--text); text-decoration: underline; }

/* Question Counter (#9) */
.question-counter {
    font-size: 13px;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 8px;
}

/* Question Nav */
.question-nav {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

/* Question Help Panel (#2-3) */
.question-help-panel {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 16px;
    font-size: 14px;
}
.question-help-panel summary {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 13px;
}
.question-help-panel[open] summary { margin-bottom: 12px; }
.help-content { display: flex; flex-direction: column; gap: 10px; }
.help-why { color: var(--text-muted); font-size: 13px; }
.help-examples { display: flex; flex-direction: column; gap: 8px; }
.help-example {
    padding: 10px;
    border-radius: var(--radius);
    font-size: 13px;
}
.help-example.good { background: rgba(34, 197, 94, 0.08); border: 1px solid rgba(34, 197, 94, 0.2); }
.help-example.bad { background: rgba(239, 68, 68, 0.08); border: 1px solid rgba(239, 68, 68, 0.2); }
.help-example strong { display: block; margin-bottom: 4px; font-size: 12px; }
.help-example p { margin: 0; }
.ai-help-result {
    padding: 10px;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text);
}

/* Doc Previews (#5) */
.doc-previews { display: flex; flex-direction: column; gap: 12px; }
.doc-preview-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
}
.doc-preview-card h4 { font-size: 14px; margin-bottom: 8px; }
.doc-preview-text {
    font-size: 12px;
    color: var(--text-muted);
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 120px;
    overflow: hidden;
    margin: 0;
    font-family: var(--font);
}

/* ============================================================
   Chat Workspace
   ============================================================ */
.chat-page {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ============================================================
   Workspace Layout (sidebar + main content)
   ============================================================ */
.workspace {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.workspace-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-y: auto;
}

.workspace-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

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

.workspace-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.workspace-content .settings-container,
.workspace-content .admin-container {
    max-width: 900px;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-brand {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border);
}

.sidebar-brand-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    flex-shrink: 0;
}

.sidebar-brand-info { flex: 1; min-width: 0; }
.sidebar-brand-name { font-size: 15px; font-weight: 600; }
.sidebar-brand-user { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-help {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    flex-shrink: 0;
}

.sidebar-help:hover { color: var(--text); border-color: var(--text-muted); text-decoration: none; }

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 14px;
    text-decoration: none;
    transition: all 0.12s;
    margin-bottom: 2px;
}

.sidebar-nav-item:hover { background: var(--bg-tertiary); color: var(--text); text-decoration: none; }
.sidebar-nav-item.active { background: var(--bg-tertiary); color: var(--text); font-weight: 500; }

.sidebar-nav-icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-nav-item-sm { font-size: 13px; padding: 7px 12px; }

.sidebar-conversations {
    padding: 4px 0 8px 0;
}

.sidebar-new-chat {
    margin: 4px 8px 8px 8px;
    width: calc(100% - 16px);
}

#conversationList {
    max-height: 240px;
    overflow-y: auto;
}

.conversation-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 12px 8px 32px;
    background: none;
    border: none;
    border-radius: var(--radius);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    font-family: var(--font);
    margin-bottom: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-item:hover { background: var(--bg-tertiary); color: var(--text); }
.conversation-item.active { background: rgba(99, 102, 241, 0.15); color: var(--text); }

.sidebar-footer {
    padding: 8px;
    border-top: 1px solid var(--border);
}

/* Sidebar Usage Indicator */
.sidebar-usage {
    display: block;
    padding: 10px 14px;
    border-top: 1px solid var(--border);
    text-decoration: none;
    color: var(--text-muted);
    transition: background 0.15s;
}
.sidebar-usage:hover { background: var(--bg-tertiary); text-decoration: none; }
.sidebar-usage-bar {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}
.sidebar-usage-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}
.sidebar-usage-text {
    font-size: 11px;
    margin-top: 4px;
    color: var(--text-muted);
}

/* Usage Progress Bars (settings, admin) */
.usage-progress-bar {
    height: 10px;
    background: var(--bg-tertiary);
    border-radius: 5px;
    overflow: hidden;
}
.usage-progress-bar.usage-progress-lg {
    height: 16px;
    border-radius: 8px;
    margin: 8px 0;
}
.usage-progress-fill {
    height: 100%;
    border-radius: inherit;
    transition: width 0.3s;
}

/* Chat messages remaining */
.chat-messages-remaining {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}
.chat-messages-remaining.usage-remaining-low {
    color: var(--warning);
}
.chat-messages-remaining.usage-remaining-critical {
    color: var(--danger);
    font-weight: 600;
}
.chat-messages-remaining a {
    color: var(--primary);
    font-weight: 500;
}

/* Usage limit inline message (chat) */
.usage-limit-msg {
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    line-height: 1.6;
}
.usage-limit-msg a {
    color: var(--primary);
    font-weight: 500;
}

/* File count label */
.file-count-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-right: 8px;
}

/* Usage limit section (settings) */
.usage-limit-header {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
}

/* Chat Main */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-header {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header h3 { font-size: 16px; font-weight: 500; }

/* Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.welcome-message {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.welcome-message h2 { color: var(--text); margin-bottom: 8px; }

.message {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    max-width: 800px;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
    color: var(--text-muted);
}

.message-user .message-avatar { background: var(--primary); color: white; }

.message-content {
    flex: 1;
    line-height: 1.7;
    font-size: 15px;
}

.message-content pre {
    background: var(--bg-tertiary);
    padding: 12px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 8px 0;
}

.message-content code {
    font-family: var(--font-mono);
    font-size: 13px;
}

.message-content :not(pre) > code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
}

.message-system {
    justify-content: center;
    font-size: 13px;
    color: var(--text-muted);
}

/* Chat Input */
.chat-input-area {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.chat-input-container {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 8px 12px;
}

.chat-input-container textarea {
    flex: 1;
    background: none;
    border: none;
    resize: none;
    padding: 4px 0;
    min-height: 24px;
    max-height: 200px;
    font-size: 15px;
    line-height: 1.5;
}

.chat-input-container textarea:focus { outline: none; }

.btn-send { flex-shrink: 0; }

.chat-main.dragover { background: rgba(99, 102, 241, 0.05); }

/* Typing Indicator (#12) */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
}

.typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typing-pulse 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

.typing-label {
    font-size: 14px;
    color: var(--text-muted);
    margin-left: 4px;
}

@keyframes typing-pulse {
    0%, 60%, 100% { opacity: 0.3; transform: scale(1); }
    30% { opacity: 1; transform: scale(1.2); }
}

/* File Delivery Card (#14) */
.file-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-top: 12px;
}

.file-card-icon { font-size: 28px; flex-shrink: 0; }
.file-card-info { flex: 1; min-width: 0; }

.file-card-name {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.file-card-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
    text-transform: uppercase;
}

.file-card-size { font-size: 12px; color: var(--text-muted); }
.file-card-actions { flex-shrink: 0; }

.file-card-pending {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
}

/* Chat Header Actions (#15, #17, #23) */
.chat-header-action { font-size: 14px; }
.chat-header-spacer { flex: 1; }

.chat-title-edit {
    font-size: 16px;
    font-weight: 500;
    background: var(--bg-tertiary);
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    color: var(--text);
    padding: 4px 10px;
    font-family: var(--font);
    width: 250px;
}

/* Sidebar Search (#16) */
.sidebar-search {
    display: block;
    width: calc(100% - 16px);
    margin: 0 8px 8px 8px;
    padding: 6px 10px;
    font-size: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font);
}

.sidebar-search:focus { outline: none; border-color: var(--primary); }

/* Message Actions (#18, #20) */
.msg-actions {
    display: flex;
    gap: 4px;
    margin-top: 6px;
    opacity: 0;
    transition: opacity 0.15s;
}

.message:hover .msg-actions { opacity: 1; }

.msg-action-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 12px;
    padding: 2px 8px;
    cursor: pointer;
    font-family: var(--font);
}

.msg-action-btn:hover { color: var(--text); border-color: var(--text-muted); }

/* Error + Retry (#22) */
.msg-error { color: var(--danger); }
.msg-retry-btn { margin-left: 8px; }
.stream-recovery-bar { margin-top: 12px; padding: 8px 12px; background: var(--bg-tertiary); border-radius: 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.text-muted { color: var(--text-muted); }

/* Code Block Copy (#19) */
.code-block-wrap {
    position: relative;
    margin: 8px 0;
}

.code-copy-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 11px;
    padding: 2px 8px;
    cursor: pointer;
    font-family: var(--font);
    opacity: 0;
    transition: opacity 0.15s;
}

.code-block-wrap:hover .code-copy-btn { opacity: 1; }
.code-copy-btn:hover { color: var(--text); border-color: var(--text-muted); }

/* ============================================================
   Settings (within workspace)
   ============================================================ */
.settings-container { max-width: 800px; }

.settings-header {
    margin-bottom: 32px;
}

.settings-header h1 { font-size: 28px; margin-top: 8px; }

.settings-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
}

.settings-section h2 {
    font-size: 18px;
    margin-bottom: 8px;
}

.settings-section > p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 16px;
}

/* Account Management (#54) */
.account-field { margin-bottom: 14px; }
.account-field > label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.account-field-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.account-field-row input {
    flex: 1;
    min-width: 140px;
}

/* Doc Editor */
.doc-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}

.doc-tab {
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    font-family: var(--font);
}

.doc-tab.active { background: var(--primary); color: white; border-color: var(--primary); }

.doc-guide {
    margin-bottom: 8px;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-muted);
}
.doc-guide strong { color: var(--text); }
.doc-guide details { margin-top: 6px; }
.doc-guide summary {
    cursor: pointer;
    color: var(--accent);
    font-size: 12px;
}
.doc-guide ul {
    margin: 6px 0 0;
    padding-left: 18px;
    font-size: 12px;
}
.doc-guide ul li { margin-bottom: 3px; }

.doc-editor {
    width: 100%;
    min-height: 300px;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    color: var(--text);
    resize: vertical;
}

.doc-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

/* Integrations */
.integration-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.integration-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.integration-card h3 { margin-bottom: 4px; }
.integration-card p { color: var(--text-muted); font-size: 13px; margin-bottom: 12px; }

/* ============================================================
   Admin Pages (within workspace)
   ============================================================ */
.admin-container { max-width: 1000px; }

.admin-header { margin-bottom: 24px; }
.admin-header h1 { font-size: 28px; }

.admin-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
}

.admin-section h2 { font-size: 18px; margin-bottom: 16px; }

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.stat-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
}

.stat-number { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* Tables */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.admin-table th {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 13px;
}

.admin-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}

.admin-table .total-row td { border-top: 2px solid var(--border); }

/* ============================================================
   Documents Page (#34-36)
   ============================================================ */
.doc-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
}

.doc-search-input {
    width: 200px;
    padding: 6px 10px;
    font-size: 13px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font);
}

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

.doc-filter-select {
    width: auto;
    padding: 6px 10px;
    font-size: 13px;
}

.doc-detail-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
}

.doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.doc-grid.doc-list-view {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.doc-grid.doc-list-view .doc-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
}

.doc-grid.doc-list-view .doc-card-icon { font-size: 24px; }
.doc-grid.doc-list-view .doc-card-title { flex: 1; margin-bottom: 0; }
.doc-grid.doc-list-view .doc-card-meta { margin-top: 0; }

.doc-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    cursor: pointer;
    transition: border-color 0.15s;
}

.doc-card:hover { border-color: var(--primary); }
.doc-card-icon { font-size: 32px; margin-bottom: 8px; }
.doc-card-title { font-size: 15px; font-weight: 500; margin-bottom: 8px; word-wrap: break-word; }
.doc-card-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.doc-card-date { font-size: 12px; color: var(--text-muted); }
.doc-card-version { font-size: 12px; color: var(--primary); font-weight: 600; }
.doc-card-source { font-size: 12px; color: var(--text-muted); display: block; margin-top: 4px; }
.doc-card-source:hover { color: var(--primary); }

.doc-empty {
    text-align: center;
    padding: 60px 20px;
    grid-column: 1 / -1;
}

.doc-empty p { margin-bottom: 8px; }

/* Document Detail Tabs */
.doc-detail-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

.doc-detail-tab {
    padding: 8px 16px;
    background: none;
    border: 1px solid transparent;
    border-radius: var(--radius) var(--radius) 0 0;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    font-family: var(--font);
}

.doc-detail-tab:hover { color: var(--text); }
.doc-detail-tab.active { color: var(--text); border-color: var(--border); border-bottom-color: var(--bg); background: var(--bg-secondary); }

/* Preview Panel */
.doc-preview-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    min-height: 300px;
    line-height: 1.7;
    font-size: 15px;
}

.doc-preview-panel h2 { font-size: 22px; margin-bottom: 12px; }
.doc-preview-panel h3 { font-size: 18px; margin-bottom: 8px; margin-top: 16px; }
.doc-preview-panel h4 { font-size: 16px; margin-bottom: 6px; margin-top: 12px; }
.doc-preview-panel ul { padding-left: 24px; margin: 8px 0; }
.doc-preview-panel li { margin-bottom: 4px; }
.doc-preview-panel pre { background: var(--bg-tertiary); padding: 12px; border-radius: var(--radius); overflow-x: auto; margin: 8px 0; }
.doc-preview-panel code { font-family: var(--font-mono); font-size: 13px; }

/* Sheet Preview Table */
.sheet-table-wrap { overflow-x: auto; margin: 8px 0; }
.sheet-name { font-size: 15px; margin: 12px 0 4px 0; color: var(--primary); }

.sheet-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.sheet-table th {
    background: var(--bg-tertiary);
    padding: 8px 12px;
    text-align: left;
    border: 1px solid var(--border);
    font-weight: 600;
    font-size: 13px;
    color: var(--text);
}

.sheet-table td {
    padding: 6px 12px;
    border: 1px solid var(--border);
    font-size: 13px;
}

.sheet-table td[contenteditable]:focus,
.sheet-table th[contenteditable]:focus {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

.col-add, .row-del {
    color: var(--text-muted);
    cursor: pointer;
    text-align: center;
    width: 30px;
    font-size: 14px;
}

.col-add:hover, .row-del:hover { color: var(--primary); }

.sheet-name-edit { margin: 12px 0 4px 0; }
.sheet-name-input { width: auto; max-width: 250px; font-size: 14px; padding: 4px 8px; }

/* Slide Preview Cards */
.slide-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 16px;
}

.slide-number { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.slide-title { font-size: 20px; margin-bottom: 8px; }
.slide-subtitle { font-size: 14px; color: var(--text-muted); margin-bottom: 8px; }
.slide-bullets { padding-left: 24px; margin: 8px 0; }
.slide-bullets li { margin-bottom: 4px; font-size: 15px; }
.slide-notes { font-size: 12px; color: var(--text-muted); padding-top: 8px; border-top: 1px solid var(--border); margin-top: 12px; }

/* Editable Slide Inputs */
.slide-title-input { width: 100%; font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.slide-subtitle-input { width: 100%; font-size: 14px; margin-bottom: 8px; }
.slide-notes-input { width: 100%; min-height: 50px; font-size: 13px; resize: vertical; margin-top: 8px; }
.slide-bullet-row { display: flex; gap: 4px; align-items: center; margin-bottom: 4px; }
.slide-bullet-input { flex: 1; font-size: 14px; }
.slide-bullets-edit { margin: 8px 0; }

/* Editor Actions */
.doc-editor-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.doc-editor-panel { min-height: 300px; }

/* EasyMDE overrides for dark theme */
.EasyMDEContainer .CodeMirror {
    background: var(--bg) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

.EasyMDEContainer .editor-toolbar {
    background: var(--bg-secondary) !important;
    border-color: var(--border) !important;
}

.EasyMDEContainer .editor-toolbar button {
    color: var(--text-muted) !important;
}

.EasyMDEContainer .editor-toolbar button:hover,
.EasyMDEContainer .editor-toolbar button.active {
    background: var(--bg-tertiary) !important;
    color: var(--text) !important;
}

.EasyMDEContainer .CodeMirror-cursor { border-color: var(--text) !important; }
.EasyMDEContainer .cm-s-easymde .cm-header { color: var(--primary) !important; }

.EasyMDEContainer .editor-preview,
.EasyMDEContainer .editor-preview-side {
    background: var(--bg-secondary) !important;
    color: var(--text) !important;
}

/* Version History (#39) */
.version-list { display: flex; flex-direction: column; gap: 8px; }

.version-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    flex-wrap: wrap;
    gap: 8px;
}

.version-item.current { border-color: var(--primary); }
.version-info { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.version-actions { display: flex; gap: 8px; }

/* Diff View (#39) */
.diff-container { overflow-x: auto; }

.diff-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 8px;
}

.diff-col-header { font-weight: 600; font-size: 14px; padding: 8px; }

.diff-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.diff-col {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    font-family: var(--font-mono);
    font-size: 12px;
    max-height: 500px;
    overflow-y: auto;
}

.diff-line { padding: 1px 4px; white-space: pre-wrap; word-wrap: break-word; }
.diff-removed { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }
.diff-added { background: rgba(34, 197, 94, 0.15); color: #86efac; }
.diff-empty { min-height: 18px; }

/* Modal (#38, #39) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    max-width: 500px;
    width: 90%;
}

.modal-card h3 { margin-bottom: 8px; }
.modal-card .text-muted { margin-bottom: 16px; font-size: 14px; }

.modal-wide { max-width: 900px; }

/* ============================================================
   Templates Page (#42-48)
   ============================================================ */
.tpl-var-count {
    font-size: 12px;
    color: var(--text-muted);
}

.tpl-used-count {
    font-size: 12px;
    color: var(--text-muted);
}

.tpl-shared-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(34, 197, 94, 0.15);
    color: #86efac;
}

/* Template Detail Layout */
.tpl-detail-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 24px;
}

.tpl-detail-main { min-width: 0; }

.tpl-tab-content { min-height: 300px; }

/* Template Sidebar Panels */
.tpl-detail-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tpl-actions-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tpl-var-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
}

.tpl-var-panel h4 {
    font-size: 14px;
    margin-bottom: 12px;
    color: var(--text);
}

.tpl-var-item {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.tpl-var-item:last-child { border-bottom: none; }

.tpl-var-name {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--primary);
    font-weight: 600;
}

.tpl-var-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.tpl-var-type {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Variable Highlight in Preview */
.tpl-var-highlight {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
    padding: 1px 4px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.9em;
}

/* Template Meta Panel */
.tpl-meta-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
}

.tpl-meta-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    padding: 4px 0;
}

/* Template Fill Form */
.tpl-fill-form {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}

/* Save Template Modal Vars */
.tpl-save-vars {
    max-height: 200px;
    overflow-y: auto;
}

.tpl-save-var-item {
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}

.tpl-save-var-item:last-child { border-bottom: none; }

@media (max-width: 768px) {
    .tpl-detail-layout {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   Files Page (#49-53)
   ============================================================ */
.files-table .file-icon-cell { width: 40px; font-size: 22px; text-align: center; }
.files-table .file-actions-cell { white-space: nowrap; }
.file-name-link { color: var(--text); font-weight: 500; }
.file-name-link:hover { color: var(--primary); text-decoration: none; }

.badge-warning { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.badge-danger { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }

.file-preview-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 480px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    z-index: 150;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.3);
}

.file-preview-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

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

.file-preview-header h3 {
    font-size: 16px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    margin-right: 12px;
}

.file-preview-header .btn-icon { font-size: 24px; }

.file-preview-meta {
    display: flex;
    gap: 12px;
    padding: 8px 20px;
    font-size: 13px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.file-preview-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.file-preview-text {
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    background: var(--bg);
    padding: 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    max-height: none;
}

.file-preview-image {
    max-width: 100%;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.file-structure-info {
    margin-top: 16px;
    padding: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
}

.file-structure-info h4 {
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--primary);
}

.file-structure-info p { margin-bottom: 4px; }

.workspace-main.dragover { background: rgba(99, 102, 241, 0.05); }

/* ============================================================
   First-Use Tour (#6)
   ============================================================ */
.tour-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9998;
    pointer-events: all;
}

.tour-highlight {
    position: fixed;
    z-index: 9999;
    box-shadow: 0 0 0 4px var(--primary), 0 0 0 9999px rgba(0, 0, 0, 0.55);
    border-radius: var(--radius);
    pointer-events: none;
    transition: all 0.3s ease;
}

.tour-tooltip {
    position: fixed;
    z-index: 10000;
    background: var(--bg-secondary);
    border: 1px solid var(--primary);
    border-radius: var(--radius-lg);
    padding: 20px;
    max-width: 320px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.tour-tooltip h4 {
    font-size: 15px;
    margin-bottom: 6px;
    color: var(--text);
}

.tour-tooltip p {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
    line-height: 1.5;
}

.tour-tooltip-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tour-step-dots {
    display: flex;
    gap: 6px;
}

.tour-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
}

.tour-dot.active { background: var(--primary); }

/* Welcome Prompt Suggestions (#7) */
.welcome-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 16px;
}

.welcome-suggestion-btn {
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    font-family: var(--font);
    transition: all 0.15s;
}

.welcome-suggestion-btn:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

@media (max-width: 768px) {
    .file-preview-overlay { width: 100%; }
}

/* ============================================================
   Settings: Integration Sync Status (#59), Usage Table (#58)
   ============================================================ */
.integration-sync-info {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 4px 0;
    font-size: 13px;
}

.sync-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.sync-green { background: var(--success); }
.sync-yellow { background: var(--warning); }
.sync-red { background: var(--danger); }
.sync-gray { background: var(--text-muted); }

.usage-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-top: 12px;
}

.usage-table th,
.usage-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.usage-table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.usage-table tr:hover td {
    background: var(--bg-secondary);
}

/* Learning banner (#68) */
.learning-banner {
    background: var(--bg-tertiary);
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin: 0 0 16px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.learning-banner-text {
    flex: 1;
    font-size: 14px;
}

.learning-banner .btn {
    flex-shrink: 0;
}
.personalization-banner {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}
.personalization-banner a { color: var(--primary); text-decoration: underline; }
.personalization-banner .btn { flex-shrink: 0; }

/* ============================================================
   Responsive — Session 38
   ============================================================ */

/* Hamburger toggle button */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 110;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 22px;
    cursor: pointer;
    padding: 8px 10px;
    line-height: 1;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
}

/* Sidebar overlay backdrop */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}
.sidebar-overlay.open {
    display: block;
}

@media (max-width: 768px) {
    /* ---- Sidebar: hamburger + overlay ---- */
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        z-index: 100;
        transition: left 0.25s ease;
        width: 260px;
    }
    .sidebar.open { left: 0; }
    .sidebar-toggle { display: flex; }

    /* ---- Layout: fix mobile viewport + scroll ---- */
    .chat-page,
    .workspace {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        min-height: 100dvh;
        overflow: visible;
    }

    .workspace-main {
        width: 100%;
        height: auto;
        min-height: 0;
        overflow-y: visible;
    }

    .workspace-content {
        padding: 12px;
        overflow-y: visible;
    }

    .workspace-header {
        padding: 12px 16px 12px 68px;
        position: sticky;
        top: 0;
        z-index: 10;
        background: var(--bg);
    }
    .workspace-header h1 { font-size: 18px; }

    /* ---- Chat: keep flex scroll but with dvh ---- */
    .chat-page {
        height: 100vh;
        height: 100dvh;
        overflow: hidden;
    }

    .chat-main {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-height: 0;
        width: 100%;
    }

    .chat-header {
        padding: 10px 12px 10px 68px;
        gap: 8px;
        flex-shrink: 0;
    }
    .chat-header h3 { font-size: 14px; }
    .chat-title-edit { width: 160px; font-size: 14px; }

    .chat-messages {
        padding: 12px;
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        min-height: 0;
    }

    .chat-input-area {
        padding: 10px 12px;
        flex-shrink: 0;
        background: var(--bg);
        z-index: 10;
    }

    .chat-input-container {
        padding: 6px 10px;
    }
    .chat-input-container textarea {
        font-size: 16px;
    }

    .message {
        max-width: 100%;
        gap: 8px;
    }
    .message-content { font-size: 15px; }
    .message-avatar { width: 28px; height: 28px; font-size: 11px; }

    .msg-actions { opacity: 1; }

    /* ---- File cards: stacked ---- */
    .file-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .file-card-meta {
        flex-wrap: wrap;
    }
    .file-card-actions {
        width: 100%;
    }
    .file-card-actions .btn {
        width: 100%;
    }

    /* ---- File card wrapper / feedback ---- */
    .file-feedback {
        flex-wrap: wrap;
    }
    .feedback-text-input {
        width: 100%;
        min-width: 0;
    }

    /* ---- Email preview card: stacked ---- */
    .email-preview-card {
        max-width: 100%;
    }
    .email-preview-actions {
        flex-direction: column;
    }
    .email-preview-actions .btn {
        width: 100%;
        min-height: 44px;
    }

    /* ---- Documents / Templates: single column ---- */
    .doc-grid {
        grid-template-columns: 1fr;
    }
    .doc-toolbar {
        flex-wrap: wrap;
    }
    .doc-search-input {
        width: 100%;
    }
    .doc-detail-toolbar {
        flex-wrap: wrap;
        gap: 6px;
    }
    .doc-tabs {
        flex-wrap: wrap;
    }
    .doc-detail-tabs {
        flex-wrap: wrap;
    }
    .doc-actions {
        flex-direction: column;
    }
    .doc-actions .btn {
        width: 100%;
        min-height: 44px;
    }
    .doc-editor-actions {
        flex-direction: column;
    }
    .doc-editor-actions .btn {
        width: 100%;
        min-height: 44px;
    }

    /* Template detail layout: single column */
    .tpl-detail-layout {
        grid-template-columns: 1fr;
    }

    /* Diff: single column */
    .diff-header,
    .diff-body {
        grid-template-columns: 1fr;
    }

    /* ---- Files page: list only, hide grid ---- */
    .files-table {
        font-size: 13px;
    }
    .files-table .file-icon-cell {
        display: none;
    }
    .file-preview-overlay {
        width: 100%;
        left: 0;
    }

    /* ---- Settings: stacked ---- */
    .settings-header h1 { font-size: 22px; }
    .settings-section { padding: 16px; }

    .account-field-row {
        flex-direction: column;
    }
    .account-field-row input {
        width: 100%;
    }

    .integration-grid {
        grid-template-columns: 1fr;
    }

    /* Purchase cards: stacked */
    .purchase-cards-grid {
        grid-template-columns: 1fr;
    }

    /* Brand kit: stacked */
    .brand-kit-colors {
        flex-direction: column;
        gap: 12px;
    }
    .brand-kit-fonts {
        flex-direction: column;
        gap: 12px;
    }
    .brand-kit-font-field {
        max-width: 100%;
    }

    /* Scheduled task form */
    .scheduled-task-header {
        flex-direction: column;
        align-items: flex-start;
    }

    /* ---- Admin / Team Admin: tables to card layout ---- */
    .admin-container { max-width: 100%; }
    .admin-header h1 { font-size: 22px; }
    .admin-section { padding: 12px; }

    .admin-tabs {
        flex-wrap: wrap;
    }
    .admin-tab {
        padding: 8px 12px;
        font-size: 13px;
    }

    .admin-filter-form {
        flex-direction: column;
    }
    .admin-filter-form input,
    .admin-filter-form select {
        width: 100%;
    }

    .admin-create-form .form-row {
        flex-direction: column;
    }
    .admin-create-form input,
    .admin-create-form select {
        width: 100%;
        min-width: 0;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .admin-table,
    .usage-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    .user-detail-grid {
        grid-template-columns: 1fr;
    }

    .user-actions-cell {
        flex-direction: column;
    }
    .user-actions-cell .btn {
        width: 100%;
        min-height: 44px;
    }

    /* ---- Modals: full-screen on mobile ---- */
    .modal-overlay {
        align-items: flex-end;
    }
    .modal-card {
        max-width: 100%;
        width: 100%;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        max-height: 90vh;
        overflow-y: auto;
    }
    .modal-wide {
        max-width: 100%;
    }
    .modal-body {
        max-height: 70vh;
    }

    /* Global search modal: full width */
    .global-search-modal.open {
        padding-top: 0;
        align-items: flex-start;
    }
    .global-search-content {
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    /* Shortcuts modal */
    .shortcuts-content {
        width: 100%;
        max-width: 100%;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }

    /* Employee chats modal */
    .emp-msg {
        max-width: 95%;
    }

    /* ---- Workflows ---- */
    .workflow-card-actions {
        flex-direction: column;
    }
    .workflow-card-actions .btn {
        width: 100%;
        min-height: 44px;
    }
    .workflow-step-options {
        flex-direction: column;
        align-items: flex-start;
    }
    .workflow-editor-actions {
        flex-direction: column;
    }
    .workflow-editor-actions .btn {
        width: 100%;
        min-height: 44px;
    }
    .workflow-progress-actions {
        flex-direction: column;
    }
    .workflow-progress-actions .btn {
        width: 100%;
        min-height: 44px;
    }

    /* ---- Onboarding ---- */
    .intro-cards {
        grid-template-columns: 1fr;
    }
    .grade-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* ---- Auth pages ---- */
    .auth-card {
        padding: 20px;
    }

    /* ---- Inline forms ---- */
    .inline-form {
        flex-direction: column;
    }
    .inline-form input,
    .inline-form select {
        width: 100%;
        min-width: 0;
    }

    /* ---- Touch targets: 44px minimum ---- */
    .btn {
        min-height: 44px;
        padding: 10px 16px;
    }
    .btn-sm {
        min-height: 36px;
        padding: 8px 12px;
    }
    .btn-icon {
        min-width: 44px;
        min-height: 44px;
        padding: 10px;
    }
    .sidebar-nav-item {
        min-height: 44px;
        padding: 10px 12px;
    }
    .sidebar-pin-item {
        min-height: 44px;
    }
    .conversation-item {
        min-height: 44px;
        padding: 10px 12px 10px 32px;
    }
    .taxonomy-item {
        min-height: 44px;
    }
    .grade-btn {
        min-height: 44px;
    }
    .doc-card {
        min-height: 44px;
    }
    .admin-tab {
        min-height: 44px;
    }
    .doc-tab {
        min-height: 44px;
    }
    .doc-detail-tab {
        min-height: 44px;
    }
    .slash-command-item {
        min-height: 44px;
    }
    .msg-action-btn {
        min-height: 36px;
        padding: 4px 10px;
    }

    /* ---- Prevent horizontal overflow ---- */
    html, body {
        overflow-x: hidden;
        max-width: 100vw;
    }

    /* ---- Chat header actions: collapse on small screens ---- */
    .chat-header-action {
        min-width: 36px;
        min-height: 36px;
        padding: 4px;
        font-size: 16px;
    }
    .chat-messages-remaining {
        font-size: 11px;
        white-space: nowrap;
    }

    /* ---- Settings tabs: scrollable ---- */
    .settings-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        gap: 0;
    }
    .settings-tabs .admin-tab {
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* ---- Notifications: full width ---- */
    .notification-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    /* ---- Text: 16px minimum for body text ---- */
    body {
        font-size: 16px;
    }
    input[type="text"],
    input[type="email"],
    input[type="password"],
    textarea,
    select {
        font-size: 16px;
    }
    .sidebar-search {
        font-size: 16px;
    }
    .text-muted {
        font-size: 14px;
    }

    /* ---- Footer ---- */
    .footer-links {
        flex-wrap: wrap;
        gap: 12px;
    }

    /* ---- Welcome suggestions ---- */
    .welcome-message {
        padding: 30px 12px;
    }
    .welcome-suggestions {
        flex-direction: column;
        align-items: center;
    }

    /* ---- Chat buy buttons ---- */
    .chat-buy-buttons {
        flex-direction: column;
        align-items: flex-start;
    }

    /* ---- Slash command dropdown ---- */
    .slash-command-dropdown {
        left: -10px;
        right: -10px;
    }

    /* ---- Learning banner ---- */
    .learning-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .learning-banner .btn {
        width: 100%;
    }
}

/* ---- Small phones (320px) ---- */
@media (max-width: 380px) {
    .workspace-header {
        padding: 10px 12px 10px 68px;
    }
    .chat-header {
        padding: 8px 10px 8px 68px;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .grade-grid {
        grid-template-columns: 1fr 1fr;
    }
    .settings-section {
        padding: 12px;
    }
    .auth-card {
        padding: 16px;
    }
    .onboarding-card {
        padding: 20px;
    }
    .question-nav {
        flex-direction: column;
    }
    .question-nav .btn {
        width: 100%;
    }
}

/* ============================================================
   Sessions 23-25: Admin & Team Admin Styles
   ============================================================ */

/* Admin tabs */
.admin-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 1px solid #333;
    padding-bottom: 0;
}
.admin-tab {
    background: none;
    border: none;
    color: #999;
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    font-size: 14px;
}
.admin-tab:hover { color: #e0e0e0; }
.admin-tab.active { color: #7c3aed; border-bottom-color: #7c3aed; }

/* Admin filter form */
.admin-filter-form {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.admin-filter-form input,
.admin-filter-form select {
    padding: 8px 12px;
    background: #1a1a2e;
    border: 1px solid #333;
    color: #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
}

/* Admin create form */
.admin-create-form .form-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
    align-items: center;
}
.admin-create-form input,
.admin-create-form select {
    padding: 8px 12px;
    background: #1a1a2e;
    border: 1px solid #333;
    color: #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    flex: 1;
    min-width: 120px;
}

/* User action buttons */
.user-actions-cell {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

/* Inline edit row */
.edit-row td {
    padding: 4px 8px;
}
.edit-row input,
.edit-row select {
    padding: 6px 8px;
    background: #1a1a2e;
    border: 1px solid #444;
    color: #e0e0e0;
    border-radius: 4px;
    font-size: 13px;
    width: 100%;
}

/* Pagination */
.admin-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
}
.pagination-info {
    color: #999;
    font-size: 14px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}
.badge-success { background: #065f46; color: #6ee7b7; }
.badge-warning { background: #78350f; color: #fbbf24; }
.badge-danger { background: #7f1d1d; color: #fca5a5; }
.badge-secondary { background: #333; color: #999; }

/* Btn variants */
.btn-success { background: #059669; color: #fff; }
.btn-success:hover { background: #047857; }
.btn-warning { background: #d97706; color: #fff; }
.btn-warning:hover { background: #b45309; }
.btn-secondary { background: #374151; color: #e0e0e0; border: 1px solid #555; }
.btn-secondary:hover { background: #4b5563; }

/* User detail modal */
.user-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}
.detail-section h4 {
    margin: 0 0 8px;
    color: #7c3aed;
}
.detail-section p {
    margin: 4px 0;
    font-size: 14px;
}

/* Taxonomy */
.taxonomy-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.taxonomy-toolbar input {
    padding: 8px 12px;
    background: #1a1a2e;
    border: 1px solid #333;
    color: #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    flex: 1;
    min-width: 200px;
}
.taxonomy-add-form {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    align-items: center;
}
.taxonomy-add-form input {
    padding: 8px 12px;
    background: #1a1a2e;
    border: 1px solid #333;
    color: #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    flex: 1;
    min-width: 100px;
}
.btn-upload {
    cursor: pointer;
}

/* System health stat variants */
.stat-success { border-color: #059669; }
.stat-danger { border-color: #dc2626; }

/* Org inline edit */
.org-name-edit {
    padding: 4px 8px;
    background: #1a1a2e;
    border: 1px solid #444;
    color: #e0e0e0;
    border-radius: 4px;
    font-size: 14px;
    width: 200px;
}

/* Modal styles (shared, if not already present) */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.modal-header h3 { margin: 0; }
.modal-close {
    background: none;
    border: none;
    color: #999;
    font-size: 24px;
    cursor: pointer;
}
.modal-close:hover { color: #e0e0e0; }
.modal-body { max-height: 70vh; overflow-y: auto; }

/* Text muted helper */
.text-muted { color: #999; font-size: 14px; }

/* ============================================================
   Site Footer (#77)
   ============================================================ */
.site-footer {
    margin-top: 60px;
    padding: 32px 0 24px;
    border-top: 1px solid var(--border);
    text-align: center;
}
.footer-inner { max-width: 760px; margin: 0 auto; }
.footer-brand { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.footer-links { display: flex; gap: 24px; justify-content: center; margin-bottom: 12px; }
.footer-links a { font-size: 13px; color: var(--text-muted); }
.footer-links a:hover { color: var(--text); text-decoration: none; }
.footer-copy { font-size: 12px; color: var(--text-muted); }

/* ============================================================
   Theme Toggle Button (Sidebar)
   ============================================================ */
.sidebar-theme-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font);
    font-size: 13px;
    color: var(--text-muted);
    padding: 6px 16px;
    width: 100%;
    text-align: left;
    transition: color 0.15s;
}
.sidebar-theme-toggle:hover { color: var(--text); background: var(--bg-secondary); }
#themeIcon { font-size: 16px; }

/* ============================================================
   Light Theme Overrides
   ============================================================ */
.theme-light,
.theme-light body {
    --bg: #ffffff;
    --bg-secondary: #f5f5f7;
    --bg-tertiary: #e8e8ed;
    --border: #d1d5db;
    --text: #1a1a2e;
    --text-muted: #6b7280;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #d97706;
}

/* Body / page background */
.theme-light body,
body.theme-light {
    background: var(--bg);
    color: var(--text);
}

/* Links */
.theme-light a { color: var(--primary); }
.theme-light a.btn-primary { color: #ffffff; }
.theme-light a.btn-primary:hover { color: #ffffff; }

/* Buttons */
.theme-light .btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text);
    border-color: var(--border);
}
.theme-light .btn-secondary:hover { background: var(--border); }
.theme-light .btn-icon { color: var(--text-muted); }
.theme-light .btn-icon:hover { color: var(--text); }

/* Forms */
.theme-light input[type="text"],
.theme-light input[type="email"],
.theme-light input[type="password"],
.theme-light input[type="number"],
.theme-light input[type="date"],
.theme-light textarea,
.theme-light select {
    background: #ffffff;
    border-color: var(--border);
    color: var(--text);
}
.theme-light input::placeholder,
.theme-light textarea::placeholder { color: #9ca3af; }
.theme-light input:focus,
.theme-light textarea:focus,
.theme-light select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79,70,229,0.15);
}

/* Sidebar */
.theme-light .sidebar {
    background: #f0f0f5;
    border-right-color: var(--border);
}
.theme-light .sidebar-brand {
    border-bottom-color: var(--border);
}
.theme-light .sidebar-brand-icon {
    background: var(--primary);
    color: #ffffff;
}
.theme-light .sidebar-brand-name { color: var(--text); }
.theme-light .sidebar-brand-user { color: var(--text-muted); }
.theme-light .sidebar-help { color: var(--text-muted); border-color: var(--border); }
.theme-light .sidebar-help:hover { color: var(--text); border-color: var(--text-muted); }
.theme-light .sidebar-nav-item { color: var(--text-muted); }
.theme-light .sidebar-nav-item:hover { background: var(--bg-tertiary); color: var(--text); }
.theme-light .sidebar-nav-item.active { background: var(--bg-tertiary); color: var(--text); }
.theme-light .sidebar-nav-item-sm { color: var(--text-muted); }
.theme-light .sidebar-nav-item-sm:hover { color: var(--text); }
.theme-light .sidebar-conversations {
    border-top-color: var(--border);
}
.theme-light .sidebar-search {
    background: #ffffff;
    border-color: var(--border);
    color: var(--text);
}
.theme-light .sidebar-new-chat {
    background: var(--bg-tertiary);
    color: var(--text);
    border-color: var(--border);
}
.theme-light .conversation-item { color: var(--text-muted); }
.theme-light .conversation-item:hover { background: var(--bg-tertiary); color: var(--text); }
.theme-light .conversation-item.active { background: var(--bg-tertiary); color: var(--text); }

/* Chat */
.theme-light .chat-main { background: var(--bg); }
.theme-light .chat-header {
    background: var(--bg);
    border-bottom-color: var(--border);
}
.theme-light .chat-header h3 { color: var(--text); }
.theme-light .chat-messages { background: var(--bg); }
.theme-light .message-user .message-content {
    background: #e8e8ed;
    color: var(--text);
}
.theme-light .message-assistant .message-content {
    background: #f5f5f7;
    color: var(--text);
    border-color: var(--border);
}
.theme-light .message-system .message-content {
    background: #f0f0f5;
    color: var(--text-muted);
}
.theme-light .message-avatar {
    background: var(--bg-tertiary);
    color: var(--text);
}
.theme-light .chat-input-area {
    background: var(--bg);
    border-top-color: var(--border);
}
.theme-light .chat-input-container {
    background: #ffffff;
    border-color: var(--border);
}
.theme-light .chat-input-container textarea {
    background: transparent;
    color: var(--text);
}
.theme-light .chat-title-edit {
    background: #ffffff;
    color: var(--text);
    border-color: var(--primary);
}

/* Welcome message */
.theme-light .welcome-message h2 { color: var(--text); }
.theme-light .welcome-message p { color: var(--text-muted); }
.theme-light .welcome-suggestion-btn {
    background: var(--bg-secondary);
    color: var(--text);
    border-color: var(--border);
}
.theme-light .welcome-suggestion-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary);
}

/* Typing indicator */
.theme-light .typing-indicator { color: var(--text-muted); }
.theme-light .typing-dot { background: var(--text-muted); }
.theme-light .typing-label { color: var(--text-muted); }

/* Code blocks */
.theme-light pre,
.theme-light code {
    background: #f0f0f5;
    color: #1a1a2e;
}
.theme-light .code-block-wrap {
    background: #f0f0f5;
    border-color: var(--border);
}
.theme-light .code-copy-btn {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border-color: var(--border);
}
.theme-light .code-copy-btn:hover { background: var(--border); color: var(--text); }

/* File cards */
.theme-light .file-card {
    background: var(--bg-secondary);
    border-color: var(--border);
}
.theme-light .file-card-icon {
    background: var(--primary);
    color: #ffffff;
}
.theme-light .file-card-name { color: var(--text); }
.theme-light .file-card-badge {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

/* Workspace */
.theme-light .workspace-main { background: var(--bg); }
.theme-light .workspace-header {
    border-bottom-color: var(--border);
}
.theme-light .workspace-header h1 { color: var(--text); }

/* Document cards */
.theme-light .doc-card {
    background: var(--bg-secondary);
    border-color: var(--border);
}
.theme-light .doc-card:hover {
    border-color: var(--primary);
    background: #ffffff;
}
.theme-light .doc-card-icon { color: var(--text); }
.theme-light .doc-card-title { color: var(--text); }
.theme-light .doc-card-meta { color: var(--text-muted); }

/* Document detail */
.theme-light .doc-detail-tab {
    background: var(--bg-secondary);
    color: var(--text-muted);
    border-color: var(--border);
}
.theme-light .doc-detail-tab.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}
.theme-light .doc-preview-panel {
    background: #ffffff;
    color: var(--text);
    border-color: var(--border);
}

/* Diff */
.theme-light .diff-removed { background: #fecaca; color: #7f1d1d; }
.theme-light .diff-added { background: #bbf7d0; color: #14532d; }
.theme-light .diff-col-header { background: var(--bg-secondary); color: var(--text); }

/* Template cards */
.theme-light .tpl-card { background: var(--bg-secondary); border-color: var(--border); }
.theme-light .tpl-card:hover { border-color: var(--primary); background: #ffffff; }
.theme-light .tpl-var-highlight {
    background: #ede9fe;
    color: #4f46e5;
}
.theme-light .tpl-var-panel { background: var(--bg-secondary); border-color: var(--border); }
.theme-light .tpl-var-item { border-bottom-color: var(--border); }
.theme-light .tpl-actions-panel { background: var(--bg-secondary); border-color: var(--border); }
.theme-light .tpl-meta-panel { background: var(--bg-secondary); border-color: var(--border); }

/* Tables */
.theme-light .admin-table th {
    background: var(--bg-secondary);
    color: var(--text);
    border-color: var(--border);
}
.theme-light .admin-table td {
    border-color: var(--border);
    color: var(--text);
}
.theme-light .admin-table tr:hover { background: var(--bg-secondary); }
.theme-light .usage-table th {
    background: var(--bg-secondary);
    color: var(--text);
    border-color: var(--border);
}
.theme-light .usage-table td {
    border-color: var(--border);
    color: var(--text);
}
.theme-light .files-table th { background: var(--bg-secondary); }
.theme-light .files-table td { border-color: var(--border); }

/* Modals */
.theme-light .modal-overlay {
    background: rgba(0,0,0,0.3);
}
.theme-light .modal-card {
    background: #ffffff;
    border-color: var(--border);
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.theme-light .modal-card h3 { color: var(--text); }

/* Badges */
.theme-light .badge {
    color: var(--text);
    background: var(--bg-tertiary);
}
.theme-light .badge-success { background: #dcfce7; color: #166534; }
.theme-light .badge-warning { background: #fef3c7; color: #92400e; }
.theme-light .badge-danger { background: #fecaca; color: #991b1b; }

/* Stat cards */
.theme-light .stat-card {
    background: var(--bg-secondary);
    border-color: var(--border);
}
.theme-light .stat-number { color: var(--text); }
.theme-light .stat-label { color: var(--text-muted); }

/* Settings sections */
.theme-light .settings-section {
    border-bottom-color: var(--border);
}
.theme-light .settings-section h2 { color: var(--text); }
.theme-light .doc-tab {
    background: var(--bg-secondary);
    color: var(--text-muted);
    border-color: var(--border);
}
.theme-light .doc-tab.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}
.theme-light .doc-editor {
    background: #ffffff;
    color: var(--text);
    border-color: var(--border);
}
.theme-light .integration-card {
    background: var(--bg-secondary);
    border-color: var(--border);
}
.theme-light .integration-card h3 { color: var(--text); }

/* Admin sections */
.theme-light .admin-section {
    border-bottom-color: var(--border);
}
.theme-light .admin-section h2 { color: var(--text); }
.theme-light .inline-form input,
.theme-light .inline-form select {
    background: #ffffff;
    border-color: var(--border);
    color: var(--text);
}

/* Account fields */
.theme-light .account-field label { color: var(--text-muted); }
.theme-light .account-field-row input {
    background: #ffffff;
    border-color: var(--border);
    color: var(--text);
}

/* Status messages */
.theme-light .status-message.success { color: #166534; }
.theme-light .status-message.error { color: #991b1b; }

/* Error messages */
.theme-light .msg-error { color: var(--danger); }
.theme-light .msg-retry-btn { background: var(--bg-tertiary); color: var(--text); border-color: var(--border); }
.theme-light .stream-recovery-bar { background: var(--bg-secondary); }

/* Message actions */
.theme-light .msg-actions { border-top-color: var(--border); }
.theme-light .msg-action-btn { color: var(--text-muted); }
.theme-light .msg-action-btn:hover { color: var(--text); }

/* Learning banner */
.theme-light .learning-banner {
    background: #ede9fe;
    border-color: #c4b5fd;
    color: var(--text);
}

/* File preview */
.theme-light .file-preview-panel {
    background: #ffffff;
    border-color: var(--border);
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}
.theme-light .file-preview-header { border-bottom-color: var(--border); }
.theme-light .file-preview-text {
    background: var(--bg-secondary);
    color: var(--text);
}

/* Sheet tables */
.theme-light .sheet-table th {
    background: var(--bg-secondary);
    color: var(--text);
    border-color: var(--border);
}
.theme-light .sheet-table td {
    border-color: var(--border);
    color: var(--text);
}

/* Slide cards */
.theme-light .slide-card {
    background: var(--bg-secondary);
    border-color: var(--border);
}
.theme-light .slide-title { color: var(--text); }
.theme-light .slide-notes {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

/* Scrollbar */
.theme-light ::-webkit-scrollbar-track { background: var(--bg-secondary); }
.theme-light ::-webkit-scrollbar-thumb { background: var(--border); }
.theme-light ::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* Tour overlay */
.theme-light .tour-overlay { background: rgba(0,0,0,0.3); }
.theme-light .tour-tooltip {
    background: #ffffff;
    border-color: var(--border);
    color: var(--text);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}
.theme-light .tour-tooltip h4 { color: var(--text); }
.theme-light .tour-tooltip p { color: var(--text-muted); }

/* EasyMDE editor override */
.theme-light .EasyMDEContainer .CodeMirror {
    background: #ffffff;
    color: var(--text);
    border-color: var(--border);
}
.theme-light .EasyMDEContainer .editor-toolbar {
    background: var(--bg-secondary);
    border-color: var(--border);
}
.theme-light .EasyMDEContainer .editor-toolbar button { color: var(--text-muted); }
.theme-light .EasyMDEContainer .editor-toolbar button:hover { background: var(--bg-tertiary); color: var(--text); }
.theme-light .EasyMDEContainer .editor-toolbar button.active { background: var(--bg-tertiary); color: var(--text); }

/* Landing page elements (when logged-in user returns) */
.theme-light .landing-nav-brand { color: var(--text); }
.theme-light .landing-nav-links a { color: var(--text-muted); }
.theme-light .landing-nav-links a:hover { color: var(--text); }
.theme-light .feature-card { background: var(--bg-secondary); border-color: var(--border); }
.theme-light .feature-card h3 { color: var(--text); }
.theme-light .mockup-container { background: var(--bg-secondary); border-color: var(--border); }
.theme-light .mockup-bar { background: var(--bg-tertiary); border-bottom-color: var(--border); }
.theme-light .mockup-sidebar { background: var(--bg-tertiary); border-right-color: var(--border); }
.theme-light .mockup-msg-bubble { background: var(--bg-tertiary); border-color: var(--border); color: var(--text-muted); }
.theme-light .mockup-file-card { background: var(--bg-tertiary); border-color: var(--border); }
.theme-light .smart-card { background: var(--bg-secondary); border-color: var(--border); }
.theme-light .smart-card h3 { color: var(--text); }
.theme-light .user-type { background: var(--bg-secondary); border-color: var(--border); }
.theme-light .user-type h3 { color: var(--text); }
.theme-light .usecase-tab { background: var(--bg-secondary); border-color: var(--border); color: var(--text-muted); }
.theme-light .usecase-tab.active { background: var(--primary); border-color: var(--primary); color: #ffffff; }
.theme-light .usecase-before { background: var(--bg-secondary); border-color: var(--border); }
.theme-light .usecase-after { background: var(--bg-secondary); border-color: var(--border); }
.theme-light .mock-prompt { background: var(--bg-tertiary); border-color: var(--border); color: var(--text); }
.theme-light .mock-result { background: var(--bg-tertiary); border-color: var(--border); }
.theme-light .price-card { background: var(--bg-secondary); border-color: var(--border); }
.theme-light .price-card.featured { border-color: var(--primary); }
.theme-light .price-card h3 { color: var(--text); }
.theme-light .faq-item { border-bottom-color: var(--border); }
.theme-light .faq-item summary { color: var(--text); }
.theme-light .faq-item summary::after { color: var(--text-muted); }
.theme-light .step-num { background: var(--primary); color: #ffffff; }
.theme-light .step h3 { color: var(--text); }

/* Legal pages */
.theme-light .legal h1, .theme-light .legal h2 { color: var(--text); }
.theme-light .legal p, .theme-light .legal li { color: var(--text-muted); }
.theme-light .legal th { background: var(--bg-secondary); color: var(--text); }
.theme-light .legal td { border-color: var(--border); color: var(--text-muted); }

/* Guide page */
.theme-light .guide h1, .theme-light .guide h2, .theme-light .guide h3 { color: var(--text); }
.theme-light .guide p, .theme-light .guide li { color: var(--text-muted); }
.theme-light .guide strong { color: var(--text); }
.theme-light .guide code { background: var(--bg-secondary); color: var(--text); }
.theme-light .guide-toc { background: var(--bg-secondary); border-color: var(--border); }
.theme-light .guide-tip { background: var(--bg-secondary); border-left-color: var(--primary); }

/* Site footer */
.theme-light .site-footer { border-top-color: var(--border); }
.theme-light .footer-brand { color: var(--text); }
.theme-light .footer-links a { color: var(--text-muted); }
.theme-light .footer-links a:hover { color: var(--text); }

/* Drag-over state */
.theme-light .dragover { background: rgba(79,70,229,0.05); }

/* Alert */
.theme-light .alert-success { background: #dcfce7; color: #166534; border-color: #bbf7d0; }

/* Spinner */
.theme-light .spinner { border-color: var(--border); border-top-color: var(--primary); }

/* Version history */
.theme-light .version-item { border-bottom-color: var(--border); }
.theme-light .version-item.current { background: var(--bg-secondary); }

/* Doc empty state */
.theme-light .doc-empty { color: var(--text-muted); }

/* Health status (admin) */
.theme-light .health-card { background: var(--bg-secondary); border-color: var(--border); }

/* Audit log (admin) */
.theme-light .audit-row { border-bottom-color: var(--border); }
.theme-light .audit-row:hover { background: var(--bg-secondary); }

/* Usage indicators (light theme) */
.theme-light .sidebar-usage { border-top-color: var(--border); }
.theme-light .sidebar-usage-bar { background: var(--bg-tertiary); }
.theme-light .usage-progress-bar { background: var(--bg-tertiary); }
.theme-light .usage-limit-msg { background: var(--bg-secondary); border-color: var(--border); }

/* ============================================================
 * Session 35 — Purchase Cards
 * ============================================================ */
.purchase-cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.purchase-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
}
.purchase-card-label {
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.purchase-card-count {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}
.purchase-card-price {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 4px;
}
.purchase-card-per {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}
.purchase-card .btn {
    width: 100%;
}

/* Chat inline buy buttons */
.chat-buy-buttons {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.chat-buy-buttons span {
    font-weight: 600;
    color: var(--text-muted);
}

/* ============================================================
 * Session 35 — Employee Chats Modal
 * ============================================================ */
.emp-chat-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.emp-chat-item {
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s;
}
.emp-chat-item:hover {
    background: var(--bg-tertiary);
}
.emp-chat-item-title {
    font-weight: 600;
    margin-bottom: 4px;
}
.emp-chat-item-meta {
    font-size: 13px;
    color: var(--text-muted);
}
.emp-transcript {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.emp-msg {
    padding: 10px 14px;
    border-radius: var(--radius);
    max-width: 85%;
}
.emp-msg-user {
    align-self: flex-end;
    background: var(--primary);
    color: #fff;
}
.emp-msg-assistant {
    align-self: flex-start;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
}
.emp-msg-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-size: 12px;
}
.emp-msg-time {
    color: var(--text-muted);
    font-size: 11px;
}
.emp-msg-user .emp-msg-time {
    color: rgba(255,255,255,0.7);
}
.emp-msg-content {
    font-size: 14px;
    line-height: 1.5;
}

/* Light theme overrides for Session 35 */
.theme-light .purchase-card { background: var(--bg-secondary); border-color: var(--border); }
.theme-light .emp-chat-item { background: var(--bg-secondary); border-color: var(--border); }
.theme-light .emp-chat-item:hover { background: var(--bg-tertiary); }
.theme-light .emp-msg-assistant { background: var(--bg-secondary); border-color: var(--border); }

/* ============================================================
   Session 36 — Email Preview Card
   ============================================================ */
.email-preview-card {
    margin-top: 12px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    max-width: 560px;
}
.email-preview-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    font-weight: 600;
    font-size: 15px;
}
.email-preview-icon {
    font-size: 18px;
}
.email-preview-fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}
.email-field label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 500;
}
.email-field-input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 14px;
    font-family: var(--font);
}
.email-field-input:focus,
.email-field-textarea:focus {
    outline: none;
    border-color: var(--primary);
}
.email-field-textarea {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 14px;
    font-family: var(--font);
    line-height: 1.5;
    resize: vertical;
}
.email-preview-actions {
    display: flex;
    gap: 8px;
}
.email-sent-confirmation {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    color: var(--success);
    font-weight: 500;
}
.email-sent-icon {
    font-size: 18px;
    font-weight: 700;
}
.email-preview-card.email-sent {
    border-color: var(--success);
    background: var(--bg-secondary);
}

/* Light theme overrides for Session 36 */
.theme-light .email-preview-card { background: var(--bg-secondary); border-color: var(--border); }
.theme-light .email-field-input,
.theme-light .email-field-textarea { background: var(--bg-tertiary); border-color: var(--border); color: var(--text); }

/* ============================================================
   Brand Kit (Session 37)
   ============================================================ */
.brand-kit-form {
    margin-top: 16px;
}
.brand-kit-logo-section {
    margin-bottom: 20px;
}
.brand-kit-logo-section label {
    display: block;
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.brand-kit-logo-preview {
    width: 160px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.brand-kit-logo-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.brand-kit-logo-placeholder {
    font-size: 12px;
    color: var(--text-muted);
}
.brand-kit-colors {
    display: flex;
    gap: 24px;
    margin-bottom: 16px;
}
.brand-kit-color-field label {
    display: block;
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.brand-kit-fonts {
    display: flex;
    gap: 24px;
    margin-bottom: 16px;
}
.brand-kit-font-field {
    flex: 1;
    max-width: 250px;
}
.brand-kit-font-field label {
    display: block;
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.brand-kit-font-field select {
    width: 100%;
}

/* ============================================================
   Output Feedback (Session 37)
   ============================================================ */
.file-card-wrapper {
    margin-top: 12px;
}
.file-card-wrapper .file-card {
    margin-top: 0;
}
.file-feedback {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    padding-left: 4px;
}
.feedback-btn {
    background: none;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    opacity: 0.5;
    transition: all 0.15s;
}
.feedback-btn:hover {
    opacity: 1;
    background: var(--bg-tertiary);
}
.feedback-btn.active {
    opacity: 1;
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}
.feedback-text-form {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 4px;
}
.feedback-text-input {
    width: 260px;
    padding: 6px 10px;
    font-size: 13px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font);
}

/* Light theme overrides for Session 37 */
.theme-light .brand-kit-logo-preview { background: #f5f5f5; border-color: #ddd; }
.theme-light .feedback-btn:hover { background: #f0f0f0; }
.theme-light .feedback-btn.active { background: rgba(99, 102, 241, 0.08); }
.theme-light .feedback-text-input { background: #f5f5f5; border-color: #ddd; color: #1a1a1a; }

/* ============================================================
   Session 39 — Global Search Modal
   ============================================================ */
.global-search-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
}
.global-search-modal.open {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 80px;
}
.global-search-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}
.global-search-content {
    position: relative;
    width: 560px;
    max-width: 90vw;
    max-height: 70vh;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.global-search-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}
.global-search-icon {
    font-size: 16px;
    opacity: 0.6;
}
.global-search-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 16px;
    font-family: var(--font);
}
.global-search-input::placeholder {
    color: var(--text-muted);
}
.global-search-kbd {
    font-size: 11px;
    padding: 2px 6px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    font-family: var(--font);
}
.global-search-results {
    overflow-y: auto;
    max-height: calc(70vh - 60px);
    padding: 8px;
}
.global-search-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}
.global-search-group {
    margin-bottom: 8px;
}
.global-search-group-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 6px 12px 4px;
}
.global-search-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    transition: background 0.1s;
}
.global-search-item:hover {
    background: var(--bg-secondary);
}
.global-search-item-icon {
    font-size: 16px;
    flex-shrink: 0;
}
.global-search-item-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
}
.global-search-item-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* ============================================================
   Session 39 — Keyboard Shortcuts Modal
   ============================================================ */
.shortcuts-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
}
.shortcuts-modal.open {
    display: flex;
    align-items: center;
    justify-content: center;
}
.shortcuts-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}
.shortcuts-content {
    position: relative;
    width: 400px;
    max-width: 90vw;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}
.shortcuts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.shortcuts-header h3 {
    margin: 0;
    font-size: 16px;
}
.shortcuts-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}
.shortcuts-close:hover {
    color: var(--text);
}
.shortcuts-list {
    padding: 12px 20px 20px;
}
.shortcut-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.shortcut-row:last-child {
    border-bottom: none;
}
.shortcut-desc {
    font-size: 14px;
    color: var(--text);
}
.shortcut-row kbd {
    font-size: 12px;
    padding: 3px 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    font-family: var(--font);
    white-space: nowrap;
}

/* ============================================================
   Session 39 — Sidebar Search Button
   ============================================================ */
.sidebar-search-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    opacity: 0.6;
    transition: opacity 0.15s;
}
.sidebar-search-btn:hover {
    opacity: 1;
}

/* ============================================================
   Session 39 — Sidebar Pinned Items
   ============================================================ */
.sidebar-pins {
    padding: 4px 12px 8px;
    border-bottom: 1px solid var(--border);
}
.sidebar-pins-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 4px 8px 4px;
}
.sidebar-pin-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    transition: background 0.1s;
}
.sidebar-pin-item:hover {
    background: var(--bg-tertiary);
}
.sidebar-pin-icon {
    font-size: 12px;
    flex-shrink: 0;
}
.sidebar-pin-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar-pin-remove {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
}
.sidebar-pin-item:hover .sidebar-pin-remove {
    display: block;
}
.sidebar-pin-remove:hover {
    color: var(--danger);
}

/* ============================================================
   Session 39 — Pin Icon Button (on cards)
   ============================================================ */
.pin-icon-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 2;
    padding: 2px 4px;
}
.doc-card {
    position: relative;
}
.doc-card:hover .pin-icon-btn {
    opacity: 0.5;
}
.pin-icon-btn:hover {
    opacity: 1 !important;
}
.pin-icon-btn-inline {
    position: static;
    opacity: 0.4;
}
.pin-icon-btn-inline:hover {
    opacity: 1;
}

/* ============================================================
   Session 39 — Slash Command Dropdown
   ============================================================ */
.slash-command-wrapper {
    flex: 1;
    position: relative;
}
.slash-command-wrapper textarea {
    width: 100%;
}
.slash-command-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    margin-bottom: 4px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    z-index: 100;
}
.slash-command-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.1s;
}
.slash-command-item:hover,
.slash-command-item.selected {
    background: var(--bg-secondary);
}
.slash-command-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--primary);
    min-width: 80px;
}
.slash-command-desc {
    font-size: 13px;
    color: var(--text-muted);
}

/* ============================================================
   Session 39 — Light Theme Overrides
   ============================================================ */
.theme-light .global-search-content {
    background: #ffffff;
    border-color: #e0e0e0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}
.theme-light .global-search-input { color: var(--text); }
.theme-light .global-search-item:hover { background: #f5f5f5; }
.theme-light .global-search-backdrop { background: rgba(0, 0, 0, 0.3); }
.theme-light .shortcuts-content {
    background: #ffffff;
    border-color: #e0e0e0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}
.theme-light .shortcuts-backdrop { background: rgba(0, 0, 0, 0.3); }
.theme-light .slash-command-dropdown {
    background: #ffffff;
    border-color: #e0e0e0;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.1);
}
.theme-light .slash-command-item:hover,
.theme-light .slash-command-item.selected { background: #f5f5f5; }
.theme-light .sidebar-pins { border-bottom-color: #e0e0e0; }
.theme-light .sidebar-pin-item:hover { background: #f5f5f5; }

/* ============================================================
   Session 40 — Morning Briefing + Scheduled Tasks
   ============================================================ */

/* Toggle switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 24px;
    transition: background 0.2s, border-color 0.2s;
}
.toggle-slider::before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: transform 0.2s, background 0.2s;
}
.toggle-switch input:checked + .toggle-slider {
    background: var(--primary);
    border-color: var(--primary);
}
.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
    background: #ffffff;
}

/* Scheduled task form */
.scheduled-task-form {
    margin: 16px 0;
    padding: 20px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.scheduled-task-form .form-group {
    margin-bottom: 12px;
}
.scheduled-task-form .form-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    color: var(--text-muted);
}
.scheduled-task-form .form-group input[type="text"] {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg-tertiary);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
}

/* Scheduled task cards */
.scheduled-tasks-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.scheduled-task-card {
    padding: 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.scheduled-task-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}
.scheduled-task-actions {
    display: flex;
    gap: 6px;
}
.scheduled-task-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 8px;
    font-size: 13px;
}

/* Light theme overrides */
.theme-light .toggle-slider { background: #e5e7eb; border-color: #d1d5db; }
.theme-light .toggle-slider::before { background: #9ca3af; }
.theme-light .scheduled-task-form { background: #f9fafb; border-color: #e0e0e0; }
.theme-light .scheduled-task-card { background: #f9fafb; border-color: #e0e0e0; }
.theme-light .scheduled-task-prompt { background: #ffffff !important; }

/* ============================================================
   Workflows — Page + Cards (Session 41)
   ============================================================ */
.workflow-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.workflow-card:hover {
    border-color: var(--primary);
}
.workflow-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
}
.workflow-card-icon {
    font-size: 24px;
    opacity: 0.7;
}
.workflow-card-info {
    flex: 1;
    min-width: 0;
}
.workflow-card-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
}
.workflow-card-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}
.workflow-card-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
}
.workflow-card-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.workflow-step-pill {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2px 10px;
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}
.workflow-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}
.workflow-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    margin-left: 6px;
    vertical-align: middle;
}
.workflow-badge.starter {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
}
.workflow-badge.shared {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

/* Workflow Editor */
.workflow-editor {
    max-width: 700px;
}
.workflow-step-editor {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 8px;
}
.workflow-step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.workflow-step-num {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
}
.workflow-step-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.workflow-step-fields input,
.workflow-step-fields textarea {
    width: 100%;
}
.workflow-step-options {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.workflow-step-options select {
    width: auto;
    min-width: 140px;
}
.form-check-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
}
.form-check-inline input[type="checkbox"] {
    width: auto;
    margin: 0;
}
/* Step tool selector (Session 54) */
.step-tools-section {
    margin-top: 8px;
}
.step-tools-label {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}
.step-tools-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
}
.step-tool-check {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}
.step-tool-check input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.workflow-editor-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

/* ============================================================
   Workflow Progress Card (in chat) (Session 41)
   ============================================================ */
.workflow-progress-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-top: 8px;
}
.workflow-progress-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
}
.workflow-progress-header.completed {
    color: var(--success);
}
.workflow-progress-header.paused {
    color: var(--warning);
}
.workflow-progress-icon {
    font-size: 16px;
}
.workflow-progress-title {
    flex: 1;
}
.workflow-progress-text {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 6px;
}
.workflow-progress-text strong {
    color: var(--text);
}
.workflow-progress-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

/* Workflow created card (Session 52) */
.workflow-created-card {
    background: var(--bg-secondary);
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-top: 8px;
}
.workflow-created-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    color: var(--success);
}
.workflow-created-icon { font-size: 16px; }
.workflow-created-name {
    font-size: 15px;
    font-weight: 600;
    margin-top: 8px;
    color: var(--text);
}
.workflow-created-meta {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}
.workflow-created-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}
.workflow-created-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* Light theme overrides — Workflows */
.theme-light .workflow-card { background: #f9fafb; border-color: #e0e0e0; }
.theme-light .workflow-card:hover { border-color: var(--primary); }
.theme-light .workflow-step-pill { background: #f3f4f6; border-color: #e0e0e0; }
.theme-light .workflow-step-editor { background: #f9fafb; border-color: #e0e0e0; }
.theme-light .workflow-progress-card { background: #f9fafb; border-color: #e0e0e0; }
.theme-light .workflow-created-card { background: #f9fafb; border-color: var(--primary); }
.theme-light .workflow-badge.starter { background: rgba(99, 102, 241, 0.1); }
.theme-light .workflow-badge.shared { background: rgba(34, 197, 94, 0.1); }

/* ============================================================
   Session 53: Tools Page
   ============================================================ */
.tools-section { margin-bottom: 32px; }
.tools-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.tools-section-header h2 { font-size: 18px; margin: 0; }
.tools-section-count {
    font-size: 13px;
    color: var(--text-muted);
}

/* Tool row list */
.tools-list { display: flex; flex-direction: column; gap: 6px; }
.tools-loading {
    color: var(--text-muted);
    font-size: 14px;
    padding: 20px 0;
}

/* Individual tool row */
.tool-row {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    transition: border-color 0.15s;
}
.tool-row:hover { border-color: var(--primary); }
.tool-row.tool-disabled { opacity: 0.5; }
.tool-row-info { flex: 1; min-width: 0; }
.tool-row-label {
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.tool-row-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tool-row-badge {
    font-size: 11px;
    padding: 1px 7px;
    border-radius: 4px;
    background: rgba(234, 179, 8, 0.15);
    color: #eab308;
    flex-shrink: 0;
}
.tool-row-badge.custom { background: rgba(34, 197, 94, 0.15); color: #22c55e; }

/* Tool toggle switch */
.tool-toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}
.tool-toggle input { opacity: 0; width: 0; height: 0; }
.tool-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg-tertiary, #555);
    border-radius: 22px;
    transition: background 0.2s;
}
.tool-toggle-slider:before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 2px;
    bottom: 2px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}
.tool-toggle input:checked + .tool-toggle-slider { background: var(--primary); }
.tool-toggle input:checked + .tool-toggle-slider:before { transform: translateX(18px); }

/* MCP connect panel (collapsible) */
.mcp-connect-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}
.mcp-connect-panel .form-group { margin-bottom: 14px; }
.mcp-connect-panel .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 5px;
}
.mcp-connect-row {
    display: flex;
    gap: 12px;
}
@media (max-width: 768px) {
    .mcp-connect-row { flex-direction: column; }
}
.mcp-connect-actions {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

/* MCP server list */
.mcp-servers-list { margin-top: 12px; }
.mcp-empty {
    color: var(--text-muted);
    font-size: 13px;
    padding: 16px 0;
}
.mcp-server-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 8px;
}
.mcp-server-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}
.mcp-server-info { min-width: 0; }
.mcp-server-name {
    font-weight: 600;
    font-size: 14px;
}
.mcp-server-url {
    font-size: 12px;
    color: var(--text-muted);
    font-family: monospace;
    word-break: break-all;
}
.mcp-server-error {
    font-size: 12px;
    color: var(--danger);
    margin-top: 4px;
}
.mcp-server-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.mcp-server-tools {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}
.mcp-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.mcp-dot-ok { background: #22c55e; }
.mcp-dot-err { background: #ef4444; }

/* Light theme overrides — Tools */
.theme-light .tool-row { background: #f9fafb; border-color: #e0e0e0; }
.theme-light .tool-row:hover { border-color: var(--primary); }
.theme-light .mcp-server-row { background: #f9fafb; border-color: #e0e0e0; }
.theme-light .mcp-connect-panel { background: #f9fafb; border-color: #e0e0e0; }
.theme-light .tools-form-panel { background: #f9fafb; border-color: #e0e0e0; }
.theme-light .api-tool-card { background: #f9fafb; border-color: #e0e0e0; }
.theme-light .action-builder { background: #f0f2f5; border-color: #e0e0e0; }
.theme-light .test-result-pre { background: #f0f2f5; }

@media (max-width: 768px) {
    .mcp-server-row { flex-direction: column; align-items: flex-start; }
    .mcp-server-right { width: 100%; justify-content: flex-end; margin-top: 8px; }
    .tool-row-desc { white-space: normal; }
    .tools-form-row { flex-direction: column; }
    .api-tool-header { flex-direction: column; align-items: flex-start; }
    .api-tool-controls { width: 100%; justify-content: flex-end; margin-top: 8px; }
    .api-action-row { flex-wrap: wrap; }
}

/* ============================================================
   Session 62: API Tool Types
   ============================================================ */

/* Subsection titles within tools sections */
.tools-subsection-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    margin: 0 0 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tool row with actions area (integrations) */
.tool-row-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Integration status badges */
.integration-status {
    font-size: 11px;
    padding: 1px 7px;
    border-radius: 4px;
    flex-shrink: 0;
}
.integration-connected { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.integration-available { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.integration-not-configured { background: rgba(234, 179, 8, 0.15); color: #eab308; }

/* Tools form panel (shared by MCP, API Manual, API Auto) */
.tools-form-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}
.tools-form-panel .form-group { margin-bottom: 14px; }
.tools-form-panel .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 5px;
}
.tools-form-row { display: flex; gap: 12px; }
.tools-form-actions { display: flex; gap: 8px; margin-top: 6px; }

/* API tool card (for API Manual / API Auto lists) */
.api-tool-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 8px;
    transition: border-color 0.15s;
}
.api-tool-card:hover { border-color: var(--primary); }

.api-tool-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.api-tool-info { flex: 1; min-width: 0; }
.api-tool-name { font-weight: 600; font-size: 15px; font-family: monospace; }
.api-tool-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}
.api-tool-url {
    font-size: 12px;
    color: var(--text-muted);
    font-family: monospace;
    word-break: break-all;
}
.api-tool-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.4;
}
.api-tool-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Tool type badges */
.tool-row-badge.api_manual { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.tool-row-badge.api_auto { background: rgba(168, 85, 247, 0.15); color: #a855f7; }
.tool-row-badge.mcp { background: rgba(234, 179, 8, 0.15); color: #eab308; }

/* API action rows within tool card */
.api-tool-actions {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}
.api-tool-actions-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.api-action-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 13px;
}
.api-action-method {
    font-size: 11px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 3px;
    font-family: monospace;
    flex-shrink: 0;
}
.api-method-get { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.api-method-post { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.api-method-put { background: rgba(234, 179, 8, 0.15); color: #eab308; }
.api-method-patch { background: rgba(168, 85, 247, 0.15); color: #a855f7; }
.api-method-delete { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.api-action-name { font-weight: 600; font-family: monospace; }
.api-action-path { color: var(--text-muted); font-family: monospace; flex: 1; }

/* Action builder (API Manual form) */
.action-builder {
    background: var(--bg-tertiary, rgba(255,255,255,0.05));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 10px;
}
.action-builder-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.action-builder-num {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

/* Parameter row */
.param-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}
.param-row .form-input { font-size: 13px; padding: 6px 8px; }
.param-required-label {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Test result */
.test-result-pre {
    background: var(--bg-tertiary, rgba(255,255,255,0.05));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    font-family: monospace;
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 300px;
    overflow-y: auto;
}
.test-result-ok { border-color: #22c55e; }
.test-result-error { border-color: #ef4444; }

/* ============================================================
   Session 50: Notifications
   ============================================================ */
.notif-badge {
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 10px;
    min-width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    line-height: 1;
    margin-left: auto;
}

/* ============================================================
   Session 50: Conversation Tags
   ============================================================ */
.conv-tag-dots { display: inline-flex; gap: 3px; margin-left: 6px; }
.conv-tag-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.tag-filter-bar { padding: 4px 8px; display: flex; gap: 4px; flex-wrap: wrap; }
.tag-filter-chip {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
}
.tag-filter-chip:hover, .tag-filter-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.tag-ctx-menu {
    position: fixed;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    padding: 4px 0;
    z-index: 300;
    min-width: 160px;
}
.tag-ctx-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text);
}
.tag-ctx-item:hover { background: var(--bg-tertiary); }
.tag-ctx-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.manage-tags-modal .modal-body { padding: 16px; }
.tag-editor-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.tag-editor-row input[type="text"] {
    flex: 1;
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
}
.tag-color-picker {
    display: flex;
    gap: 4px;
}
.tag-color-swatch {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.15s;
}
.tag-color-swatch.selected, .tag-color-swatch:hover { border-color: var(--text); }

/* Light theme — Tags */
.theme-light .tag-ctx-menu { background: #fff; border-color: #e0e0e0; }
.theme-light .tag-ctx-item:hover { background: #f3f4f6; }

/* ============================================================
   Session 50: File Folders
   ============================================================ */
.folder-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 0;
    font-size: 13px;
    color: var(--text-muted);
    flex-wrap: wrap;
}
.folder-breadcrumbs a { color: var(--primary); }
.folder-breadcrumbs .breadcrumb-sep { margin: 0 2px; color: var(--text-muted); }
.folder-row {
    cursor: pointer;
}
.folder-row td:first-child { font-size: 18px; }
.folder-row:hover { background: var(--bg-tertiary); }

/* ============================================================
   Session 50: Team Activity Log
   ============================================================ */
.activity-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    align-items: center;
}
.activity-filters select, .activity-filters input {
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
}

/* ============================================================
   Session 50: Shared Documents
   ============================================================ */
.shared-doc-upload-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    align-items: flex-end;
}
.shared-doc-upload-form .form-group { margin-bottom: 0; }
.shared-doc-upload-form input, .shared-doc-upload-form select {
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
}
.shared-doc-category-filter {
    margin-bottom: 12px;
}

/* ============================================================
   Session 50: Admin Analytics
   ============================================================ */
.analytics-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.analytics-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}
.analytics-card-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.analytics-card-value { font-size: 28px; font-weight: 700; }
.analytics-card-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.analytics-chart-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
}
.analytics-chart-title { font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.analytics-chart-svg { width: 100%; height: 200px; }
.analytics-bar-chart { display: flex; flex-direction: column; gap: 6px; }
.analytics-bar-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.analytics-bar-label { width: 120px; flex-shrink: 0; text-align: right; color: var(--text-muted); }
.analytics-bar-track { flex: 1; height: 20px; background: var(--bg-tertiary); border-radius: 4px; overflow: hidden; }
.analytics-bar-fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width 0.3s; }
.analytics-bar-value { width: 60px; font-size: 12px; color: var(--text-muted); }
.analytics-hbar-chart { display: flex; flex-direction: column; gap: 8px; }
.analytics-hbar-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.analytics-hbar-label { width: 100px; flex-shrink: 0; }
.analytics-hbar-track { flex: 1; height: 24px; background: var(--bg-tertiary); border-radius: 4px; overflow: hidden; }
.analytics-hbar-fill { height: 100%; border-radius: 4px; transition: width 0.3s; display: flex; align-items: center; padding-left: 8px; font-size: 11px; color: #fff; font-weight: 600; }
.analytics-hbar-value { width: 50px; text-align: right; color: var(--text-muted); }

/* Light theme — Analytics */
.theme-light .analytics-card { background: #f9fafb; border-color: #e0e0e0; }
.theme-light .analytics-chart-container { background: #f9fafb; border-color: #e0e0e0; }
.theme-light .analytics-bar-track, .theme-light .analytics-hbar-track { background: #e5e7eb; }

/* ============================================================
   Session 55: Model Badge
   ============================================================ */
.model-badge {
    display: inline-block;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border: 1px solid var(--border);
    margin-top: 6px;
    font-weight: 500;
    letter-spacing: 0.3px;
}
.model-badge-routed {
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary);
    border-color: rgba(99, 102, 241, 0.25);
}

/* Light theme — Model Badge */
.theme-light .model-badge { background: #f3f4f6; border-color: #e0e0e0; color: #6b7280; }
.theme-light .model-badge-routed { background: rgba(99, 102, 241, 0.08); color: #4f46e5; border-color: rgba(99, 102, 241, 0.2); }

/* ============================================================
   Session 57: Voice Input & Output
   ============================================================ */
.voice-mic-btn {
    font-size: 18px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}
.voice-mic-btn.voice-recording {
    background: var(--danger);
    color: #fff;
    animation: voice-pulse 1s infinite;
}
.voice-mic-btn.voice-processing {
    opacity: 0.5;
    pointer-events: none;
}
@keyframes voice-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

.voice-speak-btn { transition: all 0.15s; }
.voice-speak-btn.voice-playing {
    color: var(--primary);
    animation: voice-speak-pulse 0.8s infinite alternate;
}
@keyframes voice-speak-pulse {
    from { opacity: 0.5; }
    to { opacity: 1; }
}

/* Light theme — Voice */
.theme-light .voice-mic-btn.voice-recording { background: #dc2626; }

