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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f8fafc;
    color: #2d3748;
    line-height: 1.6;
    overflow-x: hidden;
    width: 100%;
}

/* Prevent horizontal scrolling on all elements */
* {
    max-width: 100%;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f8fafc;
    overflow-x: hidden;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px;
    background: linear-gradient(135deg, #0e1369 0%, #06b8a0 190%);
    color: white;
    transform: translateX(0);
    transition: width 0.3s ease, transform 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.logo-container {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    width: 120px;
    height: auto;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* First sidebar-nav takes available space, pushing bottom nav down */
.sidebar-nav:first-of-type {
    flex: 1;
}

/* Bottom navigation section */
.sidebar-nav-bottom {
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding-top: 8px;
    padding-bottom: 16px;
}

.sidebar-nav li {
    margin: 0;
}

.sidebar-nav button {
    width: 100%;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.9);
    padding: 16px 24px;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 15px;
    display: flex;
    align-items: center;
    position: relative;
}

.sidebar-nav button:hover,
.sidebar-nav button.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.sidebar-icon {
    margin-right: 12px;
    width: 20px;
    text-align: center;
}

.sidebar-text {
    flex: 1;
}

/* Sub-navigation */
.sub-nav {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(0, 0, 0, 0.1);
}

.sub-nav.visible {
    max-height: 300px;
}

.sub-nav button {
    padding-left: 60px;
    font-size: 14px;
    opacity: 0.8;
}

.sub-nav-arrow {
    margin-left: auto;
    transition: transform 0.3s ease;
    padding: 8px;
    margin: -8px;
    margin-left: auto;
    cursor: pointer;
    border-radius: 4px;
}

.sub-nav-arrow:hover {
    background: rgba(255, 255, 255, 0.15);
}

.sub-nav-arrow.rotated {
    transform: rotate(180deg);
}

/* Main Content */
.main-content {
    margin-left: 280px;
    min-height: 100vh;
    transition: margin-left 0.3s ease, width 0.3s ease;
    background: #f8fafc;
}

/* Section Management */
.section {
    display: none;
    padding: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

.section.active {
    display: block;
}

.container {
    width: 100%;
}

h1 {
    font-size: 2.2rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

h1 i {
    color: #0e1369;
}

.section-subtitle {
    font-size: 1.1rem;
    color: #718096;
    margin-bottom: 30px;
}

/* Toggle Buttons */
.sidebar-toggle-btn {
    position: fixed;
    top: 20px;
    left: 300px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 999;
    transition: all 0.3s ease;
    color: #4a5568;
}

.sidebar-toggle-btn:hover {
    background: #f7fafc;
    transform: scale(1.05);
}

.mobile-menu-toggle {
    position: fixed;
    top: 15px;
    left: 15px;
    background: linear-gradient(135deg, #0e1369 0%, #06b8a0 100%);
    border: none;
    border-radius: 8px;
    width: 44px;
    height: 44px;
    color: white;
    cursor: pointer;
    z-index: 1001;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
}

.mobile-menu-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(6, 184, 160, 0.3);
}

/* Mobile Overlay */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

/* Collapsed Sidebar — Icon Bar */
.sidebar-collapsed .sidebar {
    width: 64px;
    transform: none;
    overflow: visible;
}

.sidebar-collapsed .main-content {
    margin-left: 64px;
}

.sidebar-collapsed .sidebar-toggle-btn {
    left: 76px;
}

/* Logo: show icon, hide full */
.sidebar-logo-icon {
    display: none;
}

.sidebar-collapsed .sidebar-logo-full {
    display: none;
}

.sidebar-collapsed .sidebar-logo-icon {
    display: block;
    width: 32px;
    height: auto;
    margin: 0 auto;
}

.sidebar-collapsed .logo-container {
    padding: 14px 10px;
}

/* Hide text, arrows, and sub-nav in collapsed mode */
.sidebar-collapsed .sidebar-text {
    display: none;
}

.sidebar-collapsed .sub-nav-arrow {
    display: none;
}

.sidebar-collapsed .sub-nav {
    max-height: 0 !important;
    overflow: hidden;
    position: absolute;
    left: 64px;
    top: 0;
    width: 260px;
    max-width: none;
    min-width: 260px;
    background: #0e1369;
    border-radius: 0 10px 10px 0;
    box-shadow: 6px 4px 20px rgba(0, 0, 0, 0.35);
    transition: max-height 0.25s ease, opacity 0.25s ease;
    opacity: 0;
    z-index: 1002;
}

/* Icon-only buttons */
.sidebar-collapsed .sidebar-nav > li {
    position: relative;
}

.sidebar-collapsed .sidebar-nav > li > button {
    padding: 16px 0;
    justify-content: center;
}

.sidebar-collapsed .sidebar-icon {
    margin-right: 0;
    font-size: 18px;
}

/* Tooltip on hover (parent items only) */
.sidebar-collapsed .sidebar-nav > li > button[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 64px;
    top: 50%;
    transform: translateY(-50%);
    background: #1a1f7a;
    color: white;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1003;
    box-shadow: 4px 2px 12px rgba(0, 0, 0, 0.2);
}

/* Show tooltip on hover — only when button has NO sibling sub-nav (is last child) */
.sidebar-collapsed .sidebar-nav > li:hover > button[data-tooltip]:last-child::after {
    opacity: 1;
}

/* Flyout sub-nav on hover */
.sidebar-collapsed .sidebar-nav > li:hover > .sub-nav {
    max-height: 400px !important;
    opacity: 1;
    overflow: visible;
}

/* Flyout header label */
.sidebar-collapsed .sub-nav::before {
    content: attr(data-group);
    display: block;
    padding: 12px 20px 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 4px;
}

/* Flyout sub-nav button styling */
.sidebar-collapsed .sub-nav button {
    padding: 12px 24px !important;
    font-size: 14px;
    opacity: 1;
    display: flex;
    align-items: center;
    white-space: nowrap;
    color: rgba(255, 255, 255, 0.95);
}

.sidebar-collapsed .sub-nav .sidebar-icon {
    margin-right: 10px;
    font-size: 14px;
}

.sidebar-collapsed .sub-nav .sidebar-text {
    display: inline;
}

.sidebar-collapsed .sub-nav button:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* Bottom nav adjustments in collapsed mode */
.sidebar-collapsed .sidebar-nav-bottom {
    border-top-color: rgba(255, 255, 255, 0.1);
    padding-bottom: 12px;
}

/* Bottom nav flyout anchors upward so it stays in viewport */
.sidebar-collapsed .sidebar-nav-bottom .sub-nav {
    top: auto;
    bottom: 0;
}

/* Logout item in flyout */
.sidebar-collapsed .sidebar-logout-item {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 2px;
    padding-top: 2px;
}

/* AI Knowledge Tree Styles */
.knowledge-tree-container {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
}

.knowledge-tree {
    max-width: 100%;
}

.knowledge-branch {
    margin-bottom: 24px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.branch-header {
    background: #f8fafc;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
    user-select: none;
}

.branch-header:hover {
    background: #edf2f7;
}

.branch-icon {
    color: #0e1369;
    width: 20px;
    text-align: center;
}

.branch-title {
    flex: 1;
    font-weight: 600;
    color: #2d3748;
    font-size: 16px;
}

.expand-icon {
    color: #a0aec0;
    transition: transform 0.3s ease;
    font-size: 14px;
}

.branch-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: white;
}

.branch-content.expanded {
    max-height: 600px;
    padding: 16px 0;
}

.knowledge-item {
    padding: 12px 20px 12px 52px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f1f5f9;
}

.knowledge-item:hover {
    background: #f8fafc;
}

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

.knowledge-item-icon {
    color: #a0aec0;
    width: 16px;
    text-align: center;
    font-size: 14px;
}

.knowledge-item-name {
    flex: 1;
    color: #4a5568;
    font-weight: 500;
}

.knowledge-item-count {
    color: #a0aec0;
    font-size: 14px;
}

.knowledge-item-status {
    font-size: 12px;
    color: #718096;
}

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

.integration-status-indicator.connected {
    background: #48bb78;
}

.integration-status-indicator.not-connected {
    background: #cbd5e0;
}

/* Chat Interface Styles */
.interact-now-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Business Intelligence section title styling */
#interactnow-section h1 {
    display: block;
}

.chat-interface-modern {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    height: 75vh; /* Slightly shorter on desktop */
    max-height: 750px; /* Reduced max height */
    min-height: 600px; /* Minimum height for usability */
    display: flex;
    flex-direction: column;
    width: 98%; /* Wider on desktop */
    max-width: 1400px; /* Increased maximum width */
    margin: 40px auto 0; /* Add top margin to position lower, center horizontally */
}

.chat-header {
    background: linear-gradient(135deg, #0e1369 0%, #06b8a0 190%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-status {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #48bb78;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

.action-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Chat Overlay Styles */
.chat-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
    backdrop-filter: blur(5px);
}

.chat-overlay-container {
    width: 100%;
    height: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.chat-overlay .chat-interface-modern {
    flex: 1;
    height: 100%;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* Chat Close Button - Universal (Desktop + Mobile) */
.chat-close-btn {
    display: flex !important;
    background: rgba(255, 0, 0, 0.2) !important;
}

.chat-close-btn:hover {
    background: rgba(255, 0, 0, 0.3) !important;
}

/* Business Intelligence Layout */
.bi-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 30px;
    margin-top: 30px;
    max-height: calc(100vh - 180px);
    max-height: calc(100dvh - 180px);
}

/* Centered BI layout (no history panel) */
.bi-layout.bi-layout-centered {
    grid-template-columns: 1fr;
    max-height: none;
}

/* Chat History Panel (Left) */
.chat-history-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    height: 600px;
    height: min(600px, calc(100vh - 200px)); /* Responsive: max 600px or fit viewport */
    height: min(600px, calc(100dvh - 200px));
    display: flex;
    flex-direction: column;
}

.chat-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #0e1369 0%, #06b8a0 100%);
    color: white;
}

.chat-history-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
}

.chat-history-header h3 i {
    margin-right: 8px;
    color: white;
}

.refresh-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.refresh-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(180deg);
}

.chat-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.chat-history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.chat-history-item:hover {
    background: #e9ecef;
    border-color: #06b8a0;
    transform: translateX(5px);
}

.chat-item-content {
    flex: 1;
}

.chat-item-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.chat-item-header i {
color: #06b8a0;
margin-right: 8px;
}

.chat-item-title {
font-weight: 500;
color: #2d3748;
flex: 1;
}

.chat-item-title-input {
border: none;
background: transparent;
font-weight: 500;
color: #2d3748;
font-size: inherit;
font-family: inherit;
padding: 2px 6px;
border-radius: 4px;
outline: none;
transition: all 0.2s ease;
cursor: text;
flex: 1;
width: 100%;
}

.chat-item-title-input:hover {
background: rgba(6, 184, 160, 0.05);
}

.chat-item-title-input:focus {
background: white;
box-shadow: 0 0 0 2px #06b8a0;
cursor: text;
}

.chat-item-meta {
display: flex;
gap: 15px;
font-size: 0.85rem;
color: #666;
    font-size: 0.85rem;
    color: #666;
}

.chat-item-meta i {
    margin-right: 4px;
}

.chat-item-actions {
    display: flex;
    gap: 5px;
}

.chat-item-action-btn {
    background: transparent;
    border: none;
    color: #dc3545;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-item-action-btn:hover {
    background: rgba(220, 53, 69, 0.1);
}

.chat-history-loading,
.chat-history-empty,
.chat-history-error {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.chat-history-loading i,
.chat-history-empty i,
.chat-history-error i {
    font-size: 3rem;
    margin-bottom: 15px;
    color: #06b8a0;
}

.chat-history-empty p {
    margin: 10px 0;
}

.empty-hint {
    font-size: 0.9rem;
    color: #999;
}

/* Folder Organization Styles */
.new-folder-btn-container {
    padding: 10px;
    border-bottom: 1px solid #e9ecef;
}

.new-folder-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #0e1369 0%, #06b8a0 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.new-folder-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(6, 184, 160, 0.3);
}

.new-folder-btn i {
    font-size: 1.1rem;
}

.chat-folder {
    margin-bottom: 5px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.chat-folder.drag-over {
    background: rgba(6, 184, 160, 0.1);
    border: 2px dashed #06b8a0;
}

.chat-folder-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 5px;
    transition: all 0.2s ease;
}

.chat-folder-header:hover {
    background: #e9ecef;
}

.chat-folder-title {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    flex: 1;
    user-select: none;
}

.folder-chevron {
    color: #666;
    font-size: 0.9rem;
    transition: transform 0.2s ease;
}

.chat-folder-title .fa-folder {
    color: #06b8a0;
    font-size: 1.1rem;
}

.chat-folder .folder-name {
    font-weight: 600;
    color: #0e1369;
    font-size: 0.95rem;
}

.folder-count {
    color: #999;
    font-size: 0.85rem;
    margin-left: 5px;
}

.chat-folder-actions {
    display: flex;
    gap: 5px;
}

.folder-action-btn {
    background: transparent;
    border: none;
    color: #666;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.folder-action-btn:hover {
    background: rgba(6, 184, 160, 0.1);
    color: #06b8a0;
}

.folder-action-btn:last-child:hover {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.chat-folder-content {
    overflow: hidden;
    transition: all 0.3s ease;
    padding-left: 25px;
}

.chat-folder-content.expanded {
    max-height: 2000px;
    opacity: 1;
    margin-bottom: 10px;
}

.chat-folder-content.collapsed {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
}

.folder-empty-state {
    text-align: center;
    padding: 30px 20px;
    color: #999;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
    margin-bottom: 10px;
}

.folder-empty-state i {
    font-size: 2rem;
    margin-bottom: 10px;
    color: #06b8a0;
    opacity: 0.5;
}

.folder-empty-state p {
    margin: 0;
    font-size: 0.9rem;
}

/* Chat Item Drag Handle */
.chat-item-drag-handle {
    display: flex;
    align-items: center;
    padding: 0 8px;
    color: #999;
    cursor: grab;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.chat-history-item:hover .chat-item-drag-handle {
    opacity: 1;
}

.chat-item-drag-handle:active {
    cursor: grabbing;
}

.chat-history-item.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.chat-history-item[draggable="true"] {
    cursor: move;
}

/* Chat Multi-Select Controls */
.chat-multi-select-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 4px;
    border-radius: 6px 6px 0 0;
}

.chat-select-all-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #475569;
    font-weight: 500;
}

.chat-select-all-label:hover {
    color: #0e1369;
}

.chat-select-all-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #06b8a0;
}

.chat-delete-selected-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-delete-selected-btn:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.chat-delete-selected-btn i {
    font-size: 11px;
}

/* Chat Item Checkbox */
.chat-item-checkbox-container {
    display: flex;
    align-items: center;
    padding-right: 8px;
}

.chat-item-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #06b8a0;
}

.chat-item-checkbox:checked + .chat-item-drag-handle + .chat-item-content {
    background: rgba(6, 184, 160, 0.05);
}

/* Editable Folder Name Input */
.chat-folder .folder-name-input {
    border: none;
    background: transparent;
    font-weight: 600;
    color: #0e1369;
    font-size: 0.95rem;
    padding: 4px 8px;
    border-radius: 4px;
    outline: none;
    transition: all 0.2s ease;
    cursor: text;
    flex: 1;
    max-width: 200px;
}

.chat-folder .folder-name-input:hover {
    background: rgba(6, 184, 160, 0.05);
}

.chat-folder .folder-name-input:focus {
    background: white;
    box-shadow: 0 0 0 2px #06b8a0;
}

/* Topic Modal Styles */
.topic-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.topic-modal {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 500px;
    animation: slideUp 0.3s ease;
}

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

.topic-modal-header {
    background: linear-gradient(135deg, #0e1369 0%, #06b8a0 100%);
    color: white;
    padding: 20px 24px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topic-modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.topic-modal-header h3 i {
    margin-right: 8px;
}

.topic-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.topic-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.topic-modal-body {
    padding: 24px;
}

.topic-modal-body label {
    display: block;
    font-weight: 600;
    color: #0e1369;
    margin-bottom: 8px;
}

.topic-name-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s ease;
    outline: none;
}

.topic-name-input:focus {
    border-color: #06b8a0;
    box-shadow: 0 0 0 3px rgba(6, 184, 160, 0.1);
}

.topic-modal-body p {
    margin: 0 0 12px 0;
    color: #333;
    line-height: 1.6;
}

.topic-modal-warning {
    color: #dc3545;
    font-size: 0.9rem;
    background: rgba(220, 53, 69, 0.1);
    padding: 12px;
    border-radius: 6px;
    border-left: 3px solid #dc3545;
}

.topic-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.topic-modal-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.topic-modal-btn-cancel {
    background: #e9ecef;
    color: #666;
}

.topic-modal-btn-cancel:hover {
    background: #dee2e6;
}

.topic-modal-btn-confirm {
    background: linear-gradient(135deg, #0e1369 0%, #06b8a0 100%);
    color: white;
}

.topic-modal-btn-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(6, 184, 160, 0.3);
}

.topic-modal-btn-delete {
    background: #dc3545;
    color: white;
}

.topic-modal-btn-delete:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

/* Topic Selection Modal Styles */
.topic-options-list {
    max-height: 300px;
    overflow-y: auto;
    margin: 16px 0;
    border: 1px solid #e9ecef;
    border-radius: 8px;
}

.topic-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f8f9fa;
}

.topic-option:last-child {
    border-bottom: none;
}

.topic-option:hover {
    background: #f8f9fa;
}

.topic-option.selected {
    background: rgba(6, 184, 160, 0.1);
    border-left: 3px solid #06b8a0;
}

.topic-option i.fa-folder {
    color: #06b8a0;
    font-size: 1.1rem;
}

.topic-option span {
    flex: 1;
    font-weight: 500;
    color: #333;
}

.topic-selected-icon {
    color: #06b8a0;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.topic-option.selected .topic-selected-icon {
    opacity: 1;
}

.topic-divider {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.topic-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e9ecef;
}

.topic-divider span {
    background: white;
    padding: 0 16px;
    color: #999;
    font-size: 0.9rem;
    position: relative;
    z-index: 1;
}

.new-topic-btn {
    width: 100%;
    padding: 12px;
    background: white;
    border: 2px dashed #06b8a0;
    color: #06b8a0;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.new-topic-btn:hover {
    background: rgba(6, 184, 160, 0.05);
    border-style: solid;
}

.new-topic-btn i {
    font-size: 1.1rem;
}

.topic-modal-hint {
    margin-top: 12px;
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
}

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

.topic-modal-btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

.retry-btn {
    margin-top: 15px;
    background: #06b8a0;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.retry-btn:hover {
    background: #059688;
}

/* New Chat Panel (Right) */
.new-chat-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 40px;
    height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-trigger-content {
    text-align: center;
    max-width: 500px;
}

.chat-trigger-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}

.chat-trigger-icon {
    font-size: 50px;
    color: #06b8a0;
    margin-bottom: 0;
    animation: pulse 2s infinite;
}

.chat-trigger-logo {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 50%;
    animation: logo-pulse 2s infinite;
}

@keyframes logo-pulse {
    0% {
        transform: scale(1);
        filter: drop-shadow(0 0 0 rgba(6, 184, 160, 0.4));
    }
    50% {
        transform: scale(1.05);
        filter: drop-shadow(0 0 15px rgba(6, 184, 160, 0.6));
    }
    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 0 rgba(6, 184, 160, 0.4));
    }
}

.chat-trigger-content h2 {
    font-size: 1.8rem;
    color: #0e1369;
    margin-bottom: 0;
}

.chat-trigger-description {
    font-size: 1rem;
    color: #666;
    margin-bottom: 25px;
    line-height: 1.6;
}

.chat-trigger-btn {
    background: linear-gradient(135deg, #0e1369 0%, #06b8a0 100%);
    color: white;
    border: none;
    padding: 15px 35px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(6, 184, 160, 0.3);
}

.chat-trigger-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(6, 184, 160, 0.4);
}

.chat-trigger-btn i {
    margin-right: 10px;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Save This Chat Button */
.save-chat-container {
    display: flex;
    justify-content: center;
    margin: 15px 0;
    padding: 10px 0;
}

.save-chat-btn {
    background: linear-gradient(135deg, #e91e63 0%, #f06292 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(233, 30, 99, 0.3);
}

.save-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(233, 30, 99, 0.4);
}

.save-chat-btn i {
    margin-right: 8px;
    animation: heartbeat 1.5s infinite;
}

@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.1);
    }
    50% {
        transform: scale(1);
    }
}

/* Business Agents Page Styles */
/* Optimized Filter Bar with Table Layout */
.agents-filter-bar {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-top: 30px;
    margin-bottom: 30px;
}

/* Top Row: Search + Status + Reset */
.filter-top-row {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
}

.search-wrapper {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #718096;
    font-size: 0.95rem;
}

.agent-search-input {
    width: 100%;
    padding: 12px 15px 12px 45px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.agent-search-input:focus {
    outline: none;
    border-color: #06b8a0;
    box-shadow: 0 0 0 3px rgba(6, 184, 160, 0.1);
}

.filter-controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

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

.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #f8f9fa;
    border: 2px solid #e2e8f0;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    color: #4a5568;
    user-select: none;
}

.filter-pill.status-pill {
    padding: 8px 12px;
}

.filter-pill:hover {
    background: #e2e8f0;
    border-color: #cbd5e0;
    transform: translateY(-1px);
}

.filter-pill input[type="checkbox"] {
    display: none;
}

.filter-pill:has(input[type="checkbox"]:checked) {
    background: linear-gradient(135deg, #0e1369 0%, #06b8a0 100%);
    border-color: #06b8a0;
    color: white;
}

.filter-pill:has(input[type="checkbox"]:checked) span {
    color: white;
}

.filter-pill span {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Category Table Layout */
.category-table {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.category-column {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 12px;
    border: 1px solid #e2e8f0;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: white;
    border: 2px solid #cbd5e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
    font-size: 0.9rem;
    color: #0e1369;
    margin-bottom: 4px;
}

.category-header.all-header {
    background: linear-gradient(135deg, #0e1369 0%, #06b8a0 100%);
    border-color: #06b8a0;
    color: white;
}

.category-header.all-header span {
    color: white;
}

.category-header:hover {
    background: #e2e8f0;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.category-header.all-header:hover {
    background: linear-gradient(135deg, #0e1369 0%, #06b8a0 100%);
}

.category-header:has(input[type="checkbox"]:checked) {
    background: linear-gradient(135deg, #0e1369 0%, #06b8a0 100%);
    border-color: #06b8a0;
    color: white;
}

.category-header:has(input[type="checkbox"]:checked) span {
    color: white;
}

.category-header input[type="checkbox"] {
    display: none;
}

.category-header span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    color: #4a5568;
}

.category-item:hover {
    background: #f8f9fa;
    border-color: #cbd5e0;
    transform: translateX(2px);
}

.category-item:has(input[type="checkbox"]:checked) {
    background: #e6f7f5;
    border-color: #06b8a0;
    color: #0e1369;
    font-weight: 600;
}

.category-item input[type="checkbox"] {
    display: none;
}

.category-item span {
    flex: 1;
}

.category-separator {
    font-size: 0.7rem;
    color: #cbd5e0;
    margin: 0 4px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.active {
    background: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.status-dot.disabled {
    background: #9ca3af;
}

.reset-filters-btn {
    padding: 10px 20px;
    background: #f1f5f9;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    color: #0e1369;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}

.reset-filters-btn:hover {
    background: #e2e8f0;
    border-color: #cbd5e0;
    transform: translateY(-1px);
}

/* Agent Display Area */
.agents-display-area {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 25px;
}

.agents-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
}

.agents-header h2 {
    font-size: 1.5rem;
    color: #0e1369;
    margin: 0;
}

.agent-count {
    font-size: 0.95rem;
    color: #718096;
    background: #f1f5f9;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
}

/* Agent Cards Grid */
.agents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.agent-card {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.agent-card:hover {
    border-color: #06b8a0;
    box-shadow: 0 8px 20px rgba(6, 184, 160, 0.15);
    transform: translateY(-4px);
}

.agent-card.active {
    border-color: #10b981;
}

.agent-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.agent-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #0e1369 0%, #06b8a0 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.agent-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f8f9fa;
    border-radius: 20px;
}

.agent-status .status-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: #4a5568;
}

.agent-card-body {
    flex: 1;
    margin-bottom: 15px;
}

.agent-name {
    font-size: 1.1rem;
    color: #0e1369;
    margin-bottom: 8px;
    font-weight: 700;
}

.agent-category {
    font-size: 0.85rem;
    color: #06b8a0;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

.agent-description {
    font-size: 0.9rem;
    color: #4a5568;
    line-height: 1.5;
    margin-bottom: 12px;
}

.agent-integration {
    font-size: 0.85rem;
    color: #718096;
    display: flex;
    align-items: center;
    gap: 6px;
    font-style: italic;
}

/* Agent Role Badges */
.agent-header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.agent-role-badge {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 4px 10px;
    border-radius: 20px;
}

.agent-role-badge.role-ceo {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.agent-role-badge.role-director {
    background: linear-gradient(135deg, #0e1369, #1e40af);
    color: white;
}

.agent-role-badge.role-specialist {
    background: linear-gradient(135deg, #06b8a0, #059669);
    color: white;
}

/* Agent Details Section */
.agent-details {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.agent-detail {
    font-size: 0.82rem;
    color: #4a5568;
    line-height: 1.4;
    margin: 0;
    display: flex;
    gap: 8px;
}

.agent-detail i {
    color: #06b8a0;
    width: 14px;
    text-align: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.agent-detail strong {
    color: #2d3748;
    white-space: nowrap;
}

.agent-card-footer {
    display: flex;
    gap: 10px;
}

.agent-action-btn {
    flex: 1;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.agent-action-btn.configure {
    background: linear-gradient(135deg, #0e1369 0%, #06b8a0 100%);
    color: white;
}

.agent-action-btn.configure:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(6, 184, 160, 0.3);
}

.agent-action-btn.enable {
    background: #f1f5f9;
    color: #4a5568;
    border: 2px solid #e2e8f0;
}

.agent-action-btn.enable:hover {
    background: #e2e8f0;
    border-color: #cbd5e0;
}

/* Loading and Empty States */
.agents-loading,
.no-agents {
    text-align: center;
    padding: 60px 20px;
    color: #718096;
    grid-column: 1 / -1;
}

.agents-loading i,
.no-agents i {
    font-size: 4rem;
    margin-bottom: 20px;
    color: #cbd5e0;
}

.no-agents p {
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.no-agents .reset-btn {
    background: #06b8a0;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.no-agents .reset-btn:hover {
    background: #059688;
    transform: translateY(-2px);
}

/* Hide mobile close button on desktop (legacy) */
.mobile-close-btn {
    display: none;
}

.chat-messages-container {
    flex: 1;
    overflow: hidden;
}

.chat-messages-modern {
    height: 100%;
    padding: 20px;
    overflow-y: auto;
    background: #f8fafc;
}

/* Welcome Message */
.welcome-message {
    display: flex;
    margin-bottom: 24px;
    align-items: flex-end;
}

.welcome-message .ai-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #4a5568;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
}

.welcome-message .message-content {
    background: white;
    border-radius: 18px 18px 18px 4px;
    padding: 16px 20px;
    max-width: 80%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
}

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

.welcome-message .sender-name {
    font-size: 12px;
    font-weight: 600;
    color: #4a5568;
}

.welcome-message .timestamp {
    font-size: 10px;
    color: #a0aec0;
}

.welcome-message .message-text {
    color: #2d3748;
    line-height: 1.5;
    margin-bottom: 16px;
}

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

.quick-action-btn {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    color: #4a5568;
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.quick-action-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Chat Messages - Updated Clean Style */
.chat-message {
    display: flex;
    margin-bottom: 16px;
    align-items: flex-end;
    animation: messageSlideIn 0.2s ease-out;
}

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

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

.ai-message {
    flex-direction: row;
}

.user-avatar, .ai-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    margin: 0 8px;
}

.user-avatar {
    background: #0da3dd;
    color: white;
}

.ai-avatar {
    background: #4a5568;
    color: white;
}

.message-content {
    max-width: 75%;
    position: relative;
}

.user-content {
    background: #0e1369;
    color: white;
    border-radius: 18px 18px 4px 18px;
    padding: 12px 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.ai-content {
    background: white;
    color: #2d3748;
    border-radius: 18px 18px 18px 4px;
    padding: 12px 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    border: 1px solid #e2e8f0;
}

/* Status message styling */
.status-message .message-content {
    background: #f0f4f8;
    color: #4a5568;
    border-radius: 18px 18px 18px 4px;
    padding: 10px 14px;
    border: 1px solid #cbd5e0;
    font-style: italic;
    opacity: 0.9;
    animation: pulse 2s ease-in-out infinite;
}

.status-message .status-icon {
    margin-right: 8px;
    font-size: 16px;
}

.status-message .status-text {
    font-size: 14px;
}

@keyframes pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

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

.sender-name {
    font-size: 11px;
    font-weight: 600;
    opacity: 0.7;
}

.timestamp {
    font-size: 10px;
    opacity: 0.6;
}

.message-text {
    font-size: 16px;
    line-height: 1.5;
    word-wrap: break-word;
    margin: 0;
    padding: 0;
}

.user-content .message-text {
    color: rgba(255,255,255,0.95);
}

.ai-content .message-text {
    color: #2d3748;
}

/* Message Actions */
.message-actions {
    display: flex;
    gap: 4px;
    margin-top: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.ai-content:hover .message-actions {
    opacity: 1;
}

.message-action-btn {
    background: none;
    border: none;
    padding: 4px 6px;
    border-radius: 6px;
    cursor: pointer;
    color: #a0aec0;
    font-size: 11px;
    transition: all 0.2s ease;
}

.message-action-btn:hover {
    background: rgba(0,0,0,0.05);
    color: #4a5568;
}

/* Chat Input */
.chat-input-container {
    border-top: 1px solid #e2e8f0;
    background: white;
    padding: 16px 20px;
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 8px;
}

.input-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-action-btn {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    color: #4a5568;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.input-action-btn:hover {
    background: #edf2f7;
}

.text-input-area {
    flex: 1;
}

.text-input-area textarea {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 16px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    resize: none;
    outline: none;
    transition: border-color 0.2s ease;
    max-height: 120px;
}

.text-input-area textarea:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.send-btn {
    background: #667eea;
    border: none;
    color: white;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-btn:hover:not(:disabled) {
    background: #5a6fd8;
    transform: translateY(-1px);
}

.send-btn:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
}

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.input-hint {
    color: #a0aec0;
    font-size: 12px;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #4a5568;
    font-size: 12px;
}

.typing-dots span {
    display: inline-block;
    width: 4px;
    height: 4px;
    background: #a0aec0;
    border-radius: 50%;
    margin: 0 1px;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-6px);
    }
}

/* Content Upload Styles */
.content-upload-area {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    margin: 30px 0;
}

.upload-card h3 {
    color: #2d3748;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
}

.upload-drop-zone {
    border: 2px dashed #cbd5e0;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background: #f8fafc;
}

.upload-drop-zone:hover,
.upload-drop-zone.dragover {
    border-color: #667eea;
    background: #f0f4ff;
}

.drop-zone-icon {
    font-size: 48px;
    color: #a0aec0;
    margin-bottom: 16px;
}

.drop-zone-text {
    color: #4a5568;
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 8px;
}

.drop-zone-formats {
    color: #718096;
    font-size: 14px;
}

.upload-controls {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
    margin-top: 20px;
}

.form-group {
    flex: 1;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: #4a5568;
    font-weight: 500;
    font-size: 14px;
}

.category-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    color: #4a5568;
    outline: none;
    transition: border-color 0.2s ease;
}

.category-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.upload-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.upload-btn:hover:not(:disabled) {
    background: #5a6fd8;
    transform: translateY(-1px);
}

.upload-btn:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
}

/* File Structure Styles */
.file-structure-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    width: 100%;
    box-sizing: border-box;
}

.file-structure-section h3 {
    color: #2d3748;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
}

.category-folder {
    margin-bottom: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    transition: all 0.3s ease;
}

.folder-header {
    background: #f8fafc;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    border-bottom: 1px solid #e2e8f0;
}

.folder-header:hover {
    background: #edf2f7;
}

.folder-icon {
    color: #a0aec0;
    width: 16px;
    text-align: center;
}

.category-icon {
    color: #0e1369;
    width: 16px;
    text-align: center;
}

.folder-name {
    flex: 1;
    font-weight: 600;
    color: #2d3748;
    font-size: 14px;
}

.file-count {
    color: #a0aec0;
    font-size: 12px;
    margin-right: 8px;
}

.expand-icon {
    color: #a0aec0;
    transition: transform 0.3s ease;
    font-size: 12px;
}

.folder-contents {
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
    background: white;
}

.category-folder.expanded .folder-contents {
    max-height: 500px;
    padding: 8px 0;
}

.file-item {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f1f5f9;
}

.file-item:hover {
    background: #f8fafc;
}

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

.file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.file-item-icon {
    color: #a0aec0;
    width: 16px;
    text-align: center;
}

.file-item-name {
    color: #4a5568;
    font-weight: 500;
    font-size: 13px;
}

.file-item-size {
    color: #a0aec0;
    font-size: 11px;
    margin-left: 8px;
}

.file-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.file-item:hover .file-actions {
    opacity: 1;
}

.file-action-btn {
    background: none;
    border: none;
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
    color: #a0aec0;
    transition: all 0.2s ease;
}

.file-action-btn:hover {
    background: rgba(0,0,0,0.05);
    color: #4a5568;
}

.view-btn:hover {
    color: #0da3dd;
}

.delete-btn:hover {
    color: #ef4444;
}

/* Integrations Styles */
.integrations-container {
    max-width: 1200px;
    margin: 0 auto;
}

.integrations-header {
    text-align: center;
    margin-bottom: 40px;
}

.integrations-header h1 {
    justify-content: center;
    margin-bottom: 12px;
}

.integrations-header p {
    color: #718096;
    font-size: 18px;
}

.integrations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.integration-item {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    text-align: center;
    transition: all 0.3s ease;
}

.integration-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.integration-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    border-radius: 12px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
}

.integration-icon img {
    width: 40px;
    height: 40px;
}

.integration-item h3 {
    color: #2d3748;
    margin-bottom: 8px;
    font-size: 18px;
}

.integration-item p {
    color: #718096;
    margin-bottom: 16px;
    font-size: 14px;
}

.integration-status {
    margin-bottom: 16px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.connected {
    background: #d4edda;
    color: #28a745;
}

.status-badge.not-connected {
    background: #f8d7da;
    color: #dc3545;
}

.connect-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.connect-btn:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
}

/* Notification Styles */
.upload-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-left: 4px solid #48bb78;
    z-index: 2000;
    min-width: 300px;
    animation: slideInRight 0.3s ease;
}

.upload-notification.error {
    border-left-color: #f56565;
}

@media (max-width: 768px) {
    .upload-notification {
        min-width: unset;
        left: 16px;
        right: 16px;
        max-width: calc(100vw - 32px);
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex !important;
    }

    /* Show mobile close button only on mobile */
    .mobile-close-btn {
        display: flex !important;
    }

    /* Hide the white circle sidebar toggle button on mobile */
    .sidebar-toggle-btn {
        display: none !important;
    }

    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        overflow: hidden;
        height: 100vh;
        height: 100dvh;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .sidebar > .logo-container {
        flex-shrink: 0;
    }

    /* Keep Account pinned at bottom on mobile */
    .sidebar > .sidebar-nav:not(.sidebar-nav-bottom) {
        flex: 1;
        overflow-y: auto;
        min-height: 0;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar > .sidebar-nav-bottom {
        flex-shrink: 0;
        background: linear-gradient(135deg, #0e1369 0%, #06b8a0 190%);
    }

    .mobile-overlay {
        display: block;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }

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

    .main-content {
        margin-left: 0;
        padding: 70px 15px 20px;
        width: 100%;
        box-sizing: border-box;
    }

    .section {
        padding: 15px 10px;
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    /* Mobile Font Color Improvements for Better Visibility */
    /* Apply light colors to main page titles (including those in containers) */
    .section h1:first-of-type,
    .section .container h1:first-of-type {
        color: #f7fafc !important; /* Very light grey/white for main page titles */
    }

    .section h1:first-of-type i,
    .section .container h1:first-of-type i {
        color: #bee3f8 !important; /* Light blue for main title icons */
    }

    .section-subtitle {
        color: #e2e8f0 !important; /* Light grey for subtitles */
    }

    /* Apply light colors to main section headings */
    .section > h2:first-of-type,
    .section > h3:first-of-type,
    .section > h4:first-of-type {
        color: #f7fafc !important; /* Very light grey/white for section headings */
    }

    .section > h2:first-of-type i,
    .section > h3:first-of-type i,
    .section > h4:first-of-type i {
        color: #bee3f8 !important; /* Light blue for section heading icons */
    }

    /* Ensure content inside white containers keeps normal dark colors */
    /* Exclude main page titles from this rule */
    .organization-display h4,
    .organization-setup h3,
    .profile-section h3,
    .profile-section h4,
    .card h3,
    .card h4,
    .container h1:not(:first-of-type),
    .container h2:not(:first-of-type),
    .container h3,
    .container h4,
    .form-section h3,
    .form-section h4 {
        color: #2d3748 !important; /* Dark color for content inside white containers */
    }

    .organization-display h4 i,
    .organization-setup h3 i,
    .profile-section h3 i,
    .profile-section h4 i,
    .card h3 i,
    .card h4 i,
    .container h1:not(:first-of-type) i,
    .container h2:not(:first-of-type) i,
    .container h3 i,
    .container h4 i {
        color: #4299e1 !important; /* Normal blue for icons in white containers */
    }

    /* Keep specific elements with appropriate colors */
    .branch-title {
        color: #2d3748 !important; /* Dark color for branch titles in white containers */
    }

    /* Organization details inside white containers should be dark */
    .organization-details p {
        color: #4a5568 !important; /* Dark grey for organization details in containers */
    }

    /* EXCEPTION: Chat History Header must stay white (gradient background) */
    .chat-history-header,
    .chat-history-header h3,
    .chat-history-header h3 i,
    .container .chat-history-header h3,
    .container .chat-history-header h3 i {
        color: white !important;
    }

    /* Organization Page Mobile Fixes */
    .organization-section {
        padding: 15px 10px;
        width: 100%;
        box-sizing: border-box;
    }

    .organization-container {
        width: 100%;
        max-width: 100%;
        padding: 0;
        box-sizing: border-box;
    }

    .organization-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .organization-actions {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }

    .organization-actions .btn {
        width: 100%;
        margin: 0;
    }

    /* Team Management Mobile */
    .team-management-section {
        width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    .invitations-section {
        width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    .modern-table-container {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        box-sizing: border-box;
    }

    .modern-invitations-table {
        min-width: 600px;
        width: 100%;
    }

    .members-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        width: 100%;
    }

    .member-card {
        width: 100%;
        box-sizing: border-box;
        padding: 15px;
    }

    /* Form Mobile Improvements */
    .invitation-form {
        width: 100%;
        box-sizing: border-box;
    }

    .form-row {
        flex-direction: column;
        gap: 15px;
    }

    .form-group {
        width: 100%;
        min-width: 100%;
        box-sizing: border-box;
    }

    .form-group input,
    .form-group select {
        width: 100%;
        box-sizing: border-box;
    }

    /* Chat Interface Mobile */
    .chat-container {
        height: calc(100vh - 80px);
        width: 100%;
        box-sizing: border-box;
    }

    .chat-input-container {
        padding: 15px;
        width: 100%;
        box-sizing: border-box;
    }

    .input-wrapper {
        flex-direction: row;
        gap: 8px;
        width: 100%;
        align-items: flex-end;
    }

    .text-input-area {
        flex: 1;
        order: 1;
    }

    .input-controls {
        order: 2;
        display: flex;
        gap: 6px;
        flex-shrink: 0;
    }

    .send-btn {
        order: 1;
        align-self: flex-end;
        width: 44px;
        height: 44px;
    }

    /* File Management Mobile */
    .file-tree {
        padding: 15px;
        width: 100%;
        box-sizing: border-box;
    }

    .category-folder {
        margin-bottom: 12px;
        width: 100%;
        box-sizing: border-box;
    }

    .folder-header {
        padding: 12px;
        font-size: 14px;
        flex-wrap: wrap;
    }

    .file-count {
        margin-left: auto;
        white-space: nowrap;
    }

    /* Upload Controls Mobile */
    .upload-controls {
        flex-direction: column;
        gap: 15px;
        width: 100%;
    }

    .upload-controls .form-group {
        min-width: 100%;
        width: 100%;
    }

    /* Integrations Mobile */
    .integrations-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        width: 100%;
    }

    .integration-card {
        padding: 20px;
        width: 100%;
        box-sizing: border-box;
    }

    /* Notifications Mobile */
    .notification {
        left: 10px;
        right: 10px;
        min-width: auto;
        max-width: calc(100vw - 20px);
        box-sizing: border-box;
    }

    /* Quick Actions Mobile */
    .quick-actions {
        flex-direction: column;
        gap: 8px;
        width: 100%;
    }

    .quick-action-btn {
        width: 100%;
        justify-content: flex-start;
        box-sizing: border-box;
    }

    /* Profile Mobile */
    .profile-overview-section {
        flex-direction: column;
        text-align: center;
        width: 100%;
        box-sizing: border-box;
    }

    .profile-form-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        width: 100%;
    }

    /* Tables Mobile Scrolling */
    .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        box-sizing: border-box;
    }

    /* Organization Mobile Specific Fixes */
    .organization-overview {
        padding: 15px;
        margin: 0;
        width: 100%;
        box-sizing: border-box;
    }

    .organization-details {
        flex-direction: column;
        gap: 15px;
        width: 100%;
    }

    .organization-info {
        width: 100%;
        text-align: center;
    }

    .organization-stats {
        width: 100%;
        justify-content: center;
    }

    .stat-item {
        flex: 1;
        min-width: 80px;
        text-align: center;
    }

    /* Member Management Mobile */
    .member-management-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .member-actions {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }

    .member-actions .btn {
        width: 100%;
    }

    /* Role Badges Mobile */
    .role-badges {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    .role-badge {
        font-size: 11px;
        padding: 4px 8px;
    }

    /* Invitation Form Mobile */
    .invitation-form-container {
        width: 100%;
        padding: 15px;
        box-sizing: border-box;
    }

    .invitation-form .form-row {
        flex-direction: column;
        gap: 15px;
    }

    .invitation-form .form-group {
        width: 100%;
    }

    .invitation-form input,
    .invitation-form select {
        width: 100%;
        box-sizing: border-box;
    }

    /* Fixed width columns that cause overflow */
    .select-column,
    .organization-column,
    .inviter-column,
    .role-column,
    .date-column,
    .status-column,
    .actions-column {
        width: auto !important;
        min-width: 80px;
        flex: 1;
    }

    .quick-action-btn {
        font-size: 12px;
        padding: 6px 10px;
    }
    .chat-actions {
        gap: 4px;
    }

    .action-btn {
        padding: 6px 8px;
    }
    
    /* Chat Overlay Mobile Styles */
    .chat-overlay-container {
        padding: 0;
    }
    
    .chat-overlay .chat-interface-modern {
        border-radius: 0;
        width: 100%;
        height: 100%;
    }

    /* Business Intelligence Layout Mobile */
    .bi-layout {
        grid-template-columns: 1fr;
        gap: 20px;
        display: flex;
        flex-direction: column-reverse;
        max-height: none !important; /* Allow page scrolling on mobile */
        overflow: visible !important;
        height: auto !important;
    }

    .chat-history-panel {
        max-height: 350px;
        height: auto !important;
        flex-shrink: 0;
    }
    
    .new-chat-panel {
        height: auto !important;
        min-height: 300px;
        flex-shrink: 0;
    }
}

/* Small Laptop Screens (height-based) */
@media (max-height: 800px) and (min-width: 769px) {
    .section {
        padding: 20px;
    }
    
    .bi-layout {
        margin-top: 15px;
        gap: 20px;
        max-height: calc(100vh - 120px);
        max-height: calc(100dvh - 120px);
    }
    
    .chat-history-panel {
        height: min(500px, calc(100vh - 150px));
        height: min(500px, calc(100dvh - 150px));
    }
}

@media (max-width: 768px) {
    .new-chat-panel {
        padding: 30px 20px;
    }

    .chat-trigger-icon {
        font-size: 50px;
    }

    .chat-trigger-content h2 {
        font-size: 1.5rem;
    }

    .chat-trigger-btn {
        padding: 12px 25px;
        font-size: 1rem;
    }
    
    /* Show View Saved Chats button on mobile */
    .mobile-saved-chats-btn {
        display: flex !important;
        margin-top: 12px;
    }
    
    /* Hide the desktop Saved Chats panel on mobile - use visibility to keep data loaded */
    .chat-history-panel {
        position: absolute !important;
        left: -9999px !important;
        visibility: hidden !important;
    }
    
    /* Make new-chat-panel full width on mobile */
    .bi-layout {
        grid-template-columns: 1fr !important;
    }
    
    /* Align buttons to left on mobile */
    .chat-trigger-content {
        text-align: left !important;
    }
    
    /* Align header to left on mobile */
    .chat-trigger-header {
        justify-content: flex-start !important;
    }
    
    /* Make both buttons full width and aligned */
    .chat-trigger-content .chat-trigger-btn {
        width: 100%;
        justify-content: center;
    }

    /* Save Chat Button Mobile */
    .save-chat-btn {
        padding: 10px 25px;
        font-size: 0.95rem;
    }

    /* Business Agents Mobile */
    .agents-filter-bar {
        padding: 15px;
    }

    .filter-top-row {
        flex-direction: column;
        gap: 12px;
        margin-bottom: 15px;
        padding-bottom: 12px;
    }

    .search-wrapper {
        width: 100%;
        min-width: 100%;
    }

    .filter-controls {
        width: 100%;
        flex-direction: column;
        gap: 10px;
    }

    .status-filters {
        width: 100%;
        justify-content: space-between;
    }

    .filter-pill.status-pill {
        flex: 1;
        justify-content: center;
        font-size: 0.8rem;
        padding: 8px 10px;
    }

    .reset-filters-btn {
        width: 100%;
        padding: 10px;
    }

    .category-table {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .category-column {
        padding: 10px;
    }

    .category-header {
        font-size: 0.85rem;
        padding: 8px 10px;
    }

    .category-item {
        font-size: 0.8rem;
        padding: 6px 8px;
    }

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

    .agent-card {
        padding: 15px;
    }

    .agent-category {
        font-size: 0.8rem;
        flex-wrap: wrap;
    }

    .category-separator {
        font-size: 0.65rem;
    }

    .agents-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .agents-display-area {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .category-table {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 70px 10px 15px;
    }

    h1 {
        font-size: 1.5rem;
    }

    /* Chat Trigger Mobile */
    .chat-trigger-content {
        margin: 30px auto;
        padding: 15px;
    }

    .chat-trigger-icon {
        font-size: 50px;
    }

    .chat-trigger-content h1 {
        font-size: 1.8rem;
    }

    .chat-trigger-description {
        font-size: 1rem;
    }

    .chat-trigger-btn {
        padding: 12px 25px;
        font-size: 1rem;
    }

    .section {
        padding: 10px;
    }

    .upload-controls {
        flex-direction: column;
        gap: 12px;
    }

    .upload-btn {
        width: 100%;
        margin-top: 10px;
    }

    .content-upload-area {
        padding: 15px 10px;
    }

    .file-structure-section {
        padding: 15px 10px;
    }

    .knowledge-tree-container {
        padding: 15px 10px;
    }

    .integration-item {
        padding: 20px 15px;
    }

    .chat-messages-modern {
        padding: 15px;
    }

    .chat-input-container {
        padding: 12px 15px;
    }

    .input-wrapper {
        gap: 8px;
    }

    .welcome-message .message-content {
        max-width: 90%;
        padding: 12px 15px;
    }

    .message-content {
        max-width: 90%;
    }

    .user-content,
    .ai-content {
        padding: 10px 14px;
    }

    .file-item {
        padding: 8px 12px;
    }

    .folder-header {
        padding: 10px 12px;
    }
}

/* Small Mobile Screens */
@media (max-width: 360px) {
    .main-content {
        padding: 70px 5px 10px;
    }

    .section {
        padding: 8px;
    }

    /* Business Intelligence page mobile styling */
    #interactnow-section h1 {
        display: block;
        font-size: 1.5rem;
    }

    /* Chat Trigger Very Small Mobile */
    .chat-trigger-content {
        margin: 20px auto;
        padding: 10px;
    }

    .chat-trigger-icon {
        font-size: 40px;
    }

    .chat-trigger-content h1 {
        font-size: 1.5rem;
    }

    .chat-trigger-description {
        font-size: 0.9rem;
    }

    .chat-trigger-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .upload-drop-zone {
        padding: 15px 10px;
    }

    .drop-zone-icon {
        font-size: 36px;
    }

    .drop-zone-text {
        font-size: 14px;
    }

    .drop-zone-formats {
        font-size: 12px;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    body {
        background: #1a202c;
        color: #e2e8f0;
    }

    .main-content {
        background: #1a202c;
    }

    .section {
        background: #1a202c;
    }

    /* Add more dark mode styles as needed */

}

/* Enhanced form styling using existing classes - Add at the end */

/* Make input fields more rounded and modern */
.category-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 12px; /* More rounded */
    font-size: 14px;
    background: white;
    color: #4a5568;
    outline: none;
    transition: all 0.3s ease; /* Smoother transition */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05); /* Subtle shadow */
}

.category-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Searchable dropdown styles for profile section */
.searchable-dropdown {
    position: relative;
}

.searchable-dropdown input {
    cursor: pointer;
    padding-right: 40px; /* Make space for arrow icon */
}

.dropdown-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.dropdown-list.show {
    display: block;
}

.dropdown-item {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 14px;
    color: #4a5568;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f7fafc;
}

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

.dropdown-item:hover {
    background-color: #f7fafc;
}

.dropdown-item.highlighted {
    background-color: #667eea;
    color: white;
}

.dropdown-item.no-results {
    color: #a0aec0;
    cursor: default;
    font-style: italic;
}

.dropdown-item.no-results:hover {
    background-color: white;
}

.dropdown-arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #a0aec0;
    pointer-events: none;
    transition: transform 0.2s ease;
}

.searchable-dropdown.open .dropdown-arrow {
    transform: translateY(-50%) rotate(180deg);
}

/* Logout Button Styles */
.logout-btn {
    background: #ef4444 !important;
    color: white !important;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logout-btn:hover:not(:disabled) {
    background: #dc2626 !important;
    transform: translateY(-1px);
}

.logout-btn:disabled {
    background: #9ca3af !important;
    cursor: not-allowed;
    transform: none;
}

.action-item.danger {
    border-left: 3px solid #ef4444;
    padding-left: 16px;
}

/* ====================================
   USER DATA & ACCOUNT SECTION STYLES
   ==================================== */

/* Account Form Styles */
.account-form .form-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.account-form .form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #4a5568;
    font-size: 14px;
}

.account-form input[type="text"],
.account-form input[type="email"],
.account-form input[type="tel"],
.account-form input[type="url"],
.account-form select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background-color: #ffffff;
}

.account-form input:focus,
.account-form select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Verification Badges */
.verification-badge {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    z-index: 10;
}

.verification-badge.verified {
    background: #d4f6d4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.verification-badge.verified i {
    color: #22c55e;
}

.verification-badge.unverified {
    background: #fecaca;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.verification-badge.unverified i {
    color: #ef4444;
}

/* Read-only Fields */
.readonly-field {
    background-color: #f8f9fa !important;
    cursor: not-allowed !important;
    color: #6b7280 !important;
}

.readonly-field:focus {
    box-shadow: none !important;
    border-color: #d1d5db !important;
}

/* Account Error Styling */
.account-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    text-align: center;
}

.account-error .error-message {
    color: #991b1b;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.account-error .error-message i {
    font-size: 24px;
    color: #ef4444;
}

.account-error .error-message p {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
}

.account-error .retry-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 auto;
}

.account-error .retry-btn:hover {
    background: #c82333;
}

/* Account Messages (Success/Error notifications) */
.account-message {
    padding: 14px 16px;
    border-radius: 8px;
    margin: 20px 0;
    border-left: 4px solid;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.account-message.success {
    background: #f0f9ff;
    border-color: #10b981;
    color: #065f46;
}

.account-message.error {
    background: #fef2f2;
    border-color: #ef4444;
    color: #991b1b;
}

.account-message .message-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.account-message .message-content i {
    font-size: 16px;
    flex-shrink: 0;
}

.account-message.success i {
    color: #10b981;
}

.account-message.error i {
    color: #ef4444;
}

.account-message .close-btn {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
}

.account-message .close-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* Profile Overview Enhancements */
.profile-overview-section {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    padding: 20px 0;
}

.profile-avatar-large {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #0e1369 0%, #06b8a0 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 32px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.profile-info-section {
    flex: 1;
}

.profile-detail {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}

.profile-detail:last-child {
    border-bottom: none;
}

.profile-label {
    font-weight: 600;
    color: #374151;
    min-width: 100px;
    margin-right: 16px;
}

.profile-value {
    color: #6b7280;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    flex: 1;
}

/* Form Layout Improvements */
.upload-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: end;
}

.upload-controls .form-group {
    flex: 1;
    min-width: 250px;
    position: relative;
}

/* Button Enhancements */
#update-account-btn {
    background: linear-gradient(135deg, #0e1369 0%, #06b8a0 100%);
    border: none;
    color: white;
    padding: 14px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    margin-top: 20px;
    min-height: 48px;
}

#update-account-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(14, 19, 105, 0.3);
}

#update-account-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

#update-account-btn:disabled:hover {
    box-shadow: none;
}

/* Loading States */
.fa-spinner {
    animation: spin 1s linear infinite;
}

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

/* API Key Container */
.api-key-container {
    position: relative;
    display: flex;
    align-items: center;
}

.api-key-container input {
    padding-right: 50px !important;
    font-family: monospace;
    font-size: 13px;
}

.api-key-container .input-action-btn {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.2s ease;
}

.api-key-container .input-action-btn:hover {
    color: #374151;
    background: #f3f4f6;
}

/* Responsive Improvements */
@media (max-width: 768px) {
    .profile-overview-section {
        flex-direction: column;
        text-align: center;
        gap: 16px;
    }

    .upload-controls {
        flex-direction: column;
        gap: 16px;
    }

    .upload-controls .form-group {
        min-width: 100%;
    }

    .profile-detail {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .profile-label {
        min-width: auto;
        margin-right: 0;
        font-size: 13px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .verification-badge {
        position: static;
        transform: none;
        margin-top: 8px;
        align-self: flex-start;
    }

    .account-form .form-group {
        margin-bottom: 1.25rem;
    }
}

/* Focus Improvements for Accessibility */
.account-form input:focus,
.account-form select:focus,
#update-account-btn:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Error State for Form Fields */
.form-group.error input,
.form-group.error select {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-group.error .verification-badge {
    display: none;
}

.field-error {
    color: #ef4444;
    font-size: 12px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.field-error i {
    font-size: 12px;
}

/* Success State for Form Fields */
.form-group.success input,
.form-group.success select {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Industry Select Styling */
#user-industry {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    appearance: none;
    cursor: pointer;
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    .account-form input,
    .account-form select {
        background-color: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }

    .readonly-field {
        background-color: #4b5563 !important;
        color: #9ca3af !important;
    }

    .verification-badge.verified {
        background: #064e3b;
        color: #6ee7b7;
        border-color: #047857;
    }

    .verification-badge.unverified {
        background: #7f1d1d;
        color: #fca5a5;
        border-color: #dc2626;
    }
}

/* Profile Form Styles */
.profile-form-container {
    margin-top: 20px;
}

.profile-form-grid {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 15px !important;
    margin-bottom: 30px;
    width: 100% !important;
}

.profile-form-grid .form-group {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 calc(50% - 7.5px) !important;
    min-width: calc(50% - 7.5px) !important;
    max-width: calc(50% - 7.5px) !important;
}

.profile-form-grid .form-group label {
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
    font-size: 13px;
}

.profile-form-grid .category-select {
    padding: 10px 12px;
    font-size: 13px;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

/* Clean styling for form groups */
.profile-form-grid .form-group {
    background: transparent !important;
    border: none !important;
    margin: 0 !important;
}

.profile-form-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

/* Responsive Design for Profile Form */
@media (max-width: 768px) {
    .profile-form-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .profile-form-actions {
        justify-content: stretch;
    }
    
    .profile-form-actions .upload-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Security Settings Section */
.security-options {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.security-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid #f0f0f0;
}

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

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

.security-title {
    font-size: 14px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 2px;
}

.security-description {
    font-size: 13px;
    color: #718096;
}

.security-action-btn {
    width: 160px;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

/* Sidebar Logout Button (inside Account sub-nav) */
.sidebar-logout-item {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 4px;
    padding-top: 4px;
}

.sidebar-logout-item button {
    color: rgba(255, 255, 255, 0.6) !important;
}

.sidebar-logout-item button:hover {
    color: #f87171 !important;
    background: rgba(248, 113, 113, 0.1) !important;
}

/* Multi-Select Invitation Styles */
.invitations-header {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.bulk-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.select-all-container {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
    color: #4a5568;
    user-select: none;
}

.checkbox-container {
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.checkbox-container input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    height: 18px;
    width: 18px;
    background-color: #fff;
    border: 2px solid #cbd5e0;
    border-radius: 4px;
    position: relative;
    transition: all 0.2s ease;
}

.checkbox-container:hover input ~ .checkmark {
    border-color: #4299e1;
    background-color: #ebf8ff;
}

.checkbox-container input:checked ~ .checkmark {
    background-color: #4299e1;
    border-color: #4299e1;
}

.checkbox-container input:indeterminate ~ .checkmark {
    background-color: #4299e1;
    border-color: #4299e1;
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container input:indeterminate ~ .checkmark:after {
    display: block;
    left: 6px;
    top: 2px;
    width: 4px;
    height: 10px;
    background: white;
}

.checkbox-container .checkmark:after {
    left: 5px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.delete-selected-btn {
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    font-size: 14px;
}

.delete-selected-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #c53030 0%, #9c2626 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(229, 62, 62, 0.3);
}

.delete-selected-btn:disabled {
    background: #a0aec0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.delete-selected-btn i {
    font-size: 14px;
}

/* Invitation Card Styles */
.invitations-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.invitation-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.invitation-card:hover {
    border-color: #cbd5e0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.invitation-checkbox {
    flex-shrink: 0;
    padding-top: 2px;
}

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

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

.invitation-header h5 {
    margin: 0;
    color: #2d3748;
    font-size: 16px;
    font-weight: 600;
}

.invitation-status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.status-active {
    background-color: #c6f6d5;
    color: #22543d;
}

.status-inactive {
    background-color: #fed7d7;
    color: #742a2a;
}

.invitation-details {
    color: #4a5568;
    font-size: 14px;
    line-height: 1.5;
}

.invitation-details p {
    margin: 4px 0;
}

.invitation-details strong {
    color: #2d3748;
}

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

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

.accept-invitation-btn {
    background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.accept-invitation-btn:hover {
    background: linear-gradient(135deg, #2f855a 0%, #276749 100%);
    transform: translateY(-1px);
}

.decline-invitation-btn {
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.decline-invitation-btn:hover {
    background: linear-gradient(135deg, #c53030 0%, #9c2626 100%);
    transform: translateY(-1px);
}

.request-access-btn {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.request-access-btn:hover {
    background: linear-gradient(135deg, #3182ce 0%, #2c5282 100%);
    transform: translateY(-1px);
}

.active-label, .pending-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: 4px;
}

.active-label {
    background-color: #c6f6d5;
    color: #22543d;
}

.pending-label {
    background-color: #fef5e7;
    color: #744210;
}

/* Empty State Styles */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #718096;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    color: #cbd5e0;
}

.empty-state p {
    margin: 8px 0;
    font-size: 16px;
}

.empty-subtitle {
    font-size: 14px !important;
    color: #a0aec0 !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .bulk-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .invitation-card {
        flex-direction: column;
        gap: 12px;
    }
    
    .invitation-checkbox {
        align-self: flex-start;
    }
    
    .invitation-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .invitation-actions {
        align-self: stretch;
        justify-content: center;
    }
}

/* Team Invitations Toggle Styles - Modern Design */
.invitations-table-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    margin-bottom: 24px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.invitations-header-with-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid #e2e8f0;
}

.invitations-header-with-toggle h4 {
    margin: 0;
    color: #1a202c;
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.invitations-header-with-toggle h4:before {
    content: "📊";
    font-size: 18px;
}

.toggle-invitations-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 3px 6px rgba(102, 126, 234, 0.25);
}

.toggle-invitations-btn:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.35);
}

.toggle-invitations-btn i {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.toggle-invitations-btn.expanded i {
    transform: rotate(180deg);
}

.invitations-table-hidden {
    display: none;
}

.invitations-table-visible {
    display: block;
    animation: modernSlideDown 0.4s ease-out;
}

#invitations-table-container {
    padding: 0;
    overflow-x: auto;
}

/* Apply modern table styling to original table content */
.invitations-table-section table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: white;
}

.invitations-table-section thead {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
}

.invitations-table-section th {
    padding: 16px 20px;
    text-align: left;
    font-weight: 600;
    color: #2d3748;
    border-bottom: 2px solid #e2e8f0;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.invitations-table-section td {
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.invitations-table-section tr {
    transition: all 0.2s ease;
}

.invitations-table-section tr:hover {
    background-color: #f8fafc;
}

.invitations-table-section tr:nth-child(even) {
    background-color: #fdfdfd;
}

.invitations-table-section tr:nth-child(even):hover {
    background-color: #f8fafc;
}

/* Responsive Design for Toggle */
@media (max-width: 768px) {
    .invitations-header-with-toggle {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        padding: 16px 20px;
    }
    
    .toggle-invitations-btn {
        justify-content: center;
    }
    
    .invitations-table-section th,
    .invitations-table-section td {
        padding: 12px 16px;
    }
}

/* Modern Invitations Table Styles */
.modern-invitations-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    margin-bottom: 24px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.modern-table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid #e2e8f0;
}

.table-title-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.table-title-section h4 {
    margin: 0;
    color: #1a202c;
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.table-title-section h4 i {
    color: #4299e1;
    font-size: 18px;
}

.table-subtitle {
    color: #64748b;
    font-size: 14px;
    font-weight: 400;
}

.modern-toggle-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 3px 6px rgba(102, 126, 234, 0.25);
}

.modern-toggle-btn:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.35);
}

.modern-toggle-btn i {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.modern-toggle-btn.expanded i {
    transform: rotate(180deg);
}

.modern-table-hidden {
    display: none;
}

.modern-table-visible {
    display: block;
    animation: modernSlideDown 0.4s ease-out;
}

@keyframes modernSlideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modern-table-container {
    padding: 0;
    overflow-x: auto;
}

.modern-invitations-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: white;
}

.modern-invitations-table thead {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
}

.modern-invitations-table th {
    padding: 16px 20px;
    text-align: left;
    font-weight: 600;
    color: #2d3748;
    border-bottom: 2px solid #e2e8f0;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modern-invitations-table td {
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.modern-table-row {
    transition: all 0.2s ease;
}

.modern-table-row:hover {
    background-color: #f8fafc;
}

.modern-table-row:nth-child(even) {
    background-color: #fdfdfd;
}

.modern-table-row:nth-child(even):hover {
    background-color: #f8fafc;
}

/* Column Specific Styles */
.select-column {
    width: 50px;
    text-align: center;
}

.organization-column {
    width: 200px;
}

.inviter-column {
    width: 180px;
}

.role-column {
    width: 120px;
}

.date-column {
    width: 120px;
}

.status-column {
    width: 100px;
}

.actions-column {
    width: 140px;
    text-align: center;
}

/* Modern Checkbox Styles */
.modern-checkbox-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
}

.modern-checkbox-container input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.modern-checkmark {
    height: 20px;
    width: 20px;
    background-color: #fff;
    border: 2px solid #cbd5e0;
    border-radius: 6px;
    position: relative;
    transition: all 0.2s ease;
}

.modern-checkbox-container:hover input ~ .modern-checkmark {
    border-color: #667eea;
    background-color: #f7faff;
}

.modern-checkbox-container input:checked ~ .modern-checkmark {
    background-color: #667eea;
    border-color: #667eea;
}

.modern-checkbox-container input:indeterminate ~ .modern-checkmark {
    background-color: #667eea;
    border-color: #667eea;
}

.modern-checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.modern-checkbox-container input:checked ~ .modern-checkmark:after {
    display: block;
}

.modern-checkbox-container input:indeterminate ~ .modern-checkmark:after {
    display: block;
    left: 7px;
    top: 3px;
    width: 4px;
    height: 10px;
    background: white;
}

.modern-checkbox-container .modern-checkmark:after {
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Cell Content Styles */
.org-info, .inviter-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.org-info i {
    color: #4299e1;
    font-size: 16px;
}

.inviter-info i {
    color: #48bb78;
    font-size: 14px;
}


.date-text {
    color: #64748b;
    font-size: 13px;
    font-weight: 500;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.status-active {
    background: linear-gradient(135deg, #c6f6d5 0%, #9ae6b4 100%);
    color: #22543d;
}

.status-badge.status-inactive {
    background: linear-gradient(135deg, #fed7d7 0%, #feb2b2 100%);
    color: #742a2a;
}

/* Table Actions */
.table-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.table-action-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 12px;
}

.accept-btn {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.accept-btn:hover {
    background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
    transform: translateY(-1px);
}

.decline-btn {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
    color: white;
}

.decline-btn:hover {
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
    transform: translateY(-1px);
}

.active-member {
    color: #38a169;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Modern Table Actions Bar */
.modern-table-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

.modern-delete-btn {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    font-size: 14px;
}

.modern-delete-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(245, 101, 101, 0.3);
}

.modern-delete-btn:disabled {
    background: #a0aec0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.table-info {
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
}

/* Empty State */
.empty-table-state {
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
}

.empty-table-state i {
    font-size: 48px;
    margin-bottom: 16px;
    color: #cbd5e0;
}

.empty-table-state p {
    margin: 8px 0 4px 0;
    font-size: 18px;
    font-weight: 600;
    color: #4a5568;
}

.empty-table-state span {
    font-size: 14px;
    color: #a0aec0;
}

/* Loading State */
.loading-table-state {
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
}

.loading-table-state i {
    font-size: 32px;
    margin-bottom: 16px;
    color: #667eea;
}

.loading-table-state p {
    margin: 8px 0 4px 0;
    font-size: 16px;
    font-weight: 500;
    color: #4a5568;
}

/* Error State */
.error-table-state {
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
}

.error-table-state i {
    font-size: 48px;
    margin-bottom: 16px;
    color: #f56565;
}

.error-table-state p {
    margin: 8px 0 4px 0;
    font-size: 18px;
    font-weight: 600;
    color: #e53e3e;
}

.error-table-state span {
    font-size: 14px;
    color: #a0aec0;
    margin-bottom: 16px;
    display: block;
}

.retry-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    font-size: 14px;
    margin-top: 12px;
}

.retry-btn:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}


/* Responsive Design for Modern Table */
@media (max-width: 1024px) {
    .modern-table-container {
        overflow-x: scroll;
    }
    
    .modern-invitations-table {
        min-width: 800px;
    }
    
    .members-grid {
        grid-template-columns: 1fr;
    }
    
    .creator-header, .member-header {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
    
    .creator-status, .member-status {
        text-align: center;
    }
}

@media (max-width: 768px) {
    .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .dataset-bubbles {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .modern-table-header {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        padding: 16px 20px;
    }
    
    .modern-toggle-btn {
        justify-content: center;
    }
    
    .modern-invitations-table th,
    .modern-invitations-table td {
        padding: 12px 16px;
    }
    
    .modern-table-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 16px 20px;
    }
    
    .modern-delete-btn {
        justify-content: center;
    }
}

/* Team Members Tree Styles */
.members-tree {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.member-node {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.member-node.creator-node {
    background: linear-gradient(135deg, #fef7e0 0%, #fef3c7 100%);
    border: 2px solid #f59e0b;
}

/* Member Info Grid - Two Column Layout */
.member-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.member-left-column {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.member-right-column {
    display: flex;
    align-items: flex-start;
    padding-left: 20px;
    border-left: 2px solid #e5e7eb;
}

.member-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    flex-shrink: 0;
}

.member-avatar.creator-avatar {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.member-primary-info {
    flex: 1;
    min-width: 0;
}

/* Legacy support - keep for backward compatibility */
.member-info {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.member-details {
    flex: 1;
    min-width: 0;
}

.member-name {
    font-size: 16px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.creator-badge {
    background: #10b981;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.member-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.member-role, .member-status, .role-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.member-role {
    background: #d1fae5;
    color: #065f46;
}

.member-status.active, .member-role.active {
    background: #d1fae5;
    color: #065f46;
}

.member-role.deactive {
    background: #fee2e2;
    color: #dc2626;
}

.member-role.active:hover {
    background: #bbf7d0;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.member-role.deactive:hover {
    background: #fecaca;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.member-status.pending {
    background: #fef3c7;
    color: #92400e;
}

.member-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.edit-btn-small, .remove-btn-small {
    background: none;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.edit-btn-small {
    color: #059669;
    border-color: #059669;
}

.edit-btn-small:hover {
    background: #059669;
    color: white;
}

.remove-btn-small {
    color: #dc2626;
    border-color: #dc2626;
}

.remove-btn-small:hover {
    background: #dc2626;
    color: white;
}

.creator-label, .member-label {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    background: #f3f4f6;
    color: #6b7280;
}

.creator-label {
    background: #fbbf24;
    color: #92400e;
}

.member-roles {
    width: 100%;
    font-size: 14px;
    color: #6b7280;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.member-roles strong {
    color: #374151;
    margin-right: 4px;
}

.role-badge {
    background: #d1fae5;
    color: #065f46;
}

.no-roles {
    font-style: italic;
    color: #9ca3af;
}

/* Bedrock RAG - Sources styling */
.message-sources {
    margin-top: 12px;
    padding: 10px;
    background: #f8f9fa;
    border-left: 3px solid #06b8a0;
    border-radius: 4px;
    font-size: 12px;
}

.sources-header {
    font-weight: 600;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
    padding: 4px 0;
    transition: all 0.2s ease;
}

.sources-header:hover {
    color: #06b8a0;
}

.sources-header i.fa-file-alt {
    color: #06b8a0;
}

.sources-toggle {
    margin-left: auto;
    font-size: 10px;
    transition: transform 0.3s ease;
    color: #6c757d;
}

.message-sources.expanded .sources-toggle {
    transform: rotate(180deg);
}

.sources-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, margin-top 0.3s ease;
    margin-top: 0;
}

.message-sources.expanded .sources-list {
    max-height: 500px;
    margin-top: 8px;
}

.source-item {
    padding: 6px 8px;
    margin: 4px 0;
    background: white;
    border-radius: 3px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #6c757d;
    cursor: help;
    transition: all 0.2s ease;
}

.source-item:hover {
    background: #e9ecef;
    color: #495057;
}

.source-item i {
    color: #06b8a0;
    font-size: 10px;
}

.relevance-score {
    margin-left: auto;
    font-weight: 600;
    color: #06b8a0;
}

/* Typewriter effect cursor */
.message-text[data-typing="true"]::after {
    content: '▋';
    animation: blink 1s step-end infinite;
    color: #06b8a0;
    margin-left: 2px;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* ============================================
   AI CHAT POPUP STYLES (DEMO)
   Widescreen overlay with brand colors
   ============================================ */

/* Demo Chat Overlay */
.demo-chat-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 10000;
    padding: 20px;
}

.demo-chat-overlay-open {
    opacity: 1;
    pointer-events: all;
}

/* Demo Chat Container */
.demo-chat-container {
    position: relative;
    width: 100%;
    max-width: 1200px;
    height: 85vh;
    max-height: 800px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.demo-chat-overlay-open .demo-chat-container {
    transform: scale(1);
}

/* Mobile Full Screen */
@media (max-width: 768px) {
    .demo-chat-overlay {
        padding: 0;
    }
    
    .demo-chat-container {
        width: 100%;
        height: 100vh;
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
}

/* Demo Chat Header */
.demo-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 32px;
    background: linear-gradient(135deg, #0e1369 0%, #06b8a0 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.demo-chat-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.demo-chat-avatar {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
}

.demo-chat-agent-name {
    font-size: 18px;
    font-weight: 600;
    color: white;
}

.demo-chat-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 4px;
}

.demo-chat-status-dot {
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.demo-chat-close-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 18px;
}

.demo-chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Demo Chat Messages Area */
.demo-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: #f8fafc;
}

/* Custom Scrollbar */
.demo-chat-messages::-webkit-scrollbar {
    width: 8px;
}

.demo-chat-messages::-webkit-scrollbar-track {
    background: #e2e8f0;
}

.demo-chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.demo-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Message Container */
.demo-chat-message {
    display: flex;
    gap: 12px;
    animation: fadeInUp 0.3s ease;
}

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

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

.demo-chat-message-ai {
    justify-content: flex-start;
}

/* AI Avatar in Messages */
.demo-chat-ai-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    background: linear-gradient(135deg, #0e1369 0%, #06b8a0 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
}

/* Message Bubbles */
.demo-chat-message-bubble {
    padding: 14px 18px;
    border-radius: 18px;
    max-width: 70%;
    word-wrap: break-word;
    line-height: 1.6;
    font-size: 15px;
}

.demo-chat-message-bubble-user {
    background: linear-gradient(135deg, #0e1369 0%, #06b8a0 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.demo-chat-message-bubble-ai {
    background: white;
    color: #1e293b;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Typing Indicator */
.demo-chat-typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 14px 18px;
    background: white;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.demo-chat-typing-indicator span {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typing-bounce 1.4s ease-in-out infinite;
}

.demo-chat-typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.demo-chat-typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing-bounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-8px);
    }
}

/* Suggested Prompts */
.demo-chat-suggested-prompts {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.demo-chat-suggested-prompt-btn {
    padding: 10px 18px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 24px;
    color: #475569;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.demo-chat-suggested-prompt-btn:hover {
    background: linear-gradient(135deg, #0e1369 0%, #06b8a0 100%);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(6, 184, 160, 0.3);
}

/* Demo Chat Footer */
.demo-chat-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px 32px;
    background: white;
    border-top: 1px solid #e2e8f0;
}

.demo-chat-input {
    flex: 1;
    padding: 14px 20px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    color: #1e293b;
    font-size: 15px;
    outline: none;
    transition: all 0.2s ease;
}

.demo-chat-input::placeholder {
    color: #94a3b8;
}

.demo-chat-input:focus {
    border-color: #06b8a0;
    background: white;
}

.demo-chat-send-btn {
    width: 50px;
    height: 50px;
    min-width: 50px;
    background: linear-gradient(135deg, #0e1369 0%, #06b8a0 100%);
    border: none;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 18px;
}

.demo-chat-send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(6, 184, 160, 0.4);
}

.demo-chat-send-btn:active {
    transform: translateY(0);
}

/* Resize Handle (Desktop Only) */
.demo-chat-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #0e1369 0%, #06b8a0 100%);
    border-top-left-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: nwse-resize;
    font-size: 12px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.demo-chat-resize-handle:hover {
    opacity: 1;
}

/* Hide resize handle on mobile */
@media (max-width: 768px) {
    .demo-chat-resize-handle {
        display: none;
    }
}

/* User select none during drag/resize */
.demo-chat-header {
    user-select: none;
}

/* ============================================
   MODERN CHAT POPUP (PRODUCTION)
   Widescreen overlay with Bedrock RAG integration
   ============================================ */

/* Modern Chat Overlay */
.modern-chat-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 10000;
    padding: 20px;
}

.modern-chat-overlay-open {
    opacity: 1;
    pointer-events: all;
}

/* Modern Chat Container */
.modern-chat-container {
    position: relative;
    width: 100%;
    max-width: 1200px;
    height: 85vh;
    max-height: min(800px, calc(100vh - 40px));
    background: white;
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    overflow: clip;
}

.modern-chat-overlay-open .modern-chat-container {
    transform: scale(1);
}

/* Tablet/Small Laptop - Adjust for smaller screens */
@media (max-height: 900px) {
    .modern-chat-container {
        height: 90vh;
        max-height: calc(100vh - 40px);
    }
}

/* Very Small Screens (height) */
@media (max-height: 700px) {
    .modern-chat-container {
        height: 95vh;
        max-height: calc(100vh - 20px);
    }
}

/* Mobile Full Screen */
@media (max-width: 768px) {
    .modern-chat-overlay {
        padding: 0;
        height: 100vh;
        height: 100dvh;
    }
    
    .modern-chat-container {
        width: 100%;
        height: 100vh;
        height: 100dvh;
        max-width: 100%;
        max-height: 100vh;
        max-height: 100dvh;
        border-radius: 0;
    }
}

/* Modern Chat Header */
.modern-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 32px;
    background: linear-gradient(135deg, #0e1369 0%, #06b8a0 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    user-select: none;
    flex-shrink: 0;
}

.modern-chat-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.modern-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.modern-chat-avatar {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
}

.modern-chat-agent-name {
    font-size: 18px;
    font-weight: 600;
    color: white;
}

.modern-chat-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 4px;
}

.modern-chat-status-dot {
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    animation: pulse-dot 2s ease-in-out infinite;
}

.modern-chat-action-btn {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.modern-chat-action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modern-chat-close-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 18px;
}

.modern-chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Minimized Chat Bubble */
.chat-minimized-bubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #0e1369 0%, #06b8a0 100%);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9999;
    box-shadow: 0 4px 20px rgba(14, 19, 105, 0.4);
    transform: scale(0);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
    user-select: none;
}

.chat-minimized-bubble-visible {
    transform: scale(1);
}

.chat-minimized-bubble:hover {
    box-shadow: 0 6px 28px rgba(14, 19, 105, 0.55);
    transform: scale(1.08);
}

.chat-minimized-bubble:active {
    transform: scale(0.95);
}

.chat-minimized-bubble-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-minimized-bubble-label {
    font-size: 9px;
    font-weight: 600;
    color: white;
    margin-top: 1px;
    letter-spacing: 0.3px;
}

/* Pulse ring animation on minimized bubble */
.chat-minimized-bubble::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(6, 184, 160, 0.5);
    animation: minimized-pulse 2s ease-in-out infinite;
}

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

@media (max-width: 768px) {
    .chat-minimized-bubble {
        bottom: 16px;
        right: 16px;
        width: 52px;
        height: 52px;
    }
}

/* Modern Chat Messages Area */
.modern-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: #f8fafc;
}

/* Custom Scrollbar */
.modern-chat-messages::-webkit-scrollbar {
    width: 14px;
}

.modern-chat-messages::-webkit-scrollbar-track {
    background: #e9ecf1;
    border-radius: 7px;
}

.modern-chat-messages::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 7px;
    border: 2px solid #e9ecf1;
}

.modern-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

.modern-chat-messages::-webkit-scrollbar-button:single-button {
    display: block;
    height: 16px;
    width: 14px;
    background-color: #e2e8f0;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 8px;
}

.modern-chat-messages::-webkit-scrollbar-button:single-button:hover {
    background-color: #cbd5e1;
}

/* Up arrow */
.modern-chat-messages::-webkit-scrollbar-button:single-button:vertical:decrement {
    border-radius: 7px 7px 0 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 5l4-4 4 4' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Down arrow */
.modern-chat-messages::-webkit-scrollbar-button:single-button:vertical:increment {
    border-radius: 0 0 7px 7px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Firefox scrollbar */
.modern-chat-messages {
    scrollbar-width: auto;
    scrollbar-color: #94a3b8 #e9ecf1;
}

/* Welcome Message */
.modern-chat-welcome {
    display: flex;
    gap: 12px;
    animation: fadeInUp 0.3s ease;
}

/* Message Container */
.modern-chat-message {
    display: flex;
    gap: 12px;
    animation: fadeInUp 0.3s ease;
}

.modern-chat-message-user {
    justify-content: flex-end;
    align-items: flex-start;
    gap: 10px;
}

.modern-chat-message-ai {
    justify-content: flex-start;
    flex-direction: column;
    align-items: flex-start;
}

/* AI Avatar in Messages */
.modern-chat-ai-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    background: linear-gradient(135deg, #0e1369 0%, #06b8a0 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
}

/* AI Message Header (Avatar + Typing Indicator) */
.modern-chat-ai-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Message Bubbles */
.modern-chat-message-bubble {
    padding: 14px 18px;
    border-radius: 18px;
    max-width: 70%;
    word-wrap: break-word;
    line-height: 1.6;
    font-size: 15px;
}

.modern-chat-message-bubble-user {
    background: linear-gradient(135deg, #0e1369 0%, #06b8a0 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.modern-chat-message-bubble-ai {
    background: white;
    color: #1e293b;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    max-width: calc(100% - 48px);
    overflow: hidden;
    margin-left: 48px;
}

.modern-chat-message-bubble-ai.error {
    background: #fee2e2;
    color: #991b1b;
}

/* Chat response content inside bubble - add generous padding */
.modern-chat-message-bubble-ai .chat-response-content {
    padding: 8px 16px;
    margin: 0;
}

/* Adjust list positioning inside chat bubbles */
.modern-chat-message-bubble-ai .chat-response-content ul,
.modern-chat-message-bubble-ai .chat-response-content ol {
    margin-left: 8px;
    padding-left: 40px;
}

/* CRITICAL: Reset counter at the RESPONSE level, not per-ol */
/* This ensures numbering continues across multiple ol elements created by markdown parser */
.modern-chat-message-bubble-ai .chat-response-content {
    counter-reset: ordered-list-counter;
}

/* Use CSS counter for ordered lists to maintain sequence across broken ol elements */
.modern-chat-message-bubble-ai .chat-response-content ol {
    list-style: none;
}

.modern-chat-message-bubble-ai .chat-response-content ol > li {
    counter-increment: ordered-list-counter;
    position: relative;
}

.modern-chat-message-bubble-ai .chat-response-content ol > li::before {
    content: counter(ordered-list-counter) ".";
    position: absolute;
    left: -30px;
    font-weight: 600;
    color: #374151;
}

.modern-chat-message-bubble-ai .chat-response-content ul {
    list-style: none;
}

.modern-chat-message-bubble-ai .chat-response-content ul li {
    padding-left: 28px;
    margin: 2px 0;
    line-height: 1.4;
    position: relative;
}

.modern-chat-message-bubble-ai .chat-response-content ul li::before {
    content: "•";
    position: absolute;
    left: 8px;
    color: #0e1369;
    font-weight: bold;
    font-size: 1.2em;
}

.modern-chat-message-bubble-ai .chat-response-content ol li {
    padding-left: 8px;
    margin: 2px 0;
    line-height: 1.4;
}

/* Green numbered circles ONLY for Action Plan */
.modern-chat-message-bubble-ai .chat-response-content .action-plan-section ol {
    list-style: none;
    counter-reset: item;
    padding-left: 0;
}

.modern-chat-message-bubble-ai .chat-response-content .action-plan-section ol li {
    padding-left: 38px;
    counter-increment: item;
}

.modern-chat-message-bubble-ai .chat-response-content .action-plan-section ol li::before {
    content: counter(item);
    position: absolute;
    left: 0;
    top: 0;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #06b8a0 0%, #059669 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    line-height: 24px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.modern-chat-message-bubble-ai .chat-response-content ol li::before {
    left: 0;
}

/* Add padding to paragraphs and headings inside bubble */
.modern-chat-message-bubble-ai .chat-response-content p,
.modern-chat-message-bubble-ai .chat-response-content h1,
.modern-chat-message-bubble-ai .chat-response-content h2,
.modern-chat-message-bubble-ai .chat-response-content h3,
.modern-chat-message-bubble-ai .chat-response-content h4 {
    padding-left: 0;
    padding-right: 0;
}

/* Code blocks need padding adjustment */
.modern-chat-message-bubble-ai .chat-response-content pre {
    margin-left: 0;
    margin-right: 0;
}

/* Blockquotes need padding adjustment */
.modern-chat-message-bubble-ai .chat-response-content blockquote {
    margin-left: 0;
    margin-right: 0;
}

/* Intellisea Pro Tips Box - Tan styled container */
.intellisea-pro-tips-box {
    background: linear-gradient(135deg, #faf8f5 0%, #f5f1eb 100%);
    border: 2px solid #06b8a0;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 2px 8px rgba(6, 184, 160, 0.15);
}

.intellisea-pro-tips-box strong {
    color: #8b5a2b;
    font-size: 16px;
}

.intellisea-pro-tips-box ul {
    margin-top: 12px;
    margin-bottom: 12px;
}

.intellisea-pro-tips-box li {
    color: #5a3d1f;
    margin-bottom: 8px;
}

.intellisea-pro-tips-box p {
    color: #5a3d1f;
    margin: 8px 0;
}

/* Sources */
.modern-chat-sources {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
    font-size: 13px;
}

.modern-chat-sources ul {
    margin: 8px 0 0 0;
    padding-left: 20px;
}

.modern-chat-sources li {
    margin: 4px 0;
    color: #64748b;
}

/* Typing Indicator */
.modern-chat-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: rgba(148, 163, 184, 0.1);
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.modern-chat-typing-indicator span {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typing-bounce 1.4s ease-in-out infinite;
}

.modern-chat-typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.modern-chat-typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

/* Suggested Prompts - Amazon Rufus Style */
.modern-chat-suggested-prompts {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    margin: 16px 12px 12px 12px;
    padding: 0;
    background: transparent;
}

.modern-chat-suggested-prompt-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px 6px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    color: #2c3e50;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
    isolation: isolate;
    white-space: nowrap;
}

.modern-chat-suggested-prompt-btn i {
    font-size: 12px;
    color: #06b8a0;
    flex-shrink: 0;
    transition: all 0.25s ease;
    position: relative;
    z-index: 1;
}

.modern-chat-suggested-prompt-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0e1369 0%, #06b8a0 100%);
    opacity: 0;
    transition: opacity 0.25s ease;
    z-index: -1;
}

.modern-chat-suggested-prompt-btn:hover {
    border-color: #06b8a0;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(6, 184, 160, 0.25);
    color: white !important;
}

.modern-chat-suggested-prompt-btn:hover::before {
    opacity: 1;
}

.modern-chat-suggested-prompt-btn:hover i {
    color: white !important;
}

.modern-chat-suggested-prompt-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(6, 184, 160, 0.2);
}

/* ================================================
   History Chat Bubbles - Comic Book Speech Bubble
   ================================================ */
.history-chat-bubble {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    padding: 16px 20px 14px 20px;
    min-width: 220px;
    max-width: 300px;
    background: linear-gradient(135deg, #e8f4fc 0%, #d6ebf9 100%);
    border: none;
    border-radius: 24px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.25s ease;
    box-shadow: 0 3px 12px rgba(59, 130, 246, 0.15);
    margin-bottom: 12px;
}

/* Comic book speech bubble tail (bottom-left) */
.history-chat-bubble::before {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 24px;
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 14px solid #d6ebf9;
    filter: drop-shadow(0 2px 2px rgba(59, 130, 246, 0.1));
}

/* Hide the old arrow div */
.history-chat-bubble .bubble-arrow {
    display: none;
}

.history-chat-bubble:hover {
    background: linear-gradient(135deg, #d6ebf9 0%, #c4e0f5 100%);
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 8px 28px rgba(59, 130, 246, 0.25);
}

.history-chat-bubble:hover::before {
    border-top-color: #c4e0f5;
}

/* Bubble title - 1-2 words, bold */
.history-chat-bubble .bubble-title {
    font-size: 14px;
    font-weight: 700;
    color: #0e1369;
    margin-bottom: 6px;
    line-height: 1.2;
}

/* Bubble context - longer description */
.history-chat-bubble .bubble-context {
    font-size: 13px;
    color: #475569;
    line-height: 1.4;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Bubble timestamp */
.history-chat-bubble .bubble-time {
    font-size: 11px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 4px;
}

.history-chat-bubble .bubble-time i {
    font-size: 10px;
}

/* Container for history bubbles */
#recent-topics-list {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 12px;
    padding-top: 8px;
}

/* Mobile responsive for history bubbles */
@media (max-width: 768px) {
    .history-chat-bubble {
        min-width: 180px;
        max-width: 100%;
        padding: 12px 14px 10px 14px;
    }
    
    .history-chat-bubble .bubble-title {
        font-size: 13px;
    }
    
    .history-chat-bubble .bubble-context {
        font-size: 12px;
    }
    
    #recent-topics-list {
        flex-direction: column;
        gap: 12px;
    }
}

/* Mobile responsive for suggested prompts */
@media (max-width: 768px) {
    .modern-chat-messages {
        padding: 16px 4px;
    }
    
    .modern-chat-message-ai {
        width: 100%;
        margin-right: 0;
        padding-right: 0;
    }
    
    .modern-chat-message-bubble-ai {
        max-width: calc(100% - 40px);
        margin-left: 40px;
        margin-right: 0;
        padding-right: 8px;
    }
    
    .modern-chat-message-bubble-ai .chat-response-content {
        padding: 8px 8px 8px 12px;
    }
    
    .modern-chat-suggested-prompts {
        grid-template-columns: 1fr;
        gap: 8px;
        margin: 12px 4px 10px 4px;
    }
    
    .modern-chat-suggested-prompt-btn {
        padding: 9px 12px;
        font-size: 12px;
    }
    
    .modern-chat-suggested-prompt-btn i {
        font-size: 13px;
    }
}

/* Modern Chat Footer */
.modern-chat-footer {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    padding: 24px 32px;
    background: white;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.modern-chat-input {
    flex: 1;
    padding: 14px 20px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    color: #1e293b;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: all 0.2s ease;
    resize: none;
    max-height: 150px;
    min-height: 50px;
}

.modern-chat-input::placeholder {
    color: #94a3b8;
}

.modern-chat-input:focus {
    border-color: #06b8a0;
    background: white;
}

.modern-chat-send-btn {
    width: 50px;
    height: 50px;
    min-width: 50px;
    background: linear-gradient(135deg, #0e1369 0%, #06b8a0 100%);
    border: none;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 18px;
}

.modern-chat-send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(6, 184, 160, 0.4);
}

.modern-chat-send-btn:active {
    transform: translateY(0);
}

/* Voice Input Mic Button */
.modern-chat-mic-btn {
    width: 50px;
    height: 50px;
    min-width: 50px;
    border-radius: 12px;
    border: none;
    background: transparent;
    color: #b0b8c4;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.modern-chat-mic-btn:hover {
    color: #06b8a0;
    background: #f1f5f9;
}

.modern-chat-mic-btn.connecting {
    color: #f59e0b;
    background: transparent;
    cursor: wait;
}

.modern-chat-mic-btn.recording {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.06);
    animation: mic-pulse 1.5s ease-in-out infinite;
}

.modern-chat-mic-btn.recording:hover {
    background: rgba(239, 68, 68, 0.1);
}

@keyframes mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3); }
    50% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
}

/* Prompt History Button */
.modern-chat-prompt-history-btn {
    width: 50px;
    height: 50px;
    min-width: 50px;
    border-radius: 12px;
    border: none;
    background: transparent;
    color: #b0b8c4;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.modern-chat-prompt-history-btn:hover {
    color: #06b8a0;
    background: #f1f5f9;
}

.modern-chat-prompt-history-btn.active {
    color: #06b8a0;
    background: rgba(6, 184, 160, 0.08);
}

/* Prompt History Dropdown */
.prompt-history-dropdown {
    display: none;
    position: fixed;
    z-index: 10001;
    width: 340px;
    max-height: 420px;
    background: white;
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    flex-direction: column;
}

.prompt-history-dropdown.open {
    display: flex;
}

.prompt-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
}

.prompt-history-header i {
    margin-right: 6px;
    color: #06b8a0;
}

.prompt-history-clear-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: #94a3b8;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s ease;
}

.prompt-history-clear-btn:hover {
    background: #fee2e2;
    color: #ef4444;
}

.prompt-history-list {
    overflow-y: auto;
    max-height: 350px;
    padding: 6px;
}

.prompt-history-empty {
    padding: 32px 16px;
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
}

.prompt-history-empty i {
    display: block;
    font-size: 24px;
    margin-bottom: 8px;
    opacity: 0.5;
}

.prompt-history-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    font-size: 13px;
    color: #334155;
    line-height: 1.4;
    transition: background 0.15s ease;
    gap: 10px;
}

.prompt-history-item:hover {
    background: #f1f5f9;
}

.prompt-history-item:active {
    background: #e2e8f0;
}

.prompt-history-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.prompt-history-arrow {
    flex-shrink: 0;
    font-size: 11px;
    color: #cbd5e1;
    transition: color 0.15s ease, transform 0.15s ease;
}

.prompt-history-item:hover .prompt-history-arrow {
    color: #06b8a0;
    transform: translateX(2px);
}

/* Tools Area - Desktop: inline layout, Mobile: collapsible drawer */
.modern-chat-tools-area {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.modern-chat-tools-toggle {
    display: none; /* Hidden on desktop */
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: #b0b8c4;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s ease;
}

.modern-chat-tools-toggle:hover {
    color: #06b8a0;
    background: #f1f5f9;
}

.modern-chat-tools-toggle.active {
    color: #06b8a0;
}

.modern-chat-tools-toggle.active i {
    transform: rotate(45deg);
}

.modern-chat-tools-toggle i {
    transition: transform 0.2s ease;
}

.modern-chat-tools-drawer {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Mobile: collapse tools behind toggle button */
@media (max-width: 768px) {
    .modern-chat-footer {
        gap: 8px;
        padding: 12px 16px;
    }
    
    .modern-chat-tools-toggle {
        display: flex;
    }
    
    .modern-chat-tools-drawer {
        display: none;
        position: fixed;
        bottom: auto;
        left: auto;
        background: white;
        border-radius: 16px;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
        padding: 16px 20px;
        gap: 16px;
        z-index: 1000;
        flex-direction: row;
        align-items: center;
    }
    
    .modern-chat-tools-drawer.open {
        display: flex;
    }
    
    .modern-chat-tools-drawer .modern-chat-sensitivity-wrap,
    .modern-chat-tools-drawer .modern-chat-mic-btn,
    .modern-chat-tools-drawer .modern-chat-prompt-history-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .modern-chat-tools-drawer .modern-chat-sensitivity-btn,
    .modern-chat-tools-drawer .modern-chat-mic-btn,
    .modern-chat-tools-drawer .modern-chat-prompt-history-btn {
        width: 56px !important;
        height: 56px !important;
        min-width: 56px !important;
        font-size: 22px !important;
        border-radius: 14px;
        background: #f1f5f9;
        color: #64748b;
    }
    
    .modern-chat-tools-area {
        position: relative;
    }
    
    .modern-chat-mic-btn,
    .modern-chat-sensitivity-btn {
        width: 40px;
        height: 40px;
        min-width: 40px;
        font-size: 18px;
    }
    
    .modern-chat-send-btn {
        width: 42px;
        height: 42px;
        min-width: 42px;
        font-size: 16px;
    }
    
    .modern-chat-input {
        padding: 10px 14px;
        font-size: 14px;
        min-height: 42px;
    }
    
    .prompt-history-dropdown {
        width: calc(100vw - 24px);
        max-width: 340px;
    }
    
    .sensitivity-popup {
        width: calc(100vw - 24px);
        max-width: 340px;
    }
}

/* Response Sensitivity Button */
.modern-chat-sensitivity-wrap {
    position: relative;
    flex-shrink: 0;
}

.modern-chat-sensitivity-btn {
    width: 50px;
    height: 50px;
    min-width: 50px;
    border-radius: 12px;
    border: none;
    background: transparent;
    color: #b0b8c4;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    transition: all 0.2s ease;
}

.modern-chat-sensitivity-btn:hover {
    color: #06b8a0;
    background: #f1f5f9;
}

.modern-chat-sensitivity-btn.active {
    color: #06b8a0;
    background: #f0fdfa;
}

/* Sensitivity Popup */
.sensitivity-popup {
    position: fixed;
    transform: scale(0.95);
    transform-origin: bottom left;
    width: 340px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1000;
}

.sensitivity-popup.open {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.sensitivity-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 18px;
}

.sensitivity-popup-close {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.15s ease;
}

.sensitivity-popup-close:hover {
    color: #64748b;
    background: #f1f5f9;
}

.sensitivity-slider-group {
    margin-bottom: 18px;
}

.sensitivity-slider-group:last-child {
    margin-bottom: 0;
}

.sensitivity-slider-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 8px;
}

.sensitivity-slider-label span:last-child {
    color: #64748b;
    font-weight: 500;
}

/* Custom Range Slider */
.sensitivity-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.sensitivity-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0e1369 0%, #06b8a0 100%);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(6, 184, 160, 0.3);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.sensitivity-range::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 10px rgba(6, 184, 160, 0.4);
}

.sensitivity-range::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0e1369 0%, #06b8a0 100%);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(6, 184, 160, 0.3);
}

.sensitivity-slider-ticks {
    display: flex;
    justify-content: space-between;
    padding: 4px 2px 0;
    font-size: 10px;
    color: #cbd5e1;
}

/* Resize Handle (Desktop Only) */
.modern-chat-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #0e1369 0%, #06b8a0 100%);
    border-top-left-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: nwse-resize;
    font-size: 12px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.modern-chat-resize-handle:hover {
    opacity: 1;
}

/* Hide resize handle on mobile */
@media (max-width: 768px) {
    .modern-chat-resize-handle {
        display: none;
    }
}

/* Mobile actions - hidden on desktop */
.modern-chat-mobile-actions {
    display: none;
}

/* Mobile Chat Header - Single Row with Dropdown */
@media (max-width: 768px) {
    .modern-chat-header {
        display: flex;
        align-items: center;
        padding: 12px 16px;
        gap: 12px;
    }
    
    .modern-chat-header-left {
        display: flex;
        align-items: center;
        gap: 10px;
        flex: 1;
    }
    
    /* Logo - smaller on mobile */
    .modern-chat-header .modern-chat-avatar {
        width: 36px;
        height: 36px;
        min-width: 36px;
    }
    
    /* Hide agent name on mobile - status line shows agent info */
    .modern-chat-header .modern-chat-agent-name {
        display: none;
    }
    
    /* Status line becomes the main title */
    .modern-chat-header .modern-chat-status {
        font-size: 14px;
        margin-top: 0;
        gap: 6px;
        font-weight: 600;
    }
    
    .modern-chat-header .modern-chat-status-dot {
        width: 8px;
        height: 8px;
    }
    
    /* Hide desktop actions on mobile */
    .modern-chat-header-actions {
        display: none !important;
    }
    
    /* Show mobile actions */
    .modern-chat-mobile-actions {
        display: flex;
        align-items: center;
        gap: 8px;
        position: relative;
    }
    
    /* Dropdown toggle button */
    .modern-chat-dropdown-btn {
        width: 36px;
        height: 36px;
        background: rgba(255, 255, 255, 0.15);
        border: none;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        cursor: pointer;
        transition: all 0.2s ease;
        font-size: 14px;
    }
    
    .modern-chat-dropdown-btn:hover,
    .modern-chat-dropdown-btn.open {
        background: rgba(255, 255, 255, 0.25);
    }
    
    .modern-chat-dropdown-btn.open i {
        transform: rotate(180deg);
    }
    
    .modern-chat-dropdown-btn i {
        transition: transform 0.2s ease;
    }
    
    /* Mobile close button */
    .modern-chat-mobile-actions .modern-chat-close-btn {
        width: 36px;
        height: 36px;
        font-size: 16px;
        border-radius: 8px;
    }
    
    /* Dropdown menu */
    .modern-chat-dropdown-menu {
        position: absolute;
        top: 100%;
        right: 0;
        margin-top: 8px;
        background: #06b8a0;
        border-radius: 12px;
        padding: 8px;
        min-width: 140px;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        transition: all 0.2s ease;
        z-index: 1000;
    }
    
    .modern-chat-dropdown-menu.open {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
    
    /* Dropdown items */
    .modern-chat-dropdown-item {
        display: flex;
        align-items: center;
        gap: 12px;
        width: 100%;
        padding: 12px 16px;
        background: transparent;
        border: none;
        border-radius: 8px;
        color: white;
        font-size: 14px;
        cursor: pointer;
        transition: background 0.2s ease;
        text-align: left;
    }
    
    .modern-chat-dropdown-item:hover {
        background: rgba(255, 255, 255, 0.15);
    }
    
    .modern-chat-dropdown-item i {
        width: 18px;
        text-align: center;
        font-size: 15px;
    }
}

/* Account Grid - Two Column Layout for Organization Setup and Team Members */
.account-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 24px;
    width: 100%;
}

/* Organization Details should span full width */
#organization-details-container {
    grid-column: 1 / -1 !important;
}

/* Organization Display Compact - Single Column */
.organization-display-compact {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

.organization-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.organization-stats-compact {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
}

.stat-card-compact {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #f7fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    width: 100%;
    max-width: 280px; /* Match delete button width */
}

.stat-card-compact i {
    font-size: 20px;
    color: #06b8a0;
    flex-shrink: 0;
}

.stat-card-compact .stat-info {
    display: flex;
    flex-direction: column;
}

.stat-card-compact .stat-number {
    font-size: 18px;
    font-weight: 600;
    color: #2d3748;
}

.stat-card-compact .stat-label {
    font-size: 12px;
    color: #718096;
}

.delete-btn-compact {
    width: 100%;
    max-width: 280px; /* Constrain width */
    padding: 12px 20px;
    background: #e53e3e;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
    margin-top: 4px;
}

.delete-btn-compact:hover {
    background: #c53030;
}

.delete-btn-compact i {
    font-size: 14px;
}

/* Organization Details Container - Full Width */
#organization-details-container {
    width: 100%;
    max-width: 100%;
}

/* Organization Details Section */
.organization-details-section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-top: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    width: 100%;
}

.organization-details-section .section-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.organization-details-section .section-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 10px;
}

.organization-details-section .section-header h3 i {
    color: #06b8a0;
}

.save-details-btn {
    background: #10b981;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s ease;
}

.save-details-btn:hover {
    background: #059669;
}

.save-details-btn i {
    font-size: 14px;
}

.details-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important; /* 3 columns for better full-width layout */
    gap: 24px;
    width: 100%;
}

.detail-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.detail-field.full-width {
    grid-column: 1 / -1;
}

.detail-field label {
    font-size: 14px;
    font-weight: 600;
    color: #4a5568;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-field label i {
    color: #06b8a0;
    font-size: 16px;
}

.detail-field .field-value {
    font-size: 15px;
    color: #2d3748;
    padding: 12px 16px;
    background: #f7fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.detail-field .field-value a {
    color: #06b8a0;
    text-decoration: none;
    transition: color 0.2s ease;
}

.detail-field .field-value a:hover {
    color: #0e1369;
    text-decoration: underline;
}

.detail-input {
    font-size: 15px;
    color: #2d3748;
    padding: 12px 16px;
    background: white;
    border-radius: 8px;
    border: 1px solid #cbd5e0;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

.detail-input:focus {
    outline: none;
    border-color: #06b8a0;
    box-shadow: 0 0 0 3px rgba(6, 184, 160, 0.1);
}

.detail-input::placeholder {
    color: #a0aec0;
}

#social-media-inputs {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

.social-media-input-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.social-media-input {
    flex: 1;
    font-size: 15px;
    color: #2d3748;
    padding: 12px 16px;
    background: white;
    border-radius: 8px;
    border: 1px solid #cbd5e0;
    transition: border-color 0.2s ease;
}

.social-media-input:focus {
    outline: none;
    border-color: #06b8a0;
    box-shadow: 0 0 0 3px rgba(6, 184, 160, 0.1);
}

.remove-social-btn {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 12px 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.remove-social-btn:hover {
    background: #fecaca;
    border-color: #dc2626;
}

.remove-social-btn i {
    font-size: 14px;
}

.add-social-btn {
    background: #f7fafc;
    color: #06b8a0;
    border: 2px dashed #cbd5e0;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.add-social-btn:hover {
    background: #edf2f7;
    border-color: #06b8a0;
}

.add-social-btn i {
    font-size: 12px;
}

/* ===== Service Area Selector ===== */
.service-area-selector {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px;
}

.sa-scope-bar {
    display: flex;
    gap: 0;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 16px;
}

.sa-scope-option {
    flex: 1;
    cursor: pointer;
    margin: 0;
}

.sa-scope-option input[type="radio"] {
    display: none;
}

.sa-scope-option span {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 8px;
    font-size: 13px;
    font-weight: 500;
    color: #4a5568;
    background: white;
    border-right: 1px solid #e2e8f0;
    transition: all 0.2s ease;
    text-align: center;
}

.sa-scope-option:last-child span {
    border-right: none;
}

.sa-scope-option input[type="radio"]:checked + span {
    background: #0e1369;
    color: white;
}

.sa-scope-option span i {
    font-size: 14px;
}

.sa-detail-panel {
    min-height: 0;
    transition: all 0.3s ease;
}

.sa-info-msg {
    padding: 12px 16px;
    background: #e6fffa;
    border-radius: 8px;
    color: #047857;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sa-panel-label {
    font-size: 13px;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 8px;
    display: block;
}

.sa-national-panel {
    padding: 4px 0;
}

/* Local / Regional typeahead */
.sa-local-panel {
    padding: 4px 0;
}

.sa-city-search-wrap {
    position: relative;
    margin-bottom: 12px;
}

.sa-city-search-input-wrap {
    position: relative;
}

.sa-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #a0aec0;
    font-size: 14px;
    pointer-events: none;
}

.sa-city-search {
    padding-left: 36px !important;
}

.sa-city-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 100;
    max-height: 240px;
    overflow-y: auto;
}

.sa-dd-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 14px;
    color: #2d3748;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.1s ease;
}

.sa-dd-item:hover,
.sa-dd-item.sa-dd-highlighted {
    background: #f0fdf9;
}

.sa-dd-pop {
    font-size: 11px;
    color: #a0aec0;
    font-weight: 400;
}

.sa-dd-empty {
    padding: 12px 14px;
    color: #a0aec0;
    font-size: 13px;
    text-align: center;
}

.sa-city-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.sa-city-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #edf2f7;
    border: 1px solid #cbd5e0;
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 13px;
    color: #2d3748;
}

.sa-chip-remove {
    background: none;
    border: none;
    color: #a0aec0;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    transition: color 0.2s ease;
}

.sa-chip-remove:hover {
    color: #e53e3e;
}

/* Service area summary */
.sa-summary {
    margin-top: 12px;
    padding: 10px 14px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    color: #4a5568;
    min-height: 20px;
}

.sa-summary:empty {
    display: none;
}

.sa-summary i {
    color: #06b8a0;
    margin-right: 4px;
}

/* Responsive for service area */
@media (max-width: 900px) {
    .sa-scope-option span {
        font-size: 12px;
        padding: 8px 4px;
    }
}

@media (max-width: 600px) {
    .sa-scope-bar {
        flex-wrap: wrap;
    }
    .sa-scope-option {
        flex: 1 1 45%;
    }
}

.social-media-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.social-media-list li {
    padding: 12px 16px;
    background: #f7fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.social-media-list li a {
    color: #06b8a0;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color 0.2s ease;
}

.social-media-list li a:hover {
    color: #0e1369;
    text-decoration: underline;
}

.social-media-list li.empty-value {
    color: #a0aec0;
    font-style: italic;
}

/* ============================================= */
/* MODERNIZED ORGANIZATION PAGE                  */
/* ============================================= */

/* --- Org Header Banner --- */
.org-header-banner {
    background: linear-gradient(135deg, #0e1369 0%, #1a1f7a 50%, #06b8a0 100%);
    border-radius: 16px;
    padding: 32px 36px;
    margin-bottom: 28px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(14, 19, 105, 0.18);
}

.org-header-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(6,184,160,0.15) 0%, transparent 70%);
    pointer-events: none;
}

.org-banner-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

.org-banner-identity h2 {
    font-size: 28px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 6px 0;
    display: flex;
    align-items: center;
    gap: 12px;
    letter-spacing: -0.3px;
}

.org-banner-identity h2 i {
    font-size: 22px;
    color: #06b8a0;
}

.org-banner-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    color: rgba(255,255,255,0.7);
    font-size: 14px;
}

.org-banner-meta .org-meta-sep {
    color: rgba(255,255,255,0.3);
}

.org-banner-meta a {
    color: #06b8a0;
    text-decoration: none;
}

.org-banner-meta a:hover {
    text-decoration: underline;
}

.org-banner-edit-btn {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.org-banner-edit-btn:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.35);
}

.org-stats-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.org-stat-card {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 12px;
    padding: 16px 24px;
    min-width: 130px;
    text-align: center;
}

.org-stat-value {
    font-size: 26px;
    font-weight: 700;
    color: #ffffff;
    display: block;
    line-height: 1.2;
}

.org-stat-label {
    font-size: 12px;
    color: rgba(255,255,255,0.65);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 500;
    margin-top: 2px;
}

/* --- Two Column Layout --- */
.org-two-col {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
    margin-bottom: 28px;
}

/* --- Team Roster Card --- */
.org-roster-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    overflow: hidden;
}

.org-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #f1f5f9;
}

.org-card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.org-card-header h3 i {
    color: #06b8a0;
    font-size: 15px;
}

.org-refresh-btn {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #64748b;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
}

.org-refresh-btn:hover {
    background: #e2e8f0;
    color: #0e1369;
}

.org-roster-body {
    padding: 16px 24px 24px;
}

/* --- Member Card --- */
.org-member-card {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 18px 20px;
    margin-bottom: 12px;
    transition: all 0.2s;
    background: #fafbfc;
    border-left: 3px solid #0e1369;
}

.org-member-card:last-child {
    margin-bottom: 0;
}

.org-member-card:hover {
    box-shadow: 0 3px 12px rgba(0,0,0,0.07);
    border-color: #cbd5e0;
}

.org-member-card.org-owner-card {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid #fbbf24;
    border-left: 3px solid #f59e0b;
}

.org-member-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.org-member-identity {
    display: flex;
    align-items: center;
    gap: 12px;
}

.org-member-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: white;
    flex-shrink: 0;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
}

.org-owner-card .org-member-avatar {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.org-member-avatar.has-photo {
    background: none;
    overflow: hidden;
}

.org-member-avatar.has-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.org-member-name-block {
    display: flex;
    flex-direction: column;
}

.org-member-email {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
}

.org-member-tags {
    display: flex;
    gap: 6px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.org-tag {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.org-tag-owner {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.org-tag-member {
    background: #ede9fe;
    color: #5b21b6;
    border: 1px solid #c4b5fd;
}

.org-tag-active {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.org-tag-inactive {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

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

.org-remove-btn {
    background: transparent;
    border: 1px solid #e5e7eb;
    color: #94a3b8;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 12px;
}

.org-remove-btn:hover {
    background: #fee2e2;
    border-color: #ef4444;
    color: #ef4444;
}

.org-leave-btn {
    background: transparent;
    border: 1px solid #e5e7eb;
    color: #64748b;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.org-leave-btn:hover {
    background: #fef2f2;
    border-color: #ef4444;
    color: #ef4444;
}

/* --- Role Badges in Member Card --- */
.org-roles-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.org-roles-label {
    font-size: 12px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 600;
    margin-right: 4px;
}

.org-role-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}

.org-role-badge.active {
    background: #10b981;
    color: white;
    box-shadow: 0 1px 3px rgba(16,185,129,0.3);
}

.org-role-badge.active:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(16,185,129,0.3);
}

.org-role-badge.denied {
    background: #f1f5f9;
    color: #94a3b8;
    border: 1px solid #e2e8f0;
}

.org-role-badge.denied:hover {
    background: #fee2e2;
    color: #ef4444;
    border-color: #fca5a5;
    transform: translateY(-1px);
}

/* --- Right Column Cards --- */
.org-right-col {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.org-invite-card, .org-invitations-card, .org-danger-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    overflow: visible;
}

.org-invitations-card .org-card-header,
.org-danger-card .org-card-header {
    border-radius: 14px 14px 0 0;
}

.org-invite-body {
    padding: 20px 24px 24px;
}

.org-form-group {
    margin-bottom: 16px;
}

.org-invite-card .multi-select-container {
    position: relative;
}

.org-invite-card .multi-select-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    cursor: pointer;
    font-size: 14px;
    color: #475569;
    transition: border-color 0.2s;
}

.org-invite-card .multi-select-display:hover {
    border-color: #06b8a0;
}

.org-invite-card .multi-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    background: white;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    margin-top: 4px;
    max-height: 240px;
    overflow-y: auto;
    padding: 6px 0;
}

.org-invite-card .multi-select-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 14px;
    color: #334155;
    transition: background 0.15s;
}

.org-invite-card .multi-select-option:hover {
    background: #f0fdf9;
}

.org-invite-card .multi-select-option input[type="checkbox"] {
    accent-color: #06b8a0;
    width: 16px;
    height: 16px;
}

.org-invite-card .multi-select-option label {
    cursor: pointer;
    margin: 0;
    font-weight: 500;
}

.org-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
}

.org-form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    font-size: 14px;
    color: #1e293b;
    background: white;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.org-form-input:focus {
    outline: none;
    border-color: #06b8a0;
    box-shadow: 0 0 0 3px rgba(6,184,160,0.1);
}

.org-send-invite-btn {
    width: 100%;
    padding: 11px;
    background: linear-gradient(135deg, #0e1369, #06b8a0);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: opacity 0.2s, transform 0.2s;
}

.org-send-invite-btn:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

/* --- Invitations List --- */
.org-invitations-body {
    padding: 16px 24px 20px;
}

.org-inv-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}

.org-inv-item:last-child {
    border-bottom: none;
}

.org-inv-info h5 {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 2px 0;
}

.org-inv-info p {
    font-size: 12px;
    color: #94a3b8;
    margin: 0;
}

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

.org-inv-accept-btn, .org-inv-decline-btn {
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
}

.org-inv-accept-btn {
    background: #10b981;
    color: white;
}

.org-inv-accept-btn:hover {
    background: #059669;
}

.org-inv-decline-btn {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.org-inv-decline-btn:hover {
    background: #fee2e2;
    color: #ef4444;
    border-color: #fca5a5;
}

.org-inv-status {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 10px;
}

.org-inv-status.accepted {
    background: #d1fae5;
    color: #065f46;
}

.org-inv-status.pending {
    background: #fef3c7;
    color: #92400e;
}

.org-inv-select {
    margin-right: 8px;
    accent-color: #0e1369;
}

.org-inv-bulk-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0 4px;
    margin-bottom: 4px;
}

.org-inv-select-all {
    font-size: 12px;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.org-inv-delete-sel-btn {
    font-size: 12px;
    background: transparent;
    border: 1px solid #e2e8f0;
    color: #ef4444;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.15s;
}

.org-inv-delete-sel-btn:hover {
    background: #fee2e2;
    border-color: #fca5a5;
}

.org-inv-delete-sel-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Toggle invitations */
.org-inv-toggle-btn {
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    transition: color 0.15s;
}

.org-inv-toggle-btn:hover {
    color: #0e1369;
}

/* --- Danger Zone --- */
.org-danger-card {
    border-color: #fecaca;
}

.org-danger-body {
    padding: 20px 24px;
}

.org-danger-body p {
    font-size: 13px;
    color: #94a3b8;
    margin: 0 0 14px;
}

.org-delete-org-btn {
    width: 100%;
    padding: 10px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
}

.org-delete-org-btn:hover {
    background: #dc2626;
}

/* --- Business Profile (collapsible) --- */
.org-profile-section {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    overflow: hidden;
    margin-bottom: 28px;
}

.org-profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

.org-profile-header:hover {
    background: #f8fafc;
}

.org-profile-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.org-profile-header h3 i {
    color: #06b8a0;
}

.org-profile-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

.org-profile-toggle-btn {
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.15s;
}

.org-profile-toggle-btn:hover {
    background: #f1f5f9;
    color: #0e1369;
}

.org-profile-toggle-btn i {
    transition: transform 0.25s;
}

.org-profile-toggle-btn.expanded i {
    transform: rotate(180deg);
}

.org-profile-body {
    padding: 0 24px 24px;
    display: none;
}

.org-profile-body.visible {
    display: block;
}

.org-profile-save-row {
    display: flex;
    justify-content: flex-end;
    padding-top: 16px;
    border-top: 1px solid #f1f5f9;
}

/* --- Empty / Loading States --- */
.org-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
}

.org-empty-state i {
    font-size: 36px;
    margin-bottom: 12px;
    display: block;
    color: #cbd5e0;
}

.org-empty-state p {
    margin: 4px 0;
    font-size: 14px;
}

.org-empty-state .org-empty-sub {
    font-size: 13px;
    color: #b0bec5;
}

.org-loading {
    text-align: center;
    padding: 30px 20px;
    color: #64748b;
}

.org-loading i {
    margin-right: 8px;
}

/* --- Org page responsive --- */
@media (max-width: 1024px) {
    .org-two-col {
        grid-template-columns: 1fr;
    }
    .org-right-col {
        order: -1;
    }
    .org-stats-row {
        flex-wrap: wrap;
    }
}

@media (max-width: 640px) {
    .org-header-banner {
        padding: 20px;
    }
    .org-banner-identity h2 {
        font-size: 22px;
    }
    .org-stat-card {
        min-width: 100px;
        padding: 12px 16px;
    }
    .org-member-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .org-member-actions {
        align-self: flex-end;
    }
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .details-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 columns on medium screens */
    }
}

@media (max-width: 768px) {
    /* Global Container Mobile Fixes */
    .container {
        width: 100%;
        max-width: 100%;
        padding: 0 16px;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    
    /* Section Mobile Fixes */
    .section {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }
    
    /* Account Grid Mobile - Stack Vertically */
    .account-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
        padding: 0;
    }
    
    /* Organization Details Mobile */
    #organization-details-container {
        grid-column: 1 !important;
    }
    
    .stat-card-compact {
        max-width: 100%;
    }
    
    .delete-btn-compact {
        max-width: 100%;
    }
    
    /* Member Card Mobile - Stack Columns */
    .member-info-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .member-right-column {
        padding-left: 0;
        padding-top: 12px;
        border-left: none;
        border-top: 2px solid #e5e7eb;
    }
    
    /* Organization Details Mobile Fixes */
    #organization-details-container {
        width: 100%;
        max-width: 100%;
        padding: 0;
        margin: 0;
        box-sizing: border-box;
    }
    
    .organization-details-section {
        padding: 16px;
        margin: 16px 0;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    
    .details-grid {
        grid-template-columns: 1fr; /* 1 column on mobile */
        gap: 16px;
        width: 100%;
    }
    
    .detail-field {
        width: 100%;
        max-width: 100%;
        overflow-wrap: break-word;
        word-wrap: break-word;
    }
    
    .detail-field .field-value {
        width: 100%;
        overflow-wrap: break-word;
        word-wrap: break-word;
    }
    
    .detail-field .field-value a {
        word-break: break-all;
    }
    
    /* File Structure Section Mobile */
    .file-structure-section {
        padding: 16px;
        margin: 16px 0;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    
    /* Organization Members Mobile */
    .organization-members {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }
    
    #members-management-container {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }
    
    /* Organization Display Mobile */
    .organization-display {
        width: 100%;
        max-width: 100%;
        padding: 0;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    
    .organization-header {
        padding: 16px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .organization-info {
        width: 100%;
        overflow-wrap: break-word;
    }
    
    .organization-details p {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    /* Organization Stats Mobile */
    .organization-stats {
        display: flex;
        flex-direction: column;
        gap: 12px;
        width: 100%;
        padding: 0 16px;
        box-sizing: border-box;
    }
    
    .stat-card {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
}

/* ============================================
   GAMEPLANS SECTION STYLES
   ============================================ */

/* Top Bar - Horizontal Layout */
.gameplans-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 24px;
}

.gameplans-selector {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Dropdown Selector */
.gameplans-dropdown {
    position: relative;
}

.gameplans-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #0e1369 0%, #1e40af 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 250px;
}

.gameplans-dropdown-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(14, 19, 105, 0.3);
}

.gameplans-dropdown-btn .dropdown-arrow {
    margin-left: auto;
    transition: transform 0.2s ease;
}

.gameplans-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.gameplans-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 320px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: none;
    overflow: hidden;
}

.gameplans-dropdown.open .gameplans-dropdown-menu {
    display: block;
    animation: dropdownSlide 0.2s ease;
}

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

.dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 600;
    color: #1e293b;
}

.dropdown-new-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #06b8a0 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dropdown-new-btn:hover {
    transform: scale(1.1);
}

.gameplans-dropdown-list {
    max-height: 300px;
    overflow-y: auto;
    padding: 8px;
}

.gameplans-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px;
    color: #64748b;
    font-size: 14px;
}

.gameplans-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    color: #64748b;
    text-align: center;
}

.gameplans-empty i {
    font-size: 36px;
    color: #cbd5e1;
    margin-bottom: 12px;
}

.gameplans-empty p {
    margin: 0;
    font-size: 14px;
}

/* Gameplan List Item in Dropdown */
.gameplan-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #f8fafc;
    border-radius: 10px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.gameplan-list-item:hover {
    background: #e0f2f1;
    border-color: #06b8a0;
}

.gameplan-list-item.active {
    background: linear-gradient(135deg, #e0f2f1 0%, #d1fae5 100%);
    border-color: #06b8a0;
}

.gameplan-list-item-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #0e1369 0%, #1e40af 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    flex-shrink: 0;
}

.gameplan-list-item-content {
    flex: 1;
    min-width: 0;
}

.gameplan-list-item-title {
    font-weight: 600;
    color: #1e293b;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gameplan-list-item-date {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
}

.gameplan-list-item-date i {
    margin-right: 4px;
}

/* Create New Button */
.create-gameplan-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #06b8a0 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.create-gameplan-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(6, 184, 160, 0.35);
}

/* Gameplan With AI Button */
.gameplan-ai-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.gameplan-ai-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4);
}

.gameplan-ai-btn i {
    font-size: 18px;
}

/* Main Content Area */
.gameplans-main-content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    min-height: 500px;
}

@media (max-width: 768px) {
    .gameplans-top-bar {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }
    
    .gameplans-selector {
        flex-direction: column;
    }
    
    .gameplans-dropdown-btn {
        width: 100%;
        min-width: unset;
    }
    
    .gameplan-ai-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Empty State */
.gameplan-empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 500px;
    padding: 40px;
}

.empty-state-content {
    text-align: center;
    max-width: 400px;
}

.empty-state-content i {
    font-size: 80px;
    color: #cbd5e1;
    margin-bottom: 24px;
}

.empty-state-content h2 {
    color: #1e293b;
    font-size: 24px;
    margin-bottom: 12px;
}

.empty-state-content p {
    color: #64748b;
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 24px;
}

.create-gameplan-btn-large {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: linear-gradient(135deg, #06b8a0 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.create-gameplan-btn-large:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(6, 184, 160, 0.35);
}

/* Gameplan Editor */
.gameplan-editor {
    padding: 24px;
}

.gameplan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 24px;
}

.gameplan-title-container {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.gameplan-title-input {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
    border: none;
    background: transparent;
    outline: none;
    padding: 8px 12px;
    border-radius: 8px;
    flex: 1;
    max-width: 400px;
    transition: all 0.2s ease;
}

.gameplan-title-input:hover {
    background: #f1f5f9;
}

.gameplan-title-input:focus {
    background: white;
    box-shadow: 0 0 0 2px #06b8a0;
}

.gameplan-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.gameplan-status.draft {
    background: #fef3c7;
    color: #92400e;
}

.gameplan-status.saved {
    background: #d1fae5;
    color: #065f46;
}

.gameplan-status.unsaved {
    background: #fee2e2;
    color: #991b1b;
}

.gameplan-actions {
    display: flex;
    gap: 10px;
}

.gameplan-save-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #06b8a0 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.gameplan-save-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(6, 184, 160, 0.35);
}

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

.gameplan-save-btn.has-changes {
    animation: pulse-save 2s infinite;
}

@keyframes pulse-save {
    0%, 100% { box-shadow: 0 0 0 0 rgba(6, 184, 160, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(6, 184, 160, 0); }
}

.gameplan-delete-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background: #fee2e2;
    color: #dc2626;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.gameplan-delete-btn:hover {
    background: #fecaca;
    transform: translateY(-1px);
}

/* Timeline Section */
.gameplan-timeline-container {
    margin-bottom: 32px;
    padding: 0 24px;
}

.timeline-header-row,
.performance-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.timeline-section-title,
.performance-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.timeline-section-title i {
    color: #0e1369;
}

.performance-section-title i {
    color: #059669;
}

/* Horizontal Timeline Wrapper */
.gameplan-timeline-wrapper {
    overflow-x: auto;
    padding-bottom: 16px;
    margin: 0 -24px;
    padding: 0 24px 16px;
}

.gameplan-timeline-wrapper::-webkit-scrollbar {
    height: 8px;
}

.gameplan-timeline-wrapper::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.gameplan-timeline-wrapper::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #0e1369 0%, #06b8a0 100%);
    border-radius: 4px;
}

/* Horizontal Timeline */
.gameplan-timeline.horizontal {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 24px;
    padding: 20px 0;
    min-width: min-content;
    position: relative;
}

.gameplan-timeline.horizontal::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50px;
    height: 4px;
    background: linear-gradient(90deg, #0e1369 0%, #06b8a0 50%, #059669 100%);
    border-radius: 2px;
    z-index: 0;
}

.timeline-empty-hint,
.metrics-empty-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 80px;
    background: #f8fafc;
    border-radius: 12px;
    border: 2px dashed #e2e8f0;
    color: #64748b;
    text-align: center;
    min-width: 300px;
}

.timeline-empty-hint i,
.metrics-empty-hint i {
    font-size: 42px;
    color: #cbd5e1;
    margin-bottom: 12px;
}

.timeline-empty-hint p,
.metrics-empty-hint p {
    margin: 0;
    font-size: 14px;
}

/* Horizontal Timeline Item */
.timeline-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 280px;
    max-width: 320px;
    flex-shrink: 0;
}

.timeline-item-marker {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: white;
    z-index: 2;
    margin-bottom: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.timeline-item-marker.strategy {
    background: linear-gradient(135deg, #0e1369 0%, #1e40af 100%);
}

.timeline-item-marker.execution {
    background: linear-gradient(135deg, #06b8a0 0%, #059669 100%);
}

.timeline-item-content {
    width: 100%;
    background: white;
    border-radius: 12px;
    padding: 16px;
    border-top: 4px solid;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.timeline-item.strategy .timeline-item-content {
    border-top-color: #0e1369;
}

.timeline-item.execution .timeline-item-content {
    border-top-color: #06b8a0;
}

.timeline-item-content:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

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

.timeline-item-type {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: #64748b;
}

.timeline-item-status {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 500;
}

.timeline-item-status.planned { background: #e0e7ff; color: #3730a3; }
.timeline-item-status.in-progress { background: #fef3c7; color: #92400e; }
.timeline-item-status.completed { background: #d1fae5; color: #065f46; }
.timeline-item-status.on-hold { background: #f3f4f6; color: #4b5563; }
.timeline-item-status.pending { background: #e0f2fe; color: #0369a1; }

.timeline-item-title {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 8px 0;
}

.timeline-item-description {
    font-size: 14px;
    color: #64748b;
    line-height: 1.5;
    margin: 0 0 12px 0;
}

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

.timeline-item-date {
    font-size: 12px;
    color: #94a3b8;
}

.timeline-item-date i {
    margin-right: 4px;
}

.timeline-item-actions {
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.timeline-item-content:hover .timeline-item-actions {
    opacity: 1;
}

.timeline-item-actions button {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: white;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
}

.timeline-item-actions button:hover {
    background: #0e1369;
    color: white;
}

.timeline-item-actions button:last-child:hover {
    background: #dc2626;
}

/* Timeline Add Buttons */
.timeline-add-buttons {
    display: flex;
    gap: 12px;
}

.add-strategy-btn,
.add-execution-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: 2px dashed;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
}

.add-strategy-btn {
    border-color: #0e1369;
    color: #0e1369;
}

.add-strategy-btn:hover {
    background: #0e1369;
    color: white;
}

.add-execution-btn {
    border-color: #06b8a0;
    color: #06b8a0;
}

.add-execution-btn:hover {
    background: #06b8a0;
    color: white;
}

/* Performance Metrics */
.gameplan-performance-container {
    margin-top: 32px;
    padding: 0 24px 24px;
}

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

.metric-card {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.metric-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.metric-type-icon {
    font-size: 20px;
}

.metric-name {
    flex: 1;
    font-weight: 600;
    color: #1e293b;
    font-size: 14px;
}

.metric-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.metric-card:hover .metric-actions {
    opacity: 1;
}

.metric-actions button {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 4px;
    background: white;
    color: #64748b;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s ease;
}

.metric-actions button:hover {
    background: #0e1369;
    color: white;
}

.metric-actions button:last-child:hover {
    background: #dc2626;
}

.metric-values {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 10px;
}

.metric-current {
    font-size: 24px;
    font-weight: 700;
    color: #059669;
}

.metric-separator {
    color: #94a3b8;
}

.metric-target {
    font-size: 16px;
    color: #64748b;
}

.metric-progress-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 6px;
}

.metric-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #06b8a0 0%, #059669 100%);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.metric-progress-label {
    font-size: 11px;
    color: #94a3b8;
    text-align: right;
}

.add-metric-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: 2px dashed #059669;
    border-radius: 10px;
    background: transparent;
    color: #059669;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.add-metric-btn:hover {
    background: #059669;
    color: white;
}

/* Delete Confirmation Modal */
.delete-confirm-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    animation: fadeIn 0.2s ease;
}

.delete-confirm-modal {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    overflow: hidden;
}

.delete-confirm-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px 0;
}

.delete-confirm-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(239, 68, 68, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.delete-confirm-icon i {
    font-size: 20px;
    color: #ef4444;
}

.delete-confirm-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: #111827;
}

.delete-confirm-body {
    padding: 12px 24px 20px;
}

.delete-confirm-body p {
    margin: 0;
    font-size: 14px;
    color: #6b7280;
    line-height: 1.5;
}

.delete-confirm-filename {
    font-weight: 600;
    color: #374151;
}

.delete-confirm-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    background: #f9fafb;
    border-top: 1px solid #f3f4f6;
}

.delete-confirm-cancel {
    padding: 9px 20px;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    background: white;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.delete-confirm-cancel:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.delete-confirm-delete {
    padding: 9px 20px;
    border-radius: 10px;
    border: none;
    background: #ef4444;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.delete-confirm-delete:hover {
    background: #dc2626;
}

/* Gameplan Modal */
.gameplan-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

.gameplan-modal {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    overflow: hidden;
}

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

.gameplan-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    color: white;
}

.gameplan-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.gameplan-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.gameplan-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.gameplan-modal-body {
    padding: 24px;
}

.gameplan-form-group {
    margin-bottom: 16px;
}

.gameplan-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
}

.gameplan-form-group input,
.gameplan-form-group select,
.gameplan-form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.gameplan-form-group input:focus,
.gameplan-form-group select:focus,
.gameplan-form-group textarea:focus {
    outline: none;
    border-color: #06b8a0;
    box-shadow: 0 0 0 3px rgba(6, 184, 160, 0.15);
}

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

.gameplan-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.gameplan-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

.gameplan-modal-btn-cancel,
.gameplan-modal-btn-save {
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.gameplan-modal-btn-cancel {
    background: white;
    border: 1px solid #e2e8f0;
    color: #64748b;
}

.gameplan-modal-btn-cancel:hover {
    background: #f1f5f9;
}

.gameplan-modal-btn-save {
    border: none;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
}

.gameplan-modal-btn-save:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Responsive */
@media (max-width: 768px) {
    .gameplan-header {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }
    
    .gameplan-title-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .gameplan-title-input {
        max-width: 100%;
    }
    
    .gameplan-actions {
        justify-content: flex-end;
    }
    
    .timeline-add-buttons {
        flex-direction: column;
    }
    
    .gameplan-form-row {
        grid-template-columns: 1fr;
    }
    
    .gameplan-metrics {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   BLUEPRINT SECTION STYLES
   ============================================ */

/* Header */
.blueprint-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 40px;
    flex-wrap: wrap;
    gap: 20px;
}

.blueprint-title-area h1 {
    margin-bottom: 8px;
}

.blueprint-legend {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    background: white;
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #64748b;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-dot.excellent { background: #059669; }
.legend-dot.good { background: #0891b2; }
.legend-dot.needs-attention { background: #f59e0b; }
.legend-dot.critical { background: #dc2626; }

/* Business Info Bar */
.blueprint-business-info {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    flex-wrap: wrap;
    background: white;
    padding: 16px 24px;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
    margin-bottom: 24px;
}

/* Ask CEO Agent Button in Business Info Bar */
.blueprint-ceo-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #0e1369 0%, #1a1f7a 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: auto;
}

.blueprint-ceo-btn:hover {
    background: linear-gradient(135deg, #1a1f7a 0%, #0e1369 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(14, 19, 105, 0.3);
}

.blueprint-ceo-btn i {
    font-size: 16px;
}

.business-info-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.business-info-item .info-label {
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 6px;
}

.business-info-item .info-label i {
    color: #0e1369;
    font-size: 14px;
}

.business-info-item .info-value {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
}

.business-info-item .info-value.not-set {
    color: #94a3b8;
    font-style: italic;
    font-weight: 500;
}

/* Business Type Badges */
.business-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.business-type-badge.ecommerce {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
}

.business-type-badge.leadgen {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #047857;
}

/* Blueprint Canvas */
.blueprint-canvas {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 24px;
    padding: 40px;
    position: relative;
    overflow: visible;
}

.blueprint-canvas::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 30%, rgba(14, 19, 105, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(6, 184, 160, 0.03) 0%, transparent 50%);
    pointer-events: none;
    border-radius: 24px;
}

/* SVG Connector Lines (for gradient definitions) */
.blueprint-connectors {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* CSS Connector Lines Container */
.connector-lines-container {
    display: none; /* Hide CSS connectors, using pseudo-elements instead */
}

/* Connector lines using pseudo-elements on cards */

/* Top Row - Left box (Organic Search) - diagonal down-right to hub */
.blueprint-top-row .director-branch:first-child::after {
    content: '';
    position: absolute;
    bottom: -30px;
    right: -20px;
    width: 80px;
    height: 3px;
    background: linear-gradient(135deg, #0e1369 0%, #06b8a0 100%);
    border-radius: 2px;
    opacity: 0.6;
    transform: rotate(45deg);
    transform-origin: left center;
}

/* Top Row - Center box (Paid Ads) - straight down to hub */
.blueprint-top-row .director-branch:nth-child(2)::after {
    content: '';
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    height: 30px;
    background: linear-gradient(180deg, #dc2626 0%, #06b8a0 100%);
    border-radius: 2px;
    opacity: 0.6;
}

/* Top Row - Right box (Social Media) - diagonal down-left to hub */
.blueprint-top-row .director-branch:last-child::after {
    content: '';
    position: absolute;
    bottom: -30px;
    left: -20px;
    width: 80px;
    height: 3px;
    background: linear-gradient(135deg, #0891b2 0%, #06b8a0 100%);
    border-radius: 2px;
    opacity: 0.6;
    transform: rotate(-45deg);
    transform-origin: right center;
}

/* Middle Row - Lead Gen (left) - horizontal to hub */
.blueprint-middle-row .side-director:first-child::after {
    content: '';
    position: absolute;
    right: -40px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 3px;
    background: linear-gradient(90deg, #7c3aed 0%, #06b8a0 100%);
    border-radius: 2px;
    opacity: 0.6;
}

/* Middle Row - Sales (right) - horizontal to hub */
.blueprint-middle-row .side-director:last-child::before {
    content: '';
    position: absolute;
    left: -40px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 3px;
    background: linear-gradient(90deg, #06b8a0 0%, #f59e0b 100%);
    border-radius: 2px;
    opacity: 0.6;
}

/* Bottom Row - Left box (Website Content) - diagonal up-right to hub */
.blueprint-bottom-row .director-branch:first-child::before {
    content: '';
    position: absolute;
    top: -30px;
    right: -20px;
    width: 80px;
    height: 3px;
    background: linear-gradient(135deg, #06b8a0 0%, #059669 100%);
    border-radius: 2px;
    opacity: 0.6;
    transform: rotate(-45deg);
    transform-origin: left center;
}

/* Bottom Row - Center box (Website Design) - straight up to hub */
.blueprint-bottom-row .director-branch:nth-child(2)::before {
    content: '';
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    height: 30px;
    background: linear-gradient(180deg, #06b8a0 0%, #d946ef 100%);
    border-radius: 2px;
    opacity: 0.6;
}

/* Bottom Row - Right box (Competitors) - diagonal up-left to hub */
.blueprint-bottom-row .director-branch:last-child::before {
    content: '';
    position: absolute;
    top: -30px;
    left: -20px;
    width: 80px;
    height: 3px;
    background: linear-gradient(135deg, #06b8a0 0%, #6366f1 100%);
    border-radius: 2px;
    opacity: 0.6;
    transform: rotate(45deg);
    transform-origin: right center;
}

/* Top Row Directors (3 boxes) */
.blueprint-top-row {
    display: flex;
    justify-content: center;
    gap: 60px;
    margin-bottom: 30px;
    position: relative;
    z-index: 2;
}

/* Director Branch */
.director-branch {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.3s ease;
    position: relative;
}

.blueprint-top-row .director-branch:hover {
    transform: translateY(-8px);
}

.blueprint-bottom-row .director-branch:hover {
    transform: translateY(8px);
}

.director-branch:hover .director-card {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

/* Middle Row - Lead Gen, Hub, Sales */
.blueprint-middle-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    margin: 30px 0;
    position: relative;
    z-index: 2;
}

.blueprint-middle-row .side-director {
    flex-shrink: 0;
}

.blueprint-middle-row .side-director:hover {
    transform: translateX(-8px);
}

.blueprint-middle-row .side-director:last-child:hover {
    transform: translateX(8px);
}

/* Director Card */
.director-card {
    background: white;
    border-radius: 20px;
    padding: 24px;
    width: 200px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
}

.director-card.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.director-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #0e1369, #06b8a0);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.director-branch:hover .director-card::before {
    opacity: 1;
}

.director-card:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

/* Director Icon */
.director-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #0e1369 0%, #1e40af 100%);
    box-shadow: 0 4px 15px rgba(14, 19, 105, 0.3);
}

.director-icon.lead-gen {
    background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.director-icon.paid-ads {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.3);
}

.director-icon.social-media {
    background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
    box-shadow: 0 4px 15px rgba(8, 145, 178, 0.3);
}

.director-icon.website-content {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 4px 15px rgba(5, 150, 105, 0.3);
}

.director-icon.website-design {
    background: linear-gradient(135deg, #d946ef 0%, #c026d3 100%);
    box-shadow: 0 4px 15px rgba(217, 70, 239, 0.3);
}

.director-icon.competitors {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.director-icon.sales {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

/* Director Info */
.director-info h3 {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 4px 0;
}

.director-role {
    font-size: 12px;
    color: #64748b;
    margin: 0;
}

/* Director Score Ring */
.director-score {
    margin-top: 16px;
}

.score-ring {
    position: relative;
    width: 60px;
    height: 60px;
}

.score-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.score-ring-bg {
    fill: none;
    stroke: #e2e8f0;
    stroke-width: 3;
}

.score-ring-fill {
    fill: none;
    stroke: #06b8a0;
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dasharray 1s ease, stroke 0.3s ease;
}

.score-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
}

/* Business Hub - Center of Blueprint */
.business-hub {
    position: relative;
    width: 320px;
    padding: 32px;
    background: white;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(14, 19, 105, 0.15);
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.5s ease;
    flex-shrink: 0;
}

.business-hub.animate-in {
    opacity: 1;
    transform: scale(1);
}

.hub-glow {
    position: absolute;
    top: -20px;
    left: -20px;
    right: -20px;
    bottom: -20px;
    background: radial-gradient(ellipse at center, rgba(6, 184, 160, 0.15) 0%, transparent 70%);
    border-radius: 32px;
    z-index: -1;
    animation: hubPulse 3s ease-in-out infinite;
}

@keyframes hubPulse {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
}

.hub-content {
    text-align: center;
}

.hub-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #0e1369 0%, #1e40af 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: white;
    box-shadow: 0 8px 25px rgba(14, 19, 105, 0.3);
}

/* Business Name in Hub */
.hub-business-name {
    margin-bottom: 8px;
}

.hub-business-name .business-name-value {
    display: block;
    font-size: 20px;
    font-weight: 800;
    color: #0e1369;
    text-align: center;
}

.hub-business-name .business-name-value.not-set {
    color: #94a3b8;
    font-style: italic;
    font-weight: 600;
}

.hub-url {
    margin-bottom: 16px;
}

.url-label {
    display: block;
    font-size: 11px;
    color: #94a3b8;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.url-value {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    word-break: break-all;
}

.url-value.has-url {
    color: #0891b2;
}

.url-value.no-url {
    color: #94a3b8;
    font-style: italic;
}

.hub-overall-score {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
}

.overall-label {
    display: block;
    font-size: 12px;
    color: #64748b;
    margin-bottom: 8px;
}

.overall-score-display {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 2px;
}

.overall-value {
    font-size: 48px;
    font-weight: 800;
    color: #1e293b;
    line-height: 1;
}

.overall-max {
    font-size: 20px;
    color: #94a3b8;
    font-weight: 600;
}

.hub-overall-score .refresh-scores-btn {
    margin-top: 12px;
}

/* Score color classes */
.score-excellent .overall-value { color: #059669; }
.score-good .overall-value { color: #0891b2; }
.score-attention .overall-value { color: #f59e0b; }
.score-critical .overall-value { color: #dc2626; }

.ceo-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: #92400e;
}

.ceo-badge i {
    color: #f59e0b;
}

/* Bottom Row Directors (2 boxes) */
.blueprint-bottom-row {
    display: flex;
    justify-content: center;
    gap: 80px;
    margin-top: 30px;
    position: relative;
    z-index: 2;
}

/* Blueprint Actions */
.blueprint-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 32px;
}

.blueprint-action-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid #e2e8f0;
    background: white;
    color: #64748b;
}

.blueprint-action-btn:hover {
    border-color: #0e1369;
    color: #0e1369;
    transform: translateY(-2px);
}

.blueprint-action-btn.primary {
    background: linear-gradient(135deg, #0e1369 0%, #1e40af 100%);
    color: white;
    border: none;
}

.blueprint-action-btn.primary:hover {
    box-shadow: 0 8px 25px rgba(14, 19, 105, 0.35);
    transform: translateY(-2px);
}

.blueprint-action-btn.loading i {
    animation: spin 1s linear infinite;
}

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

/* Blueprint Modal */
.blueprint-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.blueprint-modal-backdrop.show {
    opacity: 1;
}

.blueprint-modal {
    background: white;
    border-radius: 24px;
    width: 90%;
    max-width: 480px;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25);
    transform: translateY(20px) scale(0.95);
    transition: transform 0.3s ease;
}

.blueprint-modal-backdrop.show .blueprint-modal {
    transform: translateY(0) scale(1);
}

.blueprint-modal-header {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    color: white;
    position: relative;
}

.modal-director-icon {
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.modal-director-info h2 {
    margin: 0 0 4px 0;
    font-size: 22px;
}

.modal-director-info p {
    margin: 0;
    opacity: 0.9;
    font-size: 14px;
}

.modal-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.blueprint-modal-body {
    padding: 24px;
}

.modal-score-section {
    text-align: center;
    padding: 20px;
    background: #f8fafc;
    border-radius: 16px;
    margin-bottom: 20px;
}

.modal-score-label {
    display: block;
    font-size: 13px;
    color: #64748b;
    margin-bottom: 8px;
}

.modal-score-value {
    font-size: 32px;
    font-weight: 800;
    color: #1e293b;
}

.modal-score-section.score-excellent .modal-score-value { color: #059669; }
.modal-score-section.score-good .modal-score-value { color: #0891b2; }
.modal-score-section.score-attention .modal-score-value { color: #f59e0b; }
.modal-score-section.score-critical .modal-score-value { color: #dc2626; }

.modal-description {
    color: #64748b;
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.modal-coming-soon {
    text-align: center;
    padding: 24px;
    background: linear-gradient(135deg, #eff6ff 0%, #e0f2fe 100%);
    border-radius: 16px;
    border: 2px dashed #93c5fd;
}

.modal-coming-soon i {
    font-size: 32px;
    color: #3b82f6;
    margin-bottom: 12px;
}

.modal-coming-soon h3 {
    margin: 0 0 8px 0;
    color: #1e40af;
    font-size: 18px;
}

.modal-coming-soon p {
    margin: 0;
    color: #64748b;
    font-size: 14px;
    line-height: 1.5;
}

.blueprint-modal-footer {
    padding: 16px 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-btn {
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-btn.secondary {
    background: #f1f5f9;
    border: none;
    color: #64748b;
}

.modal-btn.secondary:hover {
    background: #e2e8f0;
}

.modal-btn.primary {
    background: linear-gradient(135deg, #0e1369 0%, #1e40af 100%);
    border: none;
    color: white;
}

.modal-btn.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(14, 19, 105, 0.3);
}

/* Responsive Blueprint */
@media (max-width: 1200px) {
    .blueprint-top-row,
    .blueprint-bottom-row {
        flex-wrap: wrap;
        gap: 20px;
    }
    
    .blueprint-middle-row {
        gap: 20px;
    }
    
    .director-card {
        width: 180px;
        padding: 20px;
    }
    
    .blueprint-top-row .director-branch::after,
    .blueprint-bottom-row .director-branch::before,
    .blueprint-middle-row .side-director::after,
    .blueprint-middle-row .side-director::before {
        display: none;
    }
}

@media (max-width: 900px) {
    .blueprint-middle-row {
        flex-direction: column;
        gap: 30px;
    }
    
    .blueprint-middle-row .side-director:hover {
        transform: translateY(-8px);
    }
    
    .blueprint-middle-row .side-director:last-child:hover {
        transform: translateY(-8px);
    }
}

@media (max-width: 768px) {
    .blueprint-header {
        flex-direction: column;
    }
    
    .blueprint-legend {
        width: 100%;
        justify-content: center;
    }
    
    .blueprint-business-info {
        flex-direction: column;
        gap: 12px;
        padding: 16px;
    }
    
    .business-info-item {
        justify-content: center;
    }
    
    .blueprint-ceo-btn {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }
    
    .blueprint-canvas {
        padding: 24px 16px;
    }
    
    .director-card {
        width: 160px;
        padding: 16px;
    }
    
    .director-icon {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }
    
    .director-info h3 {
        font-size: 14px;
    }
    
    .business-hub {
        width: 280px;
        padding: 24px;
    }
    
    .hub-icon {
        width: 64px;
        height: 64px;
        font-size: 28px;
    }
    
    .overall-value {
        font-size: 36px;
    }
    
    .blueprint-actions {
        flex-direction: column;
    }
    
    .blueprint-action-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .blueprint-canvas {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 16px;
        padding: 20px 12px;
    }

    .blueprint-top-row,
    .blueprint-middle-row,
    .blueprint-bottom-row {
        display: contents;
    }

    .business-hub {
        order: -1;
        width: 100%;
        max-width: 320px;
    }

    .director-branch,
    .director-branch.side-director {
        width: 100%;
        max-width: 320px;
    }

    .director-card {
        width: 100%;
        max-width: 100%;
    }

    .blueprint-canvas::before {
        display: none;
    }
}

/* ============================================
   DIRECTOR MODAL STYLES
   ============================================ */

.director-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.director-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.director-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(14, 19, 105, 0.4);
    backdrop-filter: blur(8px);
}

.director-modal-content {
    position: relative;
    width: 90%;
    max-width: 1100px;
    max-height: 90vh;
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease;
}

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

/* Modal Header */
.director-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    background: linear-gradient(135deg, #0e1369 0%, #1e40af 100%);
    color: white;
}

.director-modal-title {
    display: flex;
    align-items: center;
    gap: 16px;
}

.director-modal-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: rgba(255, 255, 255, 0.2);
}

.director-modal-title-text h2 {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
}

.director-modal-title-text p {
    font-size: 14px;
    opacity: 0.8;
    margin: 4px 0 0 0;
}

.director-modal-actions {
    display: flex;
    gap: 12px;
}

.director-modal-export-btn {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.director-modal-export-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.director-modal-close-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.director-modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Modal Body */
.director-modal-body {
    padding: 32px;
    overflow-y: auto;
    flex: 1;
}

/* Score Section */
.director-score-section {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 32px;
    margin-bottom: 32px;
    padding-bottom: 32px;
    border-bottom: 1px solid #e2e8f0;
}

.director-current-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.score-circle-large {
    position: relative;
    width: 180px;
    height: 180px;
}

.score-circle-large svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.score-circle-large .score-bg {
    fill: none;
    stroke: #e2e8f0;
    stroke-width: 8;
}

.score-circle-large .score-fill {
    fill: none;
    stroke: url(#scoreGradient);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dasharray 1s ease;
}

.score-value-large {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.score-value-large span:first-child {
    display: block;
    font-size: 48px;
    font-weight: 800;
    color: #0e1369;
    line-height: 1;
}

.score-value-large .score-label {
    font-size: 14px;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.score-delta {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #ecfdf5;
    border-radius: 20px;
    color: #059669;
    font-size: 14px;
    font-weight: 600;
}

.score-delta.negative {
    background: #fef2f2;
    color: #dc2626;
}

.score-delta.negative i {
    transform: rotate(180deg);
}

/* Score History */
.director-score-history {
    background: #f8fafc;
    border-radius: 16px;
    padding: 20px;
}

.score-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.score-history-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.history-toggle {
    display: flex;
    background: #e2e8f0;
    border-radius: 8px;
    padding: 4px;
}

.history-toggle-btn {
    padding: 6px 14px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-toggle-btn.active {
    background: white;
    color: #0e1369;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.score-chart-container {
    height: 200px;
}

/* ============================================
   CONFIDENCE BADGE
   ============================================ */

.score-confidence-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.score-confidence-badge.confidence-full {
    background: #ecfdf5;
    color: #059669;
}

.score-confidence-badge.confidence-partial {
    background: #fffbeb;
    color: #d97706;
}

.score-confidence-badge.confidence-unavailable {
    background: #f1f5f9;
    color: #94a3b8;
}

/* ============================================
   INTEGRATION STATUS BANNER
   ============================================ */

.integration-status-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-radius: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.integration-status-banner.banner-partial {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid #fcd34d;
}

.integration-status-banner.banner-unavailable {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
}

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

.banner-partial .integration-banner-icon {
    color: #d97706;
}

.banner-unavailable .integration-banner-icon {
    color: #94a3b8;
}

.integration-banner-text {
    flex: 1;
    min-width: 200px;
}

.integration-banner-text span {
    font-size: 14px;
    font-weight: 500;
    color: #1e293b;
}

.integration-banner-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.integration-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.7);
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.integration-badge i {
    font-size: 10px;
}

/* ============================================
   SCORING FACTORS SECTION
   ============================================ */

.director-factors-section {
    margin-bottom: 24px;
}

.director-factors-section h3 {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 6px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.director-factors-section h3 i {
    color: #0e1369;
}

.factors-subtitle {
    font-size: 13px;
    color: #94a3b8;
    margin: 0 0 20px 0;
}

.factors-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.factor-row {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s ease;
}

.factor-row:last-child {
    border-bottom: none;
}

.factor-row:hover {
    background: #f8fafc;
}

.factor-row.factor-unavailable {
    opacity: 0.55;
}

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

.factor-name {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 2px;
}

.factor-description {
    font-size: 12px;
    color: #94a3b8;
    line-height: 1.3;
}

.factor-detail {
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
    font-style: italic;
}

.factor-score-area {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    width: 240px;
}

.factor-bar-container {
    flex: 1;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.factor-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}

.factor-score-value {
    font-size: 18px;
    font-weight: 700;
    width: 36px;
    text-align: right;
}

.factor-weight {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 500;
    width: 30px;
    text-align: right;
}

/* Factors Empty State */
.factors-empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #94a3b8;
}

.factors-empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.4;
}

.factors-empty-state h4 {
    font-size: 18px;
    color: #1e293b;
    margin: 0 0 8px 0;
}

.factors-empty-state p {
    font-size: 14px;
    margin: 0;
    max-width: 400px;
    margin: 0 auto;
    line-height: 1.5;
}

/* ============================================
   SCORE UPDATED INFO
   ============================================ */

.score-updated-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.score-updated-info i {
    color: #94a3b8;
    font-size: 14px;
}

.score-updated-info span {
    font-size: 13px;
    color: #64748b;
    flex: 1;
}

.refresh-scores-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid #0e1369;
    border-radius: 8px;
    background: white;
    color: #0e1369;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.refresh-scores-btn:hover {
    background: #0e1369;
    color: white;
}

.refresh-scores-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============================================
   DIRECTOR MODAL RESPONSIVE (SCORING)
   ============================================ */

@media (max-width: 900px) {
    .director-score-section {
        grid-template-columns: 1fr;
    }
    
    .director-current-score {
        flex-direction: row;
        justify-content: center;
        gap: 32px;
    }
    
    .score-circle-large {
        width: 140px;
        height: 140px;
    }
    
    .score-value-large span:first-child {
        font-size: 36px;
    }
    
    .factor-score-area {
        width: 180px;
    }
}

@media (max-width: 768px) {
    .director-modal-content {
        width: 95%;
        max-height: 95vh;
        border-radius: 16px;
    }
    
    .director-modal-header {
        padding: 16px 20px;
    }
    
    .director-modal-icon {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
    
    .director-modal-title-text h2 {
        font-size: 18px;
    }
    
    .director-modal-export-btn span {
        display: none;
    }
    
    .director-modal-body {
        padding: 20px;
    }
    
    .director-current-score {
        flex-direction: column;
    }
    
    .factor-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .factor-score-area {
        width: 100%;
    }
    
    .integration-status-banner {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .score-updated-info {
        flex-direction: column;
        text-align: center;
    }
}

/* Mobile Saved Chats Button - Hidden on Desktop */
.mobile-saved-chats-btn {
    display: none;
}

/* Mobile Saved Chats Popup */
.mobile-saved-chats-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-saved-chats-overlay.open {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.mobile-saved-chats-popup {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.mobile-saved-chats-overlay.open .mobile-saved-chats-popup {
    transform: translateY(0);
}

.mobile-saved-chats-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(135deg, #0e1369 0%, #06b8a0 100%);
    border-radius: 16px 16px 0 0;
}

.mobile-saved-chats-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

.mobile-saved-chats-close {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.mobile-saved-chats-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

.mobile-saved-chats-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.mobile-saved-chats-list .chat-history-item {
    padding: 12px 16px;
    border-radius: 10px;
    background: #f8fafc;
    margin-bottom: 10px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.mobile-saved-chats-list .chat-history-item:hover {
    background: #e2e8f0;
}

.mobile-saved-chats-list .chat-history-title {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 4px;
    font-size: 14px;
}

.mobile-saved-chats-list .chat-history-preview {
    font-size: 13px;
    color: #64748b;
    line-height: 1.4;
}

.mobile-saved-chats-list .chat-history-date {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 6px;
}

.mobile-saved-chats-list .chat-history-loading,
.mobile-saved-chats-list .chat-history-empty {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
}

.mobile-saved-chats-list .chat-history-empty i {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* Mobile History Tabs */
.mobile-history-tabs {
    display: flex;
    gap: 8px;
    padding: 0 0 16px 0;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 16px;
}

.mobile-history-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: #f1f5f9;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-history-tab:hover {
    background: #e2e8f0;
}

.mobile-history-tab.active {
    background: linear-gradient(135deg, #0e1369 0%, #06b8a0 100%);
    color: white;
}

.mobile-history-tab i {
    font-size: 14px;
}

/* Mobile Tab Content */
.mobile-tab-content {
    display: none;
}

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

/* Mobile chat items - ensure clickable on touch */
.mobile-saved-chats-list .chat-history-item {
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(6, 184, 160, 0.2);
    touch-action: manipulation;
}

/* Mobile flat chat item styling */
.mobile-saved-chats-list .mobile-chat-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    border-radius: 10px;
    background: #f8fafc;
    margin-bottom: 8px;
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(6, 184, 160, 0.2);
    touch-action: manipulation;
    transition: background 0.2s ease, transform 0.1s ease;
}

.mobile-saved-chats-list .mobile-chat-item:active {
    background: #e2e8f0;
    transform: scale(0.98);
}

.mobile-saved-chats-list .mobile-chat-item .chat-item-content {
    flex: 1;
    min-width: 0;
}

.mobile-saved-chats-list .mobile-chat-item .chat-item-title {
    font-weight: 600;
    color: #1e293b;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-saved-chats-list .mobile-chat-item .chat-item-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #94a3b8;
    margin-top: 4px;
}

.mobile-saved-chats-list .mobile-chat-item .chat-item-actions {
    flex-shrink: 0;
    margin-left: 8px;
}

.mobile-saved-chats-list .mobile-chat-item .chat-item-action-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #94a3b8;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
}

.mobile-saved-chats-list .mobile-chat-item .chat-item-action-btn:active {
    background: #fee2e2;
    color: #ef4444;
}

/* Mobile folder styling (kept for backward compat) */
.mobile-saved-chats-list .chat-folder-header {
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(6, 184, 160, 0.2);
    touch-action: manipulation;
}

.mobile-saved-chats-list .chat-folder-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.mobile-saved-chats-list .chat-folder-content.expanded {
    max-height: 2000px;
}

/* ==========================================
   Business Facts Panel & Tile Styles
   ========================================== */

/* Desktop Facts Tile - Right Side */
.facts-tile {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #0e1369 0%, #06b8a0 100%);
    color: white;
    padding: 24px 10px;
    border-radius: 12px 0 0 12px;
    cursor: pointer;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

.facts-tile:hover {
    padding-right: 16px;
    box-shadow: -6px 0 30px rgba(6, 184, 160, 0.3);
}

.facts-tile-icon {
    font-size: 22px;
    writing-mode: horizontal-tb;
}

.facts-tile-text {
    display: block;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.5px;
    white-space: nowrap;
    text-align: center;
}

/* Show all text inline as single line */
.facts-tile-text span:first-child {
    display: inline;
}

.facts-tile-text strong {
    display: inline;
    font-size: 16px;
    font-weight: 700;
}

.facts-tile-arrow {
    font-size: 14px;
    writing-mode: horizontal-tb;
    animation: pulse-arrow 1.5s ease-in-out infinite;
}

@keyframes pulse-arrow {
    0%, 100% { transform: translateX(0); opacity: 0.7; }
    50% { transform: translateX(-5px); opacity: 1; }
}

/* Facts Panel Overlay */
.facts-panel-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    justify-content: flex-end;
    backdrop-filter: blur(4px);
}

.facts-panel-overlay.open {
    display: flex;
}

.facts-panel {
    width: 100%;
    max-width: 800px;
    height: 100%;
    background: #fff;
    display: flex;
    flex-direction: column;
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.2);
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.facts-panel-header {
    background: linear-gradient(135deg, #0e1369 0%, #06b8a0 100%);
    color: white;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.facts-panel-header h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.facts-panel-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
}

.facts-panel-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Facts Panel Toolbar */
.facts-panel-toolbar {
    padding: 16px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.facts-search {
    position: relative;
    display: flex;
    align-items: center;
}

.facts-search i {
    position: absolute;
    left: 14px;
    color: #94a3b8;
    font-size: 14px;
}

.facts-search input {
    width: 100%;
    padding: 12px 16px 12px 42px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.facts-search input:focus {
    outline: none;
    border-color: #06b8a0;
    box-shadow: 0 0 0 3px rgba(6, 184, 160, 0.1);
}

.facts-actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.facts-select-all-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #64748b;
    cursor: pointer;
}

.facts-select-all-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #06b8a0;
}

.facts-delete-btn {
    background: #ef4444;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.facts-delete-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
}

.facts-delete-btn:not(:disabled):hover {
    background: #dc2626;
}

/* Facts List */
.facts-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

.facts-loading,
.facts-empty {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
}

.facts-empty i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.facts-empty p {
    margin: 0;
    line-height: 1.6;
}

/* Facts Category */
.facts-category {
    margin-bottom: 24px;
}

.facts-category-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #0e1369 0%, #06b8a0 100%);
    border-radius: 10px 10px 0 0;
    font-weight: 600;
    color: white;
    font-size: 14px;
}

.facts-category-header i {
    color: rgba(255, 255, 255, 0.9);
}

.facts-category-count {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 2px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* Facts Table */
.facts-table-wrapper {
    overflow-x: auto;
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 10px 10px;
}

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

.facts-table thead {
    background: #f8fafc;
}

.facts-table th {
    padding: 12px 10px;
    text-align: left;
    font-weight: 600;
    color: #64748b;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}

.facts-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: top;
}

.facts-table tbody tr:hover {
    background: #f8fafc;
}

.facts-table tbody tr.selected {
    background: #f0fdfa;
}

.facts-table tbody tr:last-child td {
    border-bottom: none;
}

/* Table column widths */
.facts-table .col-select {
    width: 40px;
    text-align: center;
}

.facts-table .col-fact {
    width: 25%;
    min-width: 150px;
}

.facts-table .col-value {
    width: 35%;
    min-width: 200px;
}

.facts-table .col-confidence {
    width: 100px;
    text-align: center;
}

.facts-table .col-date {
    width: 100px;
    color: #94a3b8;
    font-size: 12px;
}

.facts-table .col-actions {
    width: 110px;
}

/* Table checkboxes */
.facts-table input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #06b8a0;
    cursor: pointer;
}

.fact-key {
    font-weight: 600;
    color: #0e1369;
    font-size: 13px;
}

.fact-value {
    color: #475569;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
    padding: 4px 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
    max-height: 80px;
    overflow-y: auto;
}

.fact-value.editing {
    background: #fef9c3;
    padding: 8px;
    border: 1px dashed #eab308;
    outline: none;
    max-height: none;
}

.fact-confidence {
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
}

.fact-confidence.verified {
    background: #dcfce7;
    color: #15803d;
}

.fact-confidence.high {
    background: #dbeafe;
    color: #1d4ed8;
}

.fact-confidence.medium {
    background: #fef9c3;
    color: #a16207;
}

.fact-confidence.low {
    background: #fee2e2;
    color: #dc2626;
}

.fact-date {
    color: #94a3b8;
}

.fact-actions {
    display: flex;
    gap: 4px;
}

.fact-btn {
    background: transparent;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    color: #64748b;
    font-size: 14px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fact-btn:hover {
    background: #f1f5f9;
}

.fact-btn.verify:hover {
    color: #15803d;
    background: #dcfce7;
}

.fact-btn.edit:hover {
    color: #1d4ed8;
    background: #dbeafe;
}

.fact-btn.delete:hover {
    color: #dc2626;
    background: #fee2e2;
}

/* Mobile Facts Button */
.mobile-facts-btn {
    display: none !important;
}

/* Desktop only class */
.desktop-only {
    display: flex;
}

/* Mobile Styles */
@media (max-width: 768px) {
    /* Hide desktop tile on mobile */
    .facts-tile.desktop-only {
        display: none !important;
    }
    
    /* Show mobile facts button */
    .mobile-facts-btn {
        display: flex !important;
        margin-top: 12px;
    }
    
    /* Full-width panel on mobile */
    .facts-panel {
        max-width: 100%;
    }
    
    .facts-panel-header {
        padding: 16px 20px;
    }
    
    .facts-panel-header h3 {
        font-size: 1.1rem;
    }
    
    /* Mobile table adjustments */
    .facts-table {
        font-size: 12px;
    }
    
    .facts-table th,
    .facts-table td {
        padding: 10px 8px;
    }
    
    /* Hide date column on mobile */
    .facts-table .col-date {
        display: none;
    }
    
    /* Smaller confidence badge */
    .facts-table .col-confidence {
        width: 70px;
    }
    
    .fact-confidence {
        font-size: 10px;
        padding: 2px 6px;
    }
    
    /* Stack actions vertically on small screens */
    .fact-actions {
        flex-direction: column;
        gap: 2px;
    }
    
    .fact-btn {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
}

/* ========================================
   FACT HISTORY MODAL STYLES
   ======================================== */

.fact-history-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
}

.fact-history-modal.open {
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.history-modal-container {
    position: relative;
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    background: var(--bg-secondary, #1e1e2e);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.history-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: linear-gradient(135deg, #06b8a0 0%, #049b87 100%);
    color: white;
}

.history-modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.history-modal-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.history-modal-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

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

/* Loading State */
.history-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    color: var(--text-secondary, #a0a0a0);
    font-size: 1rem;
}

.history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    color: var(--text-secondary, #a0a0a0);
    text-align: center;
}

.history-empty i {
    font-size: 2rem;
    opacity: 0.5;
}

/* ----------------------------------------
   TIMELINE VIEW (Option 1)
   ---------------------------------------- */

.history-timeline {
    position: relative;
}

.history-item {
    display: flex;
    gap: 16px;
    padding: 16px 0;
}

.history-item.current .history-dot {
    background: #06b8a0;
    box-shadow: 0 0 0 4px rgba(6, 184, 160, 0.2);
}

.history-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 20px;
    flex-shrink: 0;
}

.history-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text-secondary, #666);
    flex-shrink: 0;
}

.history-line {
    width: 2px;
    flex: 1;
    background: var(--border-color, #333);
    margin-top: 8px;
}

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

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

.history-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary, #888);
    font-weight: 600;
}

.history-item.current .history-label {
    color: #06b8a0;
}

.history-date {
    font-size: 0.8rem;
    color: var(--text-secondary, #888);
}

.history-value {
    font-size: 1rem;
    color: var(--text-primary, #fff);
    background: var(--bg-tertiary, #252535);
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 8px;
    line-height: 1.5;
}

.history-meta {
    display: flex;
    gap: 16px;
    font-size: 0.75rem;
    color: var(--text-secondary, #888);
}

.history-source i {
    margin-right: 4px;
}

/* Change indicators */
.history-change {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
}

.history-change.positive {
    color: #22c55e;
    background: rgba(34, 197, 94, 0.15);
}

.history-change.negative {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
}

/* ----------------------------------------
   CHART VIEW (Option 4)
   ---------------------------------------- */

.history-chart-view {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.history-chart-container {
    position: relative;
    background: var(--bg-tertiary, #252535);
    border-radius: 12px;
    padding: 20px;
    padding-bottom: 40px;
}

.history-chart {
    width: 100%;
    height: auto;
}

.chart-dot {
    fill: #06b8a0;
    transition: all 0.2s ease;
    cursor: pointer;
}

.chart-dot:hover {
    r: 8;
    fill: #08d4bc;
}

.chart-labels {
    position: absolute;
    bottom: 12px;
    left: 0;
    right: 0;
    height: 20px;
}

.chart-labels span {
    position: absolute;
    transform: translateX(-50%);
    font-size: 10px;
    color: var(--text-secondary, #888);
    white-space: nowrap;
}

.history-chart-table {
    background: var(--bg-tertiary, #252535);
    border-radius: 12px;
    overflow: hidden;
}

.history-chart-table table {
    width: 100%;
    border-collapse: collapse;
}

.history-chart-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary, #888);
    background: var(--bg-secondary, #1e1e2e);
    font-weight: 600;
}

.history-chart-table td {
    padding: 12px 16px;
    font-size: 0.9rem;
    color: var(--text-primary, #fff);
    border-top: 1px solid var(--border-color, #333);
}

.history-chart-table tr.current td {
    background: rgba(6, 184, 160, 0.1);
}

.history-chart-table tr.current td:first-child {
    border-left: 3px solid #06b8a0;
}

/* ----------------------------------------
   DIFF VIEW (Option 5)
   ---------------------------------------- */

.history-diff-view {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.diff-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-tertiary, #252535);
    border-radius: 8px;
}

.diff-nav-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-secondary, #1e1e2e);
    border: 1px solid var(--border-color, #333);
    color: var(--text-primary, #fff);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.diff-nav-btn:hover:not(:disabled) {
    background: #06b8a0;
    border-color: #06b8a0;
}

.diff-nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.diff-position {
    font-size: 0.85rem;
    color: var(--text-secondary, #888);
}

.diff-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.diff-panel {
    background: var(--bg-tertiary, #252535);
    border-radius: 12px;
    overflow: hidden;
}

.diff-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-secondary, #1e1e2e);
}

.diff-panel.newer .diff-panel-header {
    background: rgba(6, 184, 160, 0.15);
}

.diff-date {
    font-size: 0.85rem;
    color: var(--text-primary, #fff);
    font-weight: 500;
}

.diff-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 8px;
    border-radius: 4px;
    background: var(--bg-tertiary, #252535);
    color: var(--text-secondary, #888);
}

.diff-panel.newer .diff-label {
    background: #06b8a0;
    color: white;
}

.diff-content {
    padding: 16px;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-primary, #fff);
    white-space: pre-wrap;
    max-height: 300px;
    overflow-y: auto;
}

/* History button style - default (no history) */
.fact-btn.verify {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.fact-btn.verify:hover {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.fact-btn.unverify {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.fact-btn.unverify:hover {
    background: rgba(245, 158, 11, 0.25);
    color: #fbbf24;
}

/* History button with versions - light green with version count */
.fact-btn.history.has-history {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
    font-weight: 700;
}

.fact-btn.history.has-history:hover {
    background: rgba(34, 197, 94, 0.3);
    color: #16a34a;
}

/* Version count number inside history button */
.fact-btn.history .version-count {
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

/* Total facts count in header */
.facts-total-count {
    font-weight: 500;
    color: #06b8a0;
    margin-left: 4px;
}

/* ----------------------------------------
   RESPONSIVE - History Modal
   ---------------------------------------- */

@media (max-width: 768px) {
    .history-modal-container {
        width: 95%;
        max-height: 90vh;
        margin: 20px;
    }

    .history-modal-header {
        padding: 16px 20px;
    }

    .history-modal-content {
        padding: 16px;
    }

    .diff-panels {
        grid-template-columns: 1fr;
    }

    .diff-navigation {
        flex-wrap: wrap;
        gap: 12px;
    }

    .diff-position {
        order: -1;
        width: 100%;
        text-align: center;
    }

    .history-chart-container {
        padding: 12px;
        padding-bottom: 35px;
    }

    .chart-labels span {
        font-size: 8px;
    }
}

/* ===== Avatar Selection Popup ===== */
.avatar-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s ease;
}

.avatar-popup-content {
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    border-radius: 20px;
    width: 90%;
    max-width: 520px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(6, 184, 160, 0.15);
    animation: slideUp 0.3s ease;
}

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

.avatar-popup-header {
    background: linear-gradient(135deg, #0e1369 0%, #1e40af 50%, #06b8a0 100%);
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.avatar-popup-header h3 {
    margin: 0;
    color: white;
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar-popup-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.avatar-popup-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

.avatar-popup-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(85vh - 160px);
}

.avatar-section h4 {
    margin: 0 0 6px 0;
    color: #0e1369;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.avatar-section h4 i {
    color: #06b8a0;
}

.avatar-section-desc {
    margin: 0 0 16px 0;
    color: #64748b;
    font-size: 13px;
}

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.avatar-option {
    position: relative;
    aspect-ratio: 1;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s ease;
    background: #f1f5f9;
}

.avatar-option img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.avatar-option:hover {
    border-color: #06b8a0;
    transform: scale(1.08);
    box-shadow: 0 4px 15px rgba(6, 184, 160, 0.3);
}

.avatar-option.selected {
    border-color: #06b8a0;
    box-shadow: 0 0 0 3px rgba(6, 184, 160, 0.3);
}

.avatar-option.loading {
    opacity: 0.7;
    pointer-events: none;
}

.avatar-option.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid rgba(6, 184, 160, 0.3);
    border-top-color: #06b8a0;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.avatar-option-check {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 22px;
    height: 22px;
    background: linear-gradient(135deg, #06b8a0, #059669);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 11px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.avatar-option.selected .avatar-option-check {
    display: flex;
}

.avatar-divider {
    display: flex;
    align-items: center;
    margin: 24px 0;
    color: #94a3b8;
    font-size: 13px;
    font-weight: 500;
}

.avatar-divider::before,
.avatar-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, #e2e8f0, transparent);
}

.avatar-divider span {
    padding: 0 16px;
}

.avatar-upload-section h4 {
    margin: 0 0 6px 0;
    color: #0e1369;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.avatar-upload-section h4 i {
    color: #06b8a0;
}

.avatar-upload-btn {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #475569;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.avatar-upload-btn:hover {
    border-color: #06b8a0;
    background: linear-gradient(135deg, #f0fdfa, #e0f2f1);
    color: #06b8a0;
}

.avatar-upload-btn i {
    font-size: 20px;
}

.avatar-popup-footer {
    background: #f8fafc;
    padding: 16px 24px;
    border-top: 1px solid #e2e8f0;
}

.current-avatar-preview {
    display: flex;
    align-items: center;
    gap: 12px;
}

.current-avatar-preview span {
    color: #64748b;
    font-size: 13px;
    font-weight: 500;
}

.current-avatar-img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 18px;
    overflow: hidden;
    border: 2px solid #06b8a0;
}

.current-avatar-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* User avatar in chat messages */
.modern-chat-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 14px;
    flex-shrink: 0;
    overflow: hidden;
}

.modern-chat-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Avatar popup mobile responsive */
@media (max-width: 480px) {
    .avatar-popup-content {
        width: 95%;
        max-height: 90vh;
        border-radius: 16px;
    }

    .avatar-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .avatar-popup-header {
        padding: 16px 20px;
    }

    .avatar-popup-header h3 {
        font-size: 18px;
    }

    .avatar-popup-body {
        padding: 20px;
    }
}

/* ===========================================
   Notification System Styles
   =========================================== */

/* Notification Badge */
#notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.4);
}

/* Notifications Tab Badge */
#notifications-tab-badge {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    margin-left: 6px;
}

/* Chat History Tabs */
.chat-history-tabs {
    display: flex;
    border-bottom: 1px solid #e2e8f0;
    padding: 0 16px;
    background: #f8fafc;
}

.chat-history-tab {
    flex: 1;
    padding: 12px 8px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: #64748b;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.chat-history-tab:hover {
    color: #4f46e5;
}

.chat-history-tab.active {
    color: #4f46e5;
    border-bottom-color: #4f46e5;
}

.chat-history-tab svg {
    width: 16px;
    height: 16px;
}

/* Tab Content */
.chat-history-tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
}

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

/* Notifications List */
#notifications-list {
    padding: 12px;
}

.notification-empty {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
}

.notification-empty svg {
    margin-bottom: 12px;
    opacity: 0.5;
}

.notification-empty p {
    margin: 4px 0;
}

.notification-empty .text-muted {
    font-size: 12px;
    color: #cbd5e1;
}

/* Notification Item */
.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s ease;
    position: relative;
    margin-bottom: 8px;
    background: #f8fafc;
}

.notification-item:hover {
    background: #e2e8f0;
}

.notification-item.unread {
    background: #eff6ff;
    border-left: 3px solid #4f46e5;
}

.notification-item.unread:hover {
    background: #dbeafe;
}

.notification-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

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

.notification-title {
    font-weight: 600;
    color: #1e293b;
    font-size: 13px;
    margin-bottom: 4px;
}

.notification-summary {
    font-size: 12px;
    color: #64748b;
    line-height: 1.4;
    margin-bottom: 4px;
}

.notification-time {
    font-size: 11px;
    color: #94a3b8;
}

.notification-unread-dot {
    width: 8px;
    height: 8px;
    background: #4f46e5;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
}

/* Notification Toast Container */
#notification-toast-container {
    position: fixed;
    bottom: 100px;
    right: 20px;
    z-index: 100001;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    max-width: 360px;
}

/* Notification Toast */
.notification-toast {
    background: white;
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    animation: toast-slide-in 0.3s ease;
    position: relative;
}

@keyframes toast-slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification-toast.toast-fade-out {
    animation: toast-fade-out 0.3s ease forwards;
}

@keyframes toast-fade-out {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.toast-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

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

.toast-title {
    font-weight: 600;
    color: #1e293b;
    font-size: 14px;
    margin-bottom: 2px;
}

.toast-summary {
    font-size: 13px;
    color: #64748b;
    line-height: 1.4;
}

.toast-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border: none;
    background: #f1f5f9;
    border-radius: 6px;
    color: #64748b;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.toast-close:hover {
    background: #e2e8f0;
    color: #1e293b;
}

/* Notification Items - Match saved chat tile styling */
#notifications-list .notification-item {
    display: flex;
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

#notifications-list .notification-item:hover {
    background: #e9ecef;
    border-color: #00c2ff;
    transform: translateX(3px);
}

#notifications-list .notification-item.unread {
    background: #eef6ff;
    border-left: 3px solid #00c2ff;
}

#notifications-list .notification-item .chat-item-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
}

#notifications-list .notification-item .chat-item-icon {
    font-size: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

#notifications-list .notification-item .chat-item-details {
    flex: 1;
    min-width: 0;
}

#notifications-list .notification-item .chat-item-title {
    font-weight: 600;
    color: #1e293b;
    font-size: 14px;
    margin-bottom: 4px;
}

#notifications-list .notification-item .chat-item-preview {
    color: #475569;
    font-size: 13px;
    line-height: 1.4;
    margin-bottom: 6px;
}

#notifications-list .notification-item .chat-item-date {
    color: #64748b;
    font-size: 11px;
}

#notifications-list .notification-badge-dot {
    width: 10px;
    height: 10px;
    background: #00c2ff;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
}

#notifications-list .notification-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: #64748b;
}

#notifications-list .notification-empty p {
    margin: 4px 0;
}

/* Notification delete button */
#notifications-list .notification-item {
    position: relative;
}

#notifications-list .notification-delete-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #94a3b8;
    border-radius: 6px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#notifications-list .notification-item:hover .notification-delete-btn {
    opacity: 1;
}

#notifications-list .notification-delete-btn:hover {
    background: #fee2e2;
    color: #ef4444;
}

/* =====================================================
   CHAT ENHANCEMENTS - Feedback, Stop, Regenerate, Tools
   ===================================================== */

/* Feedback Buttons Container */
.chat-feedback-buttons {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(148, 163, 184, 0.15);
}

.chat-feedback-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Feedback Buttons (Thumbs Up/Down) */
.chat-feedback-btn {
    width: 32px;
    height: 32px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    transition: all 0.2s ease;
    font-size: 14px;
}

.chat-feedback-btn:hover {
    background: rgba(148, 163, 184, 0.1);
    border-color: rgba(148, 163, 184, 0.5);
}

.chat-feedback-btn.chat-feedback-up:hover,
.chat-feedback-btn.chat-feedback-up.active {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
}

.chat-feedback-btn.chat-feedback-down:hover,
.chat-feedback-btn.chat-feedback-down.active {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}

/* Regenerate Button */
.chat-regenerate-btn {
    width: 32px;
    height: 32px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    transition: all 0.2s ease;
    font-size: 13px;
    margin-left: 4px;
}

.chat-regenerate-btn:hover {
    color: #00c2ff;
    background: rgba(0, 194, 255, 0.1);
    border-color: rgba(0, 194, 255, 0.3);
}

/* Inline Regenerate Button (after stop) */
.chat-regenerate-inline-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    margin-left: 12px;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 6px;
    color: #92400e;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-regenerate-inline-btn:hover {
    background: #fde68a;
    border-color: #f59e0b;
}

/* Feedback Thank You */
.chat-feedback-thanks {
    font-size: 12px;
    color: #10b981;
    margin-left: 8px;
    animation: fadeIn 0.3s ease;
}

/* Stop Button */
.chat-stop-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    margin-left: 12px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    animation: fadeIn 0.3s ease;
}

.chat-stop-btn:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    transform: scale(1.02);
}

.chat-stop-btn i {
    font-size: 11px;
}

/* Tool Activity Animation */
.tool-activity-text {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

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

/* Interrupted Message Style */
.chat-interrupted .modern-chat-message-bubble-ai {
    background: #fef3c7 !important;
    border-color: #fcd34d !important;
}

/* Tool Use Indicator */
.chat-tool-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(0, 194, 255, 0.08);
    border: 1px solid rgba(0, 194, 255, 0.2);
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 13px;
    color: #00c2ff;
}

.chat-tool-indicator i {
    animation: spin 1s linear infinite;
}

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

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .chat-feedback-btn {
        border-color: rgba(148, 163, 184, 0.2);
        color: #64748b;
    }
    
    .chat-feedback-btn:hover {
        background: rgba(148, 163, 184, 0.15);
    }
    
    .chat-regenerate-btn {
        border-color: rgba(148, 163, 184, 0.2);
        color: #64748b;
    }
}
