.saved-chats-modal-body.loading {
  position: relative;
}
.saved-chats-modal-body .modal-inline-loading {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  z-index: 2;
}
/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Rebel-style palette (safe defaults; Firestore theme overrides at runtime) */
    --primary-color: #64748b;
    --primary-hover: #475569;
    --primary-foreground: #ffffff;
    --secondary-color: #334155;
    --secondary: #f1f5f9;
    --secondary-foreground: #0f172a;
    --accent-color: #A6FF00;
    --accent-hover: #93f000;
    --accent-foreground: #0f172a;
    --accent-2: #A8DDF2;
    --accent-2-foreground: #0f172a;
    --destructive-color: #ef4444;
    --destructive-hover: #dc2626;
    --destructive-foreground: #ffffff;
    --background: #ffffff;
    --surface: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --border-focus: #A6FF00;
    --ring: #A6FF00;
    --focus-ring: 0 0 0 3px rgba(166, 255, 0, 0.25);
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --border-radius: 12px;
    --border-radius-sm: 4px;
    --transition: all 0.15s ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 16px;
}

/* ===== AUTH LOADING OVERLAY (do not wipe DOM) ===== */
body.auth-loading {
    overflow: hidden;
}

body.auth-loading .container {
    visibility: hidden;
}

.auth-loading-container {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--background);
    z-index: 100000;
    padding: 24px;
}

.auth-loading-content {
    text-align: center;
    padding: 3rem;
    background: var(--surface, white);
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.1);
    max-width: 420px;
    width: 100%;
}

.auth-loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--border, #1f2937);
    border-top: 3px solid var(--accent-color, #A6FF00);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem;
}

.auth-loading-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary, #1a202c);
    margin-bottom: 0.5rem;
}

.auth-loading-description {
    color: var(--text-secondary, #64748b);
    margin-bottom: 0;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: 100vh;
}

/* Wider + less crowded header on the generator form + loading views */
body.form-shell:not(.chat-mode) .container {
    max-width: 1040px;
}

body.form-shell:not(.chat-mode) .header {
    flex-wrap: wrap;
    row-gap: 0.75rem;
}

/* Move user controls (logout/help/theme/etc) to a dedicated top row */
body.form-shell:not(.chat-mode) .user-info {
    order: -1;
    flex: 0 0 100%;
    margin-left: 0;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    display: flex;
    justify-content: flex-end;
}

body.form-shell:not(.chat-mode) .user-info .user-welcome {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    padding: 0.5rem 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Keep nav links aligned with the logo on form/loading views */
body.form-shell:not(.chat-mode) .header-actions {
    justify-content: flex-start;
}

/* Trial banner (Design partner trials) */
.trial-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
}

.trial-banner[data-severity="active"] {
    background: color-mix(in srgb, var(--accent-color, var(--primary-color)), transparent 92%);
    border-color: color-mix(in srgb, var(--accent-color, var(--primary-color)), transparent 55%);
}

.trial-banner[data-severity="ending"] {
    background: color-mix(in srgb, var(--warning), transparent 92%);
    border-color: color-mix(in srgb, var(--warning), transparent 55%);
}

.trial-banner[data-severity="expired"] {
    background: color-mix(in srgb, var(--error), transparent 93%);
    border-color: color-mix(in srgb, var(--error), transparent 60%);
}

.trial-banner__icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    color: var(--text-secondary);
}

.trial-banner[data-severity="expired"] .trial-banner__icon {
    color: var(--error);
}

.trial-banner[data-severity="ending"] .trial-banner__icon {
    color: var(--warning);
}

.trial-banner__lucide {
    display: block;
}

.trial-banner__text {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.trial-banner__strong {
    font-weight: 800;
}

.trial-banner__sep {
    margin: 0 8px;
    color: var(--text-secondary);
}

.trial-banner__hint {
    color: var(--text-secondary);
    font-weight: 600;
}

/* Wider layout when the chat UI is active */
body.chat-mode .container {
    max-width: 1400px;
    /* Use more of the viewport for chat on laptops/monitors */
    padding-top: 1rem;
    padding-bottom: 1rem;
}

/* Header Styles */
.header {
    /* Compact top bar (reclaims vertical space) */
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    text-align: left;
    margin-bottom: 1rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    min-width: 0;
}

.logo {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
}

.header-create-vc-btn {
    padding: 0.45rem 0.8rem;
}

.subtitle {
    display: none; /* Remove the tall tagline area */
}

.saved-chats-cta { display: flex; justify-content: center; margin: 1rem 0; }

/* Header actions: center and align Admin link + Chat CTA in one row */
.header-actions {
    display: flex;
    /* Center Team/Admin links so they won't sit under the fixed user box */
    flex: 1;
    min-width: 0; /* allow shrinking in narrow form layout */
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0;
}

/* Internal staff have extra header controls; on the narrow form page we give them a 2-row header. */
body.internal-staff:not(.chat-mode) .header {
    flex-wrap: wrap;
    row-gap: 0.5rem;
}
body.internal-staff:not(.chat-mode) .header-left {
    flex: 0 0 100%;
}
body.internal-staff:not(.chat-mode) .header-actions {
    justify-content: flex-start;
}

/* Let the saved-chats CTA fit inside header row without extra top/bottom margins */
.header-actions .saved-chats-cta {
    margin: 0;
    align-items: center;
}

/* Remove extra top margin applied in header to keep vertical alignment */
.header-actions .admin-link-container {
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem; /* space between Session Analysis/Admin link and Chat Page */
}

/* Form actions */
.form-actions { display: flex; gap: 0.75rem; align-items: center; justify-content: flex-end; margin-top: 1rem; }
.save-preset-btn, .my-presets-btn { background: transparent; color: var(--text-primary); border: 1px solid var(--border); padding: 0.5rem 0.75rem; border-radius: var(--border-radius-sm); font-size: 0.9rem; cursor: pointer; transition: var(--transition); }
.save-preset-btn:hover, .my-presets-btn:hover { background: var(--secondary, #f1f5f9); }
.save-preset-btn:focus, .my-presets-btn:focus { outline: none; border-color: var(--border-focus); box-shadow: var(--focus-ring, 0 0 0 3px rgba(166, 255, 0, 0.25)); }

/* Admin Link */
.admin-link-container {
    margin-top: 1rem;
}

/* top-actions removed; using existing containers */

.admin-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    color: var(--text-primary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border);
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    transition: var(--transition);
    box-shadow: none;
}

.admin-link:hover {
    background: var(--secondary, #f1f5f9);
}

/* Header Chat button styled consistently with primary actions */
/* Use existing .my-chats-btn style for Chat CTA and top Chat Page button */

/* Customer Selector */
.customer-selector-container {
    margin-top: 0;
    display: flex;
    align-items: center;
}

.customer-selector-container.internal-picker {
    /* Compact header control for internal staff only */
    margin-top: 0;
    flex: 0 1 auto;
}

.customer-selector {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    padding: 0.5rem 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.customer-selector-container.internal-picker .customer-selector {
    /* Make it feel like a compact header control (not a big banner card) */
    background: transparent;
    border: none;
    padding: 0;
    gap: 0.35rem;
    box-shadow: none;
}

.customer-selector-container.internal-picker .selector-label,
.customer-selector-container.internal-picker .selector-note {
    display: none;
}

.selector-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
}

.customer-select {
    background: var(--surface, white);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    min-width: 200px;
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1em 1em;
    padding-right: 2rem;
}

.customer-selector-container.internal-picker .customer-select {
    /* Keep it from becoming a huge banner in the top bar */
    min-width: 180px;
    width: clamp(180px, 22vw, 280px);
    max-width: 280px;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.customer-select:hover {
    border-color: var(--border-focus);
}

/* V2V voice model selector (compact, staff/admin only) */
.v2v-selector-container {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}
.v2v-select {
    font-size: 0.8rem;
    padding: 0.3rem 1.6rem 0.3rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    background: var(--surface);
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
    background-position: right 0.3rem center;
    background-repeat: no-repeat;
    background-size: 0.85em 0.85em;
    width: auto;
    min-width: 0;
    max-width: 100px;
}
.v2v-select:hover {
    border-color: var(--border-focus);
}

.customer-select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: var(--focus-ring, 0 0 0 3px rgba(166, 255, 0, 0.25));
}

.selector-note {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-style: italic;
    white-space: nowrap;
}

/* ----------------------------------------------------------------------
   Virtual Customers Library
   ---------------------------------------------------------------------- */
.vc-library-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.vc-library-header h1 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.vc-library-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.vc-library-actions .btn-secondary {
    text-decoration: none;
}

.vc-filters {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-tabs .tab {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    padding: 0.4rem 0.75rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
}

.filter-tabs .tab:hover {
    background: var(--secondary, #f1f5f9);
    color: var(--text-primary);
}

.filter-tabs .tab:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: var(--focus-ring, 0 0 0 3px rgba(166, 255, 0, 0.25));
}

.filter-tabs .tab.active {
    background: var(--accent-color);
    color: var(--accent-foreground);
    border-color: var(--accent-color);
}

.filter-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.vc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
}

.vc-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.vc-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.vc-card-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}

.vc-visibility-badge {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
}

.vc-visibility-badge.private {
    background: var(--surface);
    border-color: var(--destructive-color);
    color: var(--destructive-color);
}

.vc-visibility-badge.organization {
    background: var(--surface);
    border-color: var(--success);
    color: var(--success);
}

.vc-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.vc-context {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.vc-badge {
    font-size: 0.75rem;
    padding: 0.1rem 0.5rem;
    background: var(--secondary, #f1f5f9);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 999px;
}

.vc-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.vc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.vc-actions .btn-primary,
.vc-actions .btn-secondary,
.vc-actions .btn-danger {
    font-size: 0.85rem;
    padding: 0.4rem 0.75rem;
}

.empty-state,
.loading-state {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
}

/* User Info */
.user-info {
    /* Keep it inside the top bar so it never overlaps admin links */
    position: static;
    margin-left: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    padding: 0.5rem 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    font-size: 0.8rem;
    flex-shrink: 0; /* prevent box from shrinking and cutting off email */
}

.user-welcome {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-primary);
}

.user-welcome-text {
    white-space: nowrap;
}

.logout-btn {
    background: var(--destructive-color, #ef4444);
    color: var(--destructive-foreground, #ffffff);
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.7rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    margin-right: 2px;
}

.logout-btn:hover {
    background: var(--destructive-hover, var(--destructive-color, #dc2626));
    transform: translateY(-1px);
}

/* Header icon buttons (Help, Notifications, Theme, Settings) */
.header-icon-btn {
    margin-left: 4px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-weight: 700;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
}

.header-icon-btn svg {
    stroke: currentColor;
}

.header-icon-btn:hover {
    background: color-mix(in srgb, var(--surface), var(--text-primary) 6%);
    border-color: var(--border);
    color: var(--text-primary);
}

/* Notifications badge */
.notifications-badge {
    display: none;
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--destructive-color);
    color: var(--destructive-foreground, #ffffff);
    border-radius: 50%;
    padding: 2px 5px;
    font-size: 10px;
    line-height: 1;
    min-width: 14px;
    text-align: center;
}

/* Help button - small thin ring around "?" */
.header-help-btn {
    border: 1px solid var(--border);
    width: 22px;
    height: 22px;
}

/* Settings button - no ring, just the icon */
.header-audio-settings-btn {
    font-size: 16px;
    font-weight: 400;
    border: none;
}

/* Theme toggle button - icon only */
.header-theme-toggle-btn {
    font-size: 16px;
    font-weight: 400;
    border: none;
}

/* Form Styles */
.form-container {
    background: var(--surface);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
    border: 1px solid var(--border);
}

.form-section {
    margin-bottom: 2.5rem;
}

.form-section:last-of-type {
    margin-bottom: 2rem;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border);
}

.section-number {
    background: var(--accent-color, var(--primary-color));
    color: var(--accent-foreground, #0f172a);
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.form-group {
    margin-bottom: 1.5rem;
}

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

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    font-family: inherit;
    background: var(--surface);
    transition: var(--transition);
    color: var(--text-primary);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: var(--focus-ring, 0 0 0 3px rgba(166, 255, 0, 0.25));
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-select {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
    appearance: none;
}

/* Submit Button */
.submit-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--accent-color, var(--primary-color));
    color: var(--accent-foreground, #0f172a);
    border: none;
    padding: 1rem 2rem;
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.submit-btn:hover {
    background: var(--accent-hover, var(--primary-hover));
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.submit-btn:active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 1.125rem;
}

/* Submit Button Group with Dropdown */
.submit-btn-group {
    position: relative;
    display: flex;
    width: 100%;
}

.submit-btn-group .submit-btn {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    flex: 1;
}

.submit-btn-dropdown {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-color, var(--primary-color));
    color: var(--accent-foreground, #0f172a);
    border: none;
    border-left: 1px solid rgba(0,0,0,0.18);
    padding: 0 0.75rem;
    border-top-right-radius: var(--border-radius-sm);
    border-bottom-right-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.submit-btn-dropdown:hover {
    background: var(--accent-hover, var(--primary-hover));
}

.submit-btn-dropdown .dropdown-arrow {
    font-size: 0.875rem;
}

.submit-dropdown-menu {
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 4px;
    background: var(--surface, white);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-lg);
    min-width: 220px;
    z-index: 100;
    overflow: hidden;
}

.submit-dropdown-menu.hidden {
    display: none;
}

.submit-dropdown-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--surface, white);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
}

.submit-dropdown-item:hover {
    background: var(--background, #f0f4ff);
}

.submit-dropdown-item + .submit-dropdown-item {
    border-top: 1px solid var(--border);
}

.submit-dropdown-item .dropdown-icon {
    font-size: 1rem;
    margin-right: 0.5rem;
}

.submit-dropdown-item .dropdown-label {
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.submit-dropdown-item .dropdown-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Loading Styles */
.loading-container {
    background: var(--surface);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 3rem 2.5rem;
    text-align: center;
    border: 1px solid var(--border);
}

.loading-spinner {
    width: 3rem;
    height: 3rem;
    border: 3px solid var(--border);
    border-top: 3px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 2rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.loading-description {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

/* Global busy overlay - blocks UI during async operations */
.global-busy-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.2s ease;
}
.global-busy-overlay.hidden {
    display: none;
}
.global-busy-content {
    background: var(--surface, white);
    padding: 2rem 3rem;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    text-align: center;
    min-width: 200px;
}
.global-busy-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border, #e2e8f0);
    border-top-color: var(--accent-color, var(--primary-color, #2196F3));
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}
.global-busy-message {
    margin: 0;
    font-size: 15px;
    color: var(--text-primary, #374151);
    font-weight: 500;
}

.loading-steps {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 300px;
    margin: 0 auto;
}

.loading-step {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border-radius: var(--border-radius-sm);
    background: var(--background);
    transition: var(--transition);
}

.loading-step.active {
    background: var(--accent-color);
    color: var(--accent-foreground);
}

.step-number {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

.loading-step.active .step-number {
    background: rgba(3, 7, 18, 0.3);
}

.step-text {
    font-size: 0.875rem;
    font-weight: 500;
}

/* Chat Styles */
.chat-container {
    background: var(--surface);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    /* Use the reclaimed vertical space from the compact top bar */
    height: calc(100vh - 140px);
    min-height: 560px;
    display: flex;
    flex-direction: column;
}

.chat-header {
    /* Compact control bar (more vertical space for chat) */
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--conversation-chat-header-border-bottom, var(--border));
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--conversation-chat-header-background, var(--background));
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.chat-vc-switcher {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0; /* allow text truncation */
}

.chat-nav-toggle-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    width: 38px;
    height: 38px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 16px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.chat-nav-toggle-icon {
    width: 18px;
    height: 18px;
    display: block;
}

.chat-nav-toggle-btn:hover {
    background: var(--background);
}

.chat-vc-switcher-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.chat-active-vc-name {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--conversation-chat-header-vc-name-text, var(--text-primary));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 520px;
}

.chat-active-vc-subtitle {
    font-size: 0.8rem;
    color: var(--conversation-chat-header-vc-subtitle-text, var(--text-secondary));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 520px;
}

.chat-state-banner {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--conversation-chat-header-state-banner-background, #eff6ff);
    color: var(--conversation-chat-header-state-banner-text, #1e3a8a);
    font-size: 0.95rem;
}

.customer-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.customer-avatar {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary-foreground, #ffffff);
}

.customer-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.customer-role {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.new-conversation-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.new-conversation-btn:hover {
    background: var(--background);
    color: var(--text-primary);
}

/* LiveKit connection status indicator */
.livekit-status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  background: var(--conversation-livekit-status-indicator-background, #f8fafc);
  border: 1px solid var(--conversation-livekit-status-indicator-border, #e2e8f0);
  font-size: 12px;
  color: var(--conversation-livekit-status-indicator-text, #64748b);
  margin-left: 16px;
  flex-shrink: 0;
}
.livekit-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--conversation-livekit-status-dot-disconnected, #94a3b8);
}
.livekit-status-indicator.disconnected .livekit-status-dot { background: var(--conversation-livekit-status-dot-disconnected, #94a3b8); }
.livekit-status-indicator.connecting .livekit-status-dot { background: var(--conversation-livekit-status-dot-connecting, #f59e0b); }
.livekit-status-indicator.connected .livekit-status-dot { background: var(--conversation-livekit-status-dot-connected, #10b981); }
.livekit-status-indicator.error .livekit-status-dot { background: var(--conversation-livekit-status-dot-error, #ef4444); }

.chat-header-buttons { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.save-chat-btn { background: var(--accent-color, var(--primary-color)); color: var(--accent-foreground, #0f172a); border: 1px solid transparent; padding: 8px 14px; border-radius: var(--border-radius-sm); font-size: 0.875rem; font-weight: 600; cursor: pointer; transition: var(--transition); box-shadow: none; }
.save-chat-btn:hover { background: var(--accent-hover, var(--accent-color, var(--primary-hover))); }
.save-chat-btn:disabled { background: var(--border); color: var(--text-secondary); cursor: not-allowed; transform: none; box-shadow: none; }
.my-chats-btn { background: var(--primary-color); color: var(--primary-foreground, #ffffff); border: 1px solid var(--border); padding: 8px 14px; border-radius: var(--border-radius-sm); font-size: 0.875rem; font-weight: 600; cursor: pointer; transition: var(--transition); box-shadow: none; }
.my-chats-btn:hover { background: var(--primary-hover); }
.my-chats-btn:disabled { background: var(--border); color: var(--text-secondary); cursor: not-allowed; transform: none; box-shadow: none; }
.my-chats-btn:disabled:hover { transform: none; box-shadow: none; }

/* Accent primary action (Rebel-style) */
#chat-save-btn.my-chats-btn { background: var(--accent-color, var(--primary-color)); color: var(--accent-foreground, #0f172a); border-color: transparent; }
#chat-save-btn.my-chats-btn:hover { background: var(--accent-hover, var(--accent-color, var(--primary-hover))); }
#chat-save-btn.my-chats-btn:disabled { background: var(--border); color: var(--text-secondary); border-color: var(--border); cursor: not-allowed; }
#chat-save-btn.my-chats-btn:disabled:hover { background: var(--border); }

/* Header nav buttons: prefer outline/neutral treatment */
#header-nav-btn.my-chats-btn,
#tm-new-vc-btn.my-chats-btn,
#tm-conversations-btn.my-chats-btn {
    background: transparent;
    color: var(--text-primary);
    border-color: var(--border);
}
#header-nav-btn.my-chats-btn:hover,
#tm-new-vc-btn.my-chats-btn:hover,
#tm-conversations-btn.my-chats-btn:hover {
    background: color-mix(in srgb, var(--surface), var(--text-primary) 6%);
}
.chat-toggle-btn, .chat-help-btn { background: var(--surface); border: 1px solid var(--border); color: var(--text-secondary); padding: 8px 12px; border-radius: var(--border-radius-sm); font-size: 0.875rem; font-weight: 600; cursor: pointer; transition: var(--transition); font-family: inherit; }
.chat-toggle-btn:hover, .chat-help-btn:hover { background: var(--background); color: var(--text-primary); }
.chat-toggle-btn.active { background: color-mix(in srgb, var(--accent-color, var(--primary-color)), transparent 88%); border-color: color-mix(in srgb, var(--accent-color, var(--primary-color)), transparent 55%); color: var(--text-primary); }

/* Compact control buttons for mic/speaker */
.chat-control-btn {
  background: var(--conversation-controls-mic-toggle-default-background, #f1f5f9);
  border: 1px solid var(--conversation-controls-mic-toggle-default-border, #94a3b8);
  color: var(--conversation-controls-mic-toggle-default-icon, #475569);
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--border-radius-sm);
  font-size: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}
.chat-control-btn:hover {
  background: var(--conversation-controls-mic-toggle-hover-background, #e2e8f0);
  border-color: var(--conversation-controls-mic-toggle-hover-border, #94a3b8);
  color: var(--conversation-controls-mic-toggle-hover-icon, #475569);
}
.chat-control-btn.active {
  background: var(--conversation-controls-mic-toggle-active-background, #fef2f2);
  border-color: var(--conversation-controls-mic-toggle-active-border, #f87171);
  color: var(--conversation-controls-mic-toggle-active-icon, #dc2626);
}

/* Disabled state: keep controls visible but clearly inactive. */
.chat-control-btn:disabled {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text-secondary);
  opacity: 1;
  cursor: not-allowed;
}
.chat-control-btn:disabled:hover {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text-secondary);
}

/* Start conversation button - neutral background, green stroke icon */
.chat-control-btn.chat-control-start {
  background: var(--conversation-controls-mic-toggle-default-background, #f1f5f9);
  border-color: var(--conversation-controls-mic-toggle-default-border, #94a3b8);
  color: var(--accent-color, var(--primary-color));
}
.chat-control-btn.chat-control-start:hover {
  background: var(--conversation-controls-mic-toggle-hover-background, #e2e8f0);
  border-color: var(--conversation-controls-mic-toggle-hover-border, #94a3b8);
}
.chat-control-btn.chat-control-start svg {
  fill: var(--accent-color, var(--primary-color));
  stroke: var(--accent-color, var(--primary-color));
}
/* End call button - neutral background, red stroke icon */
.chat-control-btn.chat-control-end {
  background: var(--conversation-controls-mic-toggle-default-background, #f1f5f9);
  border-color: var(--conversation-controls-mic-toggle-default-border, #94a3b8);
  color: var(--destructive-color, #dc2626);
}
.chat-control-btn.chat-control-end:hover {
  background: var(--conversation-controls-mic-toggle-hover-background, #e2e8f0);
  border-color: var(--conversation-controls-mic-toggle-hover-border, #94a3b8);
}
.chat-control-btn.chat-control-end svg {
  fill: var(--conversation-hangup-color, #ef4444);
  stroke: var(--conversation-hangup-color, #ef4444);
}
/* Disabled phone button should use muted icon */
.chat-control-btn:disabled svg {
  fill: none;
  stroke: currentColor;
}

/* Speaker button: allow separate tokens from mic (same base component). */
#chat-speaker-btn.chat-control-btn {
  background: var(
    --conversation-controls-speaker-toggle-default-background,
    var(--conversation-controls-mic-toggle-default-background, #f1f5f9)
  );
  border-color: var(
    --conversation-controls-speaker-toggle-default-border,
    var(--conversation-controls-mic-toggle-default-border, #94a3b8)
  );
  color: var(
    --conversation-controls-speaker-toggle-default-icon,
    var(--conversation-controls-mic-toggle-default-icon, #475569)
  );
}
#chat-speaker-btn.chat-control-btn:hover {
  background: var(
    --conversation-controls-speaker-toggle-hover-background,
    var(--conversation-controls-mic-toggle-hover-background, #e2e8f0)
  );
  border-color: var(
    --conversation-controls-speaker-toggle-hover-border,
    var(--conversation-controls-mic-toggle-hover-border, #94a3b8)
  );
  color: var(
    --conversation-controls-speaker-toggle-hover-icon,
    var(--conversation-controls-mic-toggle-hover-icon, #475569)
  );
}
#chat-speaker-btn.chat-control-btn.active {
  background: var(
    --conversation-controls-speaker-toggle-active-background,
    var(--conversation-controls-mic-toggle-active-background, #fef2f2)
  );
  border-color: var(
    --conversation-controls-speaker-toggle-active-border,
    var(--conversation-controls-mic-toggle-active-border, #f87171)
  );
  color: var(
    --conversation-controls-speaker-toggle-active-icon,
    var(--conversation-controls-mic-toggle-active-icon, #dc2626)
  );
}

/* Disabled state (best-effort; tokens include opacity). */
#chat-mic-btn.chat-control-btn:disabled {
  /* Keep for back-compat; general :disabled handles background/border/icon. */
  opacity: var(--conversation-controls-mic-toggle-disabled-opacity, 0.75);
}
#chat-speaker-btn.chat-control-btn:disabled {
  /* Keep for back-compat; general :disabled handles background/border/icon. */
  opacity: var(--conversation-controls-speaker-toggle-disabled-opacity, 0.75);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: var(--conversation-layout-chat-area-background, var(--surface));
}

.message {
    display: flex;
    max-width: 70%;
    gap: 0.75rem;
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.message.bot .message-avatar {
    background: var(--conversation-chat-bubbles-vc-avatar-background, var(--primary-color));
    color: var(--conversation-chat-bubbles-vc-avatar-text, var(--primary-foreground, #ffffff));
}

.message.user .message-avatar {
    background: var(--conversation-chat-bubbles-user-avatar-background, var(--text-secondary));
    color: var(--conversation-chat-bubbles-user-avatar-text, var(--primary-foreground, #ffffff));
}

.message-content {
    background: var(--conversation-chat-bubbles-vc-bubble-background, var(--background));
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--conversation-chat-bubbles-vc-bubble-border, var(--border));
    color: var(--conversation-chat-bubbles-vc-bubble-text, var(--text-primary));
    line-height: 1.5;
}

.message.user .message-content {
    background: var(--conversation-chat-bubbles-user-bubble-background, var(--primary-color));
    border: 1px solid var(--conversation-chat-bubbles-user-bubble-border, transparent);
    color: var(--conversation-chat-bubbles-user-bubble-text, white);
}

.message-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    text-align: right;
}

.message.bot .message-time {
    text-align: left;
}

/* Chat Input */
.chat-input-container {
    padding: 1.5rem;
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
    border-top: 1px solid var(--conversation-chat-input-border-top, var(--border));
    background: var(--conversation-chat-input-container-background, var(--background));
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

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

.chat-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--conversation-chat-input-field-border, var(--border));
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    font-family: inherit;
    background: var(--conversation-chat-input-field-background, var(--surface));
    transition: var(--transition);
    color: var(--conversation-chat-input-field-text, var(--text-primary));
    resize: none;
    min-height: 2.75rem;
    max-height: 120px;
}

.chat-input:focus {
    outline: none;
    border-color: var(--conversation-chat-input-field-focus-border, var(--border-focus));
    box-shadow: var(--focus-ring, 0 0 0 3px rgba(166, 255, 0, 0.25));
}

.send-btn {
    background: var(--conversation-chat-input-send-button-background, var(--accent-color, var(--primary-color)));
    color: var(--conversation-chat-input-send-button-icon, var(--accent-foreground, #0f172a));
    border: none;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.send-btn:hover {
    background: var(--conversation-chat-input-send-button-hover-background, var(--accent-hover, var(--primary-hover)));
}

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

.send-icon {
    font-size: 1.125rem;
}

/* Company Size Fields */
.form-help-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-style: italic;
}

.company-size-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.size-field-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sub-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

/* Radio Button Groups */
.form-radio-group {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--background);
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border);
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    transition: var(--transition);
}

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

.radio-label input[type="radio"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.radio-text {
    -webkit-user-select: none;
    user-select: none;
}

/* Comment System Styles */
.comment-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    opacity: 1; /* Fully visible for testing */
    transition: opacity 0.2s ease;
}

.message:hover .comment-buttons {
    opacity: 1;
}

.comment-btn {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    padding: 0.4rem 0.7rem;
    font-size: 1.2rem; /* Bigger emoji symbols */
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    min-width: 2.5rem;
    justify-content: center;
}

.comment-btn:hover {
    background: var(--primary-color);
    color: var(--primary-foreground, #ffffff);
    border-color: var(--primary-color);
}

.behavior-btn:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: var(--accent-foreground);
}

.facts-btn:hover {
    background: var(--accent-2, var(--accent-color));
    border-color: var(--accent-2, var(--accent-color));
    color: var(--accent-2-foreground, var(--accent-foreground));
}

/* Comment Modal */
.comment-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
}

.comment-modal-content {
    background: var(--surface);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.comment-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.comment-modal-close {
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
    line-height: 1;
}

.comment-modal-close:hover {
    color: var(--text-primary);
}

.comment-modal-body {
    padding: 1.5rem;
}

.message-context {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--background);
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border);
}

.message-context p {
    margin: 0 0 0.5rem 0;
    font-weight: 500;
    color: var(--text-primary);
}

.context-message {
    color: var(--text-secondary);
    font-style: italic;
    line-height: 1.4;
}

.comment-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.comment-type-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.comment-label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.comment-type-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    border: 1px solid transparent;
}

.comment-type-badge.behavior {
    background: color-mix(in srgb, var(--accent-color), transparent 88%);
    border-color: color-mix(in srgb, var(--accent-color), transparent 55%);
    color: var(--text-primary);
}

.comment-type-badge.facts {
    background: color-mix(in srgb, var(--accent-2, var(--accent-color)), transparent 88%);
    border-color: color-mix(in srgb, var(--accent-2, var(--accent-color)), transparent 55%);
    color: var(--text-primary);
}

.rating-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.star-rating {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.star {
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    color: var(--border);
    -webkit-user-select: none;
    user-select: none;
    transform: scale(1);
}

.star:hover {
    color: var(--warning);
    transform: scale(1.1);
}

.star.selected {
    color: var(--warning);
    transform: scale(1.15);
    text-shadow: 0 0 8px color-mix(in srgb, var(--warning), transparent 60%);
}

.rating-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-style: italic;
    min-height: 1.25rem;
}

.comment-text-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.comment-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    font-family: inherit;
    font-size: 0.875rem;
    resize: vertical;
    background: var(--surface);
    color: var(--text-primary);
    transition: var(--transition);
}

.comment-textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: var(--focus-ring, 0 0 0 3px rgba(166, 255, 0, 0.25));
}

.comment-textarea::placeholder {
    color: var(--text-secondary);
}

.comment-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.btn {
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--primary-foreground, #ffffff);
}

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

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

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

.btn-secondary:hover {
    background: var(--surface);
    color: var(--text-primary);
}

/* Success Notification Animation */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.comment-success-notification {
    animation: slideInRight 0.3s ease-out;
}

/* Saved Chat Modals (+ VC quick view modal) */
.save-chat-modal, .saved-chats-modal, .vc-quickview-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 10000; padding: 1rem; }
.save-chat-modal-content, .saved-chats-modal-content, .vc-quickview-modal-content { background: var(--surface); border-radius: var(--border-radius); box-shadow: var(--shadow-lg); border: 1px solid var(--border); width: 100%; max-width: 640px; max-height: 90vh; overflow-y: auto; }
.save-chat-modal-header, .saved-chats-modal-header, .vc-quickview-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); }
.save-chat-modal-close, .saved-chats-modal-close, .vc-quickview-modal-close { font-size: 1.5rem; cursor: pointer; color: var(--text-secondary); transition: var(--transition); line-height: 1; }
.save-chat-modal-close:hover, .saved-chats-modal-close:hover, .vc-quickview-modal-close:hover { color: var(--text-primary); }
.save-chat-modal-body, .saved-chats-modal-body, .vc-quickview-modal-body { padding: 1.25rem 1.5rem; }
.vc-quickview-modal-footer { display: flex; gap: 0.75rem; justify-content: flex-end; padding: 1rem 1.5rem; border-top: 1px solid var(--border); flex-wrap: wrap; }
.vc-quickview-grid { display: grid; gap: 0.75rem; }
.vc-quickview-row { display: grid; grid-template-columns: 160px 1fr; gap: 0.75rem; align-items: start; padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.vc-quickview-row:last-child { border-bottom: none; }
.vc-quickview-key { font-weight: 800; color: var(--text-secondary); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.4px; }
.vc-quickview-value { color: var(--text-primary); font-size: 0.95rem; white-space: pre-wrap; }
.save-options { display: grid; gap: 0.75rem; margin-bottom: 1rem; }
.save-option { display: flex; gap: 0.75rem; align-items: flex-start; }
.chat-preview { margin-top: 1rem; background: var(--background); border: 1px solid var(--border); border-radius: var(--border-radius-sm); padding: 0.75rem; }
.save-chat-modal-footer { display: flex; gap: 0.75rem; justify-content: flex-end; padding: 1rem 1.5rem; border-top: 1px solid var(--border); }
.saved-chats-loading { display: flex; gap: 0.75rem; align-items: center; color: var(--text-secondary); }
.saved-chats-list { display: grid; gap: 0.75rem; }
.saved-chats-empty { text-align: center; color: var(--text-secondary); }
.saved-chat-item { border: 1px solid var(--border); border-radius: var(--border-radius-sm); padding: 0.75rem; background: var(--surface); box-shadow: var(--shadow-sm); }
.saved-chat-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.saved-chat-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.saved-chat-details { color: var(--text-secondary); font-size: 0.9rem; }
.saved-chat-meta { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.25rem; }
.saved-chat-preview { margin-top: 0.5rem; font-style: italic; color: var(--text-primary); }

/* Form Preset Action Buttons */
.btn-preset-apply {
    background: var(--accent-color);
    color: var(--accent-foreground);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.btn-preset-apply:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-preset-overwrite {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.btn-preset-overwrite:hover {
    background: var(--background);
    border-color: var(--accent-color);
    transform: translateY(-1px);
}

.btn-icon {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 0.5rem;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
}

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

.btn-icon-danger {
    color: var(--destructive-color);
    border-color: var(--destructive-color);
}

.btn-icon-danger:hover {
    background: var(--destructive-color);
    color: var(--destructive-foreground);
    border-color: var(--destructive-color);
}

/* VC delete confirmation */
.vc-delete-warning {
  color: var(--text-primary);
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: var(--border-radius-sm);
  padding: 0.75rem 0.875rem;
  line-height: 1.45;
}

/* Compact privacy icon button in header */
.privacy-toggle-icon-btn {
  min-width: 44px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.saved-chat-privacy-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Privacy Section Styles */
.saved-chat-privacy-section {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 1rem;
  margin: 0.75rem 0;
  background: var(--background);
  border-radius: 6px;
}

.saved-chat-privacy-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.saved-chat-privacy-state {
  margin-bottom: 0.75rem;
}

.saved-chat-privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.375rem 0.75rem;
  border-radius: var(--border-radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.saved-chat-privacy-badge.shared {
  background-color: #e8f5e9;
  color: #2e7d32;
}

.saved-chat-privacy-badge.private {
  background-color: #f3e5f5;
  color: #6a1b9a;
}

.saved-chat-privacy-toggle-btn {
  width: 100%;
  padding: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: var(--transition);
}

.saved-chat-privacy-toggle-btn:hover:not(:disabled) {
  background: var(--secondary, #f1f5f9);
}

.saved-chat-privacy-toggle-btn:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: var(--focus-ring, 0 0 0 3px rgba(166, 255, 0, 0.25));
}

.saved-chat-privacy-toggle-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

@media (max-width: 768px) {
  .saved-chat-privacy-section {
    padding: 0.75rem;
  }
  
  .saved-chat-privacy-toggle-btn {
    padding: 0.625rem;
    font-size: 0.85rem;
  }
}

/* Success notification reuse */
.success-notification { animation: slideInRight 0.3s ease-out; }

/* Conditional Display */
.form-group .form-input.hidden,
.form-group .form-select.hidden {
    display: none;
    margin-top: 0;
}

.form-group .form-input:not(.hidden),
.form-group .form-select:not(.hidden) {
    margin-top: 0.75rem;
}

.form-group .form-input:not(.hidden):first-of-type,
.form-group .form-select:not(.hidden):first-of-type {
    margin-top: 0;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-style: italic;
    margin: 0.5rem 0;
}

.typing-dots {
    display: flex;
    gap: 0.25rem;
}

.typing-dot {
    width: 0.375rem;
    height: 0.375rem;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .form-container,
    .loading-container {
        padding: 1.5rem;
    }
    
    .logo {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .section-title {
        font-size: 1.125rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .chat-container {
        height: 70vh;
    }
    
    .message {
        max-width: 85%;
    }
    
    .loading-steps {
        align-items: center;
    }
    
    .form-radio-group {
        flex-direction: column;
        gap: 1rem;
    }
    
    .company-size-fields {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .user-info {
        position: fixed;
        top: 0.5rem;
        right: 0.5rem;
        left: 0.5rem;
        text-align: center;
        font-size: 0.75rem;
    }
    
    .user-welcome {
        flex-direction: column;
        gap: 0.5rem;
    }

    /* Comment Modal Responsive */
    .comment-modal {
        padding: 0.5rem;
    }
    
    .comment-modal-content {
        max-height: 95vh;
    }
    
    .comment-modal-header,
    .comment-modal-body {
        padding: 1rem;
    }
    
    .comment-actions {
        flex-direction: column;
    }
    
    .star-rating {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .customer-info {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .chat-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .new-conversation-btn {
        align-self: stretch;
    }

    .comment-buttons {
        justify-content: center;
        opacity: 1; /* Always show on mobile */
    }
}

/* Session Analysis Dashboard Styles */
.session-analysis-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.analysis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border);
}

.analysis-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.filters-section {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 25px;
    padding: 20px;
    background: var(--background);
    border-radius: var(--border-radius);
    flex-wrap: wrap;
    border: 1px solid var(--border);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-group label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 14px;
}

.filter-group input,
.filter-group select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    background: var(--surface);
    color: var(--text-primary);
}

.sessions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.sessions-list {
    background: var(--surface);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border: 1px solid var(--border);
}

.sessions-list h3 {
    background: var(--primary-color);
    color: var(--primary-foreground, #ffffff);
    margin: 0;
    padding: 20px;
    font-size: 18px;
    font-weight: 600;
}

.session-item {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

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

.session-item.selected {
    background: var(--secondary, #f1f5f9);
    border-left: 4px solid var(--accent-color, var(--primary-color));
}

.session-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 10px;
}

.session-id {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
    font-family: 'Courier New', monospace;
}

.session-rating {
    background: var(--success);
    color: var(--primary-foreground, #ffffff);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.session-rating.low {
    background: var(--error);
}

.session-rating.medium {
    background: var(--warning);
}

.session-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.session-stats {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text-secondary);
}

.stat-icon {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: var(--primary-foreground, #ffffff);
    font-weight: bold;
}

.behavior-icon {
    background: var(--accent-color);
    color: var(--accent-foreground);
}

.facts-icon {
    background: var(--accent-2, var(--accent-color));
    color: var(--accent-2-foreground, var(--accent-foreground));
}

.session-details {
    background: var(--surface);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border: 1px solid var(--border);
}

.details-header {
    background: var(--primary-color);
    color: var(--primary-foreground, #ffffff);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.details-title {
    font-size: 18px;
    font-weight: 600;
}

.details-summary {
    display: flex;
    gap: 20px;
    font-size: 14px;
}

.details-content {
    padding: 20px;
    max-height: 600px;
    overflow-y: auto;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state h4 {
    margin-bottom: 10px;
    color: var(--text-secondary);
}

.message-block {
    margin-bottom: 25px;
    padding: 20px;
    background: var(--background);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
}

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

.message-id {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: var(--text-secondary);
    background: #e9ecef;
    padding: 4px 8px;
    border-radius: 4px;
}

.message-stats {
    display: flex;
    gap: 10px;
    font-size: 12px;
}

.comment-item {
    background: var(--surface);
    padding: 15px;
    margin-bottom: 10px;
    border-radius: var(--border-radius-sm);
    border-left: 3px solid var(--error);
    box-shadow: var(--shadow-sm);
}

.comment-item.behavior {
    border-left-color: var(--accent-color);
}

.comment-item.facts_accuracy {
    border-left-color: var(--accent-2, var(--accent-color));
}

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

.comment-type {
    background: var(--error);
    color: var(--destructive-foreground, #ffffff);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
}

.comment-type.behavior {
    background: var(--accent-color);
    color: var(--accent-foreground);
}

.comment-type.facts_accuracy {
    background: var(--accent-2, var(--accent-color));
    color: var(--accent-2-foreground, var(--accent-foreground));
}

.comment-rating {
    display: flex;
    gap: 2px;
}

.star {
    color: var(--warning);
}

.comment-text {
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 8px;
}

.comment-meta {
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.error-message {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--destructive-color, var(--error));
    padding: 15px;
    border-radius: var(--border-radius-sm);
    margin: 20px 0;
}

.btn-danger {
    background: var(--destructive-color, var(--error));
    color: var(--destructive-foreground, #ffffff);
    border: 1px solid var(--destructive-color, var(--error));
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.btn-danger:hover {
    background: var(--destructive-hover, #dc2626);
    border-color: var(--destructive-hover, #dc2626);
    transform: translateY(-1px);
}

@media (max-width: 1200px) {
    .sessions-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .filters-section {
        flex-direction: column;
        align-items: stretch;
    }
    
    .analysis-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .analysis-header > div {
        justify-content: center;
    }
}

/* === Virtual Customer Cards UI === */
.customers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.customer-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    transition: var(--transition);
    position: relative;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.customer-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.customer-card.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 1px var(--primary-color);
}

.customer-status {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.customer-status.active {
    border-color: var(--success);
    color: var(--success);
}

.customer-status.inactive {
    /* default styling is already inactive/neutral */
}

.customer-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    padding-right: 5rem;
}

.customer-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    line-height: 1.5;
    flex-grow: 1; /* Allows description to take up space */
}

.customer-chatflow {
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    word-break: break-all;
}

/* === Modal (for Customer Admin) === */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1000; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
    padding-top: 60px;
}

.modal-content {
    background-color: var(--surface, #fefefe);
    margin: 5% auto;
    padding: 2rem;
    border: 1px solid var(--border, #888);
    width: 80%;
    max-width: 500px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
}

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

.close {
    color: var(--text-secondary, #aaa);
    float: right;
    font-size: 28px;
    font-weight: bold;
    line-height: 1;
}

.close:hover,
.close:focus {
    color: var(--text-primary, black);
    text-decoration: none;
    cursor: pointer;
}

/* Ensure customer admin page is centered */
body > .admin-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
} 

/* Small actions row above generator form */
.form-top-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 12px;
}
/* ===== CONTEXT DISPLAY PANEL ===== */

/* Main Chat Wrapper for Layout */
.chat-main-wrapper {
  display: flex;
  gap: 0;
  height: 100%;
  transition: gap 0.3s ease-in-out;
}

.chat-navigator {
  width: 340px;
  background: var(--conversation-layout-left-column-background, white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Desktop: allow collapsing the navigator for more chat space */
body.chat-nav-collapsed .chat-navigator {
  width: 0;
  border-right: none;
}
body.chat-nav-collapsed .chat-navigator > * {
  display: none;
}

.chat-navigator-overlay {
  display: none;
}

.chat-browse-btn {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 8px 12px;
  border-radius: var(--border-radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.chat-browse-btn:hover {
  background: var(--background);
  color: var(--text-primary);
}

/* Toggle button in header - visible only when panel is collapsed */
.chat-nav-float-toggle {
  display: none;
  width: 32px;
  height: 32px;
  padding: 5px;
  background: var(--conversation-chat-header-nav-toggle-button-background, transparent);
  border: 1px solid var(--conversation-chat-header-nav-toggle-button-border, var(--border));
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  color: var(--conversation-chat-header-nav-toggle-button-icon, var(--text-secondary));
  transition: var(--transition);
  flex-shrink: 0;
  margin-right: 8px;
}
.chat-nav-float-toggle:hover {
  background: var(--conversation-chat-header-nav-toggle-button-hover-background, var(--background));
  color: var(--conversation-chat-header-nav-toggle-button-icon, var(--text-primary));
}
.chat-nav-float-toggle svg {
  width: 100%;
  height: 100%;
}
body.chat-nav-collapsed .chat-nav-float-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-nav-header {
  padding: 14px 14px;
  border-bottom: 1px solid var(--conversation-left-column-header-border-bottom, var(--border));
  background: var(--conversation-left-column-header-background, var(--background));
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Toggle button inside the panel header */
.chat-nav-panel-toggle {
  width: 28px;
  height: 28px;
  padding: 4px;
  background: transparent;
  border: none;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
  flex-shrink: 0;
}
.chat-nav-panel-toggle:hover {
  background: var(--border);
  color: var(--text-primary);
}
.chat-nav-panel-toggle svg {
  width: 100%;
  height: 100%;
}

.chat-nav-title {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  color: var(--text-primary);
}

.chat-nav-section {
  padding: 12px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  /* Critical: allow sections to share available height so long VC lists
     don't push the Chats section below the fold (tablet/mobile drawer). */
  flex: 1 1 0;
  min-height: 0;
}

/* In the Chats section, reduce chrome a bit to fit more rows (keep <=30% height) */
#chat-nav-chats-section.chat-nav-section {
  gap: 8px;
}

#chat-nav-chats-section #vc-start-new-chat-btn {
  padding: 8px 10px;
  font-size: 12px;
}

#chat-nav-chats-section #vc-show-all-chats-btn {
  padding: 8px 10px;
  font-size: 12px;
}

#chat-nav-chats-section #vc-chats-list .chat-nav-item {
  padding: 8px 10px;
}

#chat-nav-chats-section #vc-chats-list .chat-nav-item-title {
  font-size: 13px;
}

#chat-nav-chats-section #vc-chats-list .chat-nav-item-meta {
  font-size: 11px;
}

/* Ensure the HTML `hidden` attribute reliably hides sections (even though
   `.chat-nav-section` sets `display: flex` in author CSS). */
.chat-nav-section[hidden] {
  display: none !important;
}

/* “My Chats” view: show only the all-chats section in the left column */
body.chat-nav-view-all-chats #chat-nav-vcs-section,
body.chat-nav-view-all-chats #chat-nav-chats-section {
  display: none !important;
}

.chat-nav-footer {
  flex-shrink: 0;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--background);
}

.chat-nav-footer-link {
  width: 100%;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 8px 10px;
  border-radius: var(--border-radius-sm);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.chat-nav-footer-link:hover {
  background: var(--surface);
  color: var(--text-primary);
}

.chat-nav-filters {
  display: flex;
  gap: 8px;
}

.chat-nav-filter-btn {
  flex: 1;
  background: var(--conversation-left-column-filter-button-background, var(--surface));
  border: 1px solid var(--conversation-left-column-filter-button-border, var(--border));
  color: var(--conversation-left-column-filter-button-text, var(--text-secondary));
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.chat-nav-filter-btn:hover {
  background: var(--secondary, #f1f5f9);
  color: var(--text-primary);
}

.chat-nav-filter-btn.active {
  background: var(--conversation-left-column-filter-button-active-background, rgba(166, 255, 0, 0.10));
  border-color: var(--conversation-left-column-filter-button-active-border, rgba(166, 255, 0, 0.45));
  color: var(--conversation-left-column-filter-button-active-text, var(--text-primary));
}

.chat-nav-filter-btn:focus {
  outline: none;
  box-shadow: var(
    --conversation-left-column-filter-button-focus-ring,
    var(--focus-ring, 0 0 0 3px rgba(166, 255, 0, 0.25))
  );
}

/* iPad/tablet split view: set VC vs Chats height ratio explicitly.
   (Note: :first-of-type doesn't work here because the navigator header is also a <div>.) */
#chat-nav-vcs-section {
  /* VC list is primary; aim ~70–75% height */
  flex: 2.5 1 0;
}

#chat-nav-chats-section {
  /* Chats list is secondary; aim ~25–30% height */
  flex: 1 1 0;
}

.chat-nav-section:last-child {
  border-bottom: none;
}

.chat-nav-section-title {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--conversation-left-column-section-title-text, var(--text-secondary));
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.chat-nav-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chat-nav-back-btn {
  display: none; /* enabled in phone drill-in view */
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 10px;
  border-radius: var(--border-radius-sm);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.chat-nav-back-btn:hover {
  background: var(--background);
  color: var(--text-primary);
}

/* Show Back button in drill-in chats view and in “My Chats” view */
body.chat-nav-view-chats #chat-nav-back-btn,
body.chat-nav-view-all-chats #chat-nav-all-chats-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chat-nav-search {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--border-radius-sm);
  font-size: 14px;
  outline: none;
  background: var(--surface);
  color: var(--text-primary);
}

.chat-nav-search::placeholder {
  color: var(--text-secondary);
  opacity: 1;
}

.chat-nav-search:focus {
  border-color: var(--border-focus);
  box-shadow: var(--focus-ring, 0 0 0 3px rgba(166, 255, 0, 0.25));
}

.chat-nav-hint {
  font-size: 12px;
  color: var(--text-secondary);
}

.chat-nav-primary-btn {
  background: var(--primary-color);
  color: var(--primary-foreground, #ffffff);
  border: none;
  padding: 10px 12px;
  border-radius: var(--border-radius-sm);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition);
}

.chat-nav-primary-btn:hover {
  background: var(--primary-hover);
}

.chat-nav-primary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Button row for Start chat + Settings */
.chat-nav-button-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.chat-nav-button-row .chat-nav-primary-btn {
  flex: 1;
}

.chat-nav-save-btn {
  background: color-mix(in srgb, var(--accent-color, var(--primary-color)), transparent 88%);
  border: 1px solid color-mix(in srgb, var(--accent-color, var(--primary-color)), transparent 55%);
  padding: 8px 12px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  font-size: 16px;
  transition: var(--transition);
}

.chat-nav-save-btn:hover {
  background: color-mix(in srgb, var(--accent-color, var(--primary-color)), transparent 82%);
}

.chat-nav-save-btn:disabled {
  background: var(--surface);
  border-color: var(--border);
  cursor: not-allowed;
  opacity: 0.6;
}

.chat-nav-settings-btn {
  background: color-mix(in srgb, var(--surface), var(--text-primary) 6%);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  font-size: 16px;
  transition: var(--transition);
}

.chat-nav-settings-btn:hover {
  background: color-mix(in srgb, var(--surface), var(--text-primary) 10%);
}

/* Audio Settings Modal (pre-chat) */
.audio-settings-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.audio-settings-modal {
  background: var(--surface);
  border-radius: var(--border-radius);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  max-width: 400px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

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

.audio-settings-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.audio-settings-close {
  background: transparent;
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  font-size: 13px;
}

.audio-settings-close:hover {
  background: color-mix(in srgb, var(--surface), var(--text-primary) 6%);
}

.audio-settings-body {
  padding: 20px;
}

.audio-setting-group {
  margin-bottom: 20px;
}

.audio-setting-group label {
  display: block;
  margin-bottom: 4px;
}

.audio-setting-desc {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.audio-setting-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--border-radius-sm);
  font-size: 14px;
  background: var(--surface);
  color: var(--text-primary);
}

.audio-setting-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}

.audio-setting-checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--accent-color);
  cursor: pointer;
}

.audio-setting-checkbox-label small {
  color: var(--text-secondary);
}

.audio-settings-actions {
  margin-top: 24px;
}

.audio-settings-save-btn {
  width: 100%;
  background: var(--accent-color, var(--primary-color));
  color: var(--accent-foreground, #0f172a);
  border: none;
  padding: 12px 16px;
  border-radius: var(--border-radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.audio-settings-save-btn:hover {
  background: var(--accent-hover, var(--primary-hover));
}

.audio-settings-status {
  margin-top: 12px;
  padding: 8px 12px;
  border-radius: var(--border-radius-sm);
  font-size: 13px;
  text-align: center;
}

.chat-nav-secondary-btn {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: var(--border-radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.chat-nav-secondary-btn:hover {
  background: var(--background);
  color: var(--text-primary);
}

.chat-nav-secondary-btn.hidden {
  display: none !important;
}

.chat-nav-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* Make the list the scrollable region within each section */
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-right: 2px;
}

.chat-nav-item {
  padding: 10px 12px;
  border: 1px solid var(--conversation-left-column-vc-item-border, var(--border));
  border-radius: var(--border-radius-sm);
  background: var(--conversation-left-column-vc-item-background, #f8fafc);
  cursor: pointer;
  transition: var(--transition);
}

.chat-nav-item:focus {
  outline: none;
  box-shadow: var(--focus-ring, 0 0 0 3px rgba(166, 255, 0, 0.25));
}

.chat-nav-item-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.chat-nav-item-text {
  min-width: 0;
}

.chat-nav-item-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.chat-nav-delete-btn {
  background: var(--conversation-left-column-icon-button-danger-background, #fff1f2);
  border-color: var(--conversation-left-column-icon-button-danger-border, #fecdd3);
  color: var(--conversation-left-column-icon-button-danger-icon, #dc2626);
}

.chat-nav-delete-btn:hover {
  background: var(--conversation-left-column-icon-button-danger-hover-background, #ffe4e6);
  border-color: var(--conversation-left-column-icon-button-danger-hover-border, #fecdd3);
}

.chat-nav-icon-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--conversation-left-column-icon-button-border, var(--border));
  background: var(--conversation-left-column-icon-button-background, var(--surface));
  color: var(--conversation-left-column-icon-button-icon, var(--text-primary));
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

/* Touch targets: scale up icon buttons on tablet/mobile. */
@media (pointer: coarse) {
  .chat-nav-icon-btn {
    width: 44px;
    height: 44px;
  }

  .privacy-toggle-icon-btn {
    height: 44px;
  }
}

.chat-nav-icon-img {
  width: 20px;
  height: 20px;
  display: block;
  object-fit: contain;
  /* Icon filter for dark mode visibility - use brightness(0) invert(1) to make black icons white */
  filter: var(--conversation-left-column-icon-filter, none);
}

.chat-nav-icon-btn:hover {
  background: var(--conversation-left-column-icon-button-hover-background, var(--background));
}

.chat-nav-icon-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.chat-nav-item:hover {
  background: var(--conversation-left-column-vc-item-hover-background, #f1f5f9);
}

.chat-nav-item.active {
  border-color: var(--conversation-left-column-vc-item-active-border, var(--primary-color));
  background: var(--conversation-left-column-vc-item-active-background, #eef2ff);
}

/* Allow chat items to be themed separately from VC items (same base component). */
#vc-chats-list .chat-nav-item {
  border-color: var(--conversation-left-column-chat-item-border, var(--conversation-left-column-vc-item-border, var(--border)));
  background: var(--conversation-left-column-chat-item-background, var(--conversation-left-column-vc-item-background, #f8fafc));
}
#vc-chats-list .chat-nav-item:hover {
  background: var(--conversation-left-column-chat-item-hover-background, var(--conversation-left-column-vc-item-hover-background, #f1f5f9));
}
#vc-chats-list .chat-nav-item.active {
  border-color: var(--conversation-left-column-chat-item-active-border, var(--conversation-left-column-vc-item-active-border, var(--primary-color)));
  background: var(--conversation-left-column-chat-item-active-background, var(--conversation-left-column-vc-item-active-background, #eef2ff));
}

.chat-nav-item-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 2px 0;
}

.chat-nav-item-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
}

.chat-main-content {
  flex: 1;
  position: relative; /* for jump-to-latest button */
  display: flex;
  flex-direction: column;
  min-width: 0; /* Important for flex shrinking */
}

/* LiveKit embedded session (new chat UI uses this when conversationEngine=livekit) */
.livekit-embed {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.livekit-iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
}

/* When LiveKit is the active conversational runtime, hide Flowise chat widgets */
body.conversation-engine-livekit #chat-messages,
body.conversation-engine-livekit .chat-input-container,
body.conversation-engine-livekit #jump-to-latest-btn {
  display: none !important;
}

/* In LiveKit mode we default-hide Flowise-only actions in the header */
body.conversation-engine-livekit #my-chats-btn,
body.conversation-engine-livekit #save-chat-btn,
body.conversation-engine-livekit #new-conversation-btn {
  display: none !important;
}

.jump-to-latest-btn {
  position: absolute;
  right: 18px;
  bottom: 92px; /* above composer */
  z-index: 25;
  background: var(--conversation-jump-to-latest-background, rgba(37, 99, 235, 0.95));
  color: var(--conversation-jump-to-latest-text, white);
  border: none;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
  transition: var(--transition);
}

.jump-to-latest-btn:hover {
  background: var(--conversation-jump-to-latest-hover-background, rgba(29, 78, 216, 0.95));
}

.jump-to-latest-btn:focus {
  outline: none;
  box-shadow:
    var(--conversation-jump-to-latest-focus-ring, 0 0 0 3px rgb(37 99 235 / 0.25)),
    0 10px 20px rgba(0, 0, 0, 0.12);
}

/* VC Context Panel */
.vc-context-panel {
  width: 320px;
  /* Allow the panel to actually collapse in flex layouts when "hidden" is applied. */
  min-width: 0;
  flex: 0 0 320px;
  background: var(--conversation-layout-context-panel-background, white);
  border-left: 1px solid var(--conversation-layout-context-panel-border-left, var(--border));
  display: flex;
  flex-direction: column;
  box-shadow: var(--conversation-context-panel-panel-shadow, -2px 0 8px rgba(0, 0, 0, 0.05));
  transition: all 0.3s ease-in-out;
  overflow: hidden;
}

.vc-context-panel.hidden {
  width: 0;
  flex-basis: 0;
  min-width: 0;
  border-left: none;
  box-shadow: none;
}

.vc-context-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: var(--conversation-context-panel-header-background, transparent);
  border-bottom: 1px solid var(--conversation-context-panel-header-border-bottom, var(--border));
  flex-shrink: 0;
}

.vc-context-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--conversation-context-panel-header-title-text, var(--text-primary));
}

.vc-context-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--conversation-context-panel-close-button-icon, var(--text-secondary));
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
}

.vc-context-close:hover {
  background-color: var(--conversation-context-panel-close-button-hover-background, rgba(0, 0, 0, 0.05));
  color: var(--conversation-context-panel-close-button-hover-icon, var(--text-primary));
}

.vc-context-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.vc-context-content::-webkit-scrollbar {
  width: 6px;
}

.vc-context-content::-webkit-scrollbar-track {
  background: transparent;
}

.vc-context-content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.vc-context-content::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

.vc-context-section {
  margin-bottom: 20px;
}

.vc-context-section:last-child {
  margin-bottom: 0;
}

.vc-context-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--conversation-context-panel-section-title-text, var(--text-secondary));
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 12px 0;
  padding: 0 4px;
}

.vc-context-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.vc-context-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.vc-context-field label {
  font-size: 11px;
  font-weight: 500;
  color: var(--conversation-context-panel-label-text, var(--text-secondary));
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.vc-context-value {
  font-size: 13px;
  color: var(--conversation-context-panel-value-text, var(--text-primary));
  padding: 8px 10px;
  background-color: var(--conversation-context-panel-value-background, var(--secondary, #f1f5f9));
  border-radius: var(--border-radius-sm);
  border-left: 2px solid var(--conversation-context-panel-value-accent-border-left, var(--primary-color));
  word-break: break-word;
  line-height: 1.4;
}

/* VC Context Toggle Button */
.vc-context-toggle-btn {
  background: none;
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
  transition: var(--transition);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.vc-info-icon {
  width: 16px;
  height: 16px;
  display: block;
}

.vc-context-toggle-btn:hover {
  background-color: var(--secondary, #f1f5f9);
  border-color: var(--border);
  color: var(--text-primary);
}

.vc-context-toggle-btn.active {
  background-color: var(--accent-color, var(--primary-color));
  color: var(--accent-foreground, var(--primary-foreground, #ffffff));
  border-color: var(--accent-color, var(--primary-color));
}

/* Tablet Responsive - Context Panel as Collapsible Card */
@media (max-width: 1024px) {
  .vc-context-panel {
    position: absolute;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: auto;
    max-height: 50vh;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: 12px 12px 0 0;
    z-index: 100;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
  }

  .vc-context-panel.hidden {
    max-height: 0;
    overflow: hidden;
  }

  .chat-main-wrapper {
    flex-direction: column;
  }

  /* Navigator becomes an off-canvas drawer on smaller screens */
  body.chat-nav-open {
    overflow: hidden;
  }

  .chat-navigator {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    height: 100%;
    width: 360px;
    max-width: 90vw;
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    z-index: 250;
  }

  body.chat-nav-open .chat-navigator {
    transform: translateX(0);
  }

  .chat-navigator-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    z-index: 200;
  }

  body.chat-nav-open .chat-navigator-overlay {
    display: block;
  }

  .chat-browse-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  /* On tablet/phone, keep the VC selector label compact */
  .chat-active-vc-name {
    max-width: 240px;
  }
  .chat-active-vc-subtitle {
    display: none;
  }

  /* Remove old spacing hacks (panels overlay instead) */
  .chat-input-container {
    margin-bottom: 0;
  }

  /* Prevent the fixed user-info box from blocking the drawer */
  body.chat-nav-open .user-info {
    pointer-events: none;
    opacity: 0.6;
  }
}

/* Mobile Responsive - Context Panel as Full-Screen Modal */
@media (max-width: 640px) {
  .chat-navigator {
    width: 100%;
    max-width: 100%;
  }

  .vc-context-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: 0;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border: none;
    border-radius: 0;
    z-index: 1000;
    background: var(--conversation-layout-context-panel-background, white);
  }

  .vc-context-panel.hidden {
    display: none;
  }

  .vc-context-header {
    position: sticky;
    top: 0;
    background: var(--conversation-context-panel-header-background, white);
    z-index: 10;
  }

  .chat-input-container {
    margin-bottom: 0;
  }

  .vc-context-toggle-btn {
    padding: 6px 10px;
    font-size: 12px;
  }
}

/* OS-level dark mode fallback (before Firestore theme loads). */
@media (prefers-color-scheme: dark) {
  :root {
    --primary-color: #334155;
    --primary-hover: #475569;
    --primary-foreground: #f8fafc;
    --secondary-color: #1e293b;
    --secondary: #1e293b;
    --secondary-foreground: #f8fafc;
    --accent-color: #A6FF00;
    --accent-hover: #93f000;
    --accent-foreground: #030712;
    --accent-2: #A8DDF2;
    --accent-2-foreground: #030712;
    --destructive-color: #7f1d1d;
    --destructive-hover: #991b1b;
    --destructive-foreground: #f8fafc;
    --background: #030712;
    --surface: #0b1220;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border: #1f2937;
    --border-focus: #A6FF00;
    --ring: #A6FF00;
    --focus-ring: 0 0 0 3px rgba(166, 255, 0, 0.25);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.35);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.45);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.55);
  }
}

