/* Input Theme Fix */
.theme-input-bg {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-primary) !important;
    color: var(--text-primary) !important;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
}

select.theme-input-bg {
    padding-right: 36px !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: calc(100% - 14px) center !important;
}

.theme-input-bg:focus {
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 0 2px var(--accent-dim);
}
:root {
    /* --- Color Style Map: Dark Mode --- */

    /* Core Palette: Neutrals */
    --neutral-950: #0a0a0a; /* Main Background */
    --neutral-900: #111111; /* Secondary Background */
    --neutral-850: #1a1a1a; /* Tertiary/Cards */
    --neutral-800: #222222; /* Elevated */
    --neutral-700: #333333; /* Borders/Muted UI */
    --neutral-600: #444444;
    --neutral-500: #555555;
    --neutral-400: #666666; /* Disabled text */
    --neutral-300: #888888; /* Muted text */
    --neutral-200: #aaaaaa; /* Tertiary text */
    --neutral-100: #cccccc; /* Secondary text */
    --neutral-050: #ffffff; /* Primary text */

    /* Core Palette: Accent (Blue) */
    --accent-blue: #4D7CFD;
    --accent-blue-hover: #7a9fff; /* Lighter/Brighter */
    --accent-blue-active: #3D63CA; /* Darker/Deep */
    
    /* Core Palette: Status */
    --success-green: #00cc66; /* Bright Success */
    --success-green-alt: #4caf50; /* Material Green */
    --warning-yellow: #ffc800;
    --error-red: #cc0000;
    --info-blue: #2196f3;

    /* Semantic Aliases - Backgrounds */
    --bg-primary: var(--neutral-950);
    --bg-secondary: var(--neutral-900);
    --bg-tertiary: var(--neutral-850);
    --bg-elevated: var(--neutral-800);
    --bg-overlay: rgba(0, 0, 0, 0.5);
    
    /* Semantic Aliases - Text */
    --text-primary: var(--neutral-050);
    --text-secondary: var(--neutral-100);
    --text-tertiary: var(--neutral-200);
    --text-muted: var(--neutral-300);
    --text-disabled: var(--neutral-400);

    /* Semantic Aliases - Borders */
    --border-primary: var(--neutral-700);
    --border-subtle: var(--neutral-800);
    --border-hover: var(--neutral-500);

    /* Semantic Aliases - Accent */
    --accent-color: var(--accent-blue);
    --accent-hover: var(--accent-blue-hover);
    --accent-glow: rgba(77, 124, 253, 0.5);
    --accent-dim: rgba(77, 124, 253, 0.1);
    --accent-border: rgba(77, 124, 253, 0.3);

    --tile-overlay-bg: rgba(0, 0, 0, 0.75);
    --btn-bg: #eef2ff;
    --btn-bg-hover: #dde6ff;
    --btn-color: #041120;

    /* Legacy / Compatibility */
    --bg-color: var(--bg-primary);
    --text-color: var(--text-primary);
    --secondary-bg: var(--bg-secondary);
    --font-main: 'Inter', sans-serif;

    /* Transparencies */
    --white-05: rgba(255, 255, 255, 0.05);
    --white-10: rgba(255, 255, 255, 0.1);
    --white-02: rgba(255, 255, 255, 0.02);
    --black-50: rgba(0, 0, 0, 0.5);
    --black-30: rgba(0, 0, 0, 0.3);
}

[data-theme="light"] {
    /* --- Color Style Map: Light Mode --- */

    /* Inverted Neutrals (Direct Mapping) */
    --neutral-950: #ffffff;
    --neutral-900: #f8f9fa;
    --neutral-850: #e9ecef;
    --neutral-800: #dee2e6;
    --neutral-700: #ced4da;
    --neutral-600: #adb5bd;
    --neutral-500: #6c757d;
    --neutral-400: #ced4da; /* Disabled text */
    --neutral-300: #6c757d; /* Muted text */
    --neutral-200: #495057; /* Tertiary text */
    --neutral-100: #343a40; /* Secondary text */
    --neutral-050: #212529; /* Primary text */

    /* Semantic Aliases - Backgrounds */
    --bg-primary: var(--neutral-950);
    --bg-secondary: var(--neutral-900);
    --bg-tertiary: var(--neutral-850);
    --bg-elevated: var(--neutral-950);
    --bg-overlay: rgba(255, 255, 255, 0.8);
    
    /* Semantic Aliases - Text */
    --text-primary: var(--neutral-050);
    --text-secondary: var(--neutral-100);
    --text-tertiary: var(--neutral-200);
    --text-muted: var(--neutral-300);
    --text-disabled: var(--neutral-400);

    /* Semantic Aliases - Borders */
    --border-primary: var(--neutral-700);
    --border-subtle: var(--neutral-800);
    --border-hover: var(--neutral-600);

    /* Semantic Aliases - Accent */
    --accent-color: #4D7CFD; /* Blue - CTA */
    --accent-hover: #3D63CA; /* Blue - darker hover */
    --accent-glow: rgba(77, 124, 253, 0.2);
    --accent-dim: rgba(77, 124, 253, 0.05);
    --accent-border: rgba(77, 124, 253, 0.3);

    --tile-overlay-bg: rgba(0, 0, 0, 0.05);
    --btn-bg: #041120;
    --btn-bg-hover: #222428;
    --btn-color: #eef2ff;

    /* Transparencies - Inverted for Light Mode */
    --white-05: rgba(0, 0, 0, 0.05);
    --white-10: rgba(0, 0, 0, 0.1);
    --white-02: rgba(0, 0, 0, 0.02);
    --black-50: rgba(0, 0, 0, 0.15); /* Softer shadows */
    --black-30: rgba(0, 0, 0, 0.1);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    overflow-x: hidden;
    /* cursor: none; Removed to restore mouse visibility */
}

/* Custom Cursor & Trail removed */

/* DOCX Preview Styles */
.docx-preview-container {
    font-family: 'Calibri', 'Arial', sans-serif;
    line-height: 1.6;
}
.docx-preview-container h1, .docx-preview-container h2, .docx-preview-container h3 {
    margin-top: 1em;
    margin-bottom: 0.5em;
    color: #000;
}
.docx-preview-container p {
    margin-bottom: 1em;
}
.docx-preview-container ul, .docx-preview-container ol {
    margin-left: 2em;
    margin-bottom: 1em;
}
.docx-preview-container table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 1em;
}
.docx-preview-container td, .docx-preview-container th {
    border: 1px solid #ccc;
    padding: 8px;
}

/* Custom PDF Viewer */
.custom-pdf-viewer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: var(--neutral-850);
    position: relative;
}

.pdf-page-indicator {
    position: sticky;
    top: 10px;
    right: 10px;
    align-self: flex-end;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    z-index: 10;
    pointer-events: none;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.pdf-page-canvas {
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    border-radius: 4px;
    max-width: 100%;
    height: auto;
}

.pdf-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    color: var(--text-muted);
    gap: 15px;
}

.pdf-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--neutral-700);
    border-top: 3px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--neutral-950);
}

::-webkit-scrollbar-thumb {
    background: var(--neutral-700);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

/* Typography */
h1,
h2,
h3 {
    font-weight: 700;
    letter-spacing: -0.02em;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 0;
    position: relative;
    z-index: 20;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.sidebar-logo-img {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    overflow: hidden;
    display: block;
    flex-shrink: 0;
    object-fit: contain;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-links a {
    margin-left: 30px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: var(--accent-color);
}

/* Language Switcher */
.language-switcher {
    position: relative;
    margin-left: 20px;
}

.lang-globe-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    color: var(--text-muted);
    transition: color 0.15s, background 0.15s;
    line-height: 0;
}

.lang-globe-btn:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.lang-globe-btn svg {
    display: block;
}

.lang-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--secondary-bg);
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    padding: 4px;
    min-width: 140px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14);
    z-index: 1000;
}

.lang-dropdown.active {
    display: block;
}

.lang-option {
    display: flex;
    align-items: center;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-family: var(--font-main);
    text-align: left;
    transition: background 0.12s, color 0.12s;
}

.lang-option:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.lang-option--active {
    color: var(--accent-color);
}

/* Standard Buttons */
.btn,
.event-btn,
.tile-btn,
.btn-primary,
.btn-secondary {
    padding: 10px 20px;
    border: none;
    background: var(--btn-bg);
    color: var(--btn-color);
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.btn:hover,
.event-btn:hover,
.tile-btn:hover,
.btn-primary:hover {
    background: var(--btn-bg-hover);
    box-shadow: 0 0 15px rgba(77, 124, 253, 0.4);
    transform: translateY(-1px);
}

.btn-secondary,
.tile-btn.secondary {
    background: transparent;
    border: 1px solid var(--neutral-700);
    color: var(--neutral-300);
}

.btn-secondary:hover,
.tile-btn.secondary:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: transparent;
    box-shadow: none;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
}

.btn-outline:hover {
    background: var(--accent-color);
    color: #041120;
}

/* Soft neutral button — card-like fill with border, inverts cleanly in dark/light mode */
.btn.btn-soft {
    background: transparent;
    border: 1px solid var(--border-primary);
    color: var(--text-primary);
    box-shadow: none;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    gap: 10px;
}

.btn.btn-soft:hover {
    background: var(--white-05);
    border-color: var(--border-hover);
    color: var(--text-primary);
    box-shadow: 0 2px 8px var(--black-30);
    transform: translateY(-1px);
}

/* Hero Section */
.hero {
    height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    z-index: 10;
}

.hero h1 {
    font-size: 5rem;
    line-height: 1;
    margin-bottom: 20px;
    background: linear-gradient(var(--gradient-angle, 90deg), var(--neutral-050), var(--neutral-300));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}


.hero p {
    font-size: 1.2rem;
    color: var(--neutral-300);
    max-width: 600px;
    margin-bottom: 40px;
}

/* Features */
.features {
    padding: 100px 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
    position: relative;
    z-index: 10;
}

.feature-card {
    background: rgba(255, 255, 255, 0.03);
    padding: 40px;
    border: 1px solid var(--white-10);
    transition: transform 0.3s, border-color 0.3s;
}

.feature-card:hover {
    transform: translateY(-10px);
    border-color: var(--accent-color);
}

.feature-card h3 {
    margin-bottom: 15px;
    color: var(--accent-color);
}

.feature-card p {
    color: var(--neutral-200);
    line-height: 1.6;
}

/* Auth Form */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: var(--bg-primary);
    background-image: radial-gradient(ellipse 90% 55% at 50% 30%, var(--accent-dim) 0%, transparent 65%);
}

.auth-box {
    background: var(--bg-secondary);
    padding: 40px 44px 44px;
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--border-primary);
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 32px;
}

.auth-logo-mark {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    display: block;
    object-fit: contain;
}

.auth-logo-text {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

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

.auth-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 6px 0;
    text-align: left;
}

.auth-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0;
}

.auth-submit-btn {
    width: 100%;
    padding: 12px 20px !important;
    margin-top: 4px;
    font-size: 0.9rem;
    border-radius: 10px !important;
    letter-spacing: 0.5px;
}

.auth-toggle-text {
    margin-top: 18px;
    text-align: center;
    font-size: 0.825rem;
    color: var(--text-muted);
}

.auth-toggle-text a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.auth-toggle-text a:hover {
    color: var(--accent-color);
}

.form-group.auth-trust-group {
    margin-top: 0;
    margin-bottom: 18px;
}

/* Checkbox row: a soft tile with a custom animated check box. */
.form-group.auth-trust-group .auth-checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 11px 14px;
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    background: transparent;
    font-size: 0.85rem;
    line-height: 1.35;
    text-transform: none;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.form-group.auth-trust-group .auth-checkbox-label:hover {
    border-color: var(--accent-border, var(--accent-color));
    background: var(--accent-dim);
}

.form-group.auth-trust-group .auth-checkbox-label:has(input:checked) {
    border-color: var(--accent-color);
    background: var(--accent-dim);
    color: var(--text-primary);
}

.form-group.auth-trust-group .auth-checkbox-label:has(input:focus-visible) {
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-group.auth-trust-group .auth-checkbox-label input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    flex: none;
    width: 20px;
    height: 20px;
    min-width: 20px;
    margin: 0;
    padding: 0;
    border: 1.5px solid var(--text-muted);
    border-radius: 7px;
    background: transparent center / 14px 14px no-repeat;
    box-shadow: none;
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.form-group.auth-trust-group .auth-checkbox-label input[type="checkbox"]:focus,
.form-group.auth-trust-group .auth-checkbox-label input[type="checkbox"]:focus-visible {
    outline: none;
    box-shadow: none;
}

.form-group.auth-trust-group .auth-checkbox-label input[type="checkbox"]:checked {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 8.5l3 3 6-6.5'/%3E%3C/svg%3E");
    animation: authCheckPop 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.form-group.auth-trust-group .auth-checkbox-label:active input[type="checkbox"] {
    transform: scale(0.9);
}

@keyframes authCheckPop {
    0% { transform: scale(0.8); }
    100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .form-group.auth-trust-group .auth-checkbox-label,
    .form-group.auth-trust-group .auth-checkbox-label input[type="checkbox"] { transition: none; animation: none !important; }
}

.auth-verify-pending {
    text-align: center;
    padding: 8px 0 4px;
}

.auth-verify-icon {
    font-size: 2.75rem;
    color: var(--accent-color);
    margin-bottom: 12px;
    line-height: 1;
}

.auth-verify-pending h2 {
    margin: 0 0 8px;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.auth-verify-pending .auth-subtitle {
    margin-bottom: 12px;
}

.auth-verify-email {
    font-weight: 600;
    color: var(--text-secondary);
    word-break: break-all;
    margin: 0 0 20px;
}

.auth-field-error {
    display: none;
    margin-top: 6px;
    font-size: 0.8rem;
    color: #ff4d6a;
}

.input-field-error {
    border-color: #ff4d6a !important;
    box-shadow: 0 0 0 2px rgba(255, 77, 106, 0.2) !important;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--neutral-300);
}

.form-group input,
.form-group select,
.form-group textarea,
.standard-input {
    width: 100%;
    padding: 12px 15px;
    background: var(--neutral-950);
    border: 1px solid var(--neutral-700);
    color: var(--neutral-050);
    border-radius: 8px;
    outline: none;
    transition: all 0.3s ease;
    font-family: var(--font-main);
    font-size: 0.95rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.standard-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-dim);
}

/* Dashboard */
.dashboard-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 250px;
    background: var(--secondary-bg);
    padding: 24px;
    border-right: 1px solid var(--neutral-800);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    position: relative;
    z-index: 1000;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 40px;
    transition: all 0.3s ease;
}

.sidebar-version {
    font-size: 1.1 rem;
    color: var(--neutral-500);
    font-weight: 500;
    margin-top: 6px;
    padding-left: 0px;
}

#sidebar-toggle-btn {
    background: transparent;
    border: 1px solid var(--neutral-700);
    color: var(--neutral-400);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

#sidebar-toggle-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: var(--accent-dim);
}

.sidebar.collapsed {
    width: 80px;
    padding: 30px 15px;
}

.sidebar.collapsed .logo,
.sidebar.collapsed .nav-category,
.sidebar.collapsed .nav-tab span,
.sidebar.collapsed #user-info,
.sidebar.collapsed .btn span,
.sidebar.collapsed .sidebar-version {
    display: none;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center !important;
}

.sidebar.collapsed #sidebar-toggle-btn i {
    transform: rotate(180deg);
}

.sidebar.collapsed .nav-tab {
    padding: 10px;
    justify-content: center;
    gap: 0;
}

.sidebar.collapsed .nav-tab:hover,
.sidebar.collapsed .nav-tab.active {
    padding-left: 10px;
}

.sidebar.collapsed .btn {
    padding: 10px;
    display: flex;
    justify-content: center;
}

.sidebar.collapsed .btn i {
    font-size: 1.2rem;
}

.main-content {
    flex: 1;
    min-width: 0;
    padding: 20px 40px 40px 40px; /* Reduced top padding by 50% */
    overflow-y: auto;
}

.doc-card {
    background: var(--neutral-900);
    padding: 20px;
    margin-bottom: 20px;
    border-left: 3px solid var(--accent-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.doc-card:hover {
    background: rgba(77, 124, 253, 0.05);
    border-left-width: 5px;
    transform: translateX(5px);
}

/* Phone Call Interface - integrated into dashboard layout */
.phone-interface {
    /* Reset all legacy fixed-position widget values */
    position: relative;
    inset: auto;
    bottom: auto;
    right: auto;
    /* Flex child of .dashboard-layout */
    flex: 1;
    min-width: 0;
    display: none; /* shown as flex by JS */
    flex-direction: row;
    height: 100%;
    background: var(--bg-primary);
    overflow: hidden;
    padding: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    z-index: 1;
}

/* Light / general styling for entire phone interface setup */
.phone-interface {
    background: var(--bg-primary) !important;
}

.phone-summary-panel {
    flex: 0 0 45%;
    min-width: 0;
    background: var(--bg-secondary);
    border-right: none;
    padding: 35px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    color: var(--text-primary);
}

.phone-header {
    text-align: center;
    margin-bottom: 20px;
    color: var(--accent-color);
    font-weight: bold;
}

.phone-status {
    text-align: center;
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: var(--neutral-300);
}

.waveform {
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin-bottom: 20px;
}

.bar {
    width: 5px;
    height: 10px;
    background: var(--accent-color);
    animation: wave 1s infinite ease-in-out;
}

@keyframes wave {

    0%,
    100% {
        height: 10px;
    }

    50% {
        height: 40px;
    }
}

.phone-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.btn-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
}

.btn-end {
    background: var(--accent-red);
    color: white;
}

.btn-send {
    background: var(--accent-color);
    color: #041120;
    transition: all 0.3s;
}

.btn-send:hover {
    background: #7a9fff;
    box-shadow: 0 0 15px var(--accent-color);
}

.live-transcription {
    min-height: 60px;
    max-height: 100px;
    overflow-y: auto;
    background: var(--black-30);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 15px;
    color: var(--neutral-200);
    font-size: 0.85rem;
    line-height: 1.4;
    font-style: italic;
}

.live-transcription:empty {
    display: none;
}

.btn-mute {
    background: var(--neutral-700);
    color: white;
    transition: all 0.3s;
}

.btn-mute.listening {
    background: var(--accent-color);
    box-shadow: 0 0 15px var(--accent-color);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* Custom Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

#custom-modal {
    z-index: 11000; /* Ensure error/info modals are always on top */
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--secondary-bg);
    padding: 30px;
    border: 1px solid var(--accent-color);
    border-radius: 10px;
    max-width: 400px;
    width: 90%;
    max-height: 90vh;
    text-align: center;
    box-shadow: 0 0 50px var(--accent-border);
    transform: scale(0.9);
    transition: transform 0.3s;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

/* Specific styling for the Knowledge/Debrief Modal to override default modal styling */
#new-debrief-modal .modal {
    border: 1px solid #2F2F2F; /* Match astra-sidebar gray border */
    border-radius: 20px; /* Increased border radius to match larger size */
    max-width: 812px; /* Increased from 676px by 20% for more space */
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5); /* Remove red shadow */
    overflow: hidden; /* Prevent horizontal scrollbars and clip outer modal edge */
}

/* Integration Detail Modal specific styling */
#integration-detail-modal .modal {
    border: 1px solid var(--border-primary);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5); /* Remove red shadow */
}

.modal h3 {
    color: var(--accent-color);
    margin-bottom: 15px;
}

.modal p {
    color: var(--neutral-100);
    margin-bottom: 25px;
}

.modal-description {
    color: var(--neutral-300);
    margin-bottom: 20px;
    font-size: 0.9rem;
    line-height: 1.5;
}



/* Sidebar Tabs */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    width: 100%;
}

#nav-category-project,
#nav-category-document {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 100%;
}

.nav-category {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--neutral-500);
    margin-top: 15px;
    margin-bottom: 5px;
    padding-left: 10px;
    font-weight: bold;
}

.nav-tab {
    background: transparent;
    border: 1px solid transparent;
    color: var(--neutral-300);
    padding: 10px;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-tab:hover {
    color: var(--text-color);
    border-left: 1px solid var(--accent-color);
    padding-left: 15px;
}

.nav-tab.active {
    color: var(--accent-color);
    border-left: 3px solid var(--accent-color);
    padding-left: 15px;
    background: rgba(77, 124, 253, 0.05);
}

/* Top Bar */
.top-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 30px;
    padding: 10px 0;
    border-bottom: 1px solid var(--neutral-800);
}

/* Remove default border only on Astra tab */
body[data-active-tab="astra"] .top-bar {
    border-bottom: none;
}

#user-settings-btn {
    background: linear-gradient(135deg, var(--accent-dim), rgba(77, 124, 253, 0.05));
    border: 1px solid var(--accent-border);
    color: var(--text-color);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

#user-settings-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(77, 124, 253, 0.2), transparent);
    transition: left 0.5s;
}

#user-settings-btn:hover::before {
    left: 100%;
}

#user-settings-btn:hover {
    border-color: var(--accent-color);
    box-shadow: 0 0 20px var(--accent-border);
    transform: translateY(-2px);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--accent-color);
    object-fit: cover;
    background: var(--neutral-800);
}

.settings-icon {
    font-size: 1.1rem;
    opacity: 0.7;
    transition: all 0.3s;
}

#user-settings-btn:hover .settings-icon {
    opacity: 1;
    transform: rotate(90deg);
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.tab-content.active {
    display: block;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 15px;
    border-bottom: 1px solid var(--neutral-800);
}

.data-table th {
    color: var(--neutral-300);
    text-transform: uppercase;
    font-size: 0.8rem;
}

.data-table tbody tr {
    cursor: pointer;
    transition: background 0.2s ease;
}

.data-table tbody tr:hover {
    background: var(--white-05);
}

.data-table thead tr:hover {
    background: transparent;
}

.role-badge {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.role-admin {
    background: rgba(77, 124, 253, 0.2);
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
}

.role-employee {
    background: var(--neutral-800);
    color: var(--neutral-200);
    border: 1px solid var(--neutral-600);
}

/* Team Member Checkbox List */
.team-member-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border: 1px solid var(--neutral-700);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--neutral-900);
}

.team-member-item:hover {
    border-color: var(--neutral-500);
    background: var(--neutral-850);
}

.team-member-item.selected {
    border-color: var(--accent-color);
    background: var(--accent-dim);
}

.team-member-checkbox {
    width: 22px;
    height: 22px;
    border: 2px solid var(--neutral-500);
    border-radius: 50%;
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
}

.team-member-item.selected .team-member-checkbox {
    background: var(--accent-color);
    border-color: var(--accent-color);
}

.team-member-checkbox::after {
    content: '✓';
    color: white;
    font-size: 14px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.2s;
}

.team-member-item.selected .team-member-checkbox::after {
    opacity: 1;
}

.team-member-avatar-small {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    margin-right: 15px;
    object-fit: cover;
    border: 1px solid var(--neutral-700);
    background: var(--neutral-800);
}

.team-member-info {
    flex: 1;
}

.team-member-name {
    color: var(--text-color);
    font-weight: 600;
    margin-bottom: 4px;
}

.team-member-email {
    color: var(--neutral-400);
    font-size: 0.85rem;
}

/* Debriefs Grid */
.debriefs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(244px, 1fr));
    gap: 16px;
}

/* Skeleton loaders — shown optimistically while switching orgs / reloading
   the dashboard so the UI feels responsive during the network round trip.
   A slow, gentle opacity pulse (not a travelling shimmer sweep) — easier to
   look at and less distracting than a fast/long gradient animation. */
@keyframes skeleton-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.skeleton-block {
    background-color: var(--border-primary);
    animation: skeleton-pulse 1.8s ease-in-out infinite;
    border-radius: 6px;
}

.debrief-tile.skeleton-tile,
.event-card.skeleton-tile {
    cursor: default;
    pointer-events: none;
}

.debrief-tile.skeleton-tile:hover,
.event-card.skeleton-tile:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--border-primary);
}

/* Standard Card Style */
.card,
.event-card,
.feature-card,
.doc-card {
    background: var(--neutral-900);
    border: 1px solid var(--neutral-800);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.debrief-tile {
    /* Author Pill - moved to separate rules below */
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    position: relative;
    overflow: visible;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 163px;
    cursor: pointer;
}

/* Empty category placeholder tile */
.empty-category-tile {
    border-style: dashed;
    border-color: var(--border-primary);
    background: transparent;
    cursor: default;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.empty-category-tile.clickable {
    cursor: pointer;
}

.empty-category-tile.clickable:hover {
    border-color: var(--accent-color);
    background: color-mix(in srgb, var(--accent-color) 6%, transparent);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.empty-category-tile.clickable:hover .empty-category-plus-ring {
    background: var(--accent-color);
    border-color: var(--accent-color);
    transform: scale(1.1);
}

.empty-category-tile.clickable:hover .empty-category-plus-icon {
    color: #fff;
}

.empty-category-tile.clickable:hover .empty-category-label {
    color: var(--accent-color);
}

.empty-category-tile.clickable:active {
    transform: translateY(0);
}

.empty-category-tile-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 100%;
    min-height: 163px;
    text-align: center;
    padding: 20px;
    box-sizing: border-box;
}

.empty-category-plus-ring {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1.5px solid var(--border-secondary, var(--border-primary));
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
    background: transparent;
}

.empty-category-plus-icon {
    font-size: 1.2rem;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.empty-category-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: color 0.2s ease;
    letter-spacing: 0.01em;
}

.empty-category-sub {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    font-style: italic;
    line-height: 1.4;
}

/* Status Dot Styles */
.tile-badges {
    display: flex;
    align-items: center;
    gap: 8px; /* Spacing between Date, Status, Author */
}

.tile-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
    position: relative;
    cursor: pointer; /* Match the tile's pointer cursor */
    background-color: #666; /* Default Fallback */
    transition: transform 0.2s ease;
}

/* Larger Hitbox using pseudo-element */
.tile-status-dot::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;   /* Increased hitbox width */
    height: 24px;  /* Increased hitbox height */
    border-radius: 50%;
    background: transparent;
    z-index: 1;    /* Catch hover events */
}

/* Tooltip Logic - Enhanced Design */
.tile-status-dot .status-tooltip {
    visibility: hidden;
    position: absolute;
    bottom: calc(100% + 10px); /* 10px above the dot */
    left: 50%;
    transform: translateX(-50%) translateY(5px);
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    pointer-events: none;
    z-index: 20;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3), 0 0 0 1px var(--border-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tooltip Caret (Arrow) */
.tile-status-dot .status-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: var(--bg-tertiary) transparent transparent transparent;
}

.tile-status-dot:hover {
    transform: scale(1.2);
}

.tile-status-dot:hover .status-tooltip {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Status Colors */

/* Draft (Orange) */
.tile-status-dot.status-draft {
    background-color: #ff9800;
    box-shadow: 0 0 4px rgba(255, 152, 0, 0.4);
}

/* Converted (Green) */
.tile-status-dot.status-converted {
    background-color: #4caf50;
    box-shadow: 0 0 4px rgba(76, 175, 80, 0.4);
}

/* Uploaded / File (Blue) */
.tile-status-dot.status-uploaded, 
.tile-status-dot.status-file {
    background-color: #2196f3;
    box-shadow: 0 0 4px rgba(33, 150, 243, 0.4);
}

/* Completed (Purple) */
.tile-status-dot.status-completed {
    background-color: #9c27b0;
    box-shadow: 0 0 4px rgba(156, 39, 176, 0.4);
}

/* Processing (Yellow/Gold) */
.tile-status-dot.status-processing {
    background-color: #ffc107;
    animation: pulse-dot 1s infinite;
}

@keyframes pulse-dot {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

/* Flattened Author Pill Rules */
.tile-author-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0,0,0,0.05); /* Light mode fallback */
    background: var(--bg-tertiary);
    padding: 2px 8px 2px 2px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
    margin-right: 8px;
    max-width: 120px;
}

.tile-author-pill:hover {
    background: var(--border-primary);
}

.author-pill-img {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
}

.author-pill-name {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card:hover,
.debrief-tile:hover,
.event-card:hover,
.feature-card:hover,
.doc-card:hover {
    border-color: var(--accent-color);
    box-shadow: 0 4px 15px var(--black-50);
    transform: translateY(-2px);
    cursor: pointer;
}

.debrief-tile.active {
    border-color: var(--accent-color);
    box-shadow: 0 0 30px var(--accent-dim);
}

.tile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 13px;
    position: relative;
    z-index: 55;
}

.tile-badges {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tile-title {
    font-size: 1.06rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tile-date {
    font-size: 0.81rem;
    color: var(--text-muted);
}

.tile-status {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 15px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.tile-main-content {
    flex: 1;
}

/* Topic Preview in Tile */
.tile-topic-preview {
    background: var(--bg-tertiary);
    border-radius: 6px;
    padding: 13px;
    border: 1px solid var(--border-primary);
}

.mini-label {
    font-size: 0.63rem;
    color: var(--accent-color);
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 5px;
    letter-spacing: 0.5px;
    display: block;
}

.topic-text {
    font-size: 0.81rem;
    color: var(--text-secondary);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tile-text-preview {
    font-size: 0.81rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Tile Hover Overlay */
.tile-menu-container {
    position: relative;
    z-index: 10;
}

.status-draft {
    background: var(--neutral-700);
    color: var(--neutral-200);
}

.status-completed {
    background: rgba(255, 193, 7, 0.1);
    color: #ffc107;
}

.status-converted {
    background: rgba(0, 204, 100, 0.15);
    color: #00cc50;
}

.status-empty {
    background: var(--accent-dim);
    color: var(--accent-color);
}

/* Onboarding Tile Styles */
.onboarding-tile {
    background: linear-gradient(135deg, #1a0a1f 0%, #0f051a 100%);
    border: 2px solid var(--accent-color);
    box-shadow: 0 8px 32px rgba(77, 124, 253, 0.2);
    cursor: default;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    grid-column: 1 / -1;
    /* Span all columns */
}

.onboarding-tile:hover {
    transform: translateY(0);
    box-shadow: 0 8px 32px var(--accent-border);
}

.onboarding-tile-content {
    text-align: center;
    padding: 40px;
    max-width: 800px;
    /* Increased from 600px */
    width: 100%;
}

.onboarding-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.onboarding-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 20px;
    text-shadow: 0 0 20px var(--accent-glow);
}

.onboarding-description {
    font-size: 1.1rem;
    color: var(--neutral-100);
    line-height: 1.7;
    margin-bottom: 30px;
}

.onboarding-start-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 40px;
    background: var(--accent-color);
    color: #041120;
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px var(--accent-border);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.onboarding-start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px var(--accent-glow);
    background: #ff1a4d;
}

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

.onboarding-btn-icon {
    font-size: 1.3rem;
    animation: bounce 1s ease-in-out infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-4px);
    }
}

.onboarding-details {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.onboarding-detail-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--neutral-300);
    font-size: 0.9rem;
}

.detail-icon {
    font-size: 1.2rem;
}

.tile-content {
    flex: 0 1 auto;
    margin-bottom: 15px;
    font-size: 0.9rem;
    color: var(--neutral-100);
    line-height: 1.5;
}

/* Preview Mode in Tiles */
.preview-mode {
    position: relative;
    height: 100%;
    overflow: hidden;
    color: var(--neutral-200);
    font-size: 0.81rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-bottom: 5px;
}

/* Thumbnail Image for Tiles */
.tile-thumbnail-container {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 6px;
    margin-bottom: 10px;
    background: var(--bg-tertiary);
}

.tile-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    display: block;
    mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
}

.fade-overlay {
    display: none; /* Removed as requested */
}


.tile-actions {
    display: flex;
    gap: 8px;
    margin-top: 13px;
    padding-top: 13px;
    border-top: 1px solid var(--neutral-800);
}

/* Default tile button */
.tile-btn {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--accent-color);
    background: transparent;
    color: var(--accent-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
    transition: all 0.2s;
}

.tile-btn:hover {
    background: var(--accent-color);
    color: #041120;
}

.tile-btn.secondary {
    border-color: var(--neutral-700);
    color: var(--neutral-300);
}

.tile-btn.secondary:hover {
    background: var(--neutral-700);
    color: white;
}

/* Delete button style - Consistent */
.tile-btn.delete,
.tile-btn[style*="background: var(--error-red)"] {
    border: 1px solid var(--error-red);
    background: transparent;
    color: var(--error-red);
}

.tile-btn.delete:hover,
.tile-btn[style*="background: var(--error-red)"]:hover {
    background: var(--error-red);
    color: var(--neutral-050);
}

/* Notes textarea styling */
.notes-area {
    width: 100%;
    height: 100%;
    min-height: 150px;
    background: var(--neutral-950);
    border: 1px solid var(--neutral-700);
    border-radius: 8px;
    padding: 15px;
    color: var(--neutral-100);
    font-family: var(--font-main);
    font-size: 0.9rem;
    line-height: 1.5;
    resize: none;
    outline: none;
    transition: border-color 0.3s;
}

.notes-area:focus {
    border-color: var(--accent-color);
}

.notes-area::placeholder {
    color: var(--neutral-500);
}

/* Scrollbar Styling - Minimal & Dark */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--neutral-700);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--neutral-500);
}


/* Drag and Drop Overlay */
#drag-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    color: white; /* Always white */
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none; /* Ignore mouse events when not active */
    transition: opacity 0.3s ease;
    backdrop-filter: blur(5px);
}

#drag-overlay.active {
    opacity: 1;
    pointer-events: all;
}

#drag-overlay i {
    font-size: 5rem;
    margin-bottom: 20px;
    color: var(--accent-color);
}

#drag-overlay h2 {
    font-size: 2rem;
    font-weight: 700;
}

.tile-content::-webkit-scrollbar-thumb {
    background: transparent;
}

.tile-content:hover::-webkit-scrollbar-thumb {
    background: var(--neutral-700);
}

.tile-split-view {
    display: flex;
    height: 100%;
    gap: 20px;
}

.tile-split-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tile-split-pane h4 {
    margin-bottom: 10px;
    color: var(--neutral-300);
    font-size: 0.8rem;
    text-transform: uppercase;
}

.transcript-view {
    flex: 1;
    overflow-y: auto;
    background: var(--black-30);
    padding: 10px;
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--neutral-200);
}

.transcript-item {
    margin-bottom: 10px;
}

.transcript-role {
    font-weight: bold;
    color: var(--accent-color);
    font-size: 0.7rem;
    margin-bottom: 2px;
}

.transcript-content {
    line-height: 1.4;
}

/* Documentation Viewer Modal Removed - Now using viewer.html */

/* Markdown Styling (Reusable) */
.markdown-content {
    color: var(--text-primary);
    /* Lighter text for better contrast */
    font-size: 1rem;
    line-height: 1.7;
    font-family: var(--font-main);
    /* Ensure sans-serif */
}

.markdown-content h1 {
    font-size: 1.8rem;
    margin-bottom: 15px;
    margin-top: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--accent-color);
    color: var(--accent-color);
}

.markdown-content h1:first-child {
    margin-top: 0;
}

.markdown-content h2 {
    font-size: 1.5rem;
    margin-top: 25px;
    margin-bottom: 12px;
    color: var(--text-primary);
    border-left: 3px solid var(--accent-color);
    padding-left: 12px;
}

.markdown-content h3 {
    font-size: 1.2rem;
    margin-top: 20px;
    margin-bottom: 10px;
    color: var(--text-secondary);
}

.markdown-content h4 {
    font-size: 1.1rem;
    margin-top: 15px;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.markdown-content h5,
.markdown-content h6 {
    font-size: 0.9rem;
    margin-top: 12px;
    margin-bottom: 5px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.markdown-content p {
    line-height: 1.6;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.markdown-content a {
    color: var(--accent-color);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s;
}

.markdown-content a:hover {
    border-bottom-color: var(--accent-color);
}

.markdown-content ul,
.markdown-content ol {
    margin: 12px 0;
    padding-left: 25px;
    color: var(--text-secondary);
}

.markdown-content li {
    margin-bottom: 5px;
}

.markdown-content ul li::marker {
    color: var(--accent-color);
}

.markdown-content ol li::marker {
    color: var(--accent-color);
    font-weight: bold;
}

.markdown-content code {
    background: var(--accent-dim);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: var(--accent-color);
    border: 1px solid var(--accent-border);
}

.markdown-content pre {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    overflow-x: visible;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.markdown-content pre code {
    background: transparent;
    padding: 0;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-main);
    font-size: 1rem;
    line-height: 1.7;
}

.markdown-content blockquote {
    border-left: 3px solid var(--accent-color);
    padding: 10px 15px;
    margin: 15px 0;
    background: var(--accent-dim);
    color: var(--text-tertiary);
    font-style: italic;
}

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    background: var(--bg-secondary);
    font-size: 0.9rem;
}

.markdown-content table th,
.markdown-content table td {
    padding: 10px 12px;
    border: 1px solid var(--border-primary);
    text-align: left;
}

.markdown-content table th {
    background: var(--accent-dim);
    color: var(--accent-color);
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.8em;
    letter-spacing: 1px;
}

.markdown-content table tr:hover {
    background: var(--bg-tertiary);
}

.markdown-content hr {
    border: none;
    border-top: 1px solid var(--border-primary);
    margin: 25px 0;
}

.markdown-content img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 15px 0;
    border: 1px solid var(--border-primary);
}

.markdown-content strong {
    color: var(--text-primary);
    font-weight: 700;
}

.markdown-content em {
    color: var(--text-muted);
    font-style: italic;
}

/* Description Section */
.doc-description {
    /* background: rgba(77, 124, 253, 0.05); */
    /* border-left: 4px solid var(--accent-color); */
    /* padding: 15px 20px; */
    margin: 0;
    color: var(--neutral-200);
    /* font-style: italic; */
    /* border-radius: 4px; */
    font-size: 1.1rem;
    line-height: 1.6;
}

/* Updated Date */
.doc-metadata {
    color: var(--neutral-400);
    font-size: 0.85rem;
    margin: 0;
}

/* Documentation Full-Screen Viewer */
.doc-viewer-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-color);
    padding: 0;
    overflow: hidden;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    text-align: left;
}

.doc-viewer-actions {
    position: fixed;
    top: 20px;
    right: 30px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    z-index: 10002;
}

.doc-viewer-close {
    background: transparent;
    border: 1px solid var(--neutral-700);
    color: var(--neutral-300);
    font-size: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.doc-viewer-close:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    box-shadow: 0 0 20px var(--accent-border);
}

/* Conflict Viewer Close Row (inside scrollable content) */
.conflict-close-row {
    position: sticky;
    top: -40px; /* Aligns perfectly with the top edge neutralizing parent's 40px padding */
    background: var(--bg-color, var(--bg-primary)); /* Hides text scrolling underneath */
    z-index: 100;
    
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: -40px;
    padding-top: 16px;
    padding-bottom: 16px;
    margin-bottom: 24px;
    
    /* Extend separator line edge-to-edge despite parent padding */
    margin-left: -40px;
    margin-right: -40px;
    padding-left: 40px;
    padding-right: 40px;
    border-bottom: 1px solid var(--border-primary);
}

/* Conflict Viewer Close Button (replaces doc-viewer-close for conflict modal) */
.conflict-viewer-close-btn {
    background: transparent;
    border: 1px solid var(--neutral-700);
    color: var(--neutral-300);
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    line-height: 1;
}

.conflict-viewer-close-btn:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.doc-viewer-header {
    /* max-width removed to allow full layout width control */
    margin: 0 0 40px 0;
}

.doc-viewer-header h1 {
    font-size: 2.5rem;
    margin: 0;
    background: linear-gradient(to right, var(--neutral-050), var(--neutral-300));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: calc(100% - 500px);
}

#doc-viewer-content {
    max-width: 1400px;
    width: 95%;
    margin: 0 auto;
}

/* Hide scrollbar on doc viewer for cleaner look */
.doc-viewer-container::-webkit-scrollbar {
    width: 8px;
}

.doc-viewer-container::-webkit-scrollbar-track {
    background: transparent;
}

.doc-viewer-container::-webkit-scrollbar-thumb {
    background: var(--neutral-800);
    border-radius: 4px;
}

.doc-viewer-container::-webkit-scrollbar-thumb:hover {
    background: var(--neutral-700);
}

/* Event Feed Styles */
#mark-all-read-btn {
    background: transparent;
    border: 1px solid var(--neutral-700);
    color: var(--neutral-200);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

#mark-all-read-btn:hover {
    border-color: var(--neutral-400);
    color: var(--neutral-050);
}

#mark-all-read-btn:active {
    transform: scale(0.95);
    background: var(--neutral-800);
}

.event-card {
    display: flex;
    align-items: center;
    gap: 20px;
    background: var(--neutral-900);
    border: 1px solid var(--neutral-800);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.event-card.unread {
    border-color: rgba(255, 255, 255, 1); /* White border for unread */
}

.event-card:hover {
    border-color: var(--accent-color);
    background: rgba(77, 124, 253, 0.02);
    transform: translateX(5px);
}

.event-icon {
    font-size: 2rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-dim);
    border-radius: 12px;
    flex-shrink: 0;
}

.event-author-img-tiny {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    object-fit: cover;
    vertical-align: middle;
    margin-right: 6px;
    border: 1px solid var(--accent-dim);
    display: inline-block;
}

.event-author-img-tiny:hover {
    border-color: var(--accent-color);
}

.event-content {
    flex: 1;
    min-width: 0;
}

.event-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--neutral-050);
    margin-bottom: 5px;
}

.event-details {
    font-size: 0.9rem;
    color: var(--neutral-300);
    margin-bottom: 5px;
}

.event-author strong {
    color: var(--accent-color);
}

.event-doc {
    color: var(--neutral-200);
    font-style: italic;
}

.event-timestamp {
    font-size: 0.8rem;
    color: var(--neutral-500);
}

.event-actions {
    flex-shrink: 0;
}

.event-btn {
    padding: 10px 20px;
    border: 1px solid var(--accent-color);
    background: transparent;
    color: var(--accent-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    text-transform: uppercase;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
}

.event-btn:hover {
    background: var(--accent-color);
    color: #041120;
    box-shadow: 0 0 15px var(--accent-border);
}

/* Responsive event cards */
@media (max-width: 768px) {
    .event-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .event-actions {
        width: 100%;
    }

    .event-btn {
        width: 100%;
    }
}

/* Tile Menu Styles */
.tile-menu-container {
    position: relative;
}

.tile-menu-btn {
    background: transparent;
    border: none;
    color: var(--neutral-400);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.2s;
}

.tile-menu-btn:hover {
    background: var(--white-10);
    color: var(--neutral-050);
}

.tile-menu-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--neutral-850);
    border: 1px solid var(--neutral-700);
    border-radius: 6px;
    padding: 5px 0;
    min-width: 150px;
    z-index: 100;
    box-shadow: 0 4px 12px var(--black-50);
}

.tile-menu-dropdown.active {
    display: block;
}

.tile-menu-item {
    display: block;
    width: 100%;
    padding: 8px 15px;
    text-align: left;
    background: transparent;
    border: none;
    color: var(--neutral-100);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

.tile-menu-item:hover {
    background: var(--white-05);
    color: var(--neutral-050);
}

.tile-menu-item.delete {
    color: var(--error-red);
}

.tile-menu-item.delete:hover {
    background: rgba(204, 0, 0, 0.1);
}


.tile-convert-btn.modern-btn-style {
    background: var(--accent-color);
    color: #041120;
    border: none;
    padding: 8px 13px;
    font-size: 0.81rem;
    box-shadow: 0 2px 5px var(--accent-dim);
}

.tile-convert-btn.modern-btn-style:hover {
    background: var(--accent-hover);
    box-shadow: 0 3px 7px var(--accent-glow);
    transform: translateY(-1px);
}

.tile-convert-btn.modern-btn-style svg {
    width: 16px;
    height: 16px;
}

/* Overlay button wrapper — shrink-to-content so button never stretches */
.tile-overlay-btns {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    width: max-content;
}

/* Overlay convert button - liquid glass / soft-btn style */
.tile-convert-btn.overlay-btn {
    width: auto !important;
    height: auto !important;
    padding: 6px 12px !important;
    font-size: 0.75rem !important;
    border-radius: 6px;
    border: 1px solid var(--border-primary) !important;
    background: rgba(255, 255, 255, 0.05) !important;
    backdrop-filter: blur(4.5px) saturate(140%) !important;
    -webkit-backdrop-filter: blur(4.5px) saturate(140%) !important;
    color: var(--text-primary) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
    font-weight: 500;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
}

.tile-convert-btn.overlay-btn:hover {
    background: rgba(255, 255, 255, 0.09) !important;
    border-color: var(--border-hover, rgba(255, 255, 255, 0.28)) !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.14) !important;
    transform: translateY(-2px) !important;
}

.tile-convert-btn.overlay-btn.tile-btn-pulse {
    background: rgba(255, 152, 0, 0.1) !important;
    border-color: rgba(255, 152, 0, 0.4) !important;
    color: #ff9800 !important;
}

.tile-convert-btn.overlay-btn.tile-btn-pulse:hover {
    background: rgba(255, 152, 0, 0.15) !important;
    border-color: rgba(255, 152, 0, 0.6) !important;
}

.tile-convert-btn {
    width: 100%;
    padding: 10px 16px;
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-hover) 100%);
    color: #041120;
    border: none;
    border-radius: 6px;
    font-size: 0.81rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 2px 6px var(--accent-border);
}

.tile-convert-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px var(--accent-glow);
    background: linear-gradient(135deg, #ff1744 0%, var(--accent-color) 100%);
}

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

.convert-icon {
    font-size: 0.98rem;
}

/* Fix dropdown overflow in tiles */
.tile-menu-container {
    position: relative;
    overflow: visible;
}

/* Draft Modal Styles */
.draft-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.draft-content-container {
    display: flex;
    flex-direction: column; /* Stack vertically now */
    gap: 20px;
    height: calc(100vh - 250px);
    /* Adjust based on header height */
    max-width: 1600px;
    width: 95%;
    margin: 0 auto;
}

.draft-topic-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    padding: 15px 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

.topic-label {
    color: var(--accent-color);
    font-weight: bold;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

.topic-content {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
}

.draft-split-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 20px;
    overflow: hidden;
}

.draft-split-pane h4 {
    margin-bottom: 15px;
    color: var(--text-primary);
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

.full-height {
    flex: 1;
    height: 100%;
}

/* Ensure textarea in modal looks good */
#draft-notes-area {
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    color: var(--text-primary);
    padding: 15px;
    border-radius: 8px;
    resize: none;
    font-family: var(--font-main);
    line-height: 1.6;
    font-size: 1rem;
}

#draft-notes-area:focus {
    border-color: var(--accent-color);
    outline: none;
}

/* Ensure transcript in modal looks good */
#draft-transcript-view {
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    padding: 15px;
    border-radius: 8px;
    overflow-y: auto;
}

/* Tile Loading Overlay */
.tile-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 50;
    border-radius: 12px;
    backdrop-filter: blur(4px);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--white-10);
    border-left-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

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

.loading-text {
    color: var(--neutral-050);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.tile-progress-container {
    width: 70%;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    margin-top: 15px;
    overflow: hidden;
}

.tile-progress-bar {
    height: 100%;
    background: var(--accent-color);
    width: 0%;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.loading-text-detail {
    font-size: 0.75rem;
    color: var(--neutral-300);
    margin-top: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Pending Deletion Request Overlay */
.tile-pending-deletion-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 50;
    border-radius: 12px;
    backdrop-filter: blur(3px);
    color: #f0a030;
    text-align: center;
    padding: 20px;
    box-sizing: border-box;
}

.pending-deletion-text {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #f0a030;
}

.pending-deletion-subtext {
    font-size: 0.72rem;
    color: #ccc;
    margin-top: 6px;
    line-height: 1.4;
}

/* Documentation Section Separator */
.doc-section-separator {
    margin: 40px 0 20px 0;
    border-top: 1px solid var(--neutral-700);
    position: relative;
    padding-top: 20px;
}

.doc-section-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--neutral-400);
    background: var(--neutral-850);
    /* Match modal bg */
    padding: 5px 15px;
    border-radius: 20px;
    border: 1px solid var(--neutral-700);
    width: fit-content;
}

.doc-section-author {
    color: var(--accent-color);
    font-weight: 600;
    text-transform: uppercase;
}

/* User Profile Full Screen View */
.profile-view-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
}

.profile-header-large {
    display: flex;
    align-items: center;
    gap: 40px;
    margin-bottom: 60px;
    padding-bottom: 40px;
    border-bottom: 1px solid var(--neutral-700);
}

.profile-avatar-xl {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--accent-color);
    box-shadow: 0 0 30px rgba(77, 124, 253, 0.2);
}

.profile-info-large h1 {
    font-size: 2.5rem;
    margin: 0 0 10px 0;
    color: white;
}

.profile-email-large {
    color: var(--neutral-300);
    margin: 10px 0 0 0;
    font-size: 1.1rem;
}

.section-title-large {
    color: var(--neutral-300);
    text-transform: uppercase;
    font-size: 1rem;
    margin-bottom: 25px;
    letter-spacing: 2px;
}

.profile-onboarding-section {
    margin: 40px 0;
    padding: 30px;
    background: var(--white-02);
    border-radius: 12px;
    border: 1px solid var(--white-05);
}

.profile-onboarding-content {
    color: #ddd;
    line-height: 1.8;
    font-size: 1rem;
}

.profile-onboarding-content p {
    margin-bottom: 15px;
}

.profile-onboarding-content h1,
.profile-onboarding-content h2,
.profile-onboarding-content h3 {
    color: var(--neutral-050);
    margin-top: 20px;
    margin-bottom: 10px;
}

.profile-onboarding-content ul,
.profile-onboarding-content ol {
    margin-left: 20px;
    margin-bottom: 15px;
}

.profile-activity-section {
    margin-top: 40px;
}

.profile-activity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* Reusing .profile-activity-item styles but adjusting for grid */
.profile-activity-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.profile-activity-item:hover {
    border-color: var(--accent-color);
    transform: translateY(-3px);
    background: var(--white-05);
}

.activity-icon {
    font-size: 1.2rem;
}

.activity-info {
    flex: 1;
}

.activity-desc {
    font-size: 0.9rem;
    color: #ddd;
    margin-bottom: 3px;
}

.activity-date {
    font-size: 0.75rem;
    color: var(--neutral-400);
}

.clickable-author {
    cursor: pointer;
    color: var(--accent-color);
    transition: opacity 0.2s;
}

.clickable-author:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.doc-section-date {
    font-style: italic;
}

.load-more-btn {
    display: block;
    margin: 20px auto 0;
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--neutral-700);
    color: var(--neutral-300);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.load-more-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

/* Icon Styles */
.nav-tab i,
.btn i {
    font-size: 1.2em;
    vertical-align: middle;
    margin-right: 5px;
}

.btn i {
    margin-right: 0;
    /* For icon-only buttons */
}

.nav-tab i {
    margin-right: 10px;
}

/* ==================== ASTRA CHATBOT STYLES ==================== */

#tab-astra {
    margin-top: -25px; /* Pull up to reclaim some of the 40px parent padding */
    margin-bottom: -40px; /* Pull down to use the bottom padding space */
    overflow: hidden;
}

.astra-container {
    display: flex;
    height: calc(100vh - 110px); /* Fill the reclaimed space */
    gap: 20px;
}

.astra-sidebar {
    width: 300px;
    background: transparent;
    border: 1px solid #2F2F2F;
    border-radius: 25px;
    padding: 20px 15px; /* Reduced side padding */
    display: flex;
    flex-direction: column;
}

.astra-sidebar {
    transition: width 0.25s ease, padding 0.25s ease;
    overflow: hidden;
    box-sizing: border-box;
}

.astra-sidebar-header {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.astra-sidebar-toggle {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--neutral-700);
    border-radius: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.astra-sidebar-toggle:hover {
    background: var(--neutral-700);
    color: var(--text-primary);
}

.astra-sidebar-toggle i {
    font-size: 1.1rem;
}

.astra-sidebar.collapsed {
    width: 72px;
    align-items: center;
}

.astra-sidebar.collapsed #new-chat-btn,
.astra-sidebar.collapsed .chat-search-container,
.astra-sidebar.collapsed .chat-list {
    display: none;
}

.astra-sidebar.collapsed .astra-sidebar-header {
    margin-bottom: 0;
}

[data-theme="light"] .astra-sidebar-toggle {
    border-color: var(--border-subtle);
}

#new-chat-btn {
    flex: 1;
    min-width: 0;
    width: auto;
    margin-bottom: 0;
    background: var(--neutral-800) !important; /* Override .btn red background */
    border: 1px solid var(--neutral-700);
    color: var(--text-secondary); /* Grey text */
    border-radius: 20px; /* More rounded */
    box-shadow: none !important; /* Remove red shadow */
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-transform: none; /* Often .btn has uppercase */
    font-weight: 500;
    height: 42px; /* Match search input height */
    box-sizing: border-box;
}

#new-chat-btn:hover {
    background: var(--neutral-700) !important;
    color: var(--text-primary);
    transform: translateY(-1px);
    border-color: var(--neutral-600);
}

#new-chat-btn i {
    font-size: 0.9rem; /* Small icon */
}

/* Chat Search Styles */
.chat-search-container {
    position: relative;
    margin-bottom: 5px; /* Reduced margin */
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-subtle);
    width: 100%;
    display: flex;
    align-items: center;
}

#chat-search-input {
    width: 100%;
    background: transparent;
    border: 1px solid var(--neutral-700);
    border-radius: 20px; /* Match new chat button style */
    padding: 10px 15px 10px 40px; /* Space for icon */
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
    height: 42px; /* Match .btn height (10px padding top/bottom + ~22px line height) */
}

#chat-search-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(77, 124, 253, 0.1);
}

.search-icon {
    position: absolute;
    left: 15px;
    top: calc(50% - 7.5px); /* Adjust for padding-bottom of container */
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    font-size: 1rem;
}

[data-theme="light"] #chat-search-input {
    border-color: var(--border-subtle);
    color: var(--text-primary);
}

[data-theme="light"] #chat-search-input:focus {
    border-color: var(--accent-color);
}

.chat-list {
    flex: 1;
    overflow-y: auto;
    margin-top: 5px; /* Reduced margin */
    scrollbar-color: transparent transparent; /* Firefox: hidden until hover */
}

.chat-list:hover {
    scrollbar-color: var(--neutral-700) transparent;
}

.chat-list::-webkit-scrollbar-track {
    background: transparent;
}

.chat-list::-webkit-scrollbar-thumb {
    background: transparent;
}

.chat-list:hover::-webkit-scrollbar-thumb {
    background: var(--neutral-700);
}

/* Chat List Item Animation */
.chat-item {
    padding: 6px 8px; /* Reduced side padding */
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    margin-bottom: 0px;
    cursor: pointer;
    transition: all 0.2s;
    /* removed animation to prevent flickering */
}

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

.chat-item:hover {
    background: rgba(51, 51, 51, 0.3); /* Light grey with low opacity */
    border-color: rgba(51, 51, 51, 0.5);
}

.chat-item.active {
    background: var(--accent-dim);
    border-color: var(--accent-color);
}

.chat-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2px;
}

.chat-item-title {
    font-weight: 600;
    color: var(--neutral-050);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.chat-pin-icon {
    color: var(--accent-color);
    font-size: 0.8rem;
    margin-left: 5px;
}

.chat-item-actions {
    position: relative;
    opacity: 0;
    transition: opacity 0.2s;
    color: var(--neutral-400);
    padding: 0; /* Removing padding to fit larger icon */
    width: 24px; /* Fixed width */
    height: 24px; /* Fixed height to match line height */
    border-radius: 4px;
    margin-left: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-item-actions i {
    font-size: 1.5rem; /* Way bigger icon */
    line-height: 1;
}

.chat-item:hover .chat-item-actions,
.chat-item-actions:has(.chat-item-menu.show) {
    opacity: 1;
}

.chat-item-actions:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.chat-item-menu {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 5px; /* Added margin */
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 6px; /* Increased padding */
    min-width: 160px; /* Wider menu */
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3); /* Stronger shadow */
    z-index: 100;
    display: none;
}

.chat-item-menu.show {
    display: block;
}

.chat-menu-item {
    padding: 10px 14px; /* Bigger touch targets */
    display: flex;
    align-items: center;
    gap: 10px; /* More spacing */
    font-size: 0.9rem; /* Larger font */
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

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

.chat-menu-item.delete {
    color: #ff4444;
}

.chat-menu-item.delete:hover {
    background: rgba(255, 68, 68, 0.1);
}

/* Inline Edit Input */
.chat-title-input {
    background: var(--bg-secondary);
    border: 1px solid var(--neutral-700);
    color: var(--text-primary);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.85rem;
    width: 100%;
    outline: none;
    box-sizing: border-box;
    font-family: inherit;
    font-weight: 500;
}

.chat-item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2px;
    font-size: 0.75rem;
    color: var(--neutral-500);
}

.astra-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #0A0A0A;
    border-radius: 12px;
    overflow: hidden;
    border: none;
    position: relative; /* For the top separator */
}

/* Header removed */

.astra-chat::before {
    content: '';
    position: absolute;
    top: 0;
    left: 40px; /* Aligned with chat-input.theme-input-bg inside chat-input-container */
    right: 40px;
    height: 1px;
    background-color: var(--neutral-800);
    z-index: 10;
}

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

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

.welcome-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.welcome-message h3 {
    color: var(--neutral-050);
    margin-bottom: 10px;
    font-size: 1.5rem;
}

.welcome-message p {
    font-size: 1rem;
    color: var(--text-muted);
}

.chat-message {
    display: flex;
    flex-direction: column;
    animation: fadeInUp 0.3s ease-out;
    width: 100%;
}

[data-theme="light"] .onboarding-tile {
    background: linear-gradient(135deg, #fff0f3 0%, #ffe4e6 100%);
    border: 1px solid rgba(77, 124, 253, 0.2);
    box-shadow: 0 8px 32px rgba(77, 124, 253, 0.1);
}

[data-theme="light"] .onboarding-description {
    color: var(--text-secondary);
}

#mp-avatar-placeholder {
    color: var(--text-tertiary);
}

.mp-avatar-display {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 20px var(--black-30);
    border: 1px solid var(--border-subtle);
}

.chat-message.user {
    align-items: flex-end;
    align-self: flex-end; /* Double ensure right alignment */
}

.chat-message.assistant {
    align-items: flex-start;
}

.message-content {
    max-width: 70%;
    padding: 15px 20px;
    border-radius: 12px;
    line-height: 1.6;
}





.message-sources {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    max-width: 70%;
}

.source-citation {
    padding: 6px 14px;
    background: var(--accent-dim);
    border: 1px solid var(--accent-border);
    border-radius: 20px;
    color: var(--accent-color);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.source-citation:hover {
    background: rgba(77, 124, 253, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--accent-border);
}

.source-citation.file-source {
    background: rgba(33, 150, 243, 0.1);
    border: 1px solid rgba(33, 150, 243, 0.3);
    color: #2196f3;
}

.source-citation.file-source:hover {
    background: rgba(33, 150, 243, 0.2);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.2);
}

.badge-file {
    font-size: 0.7em;
    background: rgba(33, 150, 243, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
    font-weight: 600;
    text-transform: uppercase;
}

.no-sources-badge {
    margin-top: 12px;
    padding: 8px 16px;
    background: rgba(255, 165, 0, 0.08);
    border: 1px solid rgba(255, 165, 0, 0.25);
    border-radius: 8px;
    color: #ffa500;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 70%;
}

.no-sources-badge i {
    font-size: 1.1rem;
}

.source-tile {
    margin-top: 15px;
    background: var(--neutral-900);
    border: 1px solid var(--neutral-700);
    border-radius: 12px;
    padding: 20px;
    max-width: 70%;
    animation: slideDown 0.3s ease-out;
}

.source-tile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--neutral-800);
}

.source-meta {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
    flex-wrap: wrap;
}

.source-author {
    color: var(--accent-color);
    font-weight: 600;
}

.source-date {
    color: var(--neutral-400);
}

.source-similarity {
    color: var(--neutral-300);
    background: var(--white-05);
    padding: 2px 8px;
    border-radius: 10px;
}

.source-close {
    background: none;
    border: none;
    color: var(--neutral-400);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.source-close:hover {
    background: rgba(77, 124, 253, 0.2);
    color: var(--accent-color);
}

.source-content {
    color: var(--neutral-100);
    line-height: 1.6;
    font-size: 0.9rem;
}

.source-content p {
    margin-bottom: 10px;
}

.source-content ul,
.source-content ol {
    margin-left: 20px;
    margin-bottom: 10px;
}

.source-footer {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--neutral-800);
}

.source-footer a {
    color: var(--accent-color);
    text-decoration: none;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: opacity 0.2s;
}

.source-footer a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* Legacy chat input styles removed */
/* See modern styles at end of file */

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 15px 20px;
    background: var(--neutral-850);
    border: 1px solid var(--neutral-700);
    border-radius: 12px;
    max-width: fit-content;
    border-bottom-left-radius: 4px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-color);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
}

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

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

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
    }

    to {
        opacity: 1;
        max-height: 800px;
        padding-top: 20px;
        padding-bottom: 20px;
    }
}

@keyframes typingBounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-10px);
    }
}

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

    .astra-sidebar {
        width: 100%;
        max-height: 200px;
    }

    .astra-sidebar.collapsed {
        width: 100%;
        max-height: none;
        align-items: flex-start;
    }

    .message-content,
    .message-sources,
    .source-tile {
        max-width: 90%;
    }
}

/* ==================== DOCUMENTATION SEGMENT STYLES ==================== */

.doc-segment {
    display: block;
    margin-bottom: 16px;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    background: var(--bg-secondary);
    transition: all 0.2s;
    overflow: hidden;
}

.doc-segment:hover {
    border-color: var(--accent-color);
}

.segment-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    cursor: pointer;
    background: var(--bg-elevated);
    user-select: none;
}

@keyframes segment-shimmer {
    0%, 45%, 100% {
        box-shadow: 0 0 0 0 rgba(77, 124, 253, 0);
        border-color: var(--border-subtle);
        background: var(--bg-secondary);
    }
    20%, 65% {
        box-shadow: 0 0 15px 2px rgba(77, 124, 253, 0.4);
        border-color: var(--accent-color);
        background: var(--bg-tertiary);
        transform: scale(1.01);
    }
}

.doc-segment.highlight-pulse {
    animation: segment-shimmer 2s ease-out;
}

.segment-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
}

.segment-toggle-icon {
    font-size: 1.1rem;
    color: var(--text-tertiary);
    transition: transform 0.2s;
}

.doc-segment:not(.collapsed) .segment-toggle-icon {
    transform: rotate(90deg);
}

.segment-title-preview {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.segment-header-meta {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.segment-mini-preview {
    display: none;
    padding: 0 20px 12px 20px;
}

.doc-segment.collapsed .segment-mini-preview {
    display: block;
}

.segment-mini-preview img {
    height: 60px;
    width: 60px;
    object-fit: contain;
    background: var(--bg-tertiary);
    border-radius: 4px;
    border: 1px solid var(--border-subtle);
}

.segment-body-wrapper {
    display: flex;
    gap: 40px;
    padding: 24px;
    border-top: 1px solid var(--border-subtle);
}

.doc-segment.collapsed .segment-body-wrapper {
    display: none;
}

.segment-content {
    flex: 1;
    min-width: 0;
}

.segment-meta {
    width: 200px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    /* Removed sticky as it doesn't work well inside overflow hidden container */
    height: fit-content;
}

.segment-author,
.segment-debrief-link {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.segment-author:hover,
.segment-debrief-link:hover {
    opacity: 0.7;
    text-decoration: underline;
}

.segment-date {
    font-size: 13px;
    color: var(--neutral-400);
}

.segment-meta-label {
    font-size: 11px;
    color: var(--neutral-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.segment-meta-item {
    margin-bottom: 16px;
}

/* Responsive segments */
@media (max-width: 968px) {
    .doc-segment {
        flex-direction: column-reverse;
        gap: 20px;
    }

    .segment-meta {
        width: 100%;
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 16px;
        background: rgba(77, 124, 253, 0.03);
        border-left: 2px solid var(--accent-color);
        border-radius: 4px;
    }

    .segment-meta-item {
        margin-bottom: 0;
        margin-right: 24px;
    }
}


/* ==================== ADMIN SEGMENT CONTROLS ==================== */

.segment-admin-controls {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--neutral-800);
}

.segment-edit-btn,
.segment-delete-btn {
    padding: 6px 12px;
    border: 1px solid var(--neutral-700);
    background: transparent;
    color: var(--neutral-300);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.segment-edit-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: rgba(77, 124, 253, 0.05);
}

.segment-delete-btn:hover {
    border-color: var(--error-red);
    color: var(--error-red);
    background: rgba(204, 0, 0, 0.05);
}

/* Secure Deletion Modal Styles */

.warning-box {
    background: rgba(255, 200, 0, 0.1);
    border-left: 3px solid var(--warning-yellow);
    padding: 15px;
    border-radius: 6px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: var(--warning-yellow);
}

.warning-box strong {
    display: block;
    margin-bottom: 5px;
}

.confirmation-phrase {
    background: var(--neutral-850);
    padding: 12px 16px;
    border-radius: 6px;
    margin: 10px 0 15px 0;
    font-family: monospace;
    color: var(--accent-color);
    border: 1px solid var(--accent-border);
    font-size: 0.95rem;
}




/* ==================== TOAST NOTIFICATIONS ==================== */

#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: var(--neutral-850);
    border: 1px solid var(--neutral-700);
    border-radius: 8px;
    padding: 12px 16px;
    min-width: 280px;
    max-width: 400px;
    box-shadow: 0 4px 12px var(--black-50);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInRight 0.3s ease-out;
    pointer-events: auto;
    position: relative;
    overflow: hidden;
}

.toast.success {
    border-left: 3px solid var(--success-green);
}

.toast.error {
    border-left: 3px solid var(--error-red);
}

.toast.info {
    border-left: 3px solid var(--accent-color);
}

.toast.warning {
    border-left: 3px solid var(--warning-yellow);
}

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.toast.success .toast-icon {
    color: var(--success-green);
}

.toast.error .toast-icon {
    color: var(--error-red);
}

.toast.info .toast-icon {
    color: var(--accent-color);
}

.toast.warning .toast-icon {
    color: var(--warning-yellow);
}

.toast-content {
    flex: 1;
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Ensure toast text is dark in light mode for contrast */
[data-theme="light"] .toast {
    background: var(--neutral-950);
    border: 1px solid var(--neutral-300);
}

[data-theme="light"] .toast-content {
    color: var(--neutral-050);
}

[data-theme="light"] .toast-progress {
    background: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .toast .toast-icon {
    filter: brightness(0.8);
}

/* Ensure proper contrast in light mode for specific secondary elements */
[data-theme="light"] .team-member-email,
[data-theme="light"] .help-text,
[data-theme="light"] .settings-description,
[data-theme="light"] .modal-description,
[data-theme="light"] p.help-text {
    color: var(--neutral-200);
}

.toast-close {
    background: none;
    border: none;
    color: var(--neutral-400);
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.toast-close:hover {
    background: var(--white-10);
    color: var(--neutral-050);
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    animation: progressBar 3s linear;
}

.toast.success .toast-progress {
    background: var(--success-green);
}

.toast.error .toast-progress {
    background: var(--error-red);
}

.toast.info .toast-progress {
    background: var(--accent-color);
}

.toast.warning .toast-progress {
    background: var(--warning-yellow);
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

@keyframes progressBar {
    from {
        width: 100%;
    }

    to {
        width: 0%;
    }
}

.toast.removing {
    animation: slideOutRight 0.3s ease-out forwards;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    #toast-container {
        left: 20px;
        right: 20px;
        bottom: 20px;
    }

    .toast {
        min-width: auto;
        max-width: none;
    }
}

/* Conflict Resolution Viewer */
.conflict-viewer-header {
    padding-bottom: 40px;
    border-bottom: 1px solid var(--white-05);
    margin-bottom: 40px;
}

.conflict-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 30px;
    margin-bottom: 20px;
}

.conflict-title-section {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    flex: 1;
}

.conflict-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--neutral-050);
    margin: 0 0 8px 0;
    letter-spacing: -0.02em;
}

.conflict-doc-name {
    font-size: 1rem;
    color: var(--neutral-300);
    margin: 0;
}

.conflict-similarity-badge {
    background: rgba(255, 152, 0, 0.15);
    border: 1px solid rgba(255, 152, 0, 0.3);
    color: #ff9800;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
}

.conflict-description {
    color: var(--neutral-300);
    font-size: 1.05rem;
    line-height: 1.6;
    margin: 0;
}

.conflict-segments-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 50px;
}

/* AI Conflict Analysis Section */
.conflict-analysis-section {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    margin-top: 24px;
    margin-bottom: 0;
    background: rgba(255, 152, 0, 0.06);
    border: 1px solid rgba(255, 152, 0, 0.2);
    border-radius: 10px;
}

.conflict-analysis-header {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.conflict-analysis-header strong {
    color: #ff9800;
    font-size: 0.95rem;
}

.conflict-analysis-summary {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.5;
}

/* Conflict highlight for conflicting text parts */
mark.conflict-highlight {
    background: rgba(255, 152, 0, 0.18);
    color: inherit;
    padding: 1px 4px;
    border-radius: 3px;
    border-bottom: 2px solid #ff9800;
}

.conflict-segment {
    background: var(--white-02);
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--white-05);
    transition: all 0.3s ease;
}

.conflict-segment:hover {
    border-color: var(--white-10);
    background: rgba(255, 255, 255, 0.03);
}

.conflict-segment.existing-segment {
    border-left: 3px solid var(--accent-color);
}

.conflict-segment.new-segment {
    border-left: 3px solid var(--success-green-alt);
}

.segment-header {
    padding: 20px 24px;
    background: var(--white-02);
    border-bottom: 1px solid var(--white-05);
}

.segment-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--neutral-050);
}

.segment-label svg {
    opacity: 0.8;
}

/* Specific styling for segment meta inside conflict modal to align it properly */
.conflict-segment .segment-meta {
    width: auto;
    flex-shrink: initial;
    flex-direction: column;
    padding: 16px 24px 0 24px;
    gap: 4px;
}


.segment-content {
    padding: 24px;
    max-height: 500px;
    overflow-y: auto;
    line-height: 1.8;
    font-size: 0.95rem;
}

.conflict-resolution-section {
    padding-top: 40px;
    border-top: 1px solid var(--white-05);
}

.resolution-title {
    font-size: 1.3rem;
    color: var(--neutral-300);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 30px;
    font-weight: 600;
}

.resolution-options {
    display: grid;
    gap: 16px;
    margin-bottom: 30px;
}

.resolution-btn {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    width: 100%;
}

.resolution-btn:hover {
    background: var(--white-05);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateX(8px);
}

.resolution-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.replace-btn .resolution-icon {
    background: rgba(255, 87, 34, 0.15);
    border: 1px solid rgba(255, 87, 34, 0.3);
    color: #ff5722;
}

.replace-btn:hover .resolution-icon {
    background: rgba(255, 87, 34, 0.25);
    border-color: rgba(255, 87, 34, 0.5);
}

.keep-old-btn .resolution-icon {
    background: rgba(156, 39, 176, 0.15);
    border: 1px solid rgba(156, 39, 176, 0.3);
    color: #9c27b0;
}

.keep-old-btn:hover .resolution-icon {
    background: rgba(156, 39, 176, 0.25);
    border-color: rgba(156, 39, 176, 0.5);
}

.keep-both-btn .resolution-icon {
    background: rgba(33, 150, 243, 0.15);
    border: 1px solid rgba(33, 150, 243, 0.3);
    color: var(--info-blue);
}

.keep-both-btn:hover .resolution-icon {
    background: rgba(33, 150, 243, 0.25);
    border-color: rgba(33, 150, 243, 0.5);
}

.merge-btn .resolution-icon {
    background: rgba(76, 175, 80, 0.15);
    border: 1px solid rgba(76, 175, 80, 0.3);
    color: var(--success-green-alt);
}

.merge-btn:hover .resolution-icon {
    background: rgba(76, 175, 80, 0.25);
    border-color: rgba(76, 175, 80, 0.5);
}

.merge-btn.recommended {
    border-color: rgba(76, 175, 80, 0.3);
}

.resolution-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.resolution-name {
    font-size: 1.05rem;
    color: var(--neutral-050);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.recommended-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--success-green-alt) 0%, #66bb6a 100%);
    color: white;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
}

.resolution-desc {
    font-size: 0.9rem;
    color: var(--neutral-300);
    line-height: 1.5;
}

.conflict-cancel-btn {
    width: 100%;
    padding: 16px;
    background: transparent;
    border: 1px solid var(--white-10);
    border-radius: 10px;
    color: var(--neutral-300);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.conflict-cancel-btn:hover {
    background: var(--white-02);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--neutral-050);
}

/* Responsive */
@media (max-width: 1024px) {
    .conflict-segments-container {
        grid-template-columns: 1fr;
    }

    .conflict-header-top {
        flex-direction: column;
    }

    .conflict-similarity-badge {
        align-self: flex-start;
    }
}

/* Organization Settings Styles */
.settings-section {
    margin-bottom: 50px;
    padding-bottom: 40px;
    border-bottom: 1px solid var(--white-05);
}

.settings-section:last-of-type {
    border-bottom: none;
}

.settings-section-title {
    font-size: 1.4rem;
    color: var(--neutral-050);
    margin-bottom: 15px;
    font-weight: 700;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 12px;
}

.settings-section-title::before {
    content: '';
    width: 3px;
    height: 24px;
    background: linear-gradient(180deg, var(--accent-color), var(--accent-border));
    border-radius: 2px;
}

.settings-description {
    color: var(--neutral-300);
    font-size: 0.9rem;
    margin-bottom: 20px;
    line-height: 1.6;
}

/* ==================== PROFILE TAB STYLES ==================== */

.profile-avatar-upload {
    display: flex;
    align-items: center;
    gap: 30px;
    margin-top: 20px;
}

.profile-avatar-preview-container {
    position: relative;
    width: 150px;
    height: 150px;
}

.profile-avatar-preview,
.profile-avatar-placeholder {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent-color);
    background: var(--neutral-950);
}

.profile-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(77, 124, 253, 0.05);
}

.profile-avatar-preview {
    display: none;
}

.profile-upload-controls {
    flex: 1;
}

.profile-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 20px;
}

.profile-input,
.profile-textarea {
    width: 100%;
    padding: 12px 15px;
    background: var(--neutral-950);
    border: 1px solid var(--neutral-700);
    color: var(--neutral-050);
    border-radius: 8px;
    outline: none;
    transition: all 0.3s ease;
    font-family: var(--font-main);
    font-size: 0.95rem;
}

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

.profile-input:focus,
.profile-textarea:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-dim);
}

#save-profile-btn {
    margin-top: 30px;
    width: auto;
    min-width: 200px;
}

/* Responsive adjustments for profile tab */
@media (max-width: 768px) {
    .profile-avatar-upload {
        flex-direction: column;
        align-items: flex-start;
    }

    .profile-form-grid {
        grid-template-columns: 1fr;
    }
}

/* ==================== END PROFILE TAB STYLES ==================== */

.conflict-settings-container {
    background: var(--black-30);
    border: 1px solid var(--neutral-800);
    border-radius: 12px;
    padding: 30px;
    transition: all 0.3s ease;
}

.conflict-settings-container:hover {
    border-color: var(--accent-border);
    background: var(--white-02);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 1rem;
    color: #ddd;
    position: relative;
    padding: 15px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.checkbox-label:hover {
    background: rgba(77, 124, 253, 0.05);
}

/* Switch Styles */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--neutral-600);
    transition: .3s cubic-bezier(0.4, 0.0, 0.2, 1);
    border-radius: 24px;
}

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

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

.switch input:focus + .slider {
    box-shadow: 0 0 0 2px var(--bg-primary), 0 0 0 4px var(--accent-dim);
}

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

/* Settings Grid Layout */
.settings-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
    width: 100%;
}

@media (max-width: 1400px) {
    /* .settings-grid {
        grid-template-columns: repeat(2, 1fr);
    } */
}

@media (max-width: 768px) {
    /* .settings-grid {
        grid-template-columns: 1fr;
    } */
}

.settings-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    cursor: pointer;
    overflow: hidden;
}

.settings-card.accordion {
    padding: 0;
}

.settings-card-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
}

.settings-card-body {
    padding: 0 20px;
    max-height: 0;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.settings-card.expanded .settings-card-body {
    padding-bottom: 20px;
    opacity: 1;
    /* max-height set via JS for dynamic content */
}

/* ── Credit Usage card ──────────────────────────────────────────────── */
#credit-usage-card {
    cursor: default;
}
#credit-usage-card .settings-card-body {
    max-height: none;
    opacity: 1;
    overflow: visible;
    padding-bottom: 20px;
}
.credit-usage-numbers {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 12px;
}
.credit-usage-numbers #credit-usage-used {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
}
.credit-usage-numbers .credit-usage-sep,
.credit-usage-numbers #credit-usage-allowance {
    font-size: 1.1rem;
    color: var(--text-secondary);
}
.credit-usage-numbers .credit-usage-unit {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-left: 4px;
}
.credit-usage-bar {
    width: 100%;
    height: 10px;
    background: var(--bg-tertiary, rgba(255,255,255,0.08));
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 10px;
}
.credit-usage-bar-fill {
    height: 100%;
    width: 0%;
    border-radius: 6px;
    background: var(--accent-color, #4f8cff);
    transition: width 0.4s ease, background 0.3s ease;
}
.credit-usage-bar-fill.warn { background: #f5a623; }
.credit-usage-bar-fill.over { background: #e0455e; }
.credit-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(79, 140, 255, 0.15);
    color: var(--accent-color, #4f8cff);
}
.credit-badge.warn { background: rgba(245, 166, 35, 0.18); color: #f5a623; }
.credit-badge.over { background: rgba(224, 69, 94, 0.18); color: #e0455e; }

.settings-section-title {
    margin: 0; /* Remove default margin from flex item */
}

.settings-card-actions {
    display: flex;
    align-items: center;
}

.settings-info-icon {
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: default;
    transition: color 0.2s;
    margin-left: 8px; /* Spacing between title and icon */
}

.settings-info-icon:hover {
    color: var(--accent-color);
}


.expand-icon {
    font-size: 1.2rem;
    color: var(--text-secondary);
    transition: transform 0.3s ease;
}

.settings-card.expanded .expand-icon {
    transform: rotate(180deg);
}

.settings-card:hover {
    border-color: var(--accent-border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    padding-top: 15px; /* Add spacing between items */
}

/* First item in body needs separation or border? Maybe border-top for body content? */
/* Or just let padding handle it */

.setting-info {
    flex: 1;
    min-width: 0; /* Ensures flex item can shrink below content size */
    margin-right: 15px; /* Spacing between text and switch/control */
}

.setting-label {
    display: block;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: normal; /* Allow setting title to wrap */
}

.setting-help {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin: 0;
    white-space: normal; /* Allow help text to wrap */
    overflow-wrap: break-word; /* Ensure long words break */
}

/* Compact input styling for settings */
.settings-input {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border-primary);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-top: 8px;
}

.settings-input:focus {
    border-color: var(--accent-color);
    outline: none;
}


.checkbox-label span {
    font-weight: 500;
    flex: 1;
}

.help-text {
    color: var(--neutral-400);
    font-size: 0.85rem;
    margin-top: 5px;
    margin-left: 37px;
    line-height: 1.5;
}

.rules-header {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--neutral-800);
}

.rules-header h4 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rules-header h4::before {
    content: '';
    width: 4px;
    height: 20px;
    background: var(--accent-color);
    border-radius: 2px;
}

.conflict-rules-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.conflict-rule-item {
    background: var(--neutral-900);
    border: 1px solid var(--neutral-800);
    border-radius: 10px;
    padding: 20px;
    transition: all 0.3s ease;
}

.conflict-rule-item:hover {
    background: rgba(77, 124, 253, 0.03);
    border-color: var(--accent-border);
    transform: translateX(3px);
}

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

.rule-doc-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--neutral-050);
    display: flex;
    align-items: center;
    gap: 10px;
}

.rule-doc-name svg {
    opacity: 0.7;
}

.rule-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--neutral-300);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}



.rule-action-selector {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--neutral-800);
}

.rule-action-label {
    display: block;
    color: var(--neutral-300);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 12px;
    font-weight: 600;
}

.action-select {
    width: 100%;
    padding: 12px 15px;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--font-main);
}

.action-select:hover {
    border-color: var(--accent-glow);
}

.action-select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-dim);
}

.action-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.rule-disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* Auto-resolve rules section animation */
#auto-resolve-rules {
    animation: slideDown 0.4s ease-out;
    transform-origin: top;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enhanced checkbox animation */
.checkbox-label input[type="checkbox"]:checked {
    animation: checkboxPulse 0.4s ease;
}

@keyframes checkboxPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* Enhanced rule item interactions */
.conflict-rule-item.active {
    border-color: var(--accent-color);
    box-shadow: 0 0 15px rgba(77, 124, 253, 0.2);
}

/* Status indicator for rules */
.rule-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.rule-status.enabled {
    background: rgba(77, 124, 253, 0.15);
    color: var(--accent-color);
    border: 1px solid var(--accent-border);
}

.rule-status.disabled {
    background: var(--white-05);
    color: var(--neutral-400);
    border: 1px solid var(--neutral-700);
}


/* Doc Viewer Sidebar Layout */


.doc-viewer-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    /* Important for nested scrolling */
    height: 100%;
}

.doc-viewer-sidebar {
    width: 280px;
    background: var(--black-30);
    border-right: 1px solid var(--neutral-700);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.doc-viewer-main {
    flex: 1;
    overflow-y: auto;
    padding: 60px 80px;
    /* Restore original padding */
    display: flex;
    flex-direction: column;
}

.doc-viewer-header {
    width: calc(100% + 160px);
    margin: 0 -80px 30px -80px;
    padding: 0 80px 20px 80px;
    border-bottom: 1px solid var(--neutral-800);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
}

/* Doc Viewer Tags Sidebar */
.doc-viewer-tags-sidebar {
    width: 300px;
    background: var(--black-30);
    border-left: 1px solid var(--neutral-700);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
    padding: 0;
}

.tags-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px 20px;
    border-bottom: 1px solid var(--neutral-700);
}

.tags-sidebar-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--neutral-200);
    display: flex;
    align-items: center;
    gap: 8px;
}

.tags-sidebar-header .btn-icon {
    background: transparent;
    border: 1px solid var(--neutral-700);
    color: var(--neutral-400);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.tags-sidebar-header .btn-icon:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.tags-sidebar-header .btn-icon.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: var(--bg-color);
}

.tags-display {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tag-category {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tag-category-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--neutral-500);
    font-weight: 600;
}

.tag-category-value {
    font-size: 0.85rem;
    color: var(--neutral-200);
    background: var(--neutral-800);
    border: 1px solid var(--neutral-700);
    border-radius: 6px;
    padding: 6px 10px;
    display: inline-block;
    width: fit-content;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tag-category-value.empty {
    color: var(--neutral-600);
    font-style: italic;
    background: transparent;
    border: 1px dashed var(--neutral-700);
}

.tag-additional-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag-additional-item {
    font-size: 0.8rem;
    color: var(--accent-color);
    background: rgba(var(--accent-rgb, 99, 102, 241), 0.1);
    border: 1px solid rgba(var(--accent-rgb, 99, 102, 241), 0.25);
    border-radius: 20px;
    padding: 4px 12px;
}

/* Tags Editor Form */
.tags-editor {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.tag-edit-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tag-edit-group label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--neutral-500);
    font-weight: 600;
}

.tag-edit-group input {
    background: var(--neutral-900);
    border: 1px solid var(--neutral-700);
    border-radius: 6px;
    padding: 7px 10px;
    font-size: 0.85rem;
    color: var(--neutral-200);
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
    box-sizing: border-box;
}

.tag-edit-group input:focus {
    border-color: var(--accent-color);
}

.tag-edit-group input::placeholder {
    color: var(--neutral-600);
}

.tag-edit-group .tag-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.tag-suggestion-chip {
    font-size: 0.7rem;
    color: var(--neutral-400);
    background: var(--neutral-800);
    border: 1px solid var(--neutral-700);
    border-radius: 12px;
    padding: 2px 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.tag-suggestion-chip:hover {
    color: var(--accent-color);
    border-color: var(--accent-color);
}

/* ── Explore Tags Button & Panel ───────────────────────────────────── */
.explore-tags-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
    flex-shrink: 0;
}
.explore-tags-btn:hover {
    color: var(--accent-color);
    border-color: var(--accent-color);
    background: var(--bg-tertiary);
}
.explore-tags-btn.active {
    color: var(--accent-color);
    border-color: var(--accent-color);
    background: var(--accent-color-faint, rgba(99,102,241,0.08));
}
.explore-tags-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 420px;
    max-height: 400px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 120;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.explore-tags-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-primary);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
}
.explore-tags-content {
    overflow-y: auto;
    padding: 8px 0;
}
.explore-tags-category {
    padding: 6px 16px;
}
.explore-tags-category-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.explore-tags-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.explore-tag-chip {
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.explore-tag-chip:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: var(--accent-color-faint, rgba(99,102,241,0.08));
}
.explore-tag-chip.selected {
    border-color: var(--accent-color);
    background: var(--accent-color);
    color: #041120;
}

.tag-additional-edit {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.tag-additional-edit .tag-chip {
    font-size: 0.8rem;
    color: var(--accent-color);
    background: rgba(var(--accent-rgb, 99, 102, 241), 0.1);
    border: 1px solid rgba(var(--accent-rgb, 99, 102, 241), 0.25);
    border-radius: 20px;
    padding: 3px 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tag-additional-edit .tag-chip .remove-tag {
    cursor: pointer;
    opacity: 0.6;
    font-size: 0.9em;
}

.tag-additional-edit .tag-chip .remove-tag:hover {
    opacity: 1;
}

.tag-additional-edit .add-tag-input {
    background: transparent;
    border: 1px dashed var(--neutral-700);
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 0.8rem;
    color: var(--neutral-300);
    outline: none;
    min-width: 80px;
    width: 100px;
}

.tag-additional-edit .add-tag-input:focus {
    border-color: var(--accent-color);
}

.tags-editor-actions {
    display: flex;
    gap: 8px;
    padding-top: 6px;
    border-top: 1px solid var(--neutral-700);
}

.tags-editor-actions .btn {
    flex: 1;
    padding: 8px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
}

.tags-editor-actions .btn-save {
    background: var(--accent-color);
    color: #041120;
    border: none;
}

.tags-editor-actions .btn-save:hover {
    opacity: 0.9;
}

.tags-editor-actions .btn-cancel {
    background: transparent;
    color: var(--neutral-400);
    border: 1px solid var(--neutral-700);
}

.tags-editor-actions .btn-cancel:hover {
    border-color: var(--neutral-500);
    color: var(--neutral-300);
}

.debrief-viewer-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-color);
    padding: 0;
    overflow: hidden;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    text-align: left;
}

.debrief-viewer-close {
    position: fixed;
    top: 20px;
    right: 30px;
    background: transparent;
    border: 1px solid var(--neutral-700);
    color: var(--neutral-300);
    font-size: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.debrief-viewer-close:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    box-shadow: 0 0 20px var(--accent-border);
}

.debrief-viewer-header {
    max-width: 1600px;
    width: 95%;
    margin: 0 auto;
    padding: 30px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.debrief-viewer-header h1 {
    font-size: 2rem;
    margin: 0;
    background: linear-gradient(to right, var(--neutral-050), var(--neutral-300));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Hide scrollbar on debrief viewer for cleaner look */
.debrief-viewer-container::-webkit-scrollbar {
    width: 8px;
}

.debrief-viewer-container::-webkit-scrollbar-track {
    background: transparent;
}

.debrief-viewer-container::-webkit-scrollbar-thumb {
    background: var(--neutral-800);
    border-radius: 4px;
}

.debrief-viewer-container::-webkit-scrollbar-thumb:hover {
    background: var(--neutral-700);
}

/* Organization Badge on Landing Page */
.org-badge {
    display: inline-block;
    margin-bottom: 20px;
    padding: 1px;
    /* Border width */
    background: linear-gradient(45deg, var(--accent-color), transparent);
    border-radius: 12px;
    animation: fadeIn 1s ease-out;
}

.org-badge-content {
    background: rgba(20, 20, 20, 0.8);
    backdrop-filter: blur(10px);
    padding: 10px 20px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    gap: 15px;
}

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

.org-details {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.org-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--neutral-050);
}

.org-stats {
    font-size: 0.8rem;
    color: var(--neutral-300);
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Integrated Dashboard Call Interface panels */

.phone-summary-panel {
    flex: 0 0 45%;
    min-width: 0;
    background: var(--bg-primary) !important;
    border-right: 1px solid var(--border-primary) !important;
    padding: 35px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    color: var(--text-primary);
}

.interview-topic-header {
    flex-shrink: 0;
    margin-bottom: 25px;
}

.topic-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--accent-color);
    font-weight: 700;
    display: block;
    margin-bottom: 6px;
}

.phone-summary-panel h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

.phone-summary-panel .topic-description {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-muted);
    margin-bottom: 0;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
}

.phone-summary-panel .summary-section-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-primary);
    padding-bottom: 8px;
}

/* Live Summary Notepad Document Styles */
.research-sources-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    flex-shrink: 0;
    overflow: visible !important; /* Allow source citations layout and hover effects to overflow without clipping */
}

.research-source-strip {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-primary) !important;
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    transition: all 0.2s ease;
    width: 100%;
    min-height: 38px;
    height: auto;
    flex-shrink: 0;
    box-sizing: border-box;
    cursor: pointer;
    overflow: hidden;
}

.research-source-strip-header {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 22px;
    flex-shrink: 0;
}

.research-source-strip:hover {
    border-color: var(--accent-color) !important;
    background: var(--bg-tertiary) !important;
}

.research-source-strip .source-icon {
    font-size: 1rem;
    color: var(--accent-color);
    flex-shrink: 0;
}

.research-source-strip .source-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    text-align: left;
}

.research-source-strip .source-doc {
    font-size: 0.72rem;
    color: var(--accent-color);
    background: var(--accent-dim);
    border: 1px solid var(--accent-border);
    padding: 3px 10px;
    border-radius: 20px;
    max-width: 130px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    font-weight: 600;
}

.research-source-strip .source-caret {
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.research-source-strip.expanded .source-caret {
    transform: rotate(90deg);
}

.research-source-body {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.25s cubic-bezier(0, 1, 0, 1), opacity 0.2s ease, padding 0.2s ease;
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--text-secondary);
    text-align: left;
    border-top: 0px solid transparent;
    padding-top: 0;
    margin-top: 0;
}

.research-source-strip.expanded .research-source-body {
    max-height: 200px;
    opacity: 1;
    border-top: 1px solid var(--border-subtle);
    padding-top: 8px;
    margin-top: 8px;
    transition: max-height 0.25s cubic-bezier(0.85, 0, 0.15, 1), opacity 0.2s ease, padding 0.2s ease;
}

.live-summary-document-container {
    flex: 1 1 0; /* Grow, shrink, and prioritize shrinking to fit available space */
    display: flex;
    flex-direction: column;
    min-height: 0; /* Allow the container to shrink automatically to make space for expanded headers */
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 14px;
    overflow: hidden;
    position: relative;
    box-shadow: none;
}

.live-summary-document {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.live-doc-header {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-primary);
    padding: 12px 20px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.live-indicator-pulsar {
    width: 8px;
    height: 8px;
    background: #606060;
    border-radius: 50%;
    transition: all 0.3s;
}

.live-indicator-pulsar.active {
    background: #10B981; /* bright emerald accent */
    box-shadow: 0 0 10px #10B981;
    animation: livePulse 2s infinite;
}

@keyframes livePulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.live-doc-body {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.live-doc-body.placeholder-state {
    justify-content: flex-start;
    opacity: 0.85;
}

.live-doc-section {
    position: relative;
    border-left: 2px solid #2F2F2F; /* vertical outline timeline */
    padding-left: 18px;
    transition: all 0.3s ease;
}

.live-doc-section h4 {
    color: var(--accent-color);
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: none;
    margin: 0 0 12px 0px;
    letter-spacing: 0.5px;
}

.live-doc-section ul {
    margin: 15px 0 0 0;
    padding-left: 18px;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
}

.live-doc-section li {
    margin-bottom: 8px;
}

.live-doc-section li strong {
    color: var(--text-primary);
}

.live-doc-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 10px 0;
}

.doc-badge {
    font-size: 0.65rem;
    font-weight: 700;
    background: var(--border-primary);
    color: var(--text-muted);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    text-transform: uppercase;
}

.live-doc-paragraph {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-muted);
    margin: 0;
}

.live-doc-typing-element {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding-left: 18px;
    margin-top: 10px;
    color: var(--text-muted);
    font-size: 0.85rem;
    animation: fadeIn 0.5s ease-out;
}

.typing-dot {
    width: 5px;
    height: 5px;
    background-color: var(--text-muted);
    border-radius: 50%;
    opacity: 0.4;
    animation: typingBlink 1.4s infinite both;
}

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

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

@keyframes typingBlink {
    0% {
        opacity: 0.2;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
    100% {
        opacity: 0.2;
        transform: scale(0.8);
    }
}

.typing-text {
    font-style: italic;
    margin-left: 4px;
    font-size: 0.8rem;
}

.anim-slide-up {
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

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

.anim-slide-down {
    animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.summary-points-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

/* Research sources cards in the phone left panel */
.research-sources-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
}

.research-source-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-left: 3px solid var(--accent-color);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: box-shadow 0.2s ease;
}

.research-source-card:hover {
    box-shadow: 0 3px 12px rgba(77, 124, 253, 0.15);
}

.research-source-card .source-idx {
    font-size: 0.68rem;
    font-weight: 700;
    background: var(--accent-dim);
    color: var(--accent-color);
    padding: 2px 7px;
    border-radius: 5px;
    align-self: flex-start;
    margin-bottom: 4px;
}

.research-source-card .source-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.research-source-card .source-doc {
    font-size: 0.75rem;
    color: var(--accent-color);
    opacity: 0.85;
    margin-bottom: 6px;
}

.research-source-card .source-snippet {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.research-source-loading {
    font-size: 0.82rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
}


.summary-point-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 20px;
    aspect-ratio: 1 / 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.summary-point-card:hover {
    border-color: var(--accent-color);
    box-shadow: 0 4px 20px rgba(77, 124, 253, 0.2);
    transform: translateY(-3px);
}

.summary-point-card .point-idx {
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--accent-dim);
    color: var(--accent-color);
    padding: 3px 8px;
    border-radius: 6px;
    margin-bottom: 15px;
}

.summary-point-card .point-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.4;
}

.summary-point-card .point-desc {
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
}

.phone-chat-panel {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    height: 100%;
    background: var(--bg-primary) !important;
    border-left: none !important; /* thin vertical divider */
}

/* --- Panel Resizer --- */
.phone-panel-resizer {
    flex: 0 0 3px;
    width: 3px;
    height: 100%;
    cursor: col-resize;
    background: var(--border-primary);
    position: relative;
    z-index: 300;
    transition: background 0.2s ease;
    display: flex;
    align-items: center; /* Centered in the middle of the screen */
    justify-content: center;
}

.phone-panel-resizer:hover,
.phone-panel-resizer.dragging {
    background: var(--neutral-700);
}

.phone-panel-resizer-handle {
    width: 1px;
    height: 30px;
    border-radius: 1px;
    background: rgba(255, 255, 255, 0.2);
    pointer-events: none;
    transition: background 0.2s ease, height 0.2s ease;
}

.phone-panel-resizer:hover .phone-panel-resizer-handle,
.phone-panel-resizer.dragging .phone-panel-resizer-handle {
    height: 45px;
    background: rgba(255, 255, 255, 0.45);
}

[data-theme="light"] .phone-panel-resizer-handle {
    background: rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .phone-panel-resizer:hover .phone-panel-resizer-handle,
[data-theme="light"] .phone-panel-resizer.dragging .phone-panel-resizer-handle {
    background: rgba(0, 0, 0, 0.5);
}

/* Reset button on resizer */
.phone-panel-reset-btn {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px) saturate(140%);
    -webkit-backdrop-filter: blur(8px) saturate(140%);
    color: var(--text-secondary);
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.15s ease;
    z-index: 10;
    padding: 0;
    pointer-events: all;
}

.phone-panel-reset-btn::after {
    content: attr(title);
    position: absolute;
    top: 28px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    background: var(--bg-elevated, #1a1a1a);
    color: var(--text-primary);
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--border-primary);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.phone-panel-reset-btn:hover::after {
    opacity: 1;
}

.phone-panel-resizer:hover .phone-panel-reset-btn {
    opacity: 1;
}

.phone-panel-reset-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    color: var(--text-primary);
    transform: translateX(-50%) scale(1.15);
}

[data-theme="light"] .phone-panel-reset-btn {
    border-color: rgba(0, 0, 0, 0.12);
    background: rgba(255, 255, 255, 0.6);
    color: var(--text-secondary);
}

[data-theme="light"] .phone-panel-reset-btn:hover {
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-primary);
}
/* --- Panel Resizer end --- */

.phone-chat-panel .call-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
    background: rgba(255, 255, 255, 0.06) !important;
    backdrop-filter: blur(12px) saturate(160%) !important;
    -webkit-backdrop-filter: blur(12px) saturate(160%) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.10) !important;
}

.phone-chat-panel .call-content {
    flex: 1;
    position: relative;
    width: 100%;
    min-height: 0;
    overflow: hidden;
}

.phone-chat-panel .call-chat-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 80px 24px 130px 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.phone-chat-panel .call-controls-container {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    min-width: 480px !important; /* Increased length/width of the container */
    padding: 16px 32px 24px 32px; /* Pad the bottom edge slightly more to enhance the floating effect */
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.06) !important; /* Liquid glass background */
    backdrop-filter: blur(12px) saturate(160%) !important; /* Liquid glass backdrop filter */
    -webkit-backdrop-filter: blur(12px) saturate(160%) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important; /* Subtle translucent border */
    border-radius: 40px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.10) !important; /* Premium liquid glass shadow */
    z-index: 200; /* Must be higher than .call-chat-container's z-index (100) to receive click events */
}

.call-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent);
    z-index: 10;
}

.call-status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-primary) !important;
    border: 1px solid var(--border-primary) !important;
    padding: 8px 16px;
    border-radius: 20px;
    color: var(--text-primary) !important;
    flex-shrink: 0;
}

/* --- Call Progress Bar --- */
.call-progress-bar {
    width: 100%;
    height: 14px;
    border-radius: 7px;
    background: var(--bg-primary) !important;
    border: 1px solid var(--border-primary) !important;
    overflow: hidden;
    position: relative;
}

.call-progress-bar-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0%;
    /* No border-radius — parent's overflow:hidden + border-radius clips it cleanly */
    border-radius: 0;
    background: var(--accent-color);
    will-change: width;
}

/* Fixed-width gradient overlay at the leading edge — never stretches */
.call-progress-bar-fill::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 64px;
    background: linear-gradient(to right, var(--accent-color), var(--bg-primary));
    pointer-events: none;
}
/* --- Call Progress Bar end --- */

.status-dot {
    width: 10px;
    height: 10px;
    background: var(--accent-color);
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
    transition: opacity 0.4s ease;
}

/* Thinking / Connecting / Processing — ripple rings via pseudo-elements */
.status-dot.thinking::before,
.status-dot.thinking::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--accent-color);
    opacity: 0;
}
.status-dot.thinking::before {
    animation: status-ripple 1.8s cubic-bezier(0.2, 0.6, 0.4, 1) infinite 0s;
}
.status-dot.thinking::after {
    animation: status-ripple 1.8s cubic-bezier(0.2, 0.6, 0.4, 1) infinite 0.75s;
}
@keyframes status-ripple {
    0%   { transform: translate(-50%, -50%) scale(1);   opacity: 0.55; }
    100% { transform: translate(-50%, -50%) scale(3.8); opacity: 0; }
}

/* Listening — gentle slow pulse */
.status-dot.listening {
    animation: status-listen 2s ease-in-out infinite;
}
@keyframes status-listen {
    0%, 100% { transform: scale(1);    opacity: 0.65; box-shadow: 0 0 0    0    rgba(77, 124, 253, 0);    }
    50%       { transform: scale(1.2); opacity: 1;    box-shadow: 0 0 10px 5px rgba(77, 124, 253, 0.3); }
}

/* Speaking — quick energetic glow */
.status-dot.speaking {
    animation: status-speak 0.65s ease-in-out infinite alternate;
}
@keyframes status-speak {
    from { transform: scale(1);   opacity: 0.8; box-shadow: 0 0 5px  2px rgba(77, 124, 253, 0.25); }
    to   { transform: scale(1.3); opacity: 1;   box-shadow: 0 0 14px 6px rgba(77, 124, 253, 0.55); }
}

/* Paused — slow single ripple ring, dimmed core */
.status-dot.paused {
    opacity: 0.5;
    animation: status-paused-core 3s ease-in-out infinite;
}
.status-dot.paused::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--accent-color);
    opacity: 0;
    animation: status-paused-ripple 3s cubic-bezier(0.2, 0.6, 0.4, 1) infinite 0s;
}
.status-dot.paused::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--accent-color);
    opacity: 0;
    animation: status-paused-ripple 3s cubic-bezier(0.2, 0.6, 0.4, 1) infinite 1.5s;
}
@keyframes status-paused-ripple {
    0%   { transform: translate(-50%, -50%) scale(1);   opacity: 0.4; }
    100% { transform: translate(-50%, -50%) scale(4.2); opacity: 0;   }
}
@keyframes status-paused-core {
    0%, 100% { opacity: 0.35; }
    50%       { opacity: 0.65; }
}

.minimize-btn {
    background: transparent;
    border: none;
    color: var(--neutral-050);
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s;
    flex-shrink: 0;
}

.minimize-btn:hover {
    opacity: 1;
}

.call-content {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Chat Container */
.call-chat-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 20px;
    padding-bottom: 160px;
    /* Space for fixed controls */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    mask-image: linear-gradient(to bottom, transparent, black 10%, black 90%, transparent);
    -webkit-mask-image: linear-gradient(to bottom, transparent, black 10%, black 90%, transparent);
}

/* ... (other styles remain) ... */

.chat-message {
    max-width: 80%;
    padding: 15px 20px;
    border-radius: 20px;
    font-size: 1.1rem;
    line-height: 1.5;
    /* animation: message-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); Removed for smoother typing */
}

@keyframes message-pop {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ai-message {
    align-self: flex-start;
    background: var(--bg-secondary) !important;
    border-bottom-left-radius: 5px;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-primary) !important;
}

.user-message {
    align-self: flex-end;
    background: var(--accent-color) !important;
    border-bottom-right-radius: 5px;
    color: #ffffff !important;
    border: 1px solid var(--accent-color) !important;
}

/* Live transcription: smooth left-to-right reveal for newly added characters */
@keyframes liveTextReveal {
    from {
        mask-position: 200% 0;
        -webkit-mask-position: 200% 0;
    }
    to {
        mask-position: 0% 0;
        -webkit-mask-position: 0% 0;
    }
}
.live-text-reveal {
    mask-image: linear-gradient(to right, black 70%, transparent 100%);
    mask-size: 200% 100%;
    mask-repeat: no-repeat;
    -webkit-mask-image: linear-gradient(to right, black 70%, transparent 100%);
    -webkit-mask-size: 200% 100%;
    -webkit-mask-repeat: no-repeat;
    animation: liveTextReveal 0.45s ease-out forwards;
}

/* Collapse consecutive same-sender bubbles */
.call-chat-container .user-message + .user-message {
    margin-top: -10px;
    border-top-right-radius: 5px;
}
.call-chat-container .ai-message + .ai-message {
    margin-top: -10px;
    border-top-left-radius: 5px;
}

/* Audio Visualizer */
.audio-visualizer-container {
    position: absolute;
    bottom: 150px;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    height: 100px;
    z-index: 5;
    pointer-events: none;
    display: none;
    /* Hidden as requested */
}

#audio-visualizer {
    width: 100%;
    height: 100%;
}

/* Live Transcription Overlay */
.live-transcription-overlay {
    position: absolute;
    bottom: 150px;
    /* Moved up to avoid controls */
    left: 0;
    width: 100%;
    text-align: center;
    padding: 0 20px;
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.7);
    text-shadow: 0 2px 4px var(--black-50);
    pointer-events: none;
    display: none;
    /* Hidden as requested */
}

/* Controls - inside .phone-chat-panel which is position:relative */

.call-controls {
    display: flex;
    gap: 40px;
    align-items: center;
}

.control-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 1px solid var(--border-primary);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    justify-content: center;
    align-items: center;
}

.control-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-color);
    transform: scale(1.1);
}

.control-btn.active {
    background: #4a5568;  /* Crisp dark charcoal gray */
    color: #ffffff;       /* Contrast high visibility white icon */
    border-color: #718096; /* Modern cool gray border */
    box-shadow: 0 0 15px rgba(74, 85, 104, 0.4);
    animation: none; /* Removed pulse animation for cleaner look */
}

.hangup-btn {
    background: #ff3b30;
    width: 70px;
    height: 70px;
    font-size: 2rem;
    color: #ffffff;
}

.hangup-btn:hover {
    background: #ff453a;
    border-color: #ff3b30;
    color: #000000;
    box-shadow: 0 0 30px rgba(255, 59, 48, 0.4);
}

.send-btn-floating {
    position: absolute;
    right: 40px;
    bottom: 40px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--accent-color);
    border: none;
    color: var(--neutral-050);
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(77, 124, 253, 0.4);
    transition: all 0.3s;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* --- AI Status Dot (thinking / typing indicator) --- */
.ai-status-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 2px;
    vertical-align: middle;
    position: relative;
    flex-shrink: 0;
}

.ai-status-dot .dot-core {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-color);
    position: relative;
    z-index: 1;
    transition: transform 0.2s ease;
}

/* Ripple rings – only visible while thinking */
.ai-status-dot .dot-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    margin-top: -5px;
    margin-left: -5px;
    border-radius: 50%;
    background: var(--accent-color);
    opacity: 0;
    transform: scale(1);
    pointer-events: none;
}

.ai-status-dot.thinking .dot-ring:nth-child(1) {
    animation: ai-ripple 1.8s cubic-bezier(0.2, 0.6, 0.4, 1) infinite 0s;
}
.ai-status-dot.thinking .dot-ring:nth-child(2) {
    animation: ai-ripple 1.8s cubic-bezier(0.2, 0.6, 0.4, 1) infinite 0.6s;
}
.ai-status-dot.thinking .dot-ring:nth-child(3) {
    animation: ai-ripple 1.8s cubic-bezier(0.2, 0.6, 0.4, 1) infinite 1.2s;
}

@keyframes ai-ripple {
    0%   { transform: scale(1);   opacity: 0.55; }
    100% { transform: scale(3.6); opacity: 0; }
}

/* Fade-in animation for typewriter characters */
@keyframes char-appear {
    from { opacity: 0; transform: translateY(3px); }
    to   { opacity: 1; transform: translateY(0); }
}

.chat-char {
    display: inline;
    animation: char-appear 0.18s ease forwards;
}

/* --- AI Status Dot end --- */

/* --- Speaking animation: pulse rings --- */

.call-controls-container {
    overflow: visible !important;  /* allow canvas rings to extend outside */
}

.call-controls-container.user-talking {
    border-color: rgba(77, 124, 253, 0.35) !important;
    transition: border-color 0.3s ease;
}

/* --- Speaking animation end --- */

/* Send button removed */

/* Chat Container */
.call-chat-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 20px;
    padding-bottom: 160px;
    /* Space for fixed controls */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 100;
    /* Ensure visibility */
    mask-image: none !important;
    -webkit-mask-image: none !important;
}
/* --- UI Utilities for Theme Compatibility --- */
.theme-card-bg {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-primary) !important;
}

.theme-input-bg {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-primary) !important;
    color: var(--text-primary) !important;
}

.theme-input-bg:disabled {
    color: var(--text-muted) !important;
    background: var(--bg-tertiary) !important;
}

.theme-text-primary {
    color: var(--text-primary) !important;
}

.theme-text-muted {
    color: var(--text-muted) !important;
}

.theme-text-secondary {
    color: var(--text-secondary) !important;
}

/* --- Light Mode Call UI Overrides --- */

[data-theme="light"] .phone-interface {
    background: var(--bg-primary);
}

[data-theme="light"] .phone-summary-panel {
    background: var(--neutral-100);
    border-right: 1px solid var(--border-primary);
}

[data-theme="light"] .summary-point-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
}

[data-theme="light"] .phone-chat-panel .call-controls-container {
    background: rgba(255, 255, 255, 0.4) !important; /* Semi-transparent white for liquid effect in light theme */
    backdrop-filter: blur(12px) saturate(160%) !important; /* Liquid glass backdrop filter */
    -webkit-backdrop-filter: blur(12px) saturate(160%) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important; /* Subtle translucent border */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.5) !important; /* Soft depth shadow */
}

[data-theme="light"] .phone-chat-panel .call-header {
    background: rgba(255, 255, 255, 0.4) !important;
    backdrop-filter: blur(12px) saturate(160%) !important;
    -webkit-backdrop-filter: blur(12px) saturate(160%) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.5) !important;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
}

[data-theme="light"] .ai-message {
    background: var(--neutral-200);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
}

[data-theme="light"] .live-transcription-overlay {
    color: var(--text-secondary);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

[data-theme="light"] .control-btn:hover {
    background: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .user-message {
    color: #ffffff;
}

/* Action Menu Popup */
.action-menu-popup {
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 100;
    min-width: 160px;
    overflow: hidden;
    padding: 5px 0;
}

.menu-item {
    padding: 10px 15px;
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--text-primary);
    transition: background 0.2s;
    white-space: nowrap;
}

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

.menu-item.text-danger {
    color: #ff4d4d;
}

.menu-item.text-danger:hover {
    background: rgba(255, 77, 77, 0.1);
}

/* Onboarding Page Styles */
.onboarding-page-container {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    grid-column: 1 / -1;
}

.onboarding-header {
    text-align: center;
    margin-bottom: 3rem;
}

.onboarding-header .ph-target {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--accent-color);
}

.onboarding-header h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.onboarding-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.6;
}

.upload-section {
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 40px;
    text-align: center;
    border: 1px solid var(--border-primary);
}

.upload-section h3 {
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text-primary);
}

.upload-section p {
    font-size: 0.9rem;
    margin-bottom: 20px;
    color: var(--text-muted);
}

.drop-zone {
    border: 2px dashed var(--border-primary);
    padding: 40px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-tertiary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.no-sources-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 16px;
    background: rgba(255, 152, 0, 0.1); 
    border: 1px solid rgba(255, 152, 0, 0.3);
    color: var(--warning-color);
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 8px;
}

.no-sources-badge.context-badge {
    background: rgba(33, 150, 243, 0.1);
    border: 1px solid rgba(33, 150, 243, 0.3);
    color: #2196F3;
}

.no-sources-badge i {
    font-size: 1rem;
}

/* Specific background override for light mode to match screenshot contrast */
[data-theme="light"] .drop-zone {
    background: var(--neutral-850); /* #e9ecef */
    border-color: var(--neutral-600); /* Darker border for contrast */
}

/* Light mode hover */
[data-theme="light"] .drop-zone:hover {
    background: var(--neutral-800);
    border-color: var(--accent-color);
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--accent-color);
    background: var(--bg-elevated);
}

.drop-zone i {
    font-size: 2.5rem;
    margin-bottom: 15px;
    display: block;
    color: var(--text-muted);
}

.drop-zone p {
    margin: 0;
    color: var(--text-muted);
}

.onboarding-action {
    text-align: center;
}

.onboarding-start-btn {
    padding: 16px 48px;
    font-size: 1.2rem;
    border-radius: 8px;
    background: var(--accent-color);
    color: #041120;
    border: none;
    cursor: pointer;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: opacity 0.2s;
}

.onboarding-start-btn:hover {
    opacity: 0.9;
}

.onboarding-details {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 40px;
    color: var(--text-muted);
}

.onboarding-detail-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.upload-status {
    margin-top: 15px;
    font-size: 0.9rem;
    min-height: 20px;
}

.upload-status.success {
    color: var(--success-green);
}

.upload-status.error {
    color: var(--error-red);
}

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

.drop-zone.success {
    border-color: var(--success-green);
    background: rgba(76, 175, 80, 0.05);
}


/* Onboarding Document Preview Tile */
.doc-preview-tile {
    display: flex;
    align-items: center;
    gap: 15px;
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border-primary);
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    text-align: left;
}

.drop-zone.has-file {
    border: none;
    background: transparent;
    padding: 0;
    box-shadow: none;
}

.doc-preview-visual {
    width: 60px;
    height: 80px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border: 1px solid var(--border-primary);
    flex-shrink: 0;
}

.doc-preview-visual i {
    font-size: 32px;
    color: var(--text-muted);
}

.doc-preview-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.6);
    color: white;
    font-size: 9px;
    padding: 2px;
    text-align: center;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
}

.doc-preview-info {
    flex: 1;
    overflow: hidden;
}

.doc-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

/* Onboarding Stepper */
.stepper-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    margin-bottom: 2rem;
    position: relative;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    z-index: 1;
}

/* Use pseudo-elements for lines instead of the div to ensure perfect alignment */
.stepper-line {
    display: none;
}

.step-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: transparent;
    padding: 0 10px;
    flex: 1;
    text-align: center;
}

/* Connecting lines */
.step-item::after {
    content: '';
    position: absolute;
    top: 16px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: var(--neutral-700);
    z-index: -1;
    transform: translateY(-50%);
}

/* Hide line for last item */
.step-item:last-child::after {
    display: none;
}

/* Completed steps have red connecting line to the next step */
.step-item.completed::after {
    background: var(--accent-color);
}

.step-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 2px solid var(--neutral-700); /* Default gray border */
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    transition: all 0.3s ease;
    position: relative; /* Ensure it sits on top of line */
    z-index: 2;
}

/* Active means current step: Gray fill, Red Outline, Red Glow */
.step-item.active .step-circle {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    color: var(--text-primary);
    box-shadow: 0 0 0 3px rgba(77, 124, 253, 0.1);
}

/* Completed means finished step: Red fill, Red Outline */
.step-item.completed .step-circle {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
    box-shadow: none;
}

/* Ensure current step (active but not completed) keeps its gray fill */
.step-item.active:not(.completed) .step-circle {
    background: var(--bg-secondary);
}

.step-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.step-item.active .step-label {
    color: var(--text-primary);
    font-weight: 700;
}

.onboarding-step-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.onboarding-step-content.active {
    display: block;
}

/* Step 2 Audio Test */
.audio-test-section {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-primary);
    margin: 20px 0;
    text-align: center;
}

.audio-test-section h3 {
    margin-bottom: 10px;
    color: var(--text-primary);
    font-size: 1.3rem;
    font-weight: 700;
}

.audio-test-section p {
    color: var(--text-muted);
    margin-bottom: 20px;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Audio test card containers */
.audio-test-section > div > div {
    background: var(--neutral-900) !important;
    border: 1px solid var(--neutral-800) !important;
    transition: all 0.3s ease;
}

.audio-test-section > div > div:hover {
    border-color: var(--accent-border) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--black-50);
}

/* Audio test buttons - match app button style */
.audio-test-section .btn-secondary {
    background: transparent;
    border: 1px solid var(--neutral-700);
    color: var(--text-primary);
    padding: 12px 24px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    border-radius: 8px;
}

.audio-test-section .btn-secondary:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: #041120;
    transform: translateY(-1px);
    box-shadow: 0 0 15px var(--accent-border);
}

.audio-test-section .btn-secondary:active {
    transform: translateY(0);
}

.audio-level-meter {
    width: 100%;
    height: 10px;
    background: var(--bg-tertiary);
    border-radius: 5px;
    overflow: hidden;
    margin-top: 10px;
}

.audio-level-fill {
    height: 100%;
    width: 0%;
    background: var(--success-green);
    transition: width 0.1s linear;
}

/* Onboarding back button - subtle style */
.onboarding-back-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 8px 16px;
    margin-top: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-transform: none;
    letter-spacing: 0;
}

.onboarding-back-btn:hover {
    color: var(--text-secondary);
    transform: translateX(-2px);
}

.onboarding-back-btn i {
    font-size: 1rem;
}


/* Debrief Detail Layout */
.debrief-detail-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    height: 100%;
}

.debrief-notes-section, .debrief-transcript-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 20px;
    overflow-y: auto;
    max-height: calc(100vh - 150px);
}

.debrief-notes-section h2, .debrief-transcript-section h2 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.5rem;
    color: var(--accent-color);
    border-bottom: 1px solid var(--border-primary);
    padding-bottom: 10px;
}

.transcript-item {
    margin-bottom: 15px;
    padding: 10px;
    border-radius: 8px;
    background: var(--bg-tertiary);
}

.transcript-item.ai-message {
    border-left: 3px solid var(--accent-color);
}

.transcript-item.user-message {
    border-left: 3px solid var(--text-secondary);
    box-shadow: none;
}

.transcript-role {
    font-size: 0.8rem;
    font-weight: bold;
    margin-bottom: 5px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.transcript-text {
    line-height: 1.5;
    color: var(--text-primary);
}

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


.btn.delete-outline {
    background: transparent;
    border: 1px solid var(--error-red);
    color: var(--error-red);
}

.btn.delete-outline:hover {
    background: var(--error-red);
    color: var(--neutral-050);
    box-shadow: 0 0 15px rgba(204, 0, 0, 0.4);
}

/* Knowledge Selection Styles */
.knowledge-section-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin: 18px 0 16px 4px;
}

.knowledge-section-label:first-of-type {
    margin-top: 0;
}

.knowledge-selection-grid {
    display: flex;
    gap: 20px;
    justify-content: flex-start;
    flex-wrap: wrap;
    margin: 0 0 16px 0;
}

.knowledge-tile {
    width: 130px;
    height: 120px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-primary);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    padding: 12px;
}

.knowledge-tile:hover {
    border-color: var(--accent-color);
    background: var(--bg-elevated);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.knowledge-tile .k-icon {
    font-size: 2.8rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    transition: color 0.2s;
}

.knowledge-tile:hover .k-icon {
    color: var(--accent-color);
}

.knowledge-tile .k-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

/* Google Drive Integration Styles */
.gdrive-section {
    width: 100%;
}

.gdrive-connect-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 30px 20px;
    text-align: center;
}

.gdrive-connect-icon {
    font-size: 3rem;
    color: var(--text-muted);
    opacity: 0.7;
}

.gdrive-connect-prompt p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    max-width: 360px;
    line-height: 1.5;
}

.gdrive-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 8px 14px;
    margin-bottom: 12px;
}

.gdrive-account-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.btn-icon-sm {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 1.1rem;
}

.btn-icon-sm:hover {
    background: var(--bg-elevated);
    color: var(--danger-color, #e53e3e);
}

.gdrive-breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 0;
    margin-bottom: 8px;
    font-size: 0.82rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.gdrive-crumb {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.gdrive-crumb-clickable {
    cursor: pointer;
    color: var(--accent-color);
    border-radius: 4px;
    padding: 2px 6px;
    transition: background 0.15s;
}

.gdrive-crumb-clickable:hover {
    background: var(--bg-tertiary);
}

.gdrive-crumb-separator {
    color: var(--text-muted);
    font-size: 0.7rem;
    margin: 0 2px;
}

.gdrive-folder-list {
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    max-height: 280px;
    min-height: 120px;
    overflow-y: auto;
    background: var(--bg-secondary);
}

.gdrive-folder-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid var(--border-primary);
    user-select: none;
}

.gdrive-folder-item:last-child {
    border-bottom: none;
}

.gdrive-folder-item:hover {
    background: var(--bg-tertiary);
}

.gdrive-folder-item .folder-icon {
    font-size: 1.3rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.gdrive-folder-item .folder-name {
    flex: 1;
    text-align: left;
    font-size: 0.88rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gdrive-folder-item .folder-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.gdrive-folder-item .folder-nav-btn,
.gdrive-file-item .folder-nav-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    border-radius: 4px;
    font-size: 1rem;
    transition: all 0.15s;
    flex-shrink: 0;
}

.gdrive-folder-item .folder-nav-btn:hover,
.gdrive-file-item .folder-nav-btn:hover {
    background: var(--bg-elevated);
    color: var(--accent-color);
}

.gdrive-folder-check {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-primary);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
    background: var(--bg-primary);
}

.gdrive-folder-check.checked {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: #fff;
}

.gdrive-folder-check.checked i {
    font-size: 0.75rem;
}

.gdrive-file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--border-primary);
    opacity: 0.9;
    cursor: pointer;
    transition: background 0.15s;
}

.gdrive-file-item:hover {
    background: var(--bg-tertiary);
}

.gdrive-file-item:last-child {
    border-bottom: none;
}

.gdrive-file-item .gdrive-folder-check {
    margin-right: 0px;
}

.gdrive-file-item .file-icon {
    font-size: 1.2rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.gdrive-file-item .file-name {
    flex: 1;
    text-align: left;
    font-size: 0.88rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gdrive-selected-summary {
    margin-top: 12px;
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    padding: 10px 14px;
    background: var(--bg-tertiary);
}

.gdrive-selected-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.gdrive-badge {
    background: var(--accent-color);
    color: #041120;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.gdrive-selected-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.gdrive-selected-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    padding: 3px 10px;
    font-size: 0.78rem;
    color: var(--text-primary);
}

.gdrive-selected-tag .remove-tag {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-left: 2px;
    transition: color 0.15s;
}

.gdrive-selected-tag .remove-tag:hover {
    color: var(--danger-color, #e53e3e);
}

.gdrive-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.gdrive-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 30px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.gdrive-empty i {
    font-size: 2rem;
    opacity: 0.5;
}

/* Google Drive import progress */
.gdrive-import-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px;
}

.gdrive-import-progress .progress-bar-outer {
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

.gdrive-import-progress .progress-bar-inner {
    height: 100%;
    background: var(--accent-color);
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}

.gdrive-import-progress .progress-text {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

/* Astra Streaming Animations */
.astra-status {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-style: italic;
    animation: astraPlanActivityIn 0.3s ease-out both;
}

.astra-status .astra-loading-text {
    background: linear-gradient(90deg, var(--text-muted) 0%, var(--accent-color) 45%, var(--text-muted) 90%);
    background-size: 220% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: astraPlanTextShimmer 2.4s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
    .astra-status,
    .astra-status .astra-loading-text {
        animation: none;
    }
}

.astra-loading-dots::after {
    content: '...';
    animation: dots 1.5s steps(5, end) infinite;
    display: inline-block;
    width: 20px;
    text-align: left;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

.astra-status-icon {
    color: var(--accent-color);
    display: inline-block;
    animation: spin 1s linear infinite;
}

@keyframes pulse {
    0% { opacity: 0.5; transform: scale(0.95); }
    50% { opacity: 1; transform: scale(1.05); }
    100% { opacity: 0.5; transform: scale(0.95); }
}

/* Astra Search Plan */
.astra-plan {
    margin-bottom: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    text-align: left;
}

/* Collapsed plan (shown after search completes above the answer) */
.astra-plan.collapsed .astra-plan-steps {
    display: none;
}

.astra-plan.collapsed .astra-plan-header {
    margin-bottom: 0;
    cursor: pointer;
    user-select: none;
}

.astra-plan.collapsed .astra-plan-header:hover {
    color: var(--accent-color);
}

.astra-plan.collapsed .astra-plan-toggle-icon {
    transition: transform 0.2s ease;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.astra-plan.expanded .astra-plan-steps {
    display: flex;
}

.astra-plan.expanded .astra-plan-toggle-icon {
    transform: rotate(180deg);
}

/* While Astra is planning/searching only the status line and plan are shown (no empty answer bubble) */
.chat-message.astra-awaiting > :not(.astra-status):not(.astra-plan):not(.astra-tool-feed):not(.astra-live-llm) {
    display: none;
}

/* Header extras: counter, elapsed time, progress bar */
.astra-plan-title {
    flex: 1;
}

.astra-plan-counter,
.astra-plan-elapsed {
    font-size: 0.72rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--surface-hover);
    transition: color 0.3s ease, background 0.3s ease;
}

.astra-plan-elapsed {
    background: transparent;
    padding-left: 0;
    padding-right: 0;
}

.astra-plan.is-complete .astra-plan-counter {
    color: var(--success, #22c55e);
    background: color-mix(in srgb, var(--success, #22c55e) 14%, transparent);
}

.astra-plan:not(.is-complete):not(.is-failed) .astra-plan-header-icon {
    animation: astraPlanIconBreath 2s ease-in-out infinite;
}

.astra-plan.is-complete .astra-plan-header-icon {
    color: var(--success, #22c55e);
    animation: astraPlanCheckPop 0.5s cubic-bezier(.2, 1.4, .4, 1) both;
}

.astra-plan.is-failed .astra-plan-header-icon {
    color: var(--error, #ef4444);
}

.astra-plan-progress {
    height: 3px;
    border-radius: 999px;
    background: var(--border-subtle);
    overflow: hidden;
    margin: -2px 0 10px;
}

.astra-plan.collapsed .astra-plan-progress {
    display: none;
}

.astra-plan-progress-fill {
    position: relative;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent-color), color-mix(in srgb, var(--accent-color) 55%, #fff));
    transition: width 0.6s cubic-bezier(.3, .8, .3, 1), background 0.4s ease;
    overflow: hidden;
}

.astra-plan-progress-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
    transform: translateX(-100%);
    animation: astraPlanSheen 1.6s ease-in-out infinite;
}

.astra-plan.is-complete .astra-plan-progress-fill {
    background: var(--success, #22c55e);
}

.astra-plan.is-complete .astra-plan-progress-fill::after {
    animation: none;
    opacity: 0;
}

/* Entrance + completion flash (live plans only) */
.astra-plan.is-live {
    animation: astraPlanIn 0.4s cubic-bezier(.2, .8, .2, 1) both;
    transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.astra-plan.is-live:not(.is-complete):not(.is-failed) {
    border-color: color-mix(in srgb, var(--accent-color) 35%, var(--border-subtle));
}

.astra-plan.is-live.is-complete {
    animation: astraPlanIn 0.4s cubic-bezier(.2, .8, .2, 1) both, astraPlanGlow 1.2s ease-out 1;
}

.astra-plan-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 10px;
}

.astra-plan-header i {
    color: var(--accent-color);
    font-size: 1.1rem;
}

.astra-plan-steps {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.astra-plan-step {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 8px;
    font-size: 0.85rem;
    transition: background 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

.astra-plan.is-live .astra-plan-step {
    animation: astraPlanStepIn 0.4s cubic-bezier(.2, .8, .2, 1) both;
    animation-delay: calc(var(--i, 0) * 70ms);
}

/* Timeline connector between checkpoints */
.astra-plan-step:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 17px;
    top: 27px;
    bottom: -6px;
    width: 2px;
    border-radius: 2px;
    background: var(--border-subtle);
    transform-origin: top;
}

.astra-plan-step.done:not(:last-child)::before {
    background: var(--success, #22c55e);
    opacity: 0.55;
}

.astra-plan-step.just-done:not(:last-child)::before {
    animation: astraPlanLineFill 0.5s ease-out both;
}

.astra-plan-step.pending {
    color: var(--text-muted);
}

.astra-plan-step.pending .astra-plan-step-icon i {
    color: var(--text-muted);
    opacity: 0.5;
}

.astra-plan-step.active {
    color: var(--text-color);
    background: linear-gradient(90deg, color-mix(in srgb, var(--accent-color) 10%, transparent), transparent 85%);
    box-shadow: inset 2px 0 0 var(--accent-color);
}

.astra-plan-step.active .astra-plan-step-icon i {
    color: var(--accent-color);
}

.astra-plan-step.active .astra-plan-step-name {
    font-weight: 600;
}

.astra-plan-step.done {
    color: var(--text-secondary);
}

.astra-plan-step.done .astra-plan-step-icon i {
    color: var(--success, #22c55e);
}

.astra-plan-step.done .astra-plan-step-text {
    opacity: 0.7;
}

.astra-plan-step.done .astra-plan-step-name {
    text-decoration: line-through;
    text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
}

.astra-plan-step-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 1px;
    z-index: 1;
}

.astra-plan-step-icon i {
    font-size: 1rem;
}

/* Pulsing halo around the checkpoint of the step being worked on */
.astra-plan-step.active .astra-plan-step-icon::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--accent-color) 22%, transparent);
    animation: astraPlanHalo 1.6s ease-out infinite;
    z-index: -1;
}

/* One-shot pop + ring burst when a step completes */
.astra-plan-step.just-done .astra-plan-step-icon i {
    animation: astraPlanCheckPop 0.5s cubic-bezier(.2, 1.4, .4, 1) both;
}

.astra-plan-step.just-done .astra-plan-step-icon::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--success, #22c55e);
    animation: astraPlanBurst 0.7s ease-out both;
    pointer-events: none;
}

.astra-plan-step-spinner {
    animation: spin 1s linear infinite;
}

.astra-plan-step-text {
    flex: 1;
    min-width: 0;
    line-height: 1.4;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.astra-plan-step-name {
    font-weight: 500;
}

/* Live activity line under the active step: latest tool call / status */
.astra-plan-step-activity {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--text-muted);
    min-width: 0;
    animation: astraPlanActivityIn 0.3s ease-out both;
}

.astra-plan-step-activity .astra-activity-icon {
    flex-shrink: 0;
    font-size: 0.95rem;
    color: var(--accent-color);
    animation: astraPlanBob 1.8s ease-in-out infinite;
}

.astra-plan-step-activity .astra-activity-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: linear-gradient(90deg, var(--text-muted) 0%, var(--accent-color) 45%, var(--text-muted) 90%);
    background-size: 220% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: astraPlanTextShimmer 2.4s linear infinite;
}

.astra-plan-step-activity.swap .astra-activity-text {
    animation: astraPlanTextSwap 0.35s ease-out both, astraPlanTextShimmer 2.4s linear infinite;
}

.astra-plan-step-activity .astra-activity-dots {
    display: none;
    gap: 3px;
    align-items: center;
}

.astra-plan-step-activity.is-thinking .astra-activity-dots {
    display: inline-flex;
}

.astra-plan-step-activity .astra-activity-dots i {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent-color);
    animation: astraPlanDot 1.2s ease-in-out infinite;
}

.astra-plan-step-activity .astra-activity-dots i:nth-child(2) { animation-delay: 0.15s; }
.astra-plan-step-activity .astra-activity-dots i:nth-child(3) { animation-delay: 0.3s; }

@keyframes astraPlanIn {
    from { opacity: 0; transform: translateY(8px) scale(0.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes astraPlanStepIn {
    from { opacity: 0; transform: translateX(-8px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes astraPlanActivityIn {
    from { opacity: 0; transform: translateY(-3px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes astraPlanTextShimmer {
    from { background-position: 220% 0; }
    to { background-position: -220% 0; }
}

@keyframes astraPlanHalo {
    0% { transform: scale(0.7); opacity: 0.9; }
    100% { transform: scale(1.6); opacity: 0; }
}

@keyframes astraPlanCheckPop {
    0% { transform: scale(0.3) rotate(-25deg); opacity: 0; }
    60% { transform: scale(1.3) rotate(6deg); opacity: 1; }
    100% { transform: scale(1) rotate(0); }
}

@keyframes astraPlanBurst {
    0% { transform: scale(0.6); opacity: 0.9; }
    100% { transform: scale(2); opacity: 0; }
}

@keyframes astraPlanLineFill {
    from { transform: scaleY(0); }
    to { transform: scaleY(1); }
}

@keyframes astraPlanBob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-1.5px); }
}

@keyframes astraPlanDot {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.35; }
    40% { transform: translateY(-3px); opacity: 1; }
}

@keyframes astraPlanIconBreath {
    0%, 100% { transform: scale(1); opacity: 0.85; }
    50% { transform: scale(1.15); opacity: 1; }
}

@keyframes astraPlanSheen {
    to { transform: translateX(100%); }
}

@keyframes astraPlanGlow {
    0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success, #22c55e) 45%, transparent); }
    100% { box-shadow: 0 0 0 14px transparent; }
}

@media (prefers-reduced-motion: reduce) {
    .astra-plan,
    .astra-plan *,
    .astra-plan *::before,
    .astra-plan *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* Empty Chat State */
.empty-chat-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 400px;
    color: var(--text-color);
    text-align: center;
    padding: 2rem;
}

.empty-chat-icon {
    width: 64px;
    height: 64px;
    background: var(--surface-hover);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    color: var(--accent-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.empty-chat-icon i {
    font-size: 32px;
}

.empty-chat-state h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.empty-chat-state p {
    color: var(--text-muted);
    max-width: 400px;
    margin-bottom: 2rem;
    line-height: 1.5;
}

/* Thinking Animation inside Message */
.astra-thinking {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 0;
    min-height: 24px;
}

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

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

@keyframes typing {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Avatar Stack for Tables */
.avatar-stack {
    display: flex;
    align-items: center;
}

.avatar-stack-item {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--bg-primary);
    object-fit: cover;
    margin-left: -10px;
    background: var(--neutral-800);
}

.avatar-stack-item:first-child {
    margin-left: 0;
}

.avatar-stack-count {
    margin-left: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Team Assignment Modal Redesign */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
    min-height: 40px; /* Prevent layout shift */
}

.user-tag {
    display: flex;
    align-items: center;
    background: var(--neutral-800);
    border: 1px solid var(--neutral-700);
    border-radius: 20px;
    padding: 4px 12px 4px 4px;
    font-size: 0.9rem;
    color: var(--text-primary);
    transition: all 0.2s;
}

.user-tag:hover {
    border-color: var(--neutral-600);
}

.user-tag-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin-right: 8px;
    object-fit: cover;
}

.user-tag-remove {
    margin-left: 8px;
    cursor: pointer;
    color: var(--neutral-400);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    transition: all 0.2s;
}

.user-tag-remove:hover {
    color: var(--error-red);
    background: rgba(204, 0, 0, 0.1);
}

.search-wrapper {
    position: relative;
    width: 100%;
}

.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--neutral-900);
    border: 1px solid var(--neutral-700);
    border-radius: 8px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: none; /* Hidden by default */
}

.search-results-dropdown.active {
    display: block;
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid var(--neutral-800);
    transition: background 0.2s;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--neutral-800);
}

.search-result-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-right: 12px;
    object-fit: cover;
}

.search-result-info {
    display: flex;
    flex-direction: column;
}

.search-result-name {
    font-weight: 500;
    color: var(--text-primary);
}

.search-result-email {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

/* Team Assignment Modal Updates */

/* Increase X contrast */
.user-tag-remove {
    color: var(--text-secondary) !important; /* Force higher contrast */
    font-weight: bold;
}

.user-tag-remove:hover {
    color: var(--error-red) !important;
}

/* Fixed size scroll container */
.team-selection-list {
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    height: 200px;
    overflow-y: auto;
    background: var(--bg-tertiary);
    margin-top: 5px;
}

.team-selection-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-style: italic;
}

/* Image Viewer Modal */
.image-viewer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 10600; /* above the knowledge source viewer (10500) so images can be enlarged from its segments */
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.image-viewer-overlay.active {
    opacity: 1;
    visibility: visible;
}

.image-viewer-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

.image-viewer-img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
}

.image-viewer-close {
    position: absolute;
    top: -50px;
    right: -10px;
    background: transparent;
    border: none;
    color: white;
    font-size: 2.5rem;
    cursor: pointer;
    transition: transform 0.2s, color 0.2s;
    line-height: 1;
}

.image-viewer-close:hover {
    transform: scale(1.1);
    color: var(--accent-color);
}

/* List Formatting in Messages */
.message-content ul, 
.message-content ol {
    margin-left: 20px;
    padding-left: 10px;
    margin-bottom: 12px;
}

.message-content li {
    margin-bottom: 6px;
    padding-left: 4px;
}

.message-content p {
    margin-bottom: 12px;
}

.chat-message.user .message-content > :last-child,
.chat-message.user-message .message-content > :last-child,
.chat-message.user .message-text > :last-child,
.chat-message.user-message .message-text > :last-child {
    margin-bottom: 0;
}

/* Crop Slider Styling */
#crop-zoom-slider {
    -webkit-appearance: none;
    width: 200px;
    height: 6px;
    border-radius: 5px;
    background: var(--bg-elevated);
    outline: none;
    border: 1px solid var(--border-primary);
}

#crop-zoom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
    transition: background 0.2s;
}

#crop-zoom-slider::-webkit-slider-thumb:hover {
    background: var(--accent-red-hover);
}

#crop-zoom-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    border: none;
}


/* Crop Slider Styling */
#crop-zoom-slider {
    -webkit-appearance: none;
    width: 200px;
    height: 6px;
    border-radius: 5px;
    background: var(--bg-elevated);
    outline: none;
    border: 1px solid var(--border-primary);
}

#crop-zoom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
    transition: background 0.2s;
}

#crop-zoom-slider::-webkit-slider-thumb:hover {
    background: var(--accent-red-hover);
}

#crop-zoom-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    border: none;
}


/* Source Group Styles for Doc Viewer */
.source-group {
    margin-bottom: 20px; 
    border: 1px solid var(--border-primary); 
    border-radius: 8px; 
    overflow: hidden; 
    background: var(--bg-primary);
}

.source-group-header {
    padding: 12px 15px; 
    background: var(--bg-secondary); 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    font-weight: 600; 
    border-bottom: 1px solid var(--border-subtle);
    user-select: none;
}

.source-group-content {
    /* visible by default if not collapsed */
    display: block;
}

.source-group.collapsed .source-group-content { 
    display: none !important; 
}

.source-group .group-caret { 
    transition: transform 0.2s; 
    display: inline-block;
}

.source-group:not(.collapsed) .group-caret { 
    transform: rotate(90deg); 
}

/* Source List Styles for Viewer */
.source-item {
    padding: 12px 15px;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}
.source-item:hover {
    background: var(--bg-hover, #f5f5f5);
    border-color: var(--primary-color);
}
.source-item.active {
    background: var(--primary-light, #e3f2fd);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1);
}
.source-header {
    display: flex;
    align-items: center;
    gap: 10px;
}
.source-title {
    font-weight: 600;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.source-count {
    font-size: 0.8em;
    color: var(--text-muted);
}

/* --- Doc Feed Grouping Styles --- */

.doc-feed-section {
    margin-bottom: 16px;
}

.doc-feed-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    margin-bottom: 16px;
    user-select: none;
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    transition: border-color 0.2s, background 0.2s;
    gap: 12px;
}

.doc-feed-header:hover {
    border-color: var(--border-secondary);
    background: var(--bg-tertiary);
}

.doc-feed-header:hover h3 {
    color: var(--accent-light);
}

.doc-feed-header:hover .header-caret {
    color: var(--accent-light);
}

/* Left side: caret, name, count, description */
.dfh-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

/* Right side: members, actions */
.dfh-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.doc-feed-header .header-caret {
    font-size: 1.1rem;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.doc-feed-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.doc-feed-header .count-badge {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 0.7rem;
    font-weight: 500;
    flex-shrink: 0;
}

/* Description shown inline as muted text */
.dfh-description {
    color: var(--text-tertiary);
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 320px;
    padding-left: 8px;
    border-left: 1px solid var(--border-primary);
}

/* Members chip */
.dfh-members {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px 3px 3px;
    height: 28px;
    border-radius: 20px;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    transition: border-color 0.2s, background 0.2s;
}

.dfh-members:hover {
    border-color: var(--accent-color);
    background: var(--bg-tertiary);
}

.dfh-members .avatar-stack {
    display: flex;
    align-items: center;
}

.dfh-members .avatar-stack-item {
    width: 22px;
    height: 22px;
    margin-left: -6px;
}

.dfh-members .avatar-stack-item:first-child {
    margin-left: 0;
}

.dfh-member-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

.dfh-members-empty {
    gap: 5px;
    padding: 4px 10px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.dfh-members-empty i {
    font-size: 1rem;
}

.dfh-members-empty:hover {
    color: var(--accent-color);
}

/* Per-category Add Knowledge button */
.dfh-add-knowledge-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 12px 3px 6px;
    height: 28px;
    border-radius: 20px;
    border: 1px solid var(--border-primary);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    opacity: 0;
    transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.2s, box-shadow 0.15s;
}

.doc-feed-header:hover .dfh-add-knowledge-btn {
    opacity: 1;
}

.dfh-add-knowledge-btn:hover {
    background: color-mix(in srgb, var(--accent-color) 9%, var(--bg-secondary));
    border-color: var(--accent-color);
    color: var(--accent-color);
    box-shadow: 0 1px 6px color-mix(in srgb, var(--accent-color) 15%, transparent);
}

.dfh-add-knowledge-btn i {
    font-size: 0.85rem;
}

/* Action buttons */
.dfh-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.2s;
}

.doc-feed-header:hover .dfh-actions {
    opacity: 1;
}

.dfh-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.95rem;
    transition: background 0.15s, color 0.15s;
}

.dfh-action-btn:hover {
    background: var(--bg-primary);
    color: var(--accent-color);
}

.dfh-action-btn--danger:hover {
    background: rgba(204, 0, 0, 0.1);
    color: var(--error-red, #cc0000);
}

/* Remove old header-line (no longer used) */
.doc-feed-header .header-line {
    display: none;
}

/* Collapsed State */
.doc-feed-section.collapsed .doc-feed-content-grid {
    display: none !important;
}

.doc-feed-section.collapsed .header-caret {
    transform: rotate(-90deg);
}

.doc-feed-section.collapsed {
    margin-bottom: 6px;
}

/* Drag & Drop Feedback */
.doc-feed-section {
    border: 2px solid transparent;
    border-radius: 12px;
    transition: all 0.2s ease;
}

/* Internal tile rearranging drag */
.doc-feed-section.drag-active {
    border-color: var(--accent-color);
    background: var(--bg-tertiary);
    box-shadow: 0 0 15px rgba(77, 124, 253, 0.1);
}

/* External file drop highlight */
.doc-feed-section.file-drag-active {
    border-color: var(--accent-color);
    border-style: dashed;
    background: color-mix(in srgb, var(--accent-color) 5%, var(--bg-tertiary));
    box-shadow: 0 0 20px rgba(77, 124, 253, 0.15);
}

.doc-feed-section.file-drag-active .doc-feed-header h3 {
    color: var(--accent-color);
}

/* Read-only sections show forbidden cursor when dragging files */
.doc-feed-section[data-can-write="0"] {
    /* Normal appearance, but drop is visually rejected via dropEffect='none' */
}


/* Modern Toggle Switch */
.wissenswerk-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    padding: 6px 10px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.wissenswerk-toggle-wrapper:hover {
    background-color: var(--bg-tertiary);
}

.wissenswerk-toggle {
    position: relative;
    width: 40px;
    height: 22px;
    background-color: var(--bg-tertiary);
    border-radius: 12px;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    border: 1px solid var(--border-primary);
    flex-shrink: 0;
}

.wissenswerk-toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background-color: var(--text-muted);
    border-radius: 50%;
    transition: transform 0.2s ease, background-color 0.2s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.wissenswerk-toggle-input {
    display: none;
}

.wissenswerk-toggle-input:checked + .wissenswerk-toggle {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}

.wissenswerk-toggle-input:checked + .wissenswerk-toggle::after {
    transform: translateX(18px);
    background-color: #fff;
}

.wissenswerk-toggle-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Organization Dropdown */
.org-dropdown-container {
    position: relative;
    user-select: none;
}

.org-dropdown-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    border: 1px solid var(--border-primary);
}

.org-dropdown-trigger:hover {
    background: var(--bg-tertiary);
}

.org-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-secondary);
    border-radius: 6px;
    margin-top: 4px;
    padding: 4px 0;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.org-dropdown-menu.show {
    display: block;
}

.org-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: background 0.2s;
}

.org-dropdown-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.org-dropdown-item.active {
    color: var(--accent-light);
    font-weight: 500;
}

.org-dropdown-divider {
    height: 1px;
    background: var(--border-secondary);
    margin: 4px 0;
}

/* [DEBUG] Org right-click context menu */
.debug-context-menu {
    position: fixed;
    background: var(--bg-secondary);
    border: 1px solid #f59e0b;
    border-radius: 6px;
    padding: 4px 0;
    z-index: 99999;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    min-width: 180px;
}

.debug-context-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: background 0.15s;
}

.debug-context-item:hover {
    background: var(--bg-tertiary);
}

.create-org-btn {
    color: var(--accent-light);
}

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

/* ==================== ASTRA CHAT REDESIGN ==================== */

/* Container Layout */
.astra-chat {
    background: #0A0A0A;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-messages {
    padding: 40px;
    display: flex;
    flex-direction: column;
    gap: 30px;
    max-width: 100%; /* Allow it to stretch fully */
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

/* Reset global chat-message constraints for Astra */
.astra-chat .chat-message {
    max-width: 100%;
    padding: 0;
    border-radius: 0;
}

/* User Message Styling - Right Aligned Bubble */
.chat-message.user {
    align-items: flex-end;
    animation: slideInRight 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.chat-message.user .message-content {
    background: transparent;
    color: #9A9A9A;
    padding: 12px 20px;
    border: 1px solid #2F2F2F;
    border-radius: 25px;
    max-width: 70%;
    font-size: 1rem;
    line-height: 1.5;
}

.message-timestamp {
    font-size: 0.75rem;
    color: #666666;
    margin-top: 6px;
    margin-right: 20px;
}

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

/* Astra Message Styling - Centered, Big, Clean */
.chat-message.assistant {
    align-items: center;
    width: 100%;
    animation: fadeIn 0.5s ease-out;
}

.chat-message.assistant .message-content {
    background: transparent;
    color: #9A9A9A;
    padding: 25px 30px;
    max-width: 100%;
    width: 100%;
    border: 1px solid #2F2F2F;
    border-radius: 25px;
    font-size: 1rem;
    line-height: 1.5;
    text-align: left; /* Keep left alignment for readability */
    box-sizing: border-box;
}

.chat-message.assistant .images-container,
.chat-message.assistant .astra-status,
.chat-message.assistant .astra-plan,
.chat-message.assistant .astra-debug-container {
    width: 100%;
    max-width: 100%;
    text-align: left;
    justify-content: flex-start;
    box-sizing: border-box;
}

.chat-message.assistant .no-sources-badge {
    width: fit-content;
    max-width: 100%;
    text-align: left;
    justify-content: flex-start;
    box-sizing: border-box;
    display: inline-flex; /* Ensure it shrinks to content */
    margin-top: 15px; /* Add some spacing if needed */
}

/* Sources Container - Horizontal Layout Under Answer */
.message-sources {
    display: flex;
    flex-direction: row; /* Force horizontal */
    flex-wrap: wrap;
    justify-content: flex-start; /* Align with text start */
    gap: 10px;
    margin-top: 8px; /* Reduced margin */
    width: 100%; /* Match message width */
    max-width: 100%;
    padding-top: 0; /* Remove padding */
    border-top: none;
    box-sizing: border-box;
}

/* Source Box Styling - Clean, Small, Interactive */
.astra-chat .source-citation {
    background: transparent;
    border: 1px solid #2F2F2F;
    border-radius: 25px;
    padding: 10px 16px;
    font-size: 0.95rem;
    color: #9A9A9A;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: none;
}

.astra-chat .source-citation:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: #2F2F2F;
    transform: translateY(-2px);
    color: #ffffff;
    box-shadow: none;
}

.astra-chat .source-citation.active {
    background: rgba(255, 255, 255, 0.1);
    border-color: #2F2F2F;
    color: #ffffff;
}

.astra-chat .source-citation i {
    color: #9A9A9A;
}

.astra-chat .source-citation.file-source {
    background: transparent;
    border: 1px solid #2F2F2F;
    color: #9A9A9A;
}

.astra-chat .source-citation.file-source:hover {
    background: rgba(255, 255, 255, 0.05);
    box-shadow: none;
}

/* Inline in-text citation pills — rendered from Astra's [id](type) citations
   directly inside the message text, next to the fact they support. */
.astra-chat .message-text .astra-citation {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 1.3em;
    height: 1.3em;
    padding: 0 5px;
    margin: 0 1px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid #2F2F2F;
    color: #C9C9C9;
    font-size: 0.72em;
    line-height: 1;
    vertical-align: middle;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.astra-chat .message-text .astra-citation:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: #4a4a4a;
    color: #ffffff;
    transform: translateY(-1px);
}

.astra-chat .message-text .astra-citation i {
    font-size: 1.05em;
    color: inherit;
}

.astra-chat .message-text .astra-citation-num {
    font-weight: 600;
}

.astra-chat .message-text .astra-citation.is-fact {
    cursor: default;
    background: rgba(255, 255, 255, 0.04);
    opacity: 0.85;
}

.astra-chat .message-text .astra-citation.is-fact:hover {
    transform: none;
    background: rgba(255, 255, 255, 0.04);
    border-color: #2F2F2F;
}

.astra-chat .message-text .astra-citation.unresolved {
    cursor: default;
    opacity: 0.6;
}

.astra-chat .message-text .astra-citation.unresolved:hover {
    transform: none;
}

/* Source Expanded Tile - Centered under sources */
.source-tile {
    width: 100%;
    max-width: 100%;
    margin-top: 20px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    animation: slideDownFade 0.3s ease-out;
    box-sizing: border-box;
}

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

/* Input Area Redesign - Clean, Floating Style */
.chat-input-container {
    padding: 0 40px 0 40px; /* Removed top & bottom padding */
    width: 100%;
    max-width: 100%;
    margin: 0;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    position: relative;
    align-items: center; /* Align items centered */
}

/* Microphone / Dictation Button */
.btn-mic {
    background: transparent;
    color: var(--text-muted);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    flex-shrink: 0;
    margin-right: 4px;
}

.btn-mic:hover {
    color: var(--text-primary);
    transform: scale(1.1);
}

.btn-mic i {
    font-size: 1.3rem;
}

.btn-mic.recording {
    color: var(--accent-color, #4D7CFD);
    animation: mic-pulse 1.2s ease-in-out infinite;
}

@keyframes mic-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

[data-theme="light"] .btn-mic {
    color: var(--text-muted);
}

[data-theme="light"] .btn-mic:hover {
    color: var(--text-primary);
}

[data-theme="light"] .btn-mic.recording {
    color: var(--accent-color, #4D7CFD);
}

#chat-input.theme-input-bg {
    width: 100%;
    background: transparent !important;
    border: 1px solid var(--border-subtle);
    border-radius: 24px;
    padding: 12px 50px 12px 20px !important; /* Right padding for button space */
    font-size: 1rem;
    font-family: var(--font-main); /* Restore original font */
    color: var(--text-primary);
    line-height: 1.5;
    resize: none;
    min-height: 24px;
    max-height: 150px;
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    outline: none;
    transition: all 0.2s ease;
}

#chat-input.theme-input-bg::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

#chat-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 4px 15px rgba(77, 124, 253, 0.1);
}

.btn-send {
    position: absolute;
    right: 55px; /* Position inside the input (40px container pad + 15px inside input) */
    background: transparent;
    color: var(--text-muted);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
}

.btn-send:hover {
    color: var(--text-primary);
    transform: scale(1.1);
    background: transparent !important; /* Force override earlier definitions */
    box-shadow: none !important;
}

.btn-send i {
    font-size: 1.3rem;
}

/* Typing Effect Cursor */
.typing-cursor::after {
    content: '|';
    animation: blink 1s step-start infinite;
    color: var(--accent-color);
    font-weight: bold;
    margin-left: 2px;
}

@keyframes blink {
    50% { opacity: 0; }
}

/* Bright Mode Specific Adjustments (if not covered by vars) */
[data-theme="light"] .astra-chat {
    background: var(--bg-primary);
}

[data-theme="light"] .astra-sidebar {
    border-color: var(--border-subtle);
}

[data-theme="light"] .chat-message.user .message-content,
[data-theme="light"] .chat-message.assistant .message-content {
    background: transparent;
    color: var(--text-primary);
    border-color: var(--border-subtle);
}

[data-theme="light"] .astra-chat .source-citation {
    background: var(--bg-primary);
    border-color: var(--border-subtle);
    color: var(--text-secondary);
}

[data-theme="light"] .astra-chat .source-citation:hover {
    background: var(--bg-secondary);
    border-color: var(--border-hover);
    color: var(--text-primary);
    transform: translateY(-2px);
}

[data-theme="light"] .astra-chat .source-citation i {
    color: var(--text-muted);
}

[data-theme="light"] .astra-chat .source-citation:hover i {
    color: var(--text-secondary);
}

[data-theme="light"] .astra-chat .message-text .astra-citation {
    background: var(--bg-secondary);
    border-color: var(--border-subtle);
    color: var(--text-secondary);
}

[data-theme="light"] .astra-chat .message-text .astra-citation:hover {
    background: var(--bg-tertiary, var(--bg-secondary));
    border-color: var(--border-hover);
    color: var(--text-primary);
}

[data-theme="light"] .message-timestamp {
    color: var(--text-muted);
}

[data-theme="light"] #chat-input.theme-input-bg {
    background: var(--bg-primary) !important;
    border-color: var(--border-subtle);
    color: var(--text-primary);
}

[data-theme="light"] #chat-input.theme-input-bg:focus {
    border-color: var(--accent-color);
    background: var(--bg-primary) !important;
}

[data-theme="light"] .btn-send {
    color: var(--text-muted);
}

[data-theme="light"] .btn-send:hover {
    color: var(--text-primary);
    background: transparent !important;
}

[data-theme="light"] .no-sources-badge {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
}

/* Sidebar Light Theme Adjustments */
[data-theme="light"] .chat-item:hover {
    background: rgba(0, 0, 0, 0.05); /* Softer hover for light mode */
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .chat-item.active {
    background: rgba(0, 0, 0, 0.03); /* Subtle active state */
    border-color: var(--accent-color);
}

[data-theme="light"] .chat-item-title {
    color: var(--text-primary);
}

[data-theme="light"] .chat-item-meta {
    color: var(--text-muted);
}

[data-theme="light"] .chat-title-input {
    background: #ffffff;
    border-color: #e5e5e5;
    color: var(--text-primary);
}

[data-theme="light"] .chat-item-actions {
    color: var(--text-primary); /* Make dots black/dark grey */
}

[data-theme="light"] .chat-item-actions:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

[data-theme="light"] .chat-item-menu {
    background: #ffffff;
    border-color: #e5e5e5;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); /* Softer shadow */
}

[data-theme="light"] .chat-menu-item {
    color: var(--text-primary);
}

[data-theme="light"] .chat-menu-item:hover {
    background: #f5f5f5;
}

[data-theme="light"] .chat-pin-icon {
    color: var(--accent-color);
}

/* --- Modern Upload Component Styles --- */

.modern-drop-zone {
    border: 2px dashed var(--border-primary);
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    background-color: var(--bg-secondary);
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-secondary);
}

.modern-drop-zone:hover,
.modern-drop-zone.dragover {
    border-color: var(--accent-primary);
    background-color: var(--bg-sidebar); /* slight difference */
    color: var(--accent-primary);
}

.modern-drop-zone i {
    font-size: 2.5rem;
    color: inherit;
    opacity: 0.7;
}

.modern-drop-zone p {
    margin: 0;
    font-size: 0.95rem;
}

.modern-drop-zone.has-files {
    border-color: var(--accent-primary);
    background-color: var(--bg-sidebar);
}

/* Preview List */
.upload-preview-list {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 250px;
    overflow-y: auto;
}

.upload-preview-container {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 4px 4px 4px 0;
    border-radius: 6px;
}

.upload-preview-container::-webkit-scrollbar {
    width: 4px;
}

.upload-preview-container::-webkit-scrollbar-track {
    background: transparent;
}

.upload-preview-container::-webkit-scrollbar-thumb {
    background: var(--border-primary);
    border-radius: 4px;
}

.upload-preview-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.file-preview-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    padding: 10px 14px;
    border-radius: 8px;
    transition: background 0.2s;
}

.file-preview-item:hover {
    background: var(--bg-hover);
}

.file-preview-item .file-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0; /* for truncation */
}

.file-preview-item .file-info i {
    font-size: 1.4rem;
    color: var(--text-secondary);
}

.file-preview-item .file-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.file-preview-item .file-name {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.file-preview-item .file-size {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.remove-file-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 6px;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
    flex-shrink: 0;
}

.remove-file-btn:hover {
    color: #ef4444; /* Red color for delete */
    background: rgba(239, 68, 68, 0.1);
}

/* Modern Select */
.modern-select {
    padding: 10px 12px;
    padding-right: 36px !important;
    border-radius: 8px;
    border: 1px solid var(--border-primary);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.95rem;
    width: 100%;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: calc(100% - 14px) center !important;
}

.modern-select:focus {
    border-color: var(--accent-primary);
}


/* Floating Feedback Button */
#floating-feedback-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #041120;
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    transition: transform 0.25s cubic-bezier(.4,0,.2,1), background-color 0.2s ease, box-shadow 0.25s ease;
}

#floating-feedback-btn:hover {
    transform: scale(1.08);
    background: var(--accent-hover);
    box-shadow: 0 6px 24px rgba(77, 124, 253, 0.35);
}

#floating-feedback-btn:active {
    transform: scale(0.95);
}

#floating-feedback-btn.active {
    transform: rotate(45deg) scale(1);
    background: var(--neutral-700);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

#floating-feedback-btn.active:hover {
    background: var(--neutral-600);
}

/* --- Feedback Panel --- */
#feedback-panel {
    position: fixed;
    bottom: 88px;
    right: 24px;
    width: 380px;
    max-height: calc(100vh - 120px);
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transform: translateY(16px) scale(0.96);
    transition: opacity 0.25s cubic-bezier(.4,0,.2,1), transform 0.25s cubic-bezier(.4,0,.2,1);
}

#feedback-panel.open {
    pointer-events: all;
    opacity: 1;
    transform: translateY(0) scale(1);
}

.fb-panel-inner {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.35), 0 0 0 1px var(--border-subtle);
    overflow-y: auto;
    max-height: calc(100vh - 140px);
}

[data-theme="light"] .fb-panel-inner {
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.12), 0 0 0 1px var(--border-subtle);
}

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

.fb-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.fb-header button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, background 0.15s;
}

.fb-header button:hover {
    color: var(--text-primary);
    background: var(--white-05);
}

.fb-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 16px;
}

/* Category chips */
.fb-categories {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.fb-chip {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    transition: all 0.15s ease;
    user-select: none;
}

.fb-chip input { display: none; }

.fb-chip:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.fb-chip.active {
    background: var(--accent-dim);
    border-color: var(--accent-border);
    color: var(--accent-color);
}

/* Textarea */
.fb-field textarea {
    width: 100%;
    min-height: 90px;
    max-height: 200px;
    resize: vertical;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-primary);
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
    margin-bottom: 12px;
}

.fb-field textarea::placeholder {
    color: var(--text-muted);
}

.fb-field textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-dim);
}

/* Screenshot dropzone */
.fb-dropzone {
    border: 1.5px dashed var(--border-primary);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 16px;
    transition: border-color 0.2s, background 0.2s;
    cursor: pointer;
}

.fb-dropzone.dragover {
    border-color: var(--accent-color);
    background: var(--accent-dim);
}

.fb-dropzone-empty {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.fb-dropzone-empty svg {
    flex-shrink: 0;
    opacity: 0.6;
}

.fb-dropzone-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.fb-dropzone-preview img {
    width: 100%;
    max-height: 120px;
    object-fit: contain;
    border-radius: 6px;
}

.fb-dropzone-preview button {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s;
}

.fb-dropzone-preview button:hover {
    background: rgba(0, 0, 0, 0.85);
}

/* Action buttons */
.fb-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.fb-btn {
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
    font-family: inherit;
}

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

.fb-btn-ghost:hover {
    color: var(--text-primary);
    background: var(--white-05);
}

.fb-btn-primary {
    background: #041120;
    color: #ffffff;
}


.fb-btn-primary:hover {
    background: #1d2024;
    box-shadow: 0 2px 8px var(--accent-glow);
}

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

.fb-btn-primary.loading {
    pointer-events: none;
    opacity: 0.7;
}

/* Success state */
.fb-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 30px 10px;
    gap: 8px;
}

.fb-success-icon {
    color: var(--success-green);
    margin-bottom: 4px;
    animation: fbCheckPop 0.4s cubic-bezier(.4,0,.2,1);
}

@keyframes fbCheckPop {
    0% { transform: scale(0); opacity: 0; }
    60% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

.fb-success-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.fb-success-msg {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Mobile responsive */
@media (max-width: 480px) {
    #feedback-panel {
        right: 12px;
        left: 12px;
        width: auto;
        bottom: 80px;
    }
    #floating-feedback-btn {
        bottom: 16px;
        right: 16px;
        width: 48px;
        height: 48px;
    }
}

/* ══════════════════════════════════════════════════════════════════════════════
   Integration Tile in Knowledge Feed
   ══════════════════════════════════════════════════════════════════════════════ */

.integration-tile {
    border: 1px solid var(--border-primary) !important;
    background: transparent !important;
}

.integration-tile:hover {
    border-color: var(--border-primary) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.integration-provider-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    color: var(--text-secondary);
    padding: 3px 10px 3px 8px;
    height: 28px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    transition: border-color 0.2s, background 0.2s;
}

.integration-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 500;
}

.integration-status.active {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.integration-status.syncing {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.integration-status.syncing i {
    animation: spin 1s linear infinite;
}

.integration-status.paused {
    background: rgba(234, 179, 8, 0.15);
    color: #eab308;
}

.integration-status.has-errors {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.integration-tile-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 6px;
}

.integration-email,
.integration-folders {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.integration-email i,
.integration-folders i {
    flex-shrink: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.integration-stats {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 4px;
}

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

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

.integration-stat.synced strong {
    color: #22c55e;
}

.integration-stat.processing strong {
    color: #3b82f6;
}

.integration-stat.failed strong {
    color: #ef4444;
}

.integration-last-sync {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 4px;
}

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

.spin {
    display: inline-block;
    animation: spin 1s linear infinite;
}

/* ══════════════════════════════════════════════════════════════════════════════
   Batch Upload Tile (multi-file / folder uploads) — NOT an integration
   ══════════════════════════════════════════════════════════════════════════════ */

.batch-upload-tile {
    border: 1px solid var(--border-primary) !important;
    background: transparent !important;
}

.batch-upload-tile:hover {
    border-color: var(--border-primary) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.batch-upload-provider-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    color: var(--text-secondary);
    padding: 3px 10px 3px 8px;
    height: 28px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.batch-upload-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 500;
}

.batch-upload-status.uploading {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.batch-upload-status.converting {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.batch-upload-status.ready {
    background: rgba(234, 179, 8, 0.15);
    color: #eab308;
}

.batch-upload-status.done {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.batch-upload-status.has-errors {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.batch-upload-tile-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 6px;
}

.batch-upload-files-line {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.batch-upload-files-line i {
    flex-shrink: 0;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.batch-upload-stats {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.batch-upload-stat {
    font-size: 0.75rem;
    color: var(--text-muted);
}

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

.batch-upload-stat.uploaded strong { color: #eab308; }
.batch-upload-stat.processing strong { color: #3b82f6; }
.batch-upload-stat.converted strong { color: #22c55e; }
.batch-upload-stat.failed strong { color: #ef4444; }

.batch-upload-preview-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 4px;
    padding: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
}

.batch-upload-preview-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.74rem;
    color: var(--text-secondary);
    overflow: hidden;
    white-space: nowrap;
}

.batch-upload-preview-item i {
    flex-shrink: 0;
    color: var(--text-muted);
}

.batch-upload-preview-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.batch-upload-preview-more {
    font-size: 0.72rem;
    color: var(--text-muted);
    padding-left: 2px;
}

.batch-upload-date {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.batch-upload-start-btn {
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    background: var(--accent-color);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.2s;
}

.batch-upload-start-btn:hover {
    filter: brightness(1.08);
}

/* ── Batch Conversion Options Modal ────────────────────────────────────────── */
.batch-convert-option {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.batch-convert-toggle-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
}

.batch-convert-toggle-row input[type="checkbox"] {
    margin-top: 3px;
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
}

.batch-convert-toggle-row > span {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.batch-convert-hint {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.35;
}

.batch-convert-threshold-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.batch-convert-threshold-value {
    font-variant-numeric: tabular-nums;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    padding: 2px 10px;
    font-size: 0.85rem;
    color: var(--accent-color);
}

.batch-convert-threshold-scale {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ── Batch Upload Detail Modal ─────────────────────────────────────────────── */

/* Search bar */
.batch-upload-search-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 5px 10px;
    flex: 1;
    min-width: 0;
}

.batch-upload-search-wrap i {
    flex-shrink: 0;
    color: var(--text-muted);
}

.batch-upload-search-input {
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.85rem;
    width: 100%;
}

.batch-upload-search-input::placeholder {
    color: var(--text-muted);
}

/* File list header (select-all + search) */
.batch-upload-file-list-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.batch-upload-select-all-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.batch-upload-select-all-wrap input {
    cursor: pointer;
    accent-color: var(--accent-color);
    width: 15px;
    height: 15px;
}

.batch-upload-file-count-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

/* Bulk action bar */
.batch-bulk-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.batch-bulk-count {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.batch-bulk-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Per-row checkbox */
.batch-upload-row-check {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    cursor: pointer;
    padding-right: 4px;
}

.batch-upload-row-check input {
    cursor: pointer;
    accent-color: var(--accent-color);
    width: 15px;
    height: 15px;
}

/* Per-row action icons */
.batch-upload-row-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s;
}

.batch-upload-file-row:hover .batch-upload-row-actions {
    opacity: 1;
}

.batch-row-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 6px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.15s, color 0.15s;
}

.batch-row-action-btn:hover {
    background: var(--border-primary);
    color: var(--text-primary);
}

.batch-row-action-btn.danger:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.batch-upload-detail-body {
    max-height: calc(90vh - 140px);
    min-height: 40vh;
    overflow-y: auto;
    padding: 0 5px;
}

.batch-upload-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-primary);
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.batch-upload-detail-provider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
}

.batch-upload-detail-title {
    font-size: 1.05rem;
}

.batch-upload-detail-sub {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.batch-upload-detail-stats-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.batch-upload-detail-section h4 {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    margin: 4px 0 10px;
    color: var(--text-secondary);
}

.batch-upload-file-list {
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    overflow: hidden;
    max-height: 50vh;
    overflow-y: auto;
}

.batch-upload-file-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.85rem;
    transition: background 0.1s;
}

.batch-upload-file-row:last-child {
    border-bottom: none;
}

.batch-upload-file-row.batch-upload-file-clickable {
    cursor: pointer;
}

.batch-upload-file-row.batch-upload-file-clickable:hover {
    background: var(--bg-secondary);
}

.batch-upload-file-name {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.batch-upload-file-name i {
    flex-shrink: 0;
    color: var(--text-muted);
}

.batch-upload-file-status {
    flex-shrink: 0;
    font-size: 0.72rem;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-muted);
}

.batch-upload-file-status.status-processing,
.batch-upload-file-status.status-converting {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.batch-upload-file-status.status-uploaded {
    background: rgba(234, 179, 8, 0.15);
    color: #eab308;
}

.batch-upload-file-status.status-converted {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.batch-upload-file-status.status-error {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* ══════════════════════════════════════════════════════════════════════════════
   Integration Detail Modal
   ══════════════════════════════════════════════════════════════════════════════ */

.integration-detail-body {
    max-height: calc(90vh - 140px);
    min-height: 50vh;
    overflow-y: auto;
    padding: 0 5px;
}

.integration-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-primary);
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.integration-detail-provider {
    display: flex;
    align-items: center;
    gap: 12px;
}

.integration-detail-provider i {
    font-size: 2rem;
    color: var(--accent-color);
}

.integration-detail-provider strong {
    font-size: 1.05rem;
    color: var(--text-primary);
    display: block;
    text-align: left;
}

.integration-detail-provider-label-google-drive {
    position: relative;
    left: 1px;
}

.integration-detail-email {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-align: left;
    display: block;
}

.integration-detail-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}


.integration-detail-actions .btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
    border: 1px solid var(--border-primary);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.integration-detail-actions .btn-secondary:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.integration-detail-actions .btn-danger {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

.integration-detail-actions .btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.integration-detail-section {
    margin-bottom: 20px;
}

.integration-detail-section h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.08rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.integration-detail-section h4 i {
    font-size: 1.25rem;
}

.integration-detail-folders {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 5px;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 8px;
    background: var(--bg-secondary);
}

.integration-detail-folders .gdrive-selected-tag {
    font-size: 0.94rem;
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 6px;
}

.integration-detail-folders .btn-small {
    padding: 8px 12px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: transparent;
    border: 1px dashed var(--text-muted);
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.integration-detail-folders .btn-small:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--text-primary);
}

/* Edit folders inline browser */
.edit-folders-selected {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.edit-folders-browser {
    margin-bottom: 12px;
}

.edit-folders-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 8px;
}

.integration-detail-stats-row {
    display: flex;
    gap: 16px;
    margin-bottom: 10px;
}

.integration-file-list {
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    overflow: hidden;
    max-height: 320px;
    overflow-y: auto;
}

.integration-file-row {
    display: grid;
    grid-template-columns: 1fr 130px 80px 110px;
    gap: 10px;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-primary);
    font-size: 0.8rem;
}

.integration-file-row:last-child {
    border-bottom: none;
}

.integration-file-row:hover {
    background: var(--bg-tertiary);
}

.integration-file-name {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.integration-file-name i {
    flex-shrink: 0;
    color: var(--text-muted);
}

.integration-file-path {
    color: var(--text-muted);
    font-size: 0.75rem;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.integration-file-status {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.integration-file-status.status-synced {
    color: #22c55e;
}

.integration-file-status.status-processing {
    color: #3b82f6;
}

.integration-file-status.status-failed,
.integration-file-status.status-skipped {
    color: #ef4444;
}

.integration-file-error {
    cursor: help;
    color: #ef4444;
}

.integration-detail-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-primary);
    margin-top: 8px;
}

.integration-detail-footer span {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.integration-file-synced-at {
    color: var(--text-muted);
    font-size: 0.72rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Integration file explorer & search ─────────────────────────────────── */
.intg-file-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.intg-file-search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    background: var(--bg-secondary);
}

.intg-search-icon {
    color: var(--text-muted);
    flex-shrink: 0;
    font-size: 0.9rem;
}

.intg-file-search-input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
}

.intg-file-search-input::placeholder {
    color: var(--text-muted);
}

/* Breadcrumb / back button */
.intg-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-bottom: 1px solid var(--border-primary);
    background: var(--bg-secondary);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.intg-back-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--accent-color);
    font-size: 0.8rem;
    padding: 2px 6px;
    border-radius: 5px;
    transition: background 0.15s;
    flex-shrink: 0;
}

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

.intg-bc-path {
    display: flex;
    align-items: center;
    gap: 3px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.intg-bc-root { color: var(--text-muted); }
.intg-bc-sep  { color: var(--text-muted); opacity: 0.5; }
.intg-bc-seg  { color: var(--text-primary); font-weight: 500; }

.intg-bc-clickable {
    cursor: pointer;
    transition: color 0.12s;
}

.intg-bc-clickable:hover {
    color: var(--accent-color);
}

/* Folder row — clicking navigates into it */
.intg-folder-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-primary);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-primary);
    user-select: none;
    transition: background 0.12s;
}

.intg-folder-row:hover {
    background: var(--bg-tertiary);
}

.intg-folder-icon {
    color: var(--accent-color);
    flex-shrink: 0;
}

.intg-folder-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.intg-folder-count {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 1px 7px;
    border-radius: 10px;
    flex-shrink: 0;
}

.intg-folder-arrow {
    font-size: 0.72rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* File row */
.intg-file-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 12px;
    border-bottom: 1px solid var(--border-primary);
    font-size: 0.8rem;
    transition: background 0.12s;
}

.intg-file-row:last-child {
    border-bottom: none;
}

.intg-file-row:hover {
    background: var(--bg-tertiary);
}

.intg-file-row.intg-file-clickable {
    cursor: pointer;
}

.intg-file-row.intg-file-clickable:hover .intg-file-name {
    color: var(--accent-color);
}

.intg-file-name {
    display: flex;
    align-items: center;
    gap: 7px;
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.intg-file-name i {
    flex-shrink: 0;
    color: var(--text-muted);
}

.intg-file-path-inline {
    color: var(--text-muted);
    font-size: 0.72rem;
    margin-left: 5px;
    flex-shrink: 0;
}

.intg-file-status {
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.intg-file-status.status-synced { color: #22c55e; }
.intg-file-status.status-processing { color: #3b82f6; }
.intg-file-status.status-failed,
.intg-file-status.status-skipped { color: #ef4444; }

.intg-file-error-icon {
    cursor: help;
    color: #ef4444;
}

.intg-file-synced-at {
    color: var(--text-muted);
    font-size: 0.72rem;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Increase max-height for the explorer view */
.integration-file-list {
    max-height: 400px;
}

/* Responsive */
@media (max-width: 600px) {
    .integration-file-row {
        grid-template-columns: 1fr 80px;
    }
    .integration-file-path,
    .integration-file-synced-at {
        display: none;
    }
    .integration-detail-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ════════════════════════════════════════════════════════════════════════════
   @mention autocomplete dropdown & mention chips
   ════════════════════════════════════════════════════════════════════════════ */

.mention-dropdown {
    position: absolute;
    bottom: 100%;
    left: 40px;
    right: 40px;
    max-height: 220px;
    overflow-y: auto;
    background: var(--bg-card, #1e1e1e);
    border: 1px solid var(--border-subtle, #333);
    border-radius: 12px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.25);
    z-index: 100;
    display: none;
    padding: 6px;
    margin-bottom: 6px;
}

.mention-dropdown.visible {
    display: block;
}

.mention-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.mention-option:hover,
.mention-option.active {
    background: var(--bg-hover, #2a2a2a);
}

.mention-option-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.mention-option-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.mention-option-name {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mention-option-detail {
    font-size: 0.76rem;
    color: var(--text-muted, #888);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Mention chip styling inside messages */
.mention-chip {
    color: var(--accent-color, #4D7CFD);
    font-weight: 600;
    cursor: default;
}

/* Light theme */
[data-theme="light"] .mention-dropdown {
    background: #fff;
    border-color: #ddd;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
}

[data-theme="light"] .mention-option:hover,
[data-theme="light"] .mention-option.active {
    background: #f3f3f3;
}

@keyframes warningPulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 152, 0, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(255, 152, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 152, 0, 0); }
}

.tile-btn-pulse {
    animation: warningPulse 2s infinite;
}


/* ══════════════════════════════════════════════════════════════════════════════
   Generic Tooltip Container
   ══════════════════════════════════════════════════════════════════════════════ */
[data-tooltip] {
    position: relative;
    cursor: pointer;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--neutral-800, #222);
    color: var(--text-primary, #fff);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-family: inherit;
    white-space: pre-wrap;
    width: max-content;
    max-width: 200px;
    z-index: 10000;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    border: 1px solid var(--border-primary, #444);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Optional Custom Positions */
[data-tooltip-pos="left"]::after {
    bottom: 50%;
    left: auto;
    right: calc(100% + 10px);
    transform: translateY(50%);
}

[data-tooltip-pos="right"]::after {
    bottom: 50%;
    left: calc(100% + 10px);
    transform: translateY(50%);
}

[data-tooltip-pos="bottom"]::after {
    bottom: auto;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
}

[data-tooltip-pos="top-right"]::after {
    bottom: calc(100% + 10px);
    left: auto;
    right: 0;
    transform: none;
}

/* Align chat-message user-message and ai-message with Astra designs */
.chat-message.user-message,
.chat-message.ai-message {
    max-width: 100% !important;
    padding: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    border: none !important;
    width: 100%;
}

.chat-message.user-message {
    align-items: flex-end !important;
    animation: slideInRight 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) !important;
}

.chat-message.user-message .message-content {
    background: transparent !important;
    color: #9A9A9A !important;
    padding: 12px 20px !important;
    border: 1px solid #2F2F2F !important;
    border-radius: 25px !important;
    max-width: 70% !important;
    font-size: 1rem !important;
    line-height: 1.5 !important;
    box-sizing: border-box !important;
}

.chat-message.ai-message {
    align-items: center !important;
    width: 100% !important;
    animation: fadeIn 0.5s ease-out !important;
}

.chat-message.ai-message .message-content {
    background: transparent !important;
    color: #9A9A9A !important;
    padding: 25px 30px !important;
    max-width: 100% !important;
    width: 100% !important;
    border: 1px solid #2F2F2F !important;
    border-radius: 25px !important;
    font-size: 1rem !important;
    line-height: 1.5 !important;
    text-align: left !important;
    box-sizing: border-box !important;
}

[data-theme="light"] .chat-message.user-message .message-content,
[data-theme="light"] .chat-message.ai-message .message-content {
    background: transparent !important;
    color: var(--text-primary) !important;
    border-color: var(--border-subtle) !important;
}

/* Timestamp Alignment rules for Astra and Call messaging */
.chat-message.user .message-timestamp,
.chat-message.user-message .message-timestamp {
    align-self: flex-end !important;
    margin-right: 20px !important;
    margin-left: 0 !important;
}

.chat-message.assistant .message-timestamp,
.chat-message.ai-message .message-timestamp {
    align-self: flex-start !important;
    margin-left: 30px !important;
    margin-right: 0 !important;
}


/* ══════════════════════════════════════════════════════════════════════════
   ASTRA COMPOSER — hero layout, #/@ pickers, filters
   ══════════════════════════════════════════════════════════════════════════ */
.astra-chat {
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --astra-violet: 167, 139, 250;
    --astra-teal: 45, 212, 191;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}
.astra-chat .chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 32px 40px 16px;
    animation: astraFadeIn 0.5s var(--ease-out) both;
}
.astra-chat.is-empty::before { opacity: 0; }
.astra-chat.is-empty .chat-messages { display: none; }

@keyframes astraFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes astraFadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes astraPop { from { opacity: 0; transform: scale(0.82) translateY(4px); } to { opacity: 1; transform: scale(1) translateY(0); } }

/* ── Hero ─────────────────────────────────────────────────────────────── */
.astra-hero { display: none; flex-direction: column; align-items: center; text-align: center; padding: 0 24px 30px; }
.astra-chat.is-empty { justify-content: center; padding-bottom: 7vh; }
.astra-chat.is-empty .astra-hero { display: flex; }
.astra-chat.is-empty .astra-hero > * { animation: astraFadeUp 0.7s var(--ease-out) both; }
.astra-chat.is-empty .astra-hero > :nth-child(2) { animation-delay: 0.08s; }

@keyframes astraFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }

.astra-hero-title {
    font-size: clamp(1.6rem, 2.6vw, 2.2rem);
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.15;
    margin: 0 0 10px;
    background: linear-gradient(120deg, var(--text-primary) 30%, var(--text-tertiary) 100%);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}
.astra-hero-sub { max-width: 520px; color: var(--text-muted); font-size: 0.98rem; line-height: 1.55; margin: 0; }
.astra-hero-ghost { z-index: 3; }

/* ── Composer layout ──────────────────────────────────────────────────── */
.astra-composer-wrap { flex: none; width: 100%; padding: 0 40px 24px; box-sizing: border-box; will-change: transform; }
.astra-chat.is-empty .astra-composer-wrap { padding-bottom: 0; }
.astra-composer { position: relative; max-width: 820px; margin: 0 auto; transition: max-width 0.6s var(--ease-out); }
.astra-chat.is-empty .astra-composer { max-width: 740px; }
.astra-composer-main { position: relative; }

/* ── Card ─────────────────────────────────────────────────────────────── */
@property --astra-angle { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
.astra-composer-card {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 22px;
    padding: 14px 14px 10px 18px;
    box-shadow: 0 1px 0 var(--white-05) inset, 0 8px 28px -14px var(--black-50);
    transition: border-color 0.25s ease, box-shadow 0.35s ease, transform 0.35s var(--ease-out);
}
.astra-chat.is-empty .astra-composer-card {
    padding-top: 18px;
    box-shadow: 0 1px 0 var(--white-05) inset, 0 24px 60px -24px var(--black-50);
    animation: astraFadeUp 0.7s 0.12s var(--ease-out) both;
}
.astra-composer-card:hover { border-color: var(--border-primary); }
.astra-composer-card:focus-within {
    border-color: transparent;
    box-shadow: 0 0 0 1px var(--accent-border), 0 14px 40px -16px var(--accent-glow);
}
.astra-composer-card::before {
    content: '';
    position: absolute; inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: conic-gradient(from var(--astra-angle), transparent 0 62%, var(--accent-color) 82%, rgba(var(--astra-violet), 0.9) 90%, transparent 100%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
    animation: astraSpin 7s linear infinite;
}
.astra-composer-card:focus-within::before { opacity: 0.75; }
@keyframes astraSpin { to { --astra-angle: 360deg; } }

/* Textarea (overrides the legacy #chat-input rules) */
.astra-chat #chat-input.astra-input {
    display: block;
    width: 100%;
    min-height: 28px;
    max-height: 220px;
    padding: 2px 4px 2px 0 !important;
    margin: 0;
    border: none !important;
    border-radius: 0;
    outline: none;
    box-shadow: none !important;
    background: transparent !important;
    color: var(--text-primary);
    font: inherit;
    font-size: 1.02rem;
    line-height: 1.55;
    resize: none;
    scrollbar-width: thin;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    overflow-y: auto;
    cursor: text;
}
.astra-chat.is-empty #chat-input.astra-input { min-height: 54px; font-size: 1.08rem; }
.astra-input::placeholder { color: var(--text-muted); transition: opacity 0.25s ease; }
.astra-input:focus::placeholder { opacity: 0.55; }
#chat-input.astra-input:empty::before { content: attr(placeholder); color: var(--text-muted); pointer-events: none; transition: opacity 0.25s ease; }
#chat-input.astra-input:focus:empty::before { opacity: 0.55; }

/* Attachments and @mentions inside the text */
.astra-pill {
    --c: var(--accent-color);
    --c-bg: var(--accent-dim);
    --c-border: var(--accent-border);
    display: inline-flex; align-items: center; gap: 5px;
    max-width: min(280px, 100%);
    margin: 0 1px;
    padding: 0 3px 0 7px;
    border-radius: 999px;
    border: 1px solid var(--c-border);
    background: var(--c-bg);
    color: var(--text-primary);
    font-size: 0.88em; line-height: 1.5;
    vertical-align: baseline;
    user-select: none; -webkit-user-select: none;
    transition: transform 0.2s var(--ease-spring), background 0.2s ease;
}
.astra-pill.type-source { --c: rgb(var(--astra-violet)); --c-bg: rgba(var(--astra-violet), 0.12); --c-border: rgba(var(--astra-violet), 0.35); }
.astra-pill.type-tag { --c: rgb(var(--astra-teal)); --c-bg: rgba(var(--astra-teal), 0.1); --c-border: rgba(var(--astra-teal), 0.32); }
.astra-pill.type-person { --c: #0ea5e9; --c-bg: rgba(14, 165, 233, 0.1); --c-border: rgba(14, 165, 233, 0.35); }
.astra-pill > i:first-child { color: var(--c); font-size: 1em; flex: none; }
.astra-pill-avatar { width: 16px; height: 16px; border-radius: 50%; object-fit: cover; flex: none; }
.astra-pill-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.astra-pill:hover { background: color-mix(in srgb, var(--c) 18%, transparent); }
.astra-pill.entering { animation: astraPop 0.34s var(--ease-spring) both; }
.astra-pill.pulse { animation: astraChipPulse 0.5s ease; }
.astra-pill-x {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; padding: 0; border: none; border-radius: 50%;
    background: transparent; color: var(--text-muted); cursor: pointer; font-size: 0.7em; flex: none;
    transition: background 0.18s ease, color 0.18s ease;
}
.astra-pill-x:hover { background: var(--white-10); color: var(--text-primary); }

/* ── Attachment chips ─────────────────────────────────────────────────── */
.astra-chips {
    display: flex; flex-wrap: wrap; gap: 6px;
    max-height: 0; opacity: 0; overflow: hidden;
    transition: max-height 0.35s var(--ease-out), opacity 0.25s ease, margin 0.3s ease;
}
.astra-chips.has-chips { max-height: 132px; opacity: 1; margin-bottom: 10px; overflow-y: auto; }
.astra-chip {
    --c: var(--accent-color);
    --c-bg: var(--accent-dim);
    --c-border: var(--accent-border);
    display: inline-flex; align-items: center; gap: 6px;
    max-width: 260px;
    padding: 4px 6px 4px 9px;
    border-radius: 999px;
    border: 1px solid var(--c-border);
    background: var(--c-bg);
    color: var(--text-primary);
    font-size: 0.82rem; line-height: 1.2;
    transition: transform 0.2s var(--ease-spring), opacity 0.18s ease, background 0.2s ease;
}
.astra-chip.type-source { --c: rgb(var(--astra-violet)); --c-bg: rgba(var(--astra-violet), 0.12); --c-border: rgba(var(--astra-violet), 0.35); }
.astra-chip.type-tag { --c: rgb(var(--astra-teal)); --c-bg: rgba(var(--astra-teal), 0.1); --c-border: rgba(var(--astra-teal), 0.32); }
.astra-chip > i:first-child { color: var(--c); font-size: 1rem; flex: none; }
.astra-chip-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.astra-chip.entering { animation: astraPop 0.34s var(--ease-spring) both; }
.astra-chip.pulse { animation: astraChipPulse 0.5s ease; }
.astra-chip.leaving { opacity: 0; transform: scale(0.8); }
.astra-chip:hover { background: color-mix(in srgb, var(--c) 18%, transparent); }
@keyframes astraChipPulse { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.08); box-shadow: 0 0 0 4px var(--c-bg); } }
.astra-chip-x {
    display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px; padding: 0; border: none; border-radius: 50%;
    background: transparent; color: var(--text-muted); cursor: pointer; font-size: 0.72rem;
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.astra-chip-x:hover { background: var(--white-10); color: var(--text-primary); transform: rotate(90deg); }
.astra-chip.static { padding: 4px 10px 4px 8px; animation: astraFadeUp 0.4s calc(var(--i, 0) * 60ms) var(--ease-out) both; }
.astra-chip.static.filters, .astra-chip.static.scope { --c: var(--text-tertiary); --c-bg: var(--white-05); --c-border: var(--border-primary); }

/* ── Toolbar ──────────────────────────────────────────────────────────── */
.astra-composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.astra-tools, .astra-actions { display: flex; align-items: center; gap: 4px; min-width: 0; }
.astra-tool-btn {
    position: relative;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 34px; min-width: 34px; padding: 0 9px;
    border: 1px solid transparent; border-radius: 11px;
    background: transparent; color: var(--text-muted);
    font: inherit; font-size: 0.84rem; font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s var(--ease-spring), border-color 0.2s ease;
}
.astra-tool-btn i { font-size: 1.12rem; transition: transform 0.3s var(--ease-spring); }
.astra-tool-btn:hover { background: var(--white-05); color: var(--text-primary); transform: translateY(-1px); }
.astra-tool-btn:hover i { transform: rotate(-8deg) scale(1.12); }
.astra-tool-btn:active { transform: scale(0.94); }
.astra-tool-btn.open, .astra-filter-btn.active { color: var(--accent-color); background: var(--accent-dim); border-color: var(--accent-border); }
.astra-filter-btn.open i { transform: rotate(180deg); }
.astra-badge {
    min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px;
    background: var(--accent-color); color: #fff; font-size: 0.68rem; font-weight: 700; line-height: 17px; text-align: center;
}
.astra-badge:empty { display: none; }
.astra-badge.bump { animation: astraBump 0.45s var(--ease-spring); }
@keyframes astraBump { 0% { transform: scale(0.4); } 60% { transform: scale(1.35); } 100% { transform: scale(1); } }
.astra-mic.recording { color: var(--accent-color); background: var(--accent-dim); animation: astraMic 1.2s ease-in-out infinite; }
@keyframes astraMic { 0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); } 50% { box-shadow: 0 0 0 7px transparent; } }

/* Scope segmented control (prioritize / only these) */
.astra-scope, .astra-seg {
    position: relative; display: none; align-items: center;
    padding: 2px; border-radius: 11px; background: var(--bg-tertiary); border: 1px solid var(--border-subtle);
}
.astra-scope.visible { display: inline-flex; margin-left: 4px; animation: astraPop 0.35s var(--ease-spring) both; }
.astra-scope button, .astra-seg button {
    position: relative; z-index: 1; border: none; background: transparent; cursor: pointer;
    padding: 5px 11px; font: inherit; font-size: 0.78rem; font-weight: 500; color: var(--text-muted);
    border-radius: 9px; transition: color 0.2s ease; white-space: nowrap;
}
.astra-scope button.on, .astra-seg button.on { color: var(--text-primary); }
.astra-scope-thumb, .astra-seg-thumb {
    position: absolute; top: 2px; bottom: 2px; left: 2px; width: calc(50% - 2px);
    border-radius: 9px; background: var(--bg-elevated); box-shadow: 0 1px 4px var(--black-30);
    transition: transform 0.35s var(--ease-out);
}
.astra-scope[data-mode="only"] .astra-scope-thumb { transform: translateX(100%); }
.astra-seg { display: inline-flex; }
.astra-seg button { min-width: 78px; }
.astra-seg-thumb { width: calc(33.333% - 1.33px); }
.astra-seg[data-value="file"] .astra-seg-thumb { transform: translateX(100%); }
.astra-seg[data-value="interview"] .astra-seg-thumb { transform: translateX(200%); }

/* Send */
.astra-send {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border: none; border-radius: 50%; cursor: pointer;
    background: var(--bg-elevated); color: var(--text-muted); font-size: 1.15rem;
    opacity: 0.6; transform: scale(0.94);
    transition: background 0.25s ease, color 0.25s ease, opacity 0.25s ease, transform 0.3s var(--ease-spring), box-shadow 0.3s ease;
}
.astra-send i { transition: transform 0.35s var(--ease-spring); }
.astra-send.ready { background: var(--accent-color); color: #fff; opacity: 1; transform: scale(1); box-shadow: 0 6px 18px -4px var(--accent-glow); }
.astra-send.ready:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 10px 22px -4px var(--accent-glow); }
.astra-send.ready:hover i { transform: translateY(-2px); }
.astra-send:active { transform: scale(0.9) !important; }
.astra-send:disabled { cursor: progress; opacity: 0.45; }

/* ── Hints & suggestions ──────────────────────────────────────────────── */
.astra-hints {
    display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 16px;
    margin-top: 12px; color: var(--text-muted); font-size: 0.76rem;
    opacity: 0; max-height: 0; overflow: hidden; transition: opacity 0.3s ease, max-height 0.3s ease;
}
.astra-chat.is-empty .astra-hints, .astra-composer:focus-within .astra-hints { opacity: 0.85; max-height: 40px; }
.astra-hints kbd, .astra-ac-foot kbd {
    display: inline-block; min-width: 18px; padding: 1px 5px; margin-right: 3px;
    border: 1px solid var(--border-primary); border-bottom-width: 2px; border-radius: 5px;
    background: var(--bg-tertiary); color: var(--text-tertiary); font: inherit; font-size: 0.72rem; text-align: center;
}
.astra-suggestions { display: none; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 22px; }
.astra-chat.is-empty .astra-suggestions { display: grid; }
.astra-suggestion {
    display: flex; align-items: center; gap: 10px; text-align: left;
    padding: 12px 14px; border-radius: 14px; cursor: pointer;
    border: 1px solid var(--border-subtle); background: transparent; color: var(--text-secondary);
    font: inherit; font-size: 0.88rem; line-height: 1.35;
    animation: astraFadeUp 0.6s calc(0.25s + var(--i) * 70ms) var(--ease-out) both;
    transition: transform 0.25s var(--ease-out), background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.astra-suggestion i { flex: none; font-size: 1.15rem; color: var(--accent-color); transition: transform 0.3s var(--ease-spring); }
.astra-suggestion:hover { background: var(--white-05); border-color: var(--border-primary); color: var(--text-primary); transform: translateY(-2px); }
.astra-suggestion:hover i { transform: scale(1.18) rotate(-6deg); }
.astra-suggestion:active { transform: scale(0.98); }

/* ── Popovers (autocomplete + filters) ────────────────────────────────── */
.astra-ac, .astra-filter-panel {
    position: absolute; left: 0; right: 0; bottom: calc(100% + 10px); top: auto; z-index: 30;
    background: var(--bg-secondary); border: 1px solid var(--border-primary); border-radius: 18px;
    box-shadow: 0 24px 60px -18px var(--black-50), 0 2px 0 var(--white-05) inset;
    opacity: 0; visibility: hidden; pointer-events: none;
    transform: translateY(10px) scale(0.975); transform-origin: bottom center;
    transition: opacity 0.2s ease, transform 0.32s var(--ease-out), visibility 0s linear 0.32s;
}
.astra-ac.pop-down, .astra-filter-panel.pop-down {
    bottom: auto; top: calc(100% + 10px); transform: translateY(-10px) scale(0.975); transform-origin: top center;
}
.astra-ac.pop-down.visible, .astra-filter-panel.pop-down.visible { transform: none; }
.astra-ac.visible, .astra-filter-panel.visible {
    opacity: 1; visibility: visible; pointer-events: auto; transform: none;
    transition: opacity 0.2s ease, transform 0.32s var(--ease-out), visibility 0s;
}
.astra-ac { max-height: min(360px, 46vh); overflow-y: auto; padding: 8px; scrollbar-width: thin; backdrop-filter: blur(14px); }
.astra-ac-group + .astra-ac-group { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border-subtle); }
.astra-ac-title { padding: 6px 10px 4px; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.astra-ac-item {
    position: relative; display: flex; align-items: center; gap: 11px;
    padding: 8px 10px; border-radius: 11px; cursor: pointer;
    transition: background 0.15s ease, transform 0.2s var(--ease-out);
}
.astra-ac.animate-items .astra-ac-item { animation: astraFadeUp 0.3s calc(var(--i) * 22ms) var(--ease-out) both; }
.astra-ac-item::before {
    content: ''; position: absolute; left: 0; top: 22%; bottom: 22%; width: 3px; border-radius: 3px;
    background: var(--accent-color); transform: scaleY(0); transition: transform 0.25s var(--ease-spring);
}
.astra-ac-item.active { background: var(--accent-dim); }
.astra-ac-item.active::before { transform: scaleY(1); }
.astra-ac-item.active { transform: translateX(2px); }
.astra-ac-ico, .astra-ac-avatar {
    flex: none; width: 34px; height: 34px; border-radius: 10px; object-fit: cover;
    display: inline-flex; align-items: center; justify-content: center; font-size: 1.15rem;
}
.astra-ac-avatar { border-radius: 50%; }
.astra-ac-ico.file { background: var(--accent-dim); color: var(--accent-color); }
.astra-ac-ico.src { background: rgba(var(--astra-violet), 0.14); color: rgb(var(--astra-violet)); }
.astra-ac-ico.tag { background: rgba(var(--astra-teal), 0.12); color: rgb(var(--astra-teal)); }
.astra-ac-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.astra-ac-name { color: var(--text-primary); font-size: 0.92rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.astra-ac-sub { color: var(--text-muted); font-size: 0.76rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.astra-ac-name mark { background: var(--accent-dim); color: var(--accent-color); border-radius: 3px; padding: 0 1px; }
.astra-ac-kind { flex: none; padding: 2px 8px; border-radius: 999px; background: var(--white-05); color: var(--text-muted); font-size: 0.68rem; }
.astra-ac-whys { flex: none; display: flex; gap: 4px; }
.astra-ac-why { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 999px; background: var(--accent-dim); color: var(--accent-color); font-size: 0.66rem; white-space: nowrap; }
.astra-ac-why i { font-size: 0.78rem; }
.astra-ac-whys .astra-ac-why + .astra-ac-why span { display: none; }
.astra-ac-empty { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 18px; color: var(--text-muted); font-size: 0.88rem; }
.astra-ac-foot { display: flex; gap: 14px; margin-top: 6px; padding: 8px 10px 2px; border-top: 1px solid var(--border-subtle); color: var(--text-muted); font-size: 0.72rem; }
.astra-ac-skel { display: flex; flex-direction: column; gap: 8px; padding: 6px 10px; }
.astra-ac-skel span {
    height: 34px; border-radius: 10px;
    background: linear-gradient(100deg, var(--white-05) 30%, var(--white-10) 50%, var(--white-05) 70%);
    background-size: 220% 100%; animation: astraShimmer 1.2s linear infinite;
}
.astra-ac-skel span:nth-child(2) { opacity: 0.7; } .astra-ac-skel span:nth-child(3) { opacity: 0.45; }
@keyframes astraShimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }

/* Filter panel */
.astra-filter-panel { display: flex; flex-direction: column; max-height: min(520px, 62vh); overflow: hidden; }
.astra-filter-panel.visible .astra-fp-head, .astra-filter-panel.visible section, .astra-filter-panel.visible .astra-fp-foot {
    animation: astraFadeUp 0.38s calc(var(--s, 0) * 45ms) var(--ease-out) both;
}
.astra-fp-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 12px; }
.astra-fp-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 1rem; color: var(--text-primary); }
.astra-fp-title i { color: var(--accent-color); }
.astra-fp-sub { margin-top: 2px; font-size: 0.78rem; color: var(--text-muted); }
.astra-fp-head-actions { display: flex; align-items: center; gap: 6px; }
.astra-link-btn { border: none; background: transparent; color: var(--text-muted); font: inherit; font-size: 0.82rem; cursor: pointer; padding: 6px 8px; border-radius: 8px; transition: color 0.2s ease, background 0.2s ease; }
.astra-link-btn:hover { color: var(--text-primary); background: var(--white-05); }
.astra-fp-close { width: 30px; height: 30px; border: none; border-radius: 9px; background: transparent; color: var(--text-muted); cursor: pointer; transition: all 0.25s var(--ease-out); }
.astra-fp-close:hover { background: var(--white-05); color: var(--text-primary); transform: rotate(90deg); }
.astra-fp-body { flex: 1; overflow-y: auto; padding: 2px 18px 8px; scrollbar-width: thin; }
.astra-fp-body section { padding: 12px 0; border-top: 1px solid var(--border-subtle); }
.astra-fp-body h4 { display: flex; align-items: center; gap: 7px; margin: 0 0 10px; font-size: 0.74rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-tertiary); }
.astra-fp-body h4 i { color: var(--text-muted); font-size: 0.95rem; }
.astra-fchips { display: flex; flex-wrap: wrap; gap: 7px; }
.astra-fchips.small { margin-top: 10px; }
.astra-fchip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 11px; border-radius: 999px; cursor: pointer;
    border: 1px solid var(--border-primary); background: transparent; color: var(--text-secondary);
    font: inherit; font-size: 0.82rem;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s var(--ease-spring);
}
.astra-fchip > i:first-child { font-size: 1rem; color: var(--text-muted); transition: color 0.2s ease; }
.astra-fchip .astra-fchip-check { width: 0; margin-left: -6px; opacity: 0; font-size: 0.8rem; color: var(--accent-color); transition: width 0.25s var(--ease-spring), margin 0.25s var(--ease-spring), opacity 0.2s ease; }
.astra-fchip:hover { border-color: var(--border-hover); color: var(--text-primary); transform: translateY(-1px); }
.astra-fchip:active { transform: scale(0.95); }
.astra-fchip.on { background: var(--accent-dim); border-color: var(--accent-border); color: var(--text-primary); }
.astra-fchip.on > i:first-child { color: var(--accent-color); }
.astra-fchip.on .astra-fchip-check { width: 0.85em; margin-left: 0; opacity: 1; }
.astra-fchip.person img { width: 18px; height: 18px; border-radius: 50%; object-fit: cover; }
.astra-fchip.preset { font-size: 0.78rem; padding: 4px 10px; }
.astra-dates { display: flex; align-items: flex-end; gap: 10px; }
.astra-dates > i { margin-bottom: 11px; color: var(--text-muted); }
.astra-dates label { display: flex; flex-direction: column; gap: 4px; flex: 1; font-size: 0.72rem; color: var(--text-muted); }
.astra-dates input {
    width: 100%; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border-primary);
    background: var(--bg-tertiary); color: var(--text-primary); font: inherit; font-size: 0.86rem; color-scheme: dark;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
[data-theme="light"] .astra-dates input { color-scheme: light; }
.astra-dates input:focus { outline: none; border-color: var(--accent-color); box-shadow: 0 0 0 3px var(--accent-dim); }
.astra-fp-note { margin: 8px 0 0; font-size: 0.74rem; color: var(--text-muted); }
.astra-fp-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px 14px; border-top: 1px solid var(--border-subtle); background: var(--bg-secondary); }
.astra-fp-summary { font-size: 0.8rem; color: var(--text-muted); transition: color 0.25s ease; }
.astra-fp-summary.on { color: var(--accent-color); }
.astra-primary-btn {
    border: none; cursor: pointer; padding: 8px 18px; border-radius: 11px;
    background: var(--accent-color); color: #fff; font: inherit; font-size: 0.86rem; font-weight: 600;
    transition: transform 0.25s var(--ease-spring), box-shadow 0.25s ease, filter 0.2s ease;
}
.astra-primary-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 20px -6px var(--accent-glow); filter: brightness(1.06); }
.astra-primary-btn:active { transform: scale(0.96); }

/* ── Uploaded files (composer chips, drop zone, message bubble) ───────── */
.astra-chip.type-upload {
    --c: rgb(var(--astra-teal));
    --c-bg: rgba(var(--astra-teal), 0.1);
    --c-border: rgba(var(--astra-teal), 0.32);
    position: relative; overflow: hidden;
    padding: 4px 6px 4px 5px;
    border-radius: 14px;
    max-width: 280px;
    background: linear-gradient(90deg, color-mix(in srgb, var(--c) 24%, transparent) calc(var(--p, 0) * 100%), var(--c-bg) calc(var(--p, 0) * 100%));
}
.astra-chip.type-upload > i:first-child { font-size: 1.35rem; margin: 0 2px 0 3px; }
.astra-chip.type-upload.status-ready { background: var(--c-bg); }
.astra-chip.type-upload.status-error { --c: #ef4444; --c-bg: rgba(239, 68, 68, 0.1); --c-border: rgba(239, 68, 68, 0.4); }
.astra-chip.type-upload.unreadable { --c: #f59e0b; --c-bg: rgba(245, 158, 11, 0.1); --c-border: rgba(245, 158, 11, 0.4); }
.astra-chip-thumb { width: 28px; height: 28px; border-radius: 8px; object-fit: cover; flex: none; box-shadow: 0 0 0 1px var(--c-border); }
.astra-chip-text { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.astra-chip-sub { font-size: 0.68rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.astra-chip.type-upload.status-error .astra-chip-sub { color: #ef4444; }
.astra-chip.type-upload.unreadable .astra-chip-sub { color: #f59e0b; }
.astra-chip-spin {
    width: 14px; height: 14px; flex: none; border-radius: 50%;
    border: 2px solid color-mix(in srgb, var(--c) 25%, transparent); border-top-color: var(--c);
    animation: spin 0.8s linear infinite;
}

.astra-drop-overlay {
    position: absolute; inset: 0; z-index: 5;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    border-radius: inherit;
    border: 2px dashed var(--accent-color);
    background: color-mix(in srgb, var(--bg-secondary) 82%, var(--accent-color) 18%);
    -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
    color: var(--accent-color); font-weight: 600; font-size: 0.95rem;
    opacity: 0; visibility: hidden; transform: scale(0.985);
    transition: opacity 0.2s ease, transform 0.25s var(--ease-spring), visibility 0.2s;
    pointer-events: none;
}
.astra-drop-overlay.visible { opacity: 1; visibility: visible; transform: scale(1); }
.astra-drop-overlay i { font-size: 2rem; animation: astraFloat 1.4s ease-in-out infinite; }
.astra-composer-card.is-dragging { box-shadow: 0 0 0 1px var(--accent-border), 0 18px 48px -14px var(--accent-glow); }

.astra-msg-uploads { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-bottom: 10px; }
.astra-msg-upload {
    --c: rgb(var(--astra-teal));
    display: inline-flex; align-items: center; gap: 8px;
    padding: 0; border: 1px solid var(--border-subtle); border-radius: 12px;
    background: var(--white-05); color: var(--text-primary); text-decoration: none; cursor: pointer; font: inherit;
    animation: astraFadeUp 0.4s calc(var(--i, 0) * 60ms) var(--ease-out) both;
    transition: transform 0.25s var(--ease-spring), border-color 0.2s ease, box-shadow 0.25s ease;
}
.astra-msg-upload:hover { transform: translateY(-2px); border-color: var(--c); box-shadow: 0 8px 20px -10px var(--black-50); }
.astra-msg-upload.is-image { overflow: hidden; }
.astra-msg-upload.is-image img { display: block; max-width: 200px; max-height: 150px; min-width: 64px; min-height: 48px; object-fit: cover; }
.astra-msg-upload.is-file { padding: 7px 12px 7px 9px; max-width: 260px; }
.astra-msg-upload.is-file > i { color: var(--c); font-size: 1.4rem; flex: none; }

.astra-chat .message-text .astra-citation.is-upload { cursor: default; color: rgb(var(--astra-teal)); }
.astra-chat .message-text .astra-citation.is-upload:hover { transform: none; }
@media (prefers-reduced-motion: reduce) {
    .astra-chip-spin, .astra-drop-overlay i, .astra-msg-upload { animation: none; }
}

/* ── Context shown inside the user's message ─────────────────────────── */
.astra-msg-context { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin-top: 10px; }

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 820px) {
    .astra-composer-wrap { padding: 0 14px 14px; }
    .astra-chat .chat-messages { padding: 20px 14px 12px; }
    .astra-suggestions { grid-template-columns: 1fr; }
    .astra-tool-label { display: none; }
    .astra-hints { display: none; }
}

[data-theme="light"] .astra-composer-card { box-shadow: 0 1px 0 #fff inset, 0 10px 30px -14px rgba(0, 0, 0, 0.18); }
[data-theme="light"] .astra-ac, [data-theme="light"] .astra-filter-panel { box-shadow: 0 24px 50px -20px rgba(0, 0, 0, 0.25); }

@media (prefers-reduced-motion: reduce) {
    .astra-chat *, .astra-chat *::before, .astra-chat *::after { animation: none !important; transition-duration: 0.01ms !important; }
}
/* Neutralise the legacy .mention-dropdown rules for the new popover */
.mention-dropdown.astra-ac { display: block; margin: 0; left: 0; right: 0; }

/* ── Profile → Security: password change by email link ─────────────────── */
.security-password-card {
    display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
    padding: 16px 18px; border-radius: 14px;
    border: 1px solid var(--border-primary); background: var(--bg-primary);
}
.security-password-info { flex: 1 1 280px; min-width: 0; }
.security-password-title { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.security-password-title i { color: var(--accent-color); font-size: 1.15rem; }
.security-password-info .settings-description { margin: 0; }
.security-password-status { margin: 10px 0 0; font-size: 0.85rem; line-height: 1.45; }
.security-password-status[hidden] { display: none; }
.security-password-status[data-kind="ok"] { color: #10b981; }
.security-password-status[data-kind="error"] { color: #ef4444; }
#password-reset-btn { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }

/* Astra: safety warnings forwarded with an answer */
.astra-warnings {
    --warn-color: #f5a623;
    margin: 0 0 14px;
    border: 1px solid color-mix(in srgb, var(--warn-color) 55%, transparent);
    border-radius: 10px;
    background: color-mix(in srgb, var(--warn-color) 11%, var(--bg-secondary));
    overflow: hidden;
    text-align: left;
}
.astra-warnings.level-danger { --warn-color: #e5383b; }
.astra-warnings.level-warning { --warn-color: #f5731d; }
.astra-warnings.level-caution { --warn-color: #f5c000; }
.astra-warnings.level-notice { --warn-color: var(--accent-blue); }
.astra-warnings-head {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 14px;
    font-weight: 700; font-size: 0.82rem; letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--warn-color);
    background: color-mix(in srgb, var(--warn-color) 14%, transparent);
}
.astra-warnings-head i { font-size: 1.2rem; }
.astra-warning-item {
    --item-color: var(--warn-color);
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px 14px;
    border-top: 1px solid color-mix(in srgb, var(--warn-color) 25%, transparent);
}
.astra-warning-item.level-danger { --item-color: #e5383b; }
.astra-warning-item.level-warning { --item-color: #f5731d; }
.astra-warning-item.level-caution { --item-color: #f5c000; }
.astra-warning-item.level-notice { --item-color: var(--accent-blue); }
.astra-warning-icon { color: var(--item-color); font-size: 1.25rem; flex: none; margin-top: 1px; }
.astra-warning-body { flex: 1; min-width: 0; }
.astra-warning-level { color: var(--item-color); font-weight: 700; font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; }
.astra-warning-ref { font-size: 0.82rem; font-weight: 600; margin-top: 2px; overflow-wrap: anywhere; }
.astra-warning-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; font-size: 0.92rem; margin-top: 2px; }
.astra-warning-src { margin-top: 4px; font-size: 0.74rem; opacity: 0.65; }
.astra-warning-img { max-width: 72px; max-height: 72px; border-radius: 6px; background: #fff; flex: none; }
.astra-warning-open {
    flex: none; background: transparent; border: 0; color: inherit; opacity: 0.6; cursor: pointer; padding: 4px; border-radius: 6px;
}
.astra-warning-open:hover { opacity: 1; background: color-mix(in srgb, var(--warn-color) 18%, transparent); }

/* Source tile of a JSONL knowledge entry (public/astra-entry-source.js) */
.source-tile.entry-source-tile .source-content { font-size: 0.9rem; }
.astra-entry { --tone: var(--text-muted); display: flex; flex-direction: column; gap: 14px; }
.astra-entry-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; }
.astra-entry-key {
    display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 700; font-size: 0.85rem;
    color: var(--accent-blue); background: color-mix(in srgb, var(--accent-blue) 13%, transparent);
}
.astra-entry-kind { font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.astra-entry-badges { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.astra-entry-badge {
    --tone: var(--text-muted);
    display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px;
    font-size: 0.74rem; font-weight: 600; color: var(--tone);
    background: color-mix(in srgb, var(--tone) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--tone) 30%, transparent);
}
.tone-accent { --tone: var(--accent-blue); }
.tone-violet { --tone: #9b7bff; }
.tone-ok { --tone: #22c55e; }
.tone-info { --tone: #38a1f3; }
.tone-warn { --tone: #f5a623; }
.tone-danger { --tone: #e5383b; }
.tone-muted { --tone: var(--text-muted); }

.astra-entry-alerts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.astra-entry-alerts li {
    display: flex; align-items: flex-start; gap: 8px; padding: 8px 12px; border-radius: 8px; line-height: 1.45;
    font-size: 0.85rem; color: var(--text-primary, inherit);
    background: color-mix(in srgb, var(--tone) 11%, transparent);
    border-left: 3px solid var(--tone);
}
.astra-entry-alerts li i { color: var(--tone); font-size: 1.05rem; margin-top: 1px; flex: none; }

.astra-entry-statement {
    margin: 0; padding: 12px 16px; border-radius: 10px; border-left: 4px solid var(--accent-blue);
    background: color-mix(in srgb, var(--accent-blue) 8%, transparent);
    font-size: 1rem; line-height: 1.55; font-weight: 500;
}
.astra-entry-statement p { margin: 0 0 8px; }
.astra-entry-statement p:last-child { margin-bottom: 0; }

.astra-entry-facts {
    margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px 18px;
}
.astra-entry-facts.is-stacked { grid-template-columns: 1fr; }
.astra-entry-fact { min-width: 0; }
.astra-entry-fact dt { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 3px; }
.astra-entry-fact dd { margin: 0; display: flex; flex-wrap: wrap; gap: 5px; line-height: 1.45; overflow-wrap: anywhere; }
.astra-entry-facts.is-stacked .astra-entry-fact dd { display: block; }
.astra-entry-facts.is-stacked .astra-entry-fact dd p { margin: 0 0 6px; }
.astra-entry-chip {
    display: inline-block; padding: 1px 9px; border-radius: 6px; font-size: 0.8rem;
    background: var(--bg-tertiary); border: 1px solid var(--border-subtle);
}
.astra-entry-chip.is-soft { background: transparent; }
.astra-entry-chip.is-mono, .astra-entry-thread { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.76rem; }

.astra-entry-section { border: 1px solid var(--border-subtle); border-radius: 10px; background: var(--bg-secondary); }
.astra-entry-section > summary {
    display: flex; align-items: center; gap: 8px; padding: 9px 12px; cursor: pointer; list-style: none;
    font-size: 0.85rem; font-weight: 600; user-select: none;
}
.astra-entry-section > summary::-webkit-details-marker { display: none; }
.astra-entry-section > summary::after {
    content: '\203A'; margin-left: auto; font-size: 1.1rem; color: var(--text-muted); transition: transform 0.15s;
}
.astra-entry-section[open] > summary::after { transform: rotate(90deg); }
.astra-entry-section > summary i { color: var(--accent-blue); font-size: 1.05rem; }
.astra-entry-count { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); background: var(--bg-tertiary); padding: 0 7px; border-radius: 999px; }
.astra-entry-section[open] > summary { border-bottom: 1px solid var(--border-subtle); }

.astra-entry-quotes, .astra-entry-questions { list-style: none; margin: 0; padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; }
.astra-entry-quote { padding-left: 12px; border-left: 3px solid color-mix(in srgb, var(--accent-blue) 45%, transparent); }
.astra-entry-quote-meta { display: flex; align-items: center; gap: 8px; font-size: 0.75rem; color: var(--text-muted); margin-bottom: 3px; }
.astra-entry-quote-text { font-size: 0.86rem; line-height: 1.55; font-style: italic; overflow-wrap: anywhere; }
.astra-entry-questions li { font-size: 0.86rem; line-height: 1.5; padding-left: 14px; position: relative; }
.astra-entry-questions li::before { content: '\2022'; position: absolute; left: 2px; color: var(--accent-blue); }
.astra-entry-threads { display: flex; flex-wrap: wrap; gap: 5px; padding: 10px 12px 4px; }
.astra-entry-note { padding: 4px 12px 10px; font-size: 0.78rem; color: var(--text-muted); overflow-wrap: anywhere; }

@media (max-width: 640px) {
    .astra-entry-badges { margin-left: 0; }
}

/* Astra debug mode: live view of every model call */
.astra-live-llm { margin: 8px 0; border: 1px solid var(--border-subtle); border-radius: 8px; background: var(--bg-secondary); font-size: 0.82rem; overflow: hidden; }
.astra-live-llm-head { display: flex; align-items: center; gap: 6px; padding: 6px 10px; cursor: pointer; font-weight: 600; color: var(--text-secondary); user-select: none; }
.astra-live-llm-count { font-weight: 400; color: var(--text-muted); }
.astra-live-llm.is-collapsed .astra-live-llm-list { display: none; }
.astra-llm-call { border-top: 1px solid var(--border-subtle); padding: 6px 10px; }
.astra-llm-call-head { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.astra-llm-call-title { font-weight: 600; color: var(--text-primary); }
.astra-llm-call-meta { margin-left: auto; color: var(--text-muted); font-variant-numeric: tabular-nums; font-size: 0.78rem; }
.astra-llm-call.is-running .astra-llm-call-head i { color: var(--accent-color, #60a5fa); }
.astra-llm-call.is-done .astra-llm-call-head i { color: #22c55e; }
.astra-llm-call.is-failed .astra-llm-call-head i { color: #ef4444; }
.astra-llm-spin { animation: astra-llm-spin 1s linear infinite; }
.astra-llm-call:not(.is-running) .astra-llm-spin { animation: none; }
@keyframes astra-llm-spin { to { transform: rotate(360deg); } }
.astra-llm-call.is-collapsed .astra-llm-call-prompt,
.astra-llm-call.is-collapsed .astra-llm-call-out { display: none; }
.astra-llm-call-prompt summary { cursor: pointer; color: var(--text-muted); font-size: 0.75rem; padding: 4px 0; }
.astra-llm-call-prompt pre,
.astra-llm-call-out { margin: 4px 0 0; padding: 8px 10px; max-height: 260px; overflow: auto; background: rgba(0,0,0,0.25); border-radius: 6px; font-size: 0.76rem; line-height: 1.4; white-space: pre-wrap; word-break: break-word; color: var(--text-secondary); }
.astra-llm-reasoning { color: var(--text-muted); font-style: italic; }
.astra-llm-content { color: var(--text-primary); }
.astra-llm-wait { color: var(--text-muted); animation: astra-llm-pulse 1.4s ease-in-out infinite; }
@keyframes astra-llm-pulse { 50% { opacity: 0.4; } }

/* Astra activity feed (where the status line is): a window of the last 3 steps/tool uses in the status-line format.
   New lines slide in at the bottom, older ones glide up and vanish into a fog at the top. */
@property --astra-fog { syntax: '<number>'; inherits: false; initial-value: 1; }
.astra-tool-feed {
    --astra-fog: 1;
    position: relative; align-self: stretch; width: 100%; height: 0; overflow: hidden;
    -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,var(--astra-fog)) 0%, #000 46%);
    mask-image: linear-gradient(to bottom, rgba(0,0,0,var(--astra-fog)) 0%, #000 46%);
    transition: height 0.45s cubic-bezier(0.22, 0.61, 0.36, 1), --astra-fog 0.6s ease;
}
.astra-tool-feed.has-fog { --astra-fog: 0; }
.astra-feed-list { position: absolute; left: 0; right: 0; bottom: 0; will-change: transform; }
.astra-tool-feed .astra-feed-item { margin-bottom: 6px; max-width: 100%; }
.astra-tool-feed .astra-feed-item .astra-loading-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.astra-feed-item .astra-feed-tick { animation: none; display: inline-block; font-size: 1.05em; }
.astra-feed-item.is-done .astra-feed-tick { color: #22c55e; transition: color 0.3s ease; }
.astra-feed-item.is-failed .astra-feed-tick { color: #eab308; }
.astra-feed-item.is-done .astra-loading-text,
.astra-feed-item.is-failed .astra-loading-text { animation: none; background: none; -webkit-text-fill-color: currentColor; color: var(--text-muted); }
.astra-tool-feed.is-summary {
    position: static; height: auto; overflow: visible; -webkit-mask-image: none; mask-image: none; transition: none;
    display: flex; flex-direction: row; align-items: center; justify-content: flex-start; gap: 6px;
    margin: 0 0 10px; font-size: 0.8rem; color: var(--text-muted); text-align: left;
}
@media (prefers-reduced-motion: reduce) {
    .astra-tool-feed, .astra-feed-list { transition: none !important; }
}
