/* =========================================================
   AI Employee Orchestrator - Main Design System (Vanilla CSS)
   Aesthetics: Deep Space Obsidian, Glassmorphism, Cyber Glow
   ========================================================= */

:root {
    --bg-primary: #07090e;
    --bg-surface: rgba(16, 21, 34, 0.7);
    --bg-surface-elevated: rgba(23, 31, 50, 0.85);
    --bg-input: rgba(12, 17, 29, 0.9);
    
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(139, 92, 246, 0.35);
    --border-cyan: rgba(6, 182, 212, 0.35);

    --primary: #8b5cf6;
    --primary-glow: rgba(139, 92, 246, 0.4);
    --cyan: #06b6d4;
    --cyan-glow: rgba(6, 182, 212, 0.4);
    --emerald: #10b981;
    --emerald-glow: rgba(16, 185, 129, 0.3);
    --amber: #f59e0b;
    --rose: #f43f5e;

    --text-high: #f8fafc;
    --text-mid: #94a3b8;
    --text-low: #64748b;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-full: 9999px;

    --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --shadow-soft: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 25px rgba(139, 92, 246, 0.25);
}

*, *::before, *::after,
html, body, div, span, p, h1, h2, h3, h4, h5, h6,
ul, ol, li, table, thead, tbody, tr, th, td,
button, a, label, section, article, main, header, nav, footer,
pre, code, blockquote, svg, img {
    box-sizing: border-box;
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    -webkit-touch-callout: none !important;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* ========================================================
   Global Theme-Matched Scrollbars (Edge-to-Edge Sleek Dark UI)
   ======================================================== */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(139, 92, 246, 0.4) rgba(15, 23, 42, 0.3);
}

*::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

*::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.4);
    border-radius: var(--radius-full);
}

*::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.45), rgba(6, 182, 212, 0.45));
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

*::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.75), rgba(6, 182, 212, 0.75));
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
}

*::-webkit-scrollbar-corner {
    background: transparent;
}

/* Allow text selection ONLY in interactive text inputs */
input, select, textarea, [contenteditable="true"] {
    user-select: text !important;
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-high);
    font-family: var(--font-main);
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

/* Ambient Background Lights */
.ambient-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.45;
    transform: translate3d(0, 0, 0);
    will-change: transform;
}
.glow-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.25), transparent 70%);
    top: -200px;
    left: -150px;
}
.glow-2 {
    width: 550px;
    height: 550px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.2), transparent 70%);
    bottom: -150px;
    right: -100px;
}
.glow-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(244, 63, 94, 0.15), transparent 70%);
    top: 40%;
    left: 45%;
    transform: translate(-50%, -50%);
}

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

.chat-viewport.hidden,
.employees-viewport.hidden {
    display: none !important;
}

/* Glass Card Utility */
.glass-card {
    background: var(--bg-surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-soft);
}

/* App Layout */
.app-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
    width: 100%;
    max-width: 100%;
    margin: 0;
    position: relative;
    z-index: 1;
    overflow: hidden;
}

/* Header */
.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 24px;
    border-radius: 0;
    border-top: none;
    border-left: none;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    z-index: 100;
    flex-shrink: 0;
    gap: 14px;
    height: 64px;
    min-height: 64px;
    max-height: 64px;
    overflow: visible;
    box-sizing: border-box;
    position: relative;
}

.header-left {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.brand-badge {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-icon-wrapper {
    position: relative;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(6, 182, 212, 0.3));
    border-radius: var(--radius-md);
    border: 1px solid var(--border-highlight);
    font-size: 20px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0;
    margin: 0;
    padding: 0;
}

.brand-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 0;
    line-height: 1.15;
}

.brand-title {
    margin: 0;
    padding: 0;
    line-height: 1.15;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #ffffff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.version-tag {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    background: rgba(139, 92, 246, 0.2);
    color: #c084fc;
    border: 1px solid rgba(139, 92, 246, 0.4);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    line-height: 1;
}

.brand-subtitle {
    margin: 1px 0 0 0;
    padding: 0;
    line-height: 1.2;
    font-size: 0.78rem;
    color: var(--text-mid);
    letter-spacing: -0.01em;
}

/* Header Flow Preview */
.header-center {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-width: 0;
}

.pipeline-flow-preview {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(10, 14, 24, 0.85);
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
    font-size: 0.72rem;
    max-width: 100%;
    height: 32px;
    max-height: 32px;
    box-sizing: border-box;
    overflow: hidden !important;
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
}

.pipeline-flow-preview::-webkit-scrollbar {
    display: none;
}

.flow-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    font-weight: 600;
    white-space: nowrap;
    font-size: 0.72rem;
    flex-shrink: 0;
}

.flow-tr {
    background: rgba(244, 63, 94, 0.15);
    color: #fda4af;
    border: 1px solid rgba(244, 63, 94, 0.3);
}

.flow-trans {
    background: rgba(6, 182, 212, 0.15);
    color: #67e8f9;
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.flow-brain {
    background: rgba(139, 92, 246, 0.18);
    color: #d8b4fe;
    border: 1px solid rgba(139, 92, 246, 0.4);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.2);
}

.flow-rag {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.flow-arrow {
    color: var(--text-low);
    font-size: 0.68rem;
    flex-shrink: 0;
}

.pill-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* Header Right / Status */
.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.status-badge {
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border-radius: var(--radius-full);
    font-size: 0.76rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.models-flow-tooltip {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: rgba(13, 18, 32, 0.96);
    backdrop-filter: blur(18px);
    border: 1px solid rgba(139, 92, 246, 0.35);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.75), 0 0 25px rgba(139, 92, 246, 0.25);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    z-index: 1000;
    min-width: 580px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-6px);
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.status-badge:hover .models-flow-tooltip {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

/* Floating Scroll to Bottom Button in Chat */
.scroll-to-bottom-btn {
    position: absolute;
    right: 24px;
    bottom: 74px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(18, 24, 46, 0.92);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(139, 92, 246, 0.55);
    color: #c4b5fd;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5), 0 0 14px rgba(139, 92, 246, 0.35);
    transition: bottom 0.28s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.22s ease, background 0.2s ease;
    z-index: 40;
    opacity: 1;
    transform: translateY(0);
}

.scroll-to-bottom-btn:hover {
    transform: translateY(-2px) scale(1.1);
    background: rgba(139, 92, 246, 0.35);
    border-color: rgba(139, 92, 246, 0.95);
    color: #ffffff;
    box-shadow: 0 6px 22px rgba(139, 92, 246, 0.6);
}

.scroll-to-bottom-btn.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
}

/* Dynamic positioning based on pipeline bar presence and expansion state (CSS fallback) */
.live-pipeline-bar:not(.hidden).collapsed ~ .scroll-to-bottom-btn {
    bottom: 122px;
}

.live-pipeline-bar:not(.hidden):not(.collapsed) ~ .scroll-to-bottom-btn {
    bottom: 195px;
}

.models-flow-tooltip::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 24px;
    width: 10px;
    height: 10px;
    background: #0d1220;
    border-left: 1px solid rgba(139, 92, 246, 0.35);
    border-top: 1px solid rgba(139, 92, 246, 0.35);
    transform: rotate(45deg);
}

.models-flow-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.models-flow-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: #e2e8f0;
    letter-spacing: 0.3px;
}

.models-flow-endpoint {
    font-family: var(--font-mono);
    color: #a78bfa;
    font-size: 0.68rem;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-badge.online {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.status-badge.online .status-indicator {
    background: var(--emerald);
    box-shadow: 0 0 8px var(--emerald);
}

.status-badge.connecting {
    background: rgba(245, 158, 11, 0.15);
    color: #fcd34d;
    border: 1px solid rgba(245, 158, 11, 0.3);
}
.status-badge.connecting .status-indicator {
    background: var(--amber);
    animation: pulseGlow 1.4s infinite alternate;
}

.status-badge.offline {
    background: rgba(244, 63, 94, 0.15);
    color: #fda4af;
    border: 1px solid rgba(244, 63, 94, 0.3);
}
.status-badge.offline .status-indicator {
    background: var(--rose);
}

.status-badge.simulation {
    background: rgba(139, 92, 246, 0.15);
    color: #d8b4fe;
    border: 1px solid rgba(139, 92, 246, 0.3);
}
.status-badge.simulation .status-indicator {
    background: var(--primary);
    box-shadow: 0 0 8px var(--primary);
}

.icon-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-high);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
}

.icon-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: var(--border-highlight);
    transform: translateY(-1px);
}

/* Chat Viewport & Multi-Session Layout */
.chat-viewport {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    padding: 6px 20px 12px 20px;
}

.chat-layout-container {
    flex: 1;
    min-height: 0;
    display: flex;
    gap: 14px;
    height: 100%;
    position: relative;
    overflow: hidden;
}

/* Chat Sidebar (Past Sessions) */
.chat-sidebar {
    width: 270px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-lg);
    padding: 14px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-soft);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                padding 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.25s ease,
                margin 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    z-index: 5;
}

.chat-sidebar.collapsed {
    width: 0 !important;
    min-width: 0 !important;
    padding: 0 !important;
    margin-right: -14px !important;
    border: none !important;
    opacity: 0;
    pointer-events: none;
}

.sidebar-header {
    margin-bottom: 6px;
    flex-shrink: 0;
}

.btn-new-chat {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(6, 182, 212, 0.2));
    border: 1px solid var(--border-highlight);
    color: var(--text-high);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 15px -3px rgba(139, 92, 246, 0.3);
}

.btn-new-chat:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.4), rgba(6, 182, 212, 0.35));
    border-color: rgba(139, 92, 246, 0.6);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px -2px rgba(139, 92, 246, 0.45);
}

.sidebar-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 6px 8px 6px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--text-low);
    text-transform: uppercase;
    flex-shrink: 0;
}

.sidebar-badge {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-mid);
    padding: 1px 7px;
    border-radius: var(--radius-full);
    font-size: 0.65rem;
}

.chat-sessions-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.chat-sessions-list::-webkit-scrollbar {
    width: 4px;
}

.chat-sessions-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-full);
}

.empty-sessions-note {
    padding: 24px 10px;
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-low);
    font-style: italic;
}

.session-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 10px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 8px;
    position: relative;
    user-select: none !important;
}

.session-list-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
    transform: translateX(2px);
}

.session-list-item.active {
    background: rgba(139, 92, 246, 0.14);
    border-color: rgba(139, 92, 246, 0.35);
    border-left: 3px solid #8b5cf6;
    box-shadow: 0 2px 10px -2px rgba(139, 92, 246, 0.2);
}

.session-item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.session-item-header {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.session-item-icon {
    font-size: 0.82rem;
    flex-shrink: 0;
}

.session-item-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-high);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-list-item.active .session-item-title {
    color: #e0e7ff;
    font-weight: 700;
}

.session-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.68rem;
    color: var(--text-low);
    padding-left: 20px;
}

.session-item-actions {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
}

.session-action-btn {
    opacity: 0;
    background: transparent;
    border: none;
    color: var(--text-low);
    width: 25px;
    height: 25px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.session-list-item:hover .session-action-btn {
    opacity: 0.75;
}

.session-action-btn:hover {
    opacity: 1 !important;
}

.session-rename-btn:hover {
    background: rgba(139, 92, 246, 0.22);
    color: #c4b5fd;
}

.session-delete-btn:hover {
    background: rgba(244, 63, 94, 0.22);
    color: #fda4af;
}

/* Chat Main Pane */
.chat-main-pane {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    position: relative;
    overflow: hidden;
}

.chat-active-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 14px;
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    flex-shrink: 0;
    background: rgba(16, 21, 34, 0.6);
    border: 1px solid var(--border-subtle);
}

.active-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.sidebar-toggle-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-mid);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sidebar-toggle-btn:hover {
    background: rgba(139, 92, 246, 0.18);
    color: var(--text-high);
    border-color: var(--border-highlight);
}

.active-session-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.active-session-icon {
    font-size: 0.95rem;
    flex-shrink: 0;
}

.active-session-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-high);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 480px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.active-session-title:hover {
    color: #c4b5fd;
}

.edit-session-title-btn {
    background: transparent;
    border: none;
    color: var(--text-low);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.edit-session-title-btn:hover {
    color: var(--text-high);
    background: rgba(255, 255, 255, 0.08);
}

.edit-session-title-form {
    display: flex;
    align-items: center;
    gap: 6px;
}

.edit-session-title-form.hidden {
    display: none !important;
}

.edit-session-title-input {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(139, 92, 246, 0.6);
    border-radius: var(--radius-sm);
    padding: 3px 10px;
    font-size: 0.84rem;
    color: var(--text-high);
    outline: none;
    min-width: 180px;
    max-width: 380px;
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.25);
    font-family: inherit;
}

.edit-session-title-input:focus {
    border-color: #a78bfa;
    box-shadow: 0 0 16px rgba(139, 92, 246, 0.45);
}

.session-title-action-btn {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.session-title-action-btn.save {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.4);
    color: #34d399;
}

.session-title-action-btn.save:hover {
    background: rgba(16, 185, 129, 0.35);
    color: #ffffff;
}

.session-title-action-btn.cancel {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: #f87171;
}

.session-title-action-btn.cancel:hover {
    background: rgba(239, 68, 68, 0.35);
    color: #ffffff;
}

.messages-scroll-area {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 8px 0 12px 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
    overscroll-behavior-y: contain;
    will-change: scroll-position;
    transform: translateZ(0);
}

.messages-scroll-area::-webkit-scrollbar {
    width: 6px;
}
.messages-scroll-area::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-full);
}

/* Empty State */
.empty-state-card {
    max-width: 800px;
    width: 100%;
    margin: auto;
    padding: 22px 26px;
    border-radius: var(--radius-lg);
    text-align: center;
    border: 1px solid rgba(139, 92, 246, 0.25);
    box-shadow: var(--shadow-glow);
}

.empty-icon-box {
    width: 50px;
    height: 50px;
    margin: 0 auto 10px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(6, 182, 212, 0.3));
    font-size: 26px;
    border: 1px solid var(--border-highlight);
}

.empty-title {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
    background: linear-gradient(135deg, #ffffff, #c4b5fd);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.empty-desc {
    color: var(--text-mid);
    font-size: 0.88rem;
    line-height: 1.5;
    max-width: 660px;
    margin: 0 auto 16px auto;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
    text-align: left;
}

.feature-box {
    background: rgba(10, 14, 24, 0.6);
    border: 1px solid var(--border-subtle);
    padding: 12px 14px;
    border-radius: var(--radius-md);
    transition: all 0.25s ease;
}

.feature-box:hover {
    border-color: var(--border-highlight);
    transform: translateY(-2px);
}

.feat-icon {
    font-size: 18px;
    margin-bottom: 6px;
    display: inline-block;
}

.feature-box h4 {
    font-size: 0.82rem;
    font-weight: 700;
    color: #f1f5f9;
    margin-bottom: 4px;
}

.feature-box p {
    font-size: 0.74rem;
    color: var(--text-low);
    line-height: 1.35;
}

/* Quick Prompts */
.quick-prompts-section {
    border-top: 1px solid var(--border-subtle);
    padding-top: 12px;
    text-align: left;
}

.quick-prompts-label {
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--text-mid);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.quick-prompts-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.prompt-chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-high);
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
}

.prompt-chip:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: var(--border-highlight);
    color: #ffffff;
    transform: translateY(-1px);
}

/* Chat Messages */
.message-row {
    display: flex;
    gap: 16px;
    width: 100%;
    max-width: 100%;
    margin: 0;
    animation: fadeInSlide 0.3s ease forwards;
    contain: layout style;
    content-visibility: auto;
    contain-intrinsic-size: 0 90px;
}

.message-row.user {
    justify-content: flex-end;
}

.message-row.assistant {
    justify-content: flex-start;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.message-row.user .message-avatar {
    display: none;
}

.message-row.assistant .message-avatar {
    background: transparent;
    border: none;
    box-shadow: none;
}

.message-bubble-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 100%;
    width: 100%;
}

.message-row.assistant .message-bubble-wrapper {
    max-width: 100%;
    width: 100%;
}

.message-row.user .message-bubble-wrapper {
    align-items: flex-end;
    max-width: 80%;
    width: auto;
}

/* Floating Message Copy Action (Shows strictly on mouse hover over message bubble) */
.message-copy-btn {
    position: absolute;
    top: 0;
    right: 0;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-mid);
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-full);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
    cursor: pointer;
    opacity: 0;
    transform: translateY(-4px) scale(0.96);
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    pointer-events: none;
    z-index: 10;
    user-select: none;
}

.message-bubble-wrapper:hover .message-copy-btn {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.message-copy-btn:hover {
    color: #f8fafc;
    background: rgba(30, 41, 59, 0.96);
    border-color: rgba(139, 92, 246, 0.45);
    box-shadow: 0 0 16px rgba(139, 92, 246, 0.35);
    transform: translateY(-1px) scale(1.02);
}

.message-copy-btn:active {
    transform: translateY(0) scale(0.98);
}

.message-copy-btn .copy-icon {
    font-size: 0.72rem;
    display: inline-flex;
    align-items: center;
}

.message-copy-btn.copied {
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.55);
    background: rgba(6, 78, 59, 0.9);
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.4);
}

/* For user message: position copy button on top left of user bubble */
.message-row.user .message-copy-btn {
    right: auto;
    left: 0;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.72rem;
    color: var(--text-low);
}

.message-bubble {
    padding: 14px 20px;
    border-radius: var(--radius-lg);
    font-size: 0.94rem;
    line-height: 1.6;
}

.message-bubble > *:first-child {
    margin-top: 0 !important;
}

.message-row.user .message-bubble {
    background: linear-gradient(135deg, #7c3aed, #6366f1);
    color: #ffffff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.3);
    padding: 12px 18px;
}

.message-row.assistant .message-bubble {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-bottom-left-radius: 4px;
    color: var(--text-high);
}

/* Markdown styling inside assistant message */
.message-bubble p {
    margin: 0 0 10px 0;
}
.message-bubble p:last-child {
    margin-bottom: 0;
}
.message-bubble a {
    color: #38bdf8;
    text-decoration: underline;
    text-underline-offset: 3px;
    font-weight: 500;
    transition: color 0.15s ease, text-decoration-color 0.15s ease;
    word-break: break-all;
}
.message-bubble a:hover {
    color: #7dd3fc;
    text-decoration-color: #7dd3fc;
}
.message-bubble h1,
.message-bubble h2,
.message-bubble h3,
.message-bubble h4,
.message-bubble h5,
.message-bubble h6 {
    color: var(--text-high);
    font-weight: 700;
    line-height: 1.35;
    margin: 14px 0 8px 0;
}
.message-bubble h1:first-child,
.message-bubble h2:first-child,
.message-bubble h3:first-child,
.message-bubble h4:first-child,
.message-bubble h5:first-child,
.message-bubble h6:first-child {
    margin-top: 0 !important;
}
.message-bubble h1 { font-size: 1.3rem; border-bottom: 1px solid var(--border-subtle); padding-bottom: 6px; }
.message-bubble h2 { font-size: 1.18rem; }
.message-bubble h3 { font-size: 1.06rem; color: #f1f5f9; }
.message-bubble h4 { font-size: 0.98rem; color: #e2e8f0; }
.message-bubble h5 { font-size: 0.92rem; color: #cbd5e1; }
.message-bubble h6 { font-size: 0.86rem; color: #94a3b8; }

.message-bubble blockquote {
    border-left: 3px solid #8b5cf6;
    background: rgba(139, 92, 246, 0.08);
    margin: 10px 0;
    padding: 8px 14px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: #cbd5e1;
    font-style: normal;
}
.message-bubble blockquote p {
    margin: 0;
}
.message-bubble strong {
    color: #ffffff;
    font-weight: 700;
}
.message-bubble hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    margin: 14px 0;
}

.message-bubble ul, .message-bubble ol {
    margin: 8px 0 12px 20px;
}
.message-bubble li {
    margin-bottom: 4px;
}
.message-bubble code {
    font-family: var(--font-mono);
    background: rgba(0, 0, 0, 0.4);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
    color: #67e8f9;
}
.message-bubble pre {
    background: rgba(5, 8, 16, 0.95);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin: 12px 0;
    overflow-x: auto;
}
.message-bubble pre code {
    background: transparent;
    padding: 0;
    color: #f1f5f9;
}

.message-bubble table {
    width: 100%;
    border-collapse: collapse;
    margin: 14px 0;
    font-size: 0.88rem;
    background: rgba(12, 17, 30, 0.7);
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
}

.message-bubble th,
.message-bubble td {
    padding: 10px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
}

.message-bubble th {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-high);
    font-weight: 700;
    border-bottom: 1px solid rgba(139, 92, 246, 0.3);
}

.message-bubble tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Response Duration & Latency Chips */
.message-latency-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    padding-left: 2px;
}

.latency-chip {
    position: relative;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px;
    background: rgba(14, 20, 36, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    color: var(--text-mid);
    transition: all 0.2s ease;
}

.latency-chip:hover {
    background: rgba(20, 28, 50, 0.9);
    border-color: rgba(139, 92, 246, 0.35);
    transform: translateY(-1px);
}

/* Tooltip on Hover for Latency Chips */
.latency-chip[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 7px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    padding: 4px 9px;
    background: #090d18;
    border: 1px solid rgba(139, 92, 246, 0.45);
    border-radius: 6px;
    color: #e0e7ff;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.18s cubic-bezier(0.16, 1, 0.3, 1), transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.18s;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6), 0 0 10px rgba(139, 92, 246, 0.25);
    z-index: 1000;
}

.latency-chip[data-tooltip]::after {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    border-width: 5px 5px 0 5px;
    border-style: solid;
    border-color: rgba(139, 92, 246, 0.55) transparent transparent transparent;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.18s cubic-bezier(0.16, 1, 0.3, 1), transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.18s;
    z-index: 1000;
}

.latency-chip[data-tooltip]:hover::before,
.latency-chip[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.latency-chip strong {
    color: var(--text-high);
    font-family: var(--font-mono);
    font-weight: 600;
}

.latency-chip.total {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

.latency-chip.total strong {
    color: #a7f3d0;
}

.latency-chip.total[data-tooltip]::before {
    border-color: rgba(16, 185, 129, 0.5);
    color: #6ee7b7;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6), 0 0 10px rgba(16, 185, 129, 0.25);
}

.latency-chip.total[data-tooltip]::after {
    border-color: rgba(16, 185, 129, 0.6) transparent transparent transparent;
}

.chip-icon {
    font-size: 0.75rem;
}

.chip-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.chip-dot.dot-cyan {
    background: #06b6d4;
    box-shadow: 0 0 6px rgba(6, 182, 212, 0.5);
}

.chip-dot.dot-indigo {
    background: #818cf8;
    box-shadow: 0 0 6px rgba(129, 140, 248, 0.5);
}

.chip-dot.dot-emerald {
    background: #10b981;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}

.chip-dot.dot-purple {
    background: #c084fc;
    box-shadow: 0 0 6px rgba(192, 132, 252, 0.5);
}

.chip-dot.dot-rose {
    background: #f43f5e;
    box-shadow: 0 0 6px rgba(244, 63, 94, 0.5);
}

.latency-chip.cache-hit {
    background: rgba(168, 85, 247, 0.16);
    border-color: rgba(168, 85, 247, 0.45);
    color: #d8b4fe;
}

.latency-chip.cache-hit strong {
    color: #f3e8ff;
}

.latency-chip.cache-hit[data-tooltip]::before {
    border-color: rgba(168, 85, 247, 0.55);
    color: #e9d5ff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6), 0 0 10px rgba(168, 85, 247, 0.25);
}

.latency-chip.cache-hit[data-tooltip]::after {
    border-color: rgba(168, 85, 247, 0.65) transparent transparent transparent;
}

.badge-cache {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.3), rgba(59, 130, 246, 0.25));
    border: 1px solid rgba(168, 85, 247, 0.4);
    color: #e9d5ff;
    padding: 1px 7px;
    border-radius: var(--radius-full);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
}

.meta-agent-name {
    font-weight: 700;
    color: #c4b5fd;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Pipeline Inspector Component */
.pipeline-inspector {
    width: 100%;
    margin-top: 10px;
    border-radius: var(--radius-md);
    background: rgba(10, 15, 28, 0.85);
    border: 1px solid rgba(139, 92, 246, 0.2);
    overflow: hidden;
}

.pipeline-inspector-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.pipeline-inspector-header:hover {
    background: rgba(139, 92, 246, 0.1);
}

.inspector-title-group {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #c4b5fd;
    flex-shrink: 0;
}

.inspector-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.header-latency-chips {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.header-latency-chips .latency-chip {
    padding: 2px 8px;
    font-size: 0.68rem;
}

.latency-total-badge {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-family: var(--font-mono);
    font-weight: 600;
}

.accordion-arrow {
    color: var(--text-low);
    font-size: 0.75rem;
    transition: transform 0.25s ease;
}

.pipeline-inspector.open .accordion-arrow {
    transform: rotate(180deg);
}

.pipeline-inspector-body {
    display: none;
    padding: 14px 16px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.pipeline-inspector:not(.open) .pipeline-inspector-body {
    display: none !important;
}

.stage-detail-box {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 12px;
}

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

.stage-name-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.74rem;
    font-weight: 700;
    color: #93c5fd;
}

.stage-ms-badge {
    position: relative;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.stage-ms-badge[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    right: 0;
    transform: translateY(4px);
    padding: 3px 8px;
    background: #090d18;
    border: 1px solid rgba(139, 92, 246, 0.45);
    border-radius: 5px;
    color: #e0e7ff;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
    z-index: 1000;
}

.stage-ms-badge[data-tooltip]:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.stage-text-preview {
    font-size: 0.8rem;
    color: #e2e8f0;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: var(--font-mono);
    background: rgba(0, 0, 0, 0.4);
    padding: 8px 10px;
    border-radius: 6px;
    border-left: 3px solid var(--primary);
}

.stage-text-preview.brain-text {
    border-left-color: var(--cyan);
}

/* Live Pipeline Stepper Bar (Collapsible Thin Animated Bar) */
.live-pipeline-bar {
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
    margin: 0 0 8px 0;
    border-radius: var(--radius-md);
    padding: 0;
    border: 1px solid var(--border-highlight);
    background: rgba(13, 18, 32, 0.88);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 15px rgba(139, 92, 246, 0.15);
    animation: fadeInSlide 0.3s ease;
    overflow: hidden;
    box-sizing: border-box;
    transition: all 0.25s ease;
}

.live-pipeline-bar.hidden {
    display: none !important;
}

.live-pipeline-bar.collapsed {
    background: rgba(15, 23, 42, 0.72);
    border-color: rgba(139, 92, 246, 0.3);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.pipeline-collapsed-view {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 14px;
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background 0.2s ease;
}

.pipeline-collapsed-view:hover {
    background: rgba(139, 92, 246, 0.08);
}

.collapsed-left {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #e2e8f0;
}

.pulsing-radar {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #a855f7;
    box-shadow: 0 0 10px #a855f7;
    animation: radarPulse 1.2s infinite ease-in-out;
    flex-shrink: 0;
}

.collapsed-label {
    color: #cbd5e1;
    font-size: 0.76rem;
}

.collapsed-step-name {
    color: #d8b4fe;
    font-weight: 700;
    background: rgba(139, 92, 246, 0.15);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(139, 92, 246, 0.3);
    font-size: 0.72rem;
}

.collapsed-step-timer {
    font-family: var(--font-mono);
    color: #38bdf8;
    font-size: 0.72rem;
    font-weight: 600;
}

.collapsed-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pipeline-expand-icon {
    color: var(--text-mid);
    font-size: 0.85rem;
    line-height: 1;
    transition: transform 0.25s ease;
}

.live-pipeline-bar:not(.collapsed) .pipeline-expand-icon {
    transform: rotate(180deg);
}

.collapsed-shimmer-line {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #8b5cf6, #06b6d4, transparent);
    background-size: 200% 100%;
    animation: shimmerSlide 2s linear infinite;
}

.live-pipeline-bar.collapsed .pipeline-expanded-details {
    display: none !important;
}

.live-pipeline-bar:not(.collapsed) .pipeline-expanded-details {
    display: block;
    padding: 10px 14px 12px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    animation: fadeIn 0.2s ease;
}

.live-pipeline-bar:not(.collapsed) .collapsed-shimmer-line {
    display: none;
}

@keyframes shimmerSlide {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

@keyframes radarPulse {
    0%, 100% {
        transform: scale(0.9);
        opacity: 0.6;
    }
    50% {
        transform: scale(1.3);
        opacity: 1;
        box-shadow: 0 0 12px #c084fc;
    }
}

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

.pipeline-title-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pipeline-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #e2e8f0;
}

.pipeline-timer {
    font-family: var(--font-mono);
    font-size: 0.76rem;
    font-weight: 600;
    color: #a78bfa;
}

.pipeline-stepper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    width: 100%;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
    background: rgba(12, 16, 28, 0.8);
    border: 1px solid var(--border-subtle);
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    transition: all 0.25s ease;
    overflow: hidden;
}

.step-indicator {
    position: relative;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-mid);
    font-weight: 700;
    font-size: 0.68rem;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.step-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-high);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.step-sub {
    font-size: 0.64rem;
    color: var(--text-low);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.step-badge {
    font-size: 0.6rem;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-low);
    font-weight: 600;
    white-space: nowrap;
    max-width: 85px;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.step-connector {
    width: 6px;
    height: 2px;
    background: var(--border-subtle);
    flex-shrink: 0;
}

/* Stepper States */
.step-item.running {
    border-color: var(--border-highlight);
    background: rgba(139, 92, 246, 0.15);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.2);
}
.step-item.running .step-indicator {
    background: var(--primary);
    color: #ffffff;
}
.step-item.running .step-badge {
    background: rgba(139, 92, 246, 0.3);
    color: #e9d5ff;
}

.step-item.done {
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.08);
}
.step-item.done .step-indicator {
    background: var(--emerald);
    color: #ffffff;
}
.step-item.done .step-badge {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}

/* Chat Input Bar */
.chat-input-wrapper {
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-input-form {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px 6px 12px;
    min-height: 48px;
    border-radius: var(--radius-lg);
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    transition: all 0.25s ease;
}

.chat-input-form.multiline {
    align-items: flex-end;
}

.chat-input-form:focus-within {
    border-color: var(--border-highlight);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.25);
}

.input-actions-left {
    display: flex;
    align-items: center;
    padding: 0;
    flex-shrink: 0;
}

.input-util-btn {
    background: transparent;
    border: none;
    color: var(--text-low);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.input-util-btn:hover {
    color: var(--rose);
}

.chat-textarea {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-high);
    font-family: inherit;
    font-size: 0.94rem;
    line-height: 22px;
    resize: none;
    height: 22px;
    min-height: 22px;
    max-height: 180px;
    padding: 2px 0;
    overflow-y: hidden;
    box-sizing: border-box;
}

.chat-textarea::placeholder {
    color: var(--text-low);
}

.send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    border: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
    flex-shrink: 0;
}

.send-btn:hover:not(:disabled) {
    transform: scale(1.06);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #334155;
    box-shadow: none;
}

.input-footer-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-low);
    padding: 0 6px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(4, 6, 12, 0.75);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
    animation: fadeIn 0.25s ease;
}

.modal-overlay.hidden {
    display: none !important;
}

.modal-card {
    max-width: 620px;
    width: 100%;
    border-radius: var(--radius-xl);
    overflow: hidden;
    border: 1px solid var(--border-highlight);
    background: #0d1220;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
}

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

.modal-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-icon {
    font-size: 20px;
}

.modal-header h3 {
    margin: 0;
    padding: 0;
    line-height: 1.2;
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-mid);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

.modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.settings-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #e2e8f0;
}

.settings-hint {
    font-size: 0.74rem;
    color: var(--text-low);
    line-height: 1.4;
}

.settings-input,
.settings-select,
.settings-textarea,
select:not(.chat-input-select),
textarea:not(.chat-textarea) {
    background-color: rgba(11, 15, 25, 0.75);
    border: 1px solid var(--border-subtle);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-high);
    font-family: var(--font-main);
    font-size: 0.88rem;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    width: 100%;
}

.settings-input:hover,
.settings-select:hover,
.settings-textarea:hover,
select:not(.chat-input-select):hover,
textarea:not(.chat-textarea):hover {
    border-color: rgba(139, 92, 246, 0.45);
    background-color: rgba(15, 23, 42, 0.85);
}

.settings-input:focus,
.settings-select:focus,
.settings-textarea:focus,
select:not(.chat-input-select):focus,
textarea:not(.chat-textarea):focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25);
    background-color: rgba(15, 23, 42, 0.92);
}

/* Custom styled Select Dropdown with prominent purple chevron arrow */
select,
.settings-select {
    padding-right: 40px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='18' height='18' fill='none' stroke='%23c084fc' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    background-size: 16px 16px !important;
    cursor: pointer !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    line-height: 1.3;
}

select option,
.settings-select option {
    background-color: #0b0f19;
    color: #f8fafc;
    padding: 10px 14px;
}

select option:checked,
.settings-select option:checked {
    background-color: #6366f1;
    color: #ffffff;
}

/* Custom styled Textarea */
textarea,
.settings-textarea {
    resize: vertical;
    min-height: 68px;
    line-height: 1.5;
}

textarea.font-mono,
.settings-textarea.font-mono {
    font-family: var(--font-mono) !important;
    font-size: 0.82rem;
    line-height: 1.45;
}

::placeholder,
.settings-input::placeholder,
.settings-textarea::placeholder {
    color: var(--text-low);
    opacity: 0.7;
}

.input-with-action {
    display: flex;
    gap: 8px;
}

.input-with-action input {
    flex: 1;
}

.action-btn {
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid var(--border-highlight);
    color: #d8b4fe;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    white-space: nowrap;
}

.action-btn:hover {
    background: rgba(139, 92, 246, 0.35);
    color: #ffffff;
}

.conn-test-box {
    margin-top: 6px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-family: var(--font-mono);
}

.conn-test-box.success {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.conn-test-box.error {
    background: rgba(244, 63, 94, 0.15);
    color: #fda4af;
    border: 1px solid rgba(244, 63, 94, 0.3);
}

/* Toggle Switch */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.toggle-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #f1f5f9;
}

.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    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: rgba(255, 255, 255, 0.15);
    transition: .3s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .3s;
}

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

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

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Detected Models */
.detected-models-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.link-btn {
    background: transparent;
    border: none;
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}

.link-btn:hover {
    text-decoration: underline;
}

.detected-models-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 10px;
    max-height: 140px;
    overflow-y: auto;
}

.model-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.03);
    font-size: 0.76rem;
    font-family: var(--font-mono);
}

.model-use-btns {
    display: flex;
    gap: 4px;
}

.btn-mini {
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.4);
    color: #d8b4fe;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
}

.btn-mini:hover {
    background: var(--primary);
    color: #ffffff;
}

.empty-list-note {
    font-size: 0.75rem;
    color: var(--text-low);
    text-align: center;
    padding: 10px 0;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-subtle);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-subtle);
    color: var(--text-high);
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    border: none;
    color: #ffffff;
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .header-center {
        max-width: 480px;
    }
}

@media (max-width: 1050px) {
    .header-center {
        display: none;
    }
}

@media (max-width: 950px) {
    .pipeline-stepper {
        overflow-x: auto;
        padding-bottom: 4px;
        scrollbar-width: none;
    }
    .pipeline-stepper::-webkit-scrollbar {
        display: none;
    }
    .step-item {
        min-width: 140px;
        flex-shrink: 0;
    }
}

@media (max-width: 768px) {
    .main-header {
        padding: 8px 14px;
    }
    .brand-subtitle {
        display: none;
    }
    .brand-title {
        font-size: 1rem;
    }
    .status-badge {
        padding: 4px 8px;
        font-size: 0.72rem;
    }
    .app-nav-tabs {
        width: calc(100% - 16px);
        margin: 6px auto 0;
    }
    .chat-viewport {
        padding: 6px 10px 10px 10px;
    }
    .feature-grid {
        grid-template-columns: 1fr;
    }
    .pipeline-stepper {
        flex-direction: column;
        align-items: stretch;
    }
    .step-connector {
        display: none;
    }
    .employees-grid {
        grid-template-columns: 1fr;
    }
    .patron-hero-card {
        flex-direction: column;
        align-items: flex-start;
        padding: 18px;
        gap: 16px;
    }
    .patron-stats-row {
        flex-wrap: wrap;
        gap: 16px;
    }
}

/* =========================================================
   Virtual Employees Workforce & Management Styles
   ========================================================= */

/* Navigation Tabs */
.app-nav-tabs {
    display: flex;
    gap: 8px;
    padding: 5px 12px;
    margin: 8px 20px 0 20px;
    width: calc(100% - 40px);
    max-width: calc(100% - 40px);
    border-radius: var(--radius-md);
    background: rgba(14, 20, 35, 0.65);
    border: 1px solid var(--border-subtle);
    backdrop-filter: blur(16px);
    flex-shrink: 0;
}

.nav-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-mid);
    font-size: 0.86rem;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    user-select: none;
    cursor: pointer;
    transition: all 0.25s ease;
}

.nav-tab-btn:hover {
    color: var(--text-high);
    background: rgba(255, 255, 255, 0.04);
}

.nav-tab-btn.active {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(6, 182, 212, 0.2));
    border-color: rgba(139, 92, 246, 0.4);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.2);
}

.tab-badge {
    background: rgba(139, 92, 246, 0.2);
    color: #c4b5fd;
    border: 1px solid rgba(139, 92, 246, 0.35);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 700;
}

/* Employees Viewport Layout */
.employees-viewport {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    width: calc(100% - 40px);
    max-width: calc(100% - 40px);
    margin: 10px 20px 0 20px;
    padding-bottom: 30px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    animation: fadeIn 0.3s ease;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.employees-viewport::-webkit-scrollbar {
    width: 6px;
}

.employees-viewport::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-full);
}

/* Top Bar */
.emp-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-radius: var(--radius-lg);
    background: rgba(16, 22, 38, 0.75);
    border: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.emp-bar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.emp-bar-icon-box {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(6, 182, 212, 0.2));
    border: 1px solid var(--border-highlight);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.emp-bar-title {
    margin: 0;
    padding: 0;
    line-height: 1.2;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-high);
}

.emp-bar-subtitle {
    margin: 2px 0 0 0;
    padding: 0;
    line-height: 1.2;
    font-size: 0.82rem;
    color: var(--text-mid);
}

.emp-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Cron Pill */
.cron-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid transparent;
}

.cron-status-pill.running {
    background: rgba(16, 185, 129, 0.12);
    color: #6ee7b7;
    border-color: rgba(16, 185, 129, 0.3);
}

.cron-status-pill.stopped {
    background: rgba(244, 63, 94, 0.12);
    color: #fda4af;
    border-color: rgba(244, 63, 94, 0.3);
}

.pill-radar {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: currentColor;
    box-shadow: 0 0 10px currentColor;
    animation: radarPulse 2s infinite;
}

/* Action Subtle Button */
.action-btn-subtle {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-subtle);
    color: var(--text-high);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.action-btn-subtle:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--border-highlight);
}

/* Patron Hero Card */
.patron-hero-card {
    position: relative;
    display: flex;
    gap: 28px;
    align-items: center;
    padding: 26px 32px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(26, 21, 46, 0.85), rgba(16, 22, 38, 0.85));
    border: 1px solid rgba(245, 158, 11, 0.35);
    box-shadow: 0 10px 40px -10px rgba(245, 158, 11, 0.15);
    overflow: hidden;
    flex-shrink: 0;
    min-height: 200px;
}

.patron-card-glow {
    position: absolute;
    top: -50px;
    right: -50px;
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(245, 158, 11, 0.2) 0%, transparent 70%);
    pointer-events: none;
}

.patron-avatar-col {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.patron-avatar-wrap {
    position: relative;
    width: 84px;
    height: 84px;
    min-width: 84px;
    min-height: 84px;
    flex-shrink: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(139, 92, 246, 0.3));
    border: 2px solid rgba(245, 158, 11, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.8rem;
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.3);
}

.patron-info-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.patron-badge-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.patron-role-badge {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.3));
    color: #fde68a;
    border: 1px solid rgba(245, 158, 11, 0.4);
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.patron-status-badge {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
}

.patron-name {
    font-size: 1.5rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.3px;
    margin: 4px 0 0 0;
}

.patron-desc {
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--text-mid);
    margin-top: 6px;
    max-width: 100%;
}

.patron-stats-row {
    display: flex;
    gap: 28px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-wrap: wrap;
}

.patron-stat {
    display: flex;
    flex-direction: column;
}

.stat-num {
    font-size: 1.4rem;
    font-weight: 800;
    font-family: var(--font-mono);
    color: #ffffff;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-low);
    margin-top: 2px;
}

.text-emerald { color: #34d399 !important; }
.text-amber { color: #fbbf24 !important; }
.text-indigo { color: #a5b4fc !important; }
.text-cyan { color: #38bdf8 !important; }

/* Section Header */
.employees-section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 10px;
    flex-shrink: 0;
}

.section-actions-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.section-badge {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--cyan);
}

.section-heading {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-high);
    margin-top: 3px;
}

.section-hint {
    font-size: 0.82rem;
    color: var(--text-low);
}

/* Employees Grid */
.employees-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 20px;
}

/* Individual Employee Card */
.employee-card {
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-lg);
    background: rgba(16, 21, 35, 0.75);
    border: 1px solid var(--border-subtle);
    padding: 22px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.employee-card:hover {
    border-color: rgba(139, 92, 246, 0.4);
    transform: translateY(-3px);
    box-shadow: 0 12px 35px -10px rgba(0, 0, 0, 0.6);
}

.employee-card.card-running {
    border-color: rgba(245, 158, 11, 0.6);
    box-shadow: 0 0 25px rgba(245, 158, 11, 0.2);
}

.card-top-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    margin-bottom: 14px;
    width: 100%;
}

.model-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: #c4b5fd;
    padding: 5px 12px;
    border-radius: var(--radius-full);
    font-size: 0.74rem;
    font-weight: 600;
    font-family: var(--font-mono);
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-sizing: border-box;
}

.status-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 700;
    width: 100%;
    box-sizing: border-box;
    white-space: nowrap;
}

.status-tag.idle {
    background: rgba(16, 185, 129, 0.12);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-tag.running {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.4);
}

/* Card Profile Info */
.card-profile-box {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 12px;
}

.card-avatar {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
}

.card-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 18px rgba(6, 182, 212, 0.25);
    border-color: rgba(6, 182, 212, 0.4);
}

.card-avatar svg {
    width: 100%;
    height: 100%;
    display: block;
}

.card-avatar-badge {
    position: absolute;
    bottom: -1px;
    right: -1px;
    font-size: 11px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
    z-index: 2;
}

.modal-dynamic-avatar-preview {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s ease;
}

.modal-dynamic-avatar-preview:hover {
    transform: scale(1.08);
    border-color: #38bdf8;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.3);
}

.modal-dynamic-avatar-preview svg {
    width: 100%;
    height: 100%;
    display: block;
}

.card-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    min-width: 0;
}

.card-name {
    margin: 0;
    padding: 0;
    line-height: 1.2;
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
}

.card-role {
    margin: 0;
    padding: 0;
    line-height: 1.25;
    font-size: 0.82rem;
    color: var(--cyan);
    font-weight: 600;
}

.card-dept {
    margin: 2px 0 0 0;
    padding: 0;
    line-height: 1.2;
    font-size: 0.75rem;
    color: var(--text-low);
}

/* Persona & Skills */
.card-personality {
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--text-mid);
    background: rgba(0, 0, 0, 0.25);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.04);
    margin-bottom: 12px;
}

.card-skills-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.skill-tag {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-mid);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
}

/* Routine Tasks Section inside Card */
.card-routines-box {
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 12px;
    margin-bottom: 16px;
}

.routines-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--text-low);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.routine-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    gap: 8px;
}

.routine-left {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.routine-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-high);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.routine-cron {
    font-size: 0.72rem;
    color: var(--cyan);
    font-family: var(--font-mono);
}

.routine-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-run-small {
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.4);
    color: #c4b5fd;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-run-small:hover {
    background: rgba(139, 92, 246, 0.35);
    color: #ffffff;
}

/* Card Bottom Action Buttons */
.card-actions-wrapper,
.card-actions-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.card-actions-secondary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    width: 100%;
}

.card-actions-secondary .btn-card-util,
.card-actions-row .btn-card-util {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-mid);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    white-space: nowrap;
}

.card-actions-secondary .btn-card-util:hover,
.card-actions-row .btn-card-util:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-high);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-instant-task {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: #ffffff;
    border: none;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s;
    font-family: inherit;
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.3);
}

.btn-instant-task:hover {
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
    transform: translateY(-1px);
}

.btn-card-util {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-mid);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-card-util:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-highlight);
}

/* Active running card highlight */
.employee-card.running-pulse {
    border-color: rgba(245, 158, 11, 0.8);
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.35);
}

/* Modals Enhancements */
.task-modal-card {
    max-width: 680px;
}

.employee-edit-card {
    max-width: 780px;
}

#createEmployeeModal {
    z-index: 120 !important;
}

.report-viewer-card {
    max-width: 880px;
}

.history-modal-card {
    max-width: 760px;
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 14px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    margin-bottom: 14px;
}

.task-form-group {
    margin-bottom: 14px;
}

.task-model-info-pill {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.25);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    margin-bottom: 14px;
}

.task-exec-progress {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.35);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-top: 14px;
}

.exec-loader-row {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fde68a;
    font-size: 0.85rem;
    font-weight: 600;
}

.exec-timer {
    font-family: var(--font-mono);
    color: #fbbf24;
    font-size: 0.95rem;
    font-weight: 700;
}

.task-exec-result {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.35);
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
}

.result-duration {
    font-family: var(--font-mono);
    color: var(--text-low);
    font-size: 0.78rem;
}

.result-content-box {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-subtle);
    padding: 16px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    line-height: 1.6;
    max-height: 380px;
    overflow-y: auto;
}

/* Report Viewer Markdown Styling */
.report-markdown-body {
    background: rgba(7, 9, 14, 0.6);
    border: 1px solid var(--border-subtle);
    padding: 22px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    line-height: 1.65;
    max-height: 520px;
    overflow-y: auto;
    color: #e2e8f0;
}

.report-markdown-body h1,
.report-markdown-body h2,
.report-markdown-body h3,
.report-markdown-body h4 {
    color: #ffffff;
    margin-top: 16px;
    margin-bottom: 8px;
    font-weight: 700;
}

.report-markdown-body h1 { font-size: 1.3rem; border-bottom: 1px solid rgba(255, 255, 255, 0.1); padding-bottom: 6px; }
.report-markdown-body h2 { font-size: 1.15rem; color: #a5b4fc; }
.report-markdown-body h3 { font-size: 1.0rem; color: #38bdf8; }

.report-markdown-body p {
    margin-bottom: 10px;
}

.report-markdown-body ul,
.report-markdown-body ol {
    margin-left: 20px;
    margin-bottom: 12px;
}

.report-markdown-body li {
    margin-bottom: 4px;
}

.report-markdown-body strong {
    color: #ffffff;
    font-weight: 700;
}

.report-markdown-body pre {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--border-subtle);
    padding: 12px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    margin-bottom: 12px;
}

.report-markdown-body code {
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.85em;
    color: #c4b5fd;
}

.report-markdown-body hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 18px 0;
}

/* History reports list */
.history-reports-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 480px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--border-highlight);
}

.history-item-left {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.history-title {
    font-weight: 600;
    font-size: 0.88rem;
    color: #ffffff;
}

.history-meta {
    font-size: 0.75rem;
    color: var(--text-low);
}

.history-badge-cron {
    background: rgba(6, 182, 212, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(6, 182, 212, 0.3);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 700;
}

/* Employee Conversations History Modal Styles */
.conv-thread-item {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    gap: 10px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.conv-thread-item:hover {
    background: rgba(139, 92, 246, 0.06);
    border-color: rgba(139, 92, 246, 0.35);
}

.conv-thread-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.conv-thread-info {
    flex: 1;
    min-width: 0;
}

.conv-thread-title {
    font-weight: 700;
    font-size: 0.92rem;
    color: #f8fafc;
    display: flex;
    align-items: center;
    gap: 8px;
}

.conv-thread-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    font-size: 0.72rem;
    color: var(--text-low);
}

.conv-badge-count {
    background: rgba(139, 92, 246, 0.15);
    color: #c4b5fd;
    border: 1px solid rgba(139, 92, 246, 0.3);
    padding: 1px 7px;
    border-radius: 9999px;
    font-size: 0.65rem;
    font-weight: 600;
}

.conv-thread-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.conv-last-preview {
    font-size: 0.75rem;
    color: var(--text-mid);
    background: rgba(0, 0, 0, 0.25);
    padding: 6px 10px;
    border-radius: 6px;
    border-left: 2px solid #8b5cf6;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conv-messages-container {
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 280px;
    overflow-y: auto;
}

.conv-msg-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-width: 90%;
}

.conv-msg-row.user {
    align-self: flex-end;
    text-align: right;
}

.conv-msg-row.assistant {
    align-self: flex-start;
}

.conv-msg-bubble {
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.78rem;
    line-height: 1.4;
}

.conv-msg-row.user .conv-msg-bubble {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: #fff;
    border-radius: 10px 2px 10px 10px;
}

.conv-msg-row.assistant .conv-msg-bubble {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    border-radius: 2px 10px 10px 10px;
}

/* Tasks Management in Edit Modal */
.edit-tasks-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
    margin-top: 8px;
}

.edit-task-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
}

.edit-task-title {
    flex: 1;
    font-size: 0.82rem;
    color: #ffffff;
    font-weight: 600;
}

.edit-task-cron {
    font-size: 0.75rem;
    color: var(--cyan);
    font-family: var(--font-mono);
}

.btn-task-del {
    background: transparent;
    border: none;
    color: var(--rose);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0 4px;
}

.btn-task-del:hover {
    color: #fda4af;
}

.tasks-management-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* =========================================================
   Multi-Company Switcher & Settings Tab Center
   ========================================================= */

.company-switch-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 12px;
}

.company-switch-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.35);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-high);
}

.company-switch-badge:hover {
    background: rgba(139, 92, 246, 0.22);
    border-color: rgba(139, 92, 246, 0.6);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
}

.company-badge-icon {
    font-size: 1.15rem;
}

.company-badge-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
}

.company-badge-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: #ffffff;
}

.company-badge-tag {
    font-size: 0.68rem;
    color: #c4b5fd;
    font-weight: 500;
}

.company-badge-chevron {
    font-size: 0.75rem;
    color: var(--text-mid);
    transition: transform 0.2s;
}

.company-switch-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 290px;
    background: #0f1527;
    border: 1px solid var(--border-highlight);
    border-radius: var(--radius-md);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.8), 0 0 25px rgba(139, 92, 246, 0.25);
    z-index: 1000;
    overflow: hidden;
    animation: fadeIn 0.2s ease;
}

.dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-mid);
    background: rgba(0, 0, 0, 0.25);
    border-bottom: 1px solid var(--border-subtle);
}

.dropdown-count {
    background: rgba(139, 92, 246, 0.2);
    color: #d8b4fe;
    padding: 1px 6px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
}

.company-list-items {
    max-height: 220px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 4px 0;
}

.company-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    cursor: pointer;
    transition: background 0.15s;
}

.company-dropdown-item:hover {
    background: rgba(139, 92, 246, 0.15);
}

.company-dropdown-item.active {
    background: rgba(139, 92, 246, 0.25);
    border-left: 3px solid var(--primary);
}

.company-item-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: #ffffff;
}

.company-item-meta {
    font-size: 0.7rem;
    color: var(--text-low);
}

.active-check {
    color: var(--emerald);
    font-size: 0.85rem;
    font-weight: 700;
}

.dropdown-footer {
    padding: 8px 12px;
    border-top: 1px solid var(--border-subtle);
    background: rgba(0, 0, 0, 0.2);
}

.dropdown-action-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: transparent;
    border: 1px dashed rgba(139, 92, 246, 0.4);
    color: #d8b4fe;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.dropdown-action-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: var(--primary);
    color: #ffffff;
}

/* Modal Tabs Navigation */
.settings-modal-card {
    max-width: 1040px !important;
    width: 96%;
}

.modal-tabs-nav {
    display: flex;
    gap: 2px;
    padding: 0 10px;
    background: rgba(0, 0, 0, 0.35);
    border-bottom: 1px solid var(--border-subtle);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(139, 92, 246, 0.4) rgba(0, 0, 0, 0.2);
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.modal-tabs-nav::-webkit-scrollbar {
    height: 4px;
}

.modal-tabs-nav::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-full);
}

.modal-tabs-nav::-webkit-scrollbar-thumb {
    background: linear-gradient(90deg, #8b5cf6, #06b6d4);
    border-radius: var(--radius-full);
}

.modal-tabs-nav::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(90deg, #a78bfa, #22d3ee);
}

.settings-tab-btn {
    flex: 1 1 0;
    min-width: max-content;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 12px 10px;
    color: var(--text-mid);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    text-align: center;
}

.settings-tab-btn:hover {
    color: var(--text-high);
    background: rgba(255, 255, 255, 0.04);
}

.settings-tab-btn.active {
    color: #ffffff;
    border-bottom-color: var(--primary);
    background: rgba(139, 92, 246, 0.12);
}

.tab-btn-icon {
    font-size: 0.95rem;
}

.settings-tab-panel {
    display: none;
}

.settings-tab-panel.active {
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: fadeIn 0.2s ease;
}

/* Company Management Tab */
.company-management-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-subtle);
}

.company-select-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.company-action-buttons {
    display: flex;
    gap: 8px;
}

.company-form-container {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.company-form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 14px;
    border-top: 1px solid var(--border-subtle);
    margin-top: 8px;
}

.action-btn-danger {
    background: rgba(244, 63, 94, 0.15);
    border: 1px solid rgba(244, 63, 94, 0.35);
    color: #fda4af;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn-danger:hover {
    background: rgba(244, 63, 94, 0.25);
    border-color: var(--rose);
    color: #ffffff;
}

/* Staff Tab in Settings */
.staff-tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.staff-header-info h4 {
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
}

.staff-management-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 380px;
    overflow-y: auto;
}

.staff-card-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}

.staff-card-row:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--border-highlight);
}

.staff-card-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.staff-card-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: rgba(139, 92, 246, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.staff-card-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: #ffffff;
}

.staff-card-role {
    font-size: 0.72rem;
    color: var(--text-mid);
}

.staff-card-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.staff-model-badge {
    background: rgba(6, 182, 212, 0.12);
    color: #67e8f9;
    border: 1px solid rgba(6, 182, 212, 0.3);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.72rem;
}

/* ERP Tab */
.erp-intro-box {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.1), rgba(139, 92, 246, 0.1));
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.erp-intro-icon {
    font-size: 2rem;
    line-height: 1;
}

.erp-intro-text h4 {
    margin: 0 0 4px 0;
    font-size: 0.92rem;
    color: #ffffff;
    font-weight: 700;
}

.erp-intro-text p {
    margin: 0;
    font-size: 0.76rem;
    color: var(--text-mid);
    line-height: 1.4;
}

.erp-action-row {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 6px;
}

.erp-output-box {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(16, 185, 129, 0.4);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: fadeIn 0.25s ease;
}

.erp-output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.erp-output-time {
    font-size: 0.72rem;
    color: var(--text-low);
}

.erp-output-content {
    font-family: var(--font-mono);
    font-size: 0.76rem;
    color: #a7f3d0;
    line-height: 1.5;
    white-space: pre-wrap;
    max-height: 180px;
    overflow-y: auto;
}

/* =========================================================
   Kurum Kültürü & Personel Hafızası (Culture & Memory) Tab
   ========================================================= */

.culture-split-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    width: 100%;
}

.culture-column {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.culture-col-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.culture-title {
    font-size: 0.96rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 2px 0;
}

.culture-values-banner {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.08), rgba(6, 182, 212, 0.08));
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.culture-value-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
    background: rgba(139, 92, 246, 0.18);
    color: #c4b5fd;
    border: 1px solid rgba(139, 92, 246, 0.35);
}

.culture-rules-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 380px;
    overflow-y: auto;
    padding-right: 4px;
}

.culture-rules-list::-webkit-scrollbar,
.learned-lessons-list::-webkit-scrollbar {
    width: 5px;
}

.culture-rules-list::-webkit-scrollbar-thumb,
.learned-lessons-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-full);
}

.culture-rule-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: all 0.2s ease;
}

.culture-rule-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border-highlight);
}

.rule-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.rule-card-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #f8fafc;
}

.rule-badges {
    display: flex;
    gap: 6px;
    align-items: center;
}

.badge-strict {
    background: rgba(239, 68, 68, 0.18);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.35);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.3px;
}

.badge-recommended {
    background: rgba(245, 158, 11, 0.18);
    color: #fcd34d;
    border: 1px solid rgba(245, 158, 11, 0.35);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
}

.rule-category-tag {
    font-size: 0.68rem;
    color: var(--text-low);
    font-family: var(--font-mono);
    background: rgba(255, 255, 255, 0.04);
    padding: 2px 6px;
    border-radius: 4px;
}

.rule-card-desc {
    font-size: 0.78rem;
    color: var(--text-mid);
    line-height: 1.45;
}

.rule-card-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.rule-delete-btn,
.lesson-delete-btn {
    background: transparent;
    border: none;
    color: var(--text-low);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 0.82rem;
    line-height: 1;
    transition: all 0.2s;
}

.rule-delete-btn:hover,
.lesson-delete-btn:hover {
    color: #f87171;
    background: rgba(239, 68, 68, 0.12);
}

.memory-emp-selector-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.memory-emp-summary-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
}

.memory-avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(6, 182, 212, 0.25));
    border: 1px solid var(--border-highlight);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.memory-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
}

.memory-info h4 {
    margin: 0;
    padding: 0;
    font-size: 0.92rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}

.memory-sub {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    padding: 0;
}

.mem-emp-role-title {
    font-size: 0.78rem;
    color: var(--cyan);
    font-weight: 600;
    line-height: 1.25;
}

.mem-emp-lesson-count {
    font-size: 0.72rem;
    color: #c4b5fd;
    font-weight: 500;
    line-height: 1.2;
}

.learned-lessons-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 4px;
}

.lesson-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: all 0.2s ease;
}

.lesson-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border-highlight);
}

.lesson-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.lesson-badge {
    background: rgba(6, 182, 212, 0.12);
    color: #67e8f9;
    border: 1px solid rgba(6, 182, 212, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
}

.lesson-rule-text {
    font-size: 0.82rem;
    color: var(--text-high);
    line-height: 1.45;
    font-weight: 500;
}

.lesson-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.7rem;
    color: var(--text-low);
    margin-top: 2px;
}

.lesson-confidence {
    color: #34d399;
    font-family: var(--font-mono);
    font-weight: 600;
}

.lesson-context {
    font-style: italic;
    color: var(--text-low);
    font-size: 0.72rem;
}

.mini-sub-modal {
    max-width: 540px !important;
}

@media (max-width: 900px) {
    .culture-split-container {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   Company Departments & 3D Office Room Management Styles
   ========================================================= */

.company-departments-section {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.dept-section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    gap: 12px;
}

.company-departments-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 14px;
    margin-top: 10px;
}

.department-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 12px;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    min-height: 80px;
}

.department-card:hover {
    background: rgba(22, 32, 56, 0.95);
    border-color: rgba(99, 102, 241, 0.45);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

.department-card-color-stripe {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.dept-card-icon {
    font-size: 1.7rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    flex-shrink: 0;
}

.dept-card-info {
    flex: 1;
    min-width: 0;
}

.dept-card-name {
    font-size: 0.94rem;
    font-weight: 700;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dept-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 5px;
    font-size: 0.75rem;
    color: #94a3b8;
    white-space: nowrap;
    flex-wrap: nowrap;
}

.dept-card-meta > span {
    white-space: nowrap;
    flex-shrink: 0;
}

.dept-badge-rooms {
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.70rem;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.dept-card-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.dept-action-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.dept-action-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.dept-action-btn.delete:hover {
    color: #f87171;
    background: rgba(239, 68, 68, 0.15);
}

/* Modal Quick Picker Styles */
.dept-quick-emojis {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.quick-emoji-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 1.1rem;
    padding: 3px 6px;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
}

.quick-emoji-btn:hover {
    transform: scale(1.15);
    background: rgba(255, 255, 255, 0.18);
}

.dept-color-picker-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.settings-color-input {
    width: 44px;
    height: 34px;
    padding: 0;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: transparent;
}

.color-hex-label {
    font-family: var(--font-mono, monospace);
    font-size: 0.85rem;
    color: #94a3b8;
    font-weight: 600;
}

.dept-quick-colors {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.quick-color-btn {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.quick-color-btn:hover {
    transform: scale(1.25);
    border-color: #ffffff;
}

/* Tools Search and Filter Bar */
.tools-search-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-sm, 6px);
    padding: 6px 12px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.tools-search-wrapper:focus-within {
    border-color: rgba(139, 92, 246, 0.65);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.2);
    background: rgba(15, 23, 42, 0.95);
}

.tools-search-icon {
    font-size: 0.85rem;
    opacity: 0.7;
    flex-shrink: 0;
}

.tools-search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #f8fafc;
    font-size: 0.82rem;
    font-family: inherit;
}

.tools-search-input::placeholder {
    color: #64748b;
    font-size: 0.80rem;
}

.tools-count-badge {
    font-size: 0.70rem;
    font-weight: 700;
    color: #c4b5fd;
    background: rgba(139, 92, 246, 0.18);
    border: 1px solid rgba(139, 92, 246, 0.35);
    padding: 2px 8px;
    border-radius: 9999px;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

/* Tools Permission Management Grid & Interactive Cards */
.tools-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 8px;
    max-height: 290px;
    overflow-y: auto;
    padding-right: 4px;
}

.tools-checkbox-grid::-webkit-scrollbar {
    width: 6px;
}

.tools-checkbox-grid::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.4);
    border-radius: 3px;
}

.tools-checkbox-grid::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.35);
    border-radius: 3px;
}

.tools-checkbox-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.65);
}

.tool-checkbox-card.hidden-tool {
    display: none !important;
}

.tools-no-results {
    grid-column: 1 / -1;
    padding: 22px 14px;
    text-align: center;
    color: #94a3b8;
    font-size: 0.82rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px dashed rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md, 8px);
}

@media (max-width: 640px) {
    .tools-checkbox-grid {
        grid-template-columns: 1fr;
    }
}

.tools-checkbox-grid > .tool-checkbox-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
}

.tool-checkbox-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    min-height: 80px;
}

.tool-checkbox-card:hover {
    background: rgba(30, 41, 59, 0.90);
    border-color: rgba(139, 92, 246, 0.50);
}

.tool-checkbox-card.active {
    background: rgba(124, 58, 237, 0.14);
    border-color: rgba(139, 92, 246, 0.85);
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.18);
}

.tool-checkbox-card.active.inherited {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.70);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.15);
}

.tool-checkbox-card input[type="checkbox"] {
    accent-color: #8b5cf6;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    cursor: pointer;
    flex-shrink: 0;
}

.tool-card-icon {
    font-size: 1.35rem;
    flex-shrink: 0;
    line-height: 1;
    margin-top: 1px;
}

.tool-card-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.tool-card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    margin-bottom: 3px;
}

.tool-card-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #f8fafc;
    line-height: 1.3;
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
}

.tool-card-desc {
    font-size: 0.74rem;
    color: #94a3b8;
    line-height: 1.35;
    margin-top: 2px;
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
}

.tool-card-badge {
    font-size: 0.64rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    flex-shrink: 0;
    white-space: nowrap;
}

.tool-checkbox-card > .tool-card-badge {
    margin-left: auto;
    align-self: flex-start;
}

.badge-inherited {
    background: rgba(16, 185, 129, 0.22);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.55);
}

.badge-custom {
    background: rgba(139, 92, 246, 0.22);
    color: #c4b5fd;
    border: 1px solid rgba(139, 92, 246, 0.55);
}

/* Monospace Terminal Box in Chat / Walkie-talkie */
.comms-terminal-box {
    background: #090d16;
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 8px;
    padding: 10px 14px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.80rem;
    color: #38bdf8;
    overflow-x: auto;
    margin: 8px 0;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5);
    line-height: 1.45;
}

.comms-tools-chips-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.comms-tool-chip {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 9999px;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: #38bdf8;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.comms-patron-chip {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(217, 119, 6, 0.10));
    border: 1px solid rgba(245, 158, 11, 0.45);
    color: #fde68a;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.15);
    font-weight: 700;
    letter-spacing: 0.2px;
}

.comms-tools-more {
    background: rgba(148, 163, 184, 0.14);
    border: 1px dashed rgba(148, 163, 184, 0.35);
    color: #cbd5e1;
    cursor: help;
}

/* =========================================================
   Chat File Attachments & Document Reader Styling
   ========================================================= */

.chat-attachment-chips-row,
.chat-box-attachment-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 10px;
    margin-bottom: 6px;
    border-radius: var(--radius-md);
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    transition: all 0.2s ease;
}

.chat-attachment-chips-row.hidden,
.chat-box-attachment-chips.hidden {
    display: none !important;
}

.attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.73rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: var(--text-high);
    max-width: 260px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    animation: fadeInChip 0.2s ease-out;
}

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

.attachment-chip .chip-icon {
    font-size: 0.95rem;
    flex-shrink: 0;
}

.attachment-chip .chip-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 140px;
}

.attachment-chip .chip-size {
    font-size: 0.65rem;
    opacity: 0.7;
    flex-shrink: 0;
}

.attachment-chip .chip-remove-btn {
    background: transparent;
    border: none;
    color: var(--text-low);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    transition: all 0.15s ease;
}

.attachment-chip .chip-remove-btn:hover {
    color: #f43f5e;
    background: rgba(244, 63, 94, 0.15);
}

.attachment-chip.uploading {
    opacity: 0.75;
    border-style: dashed;
}

.attachment-chip.uploading .chip-remove-btn {
    pointer-events: none;
}

/* Category-specific accent badges */
.attachment-chip.type-pdf {
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.12);
}

.attachment-chip.type-word {
    border-color: rgba(59, 130, 246, 0.4);
    background: rgba(59, 130, 246, 0.12);
}

.attachment-chip.type-excel {
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.12);
}

.attachment-chip.type-image {
    border-color: rgba(168, 85, 247, 0.4);
    background: rgba(168, 85, 247, 0.12);
}

/* Attachment cards rendered inside user message bubbles */
.message-attachments-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.message-attachment-card {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    max-width: 100%;
    transition: transform 0.15s ease, background 0.15s ease;
}

.message-attachment-card:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
}

.message-attachment-card .card-icon-wrap {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.1);
}

.message-attachment-card.type-pdf .card-icon-wrap {
    background: rgba(239, 68, 68, 0.22);
}

.message-attachment-card.type-word .card-icon-wrap {
    background: rgba(59, 130, 246, 0.22);
}

.message-attachment-card.type-excel .card-icon-wrap {
    background: rgba(16, 185, 129, 0.22);
}

.message-attachment-card.type-image .card-icon-wrap {
    background: rgba(168, 85, 247, 0.22);
}

.message-attachment-card .card-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.message-attachment-card .card-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-high);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.message-attachment-card .card-meta {
    font-size: 0.65rem;
    color: var(--text-low);
    display: flex;
    align-items: center;
    gap: 6px;
}

.message-attachment-card .card-badge {
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.12);
}

/* Button attachments in Comms & Employee Chat Boxes */
.btn-comms-attach,
.btn-box-attach {
    background: transparent;
    border: none;
    color: var(--text-low);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-comms-attach:hover,
.btn-box-attach:hover {
    color: var(--accent);
    background: rgba(139, 92, 246, 0.15);
    transform: scale(1.1);
}

/* Drag and Drop Overlays for All Chats */
.chat-drag-drop-overlay,
.chat-box-drop-overlay,
.comms-drop-overlay {
    position: absolute;
    inset: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(11, 17, 32, 0.88);
    backdrop-filter: blur(10px);
    border: 2px dashed #8b5cf6;
    border-radius: inherit;
    pointer-events: none;
    transition: opacity 0.2s ease;
    animation: dropPulse 1.8s infinite alternate;
}

@keyframes dropPulse {
    0% {
        border-color: #8b5cf6;
        box-shadow: inset 0 0 20px rgba(139, 92, 246, 0.2);
    }
    100% {
        border-color: #06b6d4;
        box-shadow: inset 0 0 35px rgba(6, 182, 212, 0.35);
    }
}

.drop-overlay-content,
.drop-overlay-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    padding: 16px;
}

.drop-icon {
    font-size: 2.5rem;
    animation: bounceDrop 0.8s ease infinite alternate;
}

@keyframes bounceDrop {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(-8px);
    }
}

.drop-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #f8fafc;
}

.drop-sub {
    margin: 0;
    font-size: 0.82rem;
    color: #94a3b8;
}

.card-download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 600;
    background: rgba(139, 92, 246, 0.22);
    color: #e2e8f0;
    border: 1px solid rgba(139, 92, 246, 0.4);
    text-decoration: none;
    margin-left: auto;
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.card-download-btn:hover {
    background: #8b5cf6;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.6);
    transform: translateY(-1px);
}

/* =========================================================
   AUTHENTICATION & LOGIN OVERLAY (CYBER-SECURE VAULT)
   ========================================================= */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, rgba(15, 23, 42, 0.98) 0%, rgba(7, 9, 14, 0.99) 100%);
    transition: opacity 0.25s ease, visibility 0.25s ease;
    transform: translate3d(0, 0, 0);
}

.login-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    display: none !important;
}

.login-box {
    width: 100%;
    max-width: 440px;
    background: rgba(16, 21, 34, 0.88);
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: var(--radius-xl);
    padding: 36px 32px;
    box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.8), 0 0 35px rgba(139, 92, 246, 0.25);
    position: relative;
    overflow: hidden;
    animation: loginBoxEnter 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.login-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #8b5cf6, #06b6d4, #10b981);
}

.login-header {
    text-align: center;
    margin-bottom: 24px;
}

.login-icon-wrap {
    width: 58px;
    height: 58px;
    margin: 0 auto 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(6, 182, 212, 0.25));
    border: 1px solid rgba(139, 92, 246, 0.45);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.35);
    font-size: 1.8rem;
}

.login-title {
    margin: 0 0 6px;
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--text-high);
    letter-spacing: -0.02em;
}

.login-subtitle {
    margin: 0;
    font-size: 0.82rem;
    color: var(--text-mid);
    line-height: 1.4;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.login-field label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-mid);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.login-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.login-input-group .input-icon {
    position: absolute;
    left: 12px;
    color: var(--text-low);
    pointer-events: none;
    font-size: 1rem;
}

.login-input-group input {
    width: 100%;
    padding: 11px 40px 11px 38px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-high);
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.2s ease;
}

.login-input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 14px rgba(139, 92, 246, 0.3);
}

.toggle-password-btn {
    position: absolute;
    right: 10px;
    background: transparent;
    border: none;
    color: var(--text-low);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease;
}

.toggle-password-btn:hover {
    color: var(--text-high);
}

.login-error-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(244, 63, 94, 0.15);
    border: 1px solid rgba(244, 63, 94, 0.35);
    border-radius: var(--radius-sm);
    color: #fca5a5;
    font-size: 0.8rem;
    line-height: 1.35;
}

.login-error-box.hidden {
    display: none;
}

.login-btn-submit {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(139, 92, 246, 0.4);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 6px;
}

.login-btn-submit:hover:not(:disabled) {
    background: linear-gradient(135deg, #9d71ff, #7377f8);
    box-shadow: 0 6px 24px rgba(139, 92, 246, 0.6);
    transform: translateY(-1px);
}

.login-btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.login-quick-accounts {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-subtle);
}

.quick-accounts-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-low);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.quick-accounts-chips {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.quick-account-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-mid);
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-account-chip:hover {
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.35);
    color: var(--text-high);
}

.chip-user-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chip-avatar {
    font-size: 1rem;
}

.chip-name {
    font-weight: 600;
}

.chip-badge {
    font-size: 0.68rem;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    background: rgba(139, 92, 246, 0.2);
    color: #c4b5fd;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.chip-badge.member {
    background: rgba(6, 182, 212, 0.2);
    color: #67e8f9;
    border-color: rgba(6, 182, 212, 0.3);
}

/* =========================================================
   HEADER USER PROFILE & SESSION PILL
   ========================================================= */
.user-session-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    transition: all 0.2s ease;
}

.user-session-pill:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(139, 92, 246, 0.3);
}

.user-avatar-badge {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(6, 182, 212, 0.3));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.user-info-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.user-name {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-high);
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role-badge {
    font-size: 0.65rem;
    font-weight: 600;
    color: #38bdf8;
}

.logout-icon-btn {
    background: transparent;
    border: none;
    color: var(--text-low);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    margin-left: 2px;
}

.logout-icon-btn:hover {
    color: #f43f5e;
    background: rgba(244, 63, 94, 0.15);
}

/* =========================================================
   COMPANY OWNER & MEMBERS MANAGEMENT (SETTINGS TAB 2)
   ========================================================= */
.company-members-section {
    padding: 18px;
    background: rgba(12, 17, 29, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.company-owner-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(139, 92, 246, 0.08));
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-md);
    margin: 12px 0 14px;
}

.owner-card-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.owner-crown-icon {
    font-size: 1.6rem;
}

.owner-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.owner-tag {
    font-size: 0.65rem;
    font-weight: 800;
    color: #fbbf24;
    letter-spacing: 0.06em;
}

.owner-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-high);
}

.owner-email {
    font-size: 0.78rem;
    color: var(--text-mid);
    font-family: var(--font-mono);
}

.owner-card-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: rgba(245, 158, 11, 0.2);
    color: #fde68a;
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.add-member-form-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.add-member-input-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

.add-member-input-wrapper .input-icon {
    position: absolute;
    left: 12px;
    color: var(--text-low);
    pointer-events: none;
}

.add-member-input-wrapper input {
    width: 100%;
    padding-left: 36px;
}

.member-only-notice {
    padding: 10px 14px;
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.25);
    border-radius: var(--radius-sm);
    color: #67e8f9;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.member-only-notice.hidden {
    display: none;
}

.members-list-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-mid);
    margin-bottom: 8px;
}

.company-members-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.member-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.member-item-row:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(139, 92, 246, 0.25);
}

.member-item-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.member-avatar {
    font-size: 1.1rem;
}

.member-info-col {
    display: flex;
    flex-direction: column;
}

.member-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-high);
}

.member-email {
    font-size: 0.74rem;
    color: var(--text-mid);
    font-family: var(--font-mono);
}

.member-date {
    font-size: 0.68rem;
    color: var(--text-low);
}

.btn-remove-member {
    background: transparent;
    border: 1px solid rgba(244, 63, 94, 0.3);
    color: #fca5a5;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-remove-member:hover {
    background: rgba(244, 63, 94, 0.2);
    color: #ffffff;
    border-color: #f43f5e;
}





