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

.auth-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb, #d1d5db);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.auth-loading-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.auth-loading-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.auth-loading-logo {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.auth-loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(59, 130, 246, 0.2);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: auth-spin 0.8s linear infinite;
}

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

.auth-loading-text {
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 500;
    color: #4b5563;
}

:root {
    --color-gray-100: #f3f4f6;
    --color-gray-200: #e5e7eb;
    --color-gray-300: #d1d5db;
    --color-gray-400: #9ca3af;
    --color-gray-500: #6b7280;
    --color-gray-600: #4b5563;
    --color-gray-700: #374151;
    --color-gray-800: #1f2937;
    --color-gray-900: #111827;
    --color-blue-500: #3b82f6;
    --color-blue-600: #2563eb;
    --color-blue-700: #1d4ed8;
    --color-green-500: #10b981;
    --color-white: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.3);
    --glass-bg-light: rgba(255, 255, 255, 0.4);
    --glass-bg-medium: rgba(255, 255, 255, 0.5);
    --glass-bg-strong: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(255, 255, 255, 0.6);
    --glass-border-light: rgba(255, 255, 255, 0.4);
    --glass-border-strong: rgba(255, 255, 255, 0.8);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--color-gray-800);
    height: 100vh;
    overflow: hidden;
    line-height: 1.5;
}

.app-container {
    position: fixed;
    inset: 0;
    overflow: hidden;
}

.animated-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.bg-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--color-gray-100), var(--color-gray-200), var(--color-gray-300));
}

.blob {
    position: absolute;
    border-radius: 50%;
    mix-blend-mode: multiply;
    filter: blur(64px);
    animation: blob 7s infinite;
}

.blob-1 {
    top: 25%;
    left: 25%;
    width: 24rem;
    height: 24rem;
    background-color: var(--color-gray-300);
    opacity: 0.4;
}

.blob-2 {
    top: 33%;
    right: 25%;
    width: 24rem;
    height: 24rem;
    background-color: var(--color-gray-400);
    opacity: 0.3;
    animation-delay: 2s;
}

.blob-3 {
    bottom: 25%;
    left: 33%;
    width: 24rem;
    height: 24rem;
    background-color: var(--color-gray-200);
    opacity: 0.35;
    animation-delay: 4s;
}

@keyframes blob {
    0% {
        transform: translate(0px, 0px) scale(1);
    }
    33% {
        transform: translate(30px, -50px) scale(1.1);
    }
    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }
    100% {
        transform: translate(0px, 0px) scale(1);
    }
}

.main-layout {
    position: relative;
    height: 100%;
    display: flex;
    z-index: 1;
}

.sidebar {
    position: relative;
    height: 100%;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    background: var(--glass-bg);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-lg);
    width: 256px;
    overflow: hidden;
}

.sidebar-scroll-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-scroll-container::-webkit-scrollbar {
    width: 4px;
}

.sidebar-scroll-container::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-scroll-container::-webkit-scrollbar-thumb {
    background: var(--color-gray-300);
    border-radius: 4px;
}

.sidebar-scroll-container::-webkit-scrollbar-thumb:hover {
    background: var(--color-gray-400);
}

.sidebar.collapsed {
    width: 64px;
}

.sidebar.collapsed .brand-text,
.sidebar.collapsed .btn-text,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .recent-chats,
.sidebar.collapsed .recent-header {
    display: none;
}

.sidebar.collapsed .chevron-left {
    display: none;
}

.sidebar.collapsed .chevron-right {
    display: block;
}

.chevron-right {
    display: none;
}

.sidebar.collapsed .sidebar-header {
    padding: 12px;
    border-bottom: none;
}

.sidebar.collapsed .sidebar-brand {
    display: none;
}

.sidebar.collapsed .collapse-btn {
    position: static;
    margin: 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: transparent;
}

.sidebar.collapsed .collapse-btn:hover {
    background: var(--glass-bg-medium);
}

.sidebar.collapsed .sidebar-actions {
    padding: 8px 12px;
    border-bottom: none;
}

.sidebar.collapsed .new-chat-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
    border-radius: 10px;
    margin: 0 auto;
}

.sidebar.collapsed .sidebar-nav {
    padding: 8px 12px;
    border-bottom: none;
}

.sidebar.collapsed .nav-item {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
    border-radius: 10px;
    margin: 0 auto 8px;
}

.sidebar.collapsed .nav-item:last-child {
    margin-bottom: 0;
}

.sidebar.collapsed .sidebar-footer {
    padding: 8px 12px 16px;
    margin-top: auto;
    border-top: none;
}

.sidebar.collapsed .settings-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
    border-radius: 10px;
    margin: 0 auto;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.sidebar.collapsed .sidebar-brand {
    justify-content: center;
    margin-bottom: 0;
}

.menu-btn {
    padding: 8px;
    border-radius: 8px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-gray-700);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.menu-btn:hover {
    background: var(--glass-bg-medium);
}

.brand-text {
    font-size: 16px;
    font-weight: 500;
    color: var(--color-gray-800);
}

.collapse-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    padding: 8px;
    border-radius: 8px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-gray-700);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.sidebar.collapsed .collapse-btn {
    position: static;
    margin: 16px auto 0;
}

.collapse-btn:hover {
    background: var(--glass-bg-medium);
}

.sidebar-actions {
    padding: 12px 16px;
    flex-shrink: 0;
}

.sidebar.collapsed .sidebar-actions {
    padding: 8px;
}

.new-chat-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--glass-bg-medium);
    border: 1px solid var(--glass-border-strong);
    cursor: pointer;
    color: var(--color-gray-800);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
    text-decoration: none;
}

.sidebar.collapsed .new-chat-btn {
    justify-content: center;
    padding: 10px;
}

.new-chat-btn:hover {
    background: var(--glass-bg-strong);
}

.sidebar-nav {
    padding: 12px;
    border-bottom: 1px solid var(--glass-border);
}

.nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--color-gray-700);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
    margin-bottom: 4px;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 10px;
}

.nav-item:last-child {
    margin-bottom: 0;
}

.nav-item:hover {
    background: var(--glass-bg-light);
    color: var(--color-gray-900);
}

.nav-item.active {
    background: var(--glass-bg-strong);
    color: var(--color-gray-900);
    box-shadow: var(--shadow-sm);
}

/* Threat Level Glow Effects for War Room Button */
.nav-item.threat-high {
    animation: threatPulseRed 1.5s ease-in-out infinite;
    color: #DC2626;
}

.nav-item.threat-medium {
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.5), 0 0 24px rgba(245, 158, 11, 0.3);
    color: #D97706;
}

@keyframes threatPulseRed {
    0%, 100% {
        box-shadow: 0 0 8px rgba(220, 38, 38, 0.4), 0 0 16px rgba(220, 38, 38, 0.2);
    }
    50% {
        box-shadow: 0 0 16px rgba(220, 38, 38, 0.7), 0 0 32px rgba(220, 38, 38, 0.4), 0 0 48px rgba(220, 38, 38, 0.2);
    }
}

/* Competitor Activity HUD Badge - Black Glassmorphism */
.aggression-hud {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(8, 8, 8, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transition: all 0.3s ease;
    z-index: 10;
}

.aggression-hud-label {
    color: #94A3B8;
    text-transform: uppercase;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.aggression-hud-value {
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.02em;
}

.aggression-hud-value.threat-low {
    color: #10B981;
}

.aggression-hud-value.threat-medium {
    color: #F59E0B;
}

.aggression-hud-value.threat-high {
    color: #DC2626;
    animation: hudPulse 2s ease-in-out infinite;
}

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

.aggression-hud-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #64748B;
    transition: all 0.3s ease;
}

.aggression-hud-dot.threat-low {
    background: #10B981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6), 0 0 16px rgba(16, 185, 129, 0.3);
}

.aggression-hud-dot.threat-medium {
    background: #F59E0B;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.6), 0 0 16px rgba(245, 158, 11, 0.3);
}

.aggression-hud-dot.threat-high {
    background: #DC2626;
    box-shadow: 0 0 8px rgba(220, 38, 38, 0.6), 0 0 16px rgba(220, 38, 38, 0.3);
    animation: dotPulse 1s ease-in-out infinite;
}

@keyframes dotPulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 0 4px rgba(220, 38, 38, 0.5);
    }
    50% { 
        transform: scale(1.2);
        box-shadow: 0 0 8px rgba(220, 38, 38, 0.8);
    }
}

.recent-chats {
    flex: 1;
    padding: 12px;
    min-height: 0;
}

.recent-header {
    padding: 0 8px 8px;
}

.recent-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-gray-500);
    letter-spacing: 0.5px;
}

.chat-history {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--color-gray-700);
    transition: all 0.2s;
    position: relative;
}

.chat-item:hover {
    background: var(--glass-bg-light);
    color: var(--color-gray-900);
}

.chat-item.active {
    background: var(--glass-bg-strong);
    color: var(--color-gray-900);
    box-shadow: var(--shadow-sm);
}

.chat-item-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
}

.chat-item-menu-btn {
    background: none;
    border: none;
    padding: 4px;
    border-radius: 4px;
    cursor: pointer;
    color: var(--color-gray-500);
    opacity: 0;
    transition: opacity 0.2s, background-color 0.2s;
}

.chat-item:hover .chat-item-menu-btn {
    opacity: 1;
}

.chat-item-menu-btn:hover {
    background: var(--glass-bg-medium);
}

.chat-item-dropdown {
    position: absolute;
    right: 8px;
    top: 100%;
    margin-top: 4px;
    background: var(--color-white);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    z-index: 1000;
    overflow: hidden;
    display: none;
}

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

.chat-item-dropdown-item {
    width: 100%;
    padding: 10px 16px;
    background: none;
    border: none;
    text-align: left;
    font-size: 14px;
    color: var(--color-gray-800);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s;
}

.chat-item-dropdown-item:hover {
    background: var(--color-gray-100);
}

.chat-item-dropdown-item.delete {
    color: #dc2626;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--glass-border);
    flex-shrink: 0;
    margin-top: auto;
}

.settings-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-gray-700);
    font-size: 14px;
    transition: all 0.2s;
}

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

.settings-btn:hover {
    background: var(--glass-bg-light);
    color: var(--color-gray-900);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-header {
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    background: var(--glass-bg);
    border-bottom: 1px solid var(--glass-border);
    padding: 16px 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 100;
}

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

.ai-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--glass-bg-strong), var(--glass-bg-light));
    backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    color: var(--color-gray-700);
    overflow: hidden;
}

.ai-avatar-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.header-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.header-title {
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 18px;
    font-weight: 600;
    color: var(--color-gray-800);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.profile-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    border-radius: 50%;
}

.avatar-img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--glass-border-strong);
}

.avatar-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--glass-bg-strong), var(--glass-bg-light));
    backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    color: var(--color-gray-700);
}

.profile-dropdown {
    position: absolute;
    top: 48px;
    right: 0;
    background: var(--color-white);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    min-width: 280px;
    z-index: 10001;
    overflow: hidden;
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
}

.profile-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

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

.profile-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-email {
    font-size: 13px;
    color: var(--color-gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.dropdown-divider {
    height: 1px;
    background: var(--color-gray-200);
}

.dropdown-item {
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    text-align: left;
    font-size: 14px;
    color: var(--color-gray-800);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background-color 0.2s;
}

.dropdown-item:hover {
    background: var(--color-gray-100);
}

.dropdown-item svg {
    color: var(--color-gray-500);
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px 32px;
    display: flex;
    flex-direction: column;
}

.welcome-message {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
}

.welcome-message.hidden {
    display: none;
}

.welcome-gravity-logo {
    width: 140px;
    height: auto;
    margin-bottom: 16px;
    object-fit: contain;
}

.welcome-greeting {
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 32px;
    font-weight: 500;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 25%, #1a1a1a 50%, #3d3d3d 75%, #1a1a1a 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0 0 6px 0;
    letter-spacing: -0.03em;
}

.welcome-subtitle {
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 32px;
    font-weight: 400;
    background: linear-gradient(135deg, #4a4a4a 0%, #6b6b6b 30%, #4a4a4a 60%, #5a5a5a 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    letter-spacing: -0.02em;
}

.message-list {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
}

.message {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    position: relative;
}

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

.message-copy-btn {
    opacity: 0;
    visibility: hidden;
    position: absolute;
    left: -40px;
    top: 8px;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.message:hover .message-copy-btn {
    opacity: 1;
    visibility: visible;
}

.message-copy-btn:hover {
    background: rgba(255, 255, 255, 1);
    color: #374151;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.message-copy-btn.copied {
    color: #10b981;
}

.message-copy-btn svg {
    width: 16px;
    height: 16px;
}

.message.user .message-copy-btn {
    left: auto;
    right: -40px;
}

.message-avatar {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.message.user .message-avatar {
    background: linear-gradient(135deg, rgba(243, 244, 246, 0.6), rgba(255, 255, 255, 0.4));
    border: 1px solid rgba(209, 213, 219, 0.6);
}

.message.ai .message-avatar {
    background: linear-gradient(135deg, rgba(219, 234, 254, 0.8), rgba(239, 246, 255, 0.6));
    border: 1px solid rgba(191, 219, 254, 0.8);
}

.message-avatar svg {
    width: 16px;
    height: 16px;
}

.message.user .message-avatar svg {
    color: #4b5563;
}

.message.ai .message-avatar svg {
    color: #1d4ed8;
}

.message-avatar-logo {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.message-content {
    flex: 1;
    max-width: 80%;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 16px;
    padding: 12px 16px;
    box-shadow: var(--shadow-lg);
}

.message.user .message-content {
    background: linear-gradient(135deg, rgba(249, 250, 251, 0.5), rgba(255, 255, 255, 0.4));
    border: 1px solid rgba(229, 231, 235, 0.7);
    border-top-right-radius: 4px;
}

.message.ai .message-content {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.6));
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-top-left-radius: 4px;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.1), 0 2px 4px -1px rgba(59, 130, 246, 0.06);
}

.message.user .message-content p {
    color: #1f2937;
}

.message.ai .message-content p {
    color: #111827;
}

.message-content p {
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0;
}

.message-content .timestamp {
    font-size: 11px;
    color: var(--color-gray-500);
    margin-top: 8px;
}

.message.ai .message-content a {
    color: var(--color-blue-600);
    text-decoration: none;
}

.message.ai .message-content a:hover {
    text-decoration: underline;
}

.md-content {
    font-size: 15px;
    line-height: 1.7;
    color: #1f2937;
}

.md-paragraph {
    margin: 0 0 16px 0;
    line-height: 1.7;
    white-space: normal;
}

.md-paragraph:last-child {
    margin-bottom: 0;
}

.md-h1 {
    font-size: 1.75em;
    font-weight: 600;
    color: #111827;
    margin: 24px 0 16px 0;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

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

.md-h2 {
    font-size: 1.4em;
    font-weight: 600;
    color: #1f2937;
    margin: 20px 0 12px 0;
    line-height: 1.35;
    letter-spacing: -0.01em;
}

.md-h2:first-child {
    margin-top: 0;
}

.md-h3 {
    font-size: 1.15em;
    font-weight: 600;
    color: #374151;
    margin: 16px 0 10px 0;
    line-height: 1.4;
}

.md-h3:first-child {
    margin-top: 0;
}

.md-h4 {
    font-size: 1em;
    font-weight: 600;
    color: #4b5563;
    margin: 14px 0 8px 0;
    line-height: 1.45;
}

.md-h4:first-child {
    margin-top: 0;
}

.md-ul, .md-ol {
    margin: 12px 0 16px 0;
    padding-left: 24px;
}

.md-ul {
    list-style-type: disc;
}

.md-ol {
    list-style-type: decimal;
}

.md-li {
    margin: 6px 0;
    line-height: 1.6;
    color: #374151;
}

.md-li::marker {
    color: #6b7280;
}

.md-hr {
    border: none;
    height: 1px;
    background: linear-gradient(to right, transparent, #d1d5db, transparent);
    margin: 20px 0;
}

.md-blockquote {
    margin: 16px 0;
    padding: 12px 16px;
    border-left: 3px solid #3b82f6;
    background: rgba(59, 130, 246, 0.05);
    border-radius: 0 8px 8px 0;
    color: #4b5563;
    font-style: italic;
}

.md-inline-code {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
    font-size: 0.9em;
    background: rgba(0, 0, 0, 0.06);
    padding: 2px 6px;
    border-radius: 4px;
    color: #dc2626;
}

.md-content strong {
    font-weight: 600;
    color: #111827;
}

.md-content em {
    font-style: italic;
    color: #4b5563;
}

.typing-indicator-container {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.typing-indicator {
    display: flex;
    gap: 4px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--color-gray-600);
    animation: bounce 1s infinite;
}

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

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

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

.input-area {
    padding: 16px 24px 24px;
    border-top: 1px solid var(--glass-border);
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: var(--shadow-sm);
}

.company-selector-wrapper {
    max-width: 900px;
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.company-selector-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-gray-600);
}

.company-selector {
    padding: 8px 12px;
    border: 1px solid var(--glass-border-strong);
    border-radius: 8px;
    background: var(--glass-bg-medium);
    color: var(--color-gray-700);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
    min-width: 180px;
}

.company-selector:hover {
    border-color: var(--color-blue-500);
}

.company-selector:focus {
    border-color: var(--color-blue-500);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.input-wrapper {
    max-width: 900px;
    margin: 0 auto;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    background: var(--glass-bg-medium);
    border-radius: 16px;
    border: 1px solid var(--glass-border-strong);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 8px;
    transition: all 0.2s;
}

.input-wrapper:focus-within {
    border-color: var(--glass-border-strong);
    box-shadow: var(--shadow-lg), 0 0 0 2px rgba(255, 255, 255, 0.2);
}

.attach-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: var(--glass-bg-medium);
    backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border-strong);
    cursor: pointer;
    color: var(--color-gray-700);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.attach-btn:hover {
    background: var(--glass-bg-strong);
}

#messageInput {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-size: 14px;
    padding: 8px;
    color: var(--color-gray-800);
    font-family: inherit;
    min-height: 36px;
}

#messageInput::placeholder {
    color: var(--color-gray-400);
}

.send-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: rgba(8, 8, 8, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    color: var(--color-white);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.send-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.send-btn:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
}

.send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: var(--glass-bg-light);
}

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

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

::-webkit-scrollbar-thumb {
    background: var(--color-gray-300);
    border-radius: 4px;
}

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

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--color-white);
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
    animation: slideIn 0.3s ease;
}

.toast.error {
    border-left: 4px solid #dc2626;
}

.toast.success {
    border-left: 4px solid #16a34a;
}

.toast.warning {
    border-left: 4px solid #ea580c;
}

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

.toast-message {
    flex: 1;
    font-size: 14px;
    color: var(--color-gray-700);
}

.toast-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--color-gray-400);
    padding: 0;
}

.toast-close:hover {
    color: var(--color-gray-700);
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.spinner {
    border: 3px solid var(--color-gray-200);
    border-top: 3px solid var(--color-blue-600);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

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

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    animation: floatBob 2s ease-in-out infinite;
}

.loading-spinner img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

@keyframes floatBob {
    0%, 100% {
        transform: translateY(0);
    }
    25% {
        transform: translateY(-8px);
    }
    50% {
        transform: translateY(-12px);
    }
    75% {
        transform: translateY(-6px);
    }
}

.syncing-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    color: #6b7280;
    font-size: 14px;
}

.syncing-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: syncSpin 0.8s linear infinite;
}

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

.reconnect-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 60px 40px;
    text-align: center;
}

.reconnect-icon {
    font-size: 48px;
    color: #f59e0b;
}

.reconnect-message {
    font-size: 16px;
    color: #374151;
    font-weight: 500;
}

.reconnect-button {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.reconnect-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.reconnect-button:active {
    transform: translateY(0);
}

.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 10px 0;
    font-size: 14px;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.message-title {
    font-weight: 600;
    font-size: 16px;
    color: var(--color-gray-800);
    margin-bottom: 8px;
}

.message-note {
    font-size: 14px;
    color: var(--color-gray-600);
    margin-bottom: 16px;
    line-height: 1.6;
}

.empty-state {
    color: var(--color-gray-400);
    font-size: 14px;
    font-style: italic;
    padding: 20px;
    text-align: center;
    background: var(--glass-bg-light);
    border-radius: 12px;
    margin: 12px 0;
}

.chart-wrapper {
    margin: 16px 0;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 0 1px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.chart-header {
    padding: 20px 24px 0;
}

.chart-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--color-gray-800);
    margin-bottom: 4px;
    line-height: 1.3;
}

.chart-subtitle {
    font-size: 13px;
    color: var(--color-gray-500);
    font-weight: 400;
}

.chart-container {
    position: relative;
    height: 280px;
    padding: 16px 24px 24px;
}

.table-wrapper {
    margin: 16px 0;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 0 1px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.table-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--color-gray-800);
    padding: 20px 24px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table thead {
    background: rgba(248, 250, 252, 0.8);
}

.data-table th {
    padding: 14px 20px;
    text-align: left;
    font-weight: 600;
    color: var(--color-gray-700);
    font-size: 13px;
    letter-spacing: 0.01em;
    white-space: nowrap;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.data-table th:first-child {
    padding-left: 24px;
}

.data-table th:last-child {
    padding-right: 24px;
}

.data-table tbody {
    background: transparent;
}

.data-table td {
    padding: 12px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    color: var(--color-gray-700);
    font-size: 14px;
    vertical-align: middle;
}

.data-table td:first-child {
    padding-left: 24px;
    font-weight: 500;
    color: var(--color-gray-800);
}

.data-table td:last-child {
    padding-right: 24px;
}

.data-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.03);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table td a,
.table-link {
    color: var(--color-blue-600);
    text-decoration: none;
    word-break: break-all;
}

.data-table td a:hover,
.table-link:hover {
    color: var(--color-blue-700);
    text-decoration: underline;
}

.truncated-text-cell {
    display: inline;
    line-height: 1.5;
}

.truncated-text,
.full-text {
    line-height: 1.5;
}

.text-expand-btn {
    background: none;
    border: none;
    color: var(--color-blue-600);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    padding: 0;
    margin-left: 4px;
}

.text-expand-btn:hover {
    color: var(--color-blue-700);
    text-decoration: underline;
}

.table-image-cell {
    display: flex;
    align-items: center;
}

.table-image-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.table-image-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.table-image-thumb:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.table-image-placeholder {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 6px;
    color: var(--color-gray-400);
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

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

.status-dot.status-green {
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

.status-dot.status-yellow {
    background: #eab308;
    box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.15);
}

.status-dot.status-red {
    background: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.status-dot.status-blue {
    background: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.status-dot.status-gray {
    background: #9ca3af;
    box-shadow: 0 0 0 3px rgba(156, 163, 175, 0.15);
}

.growth-positive {
    color: #16a34a;
    font-weight: 500;
}

.growth-negative {
    color: #dc2626;
    font-weight: 500;
}

.media-gallery {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 16px 0;
}

.media-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 0 1px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.media-image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16/10;
    overflow: hidden;
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
}

.media-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.media-card:hover .media-image {
    transform: scale(1.02);
}

.media-caption {
    padding: 16px 20px;
    text-align: center;
    font-size: 14px;
    color: var(--color-blue-600);
    font-weight: 500;
    border-top: 1px solid rgba(0, 0, 0, 0.04);
}

.media-placeholder {
    width: 100%;
    aspect-ratio: 16/10;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-placeholder-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px;
}

.media-placeholder-icon {
    width: 64px;
    height: 64px;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-placeholder-icon svg {
    width: 32px;
    height: 32px;
    color: var(--color-blue-500);
}

.media-placeholder-text {
    color: var(--color-gray-500);
    font-size: 14px;
    font-weight: 500;
    text-align: center;
}

.typing-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background-color: var(--color-gray-800);
    margin-left: 2px;
    animation: blink 1s infinite;
    vertical-align: text-bottom;
}

@keyframes blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

.thinking-text {
    color: var(--color-gray-500);
    font-size: 14px;
    font-style: normal;
    line-height: 1.4;
    animation: fadeIn 0.5s ease-in;
}

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

/* Mobile menu toggle button - visible only on mobile */
.mobile-menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--glass-bg-medium);
    border: 1px solid var(--glass-border-strong);
    cursor: pointer;
    color: var(--color-gray-700);
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.mobile-menu-toggle:hover {
    background: var(--glass-bg-strong);
}

/* Mobile overlay for sidebar - light overlay to preserve glass effect */
.mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.3);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

@media (max-width: 768px) {
    /* Show mobile menu toggle */
    .mobile-menu-toggle {
        display: flex;
    }
    
    /* Show overlay when sidebar is open */
    .mobile-overlay.visible {
        display: block;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 100;
        transform: translateX(-100%);
        width: 280px;
        /* Use same glass styling as desktop */
        background: var(--glass-bg);
        backdrop-filter: blur(24px);
        -webkit-backdrop-filter: blur(24px);
        border-right: 1px solid var(--glass-border);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
        /* Extra top padding to ensure content doesn't get clipped */
        padding-top: max(16px, env(safe-area-inset-top, 16px));
    }

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

    .sidebar.collapsed {
        width: 280px;
        transform: translateX(-100%);
    }
    
    .sidebar.collapsed.open {
        transform: translateX(0);
    }
    
    /* Hide collapse button on mobile - use menu toggle instead */
    .sidebar .collapse-btn {
        display: none;
    }
    
    /* Show all text in mobile sidebar even if collapsed */
    .sidebar.collapsed .brand-text,
    .sidebar.collapsed .btn-text,
    .sidebar.collapsed .nav-text,
    .sidebar.collapsed .recent-chats,
    .sidebar.collapsed .recent-header {
        display: block;
    }
    
    .sidebar.collapsed .sidebar-brand {
        display: flex;
    }
    
    .sidebar.collapsed .new-chat-btn {
        width: 100%;
        justify-content: flex-start;
        padding: 10px 12px;
    }
    
    .sidebar.collapsed .nav-item {
        width: 100%;
        justify-content: flex-start;
        padding: 10px 12px;
    }
    
    .sidebar.collapsed .settings-btn {
        width: 100%;
        justify-content: flex-start;
        padding: 10px 12px;
    }
    
    /* Mobile sidebar polish */
    .sidebar-header {
        padding: 16px;
        border-bottom: 1px solid var(--glass-border);
    }
    
    .sidebar-actions {
        padding: 16px;
        margin-top: 4px;
        border-bottom: 1px solid var(--glass-border);
    }
    
    .new-chat-btn {
        width: 100%;
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .sidebar-nav {
        padding: 8px 12px;
    }
    
    .nav-item {
        padding: 14px 16px;
        min-height: 48px;
        font-size: 14px;
    }
    
    .recent-chats {
        padding: 8px 12px;
    }
    
    .chat-item {
        padding: 12px 16px;
        min-height: 44px;
    }
    
    .settings-btn {
        padding: 14px 16px;
        min-height: 48px;
    }

    .chat-header {
        padding: 12px 16px;
    }
    
    /* Reposition header elements for mobile */
    .chat-header .header-left {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    /* Hide aggression HUD in header-left on mobile - show below header instead */
    .chat-header .aggression-hud {
        position: static;
        transform: none;
        order: 10;
        width: 100%;
        justify-content: center;
        margin-top: 8px;
    }
    
    /* Adjust header title size for mobile */
    .header-title {
        font-size: 16px;
    }

    .chat-container {
        padding: 16px;
        overflow-x: hidden;
    }
    
    /* Prevent horizontal scroll in messages */
    .message-list {
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .message-content {
        max-width: 85%;
        overflow-x: hidden;
        word-break: break-word;
    }
    
    /* Allow tables inside messages to scroll horizontally */
    .message-content .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .input-area {
        padding: 12px 16px 20px;
    }

    .table-wrapper {
        margin: 12px 0;
        border-radius: 12px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-title {
        font-size: 15px;
        padding: 16px 16px 12px;
    }

    .data-table {
        min-width: 500px;
    }

    .data-table th {
        padding: 10px 12px;
        font-size: 12px;
    }

    .data-table th:first-child {
        padding-left: 16px;
    }

    .data-table th:last-child {
        padding-right: 16px;
    }

    .data-table td {
        padding: 12px;
        font-size: 13px;
    }

    .data-table td:first-child {
        padding-left: 16px;
    }

    .data-table td:last-child {
        padding-right: 16px;
    }

    .status-indicator {
        gap: 6px;
        font-size: 12px;
    }

    .status-dot {
        width: 8px;
        height: 8px;
    }

    .chart-wrapper {
        margin: 12px 0;
        border-radius: 12px;
    }

    .chart-header {
        padding: 16px 16px 0;
    }

    .chart-title {
        font-size: 15px;
    }

    .chart-subtitle {
        font-size: 12px;
    }

    .chart-container {
        height: 220px;
        padding: 12px 16px 16px;
    }

    .media-gallery {
        margin: 12px 0;
        gap: 12px;
    }

    .media-card {
        border-radius: 12px;
    }

    .media-image-container {
        aspect-ratio: 16/9;
    }

    .media-caption {
        padding: 12px 16px;
        font-size: 13px;
    }

    .media-placeholder-icon {
        width: 48px;
        height: 48px;
        border-radius: 12px;
    }

    .media-placeholder-icon svg {
        width: 24px;
        height: 24px;
    }

    .media-placeholder-text {
        font-size: 13px;
    }
    
    /* Welcome message adjustments */
    .welcome-greeting,
    .welcome-subtitle {
        font-size: 24px;
    }
    
    .welcome-gravity-logo {
        width: 100px;
    }
}

@media (max-width: 480px) {
    .data-table {
        font-size: 12px;
    }

    .data-table th,
    .data-table td {
        padding: 10px 8px;
    }

    .data-table th:first-child,
    .data-table td:first-child {
        padding-left: 12px;
    }

    .data-table th:last-child,
    .data-table td:last-child {
        padding-right: 12px;
    }

    .table-title {
        font-size: 14px;
        padding: 14px 12px 10px;
    }

    .chart-container {
        height: 180px;
    }

    .chart-title {
        font-size: 14px;
    }

    .table-image-thumb {
        width: 36px;
        height: 36px;
    }

    .table-image-placeholder {
        width: 36px;
        height: 36px;
    }

    .text-expand-btn {
        font-size: 12px;
    }
}

.company-with-logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.company-logo {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    object-fit: contain;
    flex-shrink: 0;
    background: #f3f4f6;
}

.company-logo-fallback {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.company-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.table-company-cell {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.table-company-logo {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    object-fit: contain;
    flex-shrink: 0;
    background: #f3f4f6;
}

.table-company-fallback {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.table-company-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.competitor-avatar-logo {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: contain;
    flex-shrink: 0;
    background: #f3f4f6;
}

.ad-brand-logo-img {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    object-fit: contain;
    flex-shrink: 0;
    background: #f3f4f6;
}

.insights-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(249, 250, 251, 0.95));
    border: 1px solid rgba(229, 231, 235, 0.8);
    border-radius: 12px;
    padding: 20px 24px;
    margin: 8px 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

.insights-title {
    font-size: 1.15em;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 12px 0;
    line-height: 1.4;
}

.insights-summary {
    font-size: 14px;
    line-height: 1.7;
    color: #4b5563;
    margin: 0 0 16px 0;
}

.insights-key-points {
    list-style: disc;
    padding-left: 20px;
    margin: 0 0 16px 0;
}

.insights-key-points li {
    font-size: 14px;
    line-height: 1.7;
    color: #374151;
    margin-bottom: 8px;
}

.insights-key-points li:last-child {
    margin-bottom: 0;
}

.insights-key-points li strong {
    color: #1f2937;
    font-weight: 600;
}

.insights-recommendations-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(229, 231, 235, 0.6);
}

.insights-recommendations-header {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 12px 0;
}

.insights-recommendations-list {
    list-style: disc;
    padding-left: 20px;
    margin: 0;
}

.insights-recommendations-list li {
    font-size: 14px;
    line-height: 1.7;
    color: #374151;
    margin-bottom: 6px;
}

.insights-recommendations-list li:last-child {
    margin-bottom: 0;
}

.insights-note {
    font-size: 12px;
    font-style: italic;
    color: #6b7280;
    margin: 16px 0 0 0;
    padding-top: 12px;
    border-top: 1px solid rgba(229, 231, 235, 0.4);
}
